/* debug.c -- Handle generic debugging information.
- Copyright 1995, 1996, 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
/* This file implements a generic debugging format. We may eventually
have readers which convert different formats into this generic
format, and writers which write it out. The initial impetus for
- this was writing a convertor from stabs to HP IEEE-695 debugging
+ this was writing a converter from stabs to HP IEEE-695 debugging
format. */
-#include <stdio.h>
+#include "sysdep.h"
#include <assert.h>
-
#include "bfd.h"
-#include "bucomm.h"
#include "libiberty.h"
+#include "filenames.h"
#include "debug.h"
/* Global information we keep for debugging. A pointer to this
/* A type. */
-struct debug_type
+struct debug_type_s
{
/* Kind of type. */
enum debug_type_kind kind;
/* DEBUG_KIND_ENUM. */
struct debug_enum_type *kenum;
/* DEBUG_KIND_POINTER. */
- struct debug_type *kpointer;
+ struct debug_type_s *kpointer;
/* DEBUG_KIND_FUNCTION. */
struct debug_function_type *kfunction;
/* DEBUG_KIND_REFERENCE. */
- struct debug_type *kreference;
+ struct debug_type_s *kreference;
/* DEBUG_KIND_RANGE. */
struct debug_range_type *krange;
/* DEBUG_KIND_ARRAY. */
/* DEBUG_KIND_METHOD. */
struct debug_method_type *kmethod;
/* DEBUG_KIND_CONST. */
- struct debug_type *kconst;
+ struct debug_type_s *kconst;
/* DEBUG_KIND_VOLATILE. */
- struct debug_type *kvolatile;
+ struct debug_type_s *kvolatile;
/* DEBUG_KIND_NAMED, DEBUG_KIND_TAGGED. */
struct debug_named_type *knamed;
} u;
/* A field in a struct or union. */
-struct debug_field
+struct debug_field_s
{
/* Name of the field. */
const char *name;
/* Type of the field. */
- struct debug_type *type;
+ struct debug_type_s *type;
/* Visibility of the field. */
enum debug_visibility visibility;
/* Whether this is a static member. */
/* A base class for an object. */
-struct debug_baseclass
+struct debug_baseclass_s
{
/* Type of the base class. */
- struct debug_type *type;
+ struct debug_type_s *type;
/* Bit position of the base class in the object. */
unsigned int bitpos;
/* Whether the base class is virtual. */
- bfd_boolean virtual;
+ bfd_boolean is_virtual;
/* Visibility of the base class. */
enum debug_visibility visibility;
};
/* A method of an object. */
-struct debug_method
+struct debug_method_s
{
/* The name of the method. */
const char *name;
/* A NULL terminated array of different types of variants. */
- struct debug_method_variant **variants;
+ struct debug_method_variant_s **variants;
};
/* The variants of a method function of an object. These indicate
which method to run. */
-struct debug_method_variant
+struct debug_method_variant_s
{
/* The physical name of the function. */
const char *physname;
/* The type of the function. */
- struct debug_type *type;
+ struct debug_type_s *type;
/* The visibility of the function. */
enum debug_visibility visibility;
/* Whether the function is const. */
/* If voffset is VOFFSET_STATIC_METHOD, this is a static method. */
#define VOFFSET_STATIC_METHOD ((bfd_vma) -1)
/* Context of a virtual method function. */
- struct debug_type *context;
+ struct debug_type_s *context;
};
/* A variable. This is the information we keep for a variable object.
union
{
/* DEBUG_OBJECT_TYPE. */
- struct debug_type *type;
+ struct debug_type_s *type;
/* DEBUG_OBJECT_TAG. */
- struct debug_type *tag;
+ struct debug_type_s *tag;
/* DEBUG_OBJECT_VARIABLE. */
struct debug_variable *variable;
/* DEBUG_OBJECT_FUNCTION. */
/* Next ID number. */
struct debug_class_id *next;
/* The type with the ID. */
- struct debug_type *type;
+ struct debug_type_s *type;
/* The tag; NULL if no tag. */
const char *tag;
};
/* Next type on list. */
struct debug_type_compare_list *next;
/* The types we are comparing. */
- struct debug_type *t1;
- struct debug_type *t2;
+ struct debug_type_s *t1;
+ struct debug_type_s *t2;
};
/* During debug_get_real_type, a linked list of these structures is
/* Next type on list. */
struct debug_type_real_list *next;
/* The type we are checking. */
- struct debug_type *t;
+ struct debug_type_s *t;
};
/* Local functions. */
-static void debug_error
- PARAMS ((const char *));
+static void debug_error (const char *);
static struct debug_name *debug_add_to_namespace
- PARAMS ((struct debug_handle *, struct debug_namespace **, const char *,
- enum debug_object_kind, enum debug_object_linkage));
+ (struct debug_handle *, struct debug_namespace **, const char *,
+ enum debug_object_kind, enum debug_object_linkage);
static struct debug_name *debug_add_to_current_namespace
- PARAMS ((struct debug_handle *, const char *, enum debug_object_kind,
- enum debug_object_linkage));
-static struct debug_type *debug_make_type
- PARAMS ((struct debug_handle *, enum debug_type_kind, unsigned int));
-static struct debug_type *debug_get_real_type
- PARAMS ((PTR, debug_type, struct debug_type_real_list *));
+ (struct debug_handle *, const char *, enum debug_object_kind,
+ enum debug_object_linkage);
+static struct debug_type_s *debug_make_type
+ (struct debug_handle *, enum debug_type_kind, unsigned int);
+static struct debug_type_s *debug_get_real_type
+ (void *, debug_type, struct debug_type_real_list *);
static bfd_boolean debug_write_name
- PARAMS ((struct debug_handle *, const struct debug_write_fns *, PTR,
- struct debug_name *));
+ (struct debug_handle *, const struct debug_write_fns *, void *,
+ struct debug_name *);
static bfd_boolean debug_write_type
- PARAMS ((struct debug_handle *, const struct debug_write_fns *, PTR,
- struct debug_type *, struct debug_name *));
+ (struct debug_handle *, const struct debug_write_fns *, void *,
+ struct debug_type_s *, struct debug_name *);
static bfd_boolean debug_write_class_type
- PARAMS ((struct debug_handle *, const struct debug_write_fns *, PTR,
- struct debug_type *, const char *));
+ (struct debug_handle *, const struct debug_write_fns *, void *,
+ struct debug_type_s *, const char *);
static bfd_boolean debug_write_function
- PARAMS ((struct debug_handle *, const struct debug_write_fns *, PTR,
- const char *, enum debug_object_linkage, struct debug_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
- PARAMS ((struct debug_handle *, const struct debug_write_fns *, PTR,
- struct debug_block *));
+ (struct debug_handle *, const struct debug_write_fns *, void *,
+ struct debug_block *);
static bfd_boolean debug_write_linenos
- PARAMS ((struct debug_handle *, const struct debug_write_fns *, PTR,
- bfd_vma));
+ (struct debug_handle *, const struct debug_write_fns *, void *, bfd_vma);
static bfd_boolean debug_set_class_id
- PARAMS ((struct debug_handle *, const char *, struct debug_type *));
+ (struct debug_handle *, const char *, struct debug_type_s *);
static bfd_boolean debug_type_samep
- PARAMS ((struct debug_handle *, struct debug_type *, struct debug_type *));
+ (struct debug_handle *, struct debug_type_s *, struct debug_type_s *);
static bfd_boolean debug_class_type_samep
- PARAMS ((struct debug_handle *, struct debug_type *, struct debug_type *));
+ (struct debug_handle *, struct debug_type_s *, struct debug_type_s *);
\f
/* Issue an error message. */
static void
-debug_error (message)
- const char *message;
+debug_error (const char *message)
{
fprintf (stderr, "%s\n", message);
}
/* Add an object to a namespace. */
static struct debug_name *
-debug_add_to_namespace (info, nsp, name, kind, linkage)
- struct debug_handle *info ATTRIBUTE_UNUSED;
- struct debug_namespace **nsp;
- const char *name;
- enum debug_object_kind kind;
- enum debug_object_linkage linkage;
+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)
{
struct debug_name *n;
struct debug_namespace *ns;
/* Add an object to the current namespace. */
static struct debug_name *
-debug_add_to_current_namespace (info, name, kind, linkage)
- struct debug_handle *info;
- const char *name;
- enum debug_object_kind kind;
- enum debug_object_linkage linkage;
+debug_add_to_current_namespace (struct debug_handle *info, const char *name,
+ enum debug_object_kind kind,
+ enum debug_object_linkage linkage)
{
struct debug_namespace **nsp;
\f
/* Return a handle for debugging information. */
-PTR
-debug_init ()
+void *
+debug_init (void)
{
struct debug_handle *ret;
ret = (struct debug_handle *) xmalloc (sizeof *ret);
memset (ret, 0, sizeof *ret);
- return (PTR) ret;
+ return (void *) ret;
}
/* Set the source filename. This implicitly starts a new compilation
unit. */
bfd_boolean
-debug_set_filename (handle, name)
- PTR handle;
- const char *name;
+debug_set_filename (void *handle, const char *name)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_file *nfile;
include files in a single compilation unit. */
bfd_boolean
-debug_start_source (handle, name)
- PTR handle;
- const char *name;
+debug_start_source (void *handle, const char *name)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_file *f, **pf;
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)
+ if (filename_cmp (f->filename, name) == 0)
{
info->current_file = f;
return TRUE;
functions. */
bfd_boolean
-debug_record_function (handle, name, return_type, global, addr)
- PTR handle;
- const char *name;
- debug_type return_type;
- bfd_boolean global;
- bfd_vma addr;
+debug_record_function (void *handle, const char *name,
+ debug_type return_type, bfd_boolean global,
+ bfd_vma addr)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_function *f;
/* Record a parameter for the current function. */
bfd_boolean
-debug_record_parameter (handle, name, type, kind, val)
- PTR handle;
- const char *name;
- debug_type type;
- enum debug_parm_kind kind;
- bfd_vma val;
+debug_record_parameter (void *handle, const char *name, debug_type type,
+ enum debug_parm_kind kind, bfd_vma val)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_parameter *p, **pp;
/* End a function. FIXME: This should handle function nesting. */
bfd_boolean
-debug_end_function (handle, addr)
- PTR handle;
- bfd_vma addr;
+debug_end_function (void *handle, bfd_vma addr)
{
struct debug_handle *info = (struct debug_handle *) handle;
argument is the address at which this block starts. */
bfd_boolean
-debug_start_block (handle, addr)
- PTR handle;
- bfd_vma addr;
+debug_start_block (void *handle, bfd_vma addr)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_block *b, **pb;
ends. */
bfd_boolean
-debug_end_block (handle, addr)
- PTR handle;
- bfd_vma addr;
+debug_end_block (void *handle, bfd_vma addr)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_block *parent;
with a given address. */
bfd_boolean
-debug_record_line (handle, lineno, addr)
- PTR handle;
- unsigned long lineno;
- bfd_vma addr;
+debug_record_line (void *handle, unsigned long lineno, bfd_vma addr)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_lineno *l;
move in memory. */
bfd_boolean
-debug_start_common_block (handle, name)
- PTR handle ATTRIBUTE_UNUSED;
- const char *name ATTRIBUTE_UNUSED;
+debug_start_common_block (void *handle ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED)
{
/* FIXME */
debug_error (_("debug_start_common_block: not implemented"));
/* End a named common block. */
bfd_boolean
-debug_end_common_block (handle, name)
- PTR handle ATTRIBUTE_UNUSED;
- const char *name ATTRIBUTE_UNUSED;
+debug_end_common_block (void *handle ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED)
{
/* FIXME */
debug_error (_("debug_end_common_block: not implemented"));
/* Record a named integer constant. */
bfd_boolean
-debug_record_int_const (handle, name, val)
- PTR handle;
- const char *name;
- bfd_vma val;
+debug_record_int_const (void *handle, const char *name, bfd_vma val)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_name *n;
/* Record a named floating point constant. */
bfd_boolean
-debug_record_float_const (handle, name, val)
- PTR handle;
- const char *name;
- double val;
+debug_record_float_const (void *handle, const char *name, double val)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_name *n;
/* Record a typed constant with an integral value. */
bfd_boolean
-debug_record_typed_const (handle, name, type, val)
- PTR handle;
- const char *name;
- debug_type type;
- bfd_vma val;
+debug_record_typed_const (void *handle, const char *name, debug_type type,
+ bfd_vma val)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_name *n;
/* Record a label. */
bfd_boolean
-debug_record_label (handle, name, type, addr)
- PTR handle ATTRIBUTE_UNUSED;
- const char *name ATTRIBUTE_UNUSED;
- debug_type type ATTRIBUTE_UNUSED;
- bfd_vma addr ATTRIBUTE_UNUSED;
+debug_record_label (void *handle ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ debug_type type ATTRIBUTE_UNUSED,
+ bfd_vma addr ATTRIBUTE_UNUSED)
{
/* FIXME. */
debug_error (_("debug_record_label: not implemented"));
/* Record a variable. */
bfd_boolean
-debug_record_variable (handle, name, type, kind, val)
- PTR handle;
- const char *name;
- debug_type type;
- enum debug_var_kind kind;
- bfd_vma val;
+debug_record_variable (void *handle, const char *name, debug_type type,
+ enum debug_var_kind kind, bfd_vma val)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_namespace **nsp;
/* Make a type with a given kind and size. */
-static struct debug_type *
-debug_make_type (info, kind, size)
- struct debug_handle *info ATTRIBUTE_UNUSED;
- enum debug_type_kind kind;
- unsigned int size;
+static struct debug_type_s *
+debug_make_type (struct debug_handle *info ATTRIBUTE_UNUSED,
+ enum debug_type_kind kind, unsigned int size)
{
- struct debug_type *t;
+ struct debug_type_s *t;
- t = (struct debug_type *) xmalloc (sizeof *t);
+ t = (struct debug_type_s *) xmalloc (sizeof *t);
memset (t, 0, sizeof *t);
t->kind = kind;
which is referenced before it is defined. */
debug_type
-debug_make_indirect_type (handle, slot, tag)
- PTR handle;
- debug_type *slot;
- const char *tag;
+debug_make_indirect_type (void *handle, debug_type *slot, const char *tag)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_indirect_type *i;
t = debug_make_type (info, DEBUG_KIND_INDIRECT, 0);
/* Make a void type. There is only one of these. */
debug_type
-debug_make_void_type (handle)
- PTR handle;
+debug_make_void_type (void *handle)
{
struct debug_handle *info = (struct debug_handle *) handle;
if the integer is unsigned. */
debug_type
-debug_make_int_type (handle, size, unsignedp)
- PTR handle;
- unsigned int size;
- bfd_boolean unsignedp;
+debug_make_int_type (void *handle, unsigned int size, bfd_boolean unsignedp)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
t = debug_make_type (info, DEBUG_KIND_INT, size);
if (t == NULL)
the format. */
debug_type
-debug_make_float_type (handle, size)
- PTR handle;
- unsigned int size;
+debug_make_float_type (void *handle, unsigned int size)
{
struct debug_handle *info = (struct debug_handle *) handle;
/* Make a boolean type of a given size. */
debug_type
-debug_make_bool_type (handle, size)
- PTR handle;
- unsigned int size;
+debug_make_bool_type (void *handle, unsigned int size)
{
struct debug_handle *info = (struct debug_handle *) handle;
/* Make a complex type of a given size. */
debug_type
-debug_make_complex_type (handle, size)
- PTR handle;
- unsigned int size;
+debug_make_complex_type (void *handle, unsigned int size)
{
struct debug_handle *info = (struct debug_handle *) handle;
The fourth argument is a NULL terminated array of fields. */
debug_type
-debug_make_struct_type (handle, structp, size, fields)
- PTR handle;
- bfd_boolean structp;
- bfd_vma size;
- debug_field *fields;
+debug_make_struct_type (void *handle, bfd_boolean structp, bfd_vma size,
+ debug_field *fields)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_class_type *c;
t = debug_make_type (info,
object has its own virtual function table. */
debug_type
-debug_make_object_type (handle, structp, size, fields, baseclasses,
- methods, vptrbase, ownvptr)
- PTR handle;
- bfd_boolean structp;
- bfd_vma size;
- debug_field *fields;
- debug_baseclass *baseclasses;
- debug_method *methods;
- debug_type vptrbase;
- bfd_boolean ownvptr;
+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)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_class_type *c;
t = debug_make_type (info,
array of strings, and an array of corresponding values. */
debug_type
-debug_make_enum_type (handle, names, values)
- PTR handle;
- const char **names;
- bfd_signed_vma *values;
+debug_make_enum_type (void *handle, const char **names,
+ bfd_signed_vma *values)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_enum_type *e;
t = debug_make_type (info, DEBUG_KIND_ENUM, 0);
/* Make a pointer to a given type. */
debug_type
-debug_make_pointer_type (handle, type)
- PTR handle;
- debug_type type;
+debug_make_pointer_type (void *handle, debug_type type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
if (type == NULL)
return DEBUG_TYPE_NULL;
to record the parameter types. */
debug_type
-debug_make_function_type (handle, type, arg_types, varargs)
- PTR handle;
- debug_type type;
- debug_type *arg_types;
- bfd_boolean varargs;
+debug_make_function_type (void *handle, debug_type type,
+ debug_type *arg_types, bfd_boolean varargs)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_function_type *f;
if (type == NULL)
/* Make a reference to a given type. */
debug_type
-debug_make_reference_type (handle, type)
- PTR handle;
- debug_type type;
+debug_make_reference_type (void *handle, debug_type type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
if (type == NULL)
return DEBUG_TYPE_NULL;
/* Make a range of a given type from a lower to an upper bound. */
debug_type
-debug_make_range_type (handle, type, lower, upper)
- PTR handle;
- debug_type type;
- bfd_signed_vma lower;
- bfd_signed_vma upper;
+debug_make_range_type (void *handle, debug_type type, bfd_signed_vma lower,
+ bfd_signed_vma upper)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_range_type *r;
if (type == NULL)
actually a string, as in C. */
debug_type
-debug_make_array_type (handle, element_type, range_type, lower, upper,
- stringp)
- PTR handle;
- debug_type element_type;
- debug_type range_type;
- bfd_signed_vma lower;
- bfd_signed_vma upper;
- bfd_boolean stringp;
+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)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_array_type *a;
if (element_type == NULL || range_type == NULL)
CHILL. */
debug_type
-debug_make_set_type (handle, type, bitstringp)
- PTR handle;
- debug_type type;
- bfd_boolean bitstringp;
+debug_make_set_type (void *handle, debug_type type, bfd_boolean bitstringp)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_set_type *s;
if (type == NULL)
to. */
debug_type
-debug_make_offset_type (handle, base_type, target_type)
- PTR handle;
- debug_type base_type;
- debug_type target_type;
+debug_make_offset_type (void *handle, debug_type base_type,
+ debug_type target_type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_offset_type *o;
if (base_type == NULL || target_type == NULL)
argument is a NULL terminated array of argument types. */
debug_type
-debug_make_method_type (handle, return_type, domain_type, arg_types, varargs)
- PTR handle;
- debug_type return_type;
- debug_type domain_type;
- debug_type *arg_types;
- bfd_boolean varargs;
+debug_make_method_type (void *handle, debug_type return_type,
+ debug_type domain_type, debug_type *arg_types,
+ bfd_boolean varargs)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_method_type *m;
if (return_type == NULL)
/* Make a const qualified version of a given type. */
debug_type
-debug_make_const_type (handle, type)
- PTR handle;
- debug_type type;
+debug_make_const_type (void *handle, debug_type type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
if (type == NULL)
return DEBUG_TYPE_NULL;
/* Make a volatile qualified version of a given type. */
debug_type
-debug_make_volatile_type (handle, type)
- PTR handle;
- debug_type type;
+debug_make_volatile_type (void *handle, debug_type type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
if (type == NULL)
return DEBUG_TYPE_NULL;
been mentioned, but not defined. */
debug_type
-debug_make_undefined_tagged_type (handle, name, kind)
- PTR handle;
- const char *name;
- enum debug_type_kind kind;
+debug_make_undefined_tagged_type (void *handle, const char *name,
+ enum debug_type_kind kind)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
if (name == NULL)
return DEBUG_TYPE_NULL;
argument is the visibility of the base class. */
debug_baseclass
-debug_make_baseclass (handle, type, bitpos, virtual, visibility)
- PTR handle ATTRIBUTE_UNUSED;
- debug_type type;
- bfd_vma bitpos;
- bfd_boolean virtual;
- enum debug_visibility visibility;
+debug_make_baseclass (void *handle ATTRIBUTE_UNUSED, debug_type type,
+ bfd_vma bitpos, bfd_boolean is_virtual,
+ enum debug_visibility visibility)
{
- struct debug_baseclass *b;
+ struct debug_baseclass_s *b;
- b = (struct debug_baseclass *) xmalloc (sizeof *b);
+ b = (struct debug_baseclass_s *) xmalloc (sizeof *b);
memset (b, 0, sizeof *b);
b->type = type;
b->bitpos = bitpos;
- b->virtual = virtual;
+ b->is_virtual = is_virtual;
b->visibility = visibility;
return b;
of the field. */
debug_field
-debug_make_field (handle, name, type, bitpos, bitsize, visibility)
- PTR handle ATTRIBUTE_UNUSED;
- const char *name;
- debug_type type;
- bfd_vma bitpos;
- bfd_vma bitsize;
- enum debug_visibility visibility;
+debug_make_field (void *handle ATTRIBUTE_UNUSED, const char *name,
+ debug_type type, bfd_vma bitpos, bfd_vma bitsize,
+ enum debug_visibility visibility)
{
- struct debug_field *f;
+ struct debug_field_s *f;
- f = (struct debug_field *) xmalloc (sizeof *f);
+ f = (struct debug_field_s *) xmalloc (sizeof *f);
memset (f, 0, sizeof *f);
f->name = name;
member. */
debug_field
-debug_make_static_member (handle, name, type, physname, visibility)
- PTR handle ATTRIBUTE_UNUSED;
- const char *name;
- debug_type type;
- const char *physname;
- enum debug_visibility visibility;
+debug_make_static_member (void *handle ATTRIBUTE_UNUSED, const char *name,
+ debug_type type, const char *physname,
+ enum debug_visibility visibility)
{
- struct debug_field *f;
+ struct debug_field_s *f;
- f = (struct debug_field *) xmalloc (sizeof *f);
+ f = (struct debug_field_s *) xmalloc (sizeof *f);
memset (f, 0, sizeof *f);
f->name = name;
argument is a NULL terminated array of method variants. */
debug_method
-debug_make_method (handle, name, variants)
- PTR handle ATTRIBUTE_UNUSED;
- const char *name;
- debug_method_variant *variants;
+debug_make_method (void *handle ATTRIBUTE_UNUSED, const char *name,
+ debug_method_variant *variants)
{
- struct debug_method *m;
+ struct debug_method_s *m;
- m = (struct debug_method *) xmalloc (sizeof *m);
+ m = (struct debug_method_s *) xmalloc (sizeof *m);
memset (m, 0, sizeof *m);
m->name = name;
necessary? Could we just use debug_make_const_type? */
debug_method_variant
-debug_make_method_variant (handle, physname, type, visibility, constp,
- volatilep, voffset, context)
- PTR 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;
-{
- struct debug_method_variant *m;
-
- m = (struct debug_method_variant *) xmalloc (sizeof *m);
+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)
+{
+ struct debug_method_variant_s *m;
+
+ m = (struct debug_method_variant_s *) xmalloc (sizeof *m);
memset (m, 0, sizeof *m);
m->physname = physname;
since a static method can not also be virtual. */
debug_method_variant
-debug_make_static_method_variant (handle, physname, type, visibility,
- constp, volatilep)
- PTR handle ATTRIBUTE_UNUSED;
- const char *physname;
- debug_type type;
- enum debug_visibility visibility;
- bfd_boolean constp;
- bfd_boolean volatilep;
-{
- struct debug_method_variant *m;
-
- m = (struct debug_method_variant *) xmalloc (sizeof *m);
+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)
+{
+ struct debug_method_variant_s *m;
+
+ m = (struct debug_method_variant_s *) xmalloc (sizeof *m);
memset (m, 0, sizeof *m);
m->physname = physname;
/* Name a type. */
debug_type
-debug_name_type (handle, name, type)
- PTR handle;
- const char *name;
- debug_type type;
+debug_name_type (void *handle, const char *name, debug_type type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_named_type *n;
struct debug_name *nm;
/* Tag a type. */
debug_type
-debug_tag_type (handle, name, type)
- PTR handle;
- const char *name;
- debug_type type;
+debug_tag_type (void *handle, const char *name, debug_type type)
{
struct debug_handle *info = (struct debug_handle *) handle;
- struct debug_type *t;
+ struct debug_type_s *t;
struct debug_named_type *n;
struct debug_name *nm;
/* Record the size of a given type. */
bfd_boolean
-debug_record_type_size (handle, type, size)
- PTR handle ATTRIBUTE_UNUSED;
- debug_type type;
- unsigned int size;
+debug_record_type_size (void *handle ATTRIBUTE_UNUSED, debug_type type,
+ unsigned int size)
{
if (type->size != 0 && type->size != size)
fprintf (stderr, _("Warning: changing type size from %d to %d\n"),
/* Find a named type. */
debug_type
-debug_find_named_type (handle, name)
- PTR handle;
- const char *name;
+debug_find_named_type (void *handle, const char *name)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_block *b;
/* Find a tagged type. */
debug_type
-debug_find_tagged_type (handle, name, kind)
- PTR handle;
- const char *name;
- enum debug_type_kind kind;
+debug_find_tagged_type (void *handle, const char *name,
+ enum debug_type_kind kind)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_unit *u;
/* Get a base type. We build a linked list on the stack to avoid
crashing if the type is defined circularly. */
-static struct debug_type *
-debug_get_real_type (handle, type, list)
- PTR handle;
- debug_type type;
- struct debug_type_real_list *list;
+static struct debug_type_s *
+debug_get_real_type (void *handle, debug_type type,
+ struct debug_type_real_list *list)
{
struct debug_type_real_list *l;
struct debug_type_real_list rl;
for (l = list; l != NULL; l = l->next)
{
- if (l->t == type)
+ if (l->t == type || l == l->next)
{
fprintf (stderr,
_("debug_get_real_type: circular debug information for %s\n"),
/* Get the kind of a type. */
enum debug_type_kind
-debug_get_type_kind (handle, type)
- PTR handle;
- debug_type type;
+debug_get_type_kind (void *handle, debug_type type)
{
if (type == NULL)
return DEBUG_KIND_ILLEGAL;
/* Get the name of a type. */
const char *
-debug_get_type_name (handle, type)
- PTR handle;
- debug_type type;
+debug_get_type_name (void *handle, debug_type type)
{
if (type->kind == DEBUG_KIND_INDIRECT)
{
/* Get the size of a type. */
bfd_vma
-debug_get_type_size (handle, type)
- PTR handle;
- debug_type type;
+debug_get_type_size (void *handle, debug_type type)
{
if (type == NULL)
return 0;
/* Get the return type of a function or method type. */
debug_type
-debug_get_return_type (handle, type)
- PTR handle;
- debug_type type;
+debug_get_return_type (void *handle, debug_type type)
{
if (type == NULL)
return DEBUG_TYPE_NULL;
we don't currently store the parameter types of a function). */
const debug_type *
-debug_get_parameter_types (handle, type, pvarargs)
- PTR handle;
- debug_type type;
- bfd_boolean *pvarargs;
+debug_get_parameter_types (void *handle, debug_type type,
+ bfd_boolean *pvarargs)
{
if (type == NULL)
return NULL;
/* Get the target type of a type. */
debug_type
-debug_get_target_type (handle, type)
- PTR handle;
- debug_type type;
+debug_get_target_type (void *handle, debug_type type)
{
if (type == NULL)
return NULL;
class. */
const debug_field *
-debug_get_fields (handle, type)
- PTR handle;
- debug_type type;
+debug_get_fields (void *handle, debug_type type)
{
if (type == NULL)
return NULL;
/* Get the type of a field. */
debug_type
-debug_get_field_type (handle, field)
- PTR handle ATTRIBUTE_UNUSED;
- debug_field field;
+debug_get_field_type (void *handle ATTRIBUTE_UNUSED, debug_field field)
{
if (field == NULL)
return NULL;
/* Get the name of a field. */
const char *
-debug_get_field_name (handle, field)
- PTR handle ATTRIBUTE_UNUSED;
- debug_field field;
+debug_get_field_name (void *handle ATTRIBUTE_UNUSED, debug_field field)
{
if (field == NULL)
return NULL;
/* Get the bit position of a field. */
bfd_vma
-debug_get_field_bitpos (handle, field)
- PTR handle ATTRIBUTE_UNUSED;
- debug_field field;
+debug_get_field_bitpos (void *handle ATTRIBUTE_UNUSED, debug_field field)
{
if (field == NULL || field->static_member)
return (bfd_vma) -1;
/* Get the bit size of a field. */
bfd_vma
-debug_get_field_bitsize (handle, field)
- PTR handle ATTRIBUTE_UNUSED;
- debug_field field;
+debug_get_field_bitsize (void *handle ATTRIBUTE_UNUSED, debug_field field)
{
if (field == NULL || field->static_member)
return (bfd_vma) -1;
/* Get the visibility of a field. */
enum debug_visibility
-debug_get_field_visibility (handle, field)
- PTR handle ATTRIBUTE_UNUSED;
- debug_field field;
+debug_get_field_visibility (void *handle ATTRIBUTE_UNUSED, debug_field field)
{
if (field == NULL)
return DEBUG_VISIBILITY_IGNORE;
/* Get the physical name of a field. */
const char *
-debug_get_field_physname (handle, field)
- PTR handle ATTRIBUTE_UNUSED;
- debug_field field;
+debug_get_field_physname (void *handle ATTRIBUTE_UNUSED, debug_field field)
{
if (field == NULL || ! field->static_member)
return NULL;
debugging information, and a set of function pointers to call. */
bfd_boolean
-debug_write (handle, fns, fhandle)
- PTR handle;
- const struct debug_write_fns *fns;
- PTR fhandle;
+debug_write (void *handle, const struct debug_write_fns *fns, void *fhandle)
{
struct debug_handle *info = (struct debug_handle *) handle;
struct debug_unit *u;
/* Write out an element in a namespace. */
static bfd_boolean
-debug_write_name (info, fns, fhandle, n)
- struct debug_handle *info;
- const struct debug_write_fns *fns;
- PTR fhandle;
- struct debug_name *n;
+debug_write_name (struct debug_handle *info,
+ const struct debug_write_fns *fns, void *fhandle,
+ struct debug_name *n)
{
switch (n->kind)
{
points to this one. */
static bfd_boolean
-debug_write_type (info, fns, fhandle, type, name)
- struct debug_handle *info;
- const struct debug_write_fns *fns;
- PTR fhandle;
- struct debug_type *type;
- struct debug_name *name;
+debug_write_type (struct debug_handle *info,
+ const struct debug_write_fns *fns, void *fhandle,
+ struct debug_type_s *type, struct debug_name *name)
{
unsigned int i;
int is;
const char *tag = NULL;
+ if (type == DEBUG_TYPE_NULL)
+ return (*fns->empty_type) (fhandle);
+
/* 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. */
return (*fns->typedef_type) (fhandle, type->u.knamed->name->name);
else
{
- struct debug_type *real;
+ struct debug_type_s *real;
unsigned int id;
- real = debug_get_real_type ((PTR) info, type, NULL);
+ real = debug_get_real_type ((void *) info, type, NULL);
if (real == NULL)
return (*fns->empty_type) (fhandle);
id = 0;
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:
{
for (i = 0; type->u.kclass->fields[i] != NULL; i++)
{
- struct debug_field *f;
+ struct debug_field_s *f;
f = type->u.kclass->fields[i];
if (! debug_write_type (info, fns, fhandle, f->type,
/* Write out a class type. */
static bfd_boolean
-debug_write_class_type (info, fns, fhandle, type, tag)
- struct debug_handle *info;
- const struct debug_write_fns *fns;
- PTR fhandle;
- struct debug_type *type;
- const char *tag;
+debug_write_class_type (struct debug_handle *info,
+ const struct debug_write_fns *fns, void *fhandle,
+ struct debug_type_s *type, const char *tag)
{
unsigned int i;
unsigned int id;
- struct debug_type *vptrbase;
+ struct debug_type_s *vptrbase;
if (type->u.kclass == NULL)
{
{
for (i = 0; type->u.kclass->fields[i] != NULL; i++)
{
- struct debug_field *f;
+ struct debug_field_s *f;
f = type->u.kclass->fields[i];
if (! debug_write_type (info, fns, fhandle, f->type,
{
for (i = 0; type->u.kclass->baseclasses[i] != NULL; i++)
{
- struct debug_baseclass *b;
+ struct debug_baseclass_s *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,
+ if (! (*fns->class_baseclass) (fhandle, b->bitpos, b->is_virtual,
b->visibility))
return FALSE;
}
{
for (i = 0; type->u.kclass->methods[i] != NULL; i++)
{
- struct debug_method *m;
+ struct debug_method_s *m;
unsigned int j;
m = type->u.kclass->methods[i];
return FALSE;
for (j = 0; m->variants[j] != NULL; j++)
{
- struct debug_method_variant *v;
+ struct debug_method_variant_s *v;
v = m->variants[j];
if (v->context != NULL)
/* Write out information for a function. */
static bfd_boolean
-debug_write_function (info, fns, fhandle, name, linkage, function)
- struct debug_handle *info;
- const struct debug_write_fns *fns;
- PTR fhandle;
- const char *name;
- enum debug_object_linkage linkage;
- struct debug_function *function;
+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)
{
struct debug_parameter *p;
struct debug_block *b;
/* Write out information for a block. */
static bfd_boolean
-debug_write_block (info, fns, fhandle, block)
- struct debug_handle *info;
- const struct debug_write_fns *fns;
- PTR fhandle;
- struct debug_block *block;
+debug_write_block (struct debug_handle *info,
+ const struct debug_write_fns *fns, void *fhandle,
+ struct debug_block *block)
{
struct debug_name *n;
struct debug_block *b;
/* Write out line number information up to ADDRESS. */
static bfd_boolean
-debug_write_linenos (info, fns, fhandle, address)
- struct debug_handle *info;
- const struct debug_write_fns *fns;
- PTR fhandle;
- bfd_vma address;
+debug_write_linenos (struct debug_handle *info,
+ const struct debug_write_fns *fns, void *fhandle,
+ bfd_vma address)
{
while (info->current_write_lineno != NULL)
{
same struct will be defined by multiple compilation units. */
static bfd_boolean
-debug_set_class_id (info, tag, type)
- struct debug_handle *info;
- const char *tag;
- struct debug_type *type;
+debug_set_class_id (struct debug_handle *info, const char *tag,
+ struct debug_type_s *type)
{
struct debug_class_type *c;
struct debug_class_id *l;
tags and the like. */
static bfd_boolean
-debug_type_samep (info, t1, t2)
- struct debug_handle *info;
- struct debug_type *t1;
- struct debug_type *t2;
+debug_type_samep (struct debug_handle *info, struct debug_type_s *t1,
+ struct debug_type_s *t2)
{
struct debug_type_compare_list *l;
struct debug_type_compare_list top;
ret = TRUE;
else
{
- struct debug_type **a1, **a2;
+ struct debug_type_s **a1, **a2;
a1 = t1->u.kfunction->arg_types;
a2 = t2->u.kfunction->arg_types;
&& t1->u.krange->upper == t2->u.krange->upper
&& debug_type_samep (info, t1->u.krange->type,
t2->u.krange->type));
+ break;
case DEBUG_KIND_ARRAY:
ret = (t1->u.karray->lower == t2->u.karray->lower
ret = TRUE;
else
{
- struct debug_type **a1, **a2;
+ struct debug_type_s **a1, **a2;
a1 = t1->u.kmethod->arg_types;
a2 = t2->u.kmethod->arg_types;
debug_type_samep. */
static bfd_boolean
-debug_class_type_samep (info, t1, t2)
- struct debug_handle *info;
- struct debug_type *t1;
- struct debug_type *t2;
+debug_class_type_samep (struct debug_handle *info, struct debug_type_s *t1,
+ struct debug_type_s *t2)
{
struct debug_class_type *c1, *c2;
if (c1->fields != NULL)
{
- struct debug_field **pf1, **pf2;
+ struct debug_field_s **pf1, **pf2;
for (pf1 = c1->fields, pf2 = c2->fields;
*pf1 != NULL && *pf2 != NULL;
pf1++, pf2++)
{
- struct debug_field *f1, *f2;
+ struct debug_field_s *f1, *f2;
f1 = *pf1;
f2 = *pf2;
typedefs and we really don't care. */
if (strcmp (f1->name, f2->name) != 0
|| ! debug_type_samep (info,
- debug_get_real_type ((PTR) info,
+ debug_get_real_type ((void *) info,
f1->type, NULL),
- debug_get_real_type ((PTR) info,
+ debug_get_real_type ((void *) info,
f2->type, NULL)))
return FALSE;
}
if (c1->baseclasses != NULL)
{
- struct debug_baseclass **pb1, **pb2;
+ struct debug_baseclass_s **pb1, **pb2;
for (pb1 = c1->baseclasses, pb2 = c2->baseclasses;
*pb1 != NULL && *pb2 != NULL;
++pb1, ++pb2)
{
- struct debug_baseclass *b1, *b2;
+ struct debug_baseclass_s *b1, *b2;
b1 = *pb1;
b2 = *pb2;
if (b1->bitpos != b2->bitpos
- || b1->virtual != b2->virtual
+ || b1->is_virtual != b2->is_virtual
|| b1->visibility != b2->visibility
|| ! debug_type_samep (info, b1->type, b2->type))
return FALSE;
if (c1->methods != NULL)
{
- struct debug_method **pm1, **pm2;
+ struct debug_method_s **pm1, **pm2;
for (pm1 = c1->methods, pm2 = c2->methods;
*pm1 != NULL && *pm2 != NULL;
++pm1, ++pm2)
{
- struct debug_method *m1, *m2;
+ struct debug_method_s *m1, *m2;
m1 = *pm1;
m2 = *pm2;
return FALSE;
if (m1->variants == NULL)
{
- struct debug_method_variant **pv1, **pv2;
+ struct debug_method_variant_s **pv1, **pv2;
for (pv1 = m1->variants, pv2 = m2->variants;
*pv1 != NULL && *pv2 != NULL;
++pv1, ++pv2)
{
- struct debug_method_variant *v1, *v2;
+ struct debug_method_variant_s *v1, *v2;
v1 = *pv1;
v2 = *pv2;