How do you debug and profile Odin projects? Let's collect apps and workflows!

It’s all in the title: How do you debug and profile in Odin? What workflows are helpful to you and which programs do you use?

PS: My not so secret intent is to make a PR for the FAQ when/if there are enough answers, because to me this a fairly basic tooling question that I want answered for a language I want to work with.

3 Likes

For debugging, RAD Debugger. It just recently got Odin support: GitHub - EpicGamesExt/raddebugger: A native, user-mode, multi-process, graphical debugger.

For memory leaks I just use a tracking allocator: Overview | Odin Programming Language

For profiling I use spall, which Odin has core support for: Spall | Odin Programming Language

7 Likes

Keep in mind that I main Linux. Most of this also applies to FreeBSD. Probably to macOS as well if I’m not mistaken though I only have recently started dabbling in that. All of these tools are also general purpose; they have nothing to do with Odin and you could just as easily use them for programs compiled from C.

  • objdump for disassembly and checking symbols.
  • readelf to get general executable information, including symbol tables.
  • ldd to list shared object dependencies.
  • strace on Linux to observe syscalls and their results. picotrace on FreeBSD. Both of these tools have been very handy for debugging kernel-interfacing code.
  • lldb for step-by-step debugging, reading of registers, memory, and so on.
  • gdb if lldb has issues or is unable to get a stack trace which does happen rarely.
  • valgrind to record profiling statistics to be later viewed with kcachegrind.
  • prof to also record and view profiling statistics, as a second opinion.

That said, the sooner that the *nix-like operating systems get a competent visual debugger, the better. I don’t recommend using text-based debuggers if you have access to an alternative.

7 Likes

For tracing procedures spall (or tracy) also work for linux. I used to use spall because the author has shared one of the versions for free, but now I don’t have a way to pay $100 for it so I’m not using it now.

On windows there’s also remedybg which is a fairly fast and snappy debugger, way better than visual studio debugger. Sadly it doesn’t support some of the advanced features like checking your TLS layout (?). I don’t remember what my issue was, but that one time I had to debug a buffer overwrite that corrupted the TLS, I had to do a bunch of math with numbers from objdump just to calculate its address.