On 03 March 2007 20:15, Fabio Giovagnini wrote:
> Hi all,
> I'd like to develop a tool able to do the following things:
> 1) to load all the .h and .c/.cpp files;
> 2) to analyze allo the data struct / unions and classes;
> 3) to give me for each data member of a struct or union and for each data
> member of a class, the offset in bytes related to the base addess of a
> generic istance of the struct/union and class.
>
> In this way I could easily calculate the real address of each data member of
> each global declared struct / union and classes, and I clould easily read
> usign a simple communication protocol the content of a memory location of an
> embedded system only knowing the map file and the offset of each member of
> each global variable.
Sounds like what you really want is a debugger... GDB does things like that.
The information you want is all emitted by the compiler as debug info in your
object files when you use the -g flag. You haven't given details about the
task you're trying to achieve but scripting gdb is probably going to be the
way to go.
cheers,
DaveK
--
Can't think of a witty .sigline today....