Menu

#29 Support CV8 debug info (was: Crash when enabling -Zi)

open
nobody
None
5
2011-06-28
2011-04-17
Calvados
No

I've a given file when compiling in -Zi mode (COFF) which crashes with general failure. When debugging it fails while trying to emit some debug symbols, here is an excerpt of the log before it dies:

coff_write_fixup(_TEXT$0000023E, 210124h): reloc loc=217 type=20 idx=1932 sym=??0_Lockit@std@@QAE@H@Z
coff_write_fixup(_TEXT$0000023E, 21012Eh): reloc loc=3D1 type=6 idx=4166 sym=??_7?$basic_streambuf@DU?$char_traits@D@std@@@std@@6B@
coff_write_data(_TEXT$0000023E): writing linnum data
coff_write_data(_TEXT$0000023E, 210138h): linnum, #=0, ofs=FDB7, sym=??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ
coff_write_data(_TEXT$0000023E, 21013Eh): linnum, #=64953, ofs=0, sym=NULL
coff_write_data(_TEXT$0000023E, 210144h): linnum, #=64954, ofs=1, sym=NULL
coff_write_data(_TEXT$0000023E, 21014Ah): linnum, #=64955, ofs=2, sym=NULL
coff_write_data(_TEXT$0000023E, 210150h): linnum, #=64956, ofs=7, sym=NULL
coff_write_data(_TEXT$0000023E, 210156h): linnum, #=64957, ofs=C, sym=NULL
coff_write_data(_TEXT$0000023E, 21015Ch): linnum, #=64958, ofs=F, sym=NULL
coff_write_data(_TEXT$0000023E, 210162h): linnum, #=64959, ofs=10, sym=NULL
.....
coff_write_data(_TEXT$0000023E, 21086Ah): linnum, #=65463, ofs=34F, sym=NULL
coff_write_data(_TEXT$0000023E, 210870h): linnum, #=65464, ofs=351, sym=NULL
coff_write_data(_TEXT$0000023E, 210876h): linnum, #=65465, ofs=353, sym=NULL
coff_write_data(_TEXT$0000023E, 21087Ch): linnum, #=65470, ofs=358, sym=NULL
coff_write_data(_TEXT$0000023E, 210882h): linnum, #=65484

To clarify a bit, the source code is a post processed ASM file, generated from a C++ input, which is 242353 lines and compiles fine without -Zi, I can provide that source if you wish (4.7MB raw, 450K in bz2 format). Alternatively, I could do some debugging myself to help (I tried), however I wonder if I am not facing some limitation currently existing with JWASM and CV8, and I am not exactly sure how to proceed from there.

Anyway, please let me know how we can work to diagnose/fix/mitigate the exact problem. Oh and kudos on the continuous work :).

Thanks.

Discussion

  • japheth

    japheth - 2011-04-17

    I guess the crash is due to a (short) integer overflow. It can be avoided by extending member "number" in struct line_num_info (globals.h) to 32-bit (uint_32).

    The crash might vanish then, but there's most likely still a problem with line numbers, because both OMF and COFF use variables of type short to store line numbers. The only way to fix this issue is writing line number info in CodeView 8 format - but this isn't implemented yet in jwasm.

     
  • Calvados

    Calvados - 2011-04-18

    Thanks for the reply - yeah I looked at the defs when i tried to debug, and I was afraid you were going to tell me that. I am guessing implementing CV8 is quite a tedious task, and won't happen any time soon?

    I had a quick look at YASM and it seems to require a lots of code to support CV8, but may be he supports way more things than required minimally.

    Anyway, I'll patch that definition and see how that goes...

     
  • Calvados

    Calvados - 2011-04-18

    Just tried, it fixes the crash, but the output COFF is partly invalid, it won't link. Ah well...

     
  • japheth

    japheth - 2011-04-18

    > I am guessing implementing CV8 is quite a tedious task,
    > and won't happen any time soon?

    I thought about splitting the task and - in a first step - implement CV8 line number info only ( -Zd ). After all, the ONE thing which is/was tedious to implement, is the old line number info in COFF format - and this has been made obsolete in CV8.

    > I had a quick look at YASM and it seems to require a lots of code ...

    Currently I assume that one can reuse a lot of code from the CV4 symbolic debugging part.

     
  • Calvados

    Calvados - 2011-04-18

    Actually, the line number info is what is implemented in YASM afaik, and yes it seems that a lot of the code is similar from CV4.

     
  • japheth

    japheth - 2011-06-28
    • summary: Crash when enabling -Zi --> Support CV8 debug info (was: Crash when enabling -Zi)
     

Log in to post a comment.