www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Debug status

reply "ElfQT" <dethjunk yahoo.com> writes:
OK, I've ran a few rounds on debugging D.
(I've seen frigtening heights in the topic of debuggers and codeview 
formats... I'm everything but an expert with debuggers.)

All that I finally found is that the thing is in the way of decent debugging 
is that the compiler sipmly not provides the (cv4) symbolic debug 
information.

D/28413
(from http://www.wikiservice.at/wiki4d/wiki.cgi?PendingPeeves)

I've seen an unofficial wishlist on D features. I don't thik that there is 
anything more important and helpful than a debugger, which means providing 
the needed debug info.

I dared to notice this because I feel that the importance of this is lost in 
the debate of wishlists and already semi-working debuggers. (As my personal 
view, I find it odd, how others develop without being able even to debug the 
content of a char[]. printf? You must be kidding.)

Please right me if I'm wrong.
I really like to know if there is a plan on debug info.

ElfQT 
Sep 05 2005
parent reply pragma <EricAnderton youknowthedrill.yahoo> writes:
ElfQT wrote:
 OK, I've ran a few rounds on debugging D.
 (I've seen frigtening heights in the topic of debuggers and codeview 
 formats... I'm everything but an expert with debuggers.)

I know what you mean. I wasn't very knowledgable in object file formats before 4 weeks ago. My head is still spinning.
 All that I finally found is that the thing is in the way of decent debugging 
 is that the compiler sipmly not provides the (cv4) symbolic debug 
 information.
 
 D/28413
 (from http://www.wikiservice.at/wiki4d/wiki.cgi?PendingPeeves)
 
 I've seen an unofficial wishlist on D features. I don't thik that there is 
 anything more important and helpful than a debugger, which means providing 
 the needed debug info.

For what it's worth, my research can corroborate this. The .obj files generated by DMD are great for line-number matching with source, but that's about it. You're right, it provides absolutely zilch when it comes to type information. The remainder of information needed to support it simply isn't there (the $$TYPES and $$SYMBOLS segments are absent). Even if it was, the type index fields are all zero whenever they come up. So the short version is: the needed data isn't present at the .obj level (at least not as far as I can tell).
 I dared to notice this because I feel that the importance of this is 

 the debate of wishlists and already semi-working debuggers. (As my 

 view, I find it odd, how others develop without being able even to 

 content of a char[]. printf? You must be kidding.)

Never under-estimate the power of the printf().
 Please right me if I'm wrong.
 I really like to know if there is a plan on debug info.

I second that. I'm a bit curious myself. -- - EricAnderton at yahoo
Sep 05 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"pragma" <EricAnderton youknowthedrill.yahoo> wrote in message
news:dfj1vr$311m$1 digitaldaemon.com...
 For what it's worth, my research can corroborate this.  The .obj files
 generated by DMD are great for line-number matching with source, but
 that's about it.  You're right, it provides absolutely zilch when it
 comes to type information.  The remainder of information needed to
 support it simply isn't there (the $$TYPES and $$SYMBOLS segments are
 absent).  Even if it was, the type index fields are all zero whenever
 they come up.

Strange. When I compile the following code, and obj2asm it, I get this. The $$TYPES and $$SYMBOLS are there, and windbg.exe can find them. ------------------------------- module abc; char[] foos = "foo"; alias int myint; myint f; enum E { e } wchar _XX; int foo(char c, int argulid) { int x = 3; return x + c; } class Bar { int x; int y; protected int z; } enum Easy : int { red, blue, green, } ------------------------------------------ _TEXT segment dword use32 public 'CODE' ;size is 0 _TEXT ends _DATA segment para use32 public 'DATA' ;size is 128 _DATA ends CONST segment para use32 public 'CONST' ;size is 0 CONST ends _BSS segment para use32 public 'BSS' ;size is 4 _BSS ends $$SYMBOLS segment dword use32 'DEBSYM' ;size is 237 $$SYMBOLS ends $$TYPES segment dword use32 'DEBTYP' ;size is 210 $$TYPES ends FLAT group public _D3abc4foosAa public _D3abc1fi extrn _D3abc3fooFaiZi extrn _D6object6Object8opEqualsFC6ObjectZi extrn _D6object6Object5opCmpFC6ObjectZi extrn _D6object6Object6toHashFZk extrn _D6object6Object8toStringFZAa extrn _D6object6Object5printFZv extrn __Class_6Object extrn __vtbl_9ClassInfo public _D3abc3_XXu public __init_3abc3Bar public __Class_3abc3Bar public __vtbl_3abc3Bar _D3abc3fooFaiZi COMDAT flags=x0 attr=x0 align=x0 _TEXT segment assume CS:_TEXT _TEXT ends _DATA segment db 066h,06fh,06fh,000h,000h,000h,000h,000h _D3abc4foosAa: db 003h,000h,000h,000h dd offset FLAT:_DATA _D3abc3_XXu: db 0ffh,0ffh,000h,000h __init_3abc3Bar: dd offset FLAT:__vtbl_3abc3Bar db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h,000h,000h,000h,000h,000h,000h db 042h,061h,072h,000h __Class_3abc3Bar: dd offset FLAT:__vtbl_9ClassInfo db 000h,000h,000h,000h,014h,000h,000h,000h dd offset FLAT:__init_3abc3Bar db 003h,000h,000h,000h dd offset FLAT:__init_3abc3Bar[014h] db 006h,000h,000h,000h dd offset FLAT:__vtbl_3abc3Bar db 000h,000h,000h,000h db 000h,000h,000h,000h dd offset FLAT:__Class_6Object db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h,000h,000h,000h,000h,000h,000h __vtbl_3abc3Bar: dd offset FLAT:__Class_3abc3Bar dd offset FLAT:_D6object6Object5printFZv dd offset FLAT:_D6object6Object8toStringFZAa dd offset FLAT:_D6object6Object6toHashFZk dd offset FLAT:_D6object6Object5opCmpFC6ObjectZi dd offset FLAT:_D6object6Object8opEqualsFC6ObjectZi _DATA ends CONST segment CONST ends _BSS segment _BSS ends $$SYMBOLS segment S_COMPILE 06 x008000 Z8.45.6 S_GDATA32 off = x0008, seg = x0000, typ = x0023 _D3abc4foosAa segidx = 5 offset = 0018, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GDATA32 off = x0000, seg = x0000, typ = x0074 _D3abc1fi segidx = 5 offset = 0032, lcfd = ec10, fd = 1, td = 4, targdisp = x0000 S_UDT <typidx 1001> E S_GDATA32 off = x0010, seg = x0000, typ = x0021 _D3abc3_XXu segidx = 5 offset = 0050, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GPROC32 par=x00000000 end=x00000000 next=x00000000 len=x001a debsta=x0007 debend=x0016 off=x0000 seg=x0000 proctyp=x1004 near _D3abc3fooFaiZi segidx = 5 offset = 0080, lcfd = ec12, fd = 1, td = 1, targdisp = x0000 S_ENDARG S_BPREL32 off = xfffffff8, typ = x0074 argulid S_BPREL32 off = x0008, typ = x0020 c S_BPREL32 off = xfffffffc, typ = x0074 x S_RETURN 00 00 01 01 11 S_END S_UDT <typidx 1006> abc.Bar S_UDT <typidx 1009> Easy $$SYMBOLS ends $$TYPES segment 00: LF_ARGLIST argcount=0 01: LF_ENUM count=1 <typidx 0074> <fList 1002> property=x0000 E 02: LF_FIELDLIST LF_ENUMERATE attribute=x0000 x0000 e 03: LF_ARGLIST argcount=2 <typidx 0020> <typidx 0074> 04: LF_PROCEDURE <rvtype 0074> <near pascal> 00 #parms=2 <typidx 1003> 05: LF_VTSHAPE count=1 55 06: LF_STRUCTURE count=4 <typidx 1008> property=x0000 <dList 0000> <vshape 1005> length=x0014 abc.Bar 07: LF_STRUCTURE count=0 <typidx 0000> property=x0080 <dList 0000> <vshape 0000> length=x0000 Object 08: LF_FIELDLIST LF_BCLASS <typidx 1007> attribute=x0003 x0000 LF_MEMBER <typidx 0074> attribute=x0003 offset=8 x LF_MEMBER <typidx 0074> attribute=x0003 offset=12 y LF_MEMBER <typidx 0074> attribute=x0002 offset=16 z 09: LF_ENUM count=3 <typidx 0074> <fList 100a> property=x0000 Easy 0a: LF_FIELDLIST LF_ENUMERATE attribute=x0000 x0000 red LF_ENUMERATE attribute=x0000 x0001 blue LF_ENUMERATE attribute=x0000 x0002 green $$TYPES ends _D3abc3fooFaiZi comdat assume CS:_D3abc3fooFaiZi ; ;module abc; ; ;char[] foos = "foo"; ; ;alias int myint; ; ;myint f; ;enum E { e } ; ;wchar _XX; ; ;int foo(char c, int argulid) enter 8,0 mov -8[EBP],EAX ;{ ; int x = 3; mov EAX,3 mov -4[EBP],EAX ; return x + c; movzx EAX,byte ptr 8[EBP] add EAX,-4[EBP] ;} leave ret 4 _D3abc3fooFaiZi ends ; ;class Bar ;{ ; int x; ; int y; ; protected int z; ;} ; ;enum Easy : int ;{ ; red, ; blue, ; green, ;} end
Sep 15 2005
parent reply pragma <EricAnderton youknowthedrill.yahoo> writes:
It must be something with my code, or I merely forgot to compile a debug 
version of my test module.

I stand corrected, thank you Walter.

- Eric

Walter Bright wrote:
 "pragma" <EricAnderton youknowthedrill.yahoo> wrote in message
 news:dfj1vr$311m$1 digitaldaemon.com...
 
For what it's worth, my research can corroborate this.  The .obj files
generated by DMD are great for line-number matching with source, but
that's about it.  You're right, it provides absolutely zilch when it
comes to type information.  The remainder of information needed to
support it simply isn't there (the $$TYPES and $$SYMBOLS segments are
absent).  Even if it was, the type index fields are all zero whenever
they come up.

Strange. When I compile the following code, and obj2asm it, I get this. The $$TYPES and $$SYMBOLS are there, and windbg.exe can find them. ------------------------------- module abc; char[] foos = "foo"; alias int myint; myint f; enum E { e } wchar _XX; int foo(char c, int argulid) { int x = 3; return x + c; } class Bar { int x; int y; protected int z; } enum Easy : int { red, blue, green, } ------------------------------------------ _TEXT segment dword use32 public 'CODE' ;size is 0 _TEXT ends _DATA segment para use32 public 'DATA' ;size is 128 _DATA ends CONST segment para use32 public 'CONST' ;size is 0 CONST ends _BSS segment para use32 public 'BSS' ;size is 4 _BSS ends $$SYMBOLS segment dword use32 'DEBSYM' ;size is 237 $$SYMBOLS ends $$TYPES segment dword use32 'DEBTYP' ;size is 210 $$TYPES ends FLAT group public _D3abc4foosAa public _D3abc1fi extrn _D3abc3fooFaiZi extrn _D6object6Object8opEqualsFC6ObjectZi extrn _D6object6Object5opCmpFC6ObjectZi extrn _D6object6Object6toHashFZk extrn _D6object6Object8toStringFZAa extrn _D6object6Object5printFZv extrn __Class_6Object extrn __vtbl_9ClassInfo public _D3abc3_XXu public __init_3abc3Bar public __Class_3abc3Bar public __vtbl_3abc3Bar _D3abc3fooFaiZi COMDAT flags=x0 attr=x0 align=x0 _TEXT segment assume CS:_TEXT _TEXT ends _DATA segment db 066h,06fh,06fh,000h,000h,000h,000h,000h _D3abc4foosAa: db 003h,000h,000h,000h dd offset FLAT:_DATA _D3abc3_XXu: db 0ffh,0ffh,000h,000h __init_3abc3Bar: dd offset FLAT:__vtbl_3abc3Bar db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h,000h,000h,000h,000h,000h,000h db 042h,061h,072h,000h __Class_3abc3Bar: dd offset FLAT:__vtbl_9ClassInfo db 000h,000h,000h,000h,014h,000h,000h,000h dd offset FLAT:__init_3abc3Bar db 003h,000h,000h,000h dd offset FLAT:__init_3abc3Bar[014h] db 006h,000h,000h,000h dd offset FLAT:__vtbl_3abc3Bar db 000h,000h,000h,000h db 000h,000h,000h,000h dd offset FLAT:__Class_6Object db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h,000h,000h,000h,000h,000h,000h __vtbl_3abc3Bar: dd offset FLAT:__Class_3abc3Bar dd offset FLAT:_D6object6Object5printFZv dd offset FLAT:_D6object6Object8toStringFZAa dd offset FLAT:_D6object6Object6toHashFZk dd offset FLAT:_D6object6Object5opCmpFC6ObjectZi dd offset FLAT:_D6object6Object8opEqualsFC6ObjectZi _DATA ends CONST segment CONST ends _BSS segment _BSS ends $$SYMBOLS segment S_COMPILE 06 x008000 Z8.45.6 S_GDATA32 off = x0008, seg = x0000, typ = x0023 _D3abc4foosAa segidx = 5 offset = 0018, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GDATA32 off = x0000, seg = x0000, typ = x0074 _D3abc1fi segidx = 5 offset = 0032, lcfd = ec10, fd = 1, td = 4, targdisp = x0000 S_UDT <typidx 1001> E S_GDATA32 off = x0010, seg = x0000, typ = x0021 _D3abc3_XXu segidx = 5 offset = 0050, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GPROC32 par=x00000000 end=x00000000 next=x00000000 len=x001a debsta=x0007 debend=x0016 off=x0000 seg=x0000 proctyp=x1004 near _D3abc3fooFaiZi segidx = 5 offset = 0080, lcfd = ec12, fd = 1, td = 1, targdisp = x0000 S_ENDARG S_BPREL32 off = xfffffff8, typ = x0074 argulid S_BPREL32 off = x0008, typ = x0020 c S_BPREL32 off = xfffffffc, typ = x0074 x S_RETURN 00 00 01 01 11 S_END S_UDT <typidx 1006> abc.Bar S_UDT <typidx 1009> Easy $$SYMBOLS ends $$TYPES segment 00: LF_ARGLIST argcount=0 01: LF_ENUM count=1 <typidx 0074> <fList 1002> property=x0000 E 02: LF_FIELDLIST LF_ENUMERATE attribute=x0000 x0000 e 03: LF_ARGLIST argcount=2 <typidx 0020> <typidx 0074> 04: LF_PROCEDURE <rvtype 0074> <near pascal> 00 #parms=2 <typidx 1003> 05: LF_VTSHAPE count=1 55 06: LF_STRUCTURE count=4 <typidx 1008> property=x0000 <dList 0000> <vshape 1005> length=x0014 abc.Bar 07: LF_STRUCTURE count=0 <typidx 0000> property=x0080 <dList 0000> <vshape 0000> length=x0000 Object 08: LF_FIELDLIST LF_BCLASS <typidx 1007> attribute=x0003 x0000 LF_MEMBER <typidx 0074> attribute=x0003 offset=8 x LF_MEMBER <typidx 0074> attribute=x0003 offset=12 y LF_MEMBER <typidx 0074> attribute=x0002 offset=16 z 09: LF_ENUM count=3 <typidx 0074> <fList 100a> property=x0000 Easy 0a: LF_FIELDLIST LF_ENUMERATE attribute=x0000 x0000 red LF_ENUMERATE attribute=x0000 x0001 blue LF_ENUMERATE attribute=x0000 x0002 green $$TYPES ends _D3abc3fooFaiZi comdat assume CS:_D3abc3fooFaiZi ; ;module abc; ; ;char[] foos = "foo"; ; ;alias int myint; ; ;myint f; ;enum E { e } ; ;wchar _XX; ; ;int foo(char c, int argulid) enter 8,0 mov -8[EBP],EAX ;{ ; int x = 3; mov EAX,3 mov -4[EBP],EAX ; return x + c; movzx EAX,byte ptr 8[EBP] add EAX,-4[EBP] ;} leave ret 4 _D3abc3fooFaiZi ends ; ;class Bar ;{ ; int x; ; int y; ; protected int z; ;} ; ;enum Easy : int ;{ ; red, ; blue, ; green, ;} end

-- - EricAnderton at yahoo
Sep 16 2005
parent reply J Thomas <jtd514 ameritech.net> writes:
You were probably looking for OMF/COFF symbols but walter is refering to 
codeview symbols

pragma wrote:
 It must be something with my code, or I merely forgot to compile a debug 
 version of my test module.
 
 I stand corrected, thank you Walter.
 
 - Eric
 
 Walter Bright wrote:
 
 "pragma" <EricAnderton youknowthedrill.yahoo> wrote in message
 news:dfj1vr$311m$1 digitaldaemon.com...

 For what it's worth, my research can corroborate this.  The .obj files
 generated by DMD are great for line-number matching with source, but
 that's about it.  You're right, it provides absolutely zilch when it
 comes to type information.  The remainder of information needed to
 support it simply isn't there (the $$TYPES and $$SYMBOLS segments are
 absent).  Even if it was, the type index fields are all zero whenever
 they come up.

Strange. When I compile the following code, and obj2asm it, I get this. The $$TYPES and $$SYMBOLS are there, and windbg.exe can find them. ------------------------------- module abc; char[] foos = "foo"; alias int myint; myint f; enum E { e } wchar _XX; int foo(char c, int argulid) { int x = 3; return x + c; } class Bar { int x; int y; protected int z; } enum Easy : int { red, blue, green, } ------------------------------------------ _TEXT segment dword use32 public 'CODE' ;size is 0 _TEXT ends _DATA segment para use32 public 'DATA' ;size is 128 _DATA ends CONST segment para use32 public 'CONST' ;size is 0 CONST ends _BSS segment para use32 public 'BSS' ;size is 4 _BSS ends $$SYMBOLS segment dword use32 'DEBSYM' ;size is 237 $$SYMBOLS ends $$TYPES segment dword use32 'DEBTYP' ;size is 210 $$TYPES ends FLAT group public _D3abc4foosAa public _D3abc1fi extrn _D3abc3fooFaiZi extrn _D6object6Object8opEqualsFC6ObjectZi extrn _D6object6Object5opCmpFC6ObjectZi extrn _D6object6Object6toHashFZk extrn _D6object6Object8toStringFZAa extrn _D6object6Object5printFZv extrn __Class_6Object extrn __vtbl_9ClassInfo public _D3abc3_XXu public __init_3abc3Bar public __Class_3abc3Bar public __vtbl_3abc3Bar _D3abc3fooFaiZi COMDAT flags=x0 attr=x0 align=x0 _TEXT segment assume CS:_TEXT _TEXT ends _DATA segment db 066h,06fh,06fh,000h,000h,000h,000h,000h _D3abc4foosAa: db 003h,000h,000h,000h dd offset FLAT:_DATA _D3abc3_XXu: db 0ffh,0ffh,000h,000h __init_3abc3Bar: dd offset FLAT:__vtbl_3abc3Bar db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h,000h,000h,000h,000h,000h,000h db 042h,061h,072h,000h __Class_3abc3Bar: dd offset FLAT:__vtbl_9ClassInfo db 000h,000h,000h,000h,014h,000h,000h,000h dd offset FLAT:__init_3abc3Bar db 003h,000h,000h,000h dd offset FLAT:__init_3abc3Bar[014h] db 006h,000h,000h,000h dd offset FLAT:__vtbl_3abc3Bar db 000h,000h,000h,000h db 000h,000h,000h,000h dd offset FLAT:__Class_6Object db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h,000h,000h,000h,000h,000h,000h __vtbl_3abc3Bar: dd offset FLAT:__Class_3abc3Bar dd offset FLAT:_D6object6Object5printFZv dd offset FLAT:_D6object6Object8toStringFZAa dd offset FLAT:_D6object6Object6toHashFZk dd offset FLAT:_D6object6Object5opCmpFC6ObjectZi dd offset FLAT:_D6object6Object8opEqualsFC6ObjectZi _DATA ends CONST segment CONST ends _BSS segment _BSS ends $$SYMBOLS segment S_COMPILE 06 x008000 Z8.45.6 S_GDATA32 off = x0008, seg = x0000, typ = x0023 _D3abc4foosAa segidx = 5 offset = 0018, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GDATA32 off = x0000, seg = x0000, typ = x0074 _D3abc1fi segidx = 5 offset = 0032, lcfd = ec10, fd = 1, td = 4, targdisp = x0000 S_UDT <typidx 1001> E S_GDATA32 off = x0010, seg = x0000, typ = x0021 _D3abc3_XXu segidx = 5 offset = 0050, lcfd = ec10, fd = 1, td = 2, targdisp = x0000 S_GPROC32 par=x00000000 end=x00000000 next=x00000000 len=x001a debsta=x0007 debend=x0016 off=x0000 seg=x0000 proctyp=x1004 near _D3abc3fooFaiZi segidx = 5 offset = 0080, lcfd = ec12, fd = 1, td = 1, targdisp = x0000 S_ENDARG S_BPREL32 off = xfffffff8, typ = x0074 argulid S_BPREL32 off = x0008, typ = x0020 c S_BPREL32 off = xfffffffc, typ = x0074 x S_RETURN 00 00 01 01 11 S_END S_UDT <typidx 1006> abc.Bar S_UDT <typidx 1009> Easy $$SYMBOLS ends $$TYPES segment 00: LF_ARGLIST argcount=0 01: LF_ENUM count=1 <typidx 0074> <fList 1002> property=x0000 E 02: LF_FIELDLIST LF_ENUMERATE attribute=x0000 x0000 e 03: LF_ARGLIST argcount=2 <typidx 0020> <typidx 0074> 04: LF_PROCEDURE <rvtype 0074> <near pascal> 00 #parms=2 <typidx 1003> 05: LF_VTSHAPE count=1 55 06: LF_STRUCTURE count=4 <typidx 1008> property=x0000 <dList 0000> <vshape 1005> length=x0014 abc.Bar 07: LF_STRUCTURE count=0 <typidx 0000> property=x0080 <dList 0000> <vshape 0000> length=x0000 Object 08: LF_FIELDLIST LF_BCLASS <typidx 1007> attribute=x0003 x0000 LF_MEMBER <typidx 0074> attribute=x0003 offset=8 x LF_MEMBER <typidx 0074> attribute=x0003 offset=12 y LF_MEMBER <typidx 0074> attribute=x0002 offset=16 z 09: LF_ENUM count=3 <typidx 0074> <fList 100a> property=x0000 Easy 0a: LF_FIELDLIST LF_ENUMERATE attribute=x0000 x0000 red LF_ENUMERATE attribute=x0000 x0001 blue LF_ENUMERATE attribute=x0000 x0002 green $$TYPES ends _D3abc3fooFaiZi comdat assume CS:_D3abc3fooFaiZi ; ;module abc; ; ;char[] foos = "foo"; ; ;alias int myint; ; ;myint f; ;enum E { e } ; ;wchar _XX; ; ;int foo(char c, int argulid) enter 8,0 mov -8[EBP],EAX ;{ ; int x = 3; mov EAX,3 mov -4[EBP],EAX ; return x + c; movzx EAX,byte ptr 8[EBP] add EAX,-4[EBP] ;} leave ret 4 _D3abc3fooFaiZi ends ; ;class Bar ;{ ; int x; ; int y; ; protected int z; ;} ; ;enum Easy : int ;{ ; red, ; blue, ; green, ;} end


Sep 16 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"J Thomas" <jtd514 ameritech.net> wrote in message
news:dgeqkj$13ta$1 digitaldaemon.com...
 You were probably looking for OMF/COFF symbols but walter is refering to
 codeview symbols

In any case, obj2asm will definitively determine if they exist in your .obj files.
Sep 16 2005