debug.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. /* debug.h -- Describe generic debugging information.
  2. Copyright (C) 1995-2015 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. bfd_boolean (*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. bfd_boolean (*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. bfd_boolean (*empty_type) (void *);
  150. /* Push a void type onto the type stack. */
  151. bfd_boolean (*void_type) (void *);
  152. /* Push an integer type onto the type stack, given the size and
  153. whether it is unsigned. */
  154. bfd_boolean (*int_type) (void *, unsigned int, bfd_boolean);
  155. /* Push a floating type onto the type stack, given the size. */
  156. bfd_boolean (*float_type) (void *, unsigned int);
  157. /* Push a complex type onto the type stack, given the size. */
  158. bfd_boolean (*complex_type) (void *, unsigned int);
  159. /* Push a bfd_boolean type onto the type stack, given the size. */
  160. bfd_boolean (*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. bfd_boolean (*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. bfd_boolean (*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. bfd_boolean (*function_type) (void *, int, bfd_boolean);
  179. /* Pop the top type on the type stack, and push a reference to that
  180. type onto the type stack. */
  181. bfd_boolean (*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. bfd_boolean (*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. bfd_boolean (*array_type)
  191. (void *, bfd_signed_vma, bfd_signed_vma, bfd_boolean);
  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. bfd_boolean (*set_type) (void *, bfd_boolean);
  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. bfd_boolean (*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. bfd_boolean (*method_type) (void *, bfd_boolean, int, bfd_boolean);
  214. /* Pop the top type off the type stack, and push a const qualified
  215. version of that type onto the type stack. */
  216. bfd_boolean (*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. bfd_boolean (*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. bfd_boolean (*start_struct_type)
  230. (void *, const char *, unsigned int, bfd_boolean, 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. bfd_boolean (*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. bfd_boolean (*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. bfd_boolean (*start_class_type)
  251. (void *, const char *, unsigned int, bfd_boolean, unsigned int,
  252. bfd_boolean, bfd_boolean);
  253. /* Add a static member to the class currently being built. The
  254. arguments are the field name, the physical name, and the
  255. visibility. The type must be popped off the type stack. */
  256. bfd_boolean (*class_static_member)
  257. (void *, const char *, const char *, enum debug_visibility);
  258. /* Add a baseclass to the class currently being built. The type of
  259. the baseclass must be popped off the type stack. The arguments
  260. are the bit position, whether the class is virtual, and the
  261. visibility. */
  262. bfd_boolean (*class_baseclass)
  263. (void *, bfd_vma, bfd_boolean, enum debug_visibility);
  264. /* Start adding a method to the class currently being built. This
  265. is followed by calls to class_method_variant and
  266. class_static_method_variant to describe different variants of the
  267. method which take different arguments. The method is finished
  268. with a call to class_end_method. The argument is the method
  269. name. */
  270. bfd_boolean (*class_start_method) (void *, const char *);
  271. /* Describe a variant to the class method currently being built.
  272. The type of the variant must be popped off the type stack. The
  273. second argument is the physical name of the function. The
  274. following arguments are the visibility, whether the variant is
  275. const, whether the variant is volatile, the offset in the virtual
  276. function table, and whether the context is on the type stack
  277. (below the variant type). */
  278. bfd_boolean (*class_method_variant)
  279. (void *, const char *, enum debug_visibility, bfd_boolean,
  280. bfd_boolean, bfd_vma, bfd_boolean);
  281. /* Describe a static variant to the class method currently being
  282. built. The arguments are the same as for class_method_variant,
  283. except that the last two arguments are omitted. The type of the
  284. variant must be popped off the type stack. */
  285. bfd_boolean (*class_static_method_variant)
  286. (void *, const char *, enum debug_visibility, bfd_boolean,
  287. bfd_boolean);
  288. /* Finish describing a class method. */
  289. bfd_boolean (*class_end_method) (void *);
  290. /* Finish describing a class, and push it onto the type stack. */
  291. bfd_boolean (*end_class_type) (void *);
  292. /* Push a type on the stack which was given a name by an earlier
  293. call to typdef. */
  294. bfd_boolean (*typedef_type) (void *, const char *);
  295. /* Push a tagged type on the stack which was defined earlier. If
  296. the second argument is not NULL, the type was defined by a call
  297. to tag. If the second argument is NULL, the type was defined by
  298. a call to start_struct_type or start_class_type with a tag of
  299. NULL and the number of the third argument. Either way, the
  300. fourth argument is the tag kind. Note that this may be called
  301. for a struct (class) being defined, in between the call to
  302. start_struct_type (start_class_type) and the call to
  303. end_struct_type (end_class_type). */
  304. bfd_boolean (*tag_type)
  305. (void *, const char *, unsigned int, enum debug_type_kind);
  306. /* Pop the type stack, and typedef it to the given name. */
  307. bfd_boolean (*typdef) (void *, const char *);
  308. /* Pop the type stack, and declare it as a tagged struct or union or
  309. enum or whatever. The tag passed down here is redundant, since
  310. was also passed when enum_type, start_struct_type, or
  311. start_class_type was called. */
  312. bfd_boolean (*tag) (void *, const char *);
  313. /* This is called to record a named integer constant. */
  314. bfd_boolean (*int_constant) (void *, const char *, bfd_vma);
  315. /* This is called to record a named floating point constant. */
  316. bfd_boolean (*float_constant) (void *, const char *, double);
  317. /* This is called to record a typed integer constant. The type is
  318. popped off the type stack. */
  319. bfd_boolean (*typed_constant) (void *, const char *, bfd_vma);
  320. /* This is called to record a variable. The type is popped off the
  321. type stack. */
  322. bfd_boolean (*variable)
  323. (void *, const char *, enum debug_var_kind, bfd_vma);
  324. /* Start writing out a function. The return type must be popped off
  325. the stack. The bfd_boolean is TRUE if the function is global. This
  326. is followed by calls to function_parameter, followed by block
  327. information. */
  328. bfd_boolean (*start_function) (void *, const char *, bfd_boolean);
  329. /* Record a function parameter for the current function. The type
  330. must be popped off the stack. */
  331. bfd_boolean (*function_parameter)
  332. (void *, const char *, enum debug_parm_kind, bfd_vma);
  333. /* Start writing out a block. There is at least one top level block
  334. per function. Blocks may be nested. The argument is the
  335. starting address of the block. */
  336. bfd_boolean (*start_block) (void *, bfd_vma);
  337. /* Finish writing out a block. The argument is the ending address
  338. of the block. */
  339. bfd_boolean (*end_block) (void *, bfd_vma);
  340. /* Finish writing out a function. */
  341. bfd_boolean (*end_function) (void *);
  342. /* Record line number information for the current compilation unit. */
  343. bfd_boolean (*lineno) (void *, const char *, unsigned long, bfd_vma);
  344. };
  345. /* Exported functions. */
  346. /* The first argument to most of these functions is a handle. This
  347. handle is returned by the debug_init function. The purpose of the
  348. handle is to permit the debugging routines to not use static
  349. variables, and hence to be reentrant. This would be useful for a
  350. program which wanted to handle two executables simultaneously. */
  351. /* Return a debugging handle. */
  352. extern void *debug_init (void);
  353. /* Set the source filename. This implicitly starts a new compilation
  354. unit. */
  355. extern bfd_boolean debug_set_filename (void *, const char *);
  356. /* Change source files to the given file name. This is used for
  357. include files in a single compilation unit. */
  358. extern bfd_boolean debug_start_source (void *, const char *);
  359. /* Record a function definition. This implicitly starts a function
  360. block. The debug_type argument is the type of the return value.
  361. The bfd_boolean indicates whether the function is globally visible.
  362. The bfd_vma is the address of the start of the function. Currently
  363. the parameter types are specified by calls to
  364. debug_record_parameter. */
  365. extern bfd_boolean debug_record_function
  366. (void *, const char *, debug_type, bfd_boolean, bfd_vma);
  367. /* Record a parameter for the current function. */
  368. extern bfd_boolean debug_record_parameter
  369. (void *, const char *, debug_type, enum debug_parm_kind, bfd_vma);
  370. /* End a function definition. The argument is the address where the
  371. function ends. */
  372. extern bfd_boolean debug_end_function (void *, bfd_vma);
  373. /* Start a block in a function. All local information will be
  374. recorded in this block, until the matching call to debug_end_block.
  375. debug_start_block and debug_end_block may be nested. The argument
  376. is the address at which this block starts. */
  377. extern bfd_boolean debug_start_block (void *, bfd_vma);
  378. /* Finish a block in a function. This matches the call to
  379. debug_start_block. The argument is the address at which this block
  380. ends. */
  381. extern bfd_boolean debug_end_block (void *, bfd_vma);
  382. /* Associate a line number in the current source file with a given
  383. address. */
  384. extern bfd_boolean debug_record_line (void *, unsigned long, bfd_vma);
  385. /* Start a named common block. This is a block of variables that may
  386. move in memory. */
  387. extern bfd_boolean debug_start_common_block (void *, const char *);
  388. /* End a named common block. */
  389. extern bfd_boolean debug_end_common_block (void *, const char *);
  390. /* Record a named integer constant. */
  391. extern bfd_boolean debug_record_int_const (void *, const char *, bfd_vma);
  392. /* Record a named floating point constant. */
  393. extern bfd_boolean debug_record_float_const (void *, const char *, double);
  394. /* Record a typed constant with an integral value. */
  395. extern bfd_boolean debug_record_typed_const
  396. (void *, const char *, debug_type, bfd_vma);
  397. /* Record a label. */
  398. extern bfd_boolean debug_record_label
  399. (void *, const char *, debug_type, bfd_vma);
  400. /* Record a variable. */
  401. extern bfd_boolean debug_record_variable
  402. (void *, const char *, debug_type, enum debug_var_kind, bfd_vma);
  403. /* Make an indirect type. The first argument is a pointer to the
  404. location where the real type will be placed. The second argument
  405. is the type tag, if there is one; this may be NULL; the only
  406. purpose of this argument is so that debug_get_type_name can return
  407. something useful. This function may be used when a type is
  408. referenced before it is defined. */
  409. extern debug_type debug_make_indirect_type
  410. (void *, debug_type *, const char *);
  411. /* Make a void type. */
  412. extern debug_type debug_make_void_type (void *);
  413. /* Make an integer type of a given size. The bfd_boolean argument is TRUE
  414. if the integer is unsigned. */
  415. extern debug_type debug_make_int_type (void *, unsigned int, bfd_boolean);
  416. /* Make a floating point type of a given size. FIXME: On some
  417. platforms, like an Alpha, you probably need to be able to specify
  418. the format. */
  419. extern debug_type debug_make_float_type (void *, unsigned int);
  420. /* Make a boolean type of a given size. */
  421. extern debug_type debug_make_bool_type (void *, unsigned int);
  422. /* Make a complex type of a given size. */
  423. extern debug_type debug_make_complex_type (void *, unsigned int);
  424. /* Make a structure type. The second argument is TRUE for a struct,
  425. FALSE for a union. The third argument is the size of the struct.
  426. The fourth argument is a NULL terminated array of fields. */
  427. extern debug_type debug_make_struct_type
  428. (void *, bfd_boolean, bfd_vma, debug_field *);
  429. /* Make an object type. The first three arguments after the handle
  430. are the same as for debug_make_struct_type. The next arguments are
  431. a NULL terminated array of base classes, a NULL terminated array of
  432. methods, the type of the object holding the virtual function table
  433. if it is not this object, and a bfd_boolean which is TRUE if this
  434. object has its own virtual function table. */
  435. extern debug_type debug_make_object_type
  436. (void *, bfd_boolean, bfd_vma, debug_field *, debug_baseclass *,
  437. debug_method *, debug_type, bfd_boolean);
  438. /* Make an enumeration type. The arguments are a null terminated
  439. array of strings, and an array of corresponding values. */
  440. extern debug_type debug_make_enum_type
  441. (void *, const char **, bfd_signed_vma *);
  442. /* Make a pointer to a given type. */
  443. extern debug_type debug_make_pointer_type (void *, debug_type);
  444. /* Make a function type. The second argument is the return type. The
  445. third argument is a NULL terminated array of argument types. The
  446. fourth argument is TRUE if the function takes a variable number of
  447. arguments. If the third argument is NULL, then the argument types
  448. are unknown. */
  449. extern debug_type debug_make_function_type
  450. (void *, debug_type, debug_type *, bfd_boolean);
  451. /* Make a reference to a given type. */
  452. extern debug_type debug_make_reference_type (void *, debug_type);
  453. /* Make a range of a given type from a lower to an upper bound. */
  454. extern debug_type debug_make_range_type
  455. (void *, debug_type, bfd_signed_vma, bfd_signed_vma);
  456. /* Make an array type. The second argument is the type of an element
  457. of the array. The third argument is the type of a range of the
  458. array. The fourth and fifth argument are the lower and upper
  459. bounds, respectively (if the bounds are not known, lower should be
  460. 0 and upper should be -1). The sixth argument is TRUE if this
  461. array is actually a string, as in C. */
  462. extern debug_type debug_make_array_type
  463. (void *, debug_type, debug_type, bfd_signed_vma, bfd_signed_vma,
  464. bfd_boolean);
  465. /* Make a set of a given type. For example, a Pascal set type. The
  466. bfd_boolean argument is TRUE if this set is actually a bitstring, as in
  467. CHILL. */
  468. extern debug_type debug_make_set_type (void *, debug_type, bfd_boolean);
  469. /* Make a type for a pointer which is relative to an object. The
  470. second argument is the type of the object to which the pointer is
  471. relative. The third argument is the type that the pointer points
  472. to. */
  473. extern debug_type debug_make_offset_type (void *, debug_type, debug_type);
  474. /* Make a type for a method function. The second argument is the
  475. return type. The third argument is the domain. The fourth
  476. argument is a NULL terminated array of argument types. The fifth
  477. argument is TRUE if the function takes a variable number of
  478. arguments, in which case the array of argument types indicates the
  479. types of the first arguments. The domain and the argument array
  480. may be NULL, in which case this is a stub method and that
  481. information is not available. Stabs debugging uses this, and gets
  482. the argument types from the mangled name. */
  483. extern debug_type debug_make_method_type
  484. (void *, debug_type, debug_type, debug_type *, bfd_boolean);
  485. /* Make a const qualified version of a given type. */
  486. extern debug_type debug_make_const_type (void *, debug_type);
  487. /* Make a volatile qualified version of a given type. */
  488. extern debug_type debug_make_volatile_type (void *, debug_type);
  489. /* Make an undefined tagged type. For example, a struct which has
  490. been mentioned, but not defined. */
  491. extern debug_type debug_make_undefined_tagged_type
  492. (void *, const char *, enum debug_type_kind);
  493. /* Make a base class for an object. The second argument is the base
  494. class type. The third argument is the bit position of this base
  495. class in the object. The fourth argument is whether this is a
  496. virtual class. The fifth argument is the visibility of the base
  497. class. */
  498. extern debug_baseclass debug_make_baseclass
  499. (void *, debug_type, bfd_vma, bfd_boolean, enum debug_visibility);
  500. /* Make a field for a struct. The second argument is the name. The
  501. third argument is the type of the field. The fourth argument is
  502. the bit position of the field. The fifth argument is the size of
  503. the field (it may be zero). The sixth argument is the visibility
  504. of the field. */
  505. extern debug_field debug_make_field
  506. (void *, const char *, debug_type, bfd_vma, bfd_vma, enum debug_visibility);
  507. /* Make a static member of an object. The second argument is the
  508. name. The third argument is the type of the member. The fourth
  509. argument is the physical name of the member (i.e., the name as a
  510. global variable). The fifth argument is the visibility of the
  511. member. */
  512. extern debug_field debug_make_static_member
  513. (void *, const char *, debug_type, const char *, enum debug_visibility);
  514. /* Make a method. The second argument is the name, and the third
  515. argument is a NULL terminated array of method variants. Each
  516. method variant is a method with this name but with different
  517. argument types. */
  518. extern debug_method debug_make_method
  519. (void *, const char *, debug_method_variant *);
  520. /* Make a method variant. The second argument is the physical name of
  521. the function. The third argument is the type of the function,
  522. probably constructed by debug_make_method_type. The fourth
  523. argument is the visibility. The fifth argument is whether this is
  524. a const function. The sixth argument is whether this is a volatile
  525. function. The seventh argument is the index in the virtual
  526. function table, if any. The eighth argument is the virtual
  527. function context. */
  528. extern debug_method_variant debug_make_method_variant
  529. (void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
  530. bfd_boolean, bfd_vma, debug_type);
  531. /* Make a static method argument. The arguments are the same as for
  532. debug_make_method_variant, except that the last two are omitted
  533. since a static method can not also be virtual. */
  534. extern debug_method_variant debug_make_static_method_variant
  535. (void *, const char *, debug_type, enum debug_visibility, bfd_boolean,
  536. bfd_boolean);
  537. /* Name a type. This returns a new type with an attached name. */
  538. extern debug_type debug_name_type (void *, const char *, debug_type);
  539. /* Give a tag to a type, such as a struct or union. This returns a
  540. new type with an attached tag. */
  541. extern debug_type debug_tag_type (void *, const char *, debug_type);
  542. /* Record the size of a given type. */
  543. extern bfd_boolean debug_record_type_size (void *, debug_type, unsigned int);
  544. /* Find a named type. */
  545. extern debug_type debug_find_named_type (void *, const char *);
  546. /* Find a tagged type. */
  547. extern debug_type debug_find_tagged_type
  548. (void *, const char *, enum debug_type_kind);
  549. /* Get the kind of a type. */
  550. extern enum debug_type_kind debug_get_type_kind (void *, debug_type);
  551. /* Get the name of a type. */
  552. extern const char *debug_get_type_name (void *, debug_type);
  553. /* Get the size of a type. */
  554. extern bfd_vma debug_get_type_size (void *, debug_type);
  555. /* Get the return type of a function or method type. */
  556. extern debug_type debug_get_return_type (void *, debug_type);
  557. /* Get the NULL terminated array of parameter types for a function or
  558. method type (actually, parameter types are not currently stored for
  559. function types). This may be used to determine whether a method
  560. type is a stub method or not. The last argument points to a
  561. bfd_boolean which is set to TRUE if the function takes a variable
  562. number of arguments. */
  563. extern const debug_type *debug_get_parameter_types
  564. (void *, debug_type, bfd_boolean *);
  565. /* Get the target type of a pointer or reference or const or volatile
  566. type. */
  567. extern debug_type debug_get_target_type (void *, debug_type);
  568. /* Get the NULL terminated array of fields for a struct, union, or
  569. class. */
  570. extern const debug_field *debug_get_fields (void *, debug_type);
  571. /* Get the type of a field. */
  572. extern debug_type debug_get_field_type (void *, debug_field);
  573. /* Get the name of a field. */
  574. extern const char *debug_get_field_name (void *, debug_field);
  575. /* Get the bit position of a field within the containing structure.
  576. If the field is a static member, this will return (bfd_vma) -1. */
  577. extern bfd_vma debug_get_field_bitpos (void *, debug_field);
  578. /* Get the bit size of a field. If the field is a static member, this
  579. will return (bfd_vma) -1. */
  580. extern bfd_vma debug_get_field_bitsize (void *, debug_field);
  581. /* Get the visibility of a field. */
  582. extern enum debug_visibility debug_get_field_visibility (void *, debug_field);
  583. /* Get the physical name of a field, if it is a static member. If the
  584. field is not a static member, this will return NULL. */
  585. extern const char *debug_get_field_physname (void *, debug_field);
  586. /* Write out the recorded debugging information. This takes a set of
  587. function pointers which are called to do the actual writing. The
  588. first void * is the debugging handle. The second void * is a handle
  589. which is passed to the functions. */
  590. extern bfd_boolean debug_write
  591. (void *, const struct debug_write_fns *, void *);
  592. #endif /* DEBUG_H */