# Generating an EXE with Debugging Symbols

**URL:** <https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583>\
**Category:** The Garage\
**Created:** [March 25, 2013, 9:01pm UTC](https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583 "2013-03-25T21:01:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mattaclysm](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mattaclysm](https://discourse.cataclysmdda.org/u/Mattaclysm)\
**Post date:** [March 25, 2013, 9:01pm UTC](https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583/1 "2013-03-25T21:01:45Z")

</div>

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:

```auto

```

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

---

<div class="post-metadata">

**Author:** ![Mattaclysm](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mattaclysm](https://discourse.cataclysmdda.org/u/Mattaclysm)\
**Post date:** [March 27, 2013, 3:37pm UTC](https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583/2 "2013-03-27T15:37:12Z")

</div>

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:  
Release  
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  
done  
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

---

<div class="post-metadata">

**Author:** ![Mattaclysm](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mattaclysm](https://discourse.cataclysmdda.org/u/Mattaclysm)\
**Post date:** [March 27, 2013, 4:47pm UTC](https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583/3 "2013-03-27T16:47:10Z")

</div>

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: [http://pastebin.com/CrAyr88F](http://pastebin.com/CrAyr88F)

---

<div class="post-metadata">

**Author:** ![Sep](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Sep](https://discourse.cataclysmdda.org/u/Sep)\
**Post date:** [March 28, 2013, 12:01am UTC](https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583/4 "2013-03-28T00:01:13Z")

</div>

much obliged

---

<div class="post-metadata">

**Author:** ![Mattaclysm](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mattaclysm](https://discourse.cataclysmdda.org/u/Mattaclysm)\
**Post date:** [April 8, 2013, 10:06pm UTC](https://discourse.cataclysmdda.org/t/generating-an-exe-with-debugging-symbols/583/5 "2013-04-08T22:06:56Z")

</div>

The GDB Debugger (default debugger if using Code::Blocks on Windows) has been [causing my character to be Freezing starting at turn 2](https://github.com/TheDarklingWolf/Cataclysm-DDA/issues/418).

[spoiler=Technical Info]The temp\_conv vector in player.cpp contains large negative values in all indices.  
Switches attempted:  
-g  
-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.  
[/spoiler]

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