I've spend the last couple of days tinkering around at a process visualization tool.
It shows the virtual memory of a process on a 2D map and threads as small dots jumping around (at the instructions they're executing).
The map also shows the public symbols within a given shared library (e.g.
poll() in libc). Just to give you an idea where threads are hanging out.
If you want to try for yourself you can get the code at github. But it's a linux-only tool and you'll have to compile it yourself.
The main purpose of the tools is to give students an easier and intuitive idea of what a process is. It's not a serious debugging tool something like that.
I've had the idea while I was still giving the operating system lecture at university.
Back then I saw the xkcd Map of the Internet, and poof, stuff happens in your head and you can't unthink the idea.
That was quite some time ago but it was a nice pretext to fiddle around with raylib and ptrace.
Thanks to Chris from bedroomcoders.co.uk for giving me the final push to try out raylib. It really is a nice library to work with.
Aside from raylib the project had other interesting aspects:
This is a nice way of mapping the 1D address space of a process onto a 2D map.
Quite a neat idea but for now the mathematical details are beyond me. Maybe in the future I'll find the time to derive the largest
completely enclosed 2D rectangle for a given 1D range on a Hilbert curve. That would be rather neat to properly position
the labels of address ranges or the linker symbols in them. But who knows when that fancy will strike me.
ptrace was another Linux API I wanted to try for a while now.
It's basically the Linux API for debuggers like
gdb and to be honest that kind of shines through.
I probably abused the API for what I did here. :D
ELF dynamic linker symbols and DWARF debug symbols: Here we are again in fantasy land. Where I write this on something
that was formerly called the GNOME 2 desktop (now MATE). Some fantasy authors would have been proud.
Anyway, I wanted to put at least some functions on the map. Primarily to see whats inside address ranges that contain executable code.
While not simple ELF is straight forward enough to read the dynamic linking symbols from its
.dynsym section. And those have to be there for every shared library.
Also showing DWARF debug symbols would have been nice. But unfortunately this got a bit to complex for a just-for-fun operation.
And getting debug symbols for e.g. Debian packages is kinda complicated (how to load them is nicely documented though).
Well, maybe some other time. :)
I hope someone else finds this tool illuminating or at least helpful. :)
If anyone is interested I can explain stuff in more detail. For example how one texture is used to draw the map regions and borders without polygons
(plus one texture for each address region with symbols in it). I'm just to lazy to go into details if nobody is interested. :D