On Sun, Dec 08, 2013 at 10:56:09AM +0100, John Colvin wrote: > On Sunday, 8 December 2013 at 05:27:12 UTC, H. S. Teoh wrote: > >Once I hacked up a script (well, a little D program :P) that > >disassembles D executables and builds a reference graph of > >its symbols. > > Do you still have that somewhere? I've never attempted such a thing > and would like to see what it entailed.
Well, all it does is to run objdump to disassemble the executable, then parse the output to extract (1) symbols (usually functions) and (2) references to other symbols (within the function body), and construct a graph out of that. It's not 100% accurate, though, because objdump doesn't know anything about vtables or jump tables, so any references through those would not be found. Also, it will obviously produce useless results if your executable has been stripped of symbols. I'll put the code up on github if you're interested. And, looking at the code again, it appears that I was in the middle of a rewrite (doesn't even compile yet), which is in a separate git branch; but master seems usable enough so I'll just push that. T -- Skill without imagination is craftsmanship and gives us many useful objects such as wickerwork picnic baskets. Imagination without skill gives us modern art. -- Tom Stoppard