Elf symbols, little update

A little while ago I worked more on my little script to extract and expand the global symbols from an ELF file with debug (DWARF) informations. I keep it in my head all the time, so…

Here are the changes and some explanation for them.

  • Small optimization in address handling. The script was constantly converting the address from integer to hexadecimal string and back on every operation where address was needed. That is now gone and the conversion is done only at printing.
  • Resolve constant addresses. This one is kind of simple and it bothers me how I did not consider such a simple thing.
  • Experimental support for bit offsets in structs. I am not sure if I am doing it right here, it seems to work with my examples, but I am still not super convinced especially because I totally ignore the program data structure and endian-ness. Maybe I am here for a world of hurt.
  • Maximum array size handling. This one is a nice one. When the array is empty the maximum (all bits are ‘1’) value is set for the array size. The script was than trying to expand this infinite amount of elements and it would either crash all eat all the memory. So, I for not investigated and set a configurable guard to limit the number of array elements.
  • Apply data from specification to the DIE. The DIE may not contain all the required information like size or the address, this information is instead stored in a separate DIE made specificaly to specify and add some information to the original DIE. To add support for this, I went with a barbaric way and go over all DIEs in the elf file before running the type resolution on variables. There is a noticable slow down together with the next point.
  • Variable “normalization” by address. I call it “normalization” but the real thing is that I filter the DIEs with “0” as an address. The problem which I encountered is that in many CUs (Compile Units) the same variable is defined but the address is either not present and the data from specifications should be used to get it, or the address is zero on purpose, or the address is directly only on one DIE and all other ones are without it. And I did not found a good way to get rid of them all apart from filtering variables with zero address. This adds some time to process once again and slows the thing down. Well, it can also speed it up since the printing is the slowest part of the program.

All of the changes can be seen in the git logs.

Maybe one day I will write a nice proper introduction and description of this little script. There is still a lot of work and feature to do.

Articles from blogs I follow:

How I manage my bookmarks

Bookmarks are great, but just as much as I need them, I also find them dismal.

via unixdigest.com September 15, 2025

KDE Plasma 6 Wayland on FreeBSD

This year, 2025, the KDE Community held its yearly conference in Berlin, Germany. On the way I reinstalled FreeBSD on my Frame.work 13 laptop in another attempt to get KDE Plasma 6 Wayland working. Short story: yes, KDE Plasma 6 Wayland on FreeBSD works.

via [bobulate] September 7, 2025

Steve Ballmer was an underrated CEO

There's a common narrative that Microsoft was moribund under Steve Ballmer and then later saved by the miraculous leadership of Satya Nadella. This is the dominant narrative in every online discussion about the topic I've seen and it's a commo…

via danluu.com October 28, 2024

Generated by openring