Author Topic: GDB troubles  (Read 5765 times)

sebarnolds

  • Guest
GDB troubles
« on: August 10, 2005, 08:56:21 am »
Hi !

Here is my situation : I have a workspace with several projects (DLLS and one exe). Some DLLs contains base classes (which are abstract because of pure virtual functions) and some other DLLs contains classes which inherit from these base classes.

Now, how can I tell GDB to use all the symbol files (it seems he only loads the symbols of the current project).

Besides, if I put a breakpoint in my sourcecode, it doesn't manage to stop on that line (I'm sure it reaches it), it is as if no breakpoint was set. I tried on a small project with only one source file and the breakpoint works, but I want it to work with my projects. I uninstalled codeblocks and mingw and installed lastest version (which included mingw), but it doesn't seem to make any change.

Any advice ?

Thanks.

grv575

  • Guest
Re: GDB troubles
« Reply #1 on: August 10, 2005, 11:06:17 am »
1.  compile all dlls with debugging symbols
2. add all dll project .lib files to the exe project link libraries tab

that work or no?

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: GDB troubles
« Reply #2 on: August 10, 2005, 02:40:15 pm »
..I put a breakpoint in my sourcecode, it doesn't manage to stop on that line...
this happens (unfortunately) very often when using gdb
Quote
Any advice ?
one technique which works sometimes is to set a breakpoint in the dllhelper and start debugging.
when gdb breaks in the dllhelper, the go to the source file of the dll and set the breakpoint there
and continue debugging.
or you can compile "a HARD breakpoint" into you code
Code
__asm("int3");

attached is a sample project rename it to "debug_dlls.zip",
its an ordinary zip file, but the forum software
doesn't allow to post *.zip's therefore its renambed to *.txt
open "debug_dlls.workspace" and do Compile->Rebuild All Projects
and then start a debugging session "F8"

[attachment deleted by admin]

sebarnolds

  • Guest
Re: GDB troubles
« Reply #3 on: August 11, 2005, 08:54:34 pm »
Hi !

grv575 >> Thanks but I already checked the debugging symbols. I will try your second advice.
tiwag >> Thanks, I will check this file out.

Thanks for your help.

sebarnolds

  • Guest
Re: GDB troubles
« Reply #4 on: August 19, 2005, 02:50:46 pm »
Yeah, I looked at it and finally, I think I will use the hard-coded version, it seems to work well.

Now, another problem : I have a class in a DLL which inherits from a class in another DLL. GDB isn't able to display the values of inherited members.

Here is a sample :
Code
class A
{
protected :
   int a;
};

class B : public A
{
public :
   int b;
}

For an instance of B, GDB is able to display the value of "b" but not the value of "a" (in the "watches" panel).

Any idea ? Thanks.