I had a look at solving this problem a while ago. It is interesting to see your approach. Your code is better than mine in many ways but your approach, IMO, it not as portable. I will describe where we differ:
I wrote a perl script, deplib.pl, to process the output from the nm command into a machine neutral form. Each record output from deplib.pl is of the form:
libraryname|symbolName|value
where a value of 0 means referenced, 1 means defined.
I have a program, depdot which takes the output from deplib.pl and produces the dot file, writing to stdout. deplib.pl and depdot are designed to work as filters, i.e they read from stdin and write to stdout. Any errors are written to stderr.
IMO this approach is better because to port to another platform just involves changing the perl script. I have versions of the perl script for Linux and for Solaris.
Regards,
Andrew Marlow
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You're right. It's less portable in the sense that it's depending on GNU bfd. This makes it restricted to the binary formats supported by GNU Binutils. At the moment it works on Linux and Windows/Cygwin.
I started with a perl script b.t.w. :)
Eddy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a look at solving this problem a while ago. It is interesting to see your approach. Your code is better than mine in many ways but your approach, IMO, it not as portable. I will describe where we differ:
I wrote a perl script, deplib.pl, to process the output from the nm command into a machine neutral form. Each record output from deplib.pl is of the form:
libraryname|symbolName|value
where a value of 0 means referenced, 1 means defined.
I have a program, depdot which takes the output from deplib.pl and produces the dot file, writing to stdout. deplib.pl and depdot are designed to work as filters, i.e they read from stdin and write to stdout. Any errors are written to stderr.
IMO this approach is better because to port to another platform just involves changing the perl script. I have versions of the perl script for Linux and for Solaris.
Regards,
Andrew Marlow
You're right. It's less portable in the sense that it's depending on GNU bfd. This makes it restricted to the binary formats supported by GNU Binutils. At the moment it works on Linux and Windows/Cygwin.
I started with a perl script b.t.w. :)
Eddy