www.digitalmars.com         C & C++   DMDScript  

c++.beta - get it working with GDB?

reply yakov <yakov_member pathlink.com> writes:
I know you work forever with WinDBG symbol format, this was very modern an
dpowerful some years ago (maybe 10 years ago). But now it is simply not so cool
as other debuggers around. I mean GDB. IS there any chance to get DMC++ compiled
programs to work with GDB? Maybe some kind of option to OPTLINK? Or a converter
of symbol file? Or maybe it might be possible to switch to ld.exe linker from
"gnu binutils"? I tried last option but .obj files are not recognized by ld. I
know that yoube you are happy with windbg since you know it well for many years,
but for me, and as I can suggest by many others WinDBG is no good at all. Having
support for GDB is quite cool because so many moder IDEs use GDB as a backend
for their debugging facilites. Once you have GDB symbols in the EXE your
compiler will be much more used by people! Because it's compatibility with
existiong c++ source code is great and compile times are fastest in the world.
But without the support for a debugger other than your own IDE and WinDBG it is
of a little use. 

yashka at exebook dot com
Sep 22 2004
parent reply Scott Michel <scottm aero.org> writes:
There are probably a couple of ways I can think of where you might be 
personally able to help with this "problem":

(a) Hack libbfd to read/write OMF debugging information.
(b) Hack Eclipse's CDT module to read/write managed build projects for
     DMC.

The easier of these two projects is hacking libbfd. There's likely to be 
OMF file format support already, since that was the format SCO used many 
years ago in their Unix before they switched over to COFF and then ELF. 
I'd guess that all you'd have to do is recompile the Cygwin or MinGW 
tools with OMF support turned on (in addition to PE) and debug as needed.

I don't think you're going to convince Walter to suddenly convert the 
debug output to STABS or GSTABS (which is produced by the compiler, not 
the linker, BTW.) STABS and GSTABS is a variant of an older BSD 
debugging format, but then again, don't the Linux kiddies keep saying 
BSD is dead?


-scooter

yakov wrote:
 I know you work forever with WinDBG symbol format, this was very modern an
 dpowerful some years ago (maybe 10 years ago). But now it is simply not so cool
 as other debuggers around. I mean GDB. IS there any chance to get DMC++
compiled
 programs to work with GDB? Maybe some kind of option to OPTLINK? Or a converter
 of symbol file? Or maybe it might be possible to switch to ld.exe linker from
 "gnu binutils"? I tried last option but .obj files are not recognized by ld. I
 know that yoube you are happy with windbg since you know it well for many
years,
 but for me, and as I can suggest by many others WinDBG is no good at all.
Having
 support for GDB is quite cool because so many moder IDEs use GDB as a backend
 for their debugging facilites. Once you have GDB symbols in the EXE your
 compiler will be much more used by people! Because it's compatibility with
 existiong c++ source code is great and compile times are fastest in the world.
 But without the support for a debugger other than your own IDE and WinDBG it is
 of a little use. 
 
 yashka at exebook dot com

Sep 23 2004
parent reply Jerry van Dijk <jerry jvdsys.demon.nl> writes:
Scott Michel <scottm aero.org> writes:

 The easier of these two projects is hacking libbfd. There's likely to be OMF
 file format support already, since that was the format SCO used many years ago
 in their Unix before they switched over to COFF and then ELF. I'd guess that
 all you'd have to do is recompile the Cygwin or MinGW tools with OMF support
 turned on (in addition to PE) and debug as needed.

I have also been thinking along these lines, but I would think that the real problem would not be reading OMF but the fact that a) symbol information is in some old CodeView format and b) as usual name mangling. But maybe you have better info ? -- -- Jerry van Dijk -- Leiden, Holland
Sep 24 2004
parent reply Scott Michel <scottm aero.org> writes:
Jerry van Dijk wrote:

 Scott Michel <scottm aero.org> writes:
 
 
The easier of these two projects is hacking libbfd. There's likely to be OMF
file format support already, since that was the format SCO used many years ago
in their Unix before they switched over to COFF and then ELF. I'd guess that
all you'd have to do is recompile the Cygwin or MinGW tools with OMF support
turned on (in addition to PE) and debug as needed.

I have also been thinking along these lines, but I would think that the real problem would not be reading OMF but the fact that a) symbol information is in some old CodeView format and b) as usual name mangling. But maybe you have better info ?

Doing a little bit of research, it looks like OMF object file format got dropped from binutils. It doesn't look terribly hard to hack into binutils; it's SMOP. Documents are pretty easy to find. The more difficult part is going to be hunting down the CV4 debug format. This isn't impossible, but it might just require a little bit of hacking to make it work.
Sep 24 2004
parent reply Yakov <Yakov_member pathlink.com> writes:
Thank you guys for responding.
Even before I wrote here, I was looking into GDB sources to understand how it
handles symbols from the program binary. I guess it is too much for me to deal
with. Of course I could manage that, but it might take ages of man-hours for me,
since I am not familiar with the internals of GDB nor DMC.
But I still think there is a realtively easy way around this. GDB has a nice
feature of loading symbols from external file. Even without patching GDB, itis
possible to create nice utility "dmcgdb" that will extract symbol info from the
executable, convert it to gdbsymbols and write to file, which can be later used
in gdb with the command --load-symbols (if I recall tha option name correctly). 
I could have done that, the GDB symbol file format is available in GDB docs. So
what I need is DMC symbol information format. 
Anyone ever been doing things like that? Any hints are appreciated.

Yakov
Sep 27 2004
parent Scott Michel <scottm mordred.cs.ucla.edu> writes:
Yakov <Yakov_member pathlink.com> wrote:
 But I still think there is a realtively easy way around this. GDB has a nice
 feature of loading symbols from external file. Even without patching GDB, itis
 possible to create nice utility "dmcgdb" that will extract symbol info from the
 executable, convert it to gdbsymbols and write to file, which can be later used
 in gdb with the command --load-symbols (if I recall tha option name
correctly). 
 I could have done that, the GDB symbol file format is available in GDB docs. So
 what I need is DMC symbol information format. 
 Anyone ever been doing things like that? Any hints are appreciated.

There's the problem, basically. You could have the linker dump a detailed map file and then massage that into gdb's expected format. Frankly, hacking OMF format into binutils is relatively easy -- OMF's format is documented. Getting debug symbols (CV4 or CodeView format) isn't easy, but then again, someone might have some documentation somewhere that I haven't yet located. -scooter
Sep 28 2004