This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Hi all, just an onfo about huw to use gcc tree
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Fabio Giovagnini'" <fabio dot giovagnini at aurion-tech dot com>, <gcc at gcc dot gnu dot org>
- Date: Sat, 3 Mar 2007 20:28:26 -0000
- Subject: RE: Hi all, just an onfo about huw to use gcc tree
- References: <200703032115.14906.fabio.giovagnini@aurion-tech.com>
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....