Generating an EXE with Debugging Symbols

I saved a .dmp file the last time my Cataclysm crashed. Unfortunately, the .exe wasn’t compiled wtih debugging symbols included, so the call stack wasn’t readable. How do I generate cataclysm’s .exe with debugging symbols?

I forked the repo and ran a make according to the directions in the sticky (using the MinGW method). I then opened CataclysmWin.cbp in Code:Blocks, built the project, and hit the “Debug” button, but the Debugger tab showed the following:

I can see that the project was compiled with the -g flag, so why isn’t the debugging info making it into the executable?

I modified the codeblocks project file so that it would build properly in Windows. However, I still see nothing in any of the debugging windows when I debug the program. I’ve pasted my build log and debugging output below. Could someone help me get this up and running?

Build Log:

-------------- Build: Release in Cataclysm (compiler: GNU GCC Compiler)---------------
mingw32-make.exe -f Makefile.Windows
mkdir objwin
g++ -g -O3 -c mapbuffer.cpp -o objwin/mapbuffer.o
g++ -g -O3 -c defense.cpp -o objwin/defense.o
g++ -g -O3 -c skill.cpp -o objwin/skill.o
g++ -g -O3 -c item.cpp -o objwin/item.o
g++ -g -O3 -c mtypedef.cpp -o objwin/mtypedef.o
g++ -g -O3 -c posix_time.cpp -o objwin/posix_time.o
g++ -g -O3 -c texthash.cpp -o objwin/texthash.o
g++ -g -O3 -c tutorial.cpp -o objwin/tutorial.o
g++ -g -O3 -c bionics.cpp -o objwin/bionics.o
g++ -g -O3 -c monmove.cpp -o objwin/monmove.o
g++ -g -O3 -c help.cpp -o objwin/help.o
g++ -g -O3 -c calendar.cpp -o objwin/calendar.o
g++ -g -O3 -c settlement.cpp -o objwin/settlement.o
g++ -g -O3 -c name.cpp -o objwin/name.o
g++ -g -O3 -c mission_place.cpp -o objwin/mission_place.o
g++ -g -O3 -c missiondef.cpp -o objwin/missiondef.o
g++ -g -O3 -c setvector.cpp -o objwin/setvector.o
g++ -g -O3 -c basecamp.cpp -o objwin/basecamp.o
g++ -g -O3 -c player.cpp -o objwin/player.o
g++ -g -O3 -c overmap.cpp -o objwin/overmap.o
g++ -g -O3 -c mission_start.cpp -o objwin/mission_start.o
g++ -g -O3 -c mutation_data.cpp -o objwin/mutation_data.o
g++ -g -O3 -c keypress.cpp -o objwin/keypress.o
g++ -g -O3 -c mission_end.cpp -o objwin/mission_end.o
g++ -g -O3 -c mapitemsdef.cpp -o objwin/mapitemsdef.o
g++ -g -O3 -c construction.cpp -o objwin/construction.o
g++ -g -O3 -c npcmove.cpp -o objwin/npcmove.o
g++ -g -O3 -c mongroupdef.cpp -o objwin/mongroupdef.o
g++ -g -O3 -c event.cpp -o objwin/event.o
g++ -g -O3 -c monster.cpp -o objwin/monster.o
g++ -g -O3 -c newcharacter.cpp -o objwin/newcharacter.o
g++ -g -O3 -c veh_interact.cpp -o objwin/veh_interact.o
g++ -g -O3 -c color.cpp -o objwin/color.o
g++ -g -O3 -c input.cpp -o objwin/input.o
g++ -g -O3 -c mission_fail.cpp -o objwin/mission_fail.o
g++ -g -O3 -c line.cpp -o objwin/line.o
g++ -g -O3 -c melee.cpp -o objwin/melee.o
g++ -g -O3 -c iexamine.cpp -o objwin/iexamine.o
g++ -g -O3 -c debug.cpp -o objwin/debug.o
g++ -g -O3 -c main_menu.cpp -o objwin/main_menu.o
g++ -g -O3 -c disease.cpp -o objwin/disease.o
g++ -g -O3 -c inventory.cpp -o objwin/inventory.o
g++ -g -O3 -c gamemode.cpp -o objwin/gamemode.o
g++ -g -O3 -c options.cpp -o objwin/options.o
g++ -g -O3 -c mission.cpp -o objwin/mission.o
g++ -g -O3 -c trapdef.cpp -o objwin/trapdef.o
g++ -g -O3 -c artifact.cpp -o objwin/artifact.o
g++ -g -O3 -c main.cpp -o objwin/main.o
g++ -g -O3 -c catacurse.cpp -o objwin/catacurse.o
catacurse.cpp: In function ‘WINDOW* initscr()’:
catacurse.cpp:270:27: warning: passing NULL to non-pointer argument 4 of ‘int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)’ [-Wconversion-null]
catacurse.cpp:281:31: warning: passing NULL to non-pointer argument 4 of ‘int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)’ [-Wconversion-null]
catacurse.cpp:317:27: warning: passing NULL to non-pointer argument 4 of ‘int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)’ [-Wconversion-null]
g++ -g -O3 -c bodypart.cpp -o objwin/bodypart.o
g++ -g -O3 -c npc.cpp -o objwin/npc.o
g++ -g -O3 -c game.cpp -o objwin/game.o
g++ -g -O3 -c rng.cpp -o objwin/rng.o
g++ -g -O3 -c output.cpp -o objwin/output.o
g++ -g -O3 -c tileray.cpp -o objwin/tileray.o
g++ -g -O3 -c mapdata.cpp -o objwin/mapdata.o
g++ -g -O3 -c faction.cpp -o objwin/faction.o
g++ -g -O3 -c npctalk.cpp -o objwin/npctalk.o
g++ -g -O3 -c crafting.cpp -o objwin/crafting.o
g++ -g -O3 -c ranged.cpp -o objwin/ranged.o
g++ -g -O3 -c monitemsdef.cpp -o objwin/monitemsdef.o
g++ -g -O3 -c itypedef.cpp -o objwin/itypedef.o
g++ -g -O3 -c mapgen.cpp -o objwin/mapgen.o
g++ -g -O3 -c monattack.cpp -o objwin/monattack.o
g++ -g -O3 -c veh_typedef.cpp -o objwin/veh_typedef.o
g++ -g -O3 -c iuse.cpp -o objwin/iuse.o
g++ -g -O3 -c map.cpp -o objwin/map.o
g++ -g -O3 -c mutation.cpp -o objwin/mutation.o
g++ -g -O3 -c computer.cpp -o objwin/computer.o
g++ -g -O3 -c trapfunc.cpp -o objwin/trapfunc.o
g++ -g -O3 -c action.cpp -o objwin/action.o
g++ -g -O3 -c inventory_ui.cpp -o objwin/inventory_ui.o
g++ -g -O3 -c mondeath.cpp -o objwin/mondeath.o
g++ -g -O3 -c lightmap.cpp -o objwin/lightmap.o
g++ -g -O3 -c field.cpp -o objwin/field.o
g++ -g -O3 -c weather.cpp -o objwin/weather.o
g++ -g -O3 -c graffiti.cpp -o objwin/graffiti.o
g++ -g -O3 -c wish.cpp -o objwin/wish.o
g++ -g -O3 -c vehicle.cpp -o objwin/vehicle.o
g++ -Wl,-stack,12000000,-subsystem,windows -o cataclysm.exe -g -O3 objwin/mapbuffer.o objwin/defense.o objwin/skill.o objwin/item.o objwin/mtypedef.o objwin/posix_time.o objwin/texthash.o objwin/tutorial.o objwin/bionics.o objwin/monmove.o objwin/help.o objwin/calendar.o objwin/settlement.o objwin/name.o objwin/mission_place.o objwin/missiondef.o objwin/setvector.o objwin/basecamp.o objwin/player.o objwin/overmap.o objwin/mission_start.o objwin/mutation_data.o objwin/keypress.o objwin/mission_end.o objwin/mapitemsdef.o objwin/construction.o objwin/npcmove.o objwin/mongroupdef.o objwin/event.o objwin/monster.o objwin/newcharacter.o objwin/veh_interact.o objwin/color.o objwin/input.o objwin/mission_fail.o objwin/line.o objwin/melee.o objwin/iexamine.o objwin/debug.o objwin/main_menu.o objwin/disease.o objwin/inventory.o objwin/gamemode.o objwin/options.o objwin/mission.o objwin/trapdef.o objwin/artifact.o objwin/main.o objwin/catacurse.o objwin/bodypart.o objwin/npc.o objwin/game.o objwin/rng.o objwin/output.o objwin/tileray.o objwin/mapdata.o objwin/faction.o objwin/npctalk.o objwin/crafting.o objwin/ranged.o objwin/monitemsdef.o objwin/itypedef.o objwin/mapgen.o objwin/monattack.o objwin/veh_typedef.o objwin/iuse.o objwin/map.o objwin/mutation.o objwin/computer.o objwin/trapfunc.o objwin/action.o objwin/inventory_ui.o objwin/mondeath.o objwin/lightmap.o objwin/field.o objwin/weather.o objwin/graffiti.o objwin/wish.o objwin/vehicle.o -static -lgdi32
Process terminated with status 0 (4 minutes, 33 seconds)
0 errors, 3 warnings (4 minutes, 33 seconds)

Debugger tab output:

Building to ensure sources are up-to-date
Selecting target:
Adding source dir: C:\Users\Matt\Documents\GitHub\Cataclysm-DDA
Adding source dir: C:\Users\Matt\Documents\GitHub\Cataclysm-DDA
Adding file: C:\Users\Matt\Documents\GitHub\Cataclysm-DDA\Cataclysm.exe
Changing directory to: C:/Users/Matt/Documents/GitHub/Cataclysm-DDA/.
Set variable: PATH= a million entries
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/Users/Matt/Documents/GitHub/Cataclysm-DDA/Cataclysm.exe
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.4
Child process PID: 1264
[Inferior 1 (process 1264) exited normally]
No stack.
No stack.
No stack.
Failure finding "Stack level "
Failure matching reg_output
Debugger finished with status 0

Okay, I’ve got Cataclysm debugging working in Code::Blocks on Windows. The CataclysmWin.cbp file in the GitHub repository is using the Linux makefile! It also does not have the right compiler & linker switches (Code::Blocks strips out the debugging symbols). I’ll submit a pull request on GitHub to update the file.

EDIT: I think I’m going to leave the repo files alone, since most of the developers use Linux and the default makefile works fine for builds. If you want to debug the program on Windows, though, I recommend using this cdp file:

much obliged

The GDB Debugger (default debugger if using Code::Blocks on Windows) has been causing my character to be Freezing starting at turn 2.

[spoiler=Technical Info]The temp_conv vector in player.cpp contains large negative values in all indices.
Switches attempted:
-g -O3
-g -O0 -fno-inline

The issue happens in both my fork and in vanilla Cataclysm DDA.
I haven’t changed any debugging settings since this was working properly.

Anyone have any ideas why this is happening, or suggestions for alternate switches (or a different debugger)?