[PATCH] D32492: [llvm-dwarfdump] - Change format for .gdb_index dump.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 03:31:31 PDT 2017
grimar added inline comments.
================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:42
OS << format(
- " Low address = 0x%llx, High address = 0x%llx, CU index = %d\n",
- Addr.LowAddress, Addr.HighAddress, Addr.CuIndex);
+ " Low/High address = [0x%llx, 0x%llx] (Size: 0x%llx), CU id = %d\n",
+ Addr.LowAddress, Addr.HighAddress, Addr.HighAddress - Addr.LowAddress,
----------------
dblaikie wrote:
> While you're here, probably makes sense to fix the range to render as [x, y) rather than [x, y] ? (since it's a half open range, if I recall correctly)
I am not sure I understand why it is half open. If I got your idea correctly then probably output would be:
```
[a, b) (c, d) (e, f) (g, h]
```
But I do not think it would be correct.
.gdb_index format (https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html) defines address area as:
> The address area. The address area consists of a sequence of address entries. Each address entry has three elements:
> The low address. This is a 64-bit little-endian value.
> The high address. This is a 64-bit little-endian value. Like DW_AT_high_pc, the value is one byte beyond the end.
> The CU index. This is an offset_type value.
>
So we have set of elements that have begining and end marks. It looks to be set of closed segments/snippets, if I am not missing something, so I think [x, y] is more appropriate then.
I was interested how readelf dumps the .gdb_index for the same file used in testcase.
It was:
readelf --debug-dump=gdb_index dwarfdump-gdbindex-v7.elf-x86-64
```
Contents of the .gdb_index section:
Version 7
CU table:
[ 0] 0x0 - 0x33
[ 1] 0x34 - 0x67
TU table:
Address table:
00000000004000e8 00000000004000f3 0
00000000004000f3 00000000004000fe 1
Symbol table:
[489] main: 0 [global, function]
[754] int:
0 [static, type]
1 [static, type]
[956] main2: 1 [global, function]
```
Basing on above I can suggest 2 solutions:
1) Leave [x, y] as is.
2) Change dump output to something that avoids use of []() if that can be confusing, for example to:
```
Address area offset = 0x38, has 2 entries:
0x4000e8 - 0x4000f3, Size = 0xb, CU id = 0
0x4000f3 - 0x4000fe, Size = 0xb, CU id = 1
```
What do you think ?
https://reviews.llvm.org/D32492
More information about the llvm-commits
mailing list