gdb

gcc/gdb: How to embed absolute path to source file in debug information?

hello. i am just wondering if i can tell gcc to embed the absolute path to a source file in the debug information, even if i call gcc like gcc -g ../src/somecode.c -o ../bin/somecode.o as i see it atm, gcc just stores what you provide, so if you provide a relative path, at the end, gdb only knows the relative path as well. is there ...

How to get GNU AS to emit per-line debugging info or GDB to single step lines in (AVR) Assembly?

I cannot figure out how to get GAS to emit line number debugging information for gdb in assembly. Note that I'm using the avr-gcc cross compiler, but doubt that is relevant. I'm using the following command line options to assemble: avr-gcc -g -ggdb -Os -mmcu=atmega644 -ffunction-sections -fsigned-char -Winvalid-pch -Wall -Wno-long-lo...

Break execution loop inside gdb

Hello! I need to debug the program with gdb (the program itself is Qt GUI program compiled with MinGW). Particularly, program hangs at some points and I need to examine call stack. But pressing Ctrl+C seems to behave strangely -- at some points not working at all. For example, if program shows a dialog box, and I press Ctrl+C, gdb does n...

Debug DLL's under Windows with GDB

Hello! I have some project consisting of a couple of DLL's which have been compiled with MinGW with debug information, and another project with EXE target which uses these DLLs (compiled with MinGW too). The problem is, I need to put breakpoints on functions inside those DLLs, but GDB, although sets them, just silently ignores them at ...

strategies to fix runtime errors

Hi, I was wondering what strategies you guys are using to fix runtime errors? Really appreciate if you could share some tips! Here is some of my thought (possibly with the help of gdb): when runtime error happens because some memory is wrongly accessed, is the address stored in the dumped core showing where the memory is? If I can fi...

can't step into c++ program pixel city in netbeans on ubuntu

I'm using NetBeans 6.7 on Ubuntu, and I downloaded a linux port of shamus young's pixel city, http://github.com/BryanKadzban/pixelcity/tree/master but I can't step into it (it compiles and builds and runs fine (a little slow but fine)). I can step into a c++ sample project in netbeans which seems to mean that gdb is working properly. ...

help with gdb traces (or similar)

I have an application. I have the source code (in C). I can compile it anyway I want. Add whatever tool I want to it. Etc. However, I do not want to pepper the source code with a bunch of printf's. I want to be able to produce a log of some sort that shows when a particular value (some member of a global structure for example) is written...

How can I debug a program using scanf with ddd?

When ddd encounters a scanf statement, it displays "Waiting until GDB gets ready" message. The debugging activity stops here. Please guide me of overcoming this bug. I'm using an amd64 athlon processor. ...

Debugging/tracing inside a shared library during runtime?

Hello everyone, I'm trying to understand how a certain library works. I've compiled it with my added prinfts and everything is great. Now I want to stop the example program during runtime to look at the call stack, but I can't quite figure out how to do it with gdb. The function I want to break on, is inside a shared library. I've revie...

Find info from address in debugging

Hi, I am learning to solve some runtime error with gdb. Here are my questions: when runtime error happens because some access operations of some memory is conflicted, can I find out in the dumped core the address of that memory? Given an address, is it possible to find out which variable is using it (the address may be at the begining...

C : gdb behavior : value optimized out

Can anyone explain this behavior of gdb :- 900 memset(&new_ckpt_info,'\0',sizeof(CKPT_INFO)); (gdb) **903 prev_offset = cp_node->offset;** (gdb) **905 m_CPND_CKPTINFO_READ(ckpt_info,(char *)cb->shm_addr.ckpt_addr+sizeof(CKPT_** HDR),i_offset); (gdb) **903 prev_offset = cp_node->offset;** (gdb) **905 ...

Need help attaching gdb to my project

I use VS2k8 to write and compile (but not run) a program using the MPICH2 libraries on Vista x64. I then use mpiexec from the command line to launch the program (with only 1 process for the purposes of debugging), and I'd like to attach gdb to it. Simply using attach or gdb --pid=### doesn't work (I get the error Can't attach to process)...

watchpoint in GDB

Hi, If I set a watchpoint for a variable local to the current scope, it will be auto deleted when going out of the scope. Is there any way to set it once and keep it auto alive whenever entering the same scope? Is there anyway to set conditional watchpoint, like "watch var1 if var1==0"? In my case, the condition does't work. gdb stops ...

gdb evaluation of a function

Hi, I wonder why evaluate function doesn't work in gdb? In my source file I include, when debugging in gdb, these examples are wrongly evaludations. (gdb) p pow(3,2) $10 = 1 (gdb) p pow(3,3) $11 = 1 (gdb) p sqrt(9) $12 = 0 Thanks and regards! ...

Get instruction pointer of running application on Unix

Is there a way to get the instruction pointer of a running application Unix? I have a running process (C++) and want to get its current location, and thereafter in GDB (on a different machine) map the location to source location ('list' command). ...

print in Xcode GDB with C++ doesn't print correct values

I'm writing/debugging an iPhone project that uses a large portion of C++ for image processing. I'm having trouble when I'm using gdb under Xcode because whenever I print values, they are completely out of whack with the true values (comparing cout << "width" << width << endl; prints out 320, and if I do a print width in gdb, I g...

Qt question: Can you use the standard GDB debugger with Qt executables?

I just started using Qt and I wanted to debug my Qt application. Can I use the standard GDB debugger with Qt executables? ...

Xcode 3.2 + LLVM = no local symbols when debugging

I have a project for Mac OS X 10.5 that I'm building on 10.6 using Xcode 3.2. When I use GCC 4.2 for Debug build and hit a breakpoint, Xcode debugger displays local variable information normally. If I choose LLVM GCC 4.2 or Clang LLVM, when I hit breakpoint, local symbols are not available, and GDB says No symbol 'self' in current contex...

Is it possible to set a conditional breakpoint at the end of a function based on what the function is about to return?

I have a more complicated version of the following: unsigned int foo (); unsigned int bar (); unsigned int myFunc () { return foo()+bar(); } In my case, myFunc is called from lots of places. In one of the contexts there is something going wrong. I know from debugging further down what the return value of this function is when thi...

Help interpreting gdb: segfault in function

I am trying to debug a segfault, and I have this output from gdb: (gdb) n Program received signal SIGSEGV, Segmentation fault. 0x08048af9 in parse_option_list (ptr=0x6f72505f <Address 0x6f72505f out of bounds>, box_name=0x696d6978 <Address 0x696d6978 out of bounds>, option_list=0x313a7974, num_elements=0x33313532) at submit.c:125 ...