This is the situation I am facing now:
For an embedded system that does not use virtual addressing, I have an executable that was compiled with C or C ++ code with debugging information enabled. Usually it is COFF or ELF / DWARF (I get these two mixed) formats.
At run time, on a PC, I would like to determine the address of a variable with its name. (for example, "foo.bar [7] .baz") This allows me to read / write the value of a variable into the embedded system (given the debugging protocol that goes beyond the scope of this question). Obviously, any stack-based or heap-based variables are missing, since they do not have static addresses.
I did this in front of me in C ++ to parse the COFF files from the TI compiler for my 2800 series DSP systems, and it was kind of a pain. I was wondering if there is a Java library there that already does such things, since I am faced with the same as the executable files of one or two other processors.
Update: (11/18/2009) A promising clue!
Has anyone out there used the Eclipse CDT ELF parser?
(see http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.cdt.doc.isv/reference/api/org/eclipse/cdt/core/model/IBinary.html for one of javadoc pgs)
TI Code Composer 4 (based on Eclipse) seems to be using this, so it seems that if I can figure out where the documentation is, maybe I can use this to solve my problem.