Pages: 1
  Print  
Author Topic: Debugging Your Game  (Read 2352 times)
Offline (Male) Goombert
Posted on: March 03, 2014, 04:42:17 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
This guide has since been moved to the Wiki, where you can find more comprehensive information about how to improve your game's performance:
http://enigma-dev.org/docs/Wiki/Debugging

The following guide is also useful for letting us know about an issue:
http://enigma-dev.org/docs/Wiki/Bug_reporting

Please do try to put some effort into debugging issues before asking for help.

Quote from: Original Post
I am not sure if any of you are already aware but GCC and MinGW are redistributed in ENIGMA with GDB a popular and powerful debugging tool.
http://www.sourceware.org/gdb/

If your game opens and closes immediately or crashes, GDB can tell you what line in the ENIGMA source code your game crashed in. These are the steps to run your game in GDB.
1) Open your game in ENIGMA and execute it in debug mode by clicking the debug icon, this will add debugging symbols to the built executable.
2) Close the game, and look in the output window for the name of the output executable, usually a temp file on Windows and is usually named egm503450990 or similar. Copy and paste the full path to your clipboard.
3) Open enigma-dev/git-bash or on Linux or Mac any Command Line Interface or Terminal will suffice.
4) Enter "gdb file/path/to/egm/with/debugging/symbols" on the command line and hit enter.
5) Type "run" and hit enter.
6) Run the game to the point that it crashes, once it does GDB will display the segfault information.
7) If the error report is not detailed enough type "bt" for backtrace and hit enter, and it will show you the exact source files and what lines the error occurred in/on.
8) To close your game you may have to type "quit" and hit enter.

And there you have it, some advanced and very helpful debugging. These debug logs can also be useful when filing a help desk ticket as well, and you are encouraged to include them if you know how.

Note: On Windows to copy and paste a terminal window, right click on the title bar and hit Edit->Select All/Copy
« Last Edit: September 09, 2017, 05:14:22 AM by Goombert » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #1 Posted on: March 03, 2014, 10:07:46 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
I use it all the time when developing ENIGMA and have used it for years. All in all it's very good and feature rich, but sometimes the crash can be so severe that the stack gets corrupt and you can't even find the function name where the crash happened. Other times it's impossible to crash in debug mode, while it crashes all the time in release mode (Heisenbug). But sometimes even debugging in release mode will yield useful results, as often the function names are added even without debugging symbols. Parameters and other things might be optimized out, but function names are still available. We should probably add a debug console option to ENIGMA plugin, so you can run via GDB automatically from IDE.
Logged
Offline (Male) time-killer-games
Reply #2 Posted on: March 03, 2014, 01:23:42 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
I will definitely do this. I hope everyone else will. Appears that this can really really help tracking more bugs and fixing them in less time. I'm glad you discovered this. This is an area that GMStudio has had for a while but ENIGMA always lacked.  GMS can open crash reports that are automatically sent by email to YYG at the push of a button. I don't know if this would be possible but if we had something like that too, "a one click bug report" rather than having to go through multiple steps it would be much easier to file certain bugs this way. But at least what we have here is a step in the right direction. :)
Logged
Offline (Unknown gender) daz
Reply #3 Posted on: March 03, 2014, 01:44:31 PM
Contributor
Joined: Jul 2010
Posts: 167

View Profile
I will definitely do this. I hope everyone else will. Appears that this can really really help tracking more bugs and fixing them in less time. I'm glad you discovered this. This is an area that GMStudio has had for a while but ENIGMA always lacked.  GMS can open crash reports that are automatically sent by email to YYG at the push of a button. I don't know if this would be possible but if we had something like that too, "a one click bug report" rather than having to go through multiple steps it would be much easier to file certain bugs this way. But at least what we have here is a step in the right direction. :)
The steps Robert provided are for debugging your own game, not debugging LGM. In that regard, there are already some pretty amazing tools for Eclipse if you're running from within it.
Logged
Offline (Male) Goombert
Reply #4 Posted on: March 03, 2014, 09:46:57 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
TKG, I always knew about it, I was in the process of explaining it to someone else and decided to just write up instructions for everyone. I don't know why I didn't do so sooner, I am rather ignorant in that I think everyone here is as aware of the things that I am. This is also the reason why we literally haven't given two shits about adding the proper debugging symbols, GDB is pretty damn good at finding them on its own. There is a similar discussion in the other subforum regarding debug mode automatically launching GDB as maybe a preference of sorts and outputting that to the debug window.

http://enigma-dev.org/forums/index.php?topic=1813
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Goombert
Reply #5 Posted on: June 14, 2016, 02:51:22 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3107

View Profile
Also something like Google Breakpad could be considered for ENIGMA as I mentioned in another topic.

http://enigma-dev.org/forums/index.php?topic=2584
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print