General Debugging Instructions (for C projects)

I've just started out developing a game for Playdate (in C/C++) and managed to get a crash on device (but not on simulator), so I started looking for debug instructions but couldn't find much. Example projects seem to work fine so it's just a problem with my code.

I'm wondering

  1. How to get crash dumps from device.
  2. Is it possible to do remote debugging?

I did find the console via the simulator but it only showed me crashed=1 so that didn't help me too much.

I'm using Windows 10.

check for memory leaks and memory corruption or accessing memory you should not acces (out of bound arrays C Strings without null character etc).

Memory leaks you can check in debugger using memory profiler and doing a couple refreshes to see if allocated memory (count) keeps increasing or not on the simulator it would take a bit longer before it crashes i guess or may not immediatly tell you so.

I also make a habbit of fixing all warnings sometimes they'll give a clue but rarely they might be the cause of such crash.

Also does the game boot at all ? if not common pitfalls are missing data in pdxinfo, extra info gets added to pdxinfo in the pdx dir compared to what you have in source folder.

checking for memory corruption is harder, not even sure how todo this with visual studio, but i use my sdl2 reimplementation of the pd api, compile a linux binary and use valgrind on it, i've detected problems due to this before, unfortunatly getting valgrind to work on windows aint easy a pitfall of potential problems but maybe there exists (C) libraries that replace malloc or so to check for memory leaks or corruption or visual studio might have something baked in (i did not check for this)

i doubt it'll happen but also make sure you don't exceed the memory limit

about your questions: there is no remote debugging and as far as i'm aware no crashdumps either.

What you can do however is use logtoconsole statements on multiple places writing 1 2 3 4 5 6 etc and try to diminish based on the print to console statements where the error might happen

Crash logs crashlog.txt are found at the root of the Playdate when you mount it in disk mode. You can symbolicate them using the firmware_symbolizer.py script found in the SDK/bin folder. There is no remote debugging currently. As joyrider noted, it's much easier to debug in the Simulator than on device. I'd look at memory usage and also run with an address sanitizer enabled in Visual Studio (AddressSanitizer (ASan) for Windows with MSVC - C++ Team Blog).

All good suggestions! The project itself is just a copy-pasted version of Hello World example from C_API folder so for my case I assume it crashes at boot and I just messed up some build compiler / linker flags (as I have a different build system I'm porting to, instead of using CMake directly).

The pdxinfo I generate by calling pdc.exe in the SDK bin folder and looks the same as the one generated by Hello World build.

So follow instructions at Sideloading Playdate games - Playdate Help Data Disk Mode, copy /crashlog.txt and run the python script? I'll give that a go.

I've tried using firmware_symbolizer.py, but it always seems to output question marks for me. Any idea why?