This is based on David Blaikie's patch D36097 and
solves issue of wrong section index evaluating for ranges when
base address is used.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/llvm/DebugInfo/DWARF/DWARFUnit.h | ||
---|---|---|
271–272 ↗ | (On Diff #113255) | So why is this bit necessary? Should callers just not try to set a base address if they don't want to, rather than having setBaseAddress ignore the request? |
lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp | ||
71 ↗ | (On Diff #113255) | Is this clang-formatted? I'd expect no spaces inner sides of the {} |
- Addressed review comments.
include/llvm/DebugInfo/DWARF/DWARFUnit.h | ||
---|---|---|
271–272 ↗ | (On Diff #113255) | It is for dwarfdump-ranges-unrelocated.s testcase. It is based on following code: test.cpp: void foo1() { } void foo2() { } clang test.cpp -S -o test.s -gmlt -ffunction-sections And output produced is: .section .debug_info,"",@progbits .Lcu_begin0: .long 38 # Length of Unit .short 4 # DWARF version number .long .debug_abbrev # Offset Into Abbrev. Section .byte 8 # Address Size (in bytes) .byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit .long .Linfo_string0 # DW_AT_producer .short 4 # DW_AT_language .long .Linfo_string1 # DW_AT_name .long .Lline_table_start0 # DW_AT_stmt_list .long .Linfo_string2 # DW_AT_comp_dir .quad 0 # DW_AT_low_pc .long .Ldebug_ranges0 # DW_AT_ranges .section .debug_ranges,"",@progbits .Ldebug_ranges0: .quad .Lfunc_begin0 .quad .Lfunc_end0 .quad .Lfunc_begin1 .quad .Lfunc_end1 .quad 0 .quad 0 So it has ranges but also unrelocated zero base address is emited in debug info. Since it has no I moved that code to caller side, thats probably a bit more clear and localizes the hack. |
lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp | ||
71 ↗ | (On Diff #113255) | You right, fixed. |
- Added testcase for executables.
- Updated code accordinng to discussion in corresponding thread.
Couple of minor things to address before you commit this (no need to send it for further review though - I'll catch anything else in post-commit), but otherwise looks good.
lib/DebugInfo/DWARF/DWARFFormValue.cpp | ||
---|---|---|
296 ↗ | (On Diff #113529) | should getRelocatedValue handle this case (if there is no section, it coudl set the SectionIndex to -1ULL) so SectionIndex is welldefined after a call to getRelocatedValue, even when the section index is not known? |
test/DebugInfo/X86/dwarfdump-ranges-baseaddr.s | ||
65–68 ↗ | (On Diff #113529) | Add a base address selection entry in this list as well (so let the first entry rely on the CU's default base address, then use a base address selection entry to switch base address (maybe switch section too to make it obvious in the CHECKs)), to test that codepath. |