rainers / cv2pdb

converter of DMD CodeView/DWARF debug information to PDB files
Artistic License 2.0
466 stars 110 forks source link

How do i use this on executable built using by mingw64-qmake? #89

Open Youda008 opened 1 year ago

Youda008 commented 1 year ago

I use mingw64 (gcc, gdb, mingw32-make) toolchain to build applications on Windows and i use the qt5-static package to produce graphical applications with all Qt libraries statically linked. I made a debug build that includes the debug information in the executable.

When i run cv2pdb, it completes without error, but apparently the resulting pdb does not load into Visual Studio (Professional 2022) correctly, because all i see is this obrazek

I tried putting the pdb file into the same directory as the crashed executable and the dump file, I tried adding that directory to the symbol paths in Visual Studio settings, but no luck so far.

I also noticed that my original executable had ~60MB, but after cv2pdb is has ~20MB while the pdb is only ~2.5MB, so clearly incomplete.

Is this scenario unsupported or do i need to setup something else?

rainers commented 1 year ago

I guess cv2pdb is stumbling over something in your debug information. If you can make your original executable available I might have a look. Please note that DWARF5 support is limited, so if the debug information is in this format you could try generating DWARF4 instead.

Youda008 commented 1 year ago

My executable is here DoomRunner.zip

rainers commented 1 year ago

Your executable uses DWARF 5 indeed. There was a recent addition to better support it that wasn't yet in a released binary. Did you try building cv2pdb from master? I now committed a tiny fix, but the version before also showed this call stack for your executable:

    KernelBase.dll!RaiseFailFastException() + 0x152 bytes   Unknown
    dr.exe!tryToWriteFile()    C++
    dr.exe!operator%<char, QString>()  C++
    dr.exe!operator%<char, QString>()  C++
    dr.exe!QList<Mod>::operator[]() Line 580    C++
    dr.exe!AListModel<Mod>::operator[]() Line 173   C++
    dr.exe!MainWindow::MainWindow() Line 342    C++
>   dr.exe!qMain() Line 29  C++
    dr.exe!__mingw_enum_import_library_names() C++
    dr.exe!__tmainCRTStartup() Line 268 C++
    dr.exe!WinMainCRTStartup() Line 159 C++
    kernel32.dll!BaseThreadInitThunk() + 0x14 bytes Unknown
    ntdll.dll!RtlUserThreadStart() + 0x21 bytes Unknown
Youda008 commented 1 year ago

I built the project from master, but unfortunatelly i'm getting simmilar results. cv2pdb spams a lot of messages warn: could not find equivalent entry for typePtr 05BA764E, the resulting .pdb file is just 2.7 MB (where did the other 40 MB go?) and Visual Studio shows nothing.

But maybe that's because i don't know how to load the .pdb into Visual Studio properly? It never asked me where is the pdb file and doesn't give me option to point to it manually, so there must be some auto-detection involved, and maybe it's not working. Found it https://www.codetinkerer.com/2017/12/06/debugging-3rd-party-nuget-packages.html

When i try to load that pdb file manually into Visual Studio, i get obrazek