[Lldb-commits] [PATCH] D62374: FuncUnwinders: prefer debug_frame over eh_frame
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 24 02:52:48 PDT 2019
labath created this revision.
labath added reviewers: jasonmolenda, clayborg.
The two sections usually contain the same information, and we rarely
have both kinds of entries for a single function. However, in theory the
debug_frame plan can be more complete, whereas eh_frame is only required
to be correct at places where exceptions can be thrown.
https://reviews.llvm.org/D62374
Files:
lit/Unwind/Inputs/prefer-debug-over-eh-frame.s
lit/Unwind/prefer-debug-over-eh-frame.test
source/Symbol/FuncUnwinders.cpp
Index: source/Symbol/FuncUnwinders.cpp
===================================================================
--- source/Symbol/FuncUnwinders.cpp
+++ source/Symbol/FuncUnwinders.cpp
@@ -60,10 +60,10 @@
if (UnwindPlanSP plan_sp = GetSymbolFileUnwindPlan(thread))
return plan_sp;
- if (UnwindPlanSP plan_sp = GetEHFrameUnwindPlan(target))
- return plan_sp;
if (UnwindPlanSP plan_sp = GetDebugFrameUnwindPlan(target))
return plan_sp;
+ if (UnwindPlanSP plan_sp = GetEHFrameUnwindPlan(target))
+ return plan_sp;
if (UnwindPlanSP plan_sp = GetCompactUnwindUnwindPlan(target))
return plan_sp;
if (UnwindPlanSP plan_sp = GetArmUnwindUnwindPlan(target))
@@ -323,10 +323,10 @@
if (UnwindPlanSP plan_sp = GetSymbolFileUnwindPlan(thread))
return plan_sp;
- if (UnwindPlanSP plan_sp = GetEHFrameAugmentedUnwindPlan(target, thread))
- return plan_sp;
if (UnwindPlanSP plan_sp = GetDebugFrameAugmentedUnwindPlan(target, thread))
return plan_sp;
+ if (UnwindPlanSP plan_sp = GetEHFrameAugmentedUnwindPlan(target, thread))
+ return plan_sp;
return assembly_sp;
}
Index: lit/Unwind/prefer-debug-over-eh-frame.test
===================================================================
--- /dev/null
+++ lit/Unwind/prefer-debug-over-eh-frame.test
@@ -0,0 +1,21 @@
+# Test that we prefer debug_frame over eh_frame unwind plans. They usually
+# contain the same information, and we rarely have both kinds of entries for a
+# single function. However, in theory the debug_frame plan can be more complete,
+# whereas eh_frame is only required to be correct at places where exceptions can
+# be thrown.
+
+# UNSUPPORTED: system-windows
+# REQUIRES: target-x86_64, native
+
+# RUN: %clang %p/Inputs/call-asm.c %p/Inputs/prefer-debug-over-eh-frame.s -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+breakpoint set -n bar
+# CHECK: Breakpoint 1: where = {{.*}}`bar
+
+process launch
+# CHECK: stop reason = breakpoint 1.1
+
+target modules show-unwind -n foo
+# CHECK: Asynchronous (not restricted to call-sites) UnwindPlan is 'DWARF CFI plus augmentation from assembly parsing'
+# CHECK: Synchronous (restricted to call-sites) UnwindPlan is 'DWARF CFI'
Index: lit/Unwind/Inputs/prefer-debug-over-eh-frame.s
===================================================================
--- /dev/null
+++ lit/Unwind/Inputs/prefer-debug-over-eh-frame.s
@@ -0,0 +1,38 @@
+ .cfi_sections .eh_frame, .debug_frame
+ .text
+ .globl bar
+bar:
+ .cfi_startproc
+ leal (%edi, %edi), %eax
+ ret
+ .cfi_endproc
+
+ .globl foo
+foo:
+ .cfi_startproc
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ call bar
+ addl $1, %eax
+ popq %rbp
+ ret
+ .cfi_endproc
+
+ .globl asm_main
+asm_main:
+ .cfi_startproc
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ movl $47, %edi
+
+ call foo
+ popq %rbp
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62374.201170.patch
Type: text/x-patch
Size: 3228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190524/a643bfe0/attachment.bin>
More information about the lldb-commits
mailing list