I think how gdb works on Windows under mingw? When compile with mingw C into .exe, it creates PE file, right (so Windows can run it).
But then you want debug the .exe with gdb. This gdb knows to debug PE file? How? Does it read debug info from PE file? Is it Dwarf debug info or something else?
As you say, in order to run natively on windows mingw obviously produces PE executables.
Run
objdump -s your.exe
to see the sections embedded in the PE file mingw produces. (.debug_*
). If you build the same executable on, say, Linux and do the same thing you'll see the section names match. Adding in the-s
argument to objdump shows the section contents and you'll see the format looks the same, so mingw must be using DWARF.