llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.61k stars 11.35k forks source link

LLDB does not load symbols from a pdb file #91060

Open I-ABD-I opened 3 months ago

I-ABD-I commented 3 months ago

i am trying to debug a UEFI rust application and when i try to load the generated pdb file it does not load any symbols and throws this error

(lldb) target create c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.efi
(lldb) Current executable set to 'c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.efi' (x86_64).
(lldb) target symbols add c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.pdb 
error: Assertion failed: (obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS), function InitializeObject, file SymbolFilePDB.cpp, line 204
 #0 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x57d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x38e2a6
 #1 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x53995e C:\Program Files\LLVM\bin\liblldb.dll 0xc66a21
 #2 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x8e7dc0 C:\Program Files\LLVM\bin\liblldb.dll 0x8e7ce5
 #3 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x25dac8 C:\Program Files\LLVM\bin\liblldb.dll 0x991dbe
 #4 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x98ff3d C:\Program Files\LLVM\bin\liblldb.dll 0x29390d
 #5 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x2a98d5 C:\Program Files\LLVM\bin\liblldb.dll 0x2adb50
 #6 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x834c52 C:\Program Files\LLVM\bin\liblldb.dll 0x222cae
 #7 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x2af881 C:\Program Files\LLVM\bin\liblldb.dll 0x3fe52
 #8 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\lldb.exe 0x4568 C:\Program Files\LLVM\bin\lldb.exe 0x52a9
 #9 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\lldb.exe 0x2adb4 (C:\Program Files\LLVM\bin\liblldb.dll+0x57d3f7)
#10 0x00007ffda8c2d3f7
#11 0x00007ffda8c2d3f7 (C:\Program Files\LLVM\bin\liblldb.dll+0x57d3f7)
0x00007FFDA8C2D3F7, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x57D3F7 byte(s), PyInit__lldb() + 0x48E937 byte(s)
0x00007FFDA8A3E2A6, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x38E2A6 byte(s), PyInit__lldb() + 0x29F7E6 byte(s)
0x00007FFDA8BE995E, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x53995E byte(s), PyInit__lldb() + 0x44AE9E byte(s)
0x00007FFDA9316A21, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0xC66A21 byte(s), PyInit__lldb() + 0xB77F61 byte(s)
0x00007FFDA8F97DC0, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x8E7DC0 byte(s), PyInit__lldb() + 0x7F9300 byte(s)
0x00007FFDA8F97CE5, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x8E7CE5 byte(s), PyInit__lldb() + 0x7F9225 byte(s)
0x00007FFDA890DAC8, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x25DAC8 byte(s), PyInit__lldb() + 0x16F008 byte(s)
0x00007FFDA9041DBE, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x991DBE byte(s), PyInit__lldb() + 0x8A32FE byte(s)
0x00007FFDA903FF3D, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x98FF3D byte(s), PyInit__lldb() + 0x8A147D byte(s)
0x00007FFDA894390D, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x29390D byte(s), PyInit__lldb() + 0x1A4E4D byte(s)
0x00007FFDA89598D5, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x2A98D5 byte(s), PyInit__lldb() + 0x1BAE15 byte(s)
0x00007FFDA895DB50, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x2ADB50 byte(s), PyInit__lldb() + 0x1BF090 byte(s)
0x00007FFDA8EE4C52, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x834C52 byte(s), PyInit__lldb() + 0x746192 byte(s)
0x00007FFDA88D2CAE, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x222CAE byte(s), PyInit__lldb() + 0x1341EE byte(s)
0x00007FFDA895F881, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x2AF881 byte(s), PyInit__lldb() + 0x1C0DC1 byte(s)
0x00007FFDA86EFE52, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x3FE52 byte(s), ?RunCommandInterpreter@SBDebugger@lldb@@QEAAX_N0@Z() + 0xF2 byte(s)
0x00007FF68ED74568, C:\Program Files\LLVM\bin\lldb.exe(0x00007FF68ED70000) + 0x4568 byte(s)
0x00007FF68ED752A9, C:\Program Files\LLVM\bin\lldb.exe(0x00007FF68ED70000) + 0x52A9 byte(s)
0x00007FF68ED9ADB4, C:\Program Files\LLVM\bin\lldb.exe(0x00007FF68ED70000) + 0x2ADB4 byte(s)
0x00007FFEBA29257D, C:\WINDOWS\System32\KERNEL32.DLL(0x00007FFEBA280000) + 0x1257D byte(s), BaseThreadInitThunk() + 0x1D byte(s)
0x00007FFEBB76AA48, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FFEBB710000) + 0x5AA48 byte(s), RtlUserThreadStart() + 0x28 byte(s)
Please file a bug report against lldb reporting this failure log, and as many details as possible
(lldb) symbol file 'c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.pdb' has been added to 'c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.efi

i tried using code lldb launch config i found on osdev wiki but symbols are still not loading

{
            "type": "lldb",
            "request": "custom",
            "name": "Custom launch",
            "targetCreateCommands": [
                "target create --no-dependents ${workspaceFolder}/target/x86_64-unknown-uefi/debug/os.efi --symfile ${workspaceFolder}/target/x86_64-unknown-uefi/debug/os.pdb"
            ],
            "processCreateCommands": ["gdb-remote localhost:1234"]
}

i tried checking the pdb file using llvm-pdbutil and it seems fine (at least as much as i know)

when i tried using wsl2 it didn't throw this error but the symbols were still missing, same thing happened when tried compiling with RUSTFLAGS="-C debuginfo=2"

llvmbot commented 3 months ago

@llvm/issue-subscribers-lldb

Author: Aylon Ben Dvora (I-ABD-I)

i am trying to debug a UEFI rust application and when i try to load the generated pdb file it does not load any symbols and throws this error ``` (lldb) target create c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.efi (lldb) Current executable set to 'c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.efi' (x86_64). (lldb) target symbols add c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.pdb error: Assertion failed: (obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS), function InitializeObject, file SymbolFilePDB.cpp, line 204 #0 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x57d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x38e2a6 #1 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x53995e C:\Program Files\LLVM\bin\liblldb.dll 0xc66a21 #2 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x8e7dc0 C:\Program Files\LLVM\bin\liblldb.dll 0x8e7ce5 #3 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x25dac8 C:\Program Files\LLVM\bin\liblldb.dll 0x991dbe #4 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x98ff3d C:\Program Files\LLVM\bin\liblldb.dll 0x29390d #5 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x2a98d5 C:\Program Files\LLVM\bin\liblldb.dll 0x2adb50 #6 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x834c52 C:\Program Files\LLVM\bin\liblldb.dll 0x222cae #7 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\liblldb.dll 0x2af881 C:\Program Files\LLVM\bin\liblldb.dll 0x3fe52 #8 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\lldb.exe 0x4568 C:\Program Files\LLVM\bin\lldb.exe 0x52a9 #9 0x00007ffda8c2d3f7 C:\Program Files\LLVM\bin\lldb.exe 0x2adb4 (C:\Program Files\LLVM\bin\liblldb.dll+0x57d3f7) #10 0x00007ffda8c2d3f7 #11 0x00007ffda8c2d3f7 (C:\Program Files\LLVM\bin\liblldb.dll+0x57d3f7) 0x00007FFDA8C2D3F7, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x57D3F7 byte(s), PyInit__lldb() + 0x48E937 byte(s) 0x00007FFDA8A3E2A6, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x38E2A6 byte(s), PyInit__lldb() + 0x29F7E6 byte(s) 0x00007FFDA8BE995E, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x53995E byte(s), PyInit__lldb() + 0x44AE9E byte(s) 0x00007FFDA9316A21, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0xC66A21 byte(s), PyInit__lldb() + 0xB77F61 byte(s) 0x00007FFDA8F97DC0, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x8E7DC0 byte(s), PyInit__lldb() + 0x7F9300 byte(s) 0x00007FFDA8F97CE5, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x8E7CE5 byte(s), PyInit__lldb() + 0x7F9225 byte(s) 0x00007FFDA890DAC8, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x25DAC8 byte(s), PyInit__lldb() + 0x16F008 byte(s) 0x00007FFDA9041DBE, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x991DBE byte(s), PyInit__lldb() + 0x8A32FE byte(s) 0x00007FFDA903FF3D, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x98FF3D byte(s), PyInit__lldb() + 0x8A147D byte(s) 0x00007FFDA894390D, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x29390D byte(s), PyInit__lldb() + 0x1A4E4D byte(s) 0x00007FFDA89598D5, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x2A98D5 byte(s), PyInit__lldb() + 0x1BAE15 byte(s) 0x00007FFDA895DB50, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x2ADB50 byte(s), PyInit__lldb() + 0x1BF090 byte(s) 0x00007FFDA8EE4C52, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x834C52 byte(s), PyInit__lldb() + 0x746192 byte(s) 0x00007FFDA88D2CAE, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x222CAE byte(s), PyInit__lldb() + 0x1341EE byte(s) 0x00007FFDA895F881, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x2AF881 byte(s), PyInit__lldb() + 0x1C0DC1 byte(s) 0x00007FFDA86EFE52, C:\Program Files\LLVM\bin\liblldb.dll(0x00007FFDA86B0000) + 0x3FE52 byte(s), ?RunCommandInterpreter@SBDebugger@lldb@@QEAAX_N0@Z() + 0xF2 byte(s) 0x00007FF68ED74568, C:\Program Files\LLVM\bin\lldb.exe(0x00007FF68ED70000) + 0x4568 byte(s) 0x00007FF68ED752A9, C:\Program Files\LLVM\bin\lldb.exe(0x00007FF68ED70000) + 0x52A9 byte(s) 0x00007FF68ED9ADB4, C:\Program Files\LLVM\bin\lldb.exe(0x00007FF68ED70000) + 0x2ADB4 byte(s) 0x00007FFEBA29257D, C:\WINDOWS\System32\KERNEL32.DLL(0x00007FFEBA280000) + 0x1257D byte(s), BaseThreadInitThunk() + 0x1D byte(s) 0x00007FFEBB76AA48, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FFEBB710000) + 0x5AA48 byte(s), RtlUserThreadStart() + 0x28 byte(s) Please file a bug report against lldb reporting this failure log, and as many details as possible (lldb) symbol file 'c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.pdb' has been added to 'c:\Users\aylon\Documents\os\target\x86_64-unknown-uefi\debug\os.efi ``` i tried using code lldb launch config i found on osdev wiki but symbols are still not loading ``` { "type": "lldb", "request": "custom", "name": "Custom launch", "targetCreateCommands": [ "target create --no-dependents ${workspaceFolder}/target/x86_64-unknown-uefi/debug/os.efi --symfile ${workspaceFolder}/target/x86_64-unknown-uefi/debug/os.pdb" ], "processCreateCommands": ["gdb-remote localhost:1234"] } ``` i tried checking the pdb file using llvm-pdbutil and it seems fine (at least as much as i know) when i tried using wsl2 it didnt throw this error but the symbols were still missing, same thing happend when tried compiling with RUSTFLAGS="-C debuginfo=2"
manison commented 2 months ago

Same error here.

I'm adding module with target modules add:

(lldb) target modules add -s C:\Projects\uefi\debugger_test\debugger.pdb C:\Projects\uefi\debugger_test\debugger.efi
error: Assertion failed: (obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS), function InitializeObject, file SymbolFilePDB.cpp, line 204
 #0 0x00007ffe6299f2a6 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x2e3f2a6)
 #1 0x00007ffe6064f3da PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0xaef3da)
 #2 0x00007ffe607f250d PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0xc9250d)
 #3 0x00007ffe60f0b5df PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x13ab5df)
 #4 0x00007ffe60be288f PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x108288f)
 #5 0x00007ffe60be27b5 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x10827b5)
 #6 0x00007ffe60530997 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x9d0997)
 #7 0x00007ffe60532d27 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x9d2d27)
 #8 0x00007ffe605be419 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0xa5e419)
 #9 0x00007ffe60c5cb39 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x10fcb39)
#10 0x00007ffe6055aa28 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x9faa28)
#11 0x00007ffe6056f134 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0xa0f134)
#12 0x00007ffe60573556 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0xa13556)
#13 0x00007ffe60bb5332 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x1055332)
#14 0x00007ffe604ee2a7 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x98e2a7)
#15 0x00007ffe60574f10 PyInit__lldb (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0xa14f10)
#16 0x00007ffe60314342 lldb::SBDebugger::RunCommandInterpreter(bool, bool) (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\liblldb.dll+0x7b4342)
#17 0x00007ff796e4e925 (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\lldb.exe+0xe925)
#18 0x00007ff796e4f328 (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\lldb.exe+0xf328)
#19 0x00007ff796e5c770 (C:\Prg\llvm\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin\lldb.exe+0x1c770)
#20 0x00007fff3818257d (C:\windows\System32\KERNEL32.DLL+0x1257d)
#21 0x00007fff39caaa48 (C:\windows\SYSTEM32\ntdll.dll+0x5aa48)
Please file a bug report against lldb reporting this failure log, and as many details as possible

This is on Windows release 18.1.5 with MS DIA PDB parser.

When forced to use NativePDB parser (LLDB_USE_NATIVE_PDB_READER=1) it works quite all right.