(no title)
lwerdna | 4 years ago
For example, I had to parse DWARF debug info recently to scrape type information, something I dreaded doing. Instead of diving into the DWARF specs, I set out to adapt one of the pyelftools [1] examples to produce a .dot file and graphed it with dot, producing [2].
Now looking at the picture, it's nearly obvious how functions and structs and types are stored. The rest is trivia (How do I access this attribute? How do I iterate over a DIE's children?).
Here's a simple alias so that anything that writes to /tmp/tmp.dot can be viewed with a single command:
alias graph='dot -Tpng /tmp/tmp.dot -o /tmp/tmp.png && open /tmp/tmp.png'
[1] https://pypi.org/project/pyelftools/
edwinyzh|4 years ago