This PR implements `SymbolFileNativePDB::AddSymbols` which adds public
symbols to the symbol table.
These symbols are found in the publics stream. It contains mangled names
coupled with addresses. Addresses are a pair of (segment, offset).
If I understood correctly, then the segment is the section ID from the
COFF header. Sections are already
[constructed](c48ec7fb60/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (L1048))
using this 1-based index ([MS
docs](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#section-table-section-headers)).
This allows us to use `section_list->FindSectionByID`.
35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
// clang-format off
|
|
// REQUIRES: lld, x86
|
|
|
|
// Test that we can show disassembly and source.
|
|
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
|
|
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
|
|
// RUN: %lldb -f %t.exe -s \
|
|
// RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s
|
|
|
|
// Some context lines before the function.
|
|
|
|
int foo() { return 42; }
|
|
|
|
int main(int argc, char **argv) {
|
|
foo();
|
|
return 0;
|
|
}
|
|
|
|
|
|
// CHECK: (lldb) disassemble --flavor=intel -m -n main
|
|
// CHECK: ** 14 int main(int argc, char **argv) {
|
|
// CHECK: disassembly.cpp.tmp.exe`main:
|
|
// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+0>: sub rsp, 0x38
|
|
// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+4>: mov dword ptr [rsp + 0x34], 0x0
|
|
// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+12>: mov qword ptr [rsp + 0x28], rdx
|
|
// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+17>: mov dword ptr [rsp + 0x24], ecx
|
|
// CHECK: ** 15 foo();
|
|
// CHECK: disassembly.cpp.tmp.exe[{{.*}}] <+21>: call {{.*}} ; foo at disassembly.cpp:12
|
|
// CHECK: ** 16 return 0;
|
|
// CHECK-NEXT: 17 }
|
|
// CHECK-NEXT: 18
|
|
// CHECK: disassembly.cpp.tmp.exe[{{.*}}] <+26>: xor eax, eax
|
|
// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+28>: add rsp, 0x38
|
|
// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+32>: ret
|