Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breakpad: Basic support for STACK WIN unwinding
Summary: This patch makes it possible to unwind via breakpad STACK WIN records. It is "basic" because two important features are missing: - support for the .raSearch keyword - support for multiple STACK WIN records within a single function Right now, we just reject the .raSearch records, and always pick the first record for the whole function SymbolFileBreakpad, and so I think it can serve as a good example of what is needed of the symbol file and unwinding machinery to make this work. However, it is already useful for unwinding in some situations, and it sets up the general framework for the parsing of these kinds of records, which reduces the size of the followup patches implementing the two other components. Reviewers: amccarth, rnk, markmentovai Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D67067 llvm-svn: 371017
- Loading branch information
Showing
5 changed files
with
248 additions
and
27 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
lldb/lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-win.syms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
MODULE windows x86 897DD83EA8C8411897F3A925EE4BF7411 unwind-via-stack-win.pdb | ||
INFO CODE_ID 5D499B5C5000 unwind-via-stack-win.exe | ||
PUBLIC 0 0 dummy | ||
PUBLIC 10 0 call_many | ||
PUBLIC 80 0 main | ||
PUBLIC 90 0 many_pointer_args | ||
PUBLIC 100 0 bogus_rule | ||
PUBLIC 110 0 bogus_cfa_rhs | ||
PUBLIC 120 0 bogus_esp_rhs | ||
PUBLIC 130 0 temporary_var | ||
STACK WIN 4 10 6d 0 0 0 0 0 0 1 $T0 $esp 80 + = $eip $T0 ^ = $esp $T0 4 + = | ||
STACK WIN 4 80 8 0 0 0 0 0 0 1 $T0 $esp = $eip $T0 ^ = $esp $T0 4 + = | ||
STACK WIN 4 90 5 0 0 50 0 0 0 1 $T0 $esp = $eip $T0 ^ = $esp $T0 4 + = | ||
STACK WIN 4 100 4 0 0 0 0 0 0 1 bogus | ||
STACK WIN 4 110 4 0 0 0 0 0 0 1 $T0 $bogus = $eip $T0 ^ = $esp $T0 4 + = | ||
STACK WIN 4 120 4 0 0 0 0 0 0 1 $T0 $esp = $eip $T0 ^ = $esp $bogus 4 + = | ||
STACK WIN 4 130 4 0 0 0 0 0 0 1 $T0 $esp = $bogus $T0 = $eip $bogus ^ = $esp $T0 4 + = |
35 changes: 35 additions & 0 deletions
35
lldb/lit/SymbolFile/Breakpad/Inputs/unwind-via-stack-win.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- !minidump | ||
Streams: | ||
- Type: ThreadList | ||
Threads: | ||
- Thread Id: 0x0000290C | ||
Priority Class: 0x00000020 | ||
Environment Block: 0x0000000000A98000 | ||
Context: 3F0001000000000000000000000000000000000000000000000000007F02000000000000FFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002B000000530000002B0000002B00000080100B0080100B000050A90080100B0080100B0000000000E4FECF0092100B0023000000440301007CFECF002B0000007F0200000000000000000000000000000000000000000000801F0000FFFF020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000144E3D6C2000000001000000EA1E00F4C000E50700000000FC0100002CE3C014D8E202010000E507880F401D839DC60100000000400000007F00000000000000880F401D0A000000900F401D0000000000000100EA1E00009808E5077F00000000000000000000009008E507990100006002E5072CABC87708346474B42300000100000044E3C014200000000000000020532777A80F401D4F346474D00F401D6F378CCC5C4CD5010000000000000000000000000000000000000000000000003AFCD72F90E3C01418CE3470B4230000B80F401DC00F401DC80F401DD00F401D | ||
Stack: | ||
Start of Memory Range: 0x0000000000CFFE78 | ||
Content: 0000000079100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0085100B0094842777 | ||
- Type: ModuleList | ||
Modules: | ||
- Base of Image: 0x00000000000B1000 | ||
Size of Image: 0x00004000 | ||
Module Name: 'unwind-via-stack-win.exe' | ||
CodeView Record: 525344533ED87D89C8A8184197F3A925EE4BF74101000000433A5C70726F6A656374735C746573745F6170705C436F6E736F6C654170706C69636174696F6E315C44656275675C436F6E736F6C654170706C69636174696F6E312E70646200 | ||
- Base of Image: 0x0000000077260000 | ||
Size of Image: 0x000E0000 | ||
Module Name: 'C:\Windows\System32\kernel32.dll' | ||
CodeView Record: 5253445300F90A57CF8DED8A463A90390318CD4401000000776B65726E656C33322EFFFFFFFF | ||
- Type: MemoryList | ||
Memory Ranges: | ||
- Start of Memory Range: 0x0000000000CFFE78 | ||
Content: 0000000079100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0085100B0094842777 | ||
- Type: SystemInfo | ||
Processor Arch: X86 | ||
Platform ID: Win32NT | ||
CPU: | ||
Vendor ID: AuthenticAMD | ||
Version Info: 0x00800F82 | ||
Feature Info: 0x178BFBFF | ||
- Type: MiscInfo | ||
Content: 54050000F703000008290000C883495D0000000000000000AC0D000098080000AC0D00000200000002000000002000000D0000000000000002000000C4FFFFFF430065006E007400720061006C0020004500750072006F007000650020005300740061006E0064006100720064002000540069006D006500000000000000000000000A0000000500030000000000000000000000430065006E007400720061006C0020004500750072006F00700065002000530075006D006D00650072002000540069006D00650000000000000000000000000000000300000005000200000000000000C4FFFFFF310037003100330034002E0031002E007800380036006600720065002E007200730034005F00720065006C0065006100730065002E003100380030003400310030002D00310038003000340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064006200670063006F00720065002E0069003300380036002C00310030002E0030002E00310037003100330034002E0031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006C816B92 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# RUN: yaml2obj %S/Inputs/unwind-via-stack-win.yaml > %t | ||
# RUN: %lldb -c %t \ | ||
# RUN: -o "target symbols add %S/Inputs/unwind-via-stack-win.syms" \ | ||
# RUN: -s %s -b | FileCheck %s | ||
|
||
# First check that unwind plan generation works correctly. | ||
# This function has a "typical" unwind rule. | ||
image show-unwind -n call_many | ||
# CHECK-LABEL: image show-unwind -n call_many | ||
# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`call_many | ||
# CHECK: Symbol file UnwindPlan: | ||
# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN | ||
# CHECK: This UnwindPlan is sourced from the compiler: yes. | ||
# CHECK: This UnwindPlan is valid at all instruction locations: no. | ||
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 16-0x0000007d) | ||
# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0, DW_OP_consts +80, DW_OP_plus => esp=DW_OP_pick 0x00, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x00, DW_OP_deref | ||
|
||
# Then, some invalid rules. | ||
image show-unwind -n bogus_rule | ||
# CHECK-LABEL: image show-unwind -n bogus_rule | ||
# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_rule | ||
# CHECK-NOT: Symbol file | ||
|
||
image show-unwind -n bogus_cfa_rhs | ||
# CHECK-LABEL: image show-unwind -n bogus_cfa_rhs | ||
# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_cfa_rhs | ||
# CHECK-NOT: Symbol file | ||
|
||
image show-unwind -n bogus_esp_rhs | ||
# CHECK-LABEL: image show-unwind -n bogus_esp_rhs | ||
# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`bogus_esp_rhs | ||
# CHECK-NOT: Symbol file | ||
|
||
# We don't treat unknown lhs as an error, as it can be just a temporary | ||
# variable used in other rules. | ||
image show-unwind -n temporary_var | ||
# CHECK-LABEL: image show-unwind -n temporary_var | ||
# CHECK: UNWIND PLANS for unwind-via-stack-win.exe`temporary_var | ||
# CHECK: Symbol file UnwindPlan: | ||
# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN | ||
# CHECK: This UnwindPlan is sourced from the compiler: yes. | ||
# CHECK: This UnwindPlan is valid at all instruction locations: no. | ||
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 304-0x00000134) | ||
# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0 => esp=DW_OP_pick 0x00, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x00, DW_OP_deref | ||
|
||
# And finally, check that backtracing works as a whole by unwinding a simple | ||
# stack. | ||
thread backtrace | ||
# CHECK-LABEL: thread backtrace | ||
# CHECK: frame #0: 0x000b1092 unwind-via-stack-win.exe`many_pointer_args | ||
# CHECK: frame #1: 0x000b1079 unwind-via-stack-win.exe`call_many + 105 | ||
# CHECK: frame #2: 0x000b1085 unwind-via-stack-win.exe`main + 5 | ||
# CHECK: frame #3: 0x77278494 kernel32.dll | ||
# CHECK-NOT: frame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters