debug.h 29 KB

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