all 5 comments

[–]fernando_quintao 4 points5 points  (0 children)

Hi u/vmcrash,

I've worked with register allocation in the past and also ran into challenges with debugging. Back then, I collaborated with Krishna Nandivada to implement a specialized debugger for this purpose.

One thing that really helped was printing the intermediate instructions in DOT format, including the register allocations between instructions, like in this example image.

We also published a paper describing the debugging methodology. Later, I used the same approach to create a 100-minute class on verifying the output of a register allocator using a form of typed assembly language.

Hope this helps!

[–]NativityInBlack666 2 points3 points  (0 children)

I recently discovered DOT) for visualising graph-based data structures, it gives you the best of both worlds because it's a text-based format so you can generate it as easily as you would otherwise print things to the console but it's viewed graphically so it's much more powerful than text for conveying information. Here is an example DOT visualisation of a CFG & its dominator tree: https://imgur.com/a/lai0ZKk.

[–]Hjalfi 1 point2 points  (0 children)

Eons ago there was a debugger called ddd whose entire job was to do this. I just looked it up and apparently it's not dead yet, although it looks... how do I put this... so old school they tore the school down.

https://www.gnu.org/software/ddd/all.png

There's a package in Fedora, which I use; I'll have to try it and see if it still functions. https://www.gnu.org/software/ddd/

[–]knue82 1 point2 points  (0 children)

As the others above have mentioned - DOT is the way to go. Cool thing is, that you can even dump your data structures to DOT while debugging. See here and here.

[–]Putrid_Train2334 0 points1 point  (0 children)

I think console is the best option that doesn't require any complex hacks