Read errors from C code?

When i make some mistakes in C code, the dmengine is crashed.
In logs i get message:

Successfully wrote Crashdump to file: /home/user/.Defold/_crash

How can i read that dump? I need to know why crash is happened.

Unfortunately, our debugging options aren’t that great yet.
We have tasks planned for improving this situation, but until then, you have a few options:

  • Open the _crash file in a text editor that can show the hex values along with the ascii values. A bit further down, you’ll find the call stack in clear text. E.g. I use the “HexViewer” plugin in Sublime Text.
  • Print debug, add dmLogWarning("DBG: %s %s %d\n", __FILE__, __FUNCTION__, __LINE__); in many places where you suspect the crash to occur.
  • You can try running the app via XCode/VSCode/Visual Studio, to see if you get a hint (Iirc, the debug symbols aren’t fully working)
3 Likes

Thanks, I will try hexViewer. Now I use printf for debugging. I understand where it fall. But have no idea why))

1 Like

Whay about crash dump on windows? i can’t find it.

It’s called _crash there too, and it’s located under ~/AppData/Roaming/Defold (on Win 10), or the corresponding APP_DATA path on your windows machine.

On Windows, we also produce a .dmp file. If you have a debugger installed (e.g. Visual Studio), you can double click on the .dmp file, and then start the debugger (F5 in Visual Studio). You should then be able to see the callstack and maybe some values (it’s a mini dump)

2 Likes