[Lldb-commits] [lldb] [lldb] Make AddressRange dump easier on the eye (PR #141062)
via lldb-commits
lldb-commits at lists.llvm.org
Thu May 22 05:57:07 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Pavel Labath (labath)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/141062.diff
7 Files Affected:
- (modified) lldb/source/Core/AddressRange.cpp (+7-4)
- (modified) lldb/test/Shell/SymbolFile/Breakpad/stack-cfi-parsing.test (+2-2)
- (modified) lldb/test/Shell/SymbolFile/Breakpad/unwind-via-raSearch.test (+1-1)
- (modified) lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-cfi.test (+1-1)
- (modified) lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test (+2-2)
- (modified) lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test (+1-1)
- (modified) lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test (+2-2)
``````````diff
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp
index 6cef7e149cd20..315fcf1a6da32 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -162,15 +162,18 @@ bool AddressRange::Dump(Stream *s, Target *target, Address::DumpStyle style,
default:
break;
case Address::DumpStyleSectionNameOffset:
- case Address::DumpStyleSectionPointerOffset:
+ case Address::DumpStyleSectionPointerOffset: {
s->PutChar('[');
m_base_addr.Dump(s, target, style, fallback_style);
s->PutChar('-');
- DumpAddress(s->AsRawOstream(), m_base_addr.GetOffset() + GetByteSize(),
- addr_size);
+ addr_t end = m_base_addr.GetOffset() + GetByteSize();
+ if (m_base_addr.GetSection())
+ s->Format("{0}", end);
+ else
+ DumpAddress(s->AsRawOstream(), end, addr_size);
s->PutChar(')');
return true;
- break;
+ }
case Address::DumpStyleModuleWithFileAddress:
show_module = true;
diff --git a/lldb/test/Shell/SymbolFile/Breakpad/stack-cfi-parsing.test b/lldb/test/Shell/SymbolFile/Breakpad/stack-cfi-parsing.test
index 539b8096b58bc..9fbd29489c89b 100644
--- a/lldb/test/Shell/SymbolFile/Breakpad/stack-cfi-parsing.test
+++ b/lldb/test/Shell/SymbolFile/Breakpad/stack-cfi-parsing.test
@@ -11,7 +11,7 @@ image show-unwind -n func0
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
-# CHECK-NEXT: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 0-0x0000000000000002)
+# CHECK-NEXT: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 0-2)
# CHECK-NEXT: row[0]: 0: CFA=DW_OP_breg7 +0 => rbp=DW_OP_breg7 +0 rip=DW_OP_pick 0x0
# 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
@@ -48,6 +48,6 @@ image show-unwind -n func9
# CHECK: Asynchronous (not restricted to call-sites) UnwindPlan is 'breakpad STACK CFI'
# CHECK: Synchronous (restricted to call-sites) UnwindPlan is 'breakpad STACK CFI'
# CHECK: Symbol file UnwindPlan:
-# CHECK: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 9-0x000000000000000a)
+# CHECK: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 9-10)
# CHECK: row[0]: 0: CFA=DW_OP_breg6 +0 => rip=DW_OP_breg0 +0
diff --git a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-raSearch.test b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-raSearch.test
index 0bcebaa00540d..580ccf8492a0f 100644
--- a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-raSearch.test
+++ b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-raSearch.test
@@ -15,7 +15,7 @@ image show-unwind -n call_many
# CHECK: This UnwindPlan is sourced from the compiler: yes.
# CHECK: This UnwindPlan is valid at all instruction locations: no.
# CHECK: This UnwindPlan is for a trap handler function: no.
-# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
+# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-4221)
# CHECK: row[0]: 0: CFA=RaSearch at SP+0 => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref
image show-unwind -n nonzero_frame_size
diff --git a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-cfi.test b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-cfi.test
index dade708519f5b..991ae4d47cba5 100644
--- a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-cfi.test
+++ b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-cfi.test
@@ -13,7 +13,7 @@ image show-unwind -n bar
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
-# CHECK-NEXT: Address range of this UnwindPlan: [unwind-via-stack-cfi..module_image + 1056-0x0000000000000449)
+# CHECK-NEXT: Address range of this UnwindPlan: [unwind-via-stack-cfi..module_image + 1056-1097)
# 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
thread backtrace
diff --git a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test
index 5698a4f63878a..674e9e43262eb 100644
--- a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test
+++ b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test
@@ -15,7 +15,7 @@ image show-unwind -n call_many
# CHECK: This UnwindPlan is sourced from the compiler: yes.
# CHECK: This UnwindPlan is valid at all instruction locations: no.
# CHECK: This UnwindPlan is for a trap handler function: no.
-# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
+# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-4221)
# 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
# Then, some invalid rules.
@@ -44,7 +44,7 @@ image show-unwind -n temporary_var
# CHECK: This UnwindPlan is sourced from the compiler: yes.
# CHECK: This UnwindPlan is valid at all instruction locations: no.
# CHECK: This UnwindPlan is for a trap handler function: no.
-# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-0x00001134)
+# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-4404)
# 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
# And finally, check that backtracing works as a whole by unwinding a simple
diff --git a/lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test b/lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test
index 249d2ef79a891..881f71dc03548 100644
--- a/lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test
+++ b/lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test
@@ -41,7 +41,7 @@ image show-unwind -n private_fn --cached true
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
-# CHECK-NEXT: Address range of this UnwindPlan: [a.stripped.PT_LOAD[1]..text + 16-0x0000000000000013)
+# CHECK-NEXT: Address range of this UnwindPlan: [a.stripped.PT_LOAD[1]..text + 16-19)
#--- a.s
diff --git a/lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test b/lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test
index b83e388e79d21..b926432c31196 100644
--- a/lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test
+++ b/lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test
@@ -22,7 +22,7 @@ image show-unwind --cached true -n foo
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
-# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 6-0x000000000000000b)[{{.*}}.text + 12-0x000000000000001b)[{{.*}}.text + 43-0x0000000000000039)[{{.*}}.text + 58-0x0000000000000045)
+# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 6-11)[{{.*}}.text + 12-27)[{{.*}}.text + 43-57)[{{.*}}.text + 58-69)
# CHECK-NEXT: row[0]: -37: CFA=rsp+32 => rbx=[CFA-16] rip=[CFA-8]
# CHECK-NEXT: row[1]: -33: CFA=rsp +8 => rbx=[CFA-16] rip=[CFA-8]
# 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
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
-# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 27-0x000000000000002b)
+# CHECK-NEXT: Address range of this UnwindPlan: [{{.*}}.text + 27-43)
# CHECK-NEXT: row[0]: 0: CFA=rsp +8 => rip=[CFA-8]
# CHECK-NEXT: row[1]: 4: CFA=rsp+96 => rip=[CFA-8]
# CHECK-NEXT: row[2]: 15: CFA=rsp +8 => rip=[CFA-8]
``````````
</details>
https://github.com/llvm/llvm-project/pull/141062
More information about the lldb-commits
mailing list