Skip to content

Commit 4528942

Browse files
authored
[lldb] Make AddressRange dump easier on the eye (#141062)
1 parent 042912f commit 4528942

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

lldb/source/Core/AddressRange.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,18 @@ bool AddressRange::Dump(Stream *s, Target *target, Address::DumpStyle style,
162162
default:
163163
break;
164164
case Address::DumpStyleSectionNameOffset:
165-
case Address::DumpStyleSectionPointerOffset:
165+
case Address::DumpStyleSectionPointerOffset: {
166166
s->PutChar('[');
167167
m_base_addr.Dump(s, target, style, fallback_style);
168168
s->PutChar('-');
169-
DumpAddress(s->AsRawOstream(), m_base_addr.GetOffset() + GetByteSize(),
170-
addr_size);
169+
addr_t end = m_base_addr.GetOffset() + GetByteSize();
170+
if (m_base_addr.GetSection())
171+
s->Format("{0}", end);
172+
else
173+
DumpAddress(s->AsRawOstream(), end, addr_size);
171174
s->PutChar(')');
172175
return true;
173-
break;
176+
}
174177

175178
case Address::DumpStyleModuleWithFileAddress:
176179
show_module = true;

lldb/test/Shell/SymbolFile/Breakpad/stack-cfi-parsing.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ image show-unwind -n func0
1111
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
1212
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
1313
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
14-
# CHECK-NEXT: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 0-0x0000000000000002)
14+
# CHECK-NEXT: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 0-2)
1515
# CHECK-NEXT: row[0]: 0: CFA=DW_OP_breg7 +0 => rbp=DW_OP_breg7 +0 rip=DW_OP_pick 0x0
1616
# CHECK-NEXT: row[1]: 1: CFA=DW_OP_breg7 +0 => rbx=DW_OP_breg2 +0 rbp=DW_OP_breg0 +0 rip=DW_OP_pick 0x0
1717

@@ -48,6 +48,6 @@ image show-unwind -n func9
4848
# CHECK: Asynchronous (not restricted to call-sites) UnwindPlan is 'breakpad STACK CFI'
4949
# CHECK: Synchronous (restricted to call-sites) UnwindPlan is 'breakpad STACK CFI'
5050
# CHECK: Symbol file UnwindPlan:
51-
# CHECK: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 9-0x000000000000000a)
51+
# CHECK: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 9-10)
5252
# CHECK: row[0]: 0: CFA=DW_OP_breg6 +0 => rip=DW_OP_breg0 +0
5353

lldb/test/Shell/SymbolFile/Breakpad/unwind-via-raSearch.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ image show-unwind -n call_many
1515
# CHECK: This UnwindPlan is sourced from the compiler: yes.
1616
# CHECK: This UnwindPlan is valid at all instruction locations: no.
1717
# CHECK: This UnwindPlan is for a trap handler function: no.
18-
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
18+
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-4221)
1919
# CHECK: row[0]: 0: CFA=RaSearch@SP+0 => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref
2020

2121
image show-unwind -n nonzero_frame_size

lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-cfi.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ image show-unwind -n bar
1313
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
1414
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
1515
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
16-
# CHECK-NEXT: Address range of this UnwindPlan: [unwind-via-stack-cfi..module_image + 1056-0x0000000000000449)
16+
# CHECK-NEXT: Address range of this UnwindPlan: [unwind-via-stack-cfi..module_image + 1056-1097)
1717
# CHECK-NEXT: row[0]: 0: CFA=DW_OP_breg6 +0, DW_OP_deref => rbp=DW_OP_pick 0x0, DW_OP_deref rsp=DW_OP_pick 0x0, DW_OP_consts +16, DW_OP_plus rip=DW_OP_pick 0x0, DW_OP_consts +8, DW_OP_plus, DW_OP_deref
1818

1919
thread backtrace

lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ image show-unwind -n call_many
1515
# CHECK: This UnwindPlan is sourced from the compiler: yes.
1616
# CHECK: This UnwindPlan is valid at all instruction locations: no.
1717
# CHECK: This UnwindPlan is for a trap handler function: no.
18-
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
18+
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-4221)
1919
# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0, DW_OP_consts +80, DW_OP_plus => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref
2020

2121
# Then, some invalid rules.
@@ -44,7 +44,7 @@ image show-unwind -n temporary_var
4444
# CHECK: This UnwindPlan is sourced from the compiler: yes.
4545
# CHECK: This UnwindPlan is valid at all instruction locations: no.
4646
# CHECK: This UnwindPlan is for a trap handler function: no.
47-
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-0x00001134)
47+
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-4404)
4848
# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0 => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref
4949

5050
# And finally, check that backtracing works as a whole by unwinding a simple

lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ image show-unwind -n private_fn --cached true
4141
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
4242
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
4343
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
44-
# CHECK-NEXT: Address range of this UnwindPlan: [a.stripped.PT_LOAD[1]..text + 16-0x0000000000000013)
44+
# CHECK-NEXT: Address range of this UnwindPlan: [a.stripped.PT_LOAD[1]..text + 16-19)
4545

4646

4747
#--- a.s

lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ image show-unwind --cached true -n foo
2222
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
2323
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
2424
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
25-
# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 6-0x000000000000000b)[{{.*}}.text + 12-0x000000000000001b)[{{.*}}.text + 43-0x0000000000000039)[{{.*}}.text + 58-0x0000000000000045)
25+
# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 6-11)[{{.*}}.text + 12-27)[{{.*}}.text + 43-57)[{{.*}}.text + 58-69)
2626
# CHECK-NEXT: row[0]: -37: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
2727
# CHECK-NEXT: row[1]: -33: CFA=rsp +8 => rbx=[CFA-16] rip=[CFA-8]
2828
# CHECK-NEXT: row[2]: -31: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
@@ -43,7 +43,7 @@ image show-unwind --cached true -n bar
4343
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
4444
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
4545
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
46-
# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 27-0x000000000000002b)
46+
# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 27-43)
4747
# CHECK-NEXT: row[0]: 0: CFA=rsp +8 => rip=[CFA-8]
4848
# CHECK-NEXT: row[1]: 4: CFA=rsp+96 => rip=[CFA-8]
4949
# CHECK-NEXT: row[2]: 15: CFA=rsp +8 => rip=[CFA-8]

0 commit comments

Comments
 (0)