[Development] [RFCs] Migrate from GCC MinGW to LLVM MinGW
Martin Storsjö
martin at martin.st
Fri Jul 21 14:46:54 CEST 2023
On Fri, 21 Jul 2023, Cristian Adam wrote:
> Right, lldb was using the DWARF debugging information 🙁
>
> I've attached 3 screenshots of Qt Creator using lldb:
>
> 1. Unstripped MaxiDump.exe showed the bad source line and the correct
> stacktrace (due to DWARF information)
> 2. Stripped MaxiDump.exe with LLVM MinGW's lldb showed only assembly with
> bad stacktrace
> 3. Stripped MaxiDump.exe with the official llvm.org binaries (MSVC flavor)
> showed also assembly but with proper stacktrace.
If this was from the same build of MaxiDump.exe - if the debug info for
the relevant translation units was written as DWARF, it probably wasn't
written as CodeView for PDB. Or was that based on a new build where you
made sure "-g -gcodeview" was used in more places?
IIRC it's possible to generate both DWARF and CodeView debug info at the
same time too, but I haven't looked into how to do that (if it'd be enough
to just add a -gdwarf or something like that?).
> For number 3 I've tried with a copy of "c:\Program Files (x86)\Microsoft
> Visual Studio\2019\BuildTools\DIA SDK\bin\amd64\msdia140.dll" in "c:\Program
> Files\LLVM\bin" and without.
>
> I know that the llvm.org lldb binary is built using DIA SDK.
Indeed, LLVM/LLDB's own PDB support is incomplete - it works for some
cases but not everything.
> Then I decided to test clang-cl 16.0.6 and test the two lldb.exe versions.
>
> The LLVM MinGW (stripped) binary and dmp files:
>
> * MaxiDump.exe 15,872 bytes
> * MaxiDump.dmp 29,878,132 bytes
>
> The clang-cl binary and dmp files:
>
> * MaxiDump.exe 15,360 bytes
> * MaxiDump.dmp 28,460,315 bytes
>
> They ware more or less the "same".
>
> Then I loaded the "core" file and the results are:
>
> * MSVC lldb.exe loaded the source file, but pointed at the wrong line,
> also the stack trace was missing one level
> * MinGW lldb.exe loaded the source file at the right location and the
> stacktrace was fine!
Now that's odd...
> Since MinGW lldb.exe can load a MiniDump file produced by clang-cl just
> fine, I assume there is a bug in the generation step of the MiniDump when
> using the llvm mingw binaries.
Hmm, that's possible.
In any case, if the main intended usecase is with lldb, then using DWARF
for the debug info should probably be the best supported path.
I'll see if I can reproduce your results and maybe look into things at
some point...
If you can fill in the github issue with reproduction steps in the form of
exact compilation commands (bypassing cmake, just running a single command
to compile+link is clearest) - from the ground up, compiling, stripping,
running executables, running command line lldb to inspect the results -
it'd be a bit more straightforward to look into and pinpoint potential
issues.
At least from the looks of your cmake file, you're passing the -Wl,--pdb=
option for writing a PDB file, but you're not specifying -gcodeview
anywhere, so it uses the toolchain default of generating DWARF debug info
only.
// Martin
More information about the Development
mailing list