[Issue 3214] Incorrect DWARF line number debugging information on Linux

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 29 21:19:57 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3214





--- Comment #1 from nfxjfg at gmail.com  2009-07-29 21:19:56 PDT ---
Created an attachment (id=435)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=435)
dmd patch to fix the problem (against dmd 1.046)

I think I found out why it doesn't work: when compiling several files at once,
the object writer's state isn't reset correctly. Now I don't know how the hell
the backend works; I just noticed that the DWARF writer still tried to write
line numbers from the previous file (also notice what's added by objlinnum()).
In this case, c.o contained some line number information from b.o, which is why
addr2line resolved the address mentioned to b.d.

I'm posting a trivial 3 line patch that seems to solve the problem. It simply
makes obj_init() forget about the SegData from the previous object file. I
don't know if it's correct or complete, but with my test cases (the one posted
above and a larger, non-trivial heap of code) it seemed to work very well. The
patch causes a little memory leak, but that'd trivial to fix (maybe not setting
seg_max to 0 does it).

There's just one more problem. When resolving some invalid address with
addr2line, I get this output:

BFD: Dwarf Error: mangled line number section (bad file number).
BFD: Dwarf Error: mangled line number section (bad file number).
BFD: Dwarf Error: Could not find abbrev number 1014.
BFD: Dwarf Error: Could not find abbrev number 119.
BFD: Dwarf Error: Could not find abbrev number 651.
BFD: Dwarf Error: Could not find abbrev number 53.
BFD: Dwarf Error: Could not find abbrev number 84.
BFD: Dwarf Error: Could not find abbrev number 657.
BFD: Dwarf Error: Could not find abbrev number 1230.

I have no idea what's up with that and I can't reproduce it with a simpler
testcase.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list