This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: binutils, bfd library, debug.h/c files and so on...


(Sorry for confusion, reposting this to binutils
mailing list as well)

--- Ian Lance Taylor <ian@airs.com> wrote:
> debug.h/debug.c is the generic interface.  There are
> specific
> implementations for stabs and for IEEE debug info.

So it's not that simple. Can you provide me some
background information about stabs and IEEE debug info
? But normally if you compile in linux (e.g. redhat)
and in windows (cygwin), which debug information is
used there ? May be we should stick to the one format
?

> > Ok - first of all all symbols that I need are
> defined
> > in debug.c, we will probably need to move them
> into .h
> > file. (struct debug_*, enum debug_*).
> 
> My original idea was to keep the structs defined in
> debug.c and use
> accessor functions.  A number of accessor functions
> are already
> defined.  No doubt they are insufficient, but I'd
> think the first
> approach would be to add accessor functions.

Can you give me some background information about
accessor functions ? (document or example would be
fine)

How will I get all functionality that I need - do I
(1) include directly all needed files (2) get a
precompiled library from binutils and link it against
my application.


> > I will try to list here all that I need, can you
> > recommend me which structures I should be looking
> for:
> > I need type information on all C's structures,
> field *
> > N, their names, types and offsets within a struct.
> > (Which debug_* struct corresponds to it?)
> 
> I don't think there is currently a way to ask for
> all the types.  

debug_type*
debug_get_all_classes (handle)
     PTR handle;
{
  struct debug_handle *info = (struct debug_handle *)
handle;
  struct debug_unit *u;
  struct debug_type_compare_list *list;
  debug_type *classes;
  int size = 0;
  list = NULL;
  /* We search the globals of all the compilation
units.  I don't know
     if this is correct or not.  It would be easy to
change.  */

  for (u = info->units; u != NULL; u = u->next)
    {
      struct debug_file *f;

      for (f = u->files; f != NULL; f = f->next)
	{
	  struct debug_name *n;

	  if (f->globals != NULL)
	    {
	      for (n = f->globals->list; n != NULL; n =
n->next)
		{
                  if (n->kind == DEBUG_OBJECT_TAG) {
                    debug_type real =
debug_get_real_type(handle, n->u.tag, NULL);
                    if (real->kind == DEBUG_KIND_CLASS
||
                        real->kind ==
DEBUG_KIND_STRUCT) {
                      struct debug_type_compare_list
*item;
                      item = (struct
debug_type_compare_list *) xmalloc(sizeof *item);
                      memset (item, 0, sizeof *item);
                      item->next = list;
                      item->t1 = n->u.tag;
                      size++;
                      list = item;
                    }
                  }
                }
            }
        }
    }
  classes = (debug_type*) xmalloc((size+1) * sizeof
*classes);
  classes[size--] = NULL;
  while (list != NULL) {
    struct debug_type_compare_list *item;
    classes[size--] = list->t1;
    list->t1 = NULL;
    item = list;
    list = list->next;
    item->next = NULL;
    free(item);
  }
      
  return classes;
}

Copy pasted from Reflect RTTI, I've already noticed
that it is not included in debug.c. :)

> You
> can ask for a particular struct using
> debug_find_tagged_type().  Given
> a debug_type for a struct, you can get the fields
> via
> debug_get_fields().  Given a field, you can use
> debug_get_field_type(), debug_get_field_name(),
> debug_get_field_bitpos() and
> debug_get_field_bitsize().

Sounds good. Should I open the file before calling
these functions ?

> > Support for single and two dimentional structures
> is
> > also needed.
> 
> I'm not sure what this means.
arrays. sorry.
e.g. uint8 array[34];

> > the type information needs to be readed out from
> file,
> > so we will need file operations as well as object
> > reading capabilities (?, At least in older version
> of
> > RTTI there are included following files: rddbg.c
> > debug.c bucomm.c stabs.c filemode.c prdbg.c ieee.c
> 
> OK.  For stabs the relevant code is in stabs.c.  You
> can just call
> parse_stab with each stab string.  That is currently
> done by the code
> in rddbg.c.  As far as I know stabs.c doesn't care
> where the stabs
> strings come from.
Ok...  Can you provide me with some background
information on stabs ?

rddbg perfoms reading of debug information from
execuable file or object ?



	
		
______________________________________________________ 
Yahoo! for Good 
Donate to the Hurricane Katrina relief effort. 
http://store.yahoo.com/redcross-donate3/ 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]