[Lldb-commits] [lldb] [lldb] Handle improperly nested blocks differently (PR #117725)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 26 06:31:34 PDT 2025


================
@@ -0,0 +1,100 @@
+## This test checks that lldb handles (corrupt?) debug info which has improperly
+## nested blocks. The behavior here is not prescriptive. We only want to check
+## that we do something "reasonable".
+
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s look_me_up1" \
+# RUN:   -o "image lookup -v -s look_me_up2" -o exit 2>&1 | FileCheck %s
+
+# CHECK-LABEL: image lookup -v -s look_me_up1
+# CHECK: warning: {{.*}} block 0x55 has a range [0x2, 0x4) which is not contained in the parent block 0x44
+# CHECK:    Function: id = {0x00000030}, name = "fn", range = [0x0000000000000000-0x0000000000000005)
+# CHECK:      Blocks: id = {0x00000030}, range = [0x00000000-0x00000005)
+# CHECK-NEXT:         id = {0x00000044}, range = [0x00000001-0x00000003)
+# CHECK-NEXT:         id = {0x00000055}, range = [0x00000002-0x00000004)
+# CHECK-NEXT: Symbol:
+
+# CHECK-LABEL: image lookup -v -s look_me_up2
+# CHECK:    Function: id = {0x00000030}, name = "fn", range = [0x0000000000000000-0x0000000000000005)
+# CHECK:      Blocks: id = {0x00000030}, range = [0x00000000-0x00000005)
+# CHECK-NEXT: Symbol:
+
+        .text
+        .p2align 12
+fn:
+        nop
+.Lblock1_begin:
+        nop
+.Lblock2_begin:
+look_me_up1:
+        nop
+.Lblock1_end:
+look_me_up2:
+        nop
+.Lblock2_end:
+        nop
+.Lfn_end:
+
+
+        .section        .debug_abbrev,"", at progbits
----------------
labath wrote:

I've added something, though it may not be exactly what you asked for. The problem is definitely in the DWARF. There isn't really a *function* here. The code is there just to provide labels that the debug info can refer to. (Or, think of it like this: it the debug info that defines what lldb considers to be a "function")

https://github.com/llvm/llvm-project/pull/117725


More information about the lldb-commits mailing list