Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Enumerations | Functions
debug.c File Reference
#include <stdio.h>
#include <assert.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
#include "debug.h"

Go to the source code of this file.

Classes

struct  debug_handle
struct  debug_unit
struct  debug_file
struct  debug_type
struct  debug_indirect_type
struct  debug_class_type
struct  debug_enum_type
struct  debug_function_type
struct  debug_range_type
struct  debug_array_type
struct  debug_set_type
struct  debug_offset_type
struct  debug_method_type
struct  debug_named_type
struct  debug_field
struct  debug_baseclass
struct  debug_method
struct  debug_method_variant
struct  debug_variable
struct  debug_function
struct  debug_parameter
struct  debug_typed_constant
struct  debug_block
struct  debug_lineno
struct  debug_namespace
struct  debug_name
struct  debug_class_id
struct  debug_type_compare_list
struct  debug_type_real_list
union  debug_type.u
union  debug_field.u
struct  debug_field.u.f
struct  debug_field.u.s

Defines

#define VOFFSET_STATIC_METHOD   ((bfd_vma) -1)
#define DEBUG_LINENO_COUNT   10

Enumerations

enum  debug_object_kind {
  DEBUG_OBJECT_TYPE, DEBUG_OBJECT_TAG, DEBUG_OBJECT_VARIABLE, DEBUG_OBJECT_FUNCTION,
  DEBUG_OBJECT_INT_CONSTANT, DEBUG_OBJECT_FLOAT_CONSTANT, DEBUG_OBJECT_TYPED_CONSTANT
}
enum  debug_object_linkage { DEBUG_LINKAGE_AUTOMATIC, DEBUG_LINKAGE_STATIC, DEBUG_LINKAGE_GLOBAL, DEBUG_LINKAGE_NONE }

Functions

static void debug_error (const char *)
static struct debug_namedebug_add_to_namespace (struct debug_handle *, struct debug_namespace **, const char *, enum debug_object_kind, enum debug_object_linkage)
static struct debug_namedebug_add_to_current_namespace (struct debug_handle *, const char *, enum debug_object_kind, enum debug_object_linkage)
static struct debug_typedebug_make_type (struct debug_handle *, enum debug_type_kind, unsigned int)
static struct debug_typedebug_get_real_type (void *, debug_type, struct debug_type_real_list *)
static bfd_boolean debug_write_name (struct debug_handle *, const struct debug_write_fns *, void *, struct debug_name *)
static bfd_boolean debug_write_type (struct debug_handle *, const struct debug_write_fns *, void *, struct debug_type *, struct debug_name *)
static bfd_boolean debug_write_class_type (struct debug_handle *, const struct debug_write_fns *, void *, struct debug_type *, const char *)
static bfd_boolean debug_write_function (struct debug_handle *, const struct debug_write_fns *, void *, const char *, enum debug_object_linkage, struct debug_function *)
static bfd_boolean debug_write_block (struct debug_handle *, const struct debug_write_fns *, void *, struct debug_block *)
static bfd_boolean debug_write_linenos (struct debug_handle *, const struct debug_write_fns *, void *, bfd_vma)
static bfd_boolean debug_set_class_id (struct debug_handle *, const char *, struct debug_type *)
static bfd_boolean debug_type_samep (struct debug_handle *, struct debug_type *, struct debug_type *)
static bfd_boolean debug_class_type_samep (struct debug_handle *, struct debug_type *, struct debug_type *)
static struct debug_namedebug_add_to_namespace (struct debug_handle *info ATTRIBUTE_UNUSED, struct debug_namespace **nsp, const char *name, enum debug_object_kind kind, enum debug_object_linkage linkage)
void * debug_init (void)
bfd_boolean debug_set_filename (void *handle, const char *name)
bfd_boolean debug_start_source (void *handle, const char *name)
bfd_boolean debug_record_function (void *handle, const char *name, debug_type return_type, bfd_boolean global, bfd_vma addr)
bfd_boolean debug_record_parameter (void *handle, const char *name, debug_type type, enum debug_parm_kind kind, bfd_vma val)
bfd_boolean debug_end_function (void *handle, bfd_vma addr)
bfd_boolean debug_start_block (void *handle, bfd_vma addr)
bfd_boolean debug_end_block (void *handle, bfd_vma addr)
bfd_boolean debug_record_line (void *handle, unsigned long lineno, bfd_vma addr)
bfd_boolean debug_start_common_block (void *handle ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED)
bfd_boolean debug_end_common_block (void *handle ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED)
bfd_boolean debug_record_int_const (void *handle, const char *name, bfd_vma val)
bfd_boolean debug_record_float_const (void *handle, const char *name, double val)
bfd_boolean debug_record_typed_const (void *handle, const char *name, debug_type type, bfd_vma val)
bfd_boolean debug_record_label (void *handle ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED, debug_type type ATTRIBUTE_UNUSED, bfd_vma addr ATTRIBUTE_UNUSED)
bfd_boolean debug_record_variable (void *handle, const char *name, debug_type type, enum debug_var_kind kind, bfd_vma val)
static struct debug_typedebug_make_type (struct debug_handle *info ATTRIBUTE_UNUSED, enum debug_type_kind kind, unsigned int size)
debug_type debug_make_indirect_type (void *handle, debug_type *slot, const char *tag)
debug_type debug_make_void_type (void *handle)
debug_type debug_make_int_type (void *handle, unsigned int size, bfd_boolean unsignedp)
debug_type debug_make_float_type (void *handle, unsigned int size)
debug_type debug_make_bool_type (void *handle, unsigned int size)
debug_type debug_make_complex_type (void *handle, unsigned int size)
debug_type debug_make_struct_type (void *handle, bfd_boolean structp, bfd_vma size, debug_field *fields)
debug_type debug_make_object_type (void *handle, bfd_boolean structp, bfd_vma size, debug_field *fields, debug_baseclass *baseclasses, debug_method *methods, debug_type vptrbase, bfd_boolean ownvptr)
debug_type debug_make_enum_type (void *handle, const char **names, bfd_signed_vma *values)
debug_type debug_make_pointer_type (void *handle, debug_type type)
debug_type debug_make_function_type (void *handle, debug_type type, debug_type *arg_types, bfd_boolean varargs)
debug_type debug_make_reference_type (void *handle, debug_type type)
debug_type debug_make_range_type (void *handle, debug_type type, bfd_signed_vma lower, bfd_signed_vma upper)
debug_type debug_make_array_type (void *handle, debug_type element_type, debug_type range_type, bfd_signed_vma lower, bfd_signed_vma upper, bfd_boolean stringp)
debug_type debug_make_set_type (void *handle, debug_type type, bfd_boolean bitstringp)
debug_type debug_make_offset_type (void *handle, debug_type base_type, debug_type target_type)
debug_type debug_make_method_type (void *handle, debug_type return_type, debug_type domain_type, debug_type *arg_types, bfd_boolean varargs)
debug_type debug_make_const_type (void *handle, debug_type type)
debug_type debug_make_volatile_type (void *handle, debug_type type)
debug_type debug_make_undefined_tagged_type (void *handle, const char *name, enum debug_type_kind kind)
debug_baseclass debug_make_baseclass (void *handle ATTRIBUTE_UNUSED, debug_type type, bfd_vma bitpos, bfd_boolean virtual, enum debug_visibility visibility)
debug_field debug_make_field (void *handle ATTRIBUTE_UNUSED, const char *name, debug_type type, bfd_vma bitpos, bfd_vma bitsize, enum debug_visibility visibility)
debug_field debug_make_static_member (void *handle ATTRIBUTE_UNUSED, const char *name, debug_type type, const char *physname, enum debug_visibility visibility)
debug_method debug_make_method (void *handle ATTRIBUTE_UNUSED, const char *name, debug_method_variant *variants)
debug_method_variant debug_make_method_variant (void *handle ATTRIBUTE_UNUSED, const char *physname, debug_type type, enum debug_visibility visibility, bfd_boolean constp, bfd_boolean volatilep, bfd_vma voffset, debug_type context)
debug_method_variant debug_make_static_method_variant (void *handle ATTRIBUTE_UNUSED, const char *physname, debug_type type, enum debug_visibility visibility, bfd_boolean constp, bfd_boolean volatilep)
debug_type debug_name_type (void *handle, const char *name, debug_type type)
debug_type debug_tag_type (void *handle, const char *name, debug_type type)
bfd_boolean debug_record_type_size (void *handle ATTRIBUTE_UNUSED, debug_type type, unsigned int size)
debug_type debug_find_named_type (void *handle, const char *name)
debug_type debug_find_tagged_type (void *handle, const char *name, enum debug_type_kind kind)
enum debug_type_kind debug_get_type_kind (void *handle, debug_type type)
const char * debug_get_type_name (void *handle, debug_type type)
bfd_vma debug_get_type_size (void *handle, debug_type type)
debug_type debug_get_return_type (void *handle, debug_type type)
const debug_typedebug_get_parameter_types (void *handle, debug_type type, bfd_boolean *pvarargs)
debug_type debug_get_target_type (void *handle, debug_type type)
const debug_fielddebug_get_fields (void *handle, debug_type type)
debug_type debug_get_field_type (void *handle ATTRIBUTE_UNUSED, debug_field field)
const char * debug_get_field_name (void *handle ATTRIBUTE_UNUSED, debug_field field)
bfd_vma debug_get_field_bitpos (void *handle ATTRIBUTE_UNUSED, debug_field field)
bfd_vma debug_get_field_bitsize (void *handle ATTRIBUTE_UNUSED, debug_field field)
enum debug_visibility debug_get_field_visibility (void *handle ATTRIBUTE_UNUSED, debug_field field)
const char * debug_get_field_physname (void *handle ATTRIBUTE_UNUSED, debug_field field)
bfd_boolean debug_write (void *handle, const struct debug_write_fns *fns, void *fhandle)

Class Documentation

struct debug_handle

Definition at line 40 of file debug.c.

Collaboration diagram for debug_handle:
Class Members
unsigned int base_id
unsigned int class_id
struct debug_type_compare_list * compare_list
struct debug_block * current_block
struct debug_file * current_file
struct debug_function * current_function
struct debug_lineno * current_lineno
struct debug_unit * current_unit
struct debug_lineno * current_write_lineno
unsigned int current_write_lineno_index
struct debug_class_id * id_list
unsigned int mark
struct debug_unit * units
struct debug_unit

Definition at line 72 of file debug.c.

Collaboration diagram for debug_unit:
Class Members
struct debug_file * files
struct debug_lineno * linenos
struct debug_unit * next
struct debug_file

Definition at line 88 of file debug.c.

Collaboration diagram for debug_file:
Class Members
const char * filename
struct debug_namespace * globals
struct debug_file * next
struct debug_type

Definition at line 100 of file debug.c.

Collaboration diagram for debug_type:
Class Members
enum debug_type_kind unsigned
int size debug_type pointer
union debug_type
u
struct debug_indirect_type

Definition at line 148 of file debug.c.

Collaboration diagram for debug_indirect_type:
Class Members
debug_type * slot
const char * tag
struct debug_class_type

Definition at line 158 of file debug.c.

Collaboration diagram for debug_class_type:
Class Members
debug_baseclass * baseclasses
debug_field * fields
unsigned int id
unsigned int mark
debug_method * methods
debug_type vptrbase
struct debug_enum_type

Definition at line 180 of file debug.c.

Class Members
const char ** names
bfd_signed_vma * values
struct debug_function_type

Definition at line 191 of file debug.c.

Collaboration diagram for debug_function_type:
Class Members
debug_type * arg_types
debug_type return_type
bfd_boolean varargs
struct debug_range_type

Definition at line 203 of file debug.c.

Collaboration diagram for debug_range_type:
Class Members
bfd_signed_vma lower
debug_type type
bfd_signed_vma upper
struct debug_array_type

Definition at line 215 of file debug.c.

Collaboration diagram for debug_array_type:
Class Members
debug_type element_type
bfd_signed_vma lower
debug_type range_type
bfd_boolean stringp
bfd_signed_vma upper
struct debug_set_type

Definition at line 231 of file debug.c.

Collaboration diagram for debug_set_type:
Class Members
bfd_boolean bitstringp
debug_type type
struct debug_offset_type

Definition at line 241 of file debug.c.

Collaboration diagram for debug_offset_type:
Class Members
debug_type base_type
debug_type target_type
struct debug_method_type

Definition at line 251 of file debug.c.

Collaboration diagram for debug_method_type:
Class Members
debug_type * arg_types
debug_type domain_type
debug_type return_type
bfd_boolean varargs
struct debug_named_type

Definition at line 265 of file debug.c.

Collaboration diagram for debug_named_type:
Class Members
struct debug_name * name
debug_type type
struct debug_field

Definition at line 275 of file debug.c.

Collaboration diagram for debug_field:
Class Members
const char * name
struct debug_type * type
enum debug_visibility
bfd_boolean static_member
union debug_field
u
struct debug_baseclass

Definition at line 305 of file debug.c.

Collaboration diagram for debug_baseclass:
Class Members
unsigned int bitpos
struct debug_type * type
bfd_boolean virtual
struct debug_method

Definition at line 319 of file debug.c.

Collaboration diagram for debug_method:
Class Members
const char * name
struct debug_method_variant ** variants
struct debug_method_variant

Definition at line 330 of file debug.c.

Collaboration diagram for debug_method_variant:
Class Members
struct debug_type * context
const char * physname
struct debug_type * type
struct debug_variable

Definition at line 354 of file debug.c.

struct debug_function

Definition at line 367 of file debug.c.

Collaboration diagram for debug_function:
Class Members
struct debug_block * blocks
struct debug_parameter * parameters
debug_type return_type
struct debug_parameter

Definition at line 380 of file debug.c.

Collaboration diagram for debug_parameter:
Class Members
const char * name
struct debug_parameter * next
debug_type type
struct debug_typed_constant

Definition at line 396 of file debug.c.

Collaboration diagram for debug_typed_constant:
Class Members
debug_type type
bfd_vma val
struct debug_block

Definition at line 407 of file debug.c.

Collaboration diagram for debug_block:
Class Members
struct debug_block * children
bfd_vma end
struct debug_namespace * locals
struct debug_block * next
struct debug_block * parent
bfd_vma start
struct debug_lineno

Definition at line 427 of file debug.c.

Collaboration diagram for debug_lineno:
Class Members
bfd_vma addrs
struct debug_file * file
unsigned long linenos
struct debug_lineno * next
struct debug_namespace

Definition at line 443 of file debug.c.

Collaboration diagram for debug_namespace:
Class Members
struct debug_name * list
struct debug_name ** tail
struct debug_name

Definition at line 488 of file debug.c.

Collaboration diagram for debug_name:
Class Members
unsigned int mark
const char * name
struct debug_name * next
struct debug_class_id

Definition at line 523 of file debug.c.

Collaboration diagram for debug_class_id:
Class Members
struct debug_class_id * next
const char * tag
struct debug_type * type
struct debug_type_compare_list

Definition at line 536 of file debug.c.

Collaboration diagram for debug_type_compare_list:
Class Members
struct debug_type_compare_list * next
struct debug_type * t1
struct debug_type * t2
struct debug_type_real_list

Definition at line 548 of file debug.c.

Collaboration diagram for debug_type_real_list:
Class Members
struct debug_type_real_list * next
struct debug_type * t
union debug_type.u

Definition at line 109 of file debug.c.

Class Members
struct debug_array_type * karray
struct debug_class_type * kclass
struct debug_type * kconst
struct debug_enum_type * kenum
struct debug_function_type * kfunction
struct debug_indirect_type * kindirect
bfd_boolean kint
struct debug_method_type * kmethod
struct debug_named_type * knamed
struct debug_offset_type * koffset
struct debug_type * kpointer
struct debug_range_type * krange
struct debug_type * kreference
struct debug_set_type * kset
struct debug_type * kvolatile
union debug_field.u

Definition at line 285 of file debug.c.

Class Members
u f
u s
struct debug_field.u.f

Definition at line 288 of file debug.c.

Class Members
unsigned int bitpos
unsigned int bitsize
struct debug_field.u.s

Definition at line 296 of file debug.c.

Class Members
const char * physname

Define Documentation

#define DEBUG_LINENO_COUNT   10

Definition at line 434 of file debug.c.

#define VOFFSET_STATIC_METHOD   ((bfd_vma) -1)

Definition at line 345 of file debug.c.


Enumeration Type Documentation

Enumerator:
DEBUG_OBJECT_TYPE 
DEBUG_OBJECT_TAG 
DEBUG_OBJECT_VARIABLE 
DEBUG_OBJECT_FUNCTION 
DEBUG_OBJECT_INT_CONSTANT 
DEBUG_OBJECT_FLOAT_CONSTANT 
DEBUG_OBJECT_TYPED_CONSTANT 

Definition at line 453 of file debug.c.

{
  /* A type.  */
  DEBUG_OBJECT_TYPE,
  /* A tagged type (really a different sort of namespace).  */
  DEBUG_OBJECT_TAG,
  /* A variable.  */
  DEBUG_OBJECT_VARIABLE,
  /* A function.  */
  DEBUG_OBJECT_FUNCTION,
  /* An integer constant.  */
  DEBUG_OBJECT_INT_CONSTANT,
  /* A floating point constant.  */
  DEBUG_OBJECT_FLOAT_CONSTANT,
  /* A typed constant.  */
  DEBUG_OBJECT_TYPED_CONSTANT
};
Enumerator:
DEBUG_LINKAGE_AUTOMATIC 
DEBUG_LINKAGE_STATIC 
DEBUG_LINKAGE_GLOBAL 
DEBUG_LINKAGE_NONE 

Definition at line 473 of file debug.c.

{
  /* Local variable.  */
  DEBUG_LINKAGE_AUTOMATIC,
  /* Static--either file static or function static, depending upon the
     namespace is.  */
  DEBUG_LINKAGE_STATIC,
  /* Global.  */
  DEBUG_LINKAGE_GLOBAL,
  /* No linkage.  */
  DEBUG_LINKAGE_NONE
};

Function Documentation

static struct debug_name * debug_add_to_current_namespace ( struct debug_handle info,
const char *  name,
enum debug_object_kind  kind,
enum debug_object_linkage  linkage 
) [static, read]

Definition at line 639 of file debug.c.

{
  struct debug_namespace **nsp;

  if (info->current_unit == NULL
      || info->current_file == NULL)
    {
      debug_error (_("debug_add_to_current_namespace: no current file"));
      return NULL;
    }

  if (info->current_block != NULL)
    nsp = &info->current_block->locals;
  else
    nsp = &info->current_file->globals;

  return debug_add_to_namespace (info, nsp, name, kind, linkage);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct debug_name* debug_add_to_namespace ( struct debug_handle ,
struct debug_namespace **  ,
const char *  ,
enum  debug_object_kind,
enum  debug_object_linkage 
) [static, read]

Here is the caller graph for this function:

static struct debug_name* debug_add_to_namespace ( struct debug_handle *info  ATTRIBUTE_UNUSED,
struct debug_namespace **  nsp,
const char *  name,
enum debug_object_kind  kind,
enum debug_object_linkage  linkage 
) [static, read]

Definition at line 604 of file debug.c.

{
  struct debug_name *n;
  struct debug_namespace *ns;

  n = (struct debug_name *) xmalloc (sizeof *n);
  memset (n, 0, sizeof *n);

  n->name = name;
  n->kind = kind;
  n->linkage = linkage;

  ns = *nsp;
  if (ns == NULL)
    {
      ns = (struct debug_namespace *) xmalloc (sizeof *ns);
      memset (ns, 0, sizeof *ns);

      ns->tail = &ns->list;

      *nsp = ns;
    }

  *ns->tail = n;
  ns->tail = &n->next;

  return n;
}

Here is the call graph for this function:

static bfd_boolean debug_class_type_samep ( struct debug_handle info,
struct debug_type t1,
struct debug_type t2 
) [static]

Definition at line 3235 of file debug.c.

{
  struct debug_class_type *c1, *c2;

  c1 = t1->u.kclass;
  c2 = t2->u.kclass;

  if ((c1->fields == NULL) != (c2->fields == NULL)
      || (c1->baseclasses == NULL) != (c2->baseclasses == NULL)
      || (c1->methods == NULL) != (c2->methods == NULL)
      || (c1->vptrbase == NULL) != (c2->vptrbase == NULL))
    return FALSE;

  if (c1->fields != NULL)
    {
      struct debug_field **pf1, **pf2;

      for (pf1 = c1->fields, pf2 = c2->fields;
          *pf1 != NULL && *pf2 != NULL;
          pf1++, pf2++)
       {
         struct debug_field *f1, *f2;

         f1 = *pf1;
         f2 = *pf2;
         if (f1->name[0] != f2->name[0]
             || f1->visibility != f2->visibility
             || f1->static_member != f2->static_member)
           return FALSE;
         if (f1->static_member)
           {
             if (strcmp (f1->u.s.physname, f2->u.s.physname) != 0)
              return FALSE;
           }
         else
           {
             if (f1->u.f.bitpos != f2->u.f.bitpos
                || f1->u.f.bitsize != f2->u.f.bitsize)
              return FALSE;
           }
         /* We do the checks which require function calls last.  We
             don't require that the types of fields have the same
             names, since that sometimes fails in the presence of
             typedefs and we really don't care.  */
         if (strcmp (f1->name, f2->name) != 0
             || ! debug_type_samep (info,
                                 debug_get_real_type ((void *) info,
                                                   f1->type, NULL),
                                 debug_get_real_type ((void *) info,
                                                   f2->type, NULL)))
           return FALSE;
       }
      if (*pf1 != NULL || *pf2 != NULL)
       return FALSE;
    }

  if (c1->vptrbase != NULL)
    {
      if (! debug_type_samep (info, c1->vptrbase, c2->vptrbase))
       return FALSE;
    }

  if (c1->baseclasses != NULL)
    {
      struct debug_baseclass **pb1, **pb2;

      for (pb1 = c1->baseclasses, pb2 = c2->baseclasses;
          *pb1 != NULL && *pb2 != NULL;
          ++pb1, ++pb2)
       {
         struct debug_baseclass *b1, *b2;

         b1 = *pb1;
         b2 = *pb2;
         if (b1->bitpos != b2->bitpos
             || b1->virtual != b2->virtual
             || b1->visibility != b2->visibility
             || ! debug_type_samep (info, b1->type, b2->type))
           return FALSE;
       }
      if (*pb1 != NULL || *pb2 != NULL)
       return FALSE;
    }

  if (c1->methods != NULL)
    {
      struct debug_method **pm1, **pm2;

      for (pm1 = c1->methods, pm2 = c2->methods;
          *pm1 != NULL && *pm2 != NULL;
          ++pm1, ++pm2)
       {
         struct debug_method *m1, *m2;

         m1 = *pm1;
         m2 = *pm2;
         if (m1->name[0] != m2->name[0]
             || strcmp (m1->name, m2->name) != 0
             || (m1->variants == NULL) != (m2->variants == NULL))
           return FALSE;
         if (m1->variants == NULL)
           {
             struct debug_method_variant **pv1, **pv2;

             for (pv1 = m1->variants, pv2 = m2->variants;
                 *pv1 != NULL && *pv2 != NULL;
                 ++pv1, ++pv2)
              {
                struct debug_method_variant *v1, *v2;

                v1 = *pv1;
                v2 = *pv2;
                if (v1->physname[0] != v2->physname[0]
                    || v1->visibility != v2->visibility
                    || v1->constp != v2->constp
                    || v1->volatilep != v2->volatilep
                    || v1->voffset != v2->voffset
                    || (v1->context == NULL) != (v2->context == NULL)
                    || strcmp (v1->physname, v2->physname) != 0
                    || ! debug_type_samep (info, v1->type, v2->type))
                  return FALSE;
                if (v1->context != NULL)
                  {
                    if (! debug_type_samep (info, v1->context,
                                         v2->context))
                     return FALSE;
                  }
              }
             if (*pv1 != NULL || *pv2 != NULL)
              return FALSE;
           }
       }
      if (*pm1 != NULL || *pm2 != NULL)
       return FALSE;
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_end_block ( void *  handle,
bfd_vma  addr 
)

Definition at line 929 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_block *parent;

  if (info->current_unit == NULL
      || info->current_block == NULL)
    {
      debug_error (_("debug_end_block: no current block"));
      return FALSE;
    }

  parent = info->current_block->parent;
  if (parent == NULL)
    {
      debug_error (_("debug_end_block: attempt to close top level block"));
      return FALSE;
    }

  info->current_block->end = addr;

  info->current_block = parent;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_end_common_block ( void *handle  ATTRIBUTE_UNUSED,
const char *name  ATTRIBUTE_UNUSED 
)

Definition at line 1027 of file debug.c.

{
  /* FIXME */
  debug_error (_("debug_end_common_block: not implemented"));
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_end_function ( void *  handle,
bfd_vma  addr 
)

Definition at line 859 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;

  if (info->current_unit == NULL
      || info->current_block == NULL
      || info->current_function == NULL)
    {
      debug_error (_("debug_end_function: no current function"));
      return FALSE;
    }

  if (info->current_block->parent != NULL)
    {
      debug_error (_("debug_end_function: some blocks were not closed"));
      return FALSE;
    }

  info->current_block->end = addr;

  info->current_function = NULL;
  info->current_block = NULL;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void debug_error ( const char *  message) [static]

Definition at line 596 of file debug.c.

{
  fprintf (stderr, "%s\n", message);
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_find_named_type ( void *  handle,
const char *  name 
)

Definition at line 1943 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_block *b;
  struct debug_file *f;

  /* We only search the current compilation unit.  I don't know if
     this is right or not.  */

  if (info->current_unit == NULL)
    {
      debug_error (_("debug_find_named_type: no current compilation unit"));
      return DEBUG_TYPE_NULL;
    }

  for (b = info->current_block; b != NULL; b = b->parent)
    {
      if (b->locals != NULL)
       {
         struct debug_name *n;

         for (n = b->locals->list; n != NULL; n = n->next)
           {
             if (n->kind == DEBUG_OBJECT_TYPE
                && n->name[0] == name[0]
                && strcmp (n->name, name) == 0)
              return n->u.type;
           }
       }
    }

  for (f = info->current_unit->files; f != NULL; f = f->next)
    {
      if (f->globals != NULL)
       {
         struct debug_name *n;

         for (n = f->globals->list; n != NULL; n = n->next)
           {
             if (n->kind == DEBUG_OBJECT_TYPE
                && n->name[0] == name[0]
                && strcmp (n->name, name) == 0)
              return n->u.type;
           }
       }
    }

  return DEBUG_TYPE_NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_find_tagged_type ( void *  handle,
const char *  name,
enum debug_type_kind  kind 
)

Definition at line 1996 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_unit *u;

  /* 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
                    && (kind == DEBUG_KIND_ILLEGAL
                       || n->u.tag->kind == kind)
                    && n->name[0] == name[0]
                    && strcmp (n->name, name) == 0)
                  return n->u.tag;
              }
           }
       }
    }

  return DEBUG_TYPE_NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_vma debug_get_field_bitpos ( void *handle  ATTRIBUTE_UNUSED,
debug_field  field 
)

Definition at line 2269 of file debug.c.

{
  if (field == NULL || field->static_member)
    return (bfd_vma) -1;
  return field->u.f.bitpos;
}

Here is the caller graph for this function:

bfd_vma debug_get_field_bitsize ( void *handle  ATTRIBUTE_UNUSED,
debug_field  field 
)

Definition at line 2279 of file debug.c.

{
  if (field == NULL || field->static_member)
    return (bfd_vma) -1;
  return field->u.f.bitsize;
}

Here is the caller graph for this function:

const char* debug_get_field_name ( void *handle  ATTRIBUTE_UNUSED,
debug_field  field 
)

Definition at line 2259 of file debug.c.

{
  if (field == NULL)
    return NULL;
  return field->name;
}

Here is the caller graph for this function:

const char* debug_get_field_physname ( void *handle  ATTRIBUTE_UNUSED,
debug_field  field 
)

Definition at line 2299 of file debug.c.

{
  if (field == NULL || ! field->static_member)
    return NULL;
  return field->u.s.physname;
}
debug_type debug_get_field_type ( void *handle  ATTRIBUTE_UNUSED,
debug_field  field 
)

Definition at line 2249 of file debug.c.

{
  if (field == NULL)
    return NULL;
  return field->type;
}

Here is the caller graph for this function:

enum debug_visibility debug_get_field_visibility ( void *handle  ATTRIBUTE_UNUSED,
debug_field  field 
)

Definition at line 2289 of file debug.c.

{
  if (field == NULL)
    return DEBUG_VISIBILITY_IGNORE;
  return field->visibility;
}
const debug_field* debug_get_fields ( void *  handle,
debug_type  type 
)

Definition at line 2224 of file debug.c.

{
  if (type == NULL)
    return NULL;

  type = debug_get_real_type (handle, type, NULL);
  if (type == NULL)
    return NULL;

  switch (type->kind)
    {
    default:
      return NULL;
    case DEBUG_KIND_STRUCT:
    case DEBUG_KIND_UNION:
    case DEBUG_KIND_CLASS:
    case DEBUG_KIND_UNION_CLASS:
      return type->u.kclass->fields;
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

const debug_type* debug_get_parameter_types ( void *  handle,
debug_type  type,
bfd_boolean pvarargs 
)

Definition at line 2168 of file debug.c.

{
  if (type == NULL)
    return NULL;

  type = debug_get_real_type (handle, type, NULL);
  if (type == NULL)
    return NULL;

  switch (type->kind)
    {
    default:
      return NULL;
    case DEBUG_KIND_FUNCTION:
      *pvarargs = type->u.kfunction->varargs;
      return type->u.kfunction->arg_types;
    case DEBUG_KIND_METHOD:
      *pvarargs = type->u.kmethod->varargs;
      return type->u.kmethod->arg_types;
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct debug_type * debug_get_real_type ( void *  handle,
debug_type  type,
struct debug_type_real_list list 
) [static, read]

Definition at line 2035 of file debug.c.

{
  struct debug_type_real_list *l;
  struct debug_type_real_list rl;

  switch (type->kind)
    {
    default:
      return type;

    case DEBUG_KIND_INDIRECT:
    case DEBUG_KIND_NAMED:
    case DEBUG_KIND_TAGGED:
      break;
    }

  for (l = list; l != NULL; l = l->next)
    {
      if (l->t == type || l == l->next)
       {
         fprintf (stderr,
                 _("debug_get_real_type: circular debug information for %s\n"),
                 debug_get_type_name (handle, type));
         return NULL;
       }
    }

  rl.next = list;
  rl.t = type;

  switch (type->kind)
    {
      /* The default case is just here to avoid warnings.  */
    default:
    case DEBUG_KIND_INDIRECT:
      if (*type->u.kindirect->slot != NULL)
       return debug_get_real_type (handle, *type->u.kindirect->slot, &rl);
      return type;
    case DEBUG_KIND_NAMED:
    case DEBUG_KIND_TAGGED:
      return debug_get_real_type (handle, type->u.knamed->type, &rl);
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_get_return_type ( void *  handle,
debug_type  type 
)

Definition at line 2143 of file debug.c.

{
  if (type == NULL)
    return DEBUG_TYPE_NULL;

  type = debug_get_real_type (handle, type, NULL);
  if (type == NULL)
    return DEBUG_TYPE_NULL;

  switch (type->kind)
    {
    default:
      return DEBUG_TYPE_NULL;
    case DEBUG_KIND_FUNCTION:
      return type->u.kfunction->return_type;
    case DEBUG_KIND_METHOD:
      return type->u.kmethod->return_type;
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_get_target_type ( void *  handle,
debug_type  type 
)

Definition at line 2195 of file debug.c.

{
  if (type == NULL)
    return NULL;

  type = debug_get_real_type (handle, type, NULL);
  if (type == NULL)
    return NULL;

  switch (type->kind)
    {
    default:
      return NULL;
    case DEBUG_KIND_POINTER:
      return type->u.kpointer;
    case DEBUG_KIND_REFERENCE:
      return type->u.kreference;
    case DEBUG_KIND_CONST:
      return type->u.kconst;
    case DEBUG_KIND_VOLATILE:
      return type->u.kvolatile;
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

enum debug_type_kind debug_get_type_kind ( void *  handle,
debug_type  type 
)

Definition at line 2084 of file debug.c.

{
  if (type == NULL)
    return DEBUG_KIND_ILLEGAL;
  type = debug_get_real_type (handle, type, NULL);
  if (type == NULL)
    return DEBUG_KIND_ILLEGAL;
  return type->kind;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* debug_get_type_name ( void *  handle,
debug_type  type 
)

Definition at line 2097 of file debug.c.

{
  if (type->kind == DEBUG_KIND_INDIRECT)
    {
      if (*type->u.kindirect->slot != NULL)
       return debug_get_type_name (handle, *type->u.kindirect->slot);
      return type->u.kindirect->tag;
    }
  if (type->kind == DEBUG_KIND_NAMED
      || type->kind == DEBUG_KIND_TAGGED)
    return type->u.knamed->name->name;
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_vma debug_get_type_size ( void *  handle,
debug_type  type 
)

Definition at line 2114 of file debug.c.

{
  if (type == NULL)
    return 0;

  /* We don't call debug_get_real_type, because somebody might have
     called debug_record_type_size on a named or indirect type.  */

  if (type->size != 0)
    return type->size;

  switch (type->kind)
    {
    default:
      return 0;
    case DEBUG_KIND_INDIRECT:
      if (*type->u.kindirect->slot != NULL)
       return debug_get_type_size (handle, *type->u.kindirect->slot);
      return 0;
    case DEBUG_KIND_NAMED:
    case DEBUG_KIND_TAGGED:
      return debug_get_type_size (handle, type->u.knamed->type);
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* debug_init ( void  )

Definition at line 663 of file debug.c.

{
  struct debug_handle *ret;

  ret = (struct debug_handle *) xmalloc (sizeof *ret);
  memset (ret, 0, sizeof *ret);
  return (void *) ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_array_type ( void *  handle,
debug_type  element_type,
debug_type  range_type,
bfd_signed_vma  lower,
bfd_signed_vma  upper,
bfd_boolean  stringp 
)

Definition at line 1480 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_array_type *a;

  if (element_type == NULL || range_type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_ARRAY, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  a = (struct debug_array_type *) xmalloc (sizeof *a);
  memset (a, 0, sizeof *a);

  a->element_type = element_type;
  a->range_type = range_type;
  a->lower = lower;
  a->upper = upper;
  a->stringp = stringp;

  t->u.karray = a;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_baseclass debug_make_baseclass ( void *handle  ATTRIBUTE_UNUSED,
debug_type  type,
bfd_vma  bitpos,
bfd_boolean  virtual,
enum debug_visibility  visibility 
)

Definition at line 1683 of file debug.c.

{
  struct debug_baseclass *b;

  b = (struct debug_baseclass *) xmalloc (sizeof *b);
  memset (b, 0, sizeof *b);

  b->type = type;
  b->bitpos = bitpos;
  b->virtual = virtual;
  b->visibility = visibility;

  return b;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_bool_type ( void *  handle,
unsigned int  size 
)

Definition at line 1259 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;

  return debug_make_type (info, DEBUG_KIND_BOOL, size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_complex_type ( void *  handle,
unsigned int  size 
)

Definition at line 1269 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;

  return debug_make_type (info, DEBUG_KIND_COMPLEX, size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_const_type ( void *  handle,
debug_type  type 
)

Definition at line 1605 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_CONST, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  t->u.kconst = type;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_enum_type ( void *  handle,
const char **  names,
bfd_signed_vma values 
)

Definition at line 1347 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_enum_type *e;

  t = debug_make_type (info, DEBUG_KIND_ENUM, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  e = (struct debug_enum_type *) xmalloc (sizeof *e);
  memset (e, 0, sizeof *e);

  e->names = names;
  e->values = values;

  t->u.kenum = e;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_field debug_make_field ( void *handle  ATTRIBUTE_UNUSED,
const char *  name,
debug_type  type,
bfd_vma  bitpos,
bfd_vma  bitsize,
enum debug_visibility  visibility 
)

Definition at line 1707 of file debug.c.

{
  struct debug_field *f;

  f = (struct debug_field *) xmalloc (sizeof *f);
  memset (f, 0, sizeof *f);

  f->name = name;
  f->type = type;
  f->static_member = FALSE;
  f->u.f.bitpos = bitpos;
  f->u.f.bitsize = bitsize;
  f->visibility = visibility;

  return f;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_float_type ( void *  handle,
unsigned int  size 
)

Definition at line 1249 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;

  return debug_make_type (info, DEBUG_KIND_FLOAT, size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_function_type ( void *  handle,
debug_type  type,
debug_type arg_types,
bfd_boolean  varargs 
)

Definition at line 1398 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_function_type *f;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_FUNCTION, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  f = (struct debug_function_type *) xmalloc (sizeof *f);
  memset (f, 0, sizeof *f);

  f->return_type = type;
  f->arg_types = arg_types;
  f->varargs = varargs;

  t->u.kfunction = f;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_indirect_type ( void *  handle,
debug_type slot,
const char *  tag 
)

Definition at line 1195 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_indirect_type *i;

  t = debug_make_type (info, DEBUG_KIND_INDIRECT, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  i = (struct debug_indirect_type *) xmalloc (sizeof *i);
  memset (i, 0, sizeof *i);

  i->slot = slot;
  i->tag = tag;

  t->u.kindirect = i;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_int_type ( void *  handle,
unsigned int  size,
bfd_boolean  unsignedp 
)

Definition at line 1230 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;

  t = debug_make_type (info, DEBUG_KIND_INT, size);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  t->u.kint = unsignedp;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_method debug_make_method ( void *handle  ATTRIBUTE_UNUSED,
const char *  name,
debug_method_variant variants 
)

Definition at line 1755 of file debug.c.

{
  struct debug_method *m;

  m = (struct debug_method *) xmalloc (sizeof *m);
  memset (m, 0, sizeof *m);

  m->name = name;
  m->variants = variants;

  return m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_method_type ( void *  handle,
debug_type  return_type,
debug_type  domain_type,
debug_type arg_types,
bfd_boolean  varargs 
)

Definition at line 1574 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_method_type *m;

  if (return_type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_METHOD, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  m = (struct debug_method_type *) xmalloc (sizeof *m);
  memset (m, 0, sizeof *m);

  m->return_type = return_type;
  m->domain_type = domain_type;
  m->arg_types = arg_types;
  m->varargs = varargs;

  t->u.kmethod = m;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_method_variant debug_make_method_variant ( void *handle  ATTRIBUTE_UNUSED,
const char *  physname,
debug_type  type,
enum debug_visibility  visibility,
bfd_boolean  constp,
bfd_boolean  volatilep,
bfd_vma  voffset,
debug_type  context 
)

Definition at line 1779 of file debug.c.

{
  struct debug_method_variant *m;

  m = (struct debug_method_variant *) xmalloc (sizeof *m);
  memset (m, 0, sizeof *m);

  m->physname = physname;
  m->type = type;
  m->visibility = visibility;
  m->constp = constp;
  m->volatilep = volatilep;
  m->voffset = voffset;
  m->context = context;

  return m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_object_type ( void *  handle,
bfd_boolean  structp,
bfd_vma  size,
debug_field fields,
debug_baseclass baseclasses,
debug_method methods,
debug_type  vptrbase,
bfd_boolean  ownvptr 
)

Definition at line 1312 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_class_type *c;

  t = debug_make_type (info,
                     structp ? DEBUG_KIND_CLASS : DEBUG_KIND_UNION_CLASS,
                     size);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  c = (struct debug_class_type *) xmalloc (sizeof *c);
  memset (c, 0, sizeof *c);

  c->fields = fields;
  c->baseclasses = baseclasses;
  c->methods = methods;
  if (ownvptr)
    c->vptrbase = t;
  else
    c->vptrbase = vptrbase;

  t->u.kclass = c;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_offset_type ( void *  handle,
debug_type  base_type,
debug_type  target_type 
)

Definition at line 1544 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_offset_type *o;

  if (base_type == NULL || target_type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_OFFSET, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  o = (struct debug_offset_type *) xmalloc (sizeof *o);
  memset (o, 0, sizeof *o);

  o->base_type = base_type;
  o->target_type = target_type;

  t->u.koffset = o;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_pointer_type ( void *  handle,
debug_type  type 
)

Definition at line 1372 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  if (type->pointer != DEBUG_TYPE_NULL)
    return type->pointer;

  t = debug_make_type (info, DEBUG_KIND_POINTER, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  t->u.kpointer = type;

  type->pointer = t;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_range_type ( void *  handle,
debug_type  type,
bfd_signed_vma  lower,
bfd_signed_vma  upper 
)

Definition at line 1447 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_range_type *r;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_RANGE, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  r = (struct debug_range_type *) xmalloc (sizeof *r);
  memset (r, 0, sizeof *r);

  r->type = type;
  r->lower = lower;
  r->upper = upper;

  t->u.krange = r;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_reference_type ( void *  handle,
debug_type  type 
)

Definition at line 1427 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_REFERENCE, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  t->u.kreference = type;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_set_type ( void *  handle,
debug_type  type,
bfd_boolean  bitstringp 
)

Definition at line 1514 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_set_type *s;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_SET, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  s = (struct debug_set_type *) xmalloc (sizeof *s);
  memset (s, 0, sizeof *s);

  s->type = type;
  s->bitstringp = bitstringp;

  t->u.kset = s;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_field debug_make_static_member ( void *handle  ATTRIBUTE_UNUSED,
const char *  name,
debug_type  type,
const char *  physname,
enum debug_visibility  visibility 
)

Definition at line 1733 of file debug.c.

{
  struct debug_field *f;

  f = (struct debug_field *) xmalloc (sizeof *f);
  memset (f, 0, sizeof *f);

  f->name = name;
  f->type = type;
  f->static_member = TRUE;
  f->u.s.physname = physname;
  f->visibility = visibility;

  return f;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_method_variant debug_make_static_method_variant ( void *handle  ATTRIBUTE_UNUSED,
const char *  physname,
debug_type  type,
enum debug_visibility  visibility,
bfd_boolean  constp,
bfd_boolean  volatilep 
)

Definition at line 1806 of file debug.c.

{
  struct debug_method_variant *m;

  m = (struct debug_method_variant *) xmalloc (sizeof *m);
  memset (m, 0, sizeof *m);

  m->physname = physname;
  m->type = type;
  m->visibility = visibility;
  m->constp = constp;
  m->volatilep = volatilep;
  m->voffset = VOFFSET_STATIC_METHOD;

  return m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_struct_type ( void *  handle,
bfd_boolean  structp,
bfd_vma  size,
debug_field fields 
)

Definition at line 1281 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_class_type *c;

  t = debug_make_type (info,
                     structp ? DEBUG_KIND_STRUCT : DEBUG_KIND_UNION,
                     size);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  c = (struct debug_class_type *) xmalloc (sizeof *c);
  memset (c, 0, sizeof *c);

  c->fields = fields;

  t->u.kclass = c;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct debug_type* debug_make_type ( struct debug_handle ,
enum  debug_type_kind,
unsigned  int 
) [static, read]

Here is the caller graph for this function:

static struct debug_type* debug_make_type ( struct debug_handle *info  ATTRIBUTE_UNUSED,
enum debug_type_kind  kind,
unsigned int  size 
) [static, read]

Definition at line 1177 of file debug.c.

{
  struct debug_type *t;

  t = (struct debug_type *) xmalloc (sizeof *t);
  memset (t, 0, sizeof *t);

  t->kind = kind;
  t->size = size;

  return t;
}

Here is the call graph for this function:

debug_type debug_make_undefined_tagged_type ( void *  handle,
const char *  name,
enum debug_type_kind  kind 
)

Definition at line 1646 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;

  if (name == NULL)
    return DEBUG_TYPE_NULL;

  switch (kind)
    {
    case DEBUG_KIND_STRUCT:
    case DEBUG_KIND_UNION:
    case DEBUG_KIND_CLASS:
    case DEBUG_KIND_UNION_CLASS:
    case DEBUG_KIND_ENUM:
      break;

    default:
      debug_error (_("debug_make_undefined_type: unsupported kind"));
      return DEBUG_TYPE_NULL;
    }

  t = debug_make_type (info, kind, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  return debug_tag_type (handle, name, t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_void_type ( void *  handle)

Definition at line 1219 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;

  return debug_make_type (info, DEBUG_KIND_VOID, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_make_volatile_type ( void *  handle,
debug_type  type 
)

Definition at line 1625 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;

  if (type == NULL)
    return DEBUG_TYPE_NULL;

  t = debug_make_type (info, DEBUG_KIND_VOLATILE, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  t->u.kvolatile = type;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_name_type ( void *  handle,
const char *  name,
debug_type  type 
)

Definition at line 1829 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_named_type *n;
  struct debug_name *nm;

  if (name == NULL || type == NULL)
    return DEBUG_TYPE_NULL;

  if (info->current_unit == NULL
      || info->current_file == NULL)
    {
      debug_error (_("debug_name_type: no current file"));
      return DEBUG_TYPE_NULL;
    }

  t = debug_make_type (info, DEBUG_KIND_NAMED, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  n = (struct debug_named_type *) xmalloc (sizeof *n);
  memset (n, 0, sizeof *n);

  n->type = type;

  t->u.knamed = n;

  /* We always add the name to the global namespace.  This is probably
     wrong in some cases, but it seems to be right for stabs.  FIXME.  */

  nm = debug_add_to_namespace (info, &info->current_file->globals, name,
                            DEBUG_OBJECT_TYPE, DEBUG_LINKAGE_NONE);
  if (nm == NULL)
    return DEBUG_TYPE_NULL;

  nm->u.type = t;

  n->name = nm;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_float_const ( void *  handle,
const char *  name,
double  val 
)

Definition at line 1059 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_name *n;

  if (name == NULL)
    return FALSE;

  n = debug_add_to_current_namespace (info, name, DEBUG_OBJECT_FLOAT_CONSTANT,
                                  DEBUG_LINKAGE_NONE);
  if (n == NULL)
    return FALSE;

  n->u.float_constant = val;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_function ( void *  handle,
const char *  name,
debug_type  return_type,
bfd_boolean  global,
bfd_vma  addr 
)

Definition at line 767 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_function *f;
  struct debug_block *b;
  struct debug_name *n;

  if (name == NULL)
    name = "";
  if (return_type == NULL)
    return FALSE;

  if (info->current_unit == NULL)
    {
      debug_error (_("debug_record_function: no debug_set_filename call"));
      return FALSE;
    }

  f = (struct debug_function *) xmalloc (sizeof *f);
  memset (f, 0, sizeof *f);

  f->return_type = return_type;

  b = (struct debug_block *) xmalloc (sizeof *b);
  memset (b, 0, sizeof *b);

  b->start = addr;
  b->end = (bfd_vma) -1;

  f->blocks = b;

  info->current_function = f;
  info->current_block = b;

  /* FIXME: If we could handle nested functions, this would be the
     place: we would want to use a different namespace.  */
  n = debug_add_to_namespace (info,
                           &info->current_file->globals,
                           name,
                           DEBUG_OBJECT_FUNCTION,
                           (global
                            ? DEBUG_LINKAGE_GLOBAL
                            : DEBUG_LINKAGE_STATIC));
  if (n == NULL)
    return FALSE;

  n->u.function = f;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_int_const ( void *  handle,
const char *  name,
bfd_vma  val 
)

Definition at line 1038 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_name *n;

  if (name == NULL)
    return FALSE;

  n = debug_add_to_current_namespace (info, name, DEBUG_OBJECT_INT_CONSTANT,
                                  DEBUG_LINKAGE_NONE);
  if (n == NULL)
    return FALSE;

  n->u.int_constant = val;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_label ( void *handle  ATTRIBUTE_UNUSED,
const char *name  ATTRIBUTE_UNUSED,
debug_type type  ATTRIBUTE_UNUSED,
bfd_vma addr  ATTRIBUTE_UNUSED 
)

Definition at line 1109 of file debug.c.

{
  /* FIXME.  */
  debug_error (_("debug_record_label: not implemented"));
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_line ( void *  handle,
unsigned long  lineno,
bfd_vma  addr 
)

Definition at line 959 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_lineno *l;
  unsigned int i;

  if (info->current_unit == NULL)
    {
      debug_error (_("debug_record_line: no current unit"));
      return FALSE;
    }

  l = info->current_lineno;
  if (l != NULL && l->file == info->current_file)
    {
      for (i = 0; i < DEBUG_LINENO_COUNT; i++)
       {
         if (l->linenos[i] == (unsigned long) -1)
           {
             l->linenos[i] = lineno;
             l->addrs[i] = addr;
             return TRUE;
           }
       }
    }

  /* If we get here, then either 1) there is no current_lineno
     structure, which means this is the first line number in this
     compilation unit, 2) the current_lineno structure is for a
     different file, or 3) the current_lineno structure is full.
     Regardless, we want to allocate a new debug_lineno structure, put
     it in the right place, and make it the new current_lineno
     structure.  */

  l = (struct debug_lineno *) xmalloc (sizeof *l);
  memset (l, 0, sizeof *l);

  l->file = info->current_file;
  l->linenos[0] = lineno;
  l->addrs[0] = addr;
  for (i = 1; i < DEBUG_LINENO_COUNT; i++)
    l->linenos[i] = (unsigned long) -1;

  if (info->current_lineno != NULL)
    info->current_lineno->next = l;
  else
    info->current_unit->linenos = l;

  info->current_lineno = l;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_parameter ( void *  handle,
const char *  name,
debug_type  type,
enum debug_parm_kind  kind,
bfd_vma  val 
)

Definition at line 823 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_parameter *p, **pp;

  if (name == NULL || type == NULL)
    return FALSE;

  if (info->current_unit == NULL
      || info->current_function == NULL)
    {
      debug_error (_("debug_record_parameter: no current function"));
      return FALSE;
    }

  p = (struct debug_parameter *) xmalloc (sizeof *p);
  memset (p, 0, sizeof *p);

  p->name = name;
  p->type = type;
  p->kind = kind;
  p->val = val;

  for (pp = &info->current_function->parameters;
       *pp != NULL;
       pp = &(*pp)->next)
    ;
  *pp = p;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_type_size ( void *handle  ATTRIBUTE_UNUSED,
debug_type  type,
unsigned int  size 
)

Definition at line 1928 of file debug.c.

{
  if (type->size != 0 && type->size != size)
    fprintf (stderr, _("Warning: changing type size from %d to %d\n"),
            type->size, size);

  type->size = size;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_typed_const ( void *  handle,
const char *  name,
debug_type  type,
bfd_vma  val 
)

Definition at line 1080 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_name *n;
  struct debug_typed_constant *tc;

  if (name == NULL || type == NULL)
    return FALSE;

  n = debug_add_to_current_namespace (info, name, DEBUG_OBJECT_TYPED_CONSTANT,
                                  DEBUG_LINKAGE_NONE);
  if (n == NULL)
    return FALSE;

  tc = (struct debug_typed_constant *) xmalloc (sizeof *tc);
  memset (tc, 0, sizeof *tc);

  tc->type = type;
  tc->val = val;

  n->u.typed_constant = tc;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_record_variable ( void *  handle,
const char *  name,
debug_type  type,
enum debug_var_kind  kind,
bfd_vma  val 
)

Definition at line 1122 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_namespace **nsp;
  enum debug_object_linkage linkage;
  struct debug_name *n;
  struct debug_variable *v;

  if (name == NULL || type == NULL)
    return FALSE;

  if (info->current_unit == NULL
      || info->current_file == NULL)
    {
      debug_error (_("debug_record_variable: no current file"));
      return FALSE;
    }

  if (kind == DEBUG_GLOBAL || kind == DEBUG_STATIC)
    {
      nsp = &info->current_file->globals;
      if (kind == DEBUG_GLOBAL)
       linkage = DEBUG_LINKAGE_GLOBAL;
      else
       linkage = DEBUG_LINKAGE_STATIC;
    }
  else
    {
      if (info->current_block == NULL)
       nsp = &info->current_file->globals;
      else
       nsp = &info->current_block->locals;
      linkage = DEBUG_LINKAGE_AUTOMATIC;
    }

  n = debug_add_to_namespace (info, nsp, name, DEBUG_OBJECT_VARIABLE, linkage);
  if (n == NULL)
    return FALSE;

  v = (struct debug_variable *) xmalloc (sizeof *v);
  memset (v, 0, sizeof *v);

  v->kind = kind;
  v->type = type;
  v->val = val;

  n->u.variable = v;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_set_class_id ( struct debug_handle info,
const char *  tag,
struct debug_type type 
) [static]

Definition at line 2938 of file debug.c.

{
  struct debug_class_type *c;
  struct debug_class_id *l;

  assert (type->kind == DEBUG_KIND_STRUCT
         || type->kind == DEBUG_KIND_UNION
         || type->kind == DEBUG_KIND_CLASS
         || type->kind == DEBUG_KIND_UNION_CLASS);

  c = type->u.kclass;

  if (c->id > info->base_id)
    return TRUE;

  for (l = info->id_list; l != NULL; l = l->next)
    {
      if (l->type->kind != type->kind)
       continue;

      if (tag == NULL)
       {
         if (l->tag != NULL)
           continue;
       }
      else
       {
         if (l->tag == NULL
             || l->tag[0] != tag[0]
             || strcmp (l->tag, tag) != 0)
           continue;
       }

      if (debug_type_samep (info, l->type, type))
       {
         c->id = l->type->u.kclass->id;
         return TRUE;
       }
    }

  /* There are no identical types.  Use a new ID, and add it to the
     list.  */
  ++info->class_id;
  c->id = info->class_id;

  l = (struct debug_class_id *) xmalloc (sizeof *l);
  memset (l, 0, sizeof *l);

  l->type = type;
  l->tag = tag;

  l->next = info->id_list;
  info->id_list = l;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_set_filename ( void *  handle,
const char *  name 
)

Definition at line 676 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_file *nfile;
  struct debug_unit *nunit;

  if (name == NULL)
    name = "";

  nfile = (struct debug_file *) xmalloc (sizeof *nfile);
  memset (nfile, 0, sizeof *nfile);

  nfile->filename = name;

  nunit = (struct debug_unit *) xmalloc (sizeof *nunit);
  memset (nunit, 0, sizeof *nunit);

  nunit->files = nfile;
  info->current_file = nfile;

  if (info->current_unit != NULL)
    info->current_unit->next = nunit;
  else
    {
      assert (info->units == NULL);
      info->units = nunit;
    }

  info->current_unit = nunit;

  info->current_function = NULL;
  info->current_block = NULL;
  info->current_lineno = NULL;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_start_block ( void *  handle,
bfd_vma  addr 
)

Definition at line 891 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_block *b, **pb;

  /* We must always have a current block: debug_record_function sets
     one up.  */
  if (info->current_unit == NULL
      || info->current_block == NULL)
    {
      debug_error (_("debug_start_block: no current block"));
      return FALSE;
    }

  b = (struct debug_block *) xmalloc (sizeof *b);
  memset (b, 0, sizeof *b);

  b->parent = info->current_block;
  b->start = addr;
  b->end = (bfd_vma) -1;

  /* This new block is a child of the current block.  */
  for (pb = &info->current_block->children;
       *pb != NULL;
       pb = &(*pb)->next)
    ;
  *pb = b;

  info->current_block = b;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_start_common_block ( void *handle  ATTRIBUTE_UNUSED,
const char *name  ATTRIBUTE_UNUSED 
)

Definition at line 1016 of file debug.c.

{
  /* FIXME */
  debug_error (_("debug_start_common_block: not implemented"));
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_start_source ( void *  handle,
const char *  name 
)

Definition at line 717 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_file *f, **pf;

  if (name == NULL)
    name = "";

  if (info->current_unit == NULL)
    {
      debug_error (_("debug_start_source: no debug_set_filename call"));
      return FALSE;
    }

  for (f = info->current_unit->files; f != NULL; f = f->next)
    {
      if (f->filename[0] == name[0]
         && f->filename[1] == name[1]
         && strcmp (f->filename, name) == 0)
       {
         info->current_file = f;
         return TRUE;
       }
    }

  f = (struct debug_file *) xmalloc (sizeof *f);
  memset (f, 0, sizeof *f);

  f->filename = name;

  for (pf = &info->current_file->next;
       *pf != NULL;
       pf = &(*pf)->next)
    ;
  *pf = f;

  info->current_file = f;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

debug_type debug_tag_type ( void *  handle,
const char *  name,
debug_type  type 
)

Definition at line 1875 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_type *t;
  struct debug_named_type *n;
  struct debug_name *nm;

  if (name == NULL || type == NULL)
    return DEBUG_TYPE_NULL;

  if (info->current_file == NULL)
    {
      debug_error (_("debug_tag_type: no current file"));
      return DEBUG_TYPE_NULL;
    }

  if (type->kind == DEBUG_KIND_TAGGED)
    {
      if (strcmp (type->u.knamed->name->name, name) == 0)
       return type;
      debug_error (_("debug_tag_type: extra tag attempted"));
      return DEBUG_TYPE_NULL;
    }

  t = debug_make_type (info, DEBUG_KIND_TAGGED, 0);
  if (t == NULL)
    return DEBUG_TYPE_NULL;

  n = (struct debug_named_type *) xmalloc (sizeof *n);
  memset (n, 0, sizeof *n);

  n->type = type;

  t->u.knamed = n;

  /* We keep a global namespace of tags for each compilation unit.  I
     don't know if that is the right thing to do.  */

  nm = debug_add_to_namespace (info, &info->current_file->globals, name,
                            DEBUG_OBJECT_TAG, DEBUG_LINKAGE_NONE);
  if (nm == NULL)
    return DEBUG_TYPE_NULL;

  nm->u.tag = t;

  n->name = nm;

  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_type_samep ( struct debug_handle info,
struct debug_type t1,
struct debug_type t2 
) [static]

Definition at line 3000 of file debug.c.

{
  struct debug_type_compare_list *l;
  struct debug_type_compare_list top;
  bfd_boolean ret;

  if (t1 == NULL)
    return t2 == NULL;
  if (t2 == NULL)
    return FALSE;

  while (t1->kind == DEBUG_KIND_INDIRECT)
    {
      t1 = *t1->u.kindirect->slot;
      if (t1 == NULL)
       return FALSE;
    }
  while (t2->kind == DEBUG_KIND_INDIRECT)
    {
      t2 = *t2->u.kindirect->slot;
      if (t2 == NULL)
       return FALSE;
    }

  if (t1 == t2)
    return TRUE;

  /* As a special case, permit a typedef to match a tag, since C++
     debugging output will sometimes add a typedef where C debugging
     output will not.  */
  if (t1->kind == DEBUG_KIND_NAMED
      && t2->kind == DEBUG_KIND_TAGGED)
    return debug_type_samep (info, t1->u.knamed->type, t2);
  else if (t1->kind == DEBUG_KIND_TAGGED
          && t2->kind == DEBUG_KIND_NAMED)
    return debug_type_samep (info, t1, t2->u.knamed->type);

  if (t1->kind != t2->kind
      || t1->size != t2->size)
    return FALSE;

  /* Get rid of the trivial cases first.  */
  switch (t1->kind)
    {
    default:
      break;
    case DEBUG_KIND_VOID:
    case DEBUG_KIND_FLOAT:
    case DEBUG_KIND_COMPLEX:
    case DEBUG_KIND_BOOL:
      return TRUE;
    case DEBUG_KIND_INT:
      return t1->u.kint == t2->u.kint;
    }

  /* We have to avoid an infinite recursion.  We do this by keeping a
     list of types which we are comparing.  We just keep the list on
     the stack.  If we encounter a pair of types we are currently
     comparing, we just assume that they are equal.  */
  for (l = info->compare_list; l != NULL; l = l->next)
    {
      if (l->t1 == t1 && l->t2 == t2)
       return TRUE;
    }

  top.t1 = t1;
  top.t2 = t2;
  top.next = info->compare_list;
  info->compare_list = &top;

  switch (t1->kind)
    {
    default:
      abort ();
      ret = FALSE;
      break;

    case DEBUG_KIND_STRUCT:
    case DEBUG_KIND_UNION:
    case DEBUG_KIND_CLASS:
    case DEBUG_KIND_UNION_CLASS:
      if (t1->u.kclass == NULL)
       ret = t2->u.kclass == NULL;
      else if (t2->u.kclass == NULL)
       ret = FALSE;
      else if (t1->u.kclass->id > info->base_id
              && t1->u.kclass->id == t2->u.kclass->id)
       ret = TRUE;
      else
       ret = debug_class_type_samep (info, t1, t2);
      break;

    case DEBUG_KIND_ENUM:
      if (t1->u.kenum == NULL)
       ret = t2->u.kenum == NULL;
      else if (t2->u.kenum == NULL)
       ret = FALSE;
      else
       {
         const char **pn1, **pn2;
         bfd_signed_vma *pv1, *pv2;

         pn1 = t1->u.kenum->names;
         pn2 = t2->u.kenum->names;
         pv1 = t1->u.kenum->values;
         pv2 = t2->u.kenum->values;
         while (*pn1 != NULL && *pn2 != NULL)
           {
             if (**pn1 != **pn2
                || *pv1 != *pv2
                || strcmp (*pn1, *pn2) != 0)
              break;
             ++pn1;
             ++pn2;
             ++pv1;
             ++pv2;
           }
         ret = *pn1 == NULL && *pn2 == NULL;
       }
      break;

    case DEBUG_KIND_POINTER:
      ret = debug_type_samep (info, t1->u.kpointer, t2->u.kpointer);
      break;

    case DEBUG_KIND_FUNCTION:
      if (t1->u.kfunction->varargs != t2->u.kfunction->varargs
         || ! debug_type_samep (info, t1->u.kfunction->return_type,
                             t2->u.kfunction->return_type)
         || ((t1->u.kfunction->arg_types == NULL)
             != (t2->u.kfunction->arg_types == NULL)))
       ret = FALSE;
      else if (t1->u.kfunction->arg_types == NULL)
       ret = TRUE;
      else
       {
         struct debug_type **a1, **a2;

         a1 = t1->u.kfunction->arg_types;
         a2 = t2->u.kfunction->arg_types;
         while (*a1 != NULL && *a2 != NULL)
           {
             if (! debug_type_samep (info, *a1, *a2))
              break;
             ++a1;
             ++a2;
           }
         ret = *a1 == NULL && *a2 == NULL;
       }
      break;

    case DEBUG_KIND_REFERENCE:
      ret = debug_type_samep (info, t1->u.kreference, t2->u.kreference);
      break;

    case DEBUG_KIND_RANGE:
      ret = (t1->u.krange->lower == t2->u.krange->lower
            && t1->u.krange->upper == t2->u.krange->upper
            && debug_type_samep (info, t1->u.krange->type,
                              t2->u.krange->type));

    case DEBUG_KIND_ARRAY:
      ret = (t1->u.karray->lower == t2->u.karray->lower
            && t1->u.karray->upper == t2->u.karray->upper
            && t1->u.karray->stringp == t2->u.karray->stringp
            && debug_type_samep (info, t1->u.karray->element_type,
                              t2->u.karray->element_type));
      break;

    case DEBUG_KIND_SET:
      ret = (t1->u.kset->bitstringp == t2->u.kset->bitstringp
            && debug_type_samep (info, t1->u.kset->type, t2->u.kset->type));
      break;

    case DEBUG_KIND_OFFSET:
      ret = (debug_type_samep (info, t1->u.koffset->base_type,
                            t2->u.koffset->base_type)
            && debug_type_samep (info, t1->u.koffset->target_type,
                              t2->u.koffset->target_type));
      break;

    case DEBUG_KIND_METHOD:
      if (t1->u.kmethod->varargs != t2->u.kmethod->varargs
         || ! debug_type_samep (info, t1->u.kmethod->return_type,
                             t2->u.kmethod->return_type)
         || ! debug_type_samep (info, t1->u.kmethod->domain_type,
                             t2->u.kmethod->domain_type)
         || ((t1->u.kmethod->arg_types == NULL)
             != (t2->u.kmethod->arg_types == NULL)))
       ret = FALSE;
      else if (t1->u.kmethod->arg_types == NULL)
       ret = TRUE;
      else
       {
         struct debug_type **a1, **a2;

         a1 = t1->u.kmethod->arg_types;
         a2 = t2->u.kmethod->arg_types;
         while (*a1 != NULL && *a2 != NULL)
           {
             if (! debug_type_samep (info, *a1, *a2))
              break;
             ++a1;
             ++a2;
           }
         ret = *a1 == NULL && *a2 == NULL;
       }
      break;

    case DEBUG_KIND_CONST:
      ret = debug_type_samep (info, t1->u.kconst, t2->u.kconst);
      break;

    case DEBUG_KIND_VOLATILE:
      ret = debug_type_samep (info, t1->u.kvolatile, t2->u.kvolatile);
      break;

    case DEBUG_KIND_NAMED:
    case DEBUG_KIND_TAGGED:
      ret = (strcmp (t1->u.knamed->name->name, t2->u.knamed->name->name) == 0
            && debug_type_samep (info, t1->u.knamed->type,
                              t2->u.knamed->type));
      break;
    }

  info->compare_list = top.next;

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bfd_boolean debug_write ( void *  handle,
const struct debug_write_fns fns,
void *  fhandle 
)

Definition at line 2310 of file debug.c.

{
  struct debug_handle *info = (struct debug_handle *) handle;
  struct debug_unit *u;

  /* We use a mark to tell whether we have already written out a
     particular name.  We use an integer, so that we don't have to
     clear the mark fields if we happen to write out the same
     information more than once.  */
  ++info->mark;

  /* The base_id field holds an ID value which will never be used, so
     that we can tell whether we have assigned an ID during this call
     to debug_write.  */
  info->base_id = info->class_id;

  /* We keep a linked list of classes for which was have assigned ID's
     during this call to debug_write.  */
  info->id_list = NULL;

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

      info->current_write_lineno = u->linenos;
      info->current_write_lineno_index = 0;

      if (! (*fns->start_compilation_unit) (fhandle, u->files->filename))
       return FALSE;

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

         if (first_file)
           first_file = FALSE;
         else if (! (*fns->start_source) (fhandle, f->filename))
           return FALSE;

         if (f->globals != NULL)
           for (n = f->globals->list; n != NULL; n = n->next)
             if (! debug_write_name (info, fns, fhandle, n))
              return FALSE;
       }

      /* Output any line number information which hasn't already been
         handled.  */
      if (! debug_write_linenos (info, fns, fhandle, (bfd_vma) -1))
       return FALSE;
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_write_block ( struct debug_handle info,
const struct debug_write_fns fns,
void *  fhandle,
struct debug_block block 
) [static]

Definition at line 2850 of file debug.c.

{
  struct debug_name *n;
  struct debug_block *b;

  if (! debug_write_linenos (info, fns, fhandle, block->start))
    return FALSE;

  /* I can't see any point to writing out a block with no local
     variables, so we don't bother, except for the top level block.  */
  if (block->locals != NULL || block->parent == NULL)
    {
      if (! (*fns->start_block) (fhandle, block->start))
       return FALSE;
    }

  if (block->locals != NULL)
    {
      for (n = block->locals->list; n != NULL; n = n->next)
       {
         if (! debug_write_name (info, fns, fhandle, n))
           return FALSE;
       }
    }

  for (b = block->children; b != NULL; b = b->next)
    {
      if (! debug_write_block (info, fns, fhandle, b))
       return FALSE;
    }

  if (! debug_write_linenos (info, fns, fhandle, block->end))
    return FALSE;

  if (block->locals != NULL || block->parent == NULL)
    {
      if (! (*fns->end_block) (fhandle, block->end))
       return FALSE;
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_write_class_type ( struct debug_handle info,
const struct debug_write_fns fns,
void *  fhandle,
struct debug_type type,
const char *  tag 
) [static]

Definition at line 2662 of file debug.c.

{
  unsigned int i;
  unsigned int id;
  struct debug_type *vptrbase;

  if (type->u.kclass == NULL)
    {
      id = 0;
      vptrbase = NULL;
    }
  else
    {
      if (type->u.kclass->id <= info->base_id)
       {
         if (! debug_set_class_id (info, tag, type))
           return FALSE;
       }

      if (info->mark == type->u.kclass->mark)
       {
         /* We are currently outputting this class, or we have
            already output it.  This can happen when there are
            methods for an anonymous class.  */
         assert (type->u.kclass->id > info->base_id);
         return (*fns->tag_type) (fhandle, tag, type->u.kclass->id,
                               type->kind);
       }
      type->u.kclass->mark = info->mark;
      id = type->u.kclass->id;

      vptrbase = type->u.kclass->vptrbase;
      if (vptrbase != NULL && vptrbase != type)
       {
         if (! debug_write_type (info, fns, fhandle, vptrbase,
                              (struct debug_name *) NULL))
           return FALSE;
       }
    }

  if (! (*fns->start_class_type) (fhandle, tag, id,
                              type->kind == DEBUG_KIND_CLASS,
                              type->size,
                              vptrbase != NULL,
                              vptrbase == type))
    return FALSE;

  if (type->u.kclass != NULL)
    {
      if (type->u.kclass->fields != NULL)
       {
         for (i = 0; type->u.kclass->fields[i] != NULL; i++)
           {
             struct debug_field *f;

             f = type->u.kclass->fields[i];
             if (! debug_write_type (info, fns, fhandle, f->type,
                                  (struct debug_name *) NULL))
              return FALSE;
             if (f->static_member)
              {
                if (! (*fns->class_static_member) (fhandle, f->name,
                                               f->u.s.physname,
                                               f->visibility))
                  return FALSE;
              }
             else
              {
                if (! (*fns->struct_field) (fhandle, f->name, f->u.f.bitpos,
                                         f->u.f.bitsize, f->visibility))
                  return FALSE;
              }
           }
       }

      if (type->u.kclass->baseclasses != NULL)
       {
         for (i = 0; type->u.kclass->baseclasses[i] != NULL; i++)
           {
             struct debug_baseclass *b;

             b = type->u.kclass->baseclasses[i];
             if (! debug_write_type (info, fns, fhandle, b->type,
                                  (struct debug_name *) NULL))
              return FALSE;
             if (! (*fns->class_baseclass) (fhandle, b->bitpos, b->virtual,
                                        b->visibility))
              return FALSE;
           }
       }

      if (type->u.kclass->methods != NULL)
       {
         for (i = 0; type->u.kclass->methods[i] != NULL; i++)
           {
             struct debug_method *m;
             unsigned int j;

             m = type->u.kclass->methods[i];
             if (! (*fns->class_start_method) (fhandle, m->name))
              return FALSE;
             for (j = 0; m->variants[j] != NULL; j++)
              {
                struct debug_method_variant *v;

                v = m->variants[j];
                if (v->context != NULL)
                  {
                    if (! debug_write_type (info, fns, fhandle, v->context,
                                         (struct debug_name *) NULL))
                     return FALSE;
                  }
                if (! debug_write_type (info, fns, fhandle, v->type,
                                     (struct debug_name *) NULL))
                  return FALSE;
                if (v->voffset != VOFFSET_STATIC_METHOD)
                  {
                    if (! (*fns->class_method_variant) (fhandle, v->physname,
                                                   v->visibility,
                                                   v->constp,
                                                   v->volatilep,
                                                   v->voffset,
                                                   v->context != NULL))
                     return FALSE;
                  }
                else
                  {
                    if (! (*fns->class_static_method_variant) (fhandle,
                                                         v->physname,
                                                         v->visibility,
                                                         v->constp,
                                                         v->volatilep))
                     return FALSE;
                  }
              }
             if (! (*fns->class_end_method) (fhandle))
              return FALSE;
           }
       }
    }

  return (*fns->end_class_type) (fhandle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_write_function ( struct debug_handle info,
const struct debug_write_fns fns,
void *  fhandle,
const char *  name,
enum debug_object_linkage  linkage,
struct debug_function function 
) [static]

Definition at line 2811 of file debug.c.

{
  struct debug_parameter *p;
  struct debug_block *b;

  if (! debug_write_linenos (info, fns, fhandle, function->blocks->start))
    return FALSE;

  if (! debug_write_type (info, fns, fhandle, function->return_type,
                       (struct debug_name *) NULL))
    return FALSE;

  if (! (*fns->start_function) (fhandle, name,
                            linkage == DEBUG_LINKAGE_GLOBAL))
    return FALSE;

  for (p = function->parameters; p != NULL; p = p->next)
    {
      if (! debug_write_type (info, fns, fhandle, p->type,
                           (struct debug_name *) NULL)
         || ! (*fns->function_parameter) (fhandle, p->name, p->kind, p->val))
       return FALSE;
    }

  for (b = function->blocks; b != NULL; b = b->next)
    {
      if (! debug_write_block (info, fns, fhandle, b))
       return FALSE;
    }

  return (*fns->end_function) (fhandle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_write_linenos ( struct debug_handle info,
const struct debug_write_fns fns,
void *  fhandle,
bfd_vma  address 
) [static]

Definition at line 2898 of file debug.c.

{
  while (info->current_write_lineno != NULL)
    {
      struct debug_lineno *l;

      l = info->current_write_lineno;

      while (info->current_write_lineno_index < DEBUG_LINENO_COUNT)
       {
         if (l->linenos[info->current_write_lineno_index]
             == (unsigned long) -1)
           break;

         if (l->addrs[info->current_write_lineno_index] >= address)
           return TRUE;

         if (! (*fns->lineno) (fhandle, l->file->filename,
                            l->linenos[info->current_write_lineno_index],
                            l->addrs[info->current_write_lineno_index]))
           return FALSE;

         ++info->current_write_lineno_index;
       }

      info->current_write_lineno = l->next;
      info->current_write_lineno_index = 0;
    }

  return TRUE;
}

Here is the caller graph for this function:

static bfd_boolean debug_write_name ( struct debug_handle info,
const struct debug_write_fns fns,
void *  fhandle,
struct debug_name n 
) [static]

Definition at line 2369 of file debug.c.

{
  switch (n->kind)
    {
    case DEBUG_OBJECT_TYPE:
      if (! debug_write_type (info, fns, fhandle, n->u.type, n)
         || ! (*fns->typdef) (fhandle, n->name))
       return FALSE;
      return TRUE;
    case DEBUG_OBJECT_TAG:
      if (! debug_write_type (info, fns, fhandle, n->u.tag, n))
       return FALSE;
      return (*fns->tag) (fhandle, n->name);
    case DEBUG_OBJECT_VARIABLE:
      if (! debug_write_type (info, fns, fhandle, n->u.variable->type,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->variable) (fhandle, n->name, n->u.variable->kind,
                            n->u.variable->val);
    case DEBUG_OBJECT_FUNCTION:
      return debug_write_function (info, fns, fhandle, n->name,
                               n->linkage, n->u.function);
    case DEBUG_OBJECT_INT_CONSTANT:
      return (*fns->int_constant) (fhandle, n->name, n->u.int_constant);
    case DEBUG_OBJECT_FLOAT_CONSTANT:
      return (*fns->float_constant) (fhandle, n->name, n->u.float_constant);
    case DEBUG_OBJECT_TYPED_CONSTANT:
      if (! debug_write_type (info, fns, fhandle, n->u.typed_constant->type,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->typed_constant) (fhandle, n->name,
                                 n->u.typed_constant->val);
    default:
      abort ();
      return FALSE;
    }
  /*NOTREACHED*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean debug_write_type ( struct debug_handle info,
const struct debug_write_fns fns,
void *  fhandle,
struct debug_type type,
struct debug_name name 
) [static]

Definition at line 2417 of file debug.c.

{
  unsigned int i;
  int is;
  const char *tag = NULL;

  /* If we have a name for this type, just output it.  We only output
     typedef names after they have been defined.  We output type tags
     whenever we are not actually defining them.  */
  if ((type->kind == DEBUG_KIND_NAMED
       || type->kind == DEBUG_KIND_TAGGED)
      && (type->u.knamed->name->mark == info->mark
         || (type->kind == DEBUG_KIND_TAGGED
             && type->u.knamed->name != name)))
    {
      if (type->kind == DEBUG_KIND_NAMED)
       return (*fns->typedef_type) (fhandle, type->u.knamed->name->name);
      else
       {
         struct debug_type *real;
         unsigned int id;

         real = debug_get_real_type ((void *) info, type, NULL);
         if (real == NULL)
           return (*fns->empty_type) (fhandle);
         id = 0;
         if ((real->kind == DEBUG_KIND_STRUCT
              || real->kind == DEBUG_KIND_UNION
              || real->kind == DEBUG_KIND_CLASS
              || real->kind == DEBUG_KIND_UNION_CLASS)
             && real->u.kclass != NULL)
           {
             if (real->u.kclass->id <= info->base_id)
              {
                if (! debug_set_class_id (info,
                                       type->u.knamed->name->name,
                                       real))
                  return FALSE;
              }
             id = real->u.kclass->id;
           }

         return (*fns->tag_type) (fhandle, type->u.knamed->name->name, id,
                               real->kind);
       }
    }

  /* Mark the name after we have already looked for a known name, so
     that we don't just define a type in terms of itself.  We need to
     mark the name here so that a struct containing a pointer to
     itself will work.  */
  if (name != NULL)
    name->mark = info->mark;

  if (name != NULL
      && type->kind != DEBUG_KIND_NAMED
      && type->kind != DEBUG_KIND_TAGGED)
    {
      assert (name->kind == DEBUG_OBJECT_TAG);
      tag = name->name;
    }

  switch (type->kind)
    {
    case DEBUG_KIND_ILLEGAL:
      debug_error (_("debug_write_type: illegal type encountered"));
      return FALSE;
    case DEBUG_KIND_INDIRECT:
      if (*type->u.kindirect->slot == DEBUG_TYPE_NULL)
       return (*fns->empty_type) (fhandle);
      return debug_write_type (info, fns, fhandle, *type->u.kindirect->slot,
                            name);
    case DEBUG_KIND_VOID:
      return (*fns->void_type) (fhandle);
    case DEBUG_KIND_INT:
      return (*fns->int_type) (fhandle, type->size, type->u.kint);
    case DEBUG_KIND_FLOAT:
      return (*fns->float_type) (fhandle, type->size);
    case DEBUG_KIND_COMPLEX:
      return (*fns->complex_type) (fhandle, type->size);
    case DEBUG_KIND_BOOL:
      return (*fns->bool_type) (fhandle, type->size);
    case DEBUG_KIND_STRUCT:
    case DEBUG_KIND_UNION:
      if (type->u.kclass != NULL)
       {
         if (type->u.kclass->id <= info->base_id)
           {
             if (! debug_set_class_id (info, tag, type))
              return FALSE;
           }

         if (info->mark == type->u.kclass->mark)
           {
             /* We are currently outputting this struct, or we have
               already output it.  I don't know if this can happen,
               but it can happen for a class.  */
             assert (type->u.kclass->id > info->base_id);
             return (*fns->tag_type) (fhandle, tag, type->u.kclass->id,
                                   type->kind);
           }
         type->u.kclass->mark = info->mark;
       }

      if (! (*fns->start_struct_type) (fhandle, tag,
                                   (type->u.kclass != NULL
                                   ? type->u.kclass->id
                                   : 0),
                                   type->kind == DEBUG_KIND_STRUCT,
                                   type->size))
       return FALSE;
      if (type->u.kclass != NULL
         && type->u.kclass->fields != NULL)
       {
         for (i = 0; type->u.kclass->fields[i] != NULL; i++)
           {
             struct debug_field *f;

             f = type->u.kclass->fields[i];
             if (! debug_write_type (info, fns, fhandle, f->type,
                                  (struct debug_name *) NULL)
                || ! (*fns->struct_field) (fhandle, f->name, f->u.f.bitpos,
                                        f->u.f.bitsize, f->visibility))
              return FALSE;
           }
       }
      return (*fns->end_struct_type) (fhandle);
    case DEBUG_KIND_CLASS:
    case DEBUG_KIND_UNION_CLASS:
      return debug_write_class_type (info, fns, fhandle, type, tag);
    case DEBUG_KIND_ENUM:
      if (type->u.kenum == NULL)
       return (*fns->enum_type) (fhandle, tag, (const char **) NULL,
                              (bfd_signed_vma *) NULL);
      return (*fns->enum_type) (fhandle, tag, type->u.kenum->names,
                            type->u.kenum->values);
    case DEBUG_KIND_POINTER:
      if (! debug_write_type (info, fns, fhandle, type->u.kpointer,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->pointer_type) (fhandle);
    case DEBUG_KIND_FUNCTION:
      if (! debug_write_type (info, fns, fhandle,
                           type->u.kfunction->return_type,
                           (struct debug_name *) NULL))
       return FALSE;
      if (type->u.kfunction->arg_types == NULL)
       is = -1;
      else
       {
         for (is = 0; type->u.kfunction->arg_types[is] != NULL; is++)
           if (! debug_write_type (info, fns, fhandle,
                                type->u.kfunction->arg_types[is],
                                (struct debug_name *) NULL))
             return FALSE;
       }
      return (*fns->function_type) (fhandle, is,
                                type->u.kfunction->varargs);
    case DEBUG_KIND_REFERENCE:
      if (! debug_write_type (info, fns, fhandle, type->u.kreference,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->reference_type) (fhandle);
    case DEBUG_KIND_RANGE:
      if (! debug_write_type (info, fns, fhandle, type->u.krange->type,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->range_type) (fhandle, type->u.krange->lower,
                             type->u.krange->upper);
    case DEBUG_KIND_ARRAY:
      if (! debug_write_type (info, fns, fhandle, type->u.karray->element_type,
                           (struct debug_name *) NULL)
         || ! debug_write_type (info, fns, fhandle,
                             type->u.karray->range_type,
                             (struct debug_name *) NULL))
       return FALSE;
      return (*fns->array_type) (fhandle, type->u.karray->lower,
                             type->u.karray->upper,
                             type->u.karray->stringp);
    case DEBUG_KIND_SET:
      if (! debug_write_type (info, fns, fhandle, type->u.kset->type,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->set_type) (fhandle, type->u.kset->bitstringp);
    case DEBUG_KIND_OFFSET:
      if (! debug_write_type (info, fns, fhandle, type->u.koffset->base_type,
                           (struct debug_name *) NULL)
         || ! debug_write_type (info, fns, fhandle,
                             type->u.koffset->target_type,
                             (struct debug_name *) NULL))
       return FALSE;
      return (*fns->offset_type) (fhandle);
    case DEBUG_KIND_METHOD:
      if (! debug_write_type (info, fns, fhandle,
                           type->u.kmethod->return_type,
                           (struct debug_name *) NULL))
       return FALSE;
      if (type->u.kmethod->arg_types == NULL)
       is = -1;
      else
       {
         for (is = 0; type->u.kmethod->arg_types[is] != NULL; is++)
           if (! debug_write_type (info, fns, fhandle,
                                type->u.kmethod->arg_types[is],
                                (struct debug_name *) NULL))
             return FALSE;
       }
      if (type->u.kmethod->domain_type != NULL)
       {
         if (! debug_write_type (info, fns, fhandle,
                              type->u.kmethod->domain_type,
                              (struct debug_name *) NULL))
           return FALSE;
       }
      return (*fns->method_type) (fhandle,
                              type->u.kmethod->domain_type != NULL,
                              is,
                              type->u.kmethod->varargs);
    case DEBUG_KIND_CONST:
      if (! debug_write_type (info, fns, fhandle, type->u.kconst,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->const_type) (fhandle);
    case DEBUG_KIND_VOLATILE:
      if (! debug_write_type (info, fns, fhandle, type->u.kvolatile,
                           (struct debug_name *) NULL))
       return FALSE;
      return (*fns->volatile_type) (fhandle);
    case DEBUG_KIND_NAMED:
      return debug_write_type (info, fns, fhandle, type->u.knamed->type,
                            (struct debug_name *) NULL);
    case DEBUG_KIND_TAGGED:
      return debug_write_type (info, fns, fhandle, type->u.knamed->type,
                            type->u.knamed->name);
    default:
      abort ();
      return FALSE;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: