r/Compilers • • Aug 01 '26

Any debugging advice / tools for compilers?

Tired of print statements everywhere. It very satisfactory to see one but I would much rather have something like lldb to easily debug the code more intuitively.

Are there any other useful tools?

16 Upvotes

15 comments sorted by

View all comments

Show parent comment

2

u/Satu_Autio Aug 01 '26

To be honest when I was doing debugging my single biggest win was using GDB to trace the generated code instruction by instruction. That's easy to do with a trace file.

gdb binary -x tracer

Then the tracer file looks like this:

   starti
   display/i $pc
   while 1
      stepi
   end

You can get more advanced, and write to a lotfile, or similar, but this is enough to work - especially combined with tee.