Skip to content

Commit

Permalink
[lldb] add lit.local.cfg for breakpad tests
Browse files Browse the repository at this point in the history
The reason is to add .yaml as a valid test suffix. The test folder
contains one yaml file, which wasn't being run because of that.

Unsurprisingly the test fails, but this was not because the underlying
functionality was broken, but rather because the test was setup
incorrectly (most likely due to overly aggressive simplification of the
test data on my part).

Therefore this patch also tweaks the test inputs in order to test what
they are supposed to test, and also updates some other breakpad tests
(because they depend on the same inputs as this one) to be more
realistic -- specifically it avoids putting symbols to the first page of
the module, as that's where normally the COFF header would reside.
  • Loading branch information
labath committed Mar 25, 2020
1 parent bd069ad commit c726753
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 88 deletions.
26 changes: 13 additions & 13 deletions lldb/test/Shell/SymbolFile/Breakpad/Inputs/unwind-via-raSearch.syms
@@ -1,15 +1,15 @@
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 complex_rasearch
PUBLIC 110 0 esp_rasearch
PUBLIC 120 0 nonzero_frame_size
STACK WIN 4 10 6d 0 0 0 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 80 8 0 0 0 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 90 5 0 0 50 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 100 4 0 0 0 0 0 0 1 $T0 .raSearch 80 + = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 110 4 0 0 0 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp .raSearch 4 + =
STACK WIN 4 120 4 0 0 0 4 8 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
PUBLIC 1000 0 dummy
PUBLIC 1010 0 call_many
PUBLIC 1080 0 main
PUBLIC 1090 0 many_pointer_args
PUBLIC 1100 0 complex_rasearch
PUBLIC 1110 0 esp_rasearch
PUBLIC 1120 0 nonzero_frame_size
STACK WIN 4 1010 6d 0 0 0 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1080 8 0 0 0 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1090 5 0 0 50 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1100 4 0 0 0 0 0 0 1 $T0 .raSearch 80 + = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1110 4 0 0 0 0 0 0 1 $T0 .raSearch = $eip $T0 ^ = $esp .raSearch 4 + =
STACK WIN 4 1120 4 0 0 0 4 8 0 1 $T0 .raSearch = $eip $T0 ^ = $esp $T0 4 + =
@@ -1,17 +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 + =
PUBLIC 1000 0 dummy
PUBLIC 1010 0 call_many
PUBLIC 1080 0 main
PUBLIC 1090 0 many_pointer_args
PUBLIC 1100 0 bogus_rule
PUBLIC 1110 0 bogus_cfa_rhs
PUBLIC 1120 0 bogus_esp_rhs
PUBLIC 1130 0 temporary_var
STACK WIN 4 1010 6d 0 0 0 0 0 0 1 $T0 $esp 80 + = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1080 8 0 0 0 0 0 0 1 $T0 $esp = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1090 5 0 0 50 0 0 0 1 $T0 $esp = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1100 4 0 0 0 0 0 0 1 bogus
STACK WIN 4 1110 4 0 0 0 0 0 0 1 $T0 $bogus = $eip $T0 ^ = $esp $T0 4 + =
STACK WIN 4 1120 4 0 0 0 0 0 0 1 $T0 $esp = $eip $T0 ^ = $esp $bogus 4 + =
STACK WIN 4 1130 4 0 0 0 0 0 0 1 $T0 $esp = $bogus $T0 = $eip $bogus ^ = $esp $T0 4 + =
Expand Up @@ -11,7 +11,7 @@ Streams:
Content: 0000000079100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0085100B0094842777
- Type: ModuleList
Modules:
- Base of Image: 0x00000000000B1000
- Base of Image: 0x00000000000B0000
Size of Image: 0x00004000
Module Name: 'unwind-via-stack-win.exe'
CodeView Record: 525344533ED87D89C8A8184197F3A925EE4BF74101000000433A5C70726F6A656374735C746573745F6170705C436F6E736F6C654170706C69636174696F6E315C44656275675C436F6E736F6C654170706C69636174696F6E312E70646200
Expand Down
1 change: 1 addition & 0 deletions lldb/test/Shell/SymbolFile/Breakpad/lit.local.cfg
@@ -0,0 +1 @@
config.suffixes = ['.test', '.yaml']
Expand Up @@ -12,7 +12,7 @@ image show-unwind -n call_many
# 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: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
# CHECK: row[0]: 0: CFA=RaSearch@SP+0 => esp=DW_OP_pick 0x00, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x00, DW_OP_deref

image show-unwind -n nonzero_frame_size
Expand Down
@@ -1,13 +1,13 @@
# RUN: yaml2obj --docnum=1 %s > %t.dmp
# RUN: yaml2obj --docnum=2 %s > %t.exe
# RUN: %lldb -c %t.dmp %t.exe \
# RUN: yaml2obj --docnum=2 %s > %T/unwind-via-stack-win-no-memory-info.exe
# RUN: %lldb -c %t.dmp %T/unwind-via-stack-win-no-memory-info.exe \
# RUN: -o "target symbols add %S/Inputs/unwind-via-raSearch.syms" \
# RUN: -o "thread backtrace" -b | FileCheck %s

# 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 #0: 0x000b1092 unwind-via-stack-win-no-memory-info.exe`many_pointer_args
# CHECK: frame #1: 0x000b1079 unwind-via-stack-win-no-memory-info.exe`call_many + 105
# CHECK: frame #2: 0x000b1085 unwind-via-stack-win-no-memory-info.exe`main + 5
# CHECK: frame #3: 0x77278494 kernel32.dll
# CHECK-NOT: frame

Expand All @@ -24,7 +24,7 @@ Streams:
Content: 0000000079100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0000100B0085100B0094842777
- Type: ModuleList
Modules:
- Base of Image: 0x00000000000B1000
- Base of Image: 0x00000000000B0000
Size of Image: 0x00004000
Module Name: 'unwind-via-stack-win.exe'
CodeView Record: 525344533ED87D89C8A8184197F3A925EE4BF74101000000433A5C70726F6A656374735C746573745F6170705C436F6E736F6C654170706C69636174696F6E315C44656275675C436F6E736F6C654170706C69636174696F6E312E70646200
Expand Down Expand Up @@ -65,69 +65,21 @@ OptionalHeader:
SizeOfStackCommit: 4096
SizeOfHeapReserve: 1048576
SizeOfHeapCommit: 4096
ExportTable:
RelativeVirtualAddress: 8327
Size: 90
ImportTable:
RelativeVirtualAddress: 0
Size: 0
ResourceTable:
RelativeVirtualAddress: 0
Size: 0
ExceptionTable:
RelativeVirtualAddress: 12288
Size: 12
CertificateTable:
RelativeVirtualAddress: 0
Size: 0
BaseRelocationTable:
RelativeVirtualAddress: 0
Size: 0
Debug:
RelativeVirtualAddress: 8192
Size: 28
Architecture:
RelativeVirtualAddress: 0
Size: 0
GlobalPtr:
RelativeVirtualAddress: 0
Size: 0
TlsTable:
RelativeVirtualAddress: 0
Size: 0
LoadConfigTable:
RelativeVirtualAddress: 0
Size: 0
BoundImport:
RelativeVirtualAddress: 0
Size: 0
IAT:
RelativeVirtualAddress: 0
Size: 0
DelayImportDescriptor:
RelativeVirtualAddress: 0
Size: 0
ClrRuntimeHeader:
RelativeVirtualAddress: 0
Size: 0
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 4096
VirtualSize: 22
SectionData: 50894C24048B4C24040FAF4C2404890C248B042459C3
VirtualSize: 512
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 8192
VirtualSize: 236
SectionData: 00000000A565B65C00000000020000006B0000001C2000001C060000525344533ED87D89C8A8184197F3A925EE4BF74101000000443A5C757073747265616D5C6275696C645C746F6F6C735C6C6C64625C6C69745C4D6F64756C65735C5045434F46465C4F75747075745C6578706F72742D646C6C66756E632E79616D6C2E746D702E70646200000000000000000000000000AF200000000000000200000001000000CB200000D3200000D72000006578706F72742D646C6C66756E632E79616D6C2E746D702E646C6C000000000000100000D92000000100446C6C46756E63000000000101010001020000
- Name: .pdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 12288
VirtualSize: 12
SectionData: '0010000016100000E4200000'
SectionData: 00000000A565B65C00000000020000006B0000001C2000001C060000525344533ED87D89C8A8184197F3A925EE4BF74101
symbols: []
...
4 changes: 2 additions & 2 deletions lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win.test
Expand Up @@ -14,7 +14,7 @@ image show-unwind -n call_many
# 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: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
# 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.
Expand Down Expand Up @@ -42,7 +42,7 @@ image show-unwind -n temporary_var
# 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: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-0x00001134)
# 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
Expand Down

0 comments on commit c726753

Please sign in to comment.