OS: Win10 Pro 20H2, 32-bit
Compiler: gcc 11.2.0 (provided by MSYS2)
libbacktrace version: master branch downloaded from Github on 2022-03-29 (also tested with the MSYS2 libbacktrace package, version r53.1da441c-3, built on 2022-01-16)
libbacktrace doesn't supply filename or line information for programs compiled on my computer, which I'm pretty sure is a result of it not supporting address space layout randomization for 32-bit PE/COFF. If I clear the DYNAMIC_BASE bit in the executable's COFF header, or if I link with "-Wl,--disable-dynamicbase" to prevent it from getting set in the first place, then libbacktrace works properly.
While debugging this, I tried modifying coff_add() in "pecoff.c" to have it supply an offset to backtrace_dwarf_add() via the base_address argument, to compensate for the ASLR relocation:
This works when the actual base address (supplied by GetModuleHandle()) is greater than image_base, and it allows me to get debugging info even with ASLR enabled. It doesn't work when the actual base address is lower than image_base, though, since base_address is unsigned.
OS: Win10 Pro 20H2, 32-bit Compiler: gcc 11.2.0 (provided by MSYS2) libbacktrace version: master branch downloaded from Github on 2022-03-29 (also tested with the MSYS2 libbacktrace package, version r53.1da441c-3, built on 2022-01-16)
libbacktrace doesn't supply filename or line information for programs compiled on my computer, which I'm pretty sure is a result of it not supporting address space layout randomization for 32-bit PE/COFF. If I clear the DYNAMIC_BASE bit in the executable's COFF header, or if I link with "-Wl,--disable-dynamicbase" to prevent it from getting set in the first place, then libbacktrace works properly.
While debugging this, I tried modifying coff_add() in "pecoff.c" to have it supply an offset to backtrace_dwarf_add() via the base_address argument, to compensate for the ASLR relocation:
This works when the actual base address (supplied by GetModuleHandle()) is greater than image_base, and it allows me to get debugging info even with ASLR enabled. It doesn't work when the actual base address is lower than image_base, though, since base_address is unsigned.