Thanks for the answer.
I go deeper in my thought so that maybe you can give me more infos about how I 
have to investagte about gcc/gdb

We are developers of embedded software on board designed and build by us;
Generally we use 16 bit cisc and 32 bits risc cpu (Renesas h8/h8s; sh 2 / 3 ). 
We write applications for automotive enviroment mainly.
We write the code using c/c++ and we compile using gcc.
Because of we do not have much memory (ram and flash) we develop in the 
following way: each software we write has the same communication protocol 
running on RS232 or over TCP/IP and we have a simple monitoring progarm able 
to show the contents of the memory addresses in some format (char, int, long, 
signed unsigned, strings, ecc).
Generally we declare a global variable, we write a debug value into it and 
during the run time we read at the right moment the content of such a 
variable.
Good.
For avoiding to read by hand .map file produced by ld, I developed a flex / 
bison simple analizer able to extract from .map file the address of a symbol. 
So into my tool I load the .map file and I write the name of the variable and 
I can read the content of it.
This way of working becomes very hard if I use struct and union in c and 
classes in c++; I should know the offeset of each field of the struct so 
addind it to the base address known from the .map file, for each istance of 
such a struct I coud write "mysrtuct.myfield" into my tool, and, calculating 
the rigth address, my protocol could ask the target to read/write the content 
at that address.

I prefer to avoid -g option because of my memory is never enough; but a good 
compromise cound be if I could compile the debug infos into sections I could 
remove after used by gdb for giving me the informations about the offset of 
each field. Is it possible?
Where can I read more about to use gdb for embedded development with very poor 
uControllers?

Thanks




Alle 21:28, sabato 3 marzo 2007, Dave Korn ha scritto:
> 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

-- 
Fabio Giovagnini

Aurion s.r.l.
via degli orti 11,
40050 Funo di Argelato (BO)
Tel. +39.335.8350919
Fax +39.051.8659009

www.aurion-tech.com

account telefono VoIP skype (www.skype.com):
aurion.giovagnini

Reply via email to