PageRenderTime 58ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/include/hp-symtab.h

https://github.com/CTSRD-CHERI/binutils
C Header | 1538 lines | 791 code | 128 blank | 619 comment | 0 complexity | a75c5ba97264360430b31b4e96eca106 MD5 | raw file
  1. /* Definitions and structures for reading debug symbols from the
  2. native HP C compiler.
  3. Written by the Center for Software Science at the University of Utah
  4. and by Cygnus Support.
  5. Copyright 1994, 1995, 1998, 1999, 2003 Free Software Foundation, Inc.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
  17. #ifndef HP_SYMTAB_INCLUDED
  18. #define HP_SYMTAB_INCLUDED
  19. /* General information:
  20. This header file defines and describes only the data structures
  21. necessary to read debug symbols produced by the HP C compiler,
  22. HP ANSI C++ compiler, and HP FORTRAN 90 compiler using the
  23. SOM object file format.
  24. (For a full description of the debug format, ftp hpux-symtab.h from
  25. jaguar.cs.utah.edu:/dist).
  26. Additional notes (Rich Title)
  27. This file is a reverse-engineered version of a file called
  28. "symtab.h" which exists internal to HP's Computer Languages Organization
  29. in /CLO/Components/DDE/obj/som/symtab.h. Because HP's version of
  30. the file is copyrighted and not distributed, it is necessary for
  31. GDB to use the reverse-engineered version that follows.
  32. Work was done by Cygnus to reverse-engineer the C subset of symtab.h.
  33. The WDB project has extended this to also contain the C++
  34. symbol definitions, the F90 symbol definitions,
  35. and the DOC (debugging-optimized-code) symbol definitions.
  36. In some cases (the C++ symbol definitions)
  37. I have added internal documentation here that
  38. goes beyond what is supplied in HP's symtab.h. If we someday
  39. unify these files again, the extra comments should be merged back
  40. into HP's symtab.h.
  41. -------------------------------------------------------------------
  42. Debug symbols are contained entirely within an unloadable space called
  43. $DEBUG$. $DEBUG$ contains several subspaces which group related
  44. debug symbols.
  45. $GNTT$ contains information for global variables, types and contants.
  46. $LNTT$ contains information for procedures (including nesting), scoping
  47. information, local variables, types, and constants.
  48. $SLT$ contains source line information so that code addresses may be
  49. mapped to source lines.
  50. $VT$ contains various strings and constants for named objects (variables,
  51. typedefs, functions, etc). Strings are stored as null-terminated character
  52. lists. Constants always begin on word boundaries. The first byte of
  53. the VT must be zero (a null string).
  54. $XT$ is not currently used by GDB.
  55. Many structures within the subspaces point to other structures within
  56. the same subspace, or to structures within a different subspace. These
  57. pointers are represented as a structure index from the beginning of
  58. the appropriate subspace. */
  59. /* Used to describe where a constant is stored. */
  60. enum location_type
  61. {
  62. LOCATION_IMMEDIATE,
  63. LOCATION_PTR,
  64. LOCATION_VT,
  65. };
  66. /* Languages supported by this debug format. Within the data structures
  67. this type is limited to 4 bits for a maximum of 16 languages. */
  68. enum hp_language
  69. {
  70. HP_LANGUAGE_UNKNOWN,
  71. HP_LANGUAGE_C,
  72. HP_LANGUAGE_FORTRAN,
  73. HP_LANGUAGE_F77 = HP_LANGUAGE_FORTRAN,
  74. HP_LANGUAGE_PASCAL,
  75. HP_LANGUAGE_MODCAL,
  76. HP_LANGUAGE_COBOL,
  77. HP_LANGUAGE_BASIC,
  78. HP_LANGUAGE_ADA,
  79. HP_LANGUAGE_CPLUSPLUS,
  80. HP_LANGUAGE_DMPASCAL
  81. };
  82. /* Basic data types available in this debug format. Within the data
  83. structures this type is limited to 5 bits for a maximum of 32 basic
  84. data types. */
  85. enum hp_type
  86. {
  87. HP_TYPE_UNDEFINED, /* 0 */
  88. HP_TYPE_BOOLEAN, /* 1 */
  89. HP_TYPE_CHAR, /* 2 */
  90. HP_TYPE_INT, /* 3 */
  91. HP_TYPE_UNSIGNED_INT, /* 4 */
  92. HP_TYPE_REAL, /* 5 */
  93. HP_TYPE_COMPLEX, /* 6 */
  94. HP_TYPE_STRING200, /* 7 */
  95. HP_TYPE_LONGSTRING200, /* 8 */
  96. HP_TYPE_TEXT, /* 9 */
  97. HP_TYPE_FLABEL, /* 10 */
  98. HP_TYPE_FTN_STRING_SPEC, /* 11 */
  99. HP_TYPE_MOD_STRING_SPEC, /* 12 */
  100. HP_TYPE_PACKED_DECIMAL, /* 13 */
  101. HP_TYPE_REAL_3000, /* 14 */
  102. HP_TYPE_MOD_STRING_3000, /* 15 */
  103. HP_TYPE_ANYPOINTER, /* 16 */
  104. HP_TYPE_GLOBAL_ANYPOINTER, /* 17 */
  105. HP_TYPE_LOCAL_ANYPOINTER, /* 18 */
  106. HP_TYPE_COMPLEXS3000, /* 19 */
  107. HP_TYPE_FTN_STRING_S300_COMPAT, /* 20 */
  108. HP_TYPE_FTN_STRING_VAX_COMPAT, /* 21 */
  109. HP_TYPE_BOOLEAN_S300_COMPAT, /* 22 */
  110. HP_TYPE_BOOLEAN_VAX_COMPAT, /* 23 */
  111. HP_TYPE_WIDE_CHAR, /* 24 */
  112. HP_TYPE_LONG, /* 25 */
  113. HP_TYPE_UNSIGNED_LONG, /* 26 */
  114. HP_TYPE_DOUBLE, /* 27 */
  115. HP_TYPE_TEMPLATE_ARG, /* 28 */
  116. HP_TYPE_VOID /* 29 */
  117. };
  118. /* An immediate name and type table entry.
  119. extension and immediate will always be one.
  120. global will always be zero.
  121. hp_type is the basic type this entry describes.
  122. bitlength is the length in bits for the basic type. */
  123. struct dnttp_immediate
  124. {
  125. unsigned int extension: 1;
  126. unsigned int immediate: 1;
  127. unsigned int global: 1;
  128. unsigned int type: 5;
  129. unsigned int bitlength: 24;
  130. };
  131. /* A nonimmediate name and type table entry.
  132. extension will always be one.
  133. immediate will always be zero.
  134. if global is zero, this entry points into the LNTT
  135. if global is one, this entry points into the GNTT
  136. index is the index within the GNTT or LNTT for this entry. */
  137. struct dnttp_nonimmediate
  138. {
  139. unsigned int extension: 1;
  140. unsigned int immediate: 1;
  141. unsigned int global: 1;
  142. unsigned int index: 29;
  143. };
  144. /* A pointer to an entry in the GNTT and LNTT tables. It has two
  145. forms depending on the type being described.
  146. The immediate form is used for simple entries and is one
  147. word.
  148. The nonimmediate form is used for complex entries and contains
  149. an index into the LNTT or GNTT which describes the entire type.
  150. If a dnttpointer is -1, then it is a NIL entry. */
  151. #define DNTTNIL (-1)
  152. typedef union dnttpointer
  153. {
  154. struct dnttp_immediate dntti;
  155. struct dnttp_nonimmediate dnttp;
  156. int word;
  157. } dnttpointer;
  158. /* An index into the source line table. As with dnttpointers, a sltpointer
  159. of -1 indicates a NIL entry. */
  160. #define SLTNIL (-1)
  161. typedef int sltpointer;
  162. /* Index into DOC (= "Debugging Optimized Code") line table. */
  163. #define LTNIL (-1)
  164. typedef int ltpointer;
  165. /* Index into context table. */
  166. #define CTXTNIL (-1)
  167. typedef int ctxtpointer;
  168. /* Unsigned byte offset into the VT. */
  169. typedef unsigned int vtpointer;
  170. /* A DNTT entry (used within the GNTT and LNTT).
  171. DNTT entries are variable sized objects, but are always a multiple
  172. of 3 words (we call each group of 3 words a "block").
  173. The first bit in each block is an extension bit. This bit is zero
  174. for the first block of a DNTT entry. If the entry requires more
  175. than one block, then this bit is set to one in all blocks after
  176. the first one. */
  177. /* Each DNTT entry describes a particular debug symbol (beginning of
  178. a source file, a function, variables, structures, etc.
  179. The type of the DNTT entry is stored in the "kind" field within the
  180. DNTT entry itself. */
  181. enum dntt_entry_type
  182. {
  183. DNTT_TYPE_NIL = -1,
  184. DNTT_TYPE_SRCFILE,
  185. DNTT_TYPE_MODULE,
  186. DNTT_TYPE_FUNCTION,
  187. DNTT_TYPE_ENTRY,
  188. DNTT_TYPE_BEGIN,
  189. DNTT_TYPE_END,
  190. DNTT_TYPE_IMPORT,
  191. DNTT_TYPE_LABEL,
  192. DNTT_TYPE_FPARAM,
  193. DNTT_TYPE_SVAR,
  194. DNTT_TYPE_DVAR,
  195. DNTT_TYPE_HOLE1,
  196. DNTT_TYPE_CONST,
  197. DNTT_TYPE_TYPEDEF,
  198. DNTT_TYPE_TAGDEF,
  199. DNTT_TYPE_POINTER,
  200. DNTT_TYPE_ENUM,
  201. DNTT_TYPE_MEMENUM,
  202. DNTT_TYPE_SET,
  203. DNTT_TYPE_SUBRANGE,
  204. DNTT_TYPE_ARRAY,
  205. DNTT_TYPE_STRUCT,
  206. DNTT_TYPE_UNION,
  207. DNTT_TYPE_FIELD,
  208. DNTT_TYPE_VARIANT,
  209. DNTT_TYPE_FILE,
  210. DNTT_TYPE_FUNCTYPE,
  211. DNTT_TYPE_WITH,
  212. DNTT_TYPE_COMMON,
  213. DNTT_TYPE_COBSTRUCT,
  214. DNTT_TYPE_XREF,
  215. DNTT_TYPE_SA,
  216. DNTT_TYPE_MACRO,
  217. DNTT_TYPE_BLOCKDATA,
  218. DNTT_TYPE_CLASS_SCOPE,
  219. DNTT_TYPE_REFERENCE,
  220. DNTT_TYPE_PTRMEM,
  221. DNTT_TYPE_PTRMEMFUNC,
  222. DNTT_TYPE_CLASS,
  223. DNTT_TYPE_GENFIELD,
  224. DNTT_TYPE_VFUNC,
  225. DNTT_TYPE_MEMACCESS,
  226. DNTT_TYPE_INHERITANCE,
  227. DNTT_TYPE_FRIEND_CLASS,
  228. DNTT_TYPE_FRIEND_FUNC,
  229. DNTT_TYPE_MODIFIER,
  230. DNTT_TYPE_OBJECT_ID,
  231. DNTT_TYPE_MEMFUNC,
  232. DNTT_TYPE_TEMPLATE,
  233. DNTT_TYPE_TEMPLATE_ARG,
  234. DNTT_TYPE_FUNC_TEMPLATE,
  235. DNTT_TYPE_LINK,
  236. DNTT_TYPE_DYN_ARRAY_DESC,
  237. DNTT_TYPE_DESC_SUBRANGE,
  238. DNTT_TYPE_BEGIN_EXT,
  239. DNTT_TYPE_INLN,
  240. DNTT_TYPE_INLN_LIST,
  241. DNTT_TYPE_ALIAS,
  242. DNTT_TYPE_DOC_FUNCTION,
  243. DNTT_TYPE_DOC_MEMFUNC,
  244. DNTT_TYPE_MAX
  245. };
  246. /* DNTT_TYPE_SRCFILE:
  247. One DNTT_TYPE_SRCFILE symbol is output for the start of each source
  248. file and at the begin and end of an included file. A DNTT_TYPE_SRCFILE
  249. entry is also output before each DNTT_TYPE_FUNC symbol so that debuggers
  250. can determine what file a function was defined in.
  251. LANGUAGE describes the source file's language.
  252. NAME points to an VT entry providing the source file's name.
  253. Note the name used for DNTT_TYPE_SRCFILE entries are exactly as seen
  254. by the compiler (ie they may be relative or absolute). C include files
  255. via <> inclusion must use absolute paths.
  256. ADDRESS points to an SLT entry from which line number and code locations
  257. may be determined. */
  258. struct dntt_type_srcfile
  259. {
  260. unsigned int extension: 1;
  261. unsigned int kind: 10; /* DNTT_TYPE_SRCFILE */
  262. unsigned int language: 4;
  263. unsigned int unused: 17;
  264. vtpointer name;
  265. sltpointer address;
  266. };
  267. /* DNTT_TYPE_MODULE:
  268. A DNTT_TYPE_MODULE symbol is emitted for the start of a pascal
  269. module or C source file. A module indicates a compilation unit
  270. for name-scoping purposes; in that regard there should be
  271. a 1-1 correspondence between GDB "symtab"'s and MODULE symbol records.
  272. Each DNTT_TYPE_MODULE must have an associated DNTT_TYPE_END symbol.
  273. NAME points to a VT entry providing the module's name. Note C
  274. source files are considered nameless modules.
  275. ALIAS point to a VT entry providing a secondary name.
  276. ADDRESS points to an SLT entry from which line number and code locations
  277. may be determined. */
  278. struct dntt_type_module
  279. {
  280. unsigned int extension: 1;
  281. unsigned int kind: 10; /* DNTT_TYPE_MODULE */
  282. unsigned int unused: 21;
  283. vtpointer name;
  284. vtpointer alias;
  285. dnttpointer unused2;
  286. sltpointer address;
  287. };
  288. /* DNTT_TYPE_FUNCTION,
  289. DNTT_TYPE_ENTRY,
  290. DNTT_TYPE_BLOCKDATA,
  291. DNTT_TYPE_MEMFUNC:
  292. A DNTT_TYPE_FUNCTION symbol is emitted for each function definition;
  293. a DNTT_TYPE_ENTRY symbols is used for secondary entry points. Both
  294. symbols used the dntt_type_function structure.
  295. A DNTT_TYPE_BLOCKDATA symbol is emitted ...?
  296. A DNTT_TYPE_MEMFUNC symbol is emitted for inlined member functions (C++).
  297. Each of DNTT_TYPE_FUNCTION must have a matching DNTT_TYPE_END.
  298. GLOBAL is nonzero if the function has global scope.
  299. LANGUAGE describes the function's source language.
  300. OPT_LEVEL describes the optimization level the function was compiled
  301. with.
  302. VARARGS is nonzero if the function uses varargs.
  303. NAME points to a VT entry providing the function's name.
  304. ALIAS points to a VT entry providing a secondary name for the function.
  305. FIRSTPARAM points to a LNTT entry which describes the parameter list.
  306. ADDRESS points to an SLT entry from which line number and code locations
  307. may be determined.
  308. ENTRYADDR is the memory address corresponding the function's entry point
  309. RETVAL points to a LNTT entry describing the function's return value.
  310. LOWADDR is the lowest memory address associated with this function.
  311. HIADDR is the highest memory address associated with this function. */
  312. struct dntt_type_function
  313. {
  314. unsigned int extension: 1;
  315. unsigned int kind: 10; /* DNTT_TYPE_FUNCTION,
  316. DNTT_TYPE_ENTRY,
  317. DNTT_TYPE_BLOCKDATA
  318. or DNTT_TYPE_MEMFUNC */
  319. unsigned int global: 1;
  320. unsigned int language: 4;
  321. unsigned int nest_level: 5;
  322. unsigned int opt_level: 2;
  323. unsigned int varargs: 1;
  324. unsigned int lang_info: 4;
  325. unsigned int inlined: 1;
  326. unsigned int localalloc: 1;
  327. unsigned int expansion: 1;
  328. unsigned int unused: 1;
  329. vtpointer name;
  330. vtpointer alias;
  331. dnttpointer firstparam;
  332. sltpointer address;
  333. CORE_ADDR entryaddr;
  334. dnttpointer retval;
  335. CORE_ADDR lowaddr;
  336. CORE_ADDR hiaddr;
  337. };
  338. /* DNTT_TYPE_BEGIN:
  339. A DNTT_TYPE_BEGIN symbol is emitted to begin a new nested scope.
  340. Every DNTT_TYPE_BEGIN symbol must have a matching DNTT_TYPE_END symbol.
  341. CLASSFLAG is nonzero if this is the beginning of a c++ class definition.
  342. ADDRESS points to an SLT entry from which line number and code locations
  343. may be determined. */
  344. struct dntt_type_begin
  345. {
  346. unsigned int extension: 1;
  347. unsigned int kind: 10;
  348. unsigned int classflag: 1;
  349. unsigned int unused: 20;
  350. sltpointer address;
  351. };
  352. /* DNTT_TYPE_END:
  353. A DNTT_TYPE_END symbol is emitted when closing a scope started by
  354. a DNTT_TYPE_MODULE, DNTT_TYPE_FUNCTION, DNTT_TYPE_WITH,
  355. DNTT_TYPE_COMMON, DNTT_TYPE_BEGIN, and DNTT_TYPE_CLASS_SCOPE symbols.
  356. ENDKIND describes what type of scope the DNTT_TYPE_END is closing
  357. (one of the above 6 kinds).
  358. CLASSFLAG is nonzero if this is the end of a c++ class definition.
  359. ADDRESS points to an SLT entry from which line number and code locations
  360. may be determined.
  361. BEGINSCOPE points to the LNTT entry which opened the scope. */
  362. struct dntt_type_end
  363. {
  364. unsigned int extension: 1;
  365. unsigned int kind: 10;
  366. unsigned int endkind: 10;
  367. unsigned int classflag: 1;
  368. unsigned int unused: 10;
  369. sltpointer address;
  370. dnttpointer beginscope;
  371. };
  372. /* DNTT_TYPE_IMPORT is unused by GDB. */
  373. /* DNTT_TYPE_LABEL is unused by GDB. */
  374. /* DNTT_TYPE_FPARAM:
  375. A DNTT_TYPE_FPARAM symbol is emitted for a function argument. When
  376. chained together the symbols represent an argument list for a function.
  377. REGPARAM is nonzero if this parameter was passed in a register.
  378. INDIRECT is nonzero if this parameter is a pointer to the parameter
  379. (pass by reference or pass by value for large items).
  380. LONGADDR is nonzero if the parameter is a 64bit pointer.
  381. NAME is a pointer into the VT for the parameter's name.
  382. LOCATION describes where the parameter is stored. Depending on the
  383. parameter type LOCATION could be a register number, or an offset
  384. from the stack pointer.
  385. TYPE points to a NTT entry describing the type of this parameter.
  386. NEXTPARAM points to the LNTT entry describing the next parameter. */
  387. struct dntt_type_fparam
  388. {
  389. unsigned int extension: 1;
  390. unsigned int kind: 10;
  391. unsigned int regparam: 1;
  392. unsigned int indirect: 1;
  393. unsigned int longaddr: 1;
  394. unsigned int copyparam: 1;
  395. unsigned int dflt: 1;
  396. unsigned int doc_ranges: 1;
  397. unsigned int misc_kind: 1;
  398. unsigned int unused: 14;
  399. vtpointer name;
  400. CORE_ADDR location;
  401. dnttpointer type;
  402. dnttpointer nextparam;
  403. int misc;
  404. };
  405. /* DNTT_TYPE_SVAR:
  406. A DNTT_TYPE_SVAR is emitted to describe a variable in static storage.
  407. GLOBAL is nonzero if the variable has global scope.
  408. INDIRECT is nonzero if the variable is a pointer to an object.
  409. LONGADDR is nonzero if the variable is in long pointer space.
  410. STATICMEM is nonzero if the variable is a member of a class.
  411. A_UNION is nonzero if the variable is an anonymous union member.
  412. NAME is a pointer into the VT for the variable's name.
  413. LOCATION provides the memory address for the variable.
  414. TYPE is a pointer into either the GNTT or LNTT which describes
  415. the type of this variable. */
  416. struct dntt_type_svar
  417. {
  418. unsigned int extension: 1;
  419. unsigned int kind: 10;
  420. unsigned int global: 1;
  421. unsigned int indirect: 1;
  422. unsigned int longaddr: 1;
  423. unsigned int staticmem: 1;
  424. unsigned int a_union: 1;
  425. unsigned int unused1: 1;
  426. unsigned int thread_specific: 1;
  427. unsigned int unused2: 14;
  428. vtpointer name;
  429. CORE_ADDR location;
  430. dnttpointer type;
  431. unsigned int offset;
  432. unsigned int displacement;
  433. };
  434. /* DNTT_TYPE_DVAR:
  435. A DNTT_TYPE_DVAR is emitted to describe automatic variables and variables
  436. held in registers.
  437. GLOBAL is nonzero if the variable has global scope.
  438. INDIRECT is nonzero if the variable is a pointer to an object.
  439. REGVAR is nonzero if the variable is in a register.
  440. A_UNION is nonzero if the variable is an anonymous union member.
  441. NAME is a pointer into the VT for the variable's name.
  442. LOCATION provides the memory address or register number for the variable.
  443. TYPE is a pointer into either the GNTT or LNTT which describes
  444. the type of this variable. */
  445. struct dntt_type_dvar
  446. {
  447. unsigned int extension: 1;
  448. unsigned int kind: 10;
  449. unsigned int global: 1;
  450. unsigned int indirect: 1;
  451. unsigned int regvar: 1;
  452. unsigned int a_union: 1;
  453. unsigned int unused: 17;
  454. vtpointer name;
  455. int location;
  456. dnttpointer type;
  457. unsigned int offset;
  458. };
  459. /* DNTT_TYPE_CONST:
  460. A DNTT_TYPE_CONST symbol is emitted for program constants.
  461. GLOBAL is nonzero if the constant has global scope.
  462. INDIRECT is nonzero if the constant is a pointer to an object.
  463. LOCATION_TYPE describes where to find the constant's value
  464. (in the VT, memory, or embedded in an instruction).
  465. CLASSMEM is nonzero if the constant is a member of a class.
  466. NAME is a pointer into the VT for the constant's name.
  467. LOCATION provides the memory address, register number or pointer
  468. into the VT for the constant's value.
  469. TYPE is a pointer into either the GNTT or LNTT which describes
  470. the type of this variable. */
  471. struct dntt_type_const
  472. {
  473. unsigned int extension: 1;
  474. unsigned int kind: 10;
  475. unsigned int global: 1;
  476. unsigned int indirect: 1;
  477. unsigned int location_type: 3;
  478. unsigned int classmem: 1;
  479. unsigned int unused: 15;
  480. vtpointer name;
  481. CORE_ADDR location;
  482. dnttpointer type;
  483. unsigned int offset;
  484. unsigned int displacement;
  485. };
  486. /* DNTT_TYPE_TYPEDEF and DNTT_TYPE_TAGDEF:
  487. The same structure is used to describe typedefs and tagdefs.
  488. DNTT_TYPE_TYPEDEFS are associated with C "typedefs".
  489. DNTT_TYPE_TAGDEFs are associated with C "struct", "union", and "enum"
  490. tags, which may have the same name as a typedef in the same scope.
  491. Also they are associated with C++ "class" tags, which implicitly have
  492. the same name as the class type.
  493. GLOBAL is nonzero if the typedef/tagdef has global scope.
  494. TYPEINFO is used to determine if full type information is available
  495. for a tag. (usually 1, but can be zero for opaque types in C).
  496. NAME is a pointer into the VT for the constant's name.
  497. TYPE points to the underlying type for the typedef/tagdef in the
  498. GNTT or LNTT. */
  499. struct dntt_type_type
  500. {
  501. unsigned int extension: 1;
  502. unsigned int kind: 10; /* DNTT_TYPE_TYPEDEF or
  503. DNTT_TYPE_TAGDEF. */
  504. unsigned int global: 1;
  505. unsigned int typeinfo: 1;
  506. unsigned int unused: 19;
  507. vtpointer name;
  508. dnttpointer type; /* Underlying type, which for TAGDEF's may be
  509. DNTT_TYPE_STRUCT, DNTT_TYPE_UNION,
  510. DNTT_TYPE_ENUM, or DNTT_TYPE_CLASS.
  511. For TYPEDEF's other underlying types
  512. are also possible. */
  513. };
  514. /* DNTT_TYPE_POINTER:
  515. Used to describe a pointer to an underlying type.
  516. POINTSTO is a pointer into the GNTT or LNTT for the type which this
  517. pointer points to.
  518. BITLENGTH is the length of the pointer (not the underlying type). */
  519. struct dntt_type_pointer
  520. {
  521. unsigned int extension: 1;
  522. unsigned int kind: 10;
  523. unsigned int unused: 21;
  524. dnttpointer pointsto;
  525. unsigned int bitlength;
  526. };
  527. /* DNTT_TYPE_ENUM:
  528. Used to describe enumerated types.
  529. FIRSTMEM is a pointer to a DNTT_TYPE_MEMENUM in the GNTT/LNTT which
  530. describes the first member (and contains a pointer to the chain of
  531. members).
  532. BITLENGTH is the number of bits used to hold the values of the enum's
  533. members. */
  534. struct dntt_type_enum
  535. {
  536. unsigned int extension: 1;
  537. unsigned int kind: 10;
  538. unsigned int unused: 21;
  539. dnttpointer firstmem;
  540. unsigned int bitlength;
  541. };
  542. /* DNTT_TYPE_MEMENUM
  543. Used to describe members of an enumerated type.
  544. CLASSMEM is nonzero if this member is part of a class.
  545. NAME points into the VT for the name of this member.
  546. VALUE is the value of this enumeration member.
  547. NEXTMEM points to the next DNTT_TYPE_MEMENUM in the chain. */
  548. struct dntt_type_memenum
  549. {
  550. unsigned int extension: 1;
  551. unsigned int kind: 10;
  552. unsigned int classmem: 1;
  553. unsigned int unused: 20;
  554. vtpointer name;
  555. unsigned int value;
  556. dnttpointer nextmem;
  557. };
  558. /* DNTT_TYPE_SET
  559. Used to describe PASCAL "set" type.
  560. DECLARATION describes the bitpacking of the set.
  561. SUBTYPE points to a DNTT entry describing the type of the members.
  562. BITLENGTH is the size of the set. */
  563. struct dntt_type_set
  564. {
  565. unsigned int extension: 1;
  566. unsigned int kind: 10;
  567. unsigned int declaration: 2;
  568. unsigned int unused: 19;
  569. dnttpointer subtype;
  570. unsigned int bitlength;
  571. };
  572. /* DNTT_TYPE_SUBRANGE
  573. Used to describe subrange type.
  574. DYN_LOW describes the lower bound of the subrange:
  575. 00 for a constant lower bound (found in LOWBOUND).
  576. 01 for a dynamic lower bound with the lower bound found in the
  577. memory address pointed to by LOWBOUND.
  578. 10 for a dynamic lower bound described by an variable found in the
  579. DNTT/LNTT (LOWBOUND would be a pointer into the DNTT/LNTT).
  580. DYN_HIGH is similar to DYN_LOW, except it describes the upper bound.
  581. SUBTYPE points to the type of the subrange.
  582. BITLENGTH is the length in bits needed to describe the subrange's
  583. values. */
  584. struct dntt_type_subrange
  585. {
  586. unsigned int extension: 1;
  587. unsigned int kind: 10;
  588. unsigned int dyn_low: 2;
  589. unsigned int dyn_high: 2;
  590. unsigned int unused: 17;
  591. int lowbound;
  592. int highbound;
  593. dnttpointer subtype;
  594. unsigned int bitlength;
  595. };
  596. /* DNTT_TYPE_ARRAY
  597. Used to describe an array type.
  598. DECLARATION describes the bit packing used in the array.
  599. ARRAYISBYTES is nonzero if the field in arraylength describes the
  600. length in bytes rather than in bits. A value of zero is used to
  601. describe an array with size 2**32.
  602. ELEMISBYTES is nonzero if the length if each element in the array
  603. is describes in bytes rather than bits. A value of zero is used
  604. to an element with size 2**32.
  605. ELEMORDER is nonzero if the elements are indexed in increasing order.
  606. JUSTIFIED if the elements are left justified to index zero.
  607. ARRAYLENGTH is the length of the array.
  608. INDEXTYPE is a DNTT pointer to the type used to index the array.
  609. ELEMTYPE is a DNTT pointer to the type for the array elements.
  610. ELEMLENGTH is the length of each element in the array (including
  611. any padding).
  612. Multi-dimensional arrays are represented by ELEMTYPE pointing to
  613. another DNTT_TYPE_ARRAY. */
  614. struct dntt_type_array
  615. {
  616. unsigned int extension: 1;
  617. unsigned int kind: 10;
  618. unsigned int declaration: 2;
  619. unsigned int dyn_low: 2;
  620. unsigned int dyn_high: 2;
  621. unsigned int arrayisbytes: 1;
  622. unsigned int elemisbytes: 1;
  623. unsigned int elemorder: 1;
  624. unsigned int justified: 1;
  625. unsigned int unused: 11;
  626. unsigned int arraylength;
  627. dnttpointer indextype;
  628. dnttpointer elemtype;
  629. unsigned int elemlength;
  630. };
  631. /* DNTT_TYPE_STRUCT
  632. DNTT_TYPE_STRUCT is used to describe a C structure.
  633. DECLARATION describes the bitpacking used.
  634. FIRSTFIELD is a DNTT pointer to the first field of the structure
  635. (each field contains a pointer to the next field, walk the list
  636. to access all fields of the structure).
  637. VARTAGFIELD and VARLIST are used for Pascal variant records.
  638. BITLENGTH is the size of the structure in bits. */
  639. struct dntt_type_struct
  640. {
  641. unsigned int extension: 1;
  642. unsigned int kind: 10;
  643. unsigned int declaration: 2;
  644. unsigned int unused: 19;
  645. dnttpointer firstfield;
  646. dnttpointer vartagfield;
  647. dnttpointer varlist;
  648. unsigned int bitlength;
  649. };
  650. /* DNTT_TYPE_UNION
  651. DNTT_TYPE_UNION is used to describe a C union.
  652. FIRSTFIELD is a DNTT pointer to the beginning of the field chain.
  653. BITLENGTH is the size of the union in bits. */
  654. struct dntt_type_union
  655. {
  656. unsigned int extension: 1;
  657. unsigned int kind: 10;
  658. unsigned int unused: 21;
  659. dnttpointer firstfield;
  660. unsigned int bitlength;
  661. };
  662. /* DNTT_TYPE_FIELD
  663. DNTT_TYPE_FIELD describes one field in a structure or union
  664. or C++ class.
  665. VISIBILITY is used to describe the visibility of the field
  666. (for c++. public = 0, protected = 1, private = 2).
  667. A_UNION is nonzero if this field is a member of an anonymous union.
  668. STATICMEM is nonzero if this field is a static member of a template.
  669. NAME is a pointer into the VT for the name of the field.
  670. BITOFFSET gives the offset of this field in bits from the beginning
  671. of the structure or union this field is a member of.
  672. TYPE is a DNTT pointer to the type describing this field.
  673. BITLENGTH is the size of the entry in bits.
  674. NEXTFIELD is a DNTT pointer to the next field in the chain. */
  675. struct dntt_type_field
  676. {
  677. unsigned int extension: 1;
  678. unsigned int kind: 10;
  679. unsigned int visibility: 2;
  680. unsigned int a_union: 1;
  681. unsigned int staticmem: 1;
  682. unsigned int unused: 17;
  683. vtpointer name;
  684. unsigned int bitoffset;
  685. dnttpointer type;
  686. unsigned int bitlength;
  687. dnttpointer nextfield;
  688. };
  689. /* DNTT_TYPE_VARIANT is unused by GDB. */
  690. /* DNTT_TYPE_FILE is unused by GDB. */
  691. /* DNTT_TYPE_FUNCTYPE
  692. I think this is used to describe a function type (e.g., would
  693. be emitted as part of a function-pointer description).
  694. VARARGS is nonzero if this function uses varargs.
  695. FIRSTPARAM is a DNTT pointer to the first entry in the parameter
  696. chain.
  697. RETVAL is a DNTT pointer to the type of the return value. */
  698. struct dntt_type_functype
  699. {
  700. unsigned int extension: 1;
  701. unsigned int kind: 10;
  702. unsigned int varargs: 1;
  703. unsigned int info: 4;
  704. unsigned int unused: 16;
  705. unsigned int bitlength;
  706. dnttpointer firstparam;
  707. dnttpointer retval;
  708. };
  709. /* DNTT_TYPE_WITH is emitted by C++ to indicate "with" scoping semantics.
  710. (Probably also emitted by PASCAL to support "with"...).
  711. C++ example: Say "memfunc" is a method of class "c", and say
  712. "m" is a data member of class "c". Then from within "memfunc",
  713. it is legal to reference "m" directly (e.g. you don't have to
  714. say "this->m". The symbol table indicates
  715. this by emitting a DNTT_TYPE_WITH symbol within the function "memfunc",
  716. pointing to the type symbol for class "c".
  717. In GDB, this symbol record is unnecessary,
  718. because GDB's symbol lookup algorithm
  719. infers the "with" semantics when it sees a "this" argument to the member
  720. function. So GDB can safely ignore the DNTT_TYPE_WITH record.
  721. A DNTT_TYPE_WITH has a matching DNTT_TYPE_END symbol. */
  722. struct dntt_type_with
  723. {
  724. unsigned int extension: 1; /* always zero */
  725. unsigned int kind: 10; /* always DNTT_TYPE_WITH */
  726. unsigned int addrtype: 2; /* 0 => STATTYPE */
  727. /* 1 => DYNTYPE */
  728. /* 2 => REGTYPE */
  729. unsigned int indirect: 1; /* 1 => pointer to object */
  730. unsigned int longaddr: 1; /* 1 => in long pointer space */
  731. unsigned int nestlevel: 6; /* # of nesting levels back */
  732. unsigned int doc_ranges: 1; /* 1 => location is range list */
  733. unsigned int unused: 10;
  734. long location; /* where stored (allocated) */
  735. sltpointer address;
  736. dnttpointer type; /* type of with expression */
  737. vtpointer name; /* name of with expression */
  738. unsigned long offset; /* byte offset from location */
  739. };
  740. /* DNTT_TYPE_COMMON is unsupported by GDB. */
  741. /* A DNTT_TYPE_COMMON symbol must have a matching DNTT_TYPE_END symbol */
  742. /* DNTT_TYPE_COBSTRUCT is unsupported by GDB. */
  743. /* DNTT_TYPE_XREF is unsupported by GDB. */
  744. /* DNTT_TYPE_SA is unsupported by GDB. */
  745. /* DNTT_TYPE_MACRO is unsupported by GDB */
  746. /* DNTT_TYPE_BLOCKDATA has the same structure as DNTT_TYPE_FUNCTION */
  747. /* The following are the C++ specific SOM records */
  748. /* The purpose of the DNTT_TYPE_CLASS_SCOPE is to bracket C++ methods
  749. and indicate the method name belongs in the "class scope" rather
  750. than in the module they are being defined in. For example:
  751. class c {
  752. ...
  753. void memfunc(); // member function
  754. };
  755. void c::memfunc() // definition of class c's "memfunc"
  756. {
  757. ...
  758. }
  759. main()
  760. {
  761. ...
  762. }
  763. In the above, the name "memfunc" is not directly visible from "main".
  764. I.e., you have to say "break c::memfunc".
  765. If it were a normal function (not a method), it would be visible
  766. via the simple "break memfunc". Since "memfunc" otherwise looks
  767. like a normal FUNCTION in the symbol table, the bracketing
  768. CLASS_SCOPE is what is used to indicate it is really a method.
  769. A DNTT_TYPE_CLASS_SCOPE symbol must have a matching DNTT_TYPE_END symbol. */
  770. struct dntt_type_class_scope
  771. {
  772. unsigned int extension: 1; /* Always zero. */
  773. unsigned int kind: 10; /* Always DNTT_TYPE_CLASS_SCOPE. */
  774. unsigned int unused: 21;
  775. sltpointer address ; /* Pointer to SLT entry. */
  776. dnttpointer type ; /* Pointer to class type DNTT. */
  777. };
  778. /* C++ reference parameter.
  779. The structure of this record is the same as DNTT_TYPE_POINTER -
  780. refer to struct dntt_type_pointer. */
  781. /* The next two describe C++ pointer-to-data-member type, and
  782. pointer-to-member-function type, respectively.
  783. DNTT_TYPE_PTRMEM and DNTT_TYPE_PTRMEMFUNC have the same structure. */
  784. struct dntt_type_ptrmem
  785. {
  786. unsigned int extension: 1; /* Always zero. */
  787. unsigned int kind: 10; /* Always DNTT_TYPE_PTRMEM. */
  788. unsigned int unused: 21;
  789. dnttpointer pointsto ; /* Pointer to class DNTT. */
  790. dnttpointer memtype ; /* Type of member. */
  791. };
  792. struct dntt_type_ptrmemfunc
  793. {
  794. unsigned int extension: 1; /* Always zero. */
  795. unsigned int kind: 10; /* Always DNTT_TYPE_PTRMEMFUNC. */
  796. unsigned int unused: 21;
  797. dnttpointer pointsto ; /* Pointer to class DNTT. */
  798. dnttpointer memtype ; /* Type of member. */
  799. };
  800. /* The DNTT_TYPE_CLASS symbol is emitted to describe a class type.
  801. "memberlist" points to a chained list of FIELD or GENFIELD records
  802. indicating the class members. "parentlist" points to a chained list
  803. of INHERITANCE records indicating classes from which we inherit
  804. fields. */
  805. struct dntt_type_class
  806. {
  807. unsigned int extension: 1; /* Always zero. */
  808. unsigned int kind: 10; /* Always DNTT_TYPE_CLASS. */
  809. unsigned int abstract: 1; /* Is this an abstract class? */
  810. unsigned int class_decl: 2; /* 0=class,1=union,2=struct. */
  811. unsigned int expansion: 1; /* 1=template expansion. */
  812. unsigned int unused: 17;
  813. dnttpointer memberlist ; /* Ptr to chain of [GEN]FIELDs. */
  814. unsigned long vtbl_loc ; /* Offset in obj of ptr to vtbl. */
  815. dnttpointer parentlist ; /* Ptr to K_INHERITANCE list. */
  816. unsigned long bitlength ; /* Total at this level. */
  817. dnttpointer identlist ; /* Ptr to chain of class ident's. */
  818. dnttpointer friendlist ; /* Ptr to K_FRIEND list. */
  819. dnttpointer templateptr ; /* Ptr to template. */
  820. dnttpointer nextexp ; /* Ptr to next expansion. */
  821. };
  822. /* Class members are indicated via either the FIELD record (for
  823. data members, same as for C struct fields), or by the GENFIELD record
  824. (for member functions). */
  825. struct dntt_type_genfield
  826. {
  827. unsigned int extension: 1; /* Always zero. */
  828. unsigned int kind: 10; /* Always DNTT_TYPE_GENFIELD. */
  829. unsigned int visibility: 2; /* Pub = 0, prot = 1, priv = 2. */
  830. unsigned int a_union: 1; /* 1 => anonymous union member. */
  831. unsigned int unused: 18;
  832. dnttpointer field ; /* Pointer to field or qualifier. */
  833. dnttpointer nextfield ; /* Pointer to next field. */
  834. };
  835. /* C++ virtual functions. */
  836. struct dntt_type_vfunc
  837. {
  838. unsigned int extension: 1; /* always zero */
  839. unsigned int kind: 10; /* always DNTT_TYPE_VFUNC */
  840. unsigned int pure: 1; /* pure virtual function ? */
  841. unsigned int unused: 20;
  842. dnttpointer funcptr ; /* points to FUNCTION symbol */
  843. unsigned long vtbl_offset ; /* offset into vtbl for virtual */
  844. };
  845. /* Not precisely sure what this is intended for - DDE ignores it. */
  846. struct dntt_type_memaccess
  847. {
  848. unsigned int extension: 1; /* always zero */
  849. unsigned int kind: 10; /* always DNTT_TYPE_MEMACCESS */
  850. unsigned int unused: 21;
  851. dnttpointer classptr ; /* pointer to base class */
  852. dnttpointer field ; /* pointer field */
  853. };
  854. /* The DNTT_TYPE_INHERITANCE record describes derived classes.
  855. In particular, the "parentlist" field of the CLASS record points
  856. to a list of INHERITANCE records for classes from which we
  857. inherit members. */
  858. struct dntt_type_inheritance
  859. {
  860. unsigned int extension: 1; /* always zero */
  861. unsigned int kind: 10; /* always DNTT_TYPE_INHERITANCE */
  862. unsigned int Virtual: 1; /* virtual base class ? */
  863. unsigned int visibility: 2; /* pub = 0, prot = 1, priv = 2 */
  864. unsigned int unused: 18;
  865. dnttpointer classname ; /* first parent class, if any */
  866. unsigned long offset ; /* offset to start of base class */
  867. dnttpointer next ; /* pointer to next K_INHERITANCE */
  868. unsigned long future[2] ; /* padding to 3-word block end */
  869. };
  870. /* C++ "friend" classes ... */
  871. struct dntt_type_friend_class
  872. {
  873. unsigned int extension: 1; /* always zero */
  874. unsigned int kind: 10; /* always DNTT_TYPE_FRIEND_CLASS */
  875. unsigned int unused: 21;
  876. dnttpointer classptr ; /* pointer to class DNTT */
  877. dnttpointer next ; /* next DNTT_FRIEND */
  878. };
  879. struct dntt_type_friend_func
  880. {
  881. unsigned int extension: 1; /* always zero */
  882. unsigned int kind: 10; /* always DNTT_TYPE_FRIEND_FUNC */
  883. unsigned int unused: 21;
  884. dnttpointer funcptr ; /* pointer to function */
  885. dnttpointer classptr ; /* pointer to class DNTT */
  886. dnttpointer next ; /* next DNTT_FRIEND */
  887. unsigned long future[2] ; /* padding to 3-word block end */
  888. };
  889. /* DDE appears to ignore the DNTT_TYPE_MODIFIER record.
  890. It could perhaps be used to give better "ptype" output in GDB;
  891. otherwise it is probably safe for GDB to ignore it also. */
  892. struct dntt_type_modifier
  893. {
  894. unsigned int extension: 1; /* always zero */
  895. unsigned int kind: 10; /* always DNTT_TYPE_MODIFIER */
  896. unsigned int m_const: 1; /* const */
  897. unsigned int m_static: 1; /* static */
  898. unsigned int m_void: 1; /* void */
  899. unsigned int m_volatile: 1; /* volatile */
  900. unsigned int m_duplicate: 1; /* duplicate */
  901. unsigned int unused: 16;
  902. dnttpointer type ; /* subtype */
  903. unsigned long future ; /* padding to 3-word block end */
  904. };
  905. /* I'm not sure what this was intended for - DDE ignores it. */
  906. struct dntt_type_object_id
  907. {
  908. unsigned int extension: 1; /* always zero */
  909. unsigned int kind: 10; /* always DNTT_TYPE_OBJECT_ID */
  910. unsigned int indirect: 1; /* Is object_ident addr of addr? */
  911. unsigned int unused: 20;
  912. unsigned long object_ident ; /* object identifier */
  913. unsigned long offset ; /* offset to start of base class */
  914. dnttpointer next ; /* pointer to next K_OBJECT_ID */
  915. unsigned long segoffset ; /* for linker fixup */
  916. unsigned long future ; /* padding to 3-word block end */
  917. };
  918. /* No separate dntt_type_memfunc; same as dntt_type_func */
  919. /* Symbol records to support templates. These only get used
  920. in DDE's "describe" output (like GDB's "ptype"). */
  921. /* The TEMPLATE record is the header for a template-class.
  922. Like the CLASS record, a TEMPLATE record has a memberlist that
  923. points to a list of template members. It also has an arglist
  924. pointing to a list of TEMPLATE_ARG records. */
  925. struct dntt_type_template
  926. {
  927. unsigned int extension: 1; /* always zero */
  928. unsigned int kind: 10; /* always DNTT_TYPE_TEMPLATE */
  929. unsigned int abstract: 1; /* is this an abstract class? */
  930. unsigned int class_decl: 2; /* 0=class,1=union,2=struct */
  931. unsigned int unused: 18;
  932. dnttpointer memberlist ; /* ptr to chain of K_[GEN]FIELDs */
  933. long unused2 ; /* offset in obj of ptr to vtbl */
  934. dnttpointer parentlist ; /* ptr to K_INHERITANCE list */
  935. unsigned long bitlength ; /* total at this level */
  936. dnttpointer identlist ; /* ptr to chain of class ident's */
  937. dnttpointer friendlist ; /* ptr to K_FRIEND list */
  938. dnttpointer arglist ; /* ptr to argument list */
  939. dnttpointer expansions ; /* ptr to expansion list */
  940. };
  941. /* Template-class arguments are a list of TEMPL_ARG records
  942. chained together. The "name" field is the name of the formal.
  943. E.g.:
  944. template <class T> class q { ... };
  945. Then "T" is the name of the formal argument. */
  946. struct dntt_type_templ_arg
  947. {
  948. unsigned int extension: 1; /* always zero */
  949. unsigned int kind: 10; /* always DNTT_TYPE_TEMPL_ARG */
  950. unsigned int usagetype: 1; /* 0 type-name 1 expression */
  951. unsigned int unused: 20;
  952. vtpointer name ; /* name of argument */
  953. dnttpointer type ; /* for non type arguments */
  954. dnttpointer nextarg ; /* Next argument if any */
  955. long future[2] ; /* padding to 3-word block end */
  956. };
  957. /* FUNC_TEMPLATE records are sort of like FUNCTION, but are emitted
  958. for template member functions. E.g.,
  959. template <class T> class q
  960. {
  961. ...
  962. void f();
  963. ...
  964. };
  965. Within the list of FIELDs/GENFIELDs defining the member list
  966. of the template "q", "f" would appear as a FUNC_TEMPLATE.
  967. We'll also see instances of FUNCTION "f" records for each
  968. instantiation of the template. */
  969. struct dntt_type_func_template
  970. {
  971. unsigned int extension: 1; /* always zero */
  972. unsigned int kind: 10; /* always DNTT_TYPE_FUNC_TEMPLATE */
  973. unsigned int public: 1; /* 1 => globally visible */
  974. unsigned int language: 4; /* type of language */
  975. unsigned int level: 5; /* nesting level (top level = 0)*/
  976. unsigned int optimize: 2; /* level of optimization */
  977. unsigned int varargs: 1; /* ellipses. Pascal/800 later */
  978. unsigned int info: 4; /* lang-specific stuff; F_xxxx */
  979. unsigned int inlined: 1;
  980. unsigned int localloc: 1; /* 0 at top, 1 at end of block */
  981. unsigned int unused: 2;
  982. vtpointer name ; /* name of function */
  983. vtpointer alias ; /* alternate name, if any */
  984. dnttpointer firstparam ; /* first FPARAM, if any */
  985. dnttpointer retval ; /* return type, if any */
  986. dnttpointer arglist ; /* ptr to argument list */
  987. };
  988. /* LINK is apparently intended to link together function template
  989. definitions with their instantiations. However, it is not clear
  990. why this would be needed, except to provide the information on
  991. a "ptype" command. And as far as I can tell, aCC does not
  992. generate this record. */
  993. struct dntt_type_link
  994. {
  995. unsigned int extension: 1; /* always zero */
  996. unsigned int kind: 10; /* always DNTT_TYPE_LINK */
  997. unsigned int linkKind: 4; /* always LINK_UNKNOWN */
  998. unsigned int unused: 17;
  999. long future1 ; /* expansion */
  1000. dnttpointer ptr1 ; /* link from template */
  1001. dnttpointer ptr2 ; /* to expansion */
  1002. long future[2] ; /* padding to 3-word block end */
  1003. };
  1004. /* end of C++ specific SOM's. */
  1005. /* DNTT_TYPE_DYN_ARRAY_DESC is unused by GDB */
  1006. /* DNTT_TYPE_DESC_SUBRANGE is unused by GDB */
  1007. /* DNTT_TYPE_BEGIN_EXT is unused by GDB */
  1008. /* DNTT_TYPE_INLN is unused by GDB */
  1009. /* DNTT_TYPE_INLN_LIST is unused by GDB */
  1010. /* DNTT_TYPE_ALIAS is unused by GDB */
  1011. struct dntt_type_doc_function
  1012. {
  1013. unsigned int extension: 1; /* always zero */
  1014. unsigned int kind: 10; /* K_DOC_FUNCTION or */
  1015. /* K_DOC_MEMFUNC */
  1016. unsigned int global: 1; /* 1 => globally visible */
  1017. unsigned int language: 4; /* type of language */
  1018. unsigned int level: 5; /* nesting level (top level = 0)*/
  1019. unsigned int optimize: 2; /* level of optimization */
  1020. unsigned int varargs: 1; /* ellipses. Pascal/800 later */
  1021. unsigned int info: 4; /* lang-specific stuff; F_xxxx */
  1022. unsigned int inlined: 1;
  1023. unsigned int localloc: 1; /* 0 at top, 1 at end of block */
  1024. unsigned int expansion: 1; /* 1 = function expansion */
  1025. unsigned int doc_clone: 1;
  1026. vtpointer name; /* name of function */
  1027. vtpointer alias; /* alternate name, if any */
  1028. dnttpointer firstparam; /* first FPARAM, if any */
  1029. sltpointer address; /* code and text locations */
  1030. CORE_ADDR entryaddr; /* address of entry point */
  1031. dnttpointer retval; /* return type, if any */
  1032. CORE_ADDR lowaddr; /* lowest address of function */
  1033. CORE_ADDR hiaddr; /* highest address of function */
  1034. dnttpointer inline_list; /* pointer to first inline */
  1035. ltpointer lt_offset; /* start of frag/cp line table */
  1036. ctxtpointer ctxt_offset; /* start of context table for this routine */
  1037. };
  1038. /* DNTT_TYPE_DOC_MEMFUNC is unused by GDB */
  1039. /* DNTT_TYPE_GENERIC and DNTT_TYPE_BLOCK are convience structures
  1040. so we can examine a DNTT entry in a generic fashion. */
  1041. struct dntt_type_generic
  1042. {
  1043. unsigned int word[9];
  1044. };
  1045. struct dntt_type_block
  1046. {
  1047. unsigned int extension: 1;
  1048. unsigned int kind: 10;
  1049. unsigned int unused: 21;
  1050. unsigned int word[2];
  1051. };
  1052. /* One entry in a DNTT (either the LNTT or GNTT).
  1053. This is a union of the above 60 or so structure definitions. */
  1054. union dnttentry
  1055. {
  1056. struct dntt_type_srcfile dsfile;
  1057. struct dntt_type_module dmodule;
  1058. struct dntt_type_function dfunc;
  1059. struct dntt_type_function dentry;
  1060. struct dntt_type_begin dbegin;
  1061. struct dntt_type_end dend;
  1062. struct dntt_type_fparam dfparam;
  1063. struct dntt_type_svar dsvar;
  1064. struct dntt_type_dvar ddvar;
  1065. struct dntt_type_const dconst;
  1066. struct dntt_type_type dtype;
  1067. struct dntt_type_type dtag;
  1068. struct dntt_type_pointer dptr;
  1069. struct dntt_type_enum denum;
  1070. struct dntt_type_memenum dmember;
  1071. struct dntt_type_set dset;
  1072. struct dntt_type_subrange dsubr;
  1073. struct dntt_type_array darray;
  1074. struct dntt_type_struct dstruct;
  1075. struct dntt_type_union dunion;
  1076. struct dntt_type_field dfield;
  1077. struct dntt_type_functype dfunctype;
  1078. struct dntt_type_with dwith;
  1079. struct dntt_type_function dblockdata;
  1080. struct dntt_type_class_scope dclass_scope;
  1081. struct dntt_type_pointer dreference;
  1082. struct dntt_type_ptrmem dptrmem;
  1083. struct dntt_type_ptrmemfunc dptrmemfunc;
  1084. struct dntt_type_class dclass;
  1085. struct dntt_type_genfield dgenfield;
  1086. struct dntt_type_vfunc dvfunc;
  1087. struct dntt_type_memaccess dmemaccess;
  1088. struct dntt_type_inheritance dinheritance;
  1089. struct dntt_type_friend_class dfriend_class;
  1090. struct dntt_type_friend_func dfriend_func;
  1091. struct dntt_type_modifier dmodifier;
  1092. struct dntt_type_object_id dobject_id;
  1093. struct dntt_type_template dtemplate;
  1094. struct dntt_type_templ_arg dtempl_arg;
  1095. struct dntt_type_func_template dfunc_template;
  1096. struct dntt_type_link dlink;
  1097. struct dntt_type_doc_function ddocfunc;
  1098. struct dntt_type_generic dgeneric;
  1099. struct dntt_type_block dblock;
  1100. };
  1101. /* Source line entry types. */
  1102. enum slttype
  1103. {
  1104. SLT_NORMAL,
  1105. SLT_SRCFILE,
  1106. SLT_MODULE,
  1107. SLT_FUNCTION,
  1108. SLT_ENTRY,
  1109. SLT_BEGIN,
  1110. SLT_END,
  1111. SLT_WITH,
  1112. SLT_EXIT,
  1113. SLT_ASSIST,
  1114. SLT_MARKER,
  1115. SLT_CLASS_SCOPE,
  1116. SLT_INLN,
  1117. SLT_NORMAL_OFFSET,
  1118. };
  1119. /* A normal source line entry. Simply provides a mapping of a source
  1120. line number to a code address.
  1121. SLTDESC will always be SLT_NORMAL or SLT_EXIT. */
  1122. struct slt_normal
  1123. {
  1124. unsigned int sltdesc: 4;
  1125. unsigned int line: 28;
  1126. CORE_ADDR address;
  1127. };
  1128. struct slt_normal_off
  1129. {
  1130. unsigned int sltdesc: 4;
  1131. unsigned int offset: 6;
  1132. unsigned int line: 22;
  1133. CORE_ADDR address;
  1134. };
  1135. /* A special source line entry. Provides a mapping of a declaration
  1136. to a line number. These entries point back into the DNTT which
  1137. references them. */
  1138. struct slt_special
  1139. {
  1140. unsigned int sltdesc: 4;
  1141. unsigned int line: 28;
  1142. dnttpointer backptr;
  1143. };
  1144. /* Used to describe nesting.
  1145. For nested languages, an slt_assist entry must follow each SLT_FUNC
  1146. entry in the SLT. The address field will point forward to the
  1147. first slt_normal entry within the function's scope. */
  1148. struct slt_assist
  1149. {
  1150. unsigned int sltdesc: 4;
  1151. unsigned int unused: 28;
  1152. sltpointer address;
  1153. };
  1154. struct slt_generic
  1155. {
  1156. unsigned int word[2];
  1157. };
  1158. union sltentry
  1159. {
  1160. struct slt_normal snorm;
  1161. struct slt_normal_off snormoff;
  1162. struct slt_special sspec;
  1163. struct slt_assist sasst;
  1164. struct slt_generic sgeneric;
  1165. };
  1166. /* $LINES$ declarations
  1167. This is the line table used for optimized code, which is only present
  1168. in the new $PROGRAM_INFO$ debug space. */
  1169. #define DST_LN_ESCAPE_FLAG1 15
  1170. #define DST_LN_ESCAPE_FLAG2 14
  1171. #define DST_LN_CTX_SPEC1 13
  1172. #define DST_LN_CTX_SPEC2 12
  1173. /* Escape function codes: */
  1174. typedef enum
  1175. {
  1176. dst_ln_pad, /* pad byte */
  1177. dst_ln_escape_1, /* reserved */
  1178. dst_ln_dpc1_dln1, /* 1 byte line delta, 1 byte pc delta */
  1179. dst_ln_dpc2_dln2, /* 2 bytes line delta, 2 bytes pc delta */
  1180. dst_ln_pc4_ln4, /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */
  1181. dst_ln_dpc0_dln1, /* 1 byte line delta, pc delta = 0 */
  1182. dst_ln_ln_off_1, /* statement escape, stmt # = 1 (2nd stmt on line) */
  1183. dst_ln_ln_off, /* statement escape, stmt # = next byte */
  1184. dst_ln_entry, /* entry escape, next byte is entry number */
  1185. dst_ln_exit, /* exit escape */
  1186. dst_ln_stmt_end, /* gap escape, 4 bytes pc delta */
  1187. dst_ln_stmt_cp, /* current stmt is a critical point */
  1188. dst_ln_escape_12, /* reserved */
  1189. dst_ln_escape_13, /* this is an exception site record */
  1190. dst_ln_nxt_byte, /* next byte contains the real escape code */
  1191. dst_ln_end, /* end escape, final entry follows */
  1192. dst_ln_escape1_END_OF_ENUM
  1193. }
  1194. dst_ln_escape1_t;
  1195. typedef enum
  1196. {
  1197. dst_ln_ctx_1, /* next byte describes context switch with 5-bit */
  1198. /* index into the image table and 3-bit run length. */
  1199. /* If run length is 0, end with another cxt specifier or ctx_end */
  1200. dst_ln_ctx_2, /* next 2 bytes switch context: 13 bit index, 3 bit run length */
  1201. dst_ln_ctx_4, /* next 4 bytes switch context: 29 bit index, 3 bit run length */
  1202. dst_ln_ctx_end, /* end current context */
  1203. dst_ln_col_run_1, /* next byte is column position of start of next statement, */
  1204. /* following byte is length of statement */
  1205. dst_ln_col_run_2, /* next 2 bytes is column position of start of next statement, */
  1206. /* following 2 bytes is length of statement */
  1207. dst_ln_init_base1, /* next 4 bytes are absolute PC, followed by 1 byte of line number */
  1208. dst_ln_init_base2, /* next 4 bytes are absolute PC, followed by 2 bytes of line number */
  1209. dst_ln_init_base3, /* next 4 bytes are absolute PC, followed by 3 bytes of line number */
  1210. dst_ln_escape2_END_OF_ENUM
  1211. }
  1212. dst_ln_escape2_t;
  1213. typedef union
  1214. {
  1215. struct
  1216. {
  1217. unsigned int pc_delta : 4; /* 4 bit pc delta */
  1218. int ln_delta : 4; /* 4 bit line number delta */
  1219. }
  1220. delta;
  1221. struct
  1222. {
  1223. unsigned int esc_flag : 4; /* alias for pc_delta */
  1224. unsigned int esc_code : 4; /* escape function code (dst_ln_escape1_t, or ...2_t */
  1225. }
  1226. esc;
  1227. struct
  1228. {
  1229. unsigned int esc_flag : 4; /* dst_ln_ctx_spec1, or dst_ln_ctx_spec2 */
  1230. unsigned int run_length : 2;
  1231. unsigned int ctx_index : 2; /* ...spec2 contains index; ...spec1, index - 4 */
  1232. }
  1233. ctx_spec;
  1234. char sdata; /* signed data byte */
  1235. unsigned char udata; /* unsigned data byte */
  1236. }
  1237. dst_ln_entry_t,
  1238. * dst_ln_entry_ptr_t;
  1239. /* Warning: although the above union occupies only 1 byte the compiler treats
  1240. it as having size 2 (the minimum size of a struct). Therefore a sequence of
  1241. dst_ln_entry_t's cannot be described as an array, and walking through such a
  1242. sequence requires convoluted code such as
  1243. ln_ptr = (dst_ln_entry_ptr_t) (char*) ln_ptr + 1
  1244. We regret the inconvenience. */
  1245. /* Structure for interpreting the byte follow