diff options
| author | Martin Storsjö <martin@martin.st> | 2019-10-30 23:57:40 +0200 |
|---|---|---|
| committer | Martin Storsjö <martin@martin.st> | 2019-10-31 11:26:21 +0200 |
| commit | 3db1d138b1172b5855f35ab74dbf3bf327f517d2 (patch) | |
| tree | 5635ff3b8f4030479070c997cee3dc315798d064 /lldb/test/Shell/ObjectFile | |
| parent | a42967f63c96b30dd6873ceb7b2932eb7cf2cd05 (diff) | |
| download | bcm5719-llvm-3db1d138b1172b5855f35ab74dbf3bf327f517d2.tar.gz bcm5719-llvm-3db1d138b1172b5855f35ab74dbf3bf327f517d2.zip | |
[LLDB] [PECOFF] Fix error handling for executables that object::createBinary errors out on
llvm::object::createBinary returns an Expected<>, which requires
not only checking the object for success, but also requires consuming
the Error, if one was set.
Use LLDB_LOG_ERROR for this case, and change an existing similar log
statement to use it as well, to make sure the Error is consumed even
if the log channel is disabled.
Differential Revision: https://reviews.llvm.org/D69646
Diffstat (limited to 'lldb/test/Shell/ObjectFile')
| -rw-r--r-- | lldb/test/Shell/ObjectFile/PECOFF/invalid-export-table.yaml | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/lldb/test/Shell/ObjectFile/PECOFF/invalid-export-table.yaml b/lldb/test/Shell/ObjectFile/PECOFF/invalid-export-table.yaml new file mode 100644 index 00000000000..79567278668 --- /dev/null +++ b/lldb/test/Shell/ObjectFile/PECOFF/invalid-export-table.yaml @@ -0,0 +1,81 @@ +## Test that errors in loading an exe doesn't crash lldb. +## The ExportTable RelativeVirtualAddress is out of bounds here. + +# RUN: yaml2obj %s > %t.exe +# RUN: %lldb %t.exe 2>&1 | FileCheck %s + +# CHECK: error: '{{.*}}' doesn't contain any {{.*}} platform architectures +--- !COFF +OptionalHeader: + AddressOfEntryPoint: 4096 + ImageBase: 1073741824 + SectionAlignment: 4096 + FileAlignment: 512 + MajorOperatingSystemVersion: 6 + MinorOperatingSystemVersion: 0 + MajorImageVersion: 0 + MinorImageVersion: 0 + MajorSubsystemVersion: 6 + MinorSubsystemVersion: 0 + Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI + DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ] + SizeOfStackReserve: 1048576 + SizeOfStackCommit: 4096 + SizeOfHeapReserve: 1048576 + SizeOfHeapCommit: 4096 + ExportTable: + RelativeVirtualAddress: 12345678 + Size: 100 + ImportTable: + RelativeVirtualAddress: 0 + Size: 0 + ResourceTable: + RelativeVirtualAddress: 0 + Size: 0 + ExceptionTable: + RelativeVirtualAddress: 0 + Size: 0 + CertificateTable: + RelativeVirtualAddress: 0 + Size: 0 + BaseRelocationTable: + RelativeVirtualAddress: 0 + Size: 0 + Debug: + RelativeVirtualAddress: 0 + Size: 0 + 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 ] +sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + VirtualAddress: 4096 + VirtualSize: 1 + SectionData: C3 +symbols: [] +... |

