debug.h revision 218822
1306196Sjkim/* debug.h -- Describe generic debugging information. 2238405Sjkim Copyright 1995, 1996, 2002, 2003 Free Software Foundation, Inc. 3238405Sjkim Written by Ian Lance Taylor <ian@cygnus.com>. 4238405Sjkim 5238405Sjkim This file is part of GNU Binutils. 6238405Sjkim 7238405Sjkim This program is free software; you can redistribute it and/or modify 8238405Sjkim it under the terms of the GNU General Public License as published by 9238405Sjkim the Free Software Foundation; either version 2 of the License, or 10238405Sjkim (at your option) any later version. 11238405Sjkim 12238405Sjkim This program is distributed in the hope that it will be useful, 13238405Sjkim but WITHOUT ANY WARRANTY; without even the implied warranty of 14238405Sjkim MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15238405Sjkim GNU General Public License for more details. 16238405Sjkim 17238405Sjkim You should have received a copy of the GNU General Public License 18238405Sjkim along with this program; if not, write to the Free Software 19238405Sjkim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 20238405Sjkim 02110-1301, USA. */ 21238405Sjkim 22238405Sjkim#ifndef DEBUG_H 23238405Sjkim#define DEBUG_H 24238405Sjkim 25238405Sjkim/* This header file describes a generic debugging information format. 26238405Sjkim We may eventually have readers which convert different formats into 27238405Sjkim this generic format, and writers which write it out. The initial 28238405Sjkim impetus for this was writing a converter from stabs to HP IEEE-695 29238405Sjkim debugging format. */ 30238405Sjkim 31238405Sjkim/* Different kinds of types. */ 32238405Sjkim 33238405Sjkimenum debug_type_kind 34238405Sjkim{ 35238405Sjkim /* Not used. */ 36238405Sjkim DEBUG_KIND_ILLEGAL, 37238405Sjkim /* Indirect via a pointer. */ 38238405Sjkim DEBUG_KIND_INDIRECT, 39238405Sjkim /* Void. */ 40238405Sjkim DEBUG_KIND_VOID, 41276864Sjkim /* Integer. */ 42276864Sjkim DEBUG_KIND_INT, 43238405Sjkim /* Floating point. */ 44238405Sjkim DEBUG_KIND_FLOAT, 45238405Sjkim /* Complex. */ 46238405Sjkim DEBUG_KIND_COMPLEX, 47238405Sjkim /* Boolean. */ 48238405Sjkim DEBUG_KIND_BOOL, 49238405Sjkim /* Struct. */ 50238405Sjkim DEBUG_KIND_STRUCT, 51238405Sjkim /* Union. */ 52238405Sjkim DEBUG_KIND_UNION, 53276864Sjkim /* Class. */ 54276864Sjkim DEBUG_KIND_CLASS, 55276864Sjkim /* Union class (can this really happen?). */ 56238405Sjkim DEBUG_KIND_UNION_CLASS, 57276864Sjkim /* Enumeration type. */ 58276864Sjkim DEBUG_KIND_ENUM, 59276864Sjkim /* Pointer. */ 60276864Sjkim DEBUG_KIND_POINTER, 61276864Sjkim /* Function. */ 62276864Sjkim DEBUG_KIND_FUNCTION, 63238405Sjkim /* Reference. */ 64276864Sjkim DEBUG_KIND_REFERENCE, 65276864Sjkim /* Range. */ 66276864Sjkim DEBUG_KIND_RANGE, 67276864Sjkim /* Array. */ 68276864Sjkim DEBUG_KIND_ARRAY, 69238405Sjkim /* Set. */ 70276864Sjkim DEBUG_KIND_SET, 71238405Sjkim /* Based pointer. */ 72238405Sjkim DEBUG_KIND_OFFSET, 73238405Sjkim /* Method. */ 74238405Sjkim DEBUG_KIND_METHOD, 75238405Sjkim /* Const qualified type. */ 76238405Sjkim DEBUG_KIND_CONST, 77238405Sjkim /* Volatile qualified type. */ 78238405Sjkim DEBUG_KIND_VOLATILE, 79238405Sjkim /* Named type. */ 80238405Sjkim DEBUG_KIND_NAMED, 81238405Sjkim /* Tagged type. */ 82238405Sjkim DEBUG_KIND_TAGGED 83238405Sjkim}; 84238405Sjkim 85238405Sjkim/* Different kinds of variables. */ 86238405Sjkim 87238405Sjkimenum debug_var_kind 88238405Sjkim{ 89238405Sjkim /* Not used. */ 90238405Sjkim DEBUG_VAR_ILLEGAL, 91238405Sjkim /* A global variable. */ 92238405Sjkim DEBUG_GLOBAL, 93238405Sjkim /* A static variable. */ 94238405Sjkim DEBUG_STATIC, 95238405Sjkim /* A local static variable. */ 96238405Sjkim DEBUG_LOCAL_STATIC, 97238405Sjkim /* A local variable. */ 98238405Sjkim DEBUG_LOCAL, 99238405Sjkim /* A register variable. */ 100238405Sjkim DEBUG_REGISTER 101238405Sjkim}; 102238405Sjkim 103238405Sjkim/* Different kinds of function parameters. */ 104238405Sjkim 105238405Sjkimenum debug_parm_kind 106238405Sjkim{ 107238405Sjkim /* Not used. */ 108238405Sjkim DEBUG_PARM_ILLEGAL, 109238405Sjkim /* A stack based parameter. */ 110238405Sjkim DEBUG_PARM_STACK, 111238405Sjkim /* A register parameter. */ 112238405Sjkim DEBUG_PARM_REG, 113238405Sjkim /* A stack based reference parameter. */ 114238405Sjkim DEBUG_PARM_REFERENCE, 115238405Sjkim /* A register reference parameter. */ 116238405Sjkim DEBUG_PARM_REF_REG 117238405Sjkim}; 118238405Sjkim 119238405Sjkim/* Different kinds of visibility. */ 120238405Sjkim 121238405Sjkimenum debug_visibility 122238405Sjkim{ 123238405Sjkim /* A public field (e.g., a field in a C struct). */ 124238405Sjkim DEBUG_VISIBILITY_PUBLIC, 125238405Sjkim /* A protected field. */ 126238405Sjkim DEBUG_VISIBILITY_PROTECTED, 127238405Sjkim /* A private field. */ 128238405Sjkim DEBUG_VISIBILITY_PRIVATE, 129238405Sjkim /* A field which should be ignored. */ 130238405Sjkim DEBUG_VISIBILITY_IGNORE 131238405Sjkim}; 132238405Sjkim 133238405Sjkim/* A type. */ 134238405Sjkim 135238405Sjkimtypedef struct debug_type *debug_type; 136306196Sjkim 137238405Sjkim#define DEBUG_TYPE_NULL ((debug_type) NULL) 138238405Sjkim 139238405Sjkim/* A field in a struct or union. */ 140238405Sjkim 141238405Sjkimtypedef struct debug_field *debug_field; 142238405Sjkim 143238405Sjkim#define DEBUG_FIELD_NULL ((debug_field) NULL) 144238405Sjkim 145238405Sjkim/* A base class for an object. */ 146238405Sjkim 147238405Sjkimtypedef struct debug_baseclass *debug_baseclass; 148238405Sjkim 149238405Sjkim#define DEBUG_BASECLASS_NULL ((debug_baseclass) NULL) 150238405Sjkim 151238405Sjkim/* A method of an object. */ 152238405Sjkim 153238405Sjkimtypedef struct debug_method *debug_method; 154238405Sjkim 155238405Sjkim#define DEBUG_METHOD_NULL ((debug_method) NULL) 156238405Sjkim 157238405Sjkim/* The arguments to a method function of an object. These indicate 158238405Sjkim which method to run. */ 159238405Sjkim 160238405Sjkimtypedef struct debug_method_variant *debug_method_variant; 161238405Sjkim 162238405Sjkim#define DEBUG_METHOD_VARIANT_NULL ((debug_method_variant) NULL) 163238405Sjkim 164238405Sjkim/* This structure is passed to debug_write. It holds function 165238405Sjkim pointers that debug_write will call based on the accumulated 166238405Sjkim debugging information. */ 167273149Sjkim 168273149Sjkimstruct debug_write_fns 169273149Sjkim{ 170273149Sjkim /* This is called at the start of each new compilation unit with the 171273149Sjkim name of the main file in the new unit. */ 172238405Sjkim bfd_boolean (*start_compilation_unit) (void *, const char *); 173238405Sjkim 174273149Sjkim /* This is called at the start of each source file within a 175238405Sjkim compilation unit, before outputting any global information for 176238405Sjkim that file. The argument is the name of the file. */ 177238405Sjkim bfd_boolean (*start_source) (void *, const char *); 178238405Sjkim 179238405Sjkim /* Each writer must keep a stack of types. */ 180238405Sjkim 181238405Sjkim /* Push an empty type onto the type stack. This type can appear if 182238405Sjkim there is a reference to a type which is never defined. */ 183238405Sjkim bfd_boolean (*empty_type) (void *); 184238405Sjkim 185238405Sjkim /* Push a void type onto the type stack. */ 186238405Sjkim bfd_boolean (*void_type) (void *); 187238405Sjkim 188238405Sjkim /* Push an integer type onto the type stack, given the size and 189238405Sjkim whether it is unsigned. */ 190238405Sjkim bfd_boolean (*int_type) (void *, unsigned int, bfd_boolean); 191238405Sjkim 192273149Sjkim /* Push a floating type onto the type stack, given the size. */ 193238405Sjkim bfd_boolean (*float_type) (void *, unsigned int); 194273149Sjkim 195238405Sjkim /* Push a complex type onto the type stack, given the size. */ 196273149Sjkim bfd_boolean (*complex_type) (void *, unsigned int); 197273149Sjkim 198273149Sjkim /* Push a bfd_boolean type onto the type stack, given the size. */ 199273149Sjkim bfd_boolean (*bool_type) (void *, unsigned int); 200273149Sjkim 201238405Sjkim /* Push an enum type onto the type stack, given the tag, a NULL 202273149Sjkim terminated array of names and the associated values. If there is 203238405Sjkim no tag, the tag argument will be NULL. If this is an undefined 204238405Sjkim enum, the names and values arguments will be NULL. */ 205238405Sjkim bfd_boolean (*enum_type) 206238405Sjkim (void *, const char *, const char **, bfd_signed_vma *); 207238405Sjkim 208238405Sjkim /* Pop the top type on the type stack, and push a pointer to that 209238405Sjkim type onto the type stack. */ 210238405Sjkim bfd_boolean (*pointer_type) (void *); 211238405Sjkim 212238405Sjkim /* Push a function type onto the type stack. The second argument 213238405Sjkim indicates the number of argument types that have been pushed onto 214238405Sjkim the stack. If the number of argument types is passed as -1, then 215238405Sjkim the argument types of the function are unknown, and no types have 216238405Sjkim been pushed onto the stack. The third argument is TRUE if the 217238405Sjkim function takes a variable number of arguments. The return type 218238405Sjkim of the function is pushed onto the type stack below the argument 219238405Sjkim types, if any. */ 220238405Sjkim bfd_boolean (*function_type) (void *, int, bfd_boolean); 221238405Sjkim 222238405Sjkim /* Pop the top type on the type stack, and push a reference to that 223238405Sjkim type onto the type stack. */ 224238405Sjkim bfd_boolean (*reference_type) (void *); 225238405Sjkim 226238405Sjkim /* Pop the top type on the type stack, and push a range of that type 227238405Sjkim with the given lower and upper bounds onto the type stack. */ 228238405Sjkim bfd_boolean (*range_type) (void *, bfd_signed_vma, bfd_signed_vma); 229273149Sjkim 230238405Sjkim /* Push an array type onto the type stack. The top type on the type 231238405Sjkim stack is the range, and the next type on the type stack is the 232238405Sjkim element type. These should be popped before the array type is 233246772Sjkim pushed. The arguments are the lower bound, the upper bound, and 234238405Sjkim whether the array is a string. */ 235238405Sjkim bfd_boolean (*array_type) 236238405Sjkim (void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean); 237238405Sjkim 238 /* Pop the top type on the type stack, and push a set of that type 239 onto the type stack. The argument indicates whether this set is 240 a bitstring. */ 241 bfd_boolean (*set_type) (void *, bfd_boolean); 242 243 /* Push an offset type onto the type stack. The top type on the 244 type stack is the target type, and the next type on the type 245 stack is the base type. These should be popped before the offset 246 type is pushed. */ 247 bfd_boolean (*offset_type) (void *); 248 249 /* Push a method type onto the type stack. If the second argument 250 is TRUE, the top type on the stack is the class to which the 251 method belongs; otherwise, the class must be determined by the 252 class to which the method is attached. The third argument is the 253 number of argument types; these are pushed onto the type stack in 254 reverse order (the first type popped is the last argument to the 255 method). A value of -1 for the third argument means that no 256 argument information is available. The fourth argument is TRUE 257 if the function takes a variable number of arguments. The next 258 type on the type stack below the domain and the argument types is 259 the return type of the method. All these types must be popped, 260 and then the method type must be pushed. */ 261 bfd_boolean (*method_type) (void *, bfd_boolean, int, bfd_boolean); 262 263 /* Pop the top type off the type stack, and push a const qualified 264 version of that type onto the type stack. */ 265 bfd_boolean (*const_type) (void *); 266 267 /* Pop the top type off the type stack, and push a volatile 268 qualified version of that type onto the type stack. */ 269 bfd_boolean (*volatile_type) (void *); 270 271 /* Start building a struct. This is followed by calls to the 272 struct_field function, and finished by a call to the 273 end_struct_type function. The second argument is the tag; this 274 will be NULL if there isn't one. If the second argument is NULL, 275 the third argument is a constant identifying this struct for use 276 with tag_type. The fourth argument is TRUE for a struct, FALSE 277 for a union. The fifth argument is the size. If this is an 278 undefined struct or union, the size will be 0 and struct_field 279 will not be called before end_struct_type is called. */ 280 bfd_boolean (*start_struct_type) 281 (void *, const char *, unsigned int, bfd_boolean, unsigned int); 282 283 /* Add a field to the struct type currently being built. The type 284 of the field should be popped off the type stack. The arguments 285 are the name, the bit position, the bit size (may be zero if the 286 field is not packed), and the visibility. */ 287 bfd_boolean (*struct_field) 288 (void *, const char *, bfd_vma, bfd_vma, enum debug_visibility); 289 290 /* Finish building a struct, and push it onto the type stack. */ 291 bfd_boolean (*end_struct_type) (void *); 292 293 /* Start building a class. This is followed by calls to several 294 functions: struct_field, class_static_member, class_baseclass, 295 class_start_method, class_method_variant, 296 class_static_method_variant, and class_end_method. The class is 297 finished by a call to end_class_type. The first five arguments 298 are the same as for start_struct_type. The sixth argument is 299 TRUE if there is a virtual function table; if there is, the 300 seventh argument is TRUE if the virtual function table can be 301 found in the type itself, and is FALSE if the type of the object 302 holding the virtual function table should be popped from the type 303 stack. */ 304 bfd_boolean (*start_class_type) 305 (void *, const char *, unsigned int, bfd_boolean, unsigned int, 306 bfd_boolean, bfd_boolean); 307 308 /* Add a static member to the class currently being built. The 309 arguments are the field name, the physical name, and the 310 visibility. The type must be popped off the type stack. */ 311 bfd_boolean (*class_static_member) 312 (void *, const char *, const char *, enum debug_visibility); 313 314 /* Add a baseclass to the class currently being built. The type of 315 the baseclass must be popped off the type stack. The arguments 316 are the bit position, whether the class is virtual, and the 317 visibility. */ 318 bfd_boolean (*class_baseclass) 319 (void *, bfd_vma, bfd_boolean, enum debug_visibility); 320 321 /* Start adding a method to the class currently being built. This 322 is followed by calls to class_method_variant and 323 class_static_method_variant to describe different variants of the 324 method which take different arguments. The method is finished 325 with a call to class_end_method. The argument is the method 326 name. */ 327 bfd_boolean (*class_start_method) (void *, const char *); 328 329 /* Describe a variant to the class method currently being built. 330 The type of the variant must be popped off the type stack. The 331 second argument is the physical name of the function. The 332 following arguments are the visibility, whether the variant is 333 const, whether the variant is volatile, the offset in the virtual 334 function table, and whether the context is on the type stack 335 (below the variant type). */ 336 bfd_boolean (*class_method_variant) 337 (void *, const char *, enum debug_visibility, bfd_boolean, 338 bfd_boolean, bfd_vma, bfd_boolean); 339 340 /* Describe a static variant to the class method currently being 341 built. The arguments are the same as for class_method_variant, 342 except that the last two arguments are omitted. The type of the 343 variant must be popped off the type stack. */ 344 bfd_boolean (*class_static_method_variant) 345 (void *, const char *, enum debug_visibility, bfd_boolean, 346 bfd_boolean); 347 348 /* Finish describing a class method. */ 349 bfd_boolean (*class_end_method) (void *); 350 351 /* Finish describing a class, and push it onto the type stack. */ 352 bfd_boolean (*end_class_type) (void *); 353 354 /* Push a type on the stack which was given a name by an earlier 355 call to typdef. */ 356 bfd_boolean (*typedef_type) (void *, const char *); 357 358 /* Push a tagged type on the stack which was defined earlier. If 359 the second argument is not NULL, the type was defined by a call 360 to tag. If the second argument is NULL, the type was defined by 361 a call to start_struct_type or start_class_type with a tag of 362 NULL and the number of the third argument. Either way, the 363 fourth argument is the tag kind. Note that this may be called 364 for a struct (class) being defined, in between the call to 365 start_struct_type (start_class_type) and the call to 366 end_struct_type (end_class_type). */ 367 bfd_boolean (*tag_type) 368 (void *, const char *, unsigned int, enum debug_type_kind); 369 370 /* Pop the type stack, and typedef it to the given name. */ 371 bfd_boolean (*typdef) (void *, const char *); 372 373 /* Pop the type stack, and declare it as a tagged struct or union or 374 enum or whatever. The tag passed down here is redundant, since 375 was also passed when enum_type, start_struct_type, or 376 start_class_type was called. */ 377 bfd_boolean (*tag) (void *, const char *); 378 379 /* This is called to record a named integer constant. */ 380 bfd_boolean (*int_constant) (void *, const char *, bfd_vma); 381 382 /* This is called to record a named floating point constant. */ 383 bfd_boolean (*float_constant) (void *, const char *, double); 384 385 /* This is called to record a typed integer constant. The type is 386 popped off the type stack. */ 387 bfd_boolean (*typed_constant) (void *, const char *, bfd_vma); 388 389 /* This is called to record a variable. The type is popped off the 390 type stack. */ 391 bfd_boolean (*variable) 392 (void *, const char *, enum debug_var_kind, bfd_vma); 393 394 /* Start writing out a function. The return type must be popped off 395 the stack. The bfd_boolean is TRUE if the function is global. This 396 is followed by calls to function_parameter, followed by block 397 information. */ 398 bfd_boolean (*start_function) (void *, const char *, bfd_boolean); 399 400 /* Record a function parameter for the current function. The type 401 must be popped off the stack. */ 402 bfd_boolean (*function_parameter) 403 (void *, const char *, enum debug_parm_kind, bfd_vma); 404 405 /* Start writing out a block. There is at least one top level block 406 per function. Blocks may be nested. The argument is the 407 starting address of the block. */ 408 bfd_boolean (*start_block) (void *, bfd_vma); 409 410 /* Finish writing out a block. The argument is the ending address 411 of the block. */ 412 bfd_boolean (*end_block) (void *, bfd_vma); 413 414 /* Finish writing out a function. */ 415 bfd_boolean (*end_function) (void *); 416 417 /* Record line number information for the current compilation unit. */ 418 bfd_boolean (*lineno) (void *, const char *, unsigned long, bfd_vma); 419}; 420 421/* Exported functions. */ 422 423/* The first argument to most of these functions is a handle. This 424 handle is returned by the debug_init function. The purpose of the 425 handle is to permit the debugging routines to not use static 426 variables, and hence to be reentrant. This would be useful for a 427 program which wanted to handle two executables simultaneously. */ 428 429/* Return a debugging handle. */ 430 431extern void *debug_init (void); 432 433/* Set the source filename. This implicitly starts a new compilation 434 unit. */ 435 436extern bfd_boolean debug_set_filename (void *, const char *); 437 438/* Change source files to the given file name. This is used for 439 include files in a single compilation unit. */ 440 441extern bfd_boolean debug_start_source (void *, const char *); 442 443/* Record a function definition. This implicitly starts a function 444 block. The debug_type argument is the type of the return value. 445 The bfd_boolean indicates whether the function is globally visible. 446 The bfd_vma is the address of the start of the function. Currently 447 the parameter types are specified by calls to 448 debug_record_parameter. */ 449 450extern bfd_boolean debug_record_function 451 (void *, const char *, debug_type, bfd_boolean, bfd_vma); 452 453/* Record a parameter for the current function. */ 454 455extern bfd_boolean debug_record_parameter 456 (void *, const char *, debug_type, enum debug_parm_kind, bfd_vma); 457 458/* End a function definition. The argument is the address where the 459 function ends. */ 460 461extern bfd_boolean debug_end_function (void *, bfd_vma); 462 463/* Start a block in a function. All local information will be 464 recorded in this block, until the matching call to debug_end_block. 465 debug_start_block and debug_end_block may be nested. The argument 466 is the address at which this block starts. */ 467 468extern bfd_boolean debug_start_block (void *, bfd_vma); 469 470/* Finish a block in a function. This matches the call to 471 debug_start_block. The argument is the address at which this block 472 ends. */ 473 474extern bfd_boolean debug_end_block (void *, bfd_vma); 475 476/* Associate a line number in the current source file with a given 477 address. */ 478 479extern bfd_boolean debug_record_line (void *, unsigned long, bfd_vma); 480 481/* Start a named common block. This is a block of variables that may 482 move in memory. */ 483 484extern bfd_boolean debug_start_common_block (void *, const char *); 485 486/* End a named common block. */ 487 488extern bfd_boolean debug_end_common_block (void *, const char *); 489 490/* Record a named integer constant. */ 491 492extern bfd_boolean debug_record_int_const (void *, const char *, bfd_vma); 493 494/* Record a named floating point constant. */ 495 496extern bfd_boolean debug_record_float_const (void *, const char *, double); 497 498/* Record a typed constant with an integral value. */ 499 500extern bfd_boolean debug_record_typed_const 501 (void *, const char *, debug_type, bfd_vma); 502 503/* Record a label. */ 504 505extern bfd_boolean debug_record_label 506 (void *, const char *, debug_type, bfd_vma); 507 508/* Record a variable. */ 509 510extern bfd_boolean debug_record_variable 511 (void *, const char *, debug_type, enum debug_var_kind, bfd_vma); 512 513/* Make an indirect type. The first argument is a pointer to the 514 location where the real type will be placed. The second argument 515 is the type tag, if there is one; this may be NULL; the only 516 purpose of this argument is so that debug_get_type_name can return 517 something useful. This function may be used when a type is 518 referenced before it is defined. */ 519 520extern debug_type debug_make_indirect_type 521 (void *, debug_type *, const char *); 522 523/* Make a void type. */ 524 525extern debug_type debug_make_void_type (void *); 526 527/* Make an integer type of a given size. The bfd_boolean argument is TRUE 528 if the integer is unsigned. */ 529 530extern debug_type debug_make_int_type (void *, unsigned int, bfd_boolean); 531 532/* Make a floating point type of a given size. FIXME: On some 533 platforms, like an Alpha, you probably need to be able to specify 534 the format. */ 535 536extern debug_type debug_make_float_type (void *, unsigned int); 537 538/* Make a boolean type of a given size. */ 539 540extern debug_type debug_make_bool_type (void *, unsigned int); 541 542/* Make a complex type of a given size. */ 543 544extern debug_type debug_make_complex_type (void *, unsigned int); 545 546/* Make a structure type. The second argument is TRUE for a struct, 547 FALSE for a union. The third argument is the size of the struct. 548 The fourth argument is a NULL terminated array of fields. */ 549 550extern debug_type debug_make_struct_type 551 (void *, bfd_boolean, bfd_vma, debug_field *); 552 553/* Make an object type. The first three arguments after the handle 554 are the same as for debug_make_struct_type. The next arguments are 555 a NULL terminated array of base classes, a NULL terminated array of 556 methods, the type of the object holding the virtual function table 557 if it is not this object, and a bfd_boolean which is TRUE if this 558 object has its own virtual function table. */ 559 560extern debug_type debug_make_object_type 561 (void *, bfd_boolean, bfd_vma, debug_field *, debug_baseclass *, 562 debug_method *, debug_type, bfd_boolean); 563 564/* Make an enumeration type. The arguments are a null terminated 565 array of strings, and an array of corresponding values. */ 566 567extern debug_type debug_make_enum_type 568 (void *, const char **, bfd_signed_vma *); 569 570/* Make a pointer to a given type. */ 571 572extern debug_type debug_make_pointer_type (void *, debug_type); 573 574/* Make a function type. The second argument is the return type. The 575 third argument is a NULL terminated array of argument types. The 576 fourth argument is TRUE if the function takes a variable number of 577 arguments. If the third argument is NULL, then the argument types 578 are unknown. */ 579 580extern debug_type debug_make_function_type 581 (void *, debug_type, debug_type *, bfd_boolean); 582 583/* Make a reference to a given type. */ 584 585extern debug_type debug_make_reference_type (void *, debug_type); 586 587/* Make a range of a given type from a lower to an upper bound. */ 588 589extern debug_type debug_make_range_type 590 (void *, debug_type, bfd_signed_vma, bfd_signed_vma); 591 592/* Make an array type. The second argument is the type of an element 593 of the array. The third argument is the type of a range of the 594 array. The fourth and fifth argument are the lower and upper 595 bounds, respectively (if the bounds are not known, lower should be 596 0 and upper should be -1). The sixth argument is TRUE if this 597 array is actually a string, as in C. */ 598 599extern debug_type debug_make_array_type 600 (void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma, 601 bfd_boolean); 602 603/* Make a set of a given type. For example, a Pascal set type. The 604 bfd_boolean argument is TRUE if this set is actually a bitstring, as in 605 CHILL. */ 606 607extern debug_type debug_make_set_type (void *, debug_type, bfd_boolean); 608 609/* Make a type for a pointer which is relative to an object. The 610 second argument is the type of the object to which the pointer is 611 relative. The third argument is the type that the pointer points 612 to. */ 613 614extern debug_type debug_make_offset_type (void *, debug_type, debug_type); 615 616/* Make a type for a method function. The second argument is the 617 return type. The third argument is the domain. The fourth 618 argument is a NULL terminated array of argument types. The fifth 619 argument is TRUE if the function takes a variable number of 620 arguments, in which case the array of argument types indicates the 621 types of the first arguments. The domain and the argument array 622 may be NULL, in which case this is a stub method and that 623 information is not available. Stabs debugging uses this, and gets 624 the argument types from the mangled name. */ 625 626extern debug_type debug_make_method_type 627 (void *, debug_type, debug_type, debug_type *, bfd_boolean); 628 629/* Make a const qualified version of a given type. */ 630 631extern debug_type debug_make_const_type (void *, debug_type); 632 633/* Make a volatile qualified version of a given type. */ 634 635extern debug_type debug_make_volatile_type (void *, debug_type); 636 637/* Make an undefined tagged type. For example, a struct which has 638 been mentioned, but not defined. */ 639 640extern debug_type debug_make_undefined_tagged_type 641 (void *, const char *, enum debug_type_kind); 642 643/* Make a base class for an object. The second argument is the base 644 class type. The third argument is the bit position of this base 645 class in the object. The fourth argument is whether this is a 646 virtual class. The fifth argument is the visibility of the base 647 class. */ 648 649extern debug_baseclass debug_make_baseclass 650 (void *, debug_type, bfd_vma, bfd_boolean, enum debug_visibility); 651 652/* Make a field for a struct. The second argument is the name. The 653 third argument is the type of the field. The fourth argument is 654 the bit position of the field. The fifth argument is the size of 655 the field (it may be zero). The sixth argument is the visibility 656 of the field. */ 657 658extern debug_field debug_make_field 659 (void *, const char *, debug_type, bfd_vma, bfd_vma, enum debug_visibility); 660 661/* Make a static member of an object. The second argument is the 662 name. The third argument is the type of the member. The fourth 663 argument is the physical name of the member (i.e., the name as a 664 global variable). The fifth argument is the visibility of the 665 member. */ 666 667extern debug_field debug_make_static_member 668 (void *, const char *, debug_type, const char *, enum debug_visibility); 669 670/* Make a method. The second argument is the name, and the third 671 argument is a NULL terminated array of method variants. Each 672 method variant is a method with this name but with different 673 argument types. */ 674 675extern debug_method debug_make_method 676 (void *, const char *, debug_method_variant *); 677 678/* Make a method variant. The second argument is the physical name of 679 the function. The third argument is the type of the function, 680 probably constructed by debug_make_method_type. The fourth 681 argument is the visibility. The fifth argument is whether this is 682 a const function. The sixth argument is whether this is a volatile 683 function. The seventh argument is the index in the virtual 684 function table, if any. The eighth argument is the virtual 685 function context. */ 686 687extern debug_method_variant debug_make_method_variant 688 (void *, const char *, debug_type, enum debug_visibility, bfd_boolean, 689 bfd_boolean, bfd_vma, debug_type); 690 691/* Make a static method argument. The arguments are the same as for 692 debug_make_method_variant, except that the last two are omitted 693 since a static method can not also be virtual. */ 694 695extern debug_method_variant debug_make_static_method_variant 696 (void *, const char *, debug_type, enum debug_visibility, bfd_boolean, 697 bfd_boolean); 698 699/* Name a type. This returns a new type with an attached name. */ 700 701extern debug_type debug_name_type (void *, const char *, debug_type); 702 703/* Give a tag to a type, such as a struct or union. This returns a 704 new type with an attached tag. */ 705 706extern debug_type debug_tag_type (void *, const char *, debug_type); 707 708/* Record the size of a given type. */ 709 710extern bfd_boolean debug_record_type_size (void *, debug_type, unsigned int); 711 712/* Find a named type. */ 713 714extern debug_type debug_find_named_type (void *, const char *); 715 716/* Find a tagged type. */ 717 718extern debug_type debug_find_tagged_type 719 (void *, const char *, enum debug_type_kind); 720 721/* Get the kind of a type. */ 722 723extern enum debug_type_kind debug_get_type_kind (void *, debug_type); 724 725/* Get the name of a type. */ 726 727extern const char *debug_get_type_name (void *, debug_type); 728 729/* Get the size of a type. */ 730 731extern bfd_vma debug_get_type_size (void *, debug_type); 732 733/* Get the return type of a function or method type. */ 734 735extern debug_type debug_get_return_type (void *, debug_type); 736 737/* Get the NULL terminated array of parameter types for a function or 738 method type (actually, parameter types are not currently stored for 739 function types). This may be used to determine whether a method 740 type is a stub method or not. The last argument points to a 741 bfd_boolean which is set to TRUE if the function takes a variable 742 number of arguments. */ 743 744extern const debug_type *debug_get_parameter_types 745 (void *, debug_type, bfd_boolean *); 746 747/* Get the target type of a pointer or reference or const or volatile 748 type. */ 749 750extern debug_type debug_get_target_type (void *, debug_type); 751 752/* Get the NULL terminated array of fields for a struct, union, or 753 class. */ 754 755extern const debug_field *debug_get_fields (void *, debug_type); 756 757/* Get the type of a field. */ 758 759extern debug_type debug_get_field_type (void *, debug_field); 760 761/* Get the name of a field. */ 762 763extern const char *debug_get_field_name (void *, debug_field); 764 765/* Get the bit position of a field within the containing structure. 766 If the field is a static member, this will return (bfd_vma) -1. */ 767 768extern bfd_vma debug_get_field_bitpos (void *, debug_field); 769 770/* Get the bit size of a field. If the field is a static member, this 771 will return (bfd_vma) -1. */ 772 773extern bfd_vma debug_get_field_bitsize (void *, debug_field); 774 775/* Get the visibility of a field. */ 776 777extern enum debug_visibility debug_get_field_visibility (void *, debug_field); 778 779/* Get the physical name of a field, if it is a static member. If the 780 field is not a static member, this will return NULL. */ 781 782extern const char *debug_get_field_physname (void *, debug_field); 783 784/* Write out the recorded debugging information. This takes a set of 785 function pointers which are called to do the actual writing. The 786 first void * is the debugging handle. The second void * is a handle 787 which is passed to the functions. */ 788 789extern bfd_boolean debug_write 790 (void *, const struct debug_write_fns *, void *); 791 792#endif /* DEBUG_H */ 793