| 1 |
15 |
khays |
/* debug.h -- Describe generic debugging information.
|
| 2 |
|
|
Copyright 1995, 1996, 2002, 2003, 2005, 2007, 2009
|
| 3 |
|
|
Free Software Foundation, Inc.
|
| 4 |
|
|
Written by Ian Lance Taylor <ian@cygnus.com>.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of GNU Binutils.
|
| 7 |
|
|
|
| 8 |
|
|
This program is free software; you can redistribute it and/or modify
|
| 9 |
|
|
it under the terms of the GNU General Public License as published by
|
| 10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
| 11 |
|
|
(at your option) any later version.
|
| 12 |
|
|
|
| 13 |
|
|
This program is distributed in the hope that it will be useful,
|
| 14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
|
|
GNU General Public License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
You should have received a copy of the GNU General Public License
|
| 19 |
|
|
along with this program; if not, write to the Free Software
|
| 20 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
| 21 |
|
|
02110-1301, USA. */
|
| 22 |
|
|
|
| 23 |
|
|
#ifndef DEBUG_H
|
| 24 |
|
|
#define DEBUG_H
|
| 25 |
|
|
|
| 26 |
|
|
/* This header file describes a generic debugging information format.
|
| 27 |
|
|
We may eventually have readers which convert different formats into
|
| 28 |
|
|
this generic format, and writers which write it out. The initial
|
| 29 |
|
|
impetus for this was writing a converter from stabs to HP IEEE-695
|
| 30 |
|
|
debugging format. */
|
| 31 |
|
|
|
| 32 |
|
|
/* Different kinds of types. */
|
| 33 |
|
|
|
| 34 |
|
|
enum debug_type_kind
|
| 35 |
|
|
{
|
| 36 |
|
|
/* Not used. */
|
| 37 |
|
|
DEBUG_KIND_ILLEGAL,
|
| 38 |
|
|
/* Indirect via a pointer. */
|
| 39 |
|
|
DEBUG_KIND_INDIRECT,
|
| 40 |
|
|
/* Void. */
|
| 41 |
|
|
DEBUG_KIND_VOID,
|
| 42 |
|
|
/* Integer. */
|
| 43 |
|
|
DEBUG_KIND_INT,
|
| 44 |
|
|
/* Floating point. */
|
| 45 |
|
|
DEBUG_KIND_FLOAT,
|
| 46 |
|
|
/* Complex. */
|
| 47 |
|
|
DEBUG_KIND_COMPLEX,
|
| 48 |
|
|
/* Boolean. */
|
| 49 |
|
|
DEBUG_KIND_BOOL,
|
| 50 |
|
|
/* Struct. */
|
| 51 |
|
|
DEBUG_KIND_STRUCT,
|
| 52 |
|
|
/* Union. */
|
| 53 |
|
|
DEBUG_KIND_UNION,
|
| 54 |
|
|
/* Class. */
|
| 55 |
|
|
DEBUG_KIND_CLASS,
|
| 56 |
|
|
/* Union class (can this really happen?). */
|
| 57 |
|
|
DEBUG_KIND_UNION_CLASS,
|
| 58 |
|
|
/* Enumeration type. */
|
| 59 |
|
|
DEBUG_KIND_ENUM,
|
| 60 |
|
|
/* Pointer. */
|
| 61 |
|
|
DEBUG_KIND_POINTER,
|
| 62 |
|
|
/* Function. */
|
| 63 |
|
|
DEBUG_KIND_FUNCTION,
|
| 64 |
|
|
/* Reference. */
|
| 65 |
|
|
DEBUG_KIND_REFERENCE,
|
| 66 |
|
|
/* Range. */
|
| 67 |
|
|
DEBUG_KIND_RANGE,
|
| 68 |
|
|
/* Array. */
|
| 69 |
|
|
DEBUG_KIND_ARRAY,
|
| 70 |
|
|
/* Set. */
|
| 71 |
|
|
DEBUG_KIND_SET,
|
| 72 |
|
|
/* Based pointer. */
|
| 73 |
|
|
DEBUG_KIND_OFFSET,
|
| 74 |
|
|
/* Method. */
|
| 75 |
|
|
DEBUG_KIND_METHOD,
|
| 76 |
|
|
/* Const qualified type. */
|
| 77 |
|
|
DEBUG_KIND_CONST,
|
| 78 |
|
|
/* Volatile qualified type. */
|
| 79 |
|
|
DEBUG_KIND_VOLATILE,
|
| 80 |
|
|
/* Named type. */
|
| 81 |
|
|
DEBUG_KIND_NAMED,
|
| 82 |
|
|
/* Tagged type. */
|
| 83 |
|
|
DEBUG_KIND_TAGGED
|
| 84 |
|
|
};
|
| 85 |
|
|
|
| 86 |
|
|
/* Different kinds of variables. */
|
| 87 |
|
|
|
| 88 |
|
|
enum debug_var_kind
|
| 89 |
|
|
{
|
| 90 |
|
|
/* Not used. */
|
| 91 |
|
|
DEBUG_VAR_ILLEGAL,
|
| 92 |
|
|
/* A global variable. */
|
| 93 |
|
|
DEBUG_GLOBAL,
|
| 94 |
|
|
/* A static variable. */
|
| 95 |
|
|
DEBUG_STATIC,
|
| 96 |
|
|
/* A local static variable. */
|
| 97 |
|
|
DEBUG_LOCAL_STATIC,
|
| 98 |
|
|
/* A local variable. */
|
| 99 |
|
|
DEBUG_LOCAL,
|
| 100 |
|
|
/* A register variable. */
|
| 101 |
|
|
DEBUG_REGISTER
|
| 102 |
|
|
};
|
| 103 |
|
|
|
| 104 |
|
|
/* Different kinds of function parameters. */
|
| 105 |
|
|
|
| 106 |
|
|
enum debug_parm_kind
|
| 107 |
|
|
{
|
| 108 |
|
|
/* Not used. */
|
| 109 |
|
|
DEBUG_PARM_ILLEGAL,
|
| 110 |
|
|
/* A stack based parameter. */
|
| 111 |
|
|
DEBUG_PARM_STACK,
|
| 112 |
|
|
/* A register parameter. */
|
| 113 |
|
|
DEBUG_PARM_REG,
|
| 114 |
|
|
/* A stack based reference parameter. */
|
| 115 |
|
|
DEBUG_PARM_REFERENCE,
|
| 116 |
|
|
/* A register reference parameter. */
|
| 117 |
|
|
DEBUG_PARM_REF_REG
|
| 118 |
|
|
};
|
| 119 |
|
|
|
| 120 |
|
|
/* Different kinds of visibility. */
|
| 121 |
|
|
|
| 122 |
|
|
enum debug_visibility
|
| 123 |
|
|
{
|
| 124 |
|
|
/* A public field (e.g., a field in a C struct). */
|
| 125 |
|
|
DEBUG_VISIBILITY_PUBLIC,
|
| 126 |
|
|
/* A protected field. */
|
| 127 |
|
|
DEBUG_VISIBILITY_PROTECTED,
|
| 128 |
|
|
/* A private field. */
|
| 129 |
|
|
DEBUG_VISIBILITY_PRIVATE,
|
| 130 |
|
|
/* A field which should be ignored. */
|
| 131 |
|
|
DEBUG_VISIBILITY_IGNORE
|
| 132 |
|
|
};
|
| 133 |
|
|
|
| 134 |
|
|
/* A type. */
|
| 135 |
|
|
|
| 136 |
|
|
typedef struct debug_type_s *debug_type;
|
| 137 |
|
|
|
| 138 |
|
|
#define DEBUG_TYPE_NULL ((debug_type) NULL)
|
| 139 |
|
|
|
| 140 |
|
|
/* A field in a struct or union. */
|
| 141 |
|
|
|
| 142 |
|
|
typedef struct debug_field_s *debug_field;
|
| 143 |
|
|
|
| 144 |
|
|
#define DEBUG_FIELD_NULL ((debug_field) NULL)
|
| 145 |
|
|
|
| 146 |
|
|
/* A base class for an object. */
|
| 147 |
|
|
|
| 148 |
|
|
typedef struct debug_baseclass_s *debug_baseclass;
|
| 149 |
|
|
|
| 150 |
|
|
#define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL)
|
| 151 |
|
|
|
| 152 |
|
|
/* A method of an object. */
|
| 153 |
|
|
|
| 154 |
|
|
typedef struct debug_method_s *debug_method;
|
| 155 |
|
|
|
| 156 |
|
|
#define DEBUG_METHOD_NULL ((debug_method) NULL)
|
| 157 |
|
|
|
| 158 |
|
|
/* The arguments to a method function of an object. These indicate
|
| 159 |
|
|
which method to run. */
|
| 160 |
|
|
|
| 161 |
|
|
typedef struct debug_method_variant_s *debug_method_variant;
|
| 162 |
|
|
|
| 163 |
|
|
#define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL)
|
| 164 |
|
|
|
| 165 |
|
|
/* This structure is passed to debug_write. It holds function
|
| 166 |
|
|
pointers that debug_write will call based on the accumulated
|
| 167 |
|
|
debugging information. */
|
| 168 |
|
|
|
| 169 |
|
|
struct debug_write_fns
|
| 170 |
|
|
{
|
| 171 |
|
|
/* This is called at the start of each new compilation unit with the
|
| 172 |
|
|
name of the main file in the new unit. */
|
| 173 |
|
|
bfd_boolean (*start_compilation_unit) (void *, const char *);
|
| 174 |
|
|
|
| 175 |
|
|
/* This is called at the start of each source file within a
|
| 176 |
|
|
compilation unit, before outputting any global information for
|
| 177 |
|
|
that file. The argument is the name of the file. */
|
| 178 |
|
|
bfd_boolean (*start_source) (void *, const char *);
|
| 179 |
|
|
|
| 180 |
|
|
/* Each writer must keep a stack of types. */
|
| 181 |
|
|
|
| 182 |
|
|
/* Push an empty type onto the type stack. This type can appear if
|
| 183 |
|
|
there is a reference to a type which is never defined. */
|
| 184 |
|
|
bfd_boolean (*empty_type) (void *);
|
| 185 |
|
|
|
| 186 |
|
|
/* Push a void type onto the type stack. */
|
| 187 |
|
|
bfd_boolean (*void_type) (void *);
|
| 188 |
|
|
|
| 189 |
|
|
/* Push an integer type onto the type stack, given the size and
|
| 190 |
|
|
whether it is unsigned. */
|
| 191 |
|
|
bfd_boolean (*int_type) (void *, unsigned int, bfd_boolean);
|
| 192 |
|
|
|
| 193 |
|
|
/* Push a floating type onto the type stack, given the size. */
|
| 194 |
|
|
bfd_boolean (*float_type) (void *, unsigned int);
|
| 195 |
|
|
|
| 196 |
|
|
/* Push a complex type onto the type stack, given the size. */
|
| 197 |
|
|
bfd_boolean (*complex_type) (void *, unsigned int);
|
| 198 |
|
|
|
| 199 |
|
|
/* Push a bfd_boolean type onto the type stack, given the size. */
|
| 200 |
|
|
bfd_boolean (*bool_type) (void *, unsigned int);
|
| 201 |
|
|
|
| 202 |
|
|
/* Push an enum type onto the type stack, given the tag, a NULL
|
| 203 |
|
|
terminated array of names and the associated values. If there is
|
| 204 |
|
|
no tag, the tag argument will be NULL. If this is an undefined
|
| 205 |
|
|
enum, the names and values arguments will be NULL. */
|
| 206 |
|
|
bfd_boolean (*enum_type)
|
| 207 |
|
|
(void *, const char *, const char **, bfd_signed_vma *);
|
| 208 |
|
|
|
| 209 |
|
|
/* Pop the top type on the type stack, and push a pointer to that
|
| 210 |
|
|
type onto the type stack. */
|
| 211 |
|
|
bfd_boolean (*pointer_type) (void *);
|
| 212 |
|
|
|
| 213 |
|
|
/* Push a function type onto the type stack. The second argument
|
| 214 |
|
|
indicates the number of argument types that have been pushed onto
|
| 215 |
|
|
the stack. If the number of argument types is passed as -1, then
|
| 216 |
|
|
the argument types of the function are unknown, and no types have
|
| 217 |
|
|
been pushed onto the stack. The third argument is TRUE if the
|
| 218 |
|
|
function takes a variable number of arguments. The return type
|
| 219 |
|
|
of the function is pushed onto the type stack below the argument
|
| 220 |
|
|
types, if any. */
|
| 221 |
|
|
bfd_boolean (*function_type) (void *, int, bfd_boolean);
|
| 222 |
|
|
|
| 223 |
|
|
/* Pop the top type on the type stack, and push a reference to that
|
| 224 |
|
|
type onto the type stack. */
|
| 225 |
|
|
bfd_boolean (*reference_type) (void *);
|
| 226 |
|
|
|
| 227 |
|
|
/* Pop the top type on the type stack, and push a range of that type
|
| 228 |
|
|
with the given lower and upper bounds onto the type stack. */
|
| 229 |
|
|
bfd_boolean (*range_type) (void *, bfd_signed_vma, bfd_signed_vma);
|
| 230 |
|
|
|
| 231 |
|
|
/* Push an array type onto the type stack. The top type on the type
|
| 232 |
|
|
stack is the range, and the next type on the type stack is the
|
| 233 |
|
|
element type. These should be popped before the array type is
|
| 234 |
|
|
pushed. The arguments are the lower bound, the upper bound, and
|
| 235 |
|
|
whether the array is a string. */
|
| 236 |
|
|
bfd_boolean (*array_type)
|
| 237 |
|
|
(void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean);
|
| 238 |
|
|
|
| 239 |
|
|
/* Pop the top type on the type stack, and push a set of that type
|
| 240 |
|
|
onto the type stack. The argument indicates whether this set is
|
| 241 |
|
|
a bitstring. */
|
| 242 |
|
|
bfd_boolean (*set_type) (void *, bfd_boolean);
|
| 243 |
|
|
|
| 244 |
|
|
/* Push an offset type onto the type stack. The top type on the
|
| 245 |
|
|
type stack is the target type, and the next type on the type
|
| 246 |
|
|
stack is the base type. These should be popped before the offset
|
| 247 |
|
|
type is pushed. */
|
| 248 |
|
|
bfd_boolean (*offset_type) (void *);
|
| 249 |
|
|
|
| 250 |
|
|
/* Push a method type onto the type stack. If the second argument
|
| 251 |
|
|
is TRUE, the top type on the stack is the class to which the
|
| 252 |
|
|
method belongs; otherwise, the class must be determined by the
|
| 253 |
|
|
class to which the method is attached. The third argument is the
|
| 254 |
|
|
number of argument types; these are pushed onto the type stack in
|
| 255 |
|
|
reverse order (the first type popped is the last argument to the
|
| 256 |
|
|
method). A value of -1 for the third argument means that no
|
| 257 |
|
|
argument information is available. The fourth argument is TRUE
|
| 258 |
|
|
if the function takes a variable number of arguments. The next
|
| 259 |
|
|
type on the type stack below the domain and the argument types is
|
| 260 |
|
|
the return type of the method. All these types must be popped,
|
| 261 |
|
|
and then the method type must be pushed. */
|
| 262 |
|
|
bfd_boolean (*method_type) (void *, bfd_boolean, int, bfd_boolean);
|
| 263 |
|
|
|
| 264 |
|
|
/* Pop the top type off the type stack, and push a const qualified
|
| 265 |
|
|
version of that type onto the type stack. */
|
| 266 |
|
|
bfd_boolean (*const_type) (void *);
|
| 267 |
|
|
|
| 268 |
|
|
/* Pop the top type off the type stack, and push a volatile
|
| 269 |
|
|
qualified version of that type onto the type stack. */
|
| 270 |
|
|
bfd_boolean (*volatile_type) (void *);
|
| 271 |
|
|
|
| 272 |
|
|
/* Start building a struct. This is followed by calls to the
|
| 273 |
|
|
struct_field function, and finished by a call to the
|
| 274 |
|
|
end_struct_type function. The second argument is the tag; this
|
| 275 |
|
|
will be NULL if there isn't one. If the second argument is NULL,
|
| 276 |
|
|
the third argument is a constant identifying this struct for use
|
| 277 |
|
|
with tag_type. The fourth argument is TRUE for a struct, FALSE
|
| 278 |
|
|
for a union. The fifth argument is the size. If this is an
|
| 279 |
|
|
undefined struct or union, the size will be 0 and struct_field
|
| 280 |
|
|
will not be called before end_struct_type is called. */
|
| 281 |
|
|
bfd_boolean (*start_struct_type)
|
| 282 |
|
|
(void *, const char *, unsigned int, bfd_boolean, unsigned int);
|
| 283 |
|
|
|
| 284 |
|
|
/* Add a field to the struct type currently being built. The type
|
| 285 |
|
|
of the field should be popped off the type stack. The arguments
|
| 286 |
|
|
are the name, the bit position, the bit size (may be zero if the
|
| 287 |
|
|
field is not packed), and the visibility. */
|
| 288 |
|
|
bfd_boolean (*struct_field)
|
| 289 |
|
|
(void *, const char *, bfd_vma, bfd_vma, enum debug_visibility);
|
| 290 |
|
|
|
| 291 |
|
|
/* Finish building a struct, and push it onto the type stack. */
|
| 292 |
|
|
bfd_boolean (*end_struct_type) (void *);
|
| 293 |
|
|
|
| 294 |
|
|
/* Start building a class. This is followed by calls to several
|
| 295 |
|
|
functions: struct_field, class_static_member, class_baseclass,
|
| 296 |
|
|
class_start_method, class_method_variant,
|
| 297 |
|
|
class_static_method_variant, and class_end_method. The class is
|
| 298 |
|
|
finished by a call to end_class_type. The first five arguments
|
| 299 |
|
|
are the same as for start_struct_type. The sixth argument is
|
| 300 |
|
|
TRUE if there is a virtual function table; if there is, the
|
| 301 |
|
|
seventh argument is TRUE if the virtual function table can be
|
| 302 |
|
|
found in the type itself, and is FALSE if the type of the object
|
| 303 |
|
|
holding the virtual function table should be popped from the type
|
| 304 |
|
|
stack. */
|
| 305 |
|
|
bfd_boolean (*start_class_type)
|
| 306 |
|
|
(void *, const char *, unsigned int, bfd_boolean, unsigned int,
|
| 307 |
|
|
bfd_boolean, bfd_boolean);
|
| 308 |
|
|
|
| 309 |
|
|
/* Add a static member to the class currently being built. The
|
| 310 |
|
|
arguments are the field name, the physical name, and the
|
| 311 |
|
|
visibility. The type must be popped off the type stack. */
|
| 312 |
|
|
bfd_boolean (*class_static_member)
|
| 313 |
|
|
(void *, const char *, const char *, enum debug_visibility);
|
| 314 |
|
|
|
| 315 |
|
|
/* Add a baseclass to the class currently being built. The type of
|
| 316 |
|
|
the baseclass must be popped off the type stack. The arguments
|
| 317 |
|
|
are the bit position, whether the class is virtual, and the
|
| 318 |
|
|
visibility. */
|
| 319 |
|
|
bfd_boolean (*class_baseclass)
|
| 320 |
|
|
(void *, bfd_vma, bfd_boolean, enum debug_visibility);
|
| 321 |
|
|
|
| 322 |
|
|
/* Start adding a method to the class currently being built. This
|
| 323 |
|
|
is followed by calls to class_method_variant and
|
| 324 |
|
|
class_static_method_variant to describe different variants of the
|
| 325 |
|
|
method which take different arguments. The method is finished
|
| 326 |
|
|
with a call to class_end_method. The argument is the method
|
| 327 |
|
|
name. */
|
| 328 |
|
|
bfd_boolean (*class_start_method) (void *, const char *);
|
| 329 |
|
|
|
| 330 |
|
|
/* Describe a variant to the class method currently being built.
|
| 331 |
|
|
The type of the variant must be popped off the type stack. The
|
| 332 |
|
|
second argument is the physical name of the function. The
|
| 333 |
|
|
following arguments are the visibility, whether the variant is
|
| 334 |
|
|
const, whether the variant is volatile, the offset in the virtual
|
| 335 |
|
|
function table, and whether the context is on the type stack
|
| 336 |
|
|
(below the variant type). */
|
| 337 |
|
|
bfd_boolean (*class_method_variant)
|
| 338 |
|
|
(void *, const char *, enum debug_visibility, bfd_boolean,
|
| 339 |
|
|
bfd_boolean, bfd_vma, bfd_boolean);
|
| 340 |
|
|
|
| 341 |
|
|
/* Describe a static variant to the class method currently being
|
| 342 |
|
|
built. The arguments are the same as for class_method_variant,
|
| 343 |
|
|
except that the last two arguments are omitted. The type of the
|
| 344 |
|
|
variant must be popped off the type stack. */
|
| 345 |
|
|
bfd_boolean (*class_static_method_variant)
|
| 346 |
|
|
(void *, const char *, enum debug_visibility, bfd_boolean,
|
| 347 |
|
|
bfd_boolean);
|
| 348 |
|
|
|
| 349 |
|
|
/* Finish describing a class method. */
|
| 350 |
|
|
bfd_boolean (*class_end_method) (void *);
|
| 351 |
|
|
|
| 352 |
|
|
/* Finish describing a class, and push it onto the type stack. */
|
| 353 |
|
|
bfd_boolean (*end_class_type) (void *);
|
| 354 |
|
|
|
| 355 |
|
|
/* Push a type on the stack which was given a name by an earlier
|
| 356 |
|
|
call to typdef. */
|
| 357 |
|
|
bfd_boolean (*typedef_type) (void *, const char *);
|
| 358 |
|
|
|
| 359 |
|
|
/* Push a tagged type on the stack which was defined earlier. If
|
| 360 |
|
|
the second argument is not NULL, the type was defined by a call
|
| 361 |
|
|
to tag. If the second argument is NULL, the type was defined by
|
| 362 |
|
|
a call to start_struct_type or start_class_type with a tag of
|
| 363 |
|
|
NULL and the number of the third argument. Either way, the
|
| 364 |
|
|
fourth argument is the tag kind. Note that this may be called
|
| 365 |
|
|
for a struct (class) being defined, in between the call to
|
| 366 |
|
|
start_struct_type (start_class_type) and the call to
|
| 367 |
|
|
end_struct_type (end_class_type). */
|
| 368 |
|
|
bfd_boolean (*tag_type)
|
| 369 |
|
|
(void *, const char *, unsigned int, enum debug_type_kind);
|
| 370 |
|
|
|
| 371 |
|
|
/* Pop the type stack, and typedef it to the given name. */
|
| 372 |
|
|
bfd_boolean (*typdef) (void *, const char *);
|
| 373 |
|
|
|
| 374 |
|
|
/* Pop the type stack, and declare it as a tagged struct or union or
|
| 375 |
|
|
enum or whatever. The tag passed down here is redundant, since
|
| 376 |
|
|
was also passed when enum_type, start_struct_type, or
|
| 377 |
|
|
start_class_type was called. */
|
| 378 |
|
|
bfd_boolean (*tag) (void *, const char *);
|
| 379 |
|
|
|
| 380 |
|
|
/* This is called to record a named integer constant. */
|
| 381 |
|
|
bfd_boolean (*int_constant) (void *, const char *, bfd_vma);
|
| 382 |
|
|
|
| 383 |
|
|
/* This is called to record a named floating point constant. */
|
| 384 |
|
|
bfd_boolean (*float_constant) (void *, const char *, double);
|
| 385 |
|
|
|
| 386 |
|
|
/* This is called to record a typed integer constant. The type is
|
| 387 |
|
|
popped off the type stack. */
|
| 388 |
|
|
bfd_boolean (*typed_constant) (void *, const char *, bfd_vma);
|
| 389 |
|
|
|
| 390 |
|
|
/* This is called to record a variable. The type is popped off the
|
| 391 |
|
|
type stack. */
|
| 392 |
|
|
bfd_boolean (*variable)
|
| 393 |
|
|
(void *, const char *, enum debug_var_kind, bfd_vma);
|
| 394 |
|
|
|
| 395 |
|
|
/* Start writing out a function. The return type must be popped off
|
| 396 |
|
|
the stack. The bfd_boolean is TRUE if the function is global. This
|
| 397 |
|
|
is followed by calls to function_parameter, followed by block
|
| 398 |
|
|
information. */
|
| 399 |
|
|
bfd_boolean (*start_function) (void *, const char *, bfd_boolean);
|
| 400 |
|
|
|
| 401 |
|
|
/* Record a function parameter for the current function. The type
|
| 402 |
|
|
must be popped off the stack. */
|
| 403 |
|
|
bfd_boolean (*function_parameter)
|
| 404 |
|
|
(void *, const char *, enum debug_parm_kind, bfd_vma);
|
| 405 |
|
|
|
| 406 |
|
|
/* Start writing out a block. There is at least one top level block
|
| 407 |
|
|
per function. Blocks may be nested. The argument is the
|
| 408 |
|
|
starting address of the block. */
|
| 409 |
|
|
bfd_boolean (*start_block) (void *, bfd_vma);
|
| 410 |
|
|
|
| 411 |
|
|
/* Finish writing out a block. The argument is the ending address
|
| 412 |
|
|
of the block. */
|
| 413 |
|
|
bfd_boolean (*end_block) (void *, bfd_vma);
|
| 414 |
|
|
|
| 415 |
|
|
/* Finish writing out a function. */
|
| 416 |
|
|
bfd_boolean (*end_function) (void *);
|
| 417 |
|
|
|
| 418 |
|
|
/* Record line number information for the current compilation unit. */
|
| 419 |
|
|
bfd_boolean (*lineno) (void *, const char *, unsigned long, bfd_vma);
|
| 420 |
|
|
};
|
| 421 |
|
|
|
| 422 |
|
|
/* Exported functions. */
|
| 423 |
|
|
|
| 424 |
|
|
/* The first argument to most of these functions is a handle. This
|
| 425 |
|
|
handle is returned by the debug_init function. The purpose of the
|
| 426 |
|
|
handle is to permit the debugging routines to not use static
|
| 427 |
|
|
variables, and hence to be reentrant. This would be useful for a
|
| 428 |
|
|
program which wanted to handle two executables simultaneously. */
|
| 429 |
|
|
|
| 430 |
|
|
/* Return a debugging handle. */
|
| 431 |
|
|
|
| 432 |
|
|
extern void *debug_init (void);
|
| 433 |
|
|
|
| 434 |
|
|
/* Set the source filename. This implicitly starts a new compilation
|
| 435 |
|
|
unit. */
|
| 436 |
|
|
|
| 437 |
|
|
extern bfd_boolean debug_set_filename (void *, const char *);
|
| 438 |
|
|
|
| 439 |
|
|
/* Change source files to the given file name. This is used for
|
| 440 |
|
|
include files in a single compilation unit. */
|
| 441 |
|
|
|
| 442 |
|
|
extern bfd_boolean debug_start_source (void *, const char *);
|
| 443 |
|
|
|
| 444 |
|
|
/* Record a function definition. This implicitly starts a function
|
| 445 |
|
|
block. The debug_type argument is the type of the return value.
|
| 446 |
|
|
The bfd_boolean indicates whether the function is globally visible.
|
| 447 |
|
|
The bfd_vma is the address of the start of the function. Currently
|
| 448 |
|
|
the parameter types are specified by calls to
|
| 449 |
|
|
debug_record_parameter. */
|
| 450 |
|
|
|
| 451 |
|
|
extern bfd_boolean debug_record_function
|
| 452 |
|
|
(void *, const char *, debug_type, bfd_boolean, bfd_vma);
|
| 453 |
|
|
|
| 454 |
|
|
/* Record a parameter for the current function. */
|
| 455 |
|
|
|
| 456 |
|
|
extern bfd_boolean debug_record_parameter
|
| 457 |
|
|
(void *, const char *, debug_type, enum debug_parm_kind, bfd_vma);
|
| 458 |
|
|
|
| 459 |
|
|
/* End a function definition. The argument is the address where the
|
| 460 |
|
|
function ends. */
|
| 461 |
|
|
|
| 462 |
|
|
extern bfd_boolean debug_end_function (void *, bfd_vma);
|
| 463 |
|
|
|
| 464 |
|
|
/* Start a block in a function. All local information will be
|
| 465 |
|
|
recorded in this block, until the matching call to debug_end_block.
|
| 466 |
|
|
debug_start_block and debug_end_block may be nested. The argument
|
| 467 |
|
|
is the address at which this block starts. */
|
| 468 |
|
|
|
| 469 |
|
|
extern bfd_boolean debug_start_block (void *, bfd_vma);
|
| 470 |
|
|
|
| 471 |
|
|
/* Finish a block in a function. This matches the call to
|
| 472 |
|
|
debug_start_block. The argument is the address at which this block
|
| 473 |
|
|
ends. */
|
| 474 |
|
|
|
| 475 |
|
|
extern bfd_boolean debug_end_block (void *, bfd_vma);
|
| 476 |
|
|
|
| 477 |
|
|
/* Associate a line number in the current source file with a given
|
| 478 |
|
|
address. */
|
| 479 |
|
|
|
| 480 |
|
|
extern bfd_boolean debug_record_line (void *, unsigned long, bfd_vma);
|
| 481 |
|
|
|
| 482 |
|
|
/* Start a named common block. This is a block of variables that may
|
| 483 |
|
|
move in memory. */
|
| 484 |
|
|
|
| 485 |
|
|
extern bfd_boolean debug_start_common_block (void *, const char *);
|
| 486 |
|
|
|
| 487 |
|
|
/* End a named common block. */
|
| 488 |
|
|
|
| 489 |
|
|
extern bfd_boolean debug_end_common_block (void *, const char *);
|
| 490 |
|
|
|
| 491 |
|
|
/* Record a named integer constant. */
|
| 492 |
|
|
|
| 493 |
|
|
extern bfd_boolean debug_record_int_const (void *, const char *, bfd_vma);
|
| 494 |
|
|
|
| 495 |
|
|
/* Record a named floating point constant. */
|
| 496 |
|
|
|
| 497 |
|
|
extern bfd_boolean debug_record_float_const (void *, const char *, double);
|
| 498 |
|
|
|
| 499 |
|
|
/* Record a typed constant with an integral value. */
|
| 500 |
|
|
|
| 501 |
|
|
extern bfd_boolean debug_record_typed_const
|
| 502 |
|
|
(void *, const char *, debug_type, bfd_vma);
|
| 503 |
|
|
|
| 504 |
|
|
/* Record a label. */
|
| 505 |
|
|
|
| 506 |
|
|
extern bfd_boolean debug_record_label
|
| 507 |
|
|
(void *, const char *, debug_type, bfd_vma);
|
| 508 |
|
|
|
| 509 |
|
|
/* Record a variable. */
|
| 510 |
|
|
|
| 511 |
|
|
extern bfd_boolean debug_record_variable
|
| 512 |
|
|
(void *, const char *, debug_type, enum debug_var_kind, bfd_vma);
|
| 513 |
|
|
|
| 514 |
|
|
/* Make an indirect type. The first argument is a pointer to the
|
| 515 |
|
|
location where the real type will be placed. The second argument
|
| 516 |
|
|
is the type tag, if there is one; this may be NULL; the only
|
| 517 |
|
|
purpose of this argument is so that debug_get_type_name can return
|
| 518 |
|
|
something useful. This function may be used when a type is
|
| 519 |
|
|
referenced before it is defined. */
|
| 520 |
|
|
|
| 521 |
|
|
extern debug_type debug_make_indirect_type
|
| 522 |
|
|
(void *, debug_type *, const char *);
|
| 523 |
|
|
|
| 524 |
|
|
/* Make a void type. */
|
| 525 |
|
|
|
| 526 |
|
|
extern debug_type debug_make_void_type (void *);
|
| 527 |
|
|
|
| 528 |
|
|
/* Make an integer type of a given size. The bfd_boolean argument is TRUE
|
| 529 |
|
|
if the integer is unsigned. */
|
| 530 |
|
|
|
| 531 |
|
|
extern debug_type debug_make_int_type (void *, unsigned int, bfd_boolean);
|
| 532 |
|
|
|
| 533 |
|
|
/* Make a floating point type of a given size. FIXME: On some
|
| 534 |
|
|
platforms, like an Alpha, you probably need to be able to specify
|
| 535 |
|
|
the format. */
|
| 536 |
|
|
|
| 537 |
|
|
extern debug_type debug_make_float_type (void *, unsigned int);
|
| 538 |
|
|
|
| 539 |
|
|
/* Make a boolean type of a given size. */
|
| 540 |
|
|
|
| 541 |
|
|
extern debug_type debug_make_bool_type (void *, unsigned int);
|
| 542 |
|
|
|
| 543 |
|
|
/* Make a complex type of a given size. */
|
| 544 |
|
|
|
| 545 |
|
|
extern debug_type debug_make_complex_type (void *, unsigned int);
|
| 546 |
|
|
|
| 547 |
|
|
/* Make a structure type. The second argument is TRUE for a struct,
|
| 548 |
|
|
FALSE for a union. The third argument is the size of the struct.
|
| 549 |
|
|
The fourth argument is a NULL terminated array of fields. */
|
| 550 |
|
|
|
| 551 |
|
|
extern debug_type debug_make_struct_type
|
| 552 |
|
|
(void *, bfd_boolean, bfd_vma, debug_field *);
|
| 553 |
|
|
|
| 554 |
|
|
/* Make an object type. The first three arguments after the handle
|
| 555 |
|
|
are the same as for debug_make_struct_type. The next arguments are
|
| 556 |
|
|
a NULL terminated array of base classes, a NULL terminated array of
|
| 557 |
|
|
methods, the type of the object holding the virtual function table
|
| 558 |
|
|
if it is not this object, and a bfd_boolean which is TRUE if this
|
| 559 |
|
|
object has its own virtual function table. */
|
| 560 |
|
|
|
| 561 |
|
|
extern debug_type debug_make_object_type
|
| 562 |
|
|
(void *, bfd_boolean, bfd_vma, debug_field *, debug_baseclass *,
|
| 563 |
|
|
debug_method *, debug_type, bfd_boolean);
|
| 564 |
|
|
|
| 565 |
|
|
/* Make an enumeration type. The arguments are a null terminated
|
| 566 |
|
|
array of strings, and an array of corresponding values. */
|
| 567 |
|
|
|
| 568 |
|
|
extern debug_type debug_make_enum_type
|
| 569 |
|
|
(void *, const char **, bfd_signed_vma *);
|
| 570 |
|
|
|
| 571 |
|
|
/* Make a pointer to a given type. */
|
| 572 |
|
|
|
| 573 |
|
|
extern debug_type debug_make_pointer_type (void *, debug_type);
|
| 574 |
|
|
|
| 575 |
|
|
/* Make a function type. The second argument is the return type. The
|
| 576 |
|
|
third argument is a NULL terminated array of argument types. The
|
| 577 |
|
|
fourth argument is TRUE if the function takes a variable number of
|
| 578 |
|
|
arguments. If the third argument is NULL, then the argument types
|
| 579 |
|
|
are unknown. */
|
| 580 |
|
|
|
| 581 |
|
|
extern debug_type debug_make_function_type
|
| 582 |
|
|
(void *, debug_type, debug_type *, bfd_boolean);
|
| 583 |
|
|
|
| 584 |
|
|
/* Make a reference to a given type. */
|
| 585 |
|
|
|
| 586 |
|
|
extern debug_type debug_make_reference_type (void *, debug_type);
|
| 587 |
|
|
|
| 588 |
|
|
/* Make a range of a given type from a lower to an upper bound. */
|
| 589 |
|
|
|
| 590 |
|
|
extern debug_type debug_make_range_type
|
| 591 |
|
|
(void *, debug_type, bfd_signed_vma, bfd_signed_vma);
|
| 592 |
|
|
|
| 593 |
|
|
/* Make an array type. The second argument is the type of an element
|
| 594 |
|
|
of the array. The third argument is the type of a range of the
|
| 595 |
|
|
array. The fourth and fifth argument are the lower and upper
|
| 596 |
|
|
bounds, respectively (if the bounds are not known, lower should be
|
| 597 |
|
|
|
| 598 |
|
|
array is actually a string, as in C. */
|
| 599 |
|
|
|
| 600 |
|
|
extern debug_type debug_make_array_type
|
| 601 |
|
|
(void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
|
| 602 |
|
|
bfd_boolean);
|
| 603 |
|
|
|
| 604 |
|
|
/* Make a set of a given type. For example, a Pascal set type. The
|
| 605 |
|
|
bfd_boolean argument is TRUE if this set is actually a bitstring, as in
|
| 606 |
|
|
CHILL. */
|
| 607 |
|
|
|
| 608 |
|
|
extern debug_type debug_make_set_type (void *, debug_type, bfd_boolean);
|
| 609 |
|
|
|
| 610 |
|
|
/* Make a type for a pointer which is relative to an object. The
|
| 611 |
|
|
second argument is the type of the object to which the pointer is
|
| 612 |
|
|
relative. The third argument is the type that the pointer points
|
| 613 |
|
|
to. */
|
| 614 |
|
|
|
| 615 |
|
|
extern debug_type debug_make_offset_type (void *, debug_type, debug_type);
|
| 616 |
|
|
|
| 617 |
|
|
/* Make a type for a method function. The second argument is the
|
| 618 |
|
|
return type. The third argument is the domain. The fourth
|
| 619 |
|
|
argument is a NULL terminated array of argument types. The fifth
|
| 620 |
|
|
argument is TRUE if the function takes a variable number of
|
| 621 |
|
|
arguments, in which case the array of argument types indicates the
|
| 622 |
|
|
types of the first arguments. The domain and the argument array
|
| 623 |
|
|
may be NULL, in which case this is a stub method and that
|
| 624 |
|
|
information is not available. Stabs debugging uses this, and gets
|
| 625 |
|
|
the argument types from the mangled name. */
|
| 626 |
|
|
|
| 627 |
|
|
extern debug_type debug_make_method_type
|
| 628 |
|
|
(void *, debug_type, debug_type, debug_type *, bfd_boolean);
|
| 629 |
|
|
|
| 630 |
|
|
/* Make a const qualified version of a given type. */
|
| 631 |
|
|
|
| 632 |
|
|
extern debug_type debug_make_const_type (void *, debug_type);
|
| 633 |
|
|
|
| 634 |
|
|
/* Make a volatile qualified version of a given type. */
|
| 635 |
|
|
|
| 636 |
|
|
extern debug_type debug_make_volatile_type (void *, debug_type);
|
| 637 |
|
|
|
| 638 |
|
|
/* Make an undefined tagged type. For example, a struct which has
|
| 639 |
|
|
been mentioned, but not defined. */
|
| 640 |
|
|
|
| 641 |
|
|
extern debug_type debug_make_undefined_tagged_type
|
| 642 |
|
|
(void *, const char *, enum debug_type_kind);
|
| 643 |
|
|
|
| 644 |
|
|
/* Make a base class for an object. The second argument is the base
|
| 645 |
|
|
class type. The third argument is the bit position of this base
|
| 646 |
|
|
class in the object. The fourth argument is whether this is a
|
| 647 |
|
|
virtual class. The fifth argument is the visibility of the base
|
| 648 |
|
|
class. */
|
| 649 |
|
|
|
| 650 |
|
|
extern debug_baseclass debug_make_baseclass
|
| 651 |
|
|
(void *, debug_type, bfd_vma, bfd_boolean, enum debug_visibility);
|
| 652 |
|
|
|
| 653 |
|
|
/* Make a field for a struct. The second argument is the name. The
|
| 654 |
|
|
third argument is the type of the field. The fourth argument is
|
| 655 |
|
|
the bit position of the field. The fifth argument is the size of
|
| 656 |
|
|
the field (it may be zero). The sixth argument is the visibility
|
| 657 |
|
|
of the field. */
|
| 658 |
|
|
|
| 659 |
|
|
extern debug_field debug_make_field
|
| 660 |
|
|
(void *, const char *, debug_type, bfd_vma, bfd_vma, enum debug_visibility);
|
| 661 |
|
|
|
| 662 |
|
|
/* Make a static member of an object. The second argument is the
|
| 663 |
|
|
name. The third argument is the type of the member. The fourth
|
| 664 |
|
|
argument is the physical name of the member (i.e., the name as a
|
| 665 |
|
|
global variable). The fifth argument is the visibility of the
|
| 666 |
|
|
member. */
|
| 667 |
|
|
|
| 668 |
|
|
extern debug_field debug_make_static_member
|
| 669 |
|
|
(void *, const char *, debug_type, const char *, enum debug_visibility);
|
| 670 |
|
|
|
| 671 |
|
|
/* Make a method. The second argument is the name, and the third
|
| 672 |
|
|
argument is a NULL terminated array of method variants. Each
|
| 673 |
|
|
method variant is a method with this name but with different
|
| 674 |
|
|
argument types. */
|
| 675 |
|
|
|
| 676 |
|
|
extern debug_method debug_make_method
|
| 677 |
|
|
(void *, const char *, debug_method_variant *);
|
| 678 |
|
|
|
| 679 |
|
|
/* Make a method variant. The second argument is the physical name of
|
| 680 |
|
|
the function. The third argument is the type of the function,
|
| 681 |
|
|
probably constructed by debug_make_method_type. The fourth
|
| 682 |
|
|
argument is the visibility. The fifth argument is whether this is
|
| 683 |
|
|
a const function. The sixth argument is whether this is a volatile
|
| 684 |
|
|
function. The seventh argument is the index in the virtual
|
| 685 |
|
|
function table, if any. The eighth argument is the virtual
|
| 686 |
|
|
function context. */
|
| 687 |
|
|
|
| 688 |
|
|
extern debug_method_variant debug_make_method_variant
|
| 689 |
|
|
(void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
|
| 690 |
|
|
bfd_boolean, bfd_vma, debug_type);
|
| 691 |
|
|
|
| 692 |
|
|
/* Make a static method argument. The arguments are the same as for
|
| 693 |
|
|
debug_make_method_variant, except that the last two are omitted
|
| 694 |
|
|
since a static method can not also be virtual. */
|
| 695 |
|
|
|
| 696 |
|
|
extern debug_method_variant debug_make_static_method_variant
|
| 697 |
|
|
(void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
|
| 698 |
|
|
bfd_boolean);
|
| 699 |
|
|
|
| 700 |
|
|
/* Name a type. This returns a new type with an attached name. */
|
| 701 |
|
|
|
| 702 |
|
|
extern debug_type debug_name_type (void *, const char *, debug_type);
|
| 703 |
|
|
|
| 704 |
|
|
/* Give a tag to a type, such as a struct or union. This returns a
|
| 705 |
|
|
new type with an attached tag. */
|
| 706 |
|
|
|
| 707 |
|
|
extern debug_type debug_tag_type (void *, const char *, debug_type);
|
| 708 |
|
|
|
| 709 |
|
|
/* Record the size of a given type. */
|
| 710 |
|
|
|
| 711 |
|
|
extern bfd_boolean debug_record_type_size (void *, debug_type, unsigned int);
|
| 712 |
|
|
|
| 713 |
|
|
/* Find a named type. */
|
| 714 |
|
|
|
| 715 |
|
|
extern debug_type debug_find_named_type (void *, const char *);
|
| 716 |
|
|
|
| 717 |
|
|
/* Find a tagged type. */
|
| 718 |
|
|
|
| 719 |
|
|
extern debug_type debug_find_tagged_type
|
| 720 |
|
|
(void *, const char *, enum debug_type_kind);
|
| 721 |
|
|
|
| 722 |
|
|
/* Get the kind of a type. */
|
| 723 |
|
|
|
| 724 |
|
|
extern enum debug_type_kind debug_get_type_kind (void *, debug_type);
|
| 725 |
|
|
|
| 726 |
|
|
/* Get the name of a type. */
|
| 727 |
|
|
|
| 728 |
|
|
extern const char *debug_get_type_name (void *, debug_type);
|
| 729 |
|
|
|
| 730 |
|
|
/* Get the size of a type. */
|
| 731 |
|
|
|
| 732 |
|
|
extern bfd_vma debug_get_type_size (void *, debug_type);
|
| 733 |
|
|
|
| 734 |
|
|
/* Get the return type of a function or method type. */
|
| 735 |
|
|
|
| 736 |
|
|
extern debug_type debug_get_return_type (void *, debug_type);
|
| 737 |
|
|
|
| 738 |
|
|
/* Get the NULL terminated array of parameter types for a function or
|
| 739 |
|
|
method type (actually, parameter types are not currently stored for
|
| 740 |
|
|
function types). This may be used to determine whether a method
|
| 741 |
|
|
type is a stub method or not. The last argument points to a
|
| 742 |
|
|
bfd_boolean which is set to TRUE if the function takes a variable
|
| 743 |
|
|
number of arguments. */
|
| 744 |
|
|
|
| 745 |
|
|
extern const debug_type *debug_get_parameter_types
|
| 746 |
|
|
(void *, debug_type, bfd_boolean *);
|
| 747 |
|
|
|
| 748 |
|
|
/* Get the target type of a pointer or reference or const or volatile
|
| 749 |
|
|
type. */
|
| 750 |
|
|
|
| 751 |
|
|
extern debug_type debug_get_target_type (void *, debug_type);
|
| 752 |
|
|
|
| 753 |
|
|
/* Get the NULL terminated array of fields for a struct, union, or
|
| 754 |
|
|
class. */
|
| 755 |
|
|
|
| 756 |
|
|
extern const debug_field *debug_get_fields (void *, debug_type);
|
| 757 |
|
|
|
| 758 |
|
|
/* Get the type of a field. */
|
| 759 |
|
|
|
| 760 |
|
|
extern debug_type debug_get_field_type (void *, debug_field);
|
| 761 |
|
|
|
| 762 |
|
|
/* Get the name of a field. */
|
| 763 |
|
|
|
| 764 |
|
|
extern const char *debug_get_field_name (void *, debug_field);
|
| 765 |
|
|
|
| 766 |
|
|
/* Get the bit position of a field within the containing structure.
|
| 767 |
|
|
If the field is a static member, this will return (bfd_vma) -1. */
|
| 768 |
|
|
|
| 769 |
|
|
extern bfd_vma debug_get_field_bitpos (void *, debug_field);
|
| 770 |
|
|
|
| 771 |
|
|
/* Get the bit size of a field. If the field is a static member, this
|
| 772 |
|
|
will return (bfd_vma) -1. */
|
| 773 |
|
|
|
| 774 |
|
|
extern bfd_vma debug_get_field_bitsize (void *, debug_field);
|
| 775 |
|
|
|
| 776 |
|
|
/* Get the visibility of a field. */
|
| 777 |
|
|
|
| 778 |
|
|
extern enum debug_visibility debug_get_field_visibility (void *, debug_field);
|
| 779 |
|
|
|
| 780 |
|
|
/* Get the physical name of a field, if it is a static member. If the
|
| 781 |
|
|
field is not a static member, this will return NULL. */
|
| 782 |
|
|
|
| 783 |
|
|
extern const char *debug_get_field_physname (void *, debug_field);
|
| 784 |
|
|
|
| 785 |
|
|
/* Write out the recorded debugging information. This takes a set of
|
| 786 |
|
|
function pointers which are called to do the actual writing. The
|
| 787 |
|
|
first void * is the debugging handle. The second void * is a handle
|
| 788 |
|
|
which is passed to the functions. */
|
| 789 |
|
|
|
| 790 |
|
|
extern bfd_boolean debug_write
|
| 791 |
|
|
(void *, const struct debug_write_fns *, void *);
|
| 792 |
|
|
|
| 793 |
|
|
#endif /* DEBUG_H */
|