This is a situation I run into now and then:
For an embedded system which does not use virtual addressing, I have an executable file that was compiled from C or C++ code with debugging information included. It's usually in COFF or ELF/DWARF (I get those two mixed up) format.
At runtime, on a PC, I would like to determine the address of a variable given its name. (e.g. "foo.bar[7].baz") This allows me to read/write the variable's value on the embedded system (given a debugging protocol that is beyond the scope of this question). Obviously, any variables that are stack-based or heap-based are out since they don't have static addresses.
I've done this before myself in C++ to parse COFF files from TI's compiler for their 2800 series DSPs, and it was kind of a pain. I was wondering if there was a Java library out there that does this sort of thing already, since I'm facing the same thing with one or two other processors' executable files.
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 the javadoc pgs)
TI's Code Composer 4 (based on Eclipse) seems to use this, so it seems like if I can figure out where the documentation is maybe I can use that to solve my problem.