Skip to content

Comments

Dwarf (64) fixes / Issue 5569#18

Merged
WalterBright merged 12 commits intodlang:masterfrom
MartinNowak:master
Mar 26, 2011
Merged

Dwarf (64) fixes / Issue 5569#18
WalterBright merged 12 commits intodlang:masterfrom
MartinNowak:master

Conversation

@MartinNowak
Copy link
Member

  • Made CFA state machine 64 aware
  • debug ranges needed to be address size
  • corrected frame_base calculation (also 32)
  • correct line number information for multiobj (also 32)

...and required to be multiple of address size.
 - different data_alignment_factor for 64
 - different dwarf register mapping for x64-64
 - This should allow to for farfunc or other functions
   that have a bigger outer/inner frame base gap.
 - This makes variable expressions relative to the stack pointer
   of the caller, the address tracked by DW_AT_frame_base.
 - Besides the module file stored in dwarf_initmodule
   this includes files referenced by linnum_data
   and files from function code gen.
 - in case of multiobj line data was always appended
   leading to garbage .debug_line programs
@braddr
Copy link
Member

braddr commented Mar 19, 2011

Nice! You just gave me my weekend back, or at least time to work on other stuff. I was really looking to find and fix the bug you fixed in f16c68b. I'm far from an expert in this code, but nothing stood out to me as likely wrong from my reading of it.

@Marenz
Copy link

Marenz commented Mar 23, 2011

only D2 fixes :(

@braddr
Copy link
Member

braddr commented Mar 24, 2011

Marenz:

D1 will get the same set of changes. The backends between the two compilers are essentially identical.

dawgfoto:

Playing with these changes I've noticed a bug (and haven't gone back to before your changes to make sure they're not an old bug), but it looks like the args are getting reversed somewhere. For example:

(gdb) step
57 formatValue(-999L, spec);
(gdb) step
bug.formatValue (f=0x7ffff7ffe168, val=0) at ../../bugs/bug-format.d:14
14 void formatValue(long val, ref FormatSpec f)
15 {
16 char[] w;

Notice the frame info is showing f then val, but the code has val then f. The actual values are semi correct. Notice that val is both second and has 0 even though -999L is what was passed. Single stepping once more into the function and the value of val is correct:

(gdb) print val
$1 = 0
(gdb) step
16 char[] w;
(gdb) print val
$2 = -999

@WalterBright WalterBright merged commit 4719f91 into dlang:master Mar 26, 2011
@MartinNowak
Copy link
Member Author

braddr:
All parameters are referenced by their stack position relative to EBP, so the debugger will show invalid
values before the function prologue finished. Fixing this would require a debug location
list for every parameter. The same kind of what is used for the CFA. Not sure if one can simply add
this. Also the debug information would grow significally.

braddr pushed a commit to braddr/dmd that referenced this pull request Sep 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants