gdb

Using Valgrind tool how can I detect which object trying to access 0x0 address ?

I have this output when trying to debug Program received signal SIGSEGV, Segmentation fault 0x43989029 in std::string::compare (this=0x88fd430, __str=@0xbfff9060) at /home/devsw/tmp/objdir/i686-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:253 253 { return memcmp(__s1, __s2, __n); } Current language: auto; currently ...

Add functions in gdb at runtime

I'm trying to debug some STL based C++ code in gdb. The code has something like int myfunc() { std::map<int,int> m; ... } Now in gdb, inside myfunc using "print m" gives something very ugly. What I've seen recommended is compiling something like void printmap( std::map<int,int> m ) { for( std::map<int,int>::iterator it = .....

How do I debug a crash when I run my garbage-collected app in Rosetta?

I have a Universal app which is targeting 10.5 and which uses garbage collection. I am building for ppc, i386 and x86_64. I don't have access to a physical PowerPC machine so I am trying to use Rosetta to confirm that the PowerPC portion of the app works correctly. However, as soon as the app is launched in Rosetta it immediately crash...

Are "EXC_BREAKPOINT (SIGTRAP)" exceptions caused by debugging breakpoints?

I have a multithreaded app that is very stable on all my test machines and seems to be stable for almost every one of my users (based on no complaints of crashes). The app crashes frequently for one user, though, who was kind enough to send crash reports. All the crash reports (~10 consecutive reports) look essentially identical: Date...

Low level qemu based debugging

I've to test some low level code on an ARM architecture. Typically experimentation is quite complicated on the real board, so I was thinking about QEMU. What I'd like to get is some kind of debugging information like printfs or gdb. I know that this is simple with linux since it implements both the device driver for the QEMU Integrator ...

gdb print won't print out something readable from my char array

i have a char buffer[100] and i'm trying to use gdb to read the contents out of it at various stages of runtime. i use p buffer and i get "/*\000\000\000\000\000\000????X?o\000\025\202\004\b", '\0' <repeats 12 times>, ".N=?", '\0' <repeats 24 times>, "`\203\004\b\000\000\000\000L\227\004\bX????\202\004\b?\017\204\000\f?\203\000\210???...

Debug the PHP interpreter with GDB.

I would like to use GDB to step though the C++ code that makes up the php.so Apache extension. I want to see what PHP is doing while it's running a PHP application. Preferably I would use an IDE like Netbeans or Eclipse on a LAMP system. ...

gdb - thread log

Hi all, While I trying to debug a 'C' program with gdb, I always get the following continuously on the gdb console. [Thread 0xb7fe4b70 (LWP 30576) exited] [New Thread 0xb7fe4b70 (LWP 30577)] [Thread 0xb7fe4b70 (LWP 30577) exited] [New Thread 0xb7fe4b70 (LWP 30578)] [Thread 0xb7fe4b70 (LWP 30578) exited] Is there any reason why this is...

gdb: getting into a dictionary

hi, i saw this post today: http://stackoverflow.com/questions/112796/how-to-view-contents-of-nsdictionary-variable-in-xcode-debugger. i need to see the contents of a dictonary but i only know the "key"...is there a way i can spit out the details like a print_r in php? po gives me the object, but i would like to go deeper po 0x2027c0 NS...

how to set breakpoint on function in a shared library which has not been loaded in gdb

Hi, I have a shared library libtest.so which will be loaded into the the main program using dlopen. Function test() reside in libtest.so and will be called in the main program through dlsym. Is there any way I could set up a break point on test? Please note that the main programm has not been linked to libtest.so during linking time....

gdb : multithreading

Hi, I have a program which uses two threads. I have put the break point in both the threads. While running the program under gdb I want to switch between the threads and make them run. (thread t1 is active and running and thread t2; when paused on the breakpoint. I want to stop T1 running and run the T2). Is there any way that I can sc...

Cannot enter input with gdb. Help!

Hi, all. I've been having a tough time entering input with gdb using XCode or Eclipse. Every time the debugger hits std::cin, it looks like its waiting for input, but fails to accept it. I've scoured the internet for more information, but am having trouble finding anything. What do I need to do to get cin to work with gdb? For referen...

How to find which thread caused SEGFAULT in a post-mortem gdb session?

Hi, In my application I handle SIGSEG to produce a backtrace and call abort() to generate a core dump. If I now run a gdb-post-mortem analysis of the core, the thread which caused the SEGFAULT is no longer visible. Is there anything I can do so I see the cause for the SEGFAULT? Best regards, Martin ...

Debugger in an iPhone app session not launched from tapping a springboard icon

I'm trying to debug an issue that only occurs when my iPhone app receives a push notification. The trouble is I can't figure out how to get a debugger, or even view any NSLog output, when my app is launched in this way. Xcode gives me a debugger and the gdb console when it launches an app for me. So how do I run my app in the debugger...

Program execution stop at scanf???

main.c (with all the headers like stdio, stdlib, etc): int main() { int input; while(1) { printf("\n"); printf("\n1. Add new node"); printf("\n2. Delete existing node"); printf("\n3. Print all data"); printf("\n4. Exit"); printf("Enter your option -> "); scanf("%d", &input); string key = ""; string ...

Can my app arrange a gdb breakpoint or watch?

Is there a way for my code to be instrumented to insert a break point or watch on a memory location that will be honored by gdb? (And presumably have no effect when gdb is not attached.) I know how to do such things as gdb commands within the gdb session, but for certain types of debugging it would be really handy to do it "programma...

debug boost::thread with gdb, code::blocks

I am running in a little bit of a trouble with boost threads ... I am using gdb with code::blocks and everytime I set a breakpoint in the thread code it breaks in the boost thread.hpp file, more exactly in this function (that probably launches the thread) namespace boost namespace detail class thread_data: void r...

Emacs gud raising prefix key error

I'm trying to debug code in Emacs but when I try either M-x gdb or M-x pdb, I get this error: global-set-key: Key sequence C-x C-a C-l starts with non-prefix key C-x C-a This is most likely coming from this bit in gud.el: (defcustom gud-key-prefix "\C-x\C-a" "Prefix of all GUD commands valid in C buffers." :type 'string :group ...

how to print std::map value in gdb

Hi all I have a std::map< std::string, std::string> cont; I want to see cont[ "some_key" ] in gdb. When I'm trying p cont[ "some_ket" ] I'm getting this message: One of the arguments you tried to pass to operator[] could not be converted to what the function wants. I'm using GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh). Thanks ...

GDB doesnt like my typedef

It seems that the following is to deep for the debugger in Qt even though the program uses it without problem typedef QMap <int, QStringList> day2FileNameType; typedef QMap <int, day2FileNameType> month2day2FileNameType; typedef QMap <int, month2day2FileNameType> year2month2day2FileNameType; year2month2day2FileNameType y2m2d2f; now t...