Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

4580 rindas
180KB

  1. This is stabs.info, produced by makeinfo version 6.5 from stabs.texinfo.
  2. Copyright (C) 1992-2020 Free Software Foundation, Inc. Contributed by
  3. Cygnus Support. Written by Julia Menapace, Jim Kingdon, and David
  4. MacKenzie.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3 or
  7. any later version published by the Free Software Foundation; with no
  8. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  9. Texts. A copy of the license is included in the section entitled "GNU
  10. Free Documentation License".
  11. INFO-DIR-SECTION Software development
  12. START-INFO-DIR-ENTRY
  13. * Stabs: (stabs). The "stabs" debugging information format.
  14. END-INFO-DIR-ENTRY
  15. This document describes the stabs debugging symbol tables.
  16. Copyright (C) 1992-2020 Free Software Foundation, Inc. Contributed
  17. by Cygnus Support. Written by Julia Menapace, Jim Kingdon, and David
  18. MacKenzie.
  19. Permission is granted to copy, distribute and/or modify this document
  20. under the terms of the GNU Free Documentation License, Version 1.3 or
  21. any later version published by the Free Software Foundation; with no
  22. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  23. Texts. A copy of the license is included in the section entitled "GNU
  24. Free Documentation License".
  25. 
  26. File: stabs.info, Node: Top, Next: Overview, Up: (dir)
  27. The "stabs" representation of debugging information
  28. ***************************************************
  29. This document describes the stabs debugging format.
  30. * Menu:
  31. * Overview:: Overview of stabs
  32. * Program Structure:: Encoding of the structure of the program
  33. * Constants:: Constants
  34. * Variables::
  35. * Types:: Type definitions
  36. * Macro define and undefine:: Representation of #define and #undef
  37. * Symbol Tables:: Symbol information in symbol tables
  38. * Cplusplus:: Stabs specific to C++
  39. * Stab Types:: Symbol types in a.out files
  40. * Symbol Descriptors:: Table of symbol descriptors
  41. * Type Descriptors:: Table of type descriptors
  42. * Expanded Reference:: Reference information by stab type
  43. * Questions:: Questions and anomalies
  44. * Stab Sections:: In some object file formats, stabs are
  45. in sections.
  46. * GNU Free Documentation License:: The license for this documentation
  47. * Symbol Types Index:: Index of symbolic stab symbol type names.
  48. 
  49. File: stabs.info, Node: Overview, Next: Program Structure, Prev: Top, Up: Top
  50. 1 Overview of Stabs
  51. *******************
  52. "Stabs" refers to a format for information that describes a program to a
  53. debugger. This format was apparently invented by Peter Kessler at the
  54. University of California at Berkeley, for the 'pdx' Pascal debugger; the
  55. format has spread widely since then.
  56. This document is one of the few published sources of documentation on
  57. stabs. It is believed to be comprehensive for stabs used by C. The
  58. lists of symbol descriptors (*note Symbol Descriptors::) and type
  59. descriptors (*note Type Descriptors::) are believed to be completely
  60. comprehensive. Stabs for COBOL-specific features and for variant
  61. records (used by Pascal and Modula-2) are poorly documented here.
  62. Other sources of information on stabs are 'Dbx and Dbxtool
  63. Interfaces', 2nd edition, by Sun, 1988, and 'AIX Version 3.2 Files
  64. Reference', Fourth Edition, September 1992, "dbx Stabstring Grammar" in
  65. the a.out section, page 2-31. This document is believed to incorporate
  66. the information from those two sources except where it explicitly
  67. directs you to them for more information.
  68. * Menu:
  69. * Flow:: Overview of debugging information flow
  70. * Stabs Format:: Overview of stab format
  71. * String Field:: The string field
  72. * C Example:: A simple example in C source
  73. * Assembly Code:: The simple example at the assembly level
  74. 
  75. File: stabs.info, Node: Flow, Next: Stabs Format, Up: Overview
  76. 1.1 Overview of Debugging Information Flow
  77. ==========================================
  78. The GNU C compiler compiles C source in a '.c' file into assembly
  79. language in a '.s' file, which the assembler translates into a '.o'
  80. file, which the linker combines with other '.o' files and libraries to
  81. produce an executable file.
  82. With the '-g' option, GCC puts in the '.s' file additional debugging
  83. information, which is slightly transformed by the assembler and linker,
  84. and carried through into the final executable. This debugging
  85. information describes features of the source file like line numbers, the
  86. types and scopes of variables, and function names, parameters, and
  87. scopes.
  88. For some object file formats, the debugging information is
  89. encapsulated in assembler directives known collectively as "stab"
  90. (symbol table) directives, which are interspersed with the generated
  91. code. Stabs are the native format for debugging information in the
  92. a.out and XCOFF object file formats. The GNU tools can also emit stabs
  93. in the COFF and ECOFF object file formats.
  94. The assembler adds the information from stabs to the symbol
  95. information it places by default in the symbol table and the string
  96. table of the '.o' file it is building. The linker consolidates the '.o'
  97. files into one executable file, with one symbol table and one string
  98. table. Debuggers use the symbol and string tables in the executable as
  99. a source of debugging information about the program.
  100. 
  101. File: stabs.info, Node: Stabs Format, Next: String Field, Prev: Flow, Up: Overview
  102. 1.2 Overview of Stab Format
  103. ===========================
  104. There are three overall formats for stab assembler directives,
  105. differentiated by the first word of the stab. The name of the directive
  106. describes which combination of four possible data fields follows. It is
  107. either '.stabs' (string), '.stabn' (number), or '.stabd' (dot). IBM's
  108. XCOFF assembler uses '.stabx' (and some other directives such as '.file'
  109. and '.bi') instead of '.stabs', '.stabn' or '.stabd'.
  110. The overall format of each class of stab is:
  111. .stabs "STRING",TYPE,OTHER,DESC,VALUE
  112. .stabn TYPE,OTHER,DESC,VALUE
  113. .stabd TYPE,OTHER,DESC
  114. .stabx "STRING",VALUE,TYPE,SDB-TYPE
  115. For '.stabn' and '.stabd', there is no STRING (the 'n_strx' field is
  116. zero; see *note Symbol Tables::). For '.stabd', the VALUE field is
  117. implicit and has the value of the current file location. For '.stabx',
  118. the SDB-TYPE field is unused for stabs and can always be set to zero.
  119. The OTHER field is almost always unused and can be set to zero.
  120. The number in the TYPE field gives some basic information about which
  121. type of stab this is (or whether it _is_ a stab, as opposed to an
  122. ordinary symbol). Each valid type number defines a different stab type;
  123. further, the stab type defines the exact interpretation of, and possible
  124. values for, any remaining STRING, DESC, or VALUE fields present in the
  125. stab. *Note Stab Types::, for a list in numeric order of the valid TYPE
  126. field values for stab directives.
  127. 
  128. File: stabs.info, Node: String Field, Next: C Example, Prev: Stabs Format, Up: Overview
  129. 1.3 The String Field
  130. ====================
  131. For most stabs the string field holds the meat of the debugging
  132. information. The flexible nature of this field is what makes stabs
  133. extensible. For some stab types the string field contains only a name.
  134. For other stab types the contents can be a great deal more complex.
  135. The overall format of the string field for most stab types is:
  136. "NAME:SYMBOL-DESCRIPTOR TYPE-INFORMATION"
  137. NAME is the name of the symbol represented by the stab; it can
  138. contain a pair of colons (*note Nested Symbols::). NAME can be omitted,
  139. which means the stab represents an unnamed object. For example,
  140. ':t10=*2' defines type 10 as a pointer to type 2, but does not give the
  141. type a name. Omitting the NAME field is supported by AIX dbx and GDB
  142. after about version 4.8, but not other debuggers. GCC sometimes uses a
  143. single space as the name instead of omitting the name altogether;
  144. apparently that is supported by most debuggers.
  145. The SYMBOL-DESCRIPTOR following the ':' is an alphabetic character
  146. that tells more specifically what kind of symbol the stab represents.
  147. If the SYMBOL-DESCRIPTOR is omitted, but type information follows, then
  148. the stab represents a local variable. For a list of symbol descriptors,
  149. see *note Symbol Descriptors::. The 'c' symbol descriptor is an
  150. exception in that it is not followed by type information. *Note
  151. Constants::.
  152. TYPE-INFORMATION is either a TYPE-NUMBER, or 'TYPE-NUMBER='. A
  153. TYPE-NUMBER alone is a type reference, referring directly to a type that
  154. has already been defined.
  155. The 'TYPE-NUMBER=' form is a type definition, where the number
  156. represents a new type which is about to be defined. The type definition
  157. may refer to other types by number, and those type numbers may be
  158. followed by '=' and nested definitions. Also, the Lucid compiler will
  159. repeat 'TYPE-NUMBER=' more than once if it wants to define several type
  160. numbers at once.
  161. In a type definition, if the character that follows the equals sign
  162. is non-numeric then it is a TYPE-DESCRIPTOR, and tells what kind of type
  163. is about to be defined. Any other values following the TYPE-DESCRIPTOR
  164. vary, depending on the TYPE-DESCRIPTOR. *Note Type Descriptors::, for a
  165. list of TYPE-DESCRIPTOR values. If a number follows the '=' then the
  166. number is a TYPE-REFERENCE. For a full description of types, *note
  167. Types::.
  168. A TYPE-NUMBER is often a single number. The GNU and Sun tools
  169. additionally permit a TYPE-NUMBER to be a pair
  170. (FILE-NUMBER,FILETYPE-NUMBER) (the parentheses appear in the string, and
  171. serve to distinguish the two cases). The FILE-NUMBER is 0 for the base
  172. source file, 1 for the first included file, 2 for the next, and so on.
  173. The FILETYPE-NUMBER is a number starting with 1 which is incremented for
  174. each new type defined in the file. (Separating the file number and the
  175. type number permits the 'N_BINCL' optimization to succeed more often;
  176. see *note Include Files::).
  177. There is an AIX extension for type attributes. Following the '=' are
  178. any number of type attributes. Each one starts with '@' and ends with
  179. ';'. Debuggers, including AIX's dbx and GDB 4.10, skip any type
  180. attributes they do not recognize. GDB 4.9 and other versions of dbx may
  181. not do this. Because of a conflict with C++ (*note Cplusplus::), new
  182. attributes should not be defined which begin with a digit, '(', or '-';
  183. GDB may be unable to distinguish those from the C++ type descriptor '@'.
  184. The attributes are:
  185. 'aBOUNDARY'
  186. BOUNDARY is an integer specifying the alignment. I assume it
  187. applies to all variables of this type.
  188. 'pINTEGER'
  189. Pointer class (for checking). Not sure what this means, or how
  190. INTEGER is interpreted.
  191. 'P'
  192. Indicate this is a packed type, meaning that structure fields or
  193. array elements are placed more closely in memory, to save memory at
  194. the expense of speed.
  195. 'sSIZE'
  196. Size in bits of a variable of this type. This is fully supported
  197. by GDB 4.11 and later.
  198. 'S'
  199. Indicate that this type is a string instead of an array of
  200. characters, or a bitstring instead of a set. It doesn't change the
  201. layout of the data being represented, but does enable the debugger
  202. to know which type it is.
  203. 'V'
  204. Indicate that this type is a vector instead of an array. The only
  205. major difference between vectors and arrays is that vectors are
  206. passed by value instead of by reference (vector coprocessor
  207. extension).
  208. All of this can make the string field quite long. All versions of
  209. GDB, and some versions of dbx, can handle arbitrarily long strings. But
  210. many versions of dbx (or assemblers or linkers, I'm not sure which)
  211. cretinously limit the strings to about 80 characters, so compilers which
  212. must work with such systems need to split the '.stabs' directive into
  213. several '.stabs' directives. Each stab duplicates every field except
  214. the string field. The string field of every stab except the last is
  215. marked as continued with a backslash at the end (in the assembly code
  216. this may be written as a double backslash, depending on the assembler).
  217. Removing the backslashes and concatenating the string fields of each
  218. stab produces the original, long string. Just to be incompatible (or so
  219. they don't have to worry about what the assembler does with
  220. backslashes), AIX can use '?' instead of backslash.
  221. 
  222. File: stabs.info, Node: C Example, Next: Assembly Code, Prev: String Field, Up: Overview
  223. 1.4 A Simple Example in C Source
  224. ================================
  225. To get the flavor of how stabs describe source information for a C
  226. program, let's look at the simple program:
  227. main()
  228. {
  229. printf("Hello world");
  230. }
  231. When compiled with '-g', the program above yields the following '.s'
  232. file. Line numbers have been added to make it easier to refer to parts
  233. of the '.s' file in the description of the stabs that follows.
  234. 
  235. File: stabs.info, Node: Assembly Code, Prev: C Example, Up: Overview
  236. 1.5 The Simple Example at the Assembly Level
  237. ============================================
  238. This simple "hello world" example demonstrates several of the stab types
  239. used to describe C language source files.
  240. 1 gcc2_compiled.:
  241. 2 .stabs "/cygint/s1/users/jcm/play/",100,0,0,Ltext0
  242. 3 .stabs "hello.c",100,0,0,Ltext0
  243. 4 .text
  244. 5 Ltext0:
  245. 6 .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0
  246. 7 .stabs "char:t2=r2;0;127;",128,0,0,0
  247. 8 .stabs "long int:t3=r1;-2147483648;2147483647;",128,0,0,0
  248. 9 .stabs "unsigned int:t4=r1;0;-1;",128,0,0,0
  249. 10 .stabs "long unsigned int:t5=r1;0;-1;",128,0,0,0
  250. 11 .stabs "short int:t6=r1;-32768;32767;",128,0,0,0
  251. 12 .stabs "long long int:t7=r1;0;-1;",128,0,0,0
  252. 13 .stabs "short unsigned int:t8=r1;0;65535;",128,0,0,0
  253. 14 .stabs "long long unsigned int:t9=r1;0;-1;",128,0,0,0
  254. 15 .stabs "signed char:t10=r1;-128;127;",128,0,0,0
  255. 16 .stabs "unsigned char:t11=r1;0;255;",128,0,0,0
  256. 17 .stabs "float:t12=r1;4;0;",128,0,0,0
  257. 18 .stabs "double:t13=r1;8;0;",128,0,0,0
  258. 19 .stabs "long double:t14=r1;8;0;",128,0,0,0
  259. 20 .stabs "void:t15=15",128,0,0,0
  260. 21 .align 4
  261. 22 LC0:
  262. 23 .ascii "Hello, world!\12\0"
  263. 24 .align 4
  264. 25 .global _main
  265. 26 .proc 1
  266. 27 _main:
  267. 28 .stabn 68,0,4,LM1
  268. 29 LM1:
  269. 30 !#PROLOGUE# 0
  270. 31 save %sp,-136,%sp
  271. 32 !#PROLOGUE# 1
  272. 33 call ___main,0
  273. 34 nop
  274. 35 .stabn 68,0,5,LM2
  275. 36 LM2:
  276. 37 LBB2:
  277. 38 sethi %hi(LC0),%o1
  278. 39 or %o1,%lo(LC0),%o0
  279. 40 call _printf,0
  280. 41 nop
  281. 42 .stabn 68,0,6,LM3
  282. 43 LM3:
  283. 44 LBE2:
  284. 45 .stabn 68,0,6,LM4
  285. 46 LM4:
  286. 47 L1:
  287. 48 ret
  288. 49 restore
  289. 50 .stabs "main:F1",36,0,0,_main
  290. 51 .stabn 192,0,0,LBB2
  291. 52 .stabn 224,0,0,LBE2
  292. 
  293. File: stabs.info, Node: Program Structure, Next: Constants, Prev: Overview, Up: Top
  294. 2 Encoding the Structure of the Program
  295. ***************************************
  296. The elements of the program structure that stabs encode include the name
  297. of the main function, the names of the source and include files, the
  298. line numbers, procedure names and types, and the beginnings and ends of
  299. blocks of code.
  300. * Menu:
  301. * Main Program:: Indicate what the main program is
  302. * Source Files:: The path and name of the source file
  303. * Include Files:: Names of include files
  304. * Line Numbers::
  305. * Procedures::
  306. * Nested Procedures::
  307. * Block Structure::
  308. * Alternate Entry Points:: Entering procedures except at the beginning.
  309. 
  310. File: stabs.info, Node: Main Program, Next: Source Files, Up: Program Structure
  311. 2.1 Main Program
  312. ================
  313. Most languages allow the main program to have any name. The 'N_MAIN'
  314. stab type tells the debugger the name that is used in this program.
  315. Only the string field is significant; it is the name of a function which
  316. is the main program. Most C compilers do not use this stab (they expect
  317. the debugger to assume that the name is 'main'), but some C compilers
  318. emit an 'N_MAIN' stab for the 'main' function. I'm not sure how XCOFF
  319. handles this.
  320. 
  321. File: stabs.info, Node: Source Files, Next: Include Files, Prev: Main Program, Up: Program Structure
  322. 2.2 Paths and Names of the Source Files
  323. =======================================
  324. Before any other stabs occur, there must be a stab specifying the source
  325. file. This information is contained in a symbol of stab type 'N_SO';
  326. the string field contains the name of the file. The value of the symbol
  327. is the start address of the portion of the text section corresponding to
  328. that file.
  329. Some compilers use the desc field to indicate the language of the
  330. source file. Sun's compilers started this usage, and the first
  331. constants are derived from their documentation. Languages added by
  332. gcc/gdb start at 0x32 to avoid conflict with languages Sun may add in
  333. the future. A desc field with a value 0 indicates that no language has
  334. been specified via this mechanism.
  335. 'N_SO_AS' (0x1)
  336. Assembly language
  337. 'N_SO_C' (0x2)
  338. K&R traditional C
  339. 'N_SO_ANSI_C' (0x3)
  340. ANSI C
  341. 'N_SO_CC' (0x4)
  342. C++
  343. 'N_SO_FORTRAN' (0x5)
  344. Fortran
  345. 'N_SO_PASCAL' (0x6)
  346. Pascal
  347. 'N_SO_FORTRAN90' (0x7)
  348. Fortran90
  349. 'N_SO_OBJC' (0x32)
  350. Objective-C
  351. 'N_SO_OBJCPLUS' (0x33)
  352. Objective-C++
  353. Some compilers (for example, GCC2 and SunOS4 '/bin/cc') also include
  354. the directory in which the source was compiled, in a second 'N_SO'
  355. symbol preceding the one containing the file name. This symbol can be
  356. distinguished by the fact that it ends in a slash. Code from the
  357. 'cfront' C++ compiler can have additional 'N_SO' symbols for nonexistent
  358. source files after the 'N_SO' for the real source file; these are
  359. believed to contain no useful information.
  360. For example:
  361. .stabs "/cygint/s1/users/jcm/play/",100,0,0,Ltext0 # 100 is N_SO
  362. .stabs "hello.c",100,0,0,Ltext0
  363. .text
  364. Ltext0:
  365. Instead of 'N_SO' symbols, XCOFF uses a '.file' assembler directive
  366. which assembles to a 'C_FILE' symbol; explaining this in detail is
  367. outside the scope of this document.
  368. If it is useful to indicate the end of a source file, this is done
  369. with an 'N_SO' symbol with an empty string for the name. The value is
  370. the address of the end of the text section for the file. For some
  371. systems, there is no indication of the end of a source file, and you
  372. just need to figure it ended when you see an 'N_SO' for a different
  373. source file, or a symbol ending in '.o' (which at least some linkers
  374. insert to mark the start of a new '.o' file).
  375. 
  376. File: stabs.info, Node: Include Files, Next: Line Numbers, Prev: Source Files, Up: Program Structure
  377. 2.3 Names of Include Files
  378. ==========================
  379. There are several schemes for dealing with include files: the
  380. traditional 'N_SOL' approach, Sun's 'N_BINCL' approach, and the XCOFF
  381. 'C_BINCL' approach (which despite the similar name has little in common
  382. with 'N_BINCL').
  383. An 'N_SOL' symbol specifies which include file subsequent symbols
  384. refer to. The string field is the name of the file and the value is the
  385. text address corresponding to the end of the previous include file and
  386. the start of this one. To specify the main source file again, use an
  387. 'N_SOL' symbol with the name of the main source file.
  388. The 'N_BINCL' approach works as follows. An 'N_BINCL' symbol
  389. specifies the start of an include file. In an object file, only the
  390. string is significant; the linker puts data into some of the other
  391. fields. The end of the include file is marked by an 'N_EINCL' symbol
  392. (which has no string field). In an object file, there is no significant
  393. data in the 'N_EINCL' symbol. 'N_BINCL' and 'N_EINCL' can be nested.
  394. If the linker detects that two source files have identical stabs
  395. between an 'N_BINCL' and 'N_EINCL' pair (as will generally be the case
  396. for a header file), then it only puts out the stabs once. Each
  397. additional occurrence is replaced by an 'N_EXCL' symbol. I believe the
  398. GNU linker and the Sun (both SunOS4 and Solaris) linker are the only
  399. ones which supports this feature.
  400. A linker which supports this feature will set the value of a
  401. 'N_BINCL' symbol to the total of all the characters in the stabs strings
  402. included in the header file, omitting any file numbers. The value of an
  403. 'N_EXCL' symbol is the same as the value of the 'N_BINCL' symbol it
  404. replaces. This information can be used to match up 'N_EXCL' and
  405. 'N_BINCL' symbols which have the same filename. The 'N_EINCL' value,
  406. and the values of the other and description fields for all three, appear
  407. to always be zero.
  408. For the start of an include file in XCOFF, use the '.bi' assembler
  409. directive, which generates a 'C_BINCL' symbol. A '.ei' directive, which
  410. generates a 'C_EINCL' symbol, denotes the end of the include file. Both
  411. directives are followed by the name of the source file in quotes, which
  412. becomes the string for the symbol. The value of each symbol, produced
  413. automatically by the assembler and linker, is the offset into the
  414. executable of the beginning (inclusive, as you'd expect) or end
  415. (inclusive, as you would not expect) of the portion of the COFF line
  416. table that corresponds to this include file. 'C_BINCL' and 'C_EINCL' do
  417. not nest.
  418. 
  419. File: stabs.info, Node: Line Numbers, Next: Procedures, Prev: Include Files, Up: Program Structure
  420. 2.4 Line Numbers
  421. ================
  422. An 'N_SLINE' symbol represents the start of a source line. The desc
  423. field contains the line number and the value contains the code address
  424. for the start of that source line. On most machines the address is
  425. absolute; for stabs in sections (*note Stab Sections::), it is relative
  426. to the function in which the 'N_SLINE' symbol occurs.
  427. GNU documents 'N_DSLINE' and 'N_BSLINE' symbols for line numbers in
  428. the data or bss segments, respectively. They are identical to 'N_SLINE'
  429. but are relocated differently by the linker. They were intended to be
  430. used to describe the source location of a variable declaration, but I
  431. believe that GCC2 actually puts the line number in the desc field of the
  432. stab for the variable itself. GDB has been ignoring these symbols
  433. (unless they contain a string field) since at least GDB 3.5.
  434. For single source lines that generate discontiguous code, such as
  435. flow of control statements, there may be more than one line number entry
  436. for the same source line. In this case there is a line number entry at
  437. the start of each code range, each with the same line number.
  438. XCOFF does not use stabs for line numbers. Instead, it uses COFF
  439. line numbers (which are outside the scope of this document). Standard
  440. COFF line numbers cannot deal with include files, but in XCOFF this is
  441. fixed with the 'C_BINCL' method of marking include files (*note Include
  442. Files::).
  443. 
  444. File: stabs.info, Node: Procedures, Next: Nested Procedures, Prev: Line Numbers, Up: Program Structure
  445. 2.5 Procedures
  446. ==============
  447. All of the following stabs normally use the 'N_FUN' symbol type.
  448. However, Sun's 'acc' compiler on SunOS4 uses 'N_GSYM' and 'N_STSYM',
  449. which means that the value of the stab for the function is useless and
  450. the debugger must get the address of the function from the non-stab
  451. symbols instead. On systems where non-stab symbols have leading
  452. underscores, the stabs will lack underscores and the debugger needs to
  453. know about the leading underscore to match up the stab and the non-stab
  454. symbol. BSD Fortran is said to use 'N_FNAME' with the same restriction;
  455. the value of the symbol is not useful (I'm not sure it really does use
  456. this, because GDB doesn't handle this and no one has complained).
  457. A function is represented by an 'F' symbol descriptor for a global
  458. (extern) function, and 'f' for a static (local) function. For a.out,
  459. the value of the symbol is the address of the start of the function; it
  460. is already relocated. For stabs in ELF, the SunPRO compiler version
  461. 2.0.1 and GCC put out an address which gets relocated by the linker. In
  462. a future release SunPRO is planning to put out zero, in which case the
  463. address can be found from the ELF (non-stab) symbol. Because looking
  464. things up in the ELF symbols would probably be slow, I'm not sure how to
  465. find which symbol of that name is the right one, and this doesn't
  466. provide any way to deal with nested functions, it would probably be
  467. better to make the value of the stab an address relative to the start of
  468. the file, or just absolute. See *note ELF Linker Relocation:: for more
  469. information on linker relocation of stabs in ELF files. For XCOFF, the
  470. stab uses the 'C_FUN' storage class and the value of the stab is
  471. meaningless; the address of the function can be found from the csect
  472. symbol (XTY_LD/XMC_PR).
  473. The type information of the stab represents the return type of the
  474. function; thus 'foo:f5' means that foo is a function returning type 5.
  475. There is no need to try to get the line number of the start of the
  476. function from the stab for the function; it is in the next 'N_SLINE'
  477. symbol.
  478. Some compilers (such as Sun's Solaris compiler) support an extension
  479. for specifying the types of the arguments. I suspect this extension is
  480. not used for old (non-prototyped) function definitions in C. If the
  481. extension is in use, the type information of the stab for the function
  482. is followed by type information for each argument, with each argument
  483. preceded by ';'. An argument type of 0 means that additional arguments
  484. are being passed, whose types and number may vary ('...' in ANSI C). GDB
  485. has tolerated this extension (parsed the syntax, if not necessarily used
  486. the information) since at least version 4.8; I don't know whether all
  487. versions of dbx tolerate it. The argument types given here are not
  488. redundant with the symbols for the formal parameters (*note
  489. Parameters::); they are the types of the arguments as they are passed,
  490. before any conversions might take place. For example, if a C function
  491. which is declared without a prototype takes a 'float' argument, the
  492. value is passed as a 'double' but then converted to a 'float'.
  493. Debuggers need to use the types given in the arguments when printing
  494. values, but when calling the function they need to use the types given
  495. in the symbol defining the function.
  496. If the return type and types of arguments of a function which is
  497. defined in another source file are specified (i.e., a function prototype
  498. in ANSI C), traditionally compilers emit no stab; the only way for the
  499. debugger to find the information is if the source file where the
  500. function is defined was also compiled with debugging symbols. As an
  501. extension the Solaris compiler uses symbol descriptor 'P' followed by
  502. the return type of the function, followed by the arguments, each
  503. preceded by ';', as in a stab with symbol descriptor 'f' or 'F'. This
  504. use of symbol descriptor 'P' can be distinguished from its use for
  505. register parameters (*note Register Parameters::) by the fact that it
  506. has symbol type 'N_FUN'.
  507. The AIX documentation also defines symbol descriptor 'J' as an
  508. internal function. I assume this means a function nested within another
  509. function. It also says symbol descriptor 'm' is a module in Modula-2 or
  510. extended Pascal.
  511. Procedures (functions which do not return values) are represented as
  512. functions returning the 'void' type in C. I don't see why this couldn't
  513. be used for all languages (inventing a 'void' type for this purpose if
  514. necessary), but the AIX documentation defines 'I', 'P', and 'Q' for
  515. internal, global, and static procedures, respectively. These symbol
  516. descriptors are unusual in that they are not followed by type
  517. information.
  518. The following example shows a stab for a function 'main' which
  519. returns type number '1'. The '_main' specified for the value is a
  520. reference to an assembler label which is used to fill in the start
  521. address of the function.
  522. .stabs "main:F1",36,0,0,_main # 36 is N_FUN
  523. The stab representing a procedure is located immediately following
  524. the code of the procedure. This stab is in turn directly followed by a
  525. group of other stabs describing elements of the procedure. These other
  526. stabs describe the procedure's parameters, its block local variables,
  527. and its block structure.
  528. If functions can appear in different sections, then the debugger may
  529. not be able to find the end of a function. Recent versions of GCC will
  530. mark the end of a function with an 'N_FUN' symbol with an empty string
  531. for the name. The value is the address of the end of the current
  532. function. Without such a symbol, there is no indication of the address
  533. of the end of a function, and you must assume that it ended at the
  534. starting address of the next function or at the end of the text section
  535. for the program.
  536. 
  537. File: stabs.info, Node: Nested Procedures, Next: Block Structure, Prev: Procedures, Up: Program Structure
  538. 2.6 Nested Procedures
  539. =====================
  540. For any of the symbol descriptors representing procedures, after the
  541. symbol descriptor and the type information is optionally a scope
  542. specifier. This consists of a comma, the name of the procedure, another
  543. comma, and the name of the enclosing procedure. The first name is local
  544. to the scope specified, and seems to be redundant with the name of the
  545. symbol (before the ':'). This feature is used by GCC, and presumably
  546. Pascal, Modula-2, etc., compilers, for nested functions.
  547. If procedures are nested more than one level deep, only the
  548. immediately containing scope is specified. For example, this code:
  549. int
  550. foo (int x)
  551. {
  552. int bar (int y)
  553. {
  554. int baz (int z)
  555. {
  556. return x + y + z;
  557. }
  558. return baz (x + 2 * y);
  559. }
  560. return x + bar (3 * x);
  561. }
  562. produces the stabs:
  563. .stabs "baz:f1,baz,bar",36,0,0,_baz.15 # 36 is N_FUN
  564. .stabs "bar:f1,bar,foo",36,0,0,_bar.12
  565. .stabs "foo:F1",36,0,0,_foo
  566. 
  567. File: stabs.info, Node: Block Structure, Next: Alternate Entry Points, Prev: Nested Procedures, Up: Program Structure
  568. 2.7 Block Structure
  569. ===================
  570. The program's block structure is represented by the 'N_LBRAC' (left
  571. brace) and the 'N_RBRAC' (right brace) stab types. The variables
  572. defined inside a block precede the 'N_LBRAC' symbol for most compilers,
  573. including GCC. Other compilers, such as the Convex, Acorn RISC machine,
  574. and Sun 'acc' compilers, put the variables after the 'N_LBRAC' symbol.
  575. The values of the 'N_LBRAC' and 'N_RBRAC' symbols are the start and end
  576. addresses of the code of the block, respectively. For most machines,
  577. they are relative to the starting address of this source file. For the
  578. Gould NP1, they are absolute. For stabs in sections (*note Stab
  579. Sections::), they are relative to the function in which they occur.
  580. The 'N_LBRAC' and 'N_RBRAC' stabs that describe the block scope of a
  581. procedure are located after the 'N_FUN' stab that represents the
  582. procedure itself.
  583. Sun documents the desc field of 'N_LBRAC' and 'N_RBRAC' symbols as
  584. containing the nesting level of the block. However, dbx seems to not
  585. care, and GCC always sets desc to zero.
  586. For XCOFF, block scope is indicated with 'C_BLOCK' symbols. If the
  587. name of the symbol is '.bb', then it is the beginning of the block; if
  588. the name of the symbol is '.be'; it is the end of the block.
  589. 
  590. File: stabs.info, Node: Alternate Entry Points, Prev: Block Structure, Up: Program Structure
  591. 2.8 Alternate Entry Points
  592. ==========================
  593. Some languages, like Fortran, have the ability to enter procedures at
  594. some place other than the beginning. One can declare an alternate entry
  595. point. The 'N_ENTRY' stab is for this; however, the Sun FORTRAN
  596. compiler doesn't use it. According to AIX documentation, only the name
  597. of a 'C_ENTRY' stab is significant; the address of the alternate entry
  598. point comes from the corresponding external symbol. A previous revision
  599. of this document said that the value of an 'N_ENTRY' stab was the
  600. address of the alternate entry point, but I don't know the source for
  601. that information.
  602. 
  603. File: stabs.info, Node: Constants, Next: Variables, Prev: Program Structure, Up: Top
  604. 3 Constants
  605. ***********
  606. The 'c' symbol descriptor indicates that this stab represents a
  607. constant. This symbol descriptor is an exception to the general rule
  608. that symbol descriptors are followed by type information. Instead, it
  609. is followed by '=' and one of the following:
  610. 'b VALUE'
  611. Boolean constant. VALUE is a numeric value; I assume it is 0 for
  612. false or 1 for true.
  613. 'c VALUE'
  614. Character constant. VALUE is the numeric value of the constant.
  615. 'e TYPE-INFORMATION , VALUE'
  616. Constant whose value can be represented as integral.
  617. TYPE-INFORMATION is the type of the constant, as it would appear
  618. after a symbol descriptor (*note String Field::). VALUE is the
  619. numeric value of the constant. GDB 4.9 does not actually get the
  620. right value if VALUE does not fit in a host 'int', but it does not
  621. do anything violent, and future debuggers could be extended to
  622. accept integers of any size (whether unsigned or not). This
  623. constant type is usually documented as being only for enumeration
  624. constants, but GDB has never imposed that restriction; I don't know
  625. about other debuggers.
  626. 'i VALUE'
  627. Integer constant. VALUE is the numeric value. The type is some
  628. sort of generic integer type (for GDB, a host 'int'); to specify
  629. the type explicitly, use 'e' instead.
  630. 'r VALUE'
  631. Real constant. VALUE is the real value, which can be 'INF'
  632. (optionally preceded by a sign) for infinity, 'QNAN' for a quiet
  633. NaN (not-a-number), or 'SNAN' for a signalling NaN. If it is a
  634. normal number the format is that accepted by the C library function
  635. 'atof'.
  636. 's STRING'
  637. String constant. STRING is a string enclosed in either ''' (in
  638. which case ''' characters within the string are represented as '\''
  639. or '"' (in which case '"' characters within the string are
  640. represented as '\"').
  641. 'S TYPE-INFORMATION , ELEMENTS , BITS , PATTERN'
  642. Set constant. TYPE-INFORMATION is the type of the constant, as it
  643. would appear after a symbol descriptor (*note String Field::).
  644. ELEMENTS is the number of elements in the set (does this means how
  645. many bits of PATTERN are actually used, which would be redundant
  646. with the type, or perhaps the number of bits set in PATTERN? I
  647. don't get it), BITS is the number of bits in the constant (meaning
  648. it specifies the length of PATTERN, I think), and PATTERN is a
  649. hexadecimal representation of the set. AIX documentation refers to
  650. a limit of 32 bytes, but I see no reason why this limit should
  651. exist. This form could probably be used for arbitrary constants,
  652. not just sets; the only catch is that PATTERN should be understood
  653. to be target, not host, byte order and format.
  654. The boolean, character, string, and set constants are not supported
  655. by GDB 4.9, but it ignores them. GDB 4.8 and earlier gave an error
  656. message and refused to read symbols from the file containing the
  657. constants.
  658. The above information is followed by ';'.
  659. 
  660. File: stabs.info, Node: Variables, Next: Types, Prev: Constants, Up: Top
  661. 4 Variables
  662. ***********
  663. Different types of stabs describe the various ways that variables can be
  664. allocated: on the stack, globally, in registers, in common blocks,
  665. statically, or as arguments to a function.
  666. * Menu:
  667. * Stack Variables:: Variables allocated on the stack.
  668. * Global Variables:: Variables used by more than one source file.
  669. * Register Variables:: Variables in registers.
  670. * Common Blocks:: Variables statically allocated together.
  671. * Statics:: Variables local to one source file.
  672. * Based Variables:: Fortran pointer based variables.
  673. * Parameters:: Variables for arguments to functions.
  674. 
  675. File: stabs.info, Node: Stack Variables, Next: Global Variables, Up: Variables
  676. 4.1 Automatic Variables Allocated on the Stack
  677. ==============================================
  678. If a variable's scope is local to a function and its lifetime is only as
  679. long as that function executes (C calls such variables "automatic"), it
  680. can be allocated in a register (*note Register Variables::) or on the
  681. stack.
  682. Each variable allocated on the stack has a stab with the symbol
  683. descriptor omitted. Since type information should begin with a digit,
  684. '-', or '(', only those characters precluded from being used for symbol
  685. descriptors. However, the Acorn RISC machine (ARM) is said to get this
  686. wrong: it puts out a mere type definition here, without the preceding
  687. 'TYPE-NUMBER='. This is a bad idea; there is no guarantee that type
  688. descriptors are distinct from symbol descriptors. Stabs for stack
  689. variables use the 'N_LSYM' stab type, or 'C_LSYM' for XCOFF.
  690. The value of the stab is the offset of the variable within the local
  691. variables. On most machines this is an offset from the frame pointer
  692. and is negative. The location of the stab specifies which block it is
  693. defined in; see *note Block Structure::.
  694. For example, the following C code:
  695. int
  696. main ()
  697. {
  698. int x;
  699. }
  700. produces the following stabs:
  701. .stabs "main:F1",36,0,0,_main # 36 is N_FUN
  702. .stabs "x:1",128,0,0,-12 # 128 is N_LSYM
  703. .stabn 192,0,0,LBB2 # 192 is N_LBRAC
  704. .stabn 224,0,0,LBE2 # 224 is N_RBRAC
  705. See *note Procedures:: for more information on the 'N_FUN' stab, and
  706. *note Block Structure:: for more information on the 'N_LBRAC' and
  707. 'N_RBRAC' stabs.
  708. 
  709. File: stabs.info, Node: Global Variables, Next: Register Variables, Prev: Stack Variables, Up: Variables
  710. 4.2 Global Variables
  711. ====================
  712. A variable whose scope is not specific to just one source file is
  713. represented by the 'G' symbol descriptor. These stabs use the 'N_GSYM'
  714. stab type (C_GSYM for XCOFF). The type information for the stab (*note
  715. String Field::) gives the type of the variable.
  716. For example, the following source code:
  717. char g_foo = 'c';
  718. yields the following assembly code:
  719. .stabs "g_foo:G2",32,0,0,0 # 32 is N_GSYM
  720. .global _g_foo
  721. .data
  722. _g_foo:
  723. .byte 99
  724. The address of the variable represented by the 'N_GSYM' is not
  725. contained in the 'N_GSYM' stab. The debugger gets this information from
  726. the external symbol for the global variable. In the example above, the
  727. '.global _g_foo' and '_g_foo:' lines tell the assembler to produce an
  728. external symbol.
  729. Some compilers, like GCC, output 'N_GSYM' stabs only once, where the
  730. variable is defined. Other compilers, like SunOS4 /bin/cc, output a
  731. 'N_GSYM' stab for each compilation unit which references the variable.
  732. 
  733. File: stabs.info, Node: Register Variables, Next: Common Blocks, Prev: Global Variables, Up: Variables
  734. 4.3 Register Variables
  735. ======================
  736. Register variables have their own stab type, 'N_RSYM' ('C_RSYM' for
  737. XCOFF), and their own symbol descriptor, 'r'. The stab's value is the
  738. number of the register where the variable data will be stored.
  739. AIX defines a separate symbol descriptor 'd' for floating point
  740. registers. This seems unnecessary; why not just just give floating
  741. point registers different register numbers? I have not verified whether
  742. the compiler actually uses 'd'.
  743. If the register is explicitly allocated to a global variable, but not
  744. initialized, as in:
  745. register int g_bar asm ("%g5");
  746. then the stab may be emitted at the end of the object file, with the
  747. other bss symbols.
  748. 
  749. File: stabs.info, Node: Common Blocks, Next: Statics, Prev: Register Variables, Up: Variables
  750. 4.4 Common Blocks
  751. =================
  752. A common block is a statically allocated section of memory which can be
  753. referred to by several source files. It may contain several variables.
  754. I believe Fortran is the only language with this feature.
  755. A 'N_BCOMM' stab begins a common block and an 'N_ECOMM' stab ends it.
  756. The only field that is significant in these two stabs is the string,
  757. which names a normal (non-debugging) symbol that gives the address of
  758. the common block. According to IBM documentation, only the 'N_BCOMM'
  759. has the name of the common block (even though their compiler actually
  760. puts it both places).
  761. The stabs for the members of the common block are between the
  762. 'N_BCOMM' and the 'N_ECOMM'; the value of each stab is the offset within
  763. the common block of that variable. IBM uses the 'C_ECOML' stab type,
  764. and there is a corresponding 'N_ECOML' stab type, but Sun's Fortran
  765. compiler uses 'N_GSYM' instead. The variables within a common block use
  766. the 'V' symbol descriptor (I believe this is true of all Fortran
  767. variables). Other stabs (at least type declarations using 'C_DECL') can
  768. also be between the 'N_BCOMM' and the 'N_ECOMM'.
  769. 
  770. File: stabs.info, Node: Statics, Next: Based Variables, Prev: Common Blocks, Up: Variables
  771. 4.5 Static Variables
  772. ====================
  773. Initialized static variables are represented by the 'S' and 'V' symbol
  774. descriptors. 'S' means file scope static, and 'V' means procedure scope
  775. static. One exception: in XCOFF, IBM's xlc compiler always uses 'V',
  776. and whether it is file scope or not is distinguished by whether the stab
  777. is located within a function.
  778. In a.out files, 'N_STSYM' means the data section, 'N_FUN' means the
  779. text section, and 'N_LCSYM' means the bss section. For those systems
  780. with a read-only data section separate from the text section (Solaris),
  781. 'N_ROSYM' means the read-only data section.
  782. For example, the source lines:
  783. static const int var_const = 5;
  784. static int var_init = 2;
  785. static int var_noinit;
  786. yield the following stabs:
  787. .stabs "var_const:S1",36,0,0,_var_const # 36 is N_FUN
  788. ...
  789. .stabs "var_init:S1",38,0,0,_var_init # 38 is N_STSYM
  790. ...
  791. .stabs "var_noinit:S1",40,0,0,_var_noinit # 40 is N_LCSYM
  792. In XCOFF files, the stab type need not indicate the section;
  793. 'C_STSYM' can be used for all statics. Also, each static variable is
  794. enclosed in a static block. A 'C_BSTAT' (emitted with a '.bs' assembler
  795. directive) symbol begins the static block; its value is the symbol
  796. number of the csect symbol whose value is the address of the static
  797. block, its section is the section of the variables in that static block,
  798. and its name is '.bs'. A 'C_ESTAT' (emitted with a '.es' assembler
  799. directive) symbol ends the static block; its name is '.es' and its value
  800. and section are ignored.
  801. In ECOFF files, the storage class is used to specify the section, so
  802. the stab type need not indicate the section.
  803. In ELF files, for the SunPRO compiler version 2.0.1, symbol
  804. descriptor 'S' means that the address is absolute (the linker relocates
  805. it) and symbol descriptor 'V' means that the address is relative to the
  806. start of the relevant section for that compilation unit. SunPRO has
  807. plans to have the linker stop relocating stabs; I suspect that their the
  808. debugger gets the address from the corresponding ELF (not stab) symbol.
  809. I'm not sure how to find which symbol of that name is the right one.
  810. The clean way to do all this would be to have the value of a symbol
  811. descriptor 'S' symbol be an offset relative to the start of the file,
  812. just like everything else, but that introduces obvious compatibility
  813. problems. For more information on linker stab relocation, *Note ELF
  814. Linker Relocation::.
  815. 
  816. File: stabs.info, Node: Based Variables, Next: Parameters, Prev: Statics, Up: Variables
  817. 4.6 Fortran Based Variables
  818. ===========================
  819. Fortran (at least, the Sun and SGI dialects of FORTRAN-77) has a feature
  820. which allows allocating arrays with 'malloc', but which avoids blurring
  821. the line between arrays and pointers the way that C does. In stabs such
  822. a variable uses the 'b' symbol descriptor.
  823. For example, the Fortran declarations
  824. real foo, foo10(10), foo10_5(10,5)
  825. pointer (foop, foo)
  826. pointer (foo10p, foo10)
  827. pointer (foo105p, foo10_5)
  828. produce the stabs
  829. foo:b6
  830. foo10:bar3;1;10;6
  831. foo10_5:bar3;1;5;ar3;1;10;6
  832. In this example, 'real' is type 6 and type 3 is an integral type
  833. which is the type of the subscripts of the array (probably 'integer').
  834. The 'b' symbol descriptor is like 'V' in that it denotes a statically
  835. allocated symbol whose scope is local to a function; see *Note
  836. Statics::. The value of the symbol, instead of being the address of the
  837. variable itself, is the address of a pointer to that variable. So in
  838. the above example, the value of the 'foo' stab is the address of a
  839. pointer to a real, the value of the 'foo10' stab is the address of a
  840. pointer to a 10-element array of reals, and the value of the 'foo10_5'
  841. stab is the address of a pointer to a 5-element array of 10-element
  842. arrays of reals.
  843. 
  844. File: stabs.info, Node: Parameters, Prev: Based Variables, Up: Variables
  845. 4.7 Parameters
  846. ==============
  847. Formal parameters to a function are represented by a stab (or sometimes
  848. two; see below) for each parameter. The stabs are in the order in which
  849. the debugger should print the parameters (i.e., the order in which the
  850. parameters are declared in the source file). The exact form of the stab
  851. depends on how the parameter is being passed.
  852. Parameters passed on the stack use the symbol descriptor 'p' and the
  853. 'N_PSYM' symbol type (or 'C_PSYM' for XCOFF). The value of the symbol is
  854. an offset used to locate the parameter on the stack; its exact meaning
  855. is machine-dependent, but on most machines it is an offset from the
  856. frame pointer.
  857. As a simple example, the code:
  858. main (argc, argv)
  859. int argc;
  860. char **argv;
  861. produces the stabs:
  862. .stabs "main:F1",36,0,0,_main # 36 is N_FUN
  863. .stabs "argc:p1",160,0,0,68 # 160 is N_PSYM
  864. .stabs "argv:p20=*21=*2",160,0,0,72
  865. The type definition of 'argv' is interesting because it contains
  866. several type definitions. Type 21 is pointer to type 2 (char) and
  867. 'argv' (type 20) is pointer to type 21.
  868. The following symbol descriptors are also said to go with 'N_PSYM'.
  869. The value of the symbol is said to be an offset from the argument
  870. pointer (I'm not sure whether this is true or not).
  871. pP (<<??>>)
  872. pF Fortran function parameter
  873. X (function result variable)
  874. * Menu:
  875. * Register Parameters::
  876. * Local Variable Parameters::
  877. * Reference Parameters::
  878. * Conformant Arrays::
  879. 
  880. File: stabs.info, Node: Register Parameters, Next: Local Variable Parameters, Up: Parameters
  881. 4.7.1 Passing Parameters in Registers
  882. -------------------------------------
  883. If the parameter is passed in a register, then traditionally there are
  884. two symbols for each argument:
  885. .stabs "arg:p1" . . . ; N_PSYM
  886. .stabs "arg:r1" . . . ; N_RSYM
  887. Debuggers use the second one to find the value, and the first one to
  888. know that it is an argument.
  889. Because that approach is kind of ugly, some compilers use symbol
  890. descriptor 'P' or 'R' to indicate an argument which is in a register.
  891. Symbol type 'C_RPSYM' is used in XCOFF and 'N_RSYM' is used otherwise.
  892. The symbol's value is the register number. 'P' and 'R' mean the same
  893. thing; the difference is that 'P' is a GNU invention and 'R' is an IBM
  894. (XCOFF) invention. As of version 4.9, GDB should handle either one.
  895. There is at least one case where GCC uses a 'p' and 'r' pair rather
  896. than 'P'; this is where the argument is passed in the argument list and
  897. then loaded into a register.
  898. According to the AIX documentation, symbol descriptor 'D' is for a
  899. parameter passed in a floating point register. This seems
  900. unnecessary--why not just use 'R' with a register number which indicates
  901. that it's a floating point register? I haven't verified whether the
  902. system actually does what the documentation indicates.
  903. On the sparc and hppa, for a 'P' symbol whose type is a structure or
  904. union, the register contains the address of the structure. On the
  905. sparc, this is also true of a 'p' and 'r' pair (using Sun 'cc') or a 'p'
  906. symbol. However, if a (small) structure is really in a register, 'r' is
  907. used. And, to top it all off, on the hppa it might be a structure which
  908. was passed on the stack and loaded into a register and for which there
  909. is a 'p' and 'r' pair! I believe that symbol descriptor 'i' is supposed
  910. to deal with this case (it is said to mean "value parameter by
  911. reference, indirect access"; I don't know the source for this
  912. information), but I don't know details or what compilers or debuggers
  913. use it, if any (not GDB or GCC). It is not clear to me whether this case
  914. needs to be dealt with differently than parameters passed by reference
  915. (*note Reference Parameters::).
  916. 
  917. File: stabs.info, Node: Local Variable Parameters, Next: Reference Parameters, Prev: Register Parameters, Up: Parameters
  918. 4.7.2 Storing Parameters as Local Variables
  919. -------------------------------------------
  920. There is a case similar to an argument in a register, which is an
  921. argument that is actually stored as a local variable. Sometimes this
  922. happens when the argument was passed in a register and then the compiler
  923. stores it as a local variable. If possible, the compiler should claim
  924. that it's in a register, but this isn't always done.
  925. If a parameter is passed as one type and converted to a smaller type
  926. by the prologue (for example, the parameter is declared as a 'float',
  927. but the calling conventions specify that it is passed as a 'double'),
  928. then GCC2 (sometimes) uses a pair of symbols. The first symbol uses
  929. symbol descriptor 'p' and the type which is passed. The second symbol
  930. has the type and location which the parameter actually has after the
  931. prologue. For example, suppose the following C code appears with no
  932. prototypes involved:
  933. void
  934. subr (f)
  935. float f;
  936. {
  937. if 'f' is passed as a double at stack offset 8, and the prologue
  938. converts it to a float in register number 0, then the stabs look like:
  939. .stabs "f:p13",160,0,3,8 # 160 is 'N_PSYM', here 13 is 'double'
  940. .stabs "f:r12",64,0,3,0 # 64 is 'N_RSYM', here 12 is 'float'
  941. In both stabs 3 is the line number where 'f' is declared (*note Line
  942. Numbers::).
  943. GCC, at least on the 960, has another solution to the same problem.
  944. It uses a single 'p' symbol descriptor for an argument which is stored
  945. as a local variable but uses 'N_LSYM' instead of 'N_PSYM'. In this
  946. case, the value of the symbol is an offset relative to the local
  947. variables for that function, not relative to the arguments; on some
  948. machines those are the same thing, but not on all.
  949. On the VAX or on other machines in which the calling convention
  950. includes the number of words of arguments actually passed, the debugger
  951. (GDB at least) uses the parameter symbols to keep track of whether it
  952. needs to print nameless arguments in addition to the formal parameters
  953. which it has printed because each one has a stab. For example, in
  954. extern int fprintf (FILE *stream, char *format, ...);
  955. ...
  956. fprintf (stdout, "%d\n", x);
  957. there are stabs for 'stream' and 'format'. On most machines, the
  958. debugger can only print those two arguments (because it has no way of
  959. knowing that additional arguments were passed), but on the VAX or other
  960. machines with a calling convention which indicates the number of words
  961. of arguments, the debugger can print all three arguments. To do so, the
  962. parameter symbol (symbol descriptor 'p') (not necessarily 'r' or symbol
  963. descriptor omitted symbols) needs to contain the actual type as passed
  964. (for example, 'double' not 'float' if it is passed as a double and
  965. converted to a float).
  966. 
  967. File: stabs.info, Node: Reference Parameters, Next: Conformant Arrays, Prev: Local Variable Parameters, Up: Parameters
  968. 4.7.3 Passing Parameters by Reference
  969. -------------------------------------
  970. If the parameter is passed by reference (e.g., Pascal 'VAR' parameters),
  971. then the symbol descriptor is 'v' if it is in the argument list, or 'a'
  972. if it in a register. Other than the fact that these contain the address
  973. of the parameter rather than the parameter itself, they are identical to
  974. 'p' and 'R', respectively. I believe 'a' is an AIX invention; 'v' is
  975. supported by all stabs-using systems as far as I know.
  976. 
  977. File: stabs.info, Node: Conformant Arrays, Prev: Reference Parameters, Up: Parameters
  978. 4.7.4 Passing Conformant Array Parameters
  979. -----------------------------------------
  980. Conformant arrays are a feature of Modula-2, and perhaps other
  981. languages, in which the size of an array parameter is not known to the
  982. called function until run-time. Such parameters have two stabs: a 'x'
  983. for the array itself, and a 'C', which represents the size of the array.
  984. The value of the 'x' stab is the offset in the argument list where the
  985. address of the array is stored (it this right? it is a guess); the
  986. value of the 'C' stab is the offset in the argument list where the size
  987. of the array (in elements? in bytes?) is stored.
  988. 
  989. File: stabs.info, Node: Types, Next: Macro define and undefine, Prev: Variables, Up: Top
  990. 5 Defining Types
  991. ****************
  992. The examples so far have described types as references to previously
  993. defined types, or defined in terms of subranges of or pointers to
  994. previously defined types. This chapter describes the other type
  995. descriptors that may follow the '=' in a type definition.
  996. * Menu:
  997. * Builtin Types:: Integers, floating point, void, etc.
  998. * Miscellaneous Types:: Pointers, sets, files, etc.
  999. * Cross-References:: Referring to a type not yet defined.
  1000. * Subranges:: A type with a specific range.
  1001. * Arrays:: An aggregate type of same-typed elements.
  1002. * Strings:: Like an array but also has a length.
  1003. * Enumerations:: Like an integer but the values have names.
  1004. * Structures:: An aggregate type of different-typed elements.
  1005. * Typedefs:: Giving a type a name.
  1006. * Unions:: Different types sharing storage.
  1007. * Function Types::
  1008. 
  1009. File: stabs.info, Node: Builtin Types, Next: Miscellaneous Types, Up: Types
  1010. 5.1 Builtin Types
  1011. =================
  1012. Certain types are built in ('int', 'short', 'void', 'float', etc.); the
  1013. debugger recognizes these types and knows how to handle them. Thus,
  1014. don't be surprised if some of the following ways of specifying builtin
  1015. types do not specify everything that a debugger would need to know about
  1016. the type--in some cases they merely specify enough information to
  1017. distinguish the type from other types.
  1018. The traditional way to define builtin types is convoluted, so new
  1019. ways have been invented to describe them. Sun's 'acc' uses special
  1020. builtin type descriptors ('b' and 'R'), and IBM uses negative type
  1021. numbers. GDB accepts all three ways, as of version 4.8; dbx just
  1022. accepts the traditional builtin types and perhaps one of the other two
  1023. formats. The following sections describe each of these formats.
  1024. * Menu:
  1025. * Traditional Builtin Types:: Put on your seat belts and prepare for kludgery
  1026. * Builtin Type Descriptors:: Builtin types with special type descriptors
  1027. * Negative Type Numbers:: Builtin types using negative type numbers
  1028. 
  1029. File: stabs.info, Node: Traditional Builtin Types, Next: Builtin Type Descriptors, Up: Builtin Types
  1030. 5.1.1 Traditional Builtin Types
  1031. -------------------------------
  1032. This is the traditional, convoluted method for defining builtin types.
  1033. There are several classes of such type definitions: integer, floating
  1034. point, and 'void'.
  1035. * Menu:
  1036. * Traditional Integer Types::
  1037. * Traditional Other Types::
  1038. 
  1039. File: stabs.info, Node: Traditional Integer Types, Next: Traditional Other Types, Up: Traditional Builtin Types
  1040. 5.1.1.1 Traditional Integer Types
  1041. .................................
  1042. Often types are defined as subranges of themselves. If the bounding
  1043. values fit within an 'int', then they are given normally. For example:
  1044. .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0 # 128 is N_LSYM
  1045. .stabs "char:t2=r2;0;127;",128,0,0,0
  1046. Builtin types can also be described as subranges of 'int':
  1047. .stabs "unsigned short:t6=r1;0;65535;",128,0,0,0
  1048. If the lower bound of a subrange is 0 and the upper bound is -1, the
  1049. type is an unsigned integral type whose bounds are too big to describe
  1050. in an 'int'. Traditionally this is only used for 'unsigned int' and
  1051. 'unsigned long':
  1052. .stabs "unsigned int:t4=r1;0;-1;",128,0,0,0
  1053. For larger types, GCC 2.4.5 puts out bounds in octal, with one or
  1054. more leading zeroes. In this case a negative bound consists of a number
  1055. which is a 1 bit (for the sign bit) followed by a 0 bit for each bit in
  1056. the number (except the sign bit), and a positive bound is one which is a
  1057. 1 bit for each bit in the number (except possibly the sign bit). All
  1058. known versions of dbx and GDB version 4 accept this (at least in the
  1059. sense of not refusing to process the file), but GDB 3.5 refuses to read
  1060. the whole file containing such symbols. So GCC 2.3.3 did not output the
  1061. proper size for these types. As an example of octal bounds, the string
  1062. fields of the stabs for 64 bit integer types look like:
  1063. long int:t3=r1;001000000000000000000000;000777777777777777777777;
  1064. long unsigned int:t5=r1;000000000000000000000000;001777777777777777777777;
  1065. If the lower bound of a subrange is 0 and the upper bound is
  1066. negative, the type is an unsigned integral type whose size in bytes is
  1067. the absolute value of the upper bound. I believe this is a Convex
  1068. convention for 'unsigned long long'.
  1069. If the lower bound of a subrange is negative and the upper bound is
  1070. 0, the type is a signed integral type whose size in bytes is the
  1071. absolute value of the lower bound. I believe this is a Convex
  1072. convention for 'long long'. To distinguish this from a legitimate
  1073. subrange, the type should be a subrange of itself. I'm not sure whether
  1074. this is the case for Convex.
  1075. 
  1076. File: stabs.info, Node: Traditional Other Types, Prev: Traditional Integer Types, Up: Traditional Builtin Types
  1077. 5.1.1.2 Traditional Other Types
  1078. ...............................
  1079. If the upper bound of a subrange is 0 and the lower bound is positive,
  1080. the type is a floating point type, and the lower bound of the subrange
  1081. indicates the number of bytes in the type:
  1082. .stabs "float:t12=r1;4;0;",128,0,0,0
  1083. .stabs "double:t13=r1;8;0;",128,0,0,0
  1084. However, GCC writes 'long double' the same way it writes 'double', so
  1085. there is no way to distinguish.
  1086. .stabs "long double:t14=r1;8;0;",128,0,0,0
  1087. Complex types are defined the same way as floating-point types; there
  1088. is no way to distinguish a single-precision complex from a
  1089. double-precision floating-point type.
  1090. The C 'void' type is defined as itself:
  1091. .stabs "void:t15=15",128,0,0,0
  1092. I'm not sure how a boolean type is represented.
  1093. 
  1094. File: stabs.info, Node: Builtin Type Descriptors, Next: Negative Type Numbers, Prev: Traditional Builtin Types, Up: Builtin Types
  1095. 5.1.2 Defining Builtin Types Using Builtin Type Descriptors
  1096. -----------------------------------------------------------
  1097. This is the method used by Sun's 'acc' for defining builtin types.
  1098. These are the type descriptors to define builtin types:
  1099. 'b SIGNED CHAR-FLAG WIDTH ; OFFSET ; NBITS ;'
  1100. Define an integral type. SIGNED is 'u' for unsigned or 's' for
  1101. signed. CHAR-FLAG is 'c' which indicates this is a character type,
  1102. or is omitted. I assume this is to distinguish an integral type
  1103. from a character type of the same size, for example it might make
  1104. sense to set it for the C type 'wchar_t' so the debugger can print
  1105. such variables differently (Solaris does not do this). Sun sets it
  1106. on the C types 'signed char' and 'unsigned char' which arguably is
  1107. wrong. WIDTH and OFFSET appear to be for small objects stored in
  1108. larger ones, for example a 'short' in an 'int' register. WIDTH is
  1109. normally the number of bytes in the type. OFFSET seems to always
  1110. be zero. NBITS is the number of bits in the type.
  1111. Note that type descriptor 'b' used for builtin types conflicts with
  1112. its use for Pascal space types (*note Miscellaneous Types::); they
  1113. can be distinguished because the character following the type
  1114. descriptor will be a digit, '(', or '-' for a Pascal space type, or
  1115. 'u' or 's' for a builtin type.
  1116. 'w'
  1117. Documented by AIX to define a wide character type, but their
  1118. compiler actually uses negative type numbers (*note Negative Type
  1119. Numbers::).
  1120. 'R FP-TYPE ; BYTES ;'
  1121. Define a floating point type. FP-TYPE has one of the following
  1122. values:
  1123. '1 (NF_SINGLE)'
  1124. IEEE 32-bit (single precision) floating point format.
  1125. '2 (NF_DOUBLE)'
  1126. IEEE 64-bit (double precision) floating point format.
  1127. '3 (NF_COMPLEX)'
  1128. '4 (NF_COMPLEX16)'
  1129. '5 (NF_COMPLEX32)'
  1130. These are for complex numbers. A comment in the GDB source
  1131. describes them as Fortran 'complex', 'double complex', and
  1132. 'complex*16', respectively, but what does that mean? (i.e.,
  1133. Single precision? Double precision?).
  1134. '6 (NF_LDOUBLE)'
  1135. Long double. This should probably only be used for Sun format
  1136. 'long double', and new codes should be used for other floating
  1137. point formats ('NF_DOUBLE' can be used if a 'long double' is
  1138. really just an IEEE double, of course).
  1139. BYTES is the number of bytes occupied by the type. This allows a
  1140. debugger to perform some operations with the type even if it
  1141. doesn't understand FP-TYPE.
  1142. 'g TYPE-INFORMATION ; NBITS'
  1143. Documented by AIX to define a floating type, but their compiler
  1144. actually uses negative type numbers (*note Negative Type
  1145. Numbers::).
  1146. 'c TYPE-INFORMATION ; NBITS'
  1147. Documented by AIX to define a complex type, but their compiler
  1148. actually uses negative type numbers (*note Negative Type
  1149. Numbers::).
  1150. The C 'void' type is defined as a signed integral type 0 bits long:
  1151. .stabs "void:t19=bs0;0;0",128,0,0,0
  1152. The Solaris compiler seems to omit the trailing semicolon in this
  1153. case. Getting sloppy in this way is not a swift move because if a type
  1154. is embedded in a more complex expression it is necessary to be able to
  1155. tell where it ends.
  1156. I'm not sure how a boolean type is represented.
  1157. 
  1158. File: stabs.info, Node: Negative Type Numbers, Prev: Builtin Type Descriptors, Up: Builtin Types
  1159. 5.1.3 Negative Type Numbers
  1160. ---------------------------
  1161. This is the method used in XCOFF for defining builtin types. Since the
  1162. debugger knows about the builtin types anyway, the idea of negative type
  1163. numbers is simply to give a special type number which indicates the
  1164. builtin type. There is no stab defining these types.
  1165. There are several subtle issues with negative type numbers.
  1166. One is the size of the type. A builtin type (for example the C types
  1167. 'int' or 'long') might have different sizes depending on compiler
  1168. options, the target architecture, the ABI, etc. This issue doesn't come
  1169. up for IBM tools since (so far) they just target the RS/6000; the sizes
  1170. indicated below for each size are what the IBM RS/6000 tools use. To
  1171. deal with differing sizes, either define separate negative type numbers
  1172. for each size (which works but requires changing the debugger, and,
  1173. unless you get both AIX dbx and GDB to accept the change, introduces an
  1174. incompatibility), or use a type attribute (*note String Field::) to
  1175. define a new type with the appropriate size (which merely requires a
  1176. debugger which understands type attributes, like AIX dbx or GDB). For
  1177. example,
  1178. .stabs "boolean:t10=@s8;-16",128,0,0,0
  1179. defines an 8-bit boolean type, and
  1180. .stabs "boolean:t10=@s64;-16",128,0,0,0
  1181. defines a 64-bit boolean type.
  1182. A similar issue is the format of the type. This comes up most often
  1183. for floating-point types, which could have various formats (particularly
  1184. extended doubles, which vary quite a bit even among IEEE systems).
  1185. Again, it is best to define a new negative type number for each
  1186. different format; changing the format based on the target system has
  1187. various problems. One such problem is that the Alpha has both VAX and
  1188. IEEE floating types. One can easily imagine one library using the VAX
  1189. types and another library in the same executable using the IEEE types.
  1190. Another example is that the interpretation of whether a boolean is true
  1191. or false can be based on the least significant bit, most significant
  1192. bit, whether it is zero, etc., and different compilers (or different
  1193. options to the same compiler) might provide different kinds of boolean.
  1194. The last major issue is the names of the types. The name of a given
  1195. type depends _only_ on the negative type number given; these do not vary
  1196. depending on the language, the target system, or anything else. One can
  1197. always define separate type numbers--in the following list you will see
  1198. for example separate 'int' and 'integer*4' types which are identical
  1199. except for the name. But compatibility can be maintained by not
  1200. inventing new negative type numbers and instead just defining a new type
  1201. with a new name. For example:
  1202. .stabs "CARDINAL:t10=-8",128,0,0,0
  1203. Here is the list of negative type numbers. The phrase "integral
  1204. type" is used to mean twos-complement (I strongly suspect that all
  1205. machines which use stabs use twos-complement; most machines use
  1206. twos-complement these days).
  1207. '-1'
  1208. 'int', 32 bit signed integral type.
  1209. '-2'
  1210. 'char', 8 bit type holding a character. Both GDB and dbx on AIX
  1211. treat this as signed. GCC uses this type whether 'char' is signed
  1212. or not, which seems like a bad idea. The AIX compiler ('xlc')
  1213. seems to avoid this type; it uses -5 instead for 'char'.
  1214. '-3'
  1215. 'short', 16 bit signed integral type.
  1216. '-4'
  1217. 'long', 32 bit signed integral type.
  1218. '-5'
  1219. 'unsigned char', 8 bit unsigned integral type.
  1220. '-6'
  1221. 'signed char', 8 bit signed integral type.
  1222. '-7'
  1223. 'unsigned short', 16 bit unsigned integral type.
  1224. '-8'
  1225. 'unsigned int', 32 bit unsigned integral type.
  1226. '-9'
  1227. 'unsigned', 32 bit unsigned integral type.
  1228. '-10'
  1229. 'unsigned long', 32 bit unsigned integral type.
  1230. '-11'
  1231. 'void', type indicating the lack of a value.
  1232. '-12'
  1233. 'float', IEEE single precision.
  1234. '-13'
  1235. 'double', IEEE double precision.
  1236. '-14'
  1237. 'long double', IEEE double precision. The compiler claims the size
  1238. will increase in a future release, and for binary compatibility you
  1239. have to avoid using 'long double'. I hope when they increase it
  1240. they use a new negative type number.
  1241. '-15'
  1242. 'integer'. 32 bit signed integral type.
  1243. '-16'
  1244. 'boolean'. 32 bit type. GDB and GCC assume that zero is false,
  1245. one is true, and other values have unspecified meaning. I hope
  1246. this agrees with how the IBM tools use the type.
  1247. '-17'
  1248. 'short real'. IEEE single precision.
  1249. '-18'
  1250. 'real'. IEEE double precision.
  1251. '-19'
  1252. 'stringptr'. *Note Strings::.
  1253. '-20'
  1254. 'character', 8 bit unsigned character type.
  1255. '-21'
  1256. 'logical*1', 8 bit type. This Fortran type has a split personality
  1257. in that it is used for boolean variables, but can also be used for
  1258. unsigned integers. 0 is false, 1 is true, and other values are
  1259. non-boolean.
  1260. '-22'
  1261. 'logical*2', 16 bit type. This Fortran type has a split
  1262. personality in that it is used for boolean variables, but can also
  1263. be used for unsigned integers. 0 is false, 1 is true, and other
  1264. values are non-boolean.
  1265. '-23'
  1266. 'logical*4', 32 bit type. This Fortran type has a split
  1267. personality in that it is used for boolean variables, but can also
  1268. be used for unsigned integers. 0 is false, 1 is true, and other
  1269. values are non-boolean.
  1270. '-24'
  1271. 'logical', 32 bit type. This Fortran type has a split personality
  1272. in that it is used for boolean variables, but can also be used for
  1273. unsigned integers. 0 is false, 1 is true, and other values are
  1274. non-boolean.
  1275. '-25'
  1276. 'complex'. A complex type consisting of two IEEE single-precision
  1277. floating point values.
  1278. '-26'
  1279. 'complex'. A complex type consisting of two IEEE double-precision
  1280. floating point values.
  1281. '-27'
  1282. 'integer*1', 8 bit signed integral type.
  1283. '-28'
  1284. 'integer*2', 16 bit signed integral type.
  1285. '-29'
  1286. 'integer*4', 32 bit signed integral type.
  1287. '-30'
  1288. 'wchar'. Wide character, 16 bits wide, unsigned (what format?
  1289. Unicode?).
  1290. '-31'
  1291. 'long long', 64 bit signed integral type.
  1292. '-32'
  1293. 'unsigned long long', 64 bit unsigned integral type.
  1294. '-33'
  1295. 'logical*8', 64 bit unsigned integral type.
  1296. '-34'
  1297. 'integer*8', 64 bit signed integral type.
  1298. 
  1299. File: stabs.info, Node: Miscellaneous Types, Next: Cross-References, Prev: Builtin Types, Up: Types
  1300. 5.2 Miscellaneous Types
  1301. =======================
  1302. 'b TYPE-INFORMATION ; BYTES'
  1303. Pascal space type. This is documented by IBM; what does it mean?
  1304. This use of the 'b' type descriptor can be distinguished from its
  1305. use for builtin integral types (*note Builtin Type Descriptors::)
  1306. because the character following the type descriptor is always a
  1307. digit, '(', or '-'.
  1308. 'B TYPE-INFORMATION'
  1309. A volatile-qualified version of TYPE-INFORMATION. This is a Sun
  1310. extension. References and stores to a variable with a
  1311. volatile-qualified type must not be optimized or cached; they must
  1312. occur as the user specifies them.
  1313. 'd TYPE-INFORMATION'
  1314. File of type TYPE-INFORMATION. As far as I know this is only used
  1315. by Pascal.
  1316. 'k TYPE-INFORMATION'
  1317. A const-qualified version of TYPE-INFORMATION. This is a Sun
  1318. extension. A variable with a const-qualified type cannot be
  1319. modified.
  1320. 'M TYPE-INFORMATION ; LENGTH'
  1321. Multiple instance type. The type seems to composed of LENGTH
  1322. repetitions of TYPE-INFORMATION, for example 'character*3' is
  1323. represented by 'M-2;3', where '-2' is a reference to a character
  1324. type (*note Negative Type Numbers::). I'm not sure how this
  1325. differs from an array. This appears to be a Fortran feature.
  1326. LENGTH is a bound, like those in range types; see *note
  1327. Subranges::.
  1328. 'S TYPE-INFORMATION'
  1329. Pascal set type. TYPE-INFORMATION must be a small type such as an
  1330. enumeration or a subrange, and the type is a bitmask whose length
  1331. is specified by the number of elements in TYPE-INFORMATION.
  1332. In CHILL, if it is a bitstring instead of a set, also use the 'S'
  1333. type attribute (*note String Field::).
  1334. '* TYPE-INFORMATION'
  1335. Pointer to TYPE-INFORMATION.
  1336. 
  1337. File: stabs.info, Node: Cross-References, Next: Subranges, Prev: Miscellaneous Types, Up: Types
  1338. 5.3 Cross-References to Other Types
  1339. ===================================
  1340. A type can be used before it is defined; one common way to deal with
  1341. that situation is just to use a type reference to a type which has not
  1342. yet been defined.
  1343. Another way is with the 'x' type descriptor, which is followed by 's'
  1344. for a structure tag, 'u' for a union tag, or 'e' for a enumerator tag,
  1345. followed by the name of the tag, followed by ':'. If the name contains
  1346. '::' between a '<' and '>' pair (for C++ templates), such a '::' does
  1347. not end the name--only a single ':' ends the name; see *note Nested
  1348. Symbols::.
  1349. For example, the following C declarations:
  1350. struct foo;
  1351. struct foo *bar;
  1352. produce:
  1353. .stabs "bar:G16=*17=xsfoo:",32,0,0,0
  1354. Not all debuggers support the 'x' type descriptor, so on some
  1355. machines GCC does not use it. I believe that for the above example it
  1356. would just emit a reference to type 17 and never define it, but I
  1357. haven't verified that.
  1358. Modula-2 imported types, at least on AIX, use the 'i' type
  1359. descriptor, which is followed by the name of the module from which the
  1360. type is imported, followed by ':', followed by the name of the type.
  1361. There is then optionally a comma followed by type information for the
  1362. type. This differs from merely naming the type (*note Typedefs::) in
  1363. that it identifies the module; I don't understand whether the name of
  1364. the type given here is always just the same as the name we are giving
  1365. it, or whether this type descriptor is used with a nameless stab (*note
  1366. String Field::), or what. The symbol ends with ';'.
  1367. 
  1368. File: stabs.info, Node: Subranges, Next: Arrays, Prev: Cross-References, Up: Types
  1369. 5.4 Subrange Types
  1370. ==================
  1371. The 'r' type descriptor defines a type as a subrange of another type.
  1372. It is followed by type information for the type of which it is a
  1373. subrange, a semicolon, an integral lower bound, a semicolon, an integral
  1374. upper bound, and a semicolon. The AIX documentation does not specify
  1375. the trailing semicolon, in an effort to specify array indexes more
  1376. cleanly, but a subrange which is not an array index has always included
  1377. a trailing semicolon (*note Arrays::).
  1378. Instead of an integer, either bound can be one of the following:
  1379. 'A OFFSET'
  1380. The bound is passed by reference on the stack at offset OFFSET from
  1381. the argument list. *Note Parameters::, for more information on
  1382. such offsets.
  1383. 'T OFFSET'
  1384. The bound is passed by value on the stack at offset OFFSET from the
  1385. argument list.
  1386. 'a REGISTER-NUMBER'
  1387. The bound is passed by reference in register number
  1388. REGISTER-NUMBER.
  1389. 't REGISTER-NUMBER'
  1390. The bound is passed by value in register number REGISTER-NUMBER.
  1391. 'J'
  1392. There is no bound.
  1393. Subranges are also used for builtin types; see *note Traditional
  1394. Builtin Types::.
  1395. 
  1396. File: stabs.info, Node: Arrays, Next: Strings, Prev: Subranges, Up: Types
  1397. 5.5 Array Types
  1398. ===============
  1399. Arrays use the 'a' type descriptor. Following the type descriptor is
  1400. the type of the index and the type of the array elements. If the index
  1401. type is a range type, it ends in a semicolon; otherwise (for example, if
  1402. it is a type reference), there does not appear to be any way to tell
  1403. where the types are separated. In an effort to clean up this mess, IBM
  1404. documents the two types as being separated by a semicolon, and a range
  1405. type as not ending in a semicolon (but this is not right for range types
  1406. which are not array indexes, *note Subranges::). I think probably the
  1407. best solution is to specify that a semicolon ends a range type, and that
  1408. the index type and element type of an array are separated by a
  1409. semicolon, but that if the index type is a range type, the extra
  1410. semicolon can be omitted. GDB (at least through version 4.9) doesn't
  1411. support any kind of index type other than a range anyway; I'm not sure
  1412. about dbx.
  1413. It is well established, and widely used, that the type of the index,
  1414. unlike most types found in the stabs, is merely a type definition, not
  1415. type information (*note String Field::) (that is, it need not start with
  1416. 'TYPE-NUMBER=' if it is defining a new type). According to a comment in
  1417. GDB, this is also true of the type of the array elements; it gives
  1418. 'ar1;1;10;ar1;1;10;4' as a legitimate way to express a two dimensional
  1419. array. According to AIX documentation, the element type must be type
  1420. information. GDB accepts either.
  1421. The type of the index is often a range type, expressed as the type
  1422. descriptor 'r' and some parameters. It defines the size of the array.
  1423. In the example below, the range 'r1;0;2;' defines an index type which is
  1424. a subrange of type 1 (integer), with a lower bound of 0 and an upper
  1425. bound of 2. This defines the valid range of subscripts of a
  1426. three-element C array.
  1427. For example, the definition:
  1428. char char_vec[3] = {'a','b','c'};
  1429. produces the output:
  1430. .stabs "char_vec:G19=ar1;0;2;2",32,0,0,0
  1431. .global _char_vec
  1432. .align 4
  1433. _char_vec:
  1434. .byte 97
  1435. .byte 98
  1436. .byte 99
  1437. If an array is "packed", the elements are spaced more closely than
  1438. normal, saving memory at the expense of speed. For example, an array of
  1439. 3-byte objects might, if unpacked, have each element aligned on a 4-byte
  1440. boundary, but if packed, have no padding. One way to specify that
  1441. something is packed is with type attributes (*note String Field::). In
  1442. the case of arrays, another is to use the 'P' type descriptor instead of
  1443. 'a'. Other than specifying a packed array, 'P' is identical to 'a'.
  1444. An open array is represented by the 'A' type descriptor followed by
  1445. type information specifying the type of the array elements.
  1446. An N-dimensional dynamic array is represented by
  1447. D DIMENSIONS ; TYPE-INFORMATION
  1448. DIMENSIONS is the number of dimensions; TYPE-INFORMATION specifies
  1449. the type of the array elements.
  1450. A subarray of an N-dimensional array is represented by
  1451. E DIMENSIONS ; TYPE-INFORMATION
  1452. DIMENSIONS is the number of dimensions; TYPE-INFORMATION specifies
  1453. the type of the array elements.
  1454. 
  1455. File: stabs.info, Node: Strings, Next: Enumerations, Prev: Arrays, Up: Types
  1456. 5.6 Strings
  1457. ===========
  1458. Some languages, like C or the original Pascal, do not have string types,
  1459. they just have related things like arrays of characters. But most
  1460. Pascals and various other languages have string types, which are
  1461. indicated as follows:
  1462. 'n TYPE-INFORMATION ; BYTES'
  1463. BYTES is the maximum length. I'm not sure what TYPE-INFORMATION
  1464. is; I suspect that it means that this is a string of
  1465. TYPE-INFORMATION (thus allowing a string of integers, a string of
  1466. wide characters, etc., as well as a string of characters). Not
  1467. sure what the format of this type is. This is an AIX feature.
  1468. 'z TYPE-INFORMATION ; BYTES'
  1469. Just like 'n' except that this is a gstring, not an ordinary
  1470. string. I don't know the difference.
  1471. 'N'
  1472. Pascal Stringptr. What is this? This is an AIX feature.
  1473. Languages, such as CHILL which have a string type which is basically
  1474. just an array of characters use the 'S' type attribute (*note String
  1475. Field::).
  1476. 
  1477. File: stabs.info, Node: Enumerations, Next: Structures, Prev: Strings, Up: Types
  1478. 5.7 Enumerations
  1479. ================
  1480. Enumerations are defined with the 'e' type descriptor.
  1481. The source line below declares an enumeration type at file scope.
  1482. The type definition is located after the 'N_RBRAC' that marks the end of
  1483. the previous procedure's block scope, and before the 'N_FUN' that marks
  1484. the beginning of the next procedure's block scope. Therefore it does
  1485. not describe a block local symbol, but a file local one.
  1486. The source line:
  1487. enum e_places {first,second=3,last};
  1488. generates the following stab:
  1489. .stabs "e_places:T22=efirst:0,second:3,last:4,;",128,0,0,0
  1490. The symbol descriptor ('T') says that the stab describes a structure,
  1491. enumeration, or union tag. The type descriptor 'e', following the '22='
  1492. of the type definition narrows it down to an enumeration type.
  1493. Following the 'e' is a list of the elements of the enumeration. The
  1494. format is 'NAME:VALUE,'. The list of elements ends with ';'. The fact
  1495. that VALUE is specified as an integer can cause problems if the value is
  1496. large. GCC 2.5.2 tries to output it in octal in that case with a
  1497. leading zero, which is probably a good thing, although GDB 4.11 supports
  1498. octal only in cases where decimal is perfectly good. Negative decimal
  1499. values are supported by both GDB and dbx.
  1500. There is no standard way to specify the size of an enumeration type;
  1501. it is determined by the architecture (normally all enumerations types
  1502. are 32 bits). Type attributes can be used to specify an enumeration
  1503. type of another size for debuggers which support them; see *note String
  1504. Field::.
  1505. Enumeration types are unusual in that they define symbols for the
  1506. enumeration values ('first', 'second', and 'third' in the above
  1507. example), and even though these symbols are visible in the file as a
  1508. whole (rather than being in a more local namespace like structure member
  1509. names), they are defined in the type definition for the enumeration type
  1510. rather than each having their own symbol. In order to be fast, GDB will
  1511. only get symbols from such types (in its initial scan of the stabs) if
  1512. the type is the first thing defined after a 'T' or 't' symbol descriptor
  1513. (the above example fulfills this requirement). If the type does not
  1514. have a name, the compiler should emit it in a nameless stab (*note
  1515. String Field::); GCC does this.
  1516. 
  1517. File: stabs.info, Node: Structures, Next: Typedefs, Prev: Enumerations, Up: Types
  1518. 5.8 Structures
  1519. ==============
  1520. The encoding of structures in stabs can be shown with an example.
  1521. The following source code declares a structure tag and defines an
  1522. instance of the structure in global scope. Then a 'typedef' equates the
  1523. structure tag with a new type. Separate stabs are generated for the
  1524. structure tag, the structure 'typedef', and the structure instance. The
  1525. stabs for the tag and the 'typedef' are emitted when the definitions are
  1526. encountered. Since the structure elements are not initialized, the stab
  1527. and code for the structure variable itself is located at the end of the
  1528. program in the bss section.
  1529. struct s_tag {
  1530. int s_int;
  1531. float s_float;
  1532. char s_char_vec[8];
  1533. struct s_tag* s_next;
  1534. } g_an_s;
  1535. typedef struct s_tag s_typedef;
  1536. The structure tag has an 'N_LSYM' stab type because, like the
  1537. enumeration, the symbol has file scope. Like the enumeration, the
  1538. symbol descriptor is 'T', for enumeration, structure, or tag type. The
  1539. type descriptor 's' following the '16=' of the type definition narrows
  1540. the symbol type to structure.
  1541. Following the 's' type descriptor is the number of bytes the
  1542. structure occupies, followed by a description of each structure element.
  1543. The structure element descriptions are of the form 'NAME:TYPE, BIT
  1544. OFFSET FROM THE START OF THE STRUCT, NUMBER OF BITS IN THE ELEMENT'.
  1545. # 128 is N_LSYM
  1546. .stabs "s_tag:T16=s20s_int:1,0,32;s_float:12,32,32;
  1547. s_char_vec:17=ar1;0;7;2,64,64;s_next:18=*16,128,32;;",128,0,0,0
  1548. In this example, the first two structure elements are previously
  1549. defined types. For these, the type following the 'NAME:' part of the
  1550. element description is a simple type reference. The other two structure
  1551. elements are new types. In this case there is a type definition
  1552. embedded after the 'NAME:'. The type definition for the array element
  1553. looks just like a type definition for a stand-alone array. The 's_next'
  1554. field is a pointer to the same kind of structure that the field is an
  1555. element of. So the definition of structure type 16 contains a type
  1556. definition for an element which is a pointer to type 16.
  1557. If a field is a static member (this is a C++ feature in which a
  1558. single variable appears to be a field of every structure of a given
  1559. type) it still starts out with the field name, a colon, and the type,
  1560. but then instead of a comma, bit position, comma, and bit size, there is
  1561. a colon followed by the name of the variable which each such field
  1562. refers to.
  1563. If the structure has methods (a C++ feature), they follow the
  1564. non-method fields; see *note Cplusplus::.
  1565. 
  1566. File: stabs.info, Node: Typedefs, Next: Unions, Prev: Structures, Up: Types
  1567. 5.9 Giving a Type a Name
  1568. ========================
  1569. To give a type a name, use the 't' symbol descriptor. The type is
  1570. specified by the type information (*note String Field::) for the stab.
  1571. For example,
  1572. .stabs "s_typedef:t16",128,0,0,0 # 128 is N_LSYM
  1573. specifies that 's_typedef' refers to type number 16. Such stabs have
  1574. symbol type 'N_LSYM' (or 'C_DECL' for XCOFF). (The Sun documentation
  1575. mentions using 'N_GSYM' in some cases).
  1576. If you are specifying the tag name for a structure, union, or
  1577. enumeration, use the 'T' symbol descriptor instead. I believe C is the
  1578. only language with this feature.
  1579. If the type is an opaque type (I believe this is a Modula-2 feature),
  1580. AIX provides a type descriptor to specify it. The type descriptor is
  1581. 'o' and is followed by a name. I don't know what the name means--is it
  1582. always the same as the name of the type, or is this type descriptor used
  1583. with a nameless stab (*note String Field::)? There optionally follows a
  1584. comma followed by type information which defines the type of this type.
  1585. If omitted, a semicolon is used in place of the comma and the type
  1586. information, and the type is much like a generic pointer type--it has a
  1587. known size but little else about it is specified.
  1588. 
  1589. File: stabs.info, Node: Unions, Next: Function Types, Prev: Typedefs, Up: Types
  1590. 5.10 Unions
  1591. ===========
  1592. union u_tag {
  1593. int u_int;
  1594. float u_float;
  1595. char* u_char;
  1596. } an_u;
  1597. This code generates a stab for a union tag and a stab for a union
  1598. variable. Both use the 'N_LSYM' stab type. If a union variable is
  1599. scoped locally to the procedure in which it is defined, its stab is
  1600. located immediately preceding the 'N_LBRAC' for the procedure's block
  1601. start.
  1602. The stab for the union tag, however, is located preceding the code
  1603. for the procedure in which it is defined. The stab type is 'N_LSYM'.
  1604. This would seem to imply that the union type is file scope, like the
  1605. struct type 's_tag'. This is not true. The contents and position of
  1606. the stab for 'u_type' do not convey any information about its procedure
  1607. local scope.
  1608. # 128 is N_LSYM
  1609. .stabs "u_tag:T23=u4u_int:1,0,32;u_float:12,0,32;u_char:21,0,32;;",
  1610. 128,0,0,0
  1611. The symbol descriptor 'T', following the 'name:' means that the stab
  1612. describes an enumeration, structure, or union tag. The type descriptor
  1613. 'u', following the '23=' of the type definition, narrows it down to a
  1614. union type definition. Following the 'u' is the number of bytes in the
  1615. union. After that is a list of union element descriptions. Their
  1616. format is 'NAME:TYPE, BIT OFFSET INTO THE UNION, NUMBER OF BYTES FOR THE
  1617. ELEMENT;'.
  1618. The stab for the union variable is:
  1619. .stabs "an_u:23",128,0,0,-20 # 128 is N_LSYM
  1620. '-20' specifies where the variable is stored (*note Stack
  1621. Variables::).
  1622. 
  1623. File: stabs.info, Node: Function Types, Prev: Unions, Up: Types
  1624. 5.11 Function Types
  1625. ===================
  1626. Various types can be defined for function variables. These types are
  1627. not used in defining functions (*note Procedures::); they are used for
  1628. things like pointers to functions.
  1629. The simple, traditional, type is type descriptor 'f' is followed by
  1630. type information for the return type of the function, followed by a
  1631. semicolon.
  1632. This does not deal with functions for which the number and types of
  1633. the parameters are part of the type, as in Modula-2 or ANSI C. AIX
  1634. provides extensions to specify these, using the 'f', 'F', 'p', and 'R'
  1635. type descriptors.
  1636. First comes the type descriptor. If it is 'f' or 'F', this type
  1637. involves a function rather than a procedure, and the type information
  1638. for the return type of the function follows, followed by a comma. Then
  1639. comes the number of parameters to the function and a semicolon. Then,
  1640. for each parameter, there is the name of the parameter followed by a
  1641. colon (this is only present for type descriptors 'R' and 'F' which
  1642. represent Pascal function or procedure parameters), type information for
  1643. the parameter, a comma, 0 if passed by reference or 1 if passed by
  1644. value, and a semicolon. The type definition ends with a semicolon.
  1645. For example, this variable definition:
  1646. int (*g_pf)();
  1647. generates the following code:
  1648. .stabs "g_pf:G24=*25=f1",32,0,0,0
  1649. .common _g_pf,4,"bss"
  1650. The variable defines a new type, 24, which is a pointer to another
  1651. new type, 25, which is a function returning 'int'.
  1652. 
  1653. File: stabs.info, Node: Macro define and undefine, Next: Symbol Tables, Prev: Types, Up: Top
  1654. 6 Representation of #define and #undef
  1655. **************************************
  1656. This section describes the stabs support for macro define and undefine
  1657. information, supported on some systems. (e.g., with '-g3' '-gstabs'
  1658. when using GCC).
  1659. A '#define MACRO-NAME MACRO-BODY' is represented with an
  1660. 'N_MAC_DEFINE' stab with a string field of 'MACRO-NAME MACRO-BODY'.
  1661. An '#undef MACRO-NAME' is represented with an 'N_MAC_UNDEF' stabs
  1662. with a string field of simply 'MACRO-NAME'.
  1663. For both 'N_MAC_DEFINE' and 'N_MAC_UNDEF', the desc field is the line
  1664. number within the file where the corresponding '#define' or '#undef'
  1665. occurred.
  1666. For example, the following C code:
  1667. #define NONE 42
  1668. #define TWO(a, b) (a + (a) + 2 * b)
  1669. #define ONE(c) (c + 19)
  1670. main(int argc, char *argv[])
  1671. {
  1672. func(NONE, TWO(10, 11));
  1673. func(NONE, ONE(23));
  1674. #undef ONE
  1675. #define ONE(c) (c + 23)
  1676. func(NONE, ONE(-23));
  1677. return (0);
  1678. }
  1679. int global;
  1680. func(int arg1, int arg2)
  1681. {
  1682. global = arg1 + arg2;
  1683. }
  1684. produces the following stabs (as well as many others):
  1685. .stabs "NONE 42",54,0,1,0
  1686. .stabs "TWO(a,b) (a + (a) + 2 * b)",54,0,2,0
  1687. .stabs "ONE(c) (c + 19)",54,0,3,0
  1688. .stabs "ONE",58,0,10,0
  1689. .stabs "ONE(c) (c + 23)",54,0,11,0
  1690. NOTE: In the above example, '54' is 'N_MAC_DEFINE' and '58' is
  1691. 'N_MAC_UNDEF'.
  1692. 
  1693. File: stabs.info, Node: Symbol Tables, Next: Cplusplus, Prev: Macro define and undefine, Up: Top
  1694. 7 Symbol Information in Symbol Tables
  1695. *************************************
  1696. This chapter describes the format of symbol table entries and how stab
  1697. assembler directives map to them. It also describes the transformations
  1698. that the assembler and linker make on data from stabs.
  1699. * Menu:
  1700. * Symbol Table Format::
  1701. * Transformations On Symbol Tables::
  1702. 
  1703. File: stabs.info, Node: Symbol Table Format, Next: Transformations On Symbol Tables, Up: Symbol Tables
  1704. 7.1 Symbol Table Format
  1705. =======================
  1706. Each time the assembler encounters a stab directive, it puts each field
  1707. of the stab into a corresponding field in a symbol table entry of its
  1708. output file. If the stab contains a string field, the symbol table
  1709. entry for that stab points to a string table entry containing the string
  1710. data from the stab. Assembler labels become relocatable addresses.
  1711. Symbol table entries in a.out have the format:
  1712. struct internal_nlist {
  1713. unsigned long n_strx; /* index into string table of name */
  1714. unsigned char n_type; /* type of symbol */
  1715. unsigned char n_other; /* misc info (usually empty) */
  1716. unsigned short n_desc; /* description field */
  1717. bfd_vma n_value; /* value of symbol */
  1718. };
  1719. If the stab has a string, the 'n_strx' field holds the offset in
  1720. bytes of the string within the string table. The string is terminated
  1721. by a NUL character. If the stab lacks a string (for example, it was
  1722. produced by a '.stabn' or '.stabd' directive), the 'n_strx' field is
  1723. zero.
  1724. Symbol table entries with 'n_type' field values greater than 0x1f
  1725. originated as stabs generated by the compiler (with one random
  1726. exception). The other entries were placed in the symbol table of the
  1727. executable by the assembler or the linker.
  1728. 
  1729. File: stabs.info, Node: Transformations On Symbol Tables, Prev: Symbol Table Format, Up: Symbol Tables
  1730. 7.2 Transformations on Symbol Tables
  1731. ====================================
  1732. The linker concatenates object files and does fixups of externally
  1733. defined symbols.
  1734. You can see the transformations made on stab data by the assembler
  1735. and linker by examining the symbol table after each pass of the build.
  1736. To do this, use 'nm -ap', which dumps the symbol table, including
  1737. debugging information, unsorted. For stab entries the columns are:
  1738. VALUE, OTHER, DESC, TYPE, STRING. For assembler and linker symbols, the
  1739. columns are: VALUE, TYPE, STRING.
  1740. The low 5 bits of the stab type tell the linker how to relocate the
  1741. value of the stab. Thus for stab types like 'N_RSYM' and 'N_LSYM',
  1742. where the value is an offset or a register number, the low 5 bits are
  1743. 'N_ABS', which tells the linker not to relocate the value.
  1744. Where the value of a stab contains an assembly language label, it is
  1745. transformed by each build step. The assembler turns it into a
  1746. relocatable address and the linker turns it into an absolute address.
  1747. * Menu:
  1748. * Transformations On Static Variables::
  1749. * Transformations On Global Variables::
  1750. * Stab Section Transformations:: For some object file formats,
  1751. things are a bit different.
  1752. 
  1753. File: stabs.info, Node: Transformations On Static Variables, Next: Transformations On Global Variables, Up: Transformations On Symbol Tables
  1754. 7.2.1 Transformations on Static Variables
  1755. -----------------------------------------
  1756. This source line defines a static variable at file scope:
  1757. static int s_g_repeat
  1758. The following stab describes the symbol:
  1759. .stabs "s_g_repeat:S1",38,0,0,_s_g_repeat
  1760. The assembler transforms the stab into this symbol table entry in the
  1761. '.o' file. The location is expressed as a data segment offset.
  1762. 00000084 - 00 0000 STSYM s_g_repeat:S1
  1763. In the symbol table entry from the executable, the linker has made the
  1764. relocatable address absolute.
  1765. 0000e00c - 00 0000 STSYM s_g_repeat:S1
  1766. 
  1767. File: stabs.info, Node: Transformations On Global Variables, Next: Stab Section Transformations, Prev: Transformations On Static Variables, Up: Transformations On Symbol Tables
  1768. 7.2.2 Transformations on Global Variables
  1769. -----------------------------------------
  1770. Stabs for global variables do not contain location information. In this
  1771. case, the debugger finds location information in the assembler or linker
  1772. symbol table entry describing the variable. The source line:
  1773. char g_foo = 'c';
  1774. generates the stab:
  1775. .stabs "g_foo:G2",32,0,0,0
  1776. The variable is represented by two symbol table entries in the object
  1777. file (see below). The first one originated as a stab. The second one
  1778. is an external symbol. The upper case 'D' signifies that the 'n_type'
  1779. field of the symbol table contains 7, 'N_DATA' with local linkage. The
  1780. stab's value is zero since the value is not used for 'N_GSYM' stabs.
  1781. The value of the linker symbol is the relocatable address corresponding
  1782. to the variable.
  1783. 00000000 - 00 0000 GSYM g_foo:G2
  1784. 00000080 D _g_foo
  1785. These entries as transformed by the linker. The linker symbol table
  1786. entry now holds an absolute address:
  1787. 00000000 - 00 0000 GSYM g_foo:G2
  1788. ...
  1789. 0000e008 D _g_foo
  1790. 
  1791. File: stabs.info, Node: Stab Section Transformations, Prev: Transformations On Global Variables, Up: Transformations On Symbol Tables
  1792. 7.2.3 Transformations of Stabs in separate sections
  1793. ---------------------------------------------------
  1794. For object file formats using stabs in separate sections (*note Stab
  1795. Sections::), use 'objdump --stabs' instead of 'nm' to show the stabs in
  1796. an object or executable file. 'objdump' is a GNU utility; Sun does not
  1797. provide any equivalent.
  1798. The following example is for a stab whose value is an address is
  1799. relative to the compilation unit (*note ELF Linker Relocation::). For
  1800. example, if the source line
  1801. static int ld = 5;
  1802. appears within a function, then the assembly language output from the
  1803. compiler contains:
  1804. .Ddata.data:
  1805. ...
  1806. .stabs "ld:V(0,3)",0x26,0,4,.L18-Ddata.data # 0x26 is N_STSYM
  1807. ...
  1808. .L18:
  1809. .align 4
  1810. .word 0x5
  1811. Because the value is formed by subtracting one symbol from another,
  1812. the value is absolute, not relocatable, and so the object file contains
  1813. Symnum n_type n_othr n_desc n_value n_strx String
  1814. 31 STSYM 0 4 00000004 680 ld:V(0,3)
  1815. without any relocations, and the executable file also contains
  1816. Symnum n_type n_othr n_desc n_value n_strx String
  1817. 31 STSYM 0 4 00000004 680 ld:V(0,3)
  1818. 
  1819. File: stabs.info, Node: Cplusplus, Next: Stab Types, Prev: Symbol Tables, Up: Top
  1820. 8 GNU C++ Stabs
  1821. ***************
  1822. * Menu:
  1823. * Class Names:: C++ class names are both tags and typedefs.
  1824. * Nested Symbols:: C++ symbol names can be within other types.
  1825. * Basic Cplusplus Types::
  1826. * Simple Classes::
  1827. * Class Instance::
  1828. * Methods:: Method definition
  1829. * Method Type Descriptor:: The '#' type descriptor
  1830. * Member Type Descriptor:: The '@' type descriptor
  1831. * Protections::
  1832. * Method Modifiers::
  1833. * Virtual Methods::
  1834. * Inheritance::
  1835. * Virtual Base Classes::
  1836. * Static Members::
  1837. 
  1838. File: stabs.info, Node: Class Names, Next: Nested Symbols, Up: Cplusplus
  1839. 8.1 C++ Class Names
  1840. ===================
  1841. In C++, a class name which is declared with 'class', 'struct', or
  1842. 'union', is not only a tag, as in C, but also a type name. Thus there
  1843. should be stabs with both 't' and 'T' symbol descriptors (*note
  1844. Typedefs::).
  1845. To save space, there is a special abbreviation for this case. If the
  1846. 'T' symbol descriptor is followed by 't', then the stab defines both a
  1847. type name and a tag.
  1848. For example, the C++ code
  1849. struct foo {int x;};
  1850. can be represented as either
  1851. .stabs "foo:T19=s4x:1,0,32;;",128,0,0,0 # 128 is N_LSYM
  1852. .stabs "foo:t19",128,0,0,0
  1853. or
  1854. .stabs "foo:Tt19=s4x:1,0,32;;",128,0,0,0
  1855. 
  1856. File: stabs.info, Node: Nested Symbols, Next: Basic Cplusplus Types, Prev: Class Names, Up: Cplusplus
  1857. 8.2 Defining a Symbol Within Another Type
  1858. =========================================
  1859. In C++, a symbol (such as a type name) can be defined within another
  1860. type.
  1861. In stabs, this is sometimes represented by making the name of a
  1862. symbol which contains '::'. Such a pair of colons does not end the name
  1863. of the symbol, the way a single colon would (*note String Field::). I'm
  1864. not sure how consistently used or well thought out this mechanism is.
  1865. So that a pair of colons in this position always has this meaning, ':'
  1866. cannot be used as a symbol descriptor.
  1867. For example, if the string for a stab is 'foo::bar::baz:t5=*6', then
  1868. 'foo::bar::baz' is the name of the symbol, 't' is the symbol descriptor,
  1869. and '5=*6' is the type information.
  1870. 
  1871. File: stabs.info, Node: Basic Cplusplus Types, Next: Simple Classes, Prev: Nested Symbols, Up: Cplusplus
  1872. 8.3 Basic Types For C++
  1873. =======================
  1874. << the examples that follow are based on a01.C >>
  1875. C++ adds two more builtin types to the set defined for C. These are
  1876. the unknown type and the vtable record type. The unknown type, type 16,
  1877. is defined in terms of itself like the void type.
  1878. The vtable record type, type 17, is defined as a structure type and
  1879. then as a structure tag. The structure has four fields: delta, index,
  1880. pfn, and delta2. pfn is the function pointer.
  1881. << In boilerplate $vtbl_ptr_type, what are the fields delta, index,
  1882. and delta2 used for? >>
  1883. This basic type is present in all C++ programs even if there are no
  1884. virtual methods defined.
  1885. .stabs "struct_name:sym_desc(type)type_def(17)=type_desc(struct)struct_bytes(8)
  1886. elem_name(delta):type_ref(short int),bit_offset(0),field_bits(16);
  1887. elem_name(index):type_ref(short int),bit_offset(16),field_bits(16);
  1888. elem_name(pfn):type_def(18)=type_desc(ptr to)type_ref(void),
  1889. bit_offset(32),field_bits(32);
  1890. elem_name(delta2):type_def(short int);bit_offset(32),field_bits(16);;"
  1891. N_LSYM, NIL, NIL
  1892. .stabs "$vtbl_ptr_type:t17=s8
  1893. delta:6,0,16;index:6,16,16;pfn:18=*15,32,32;delta2:6,32,16;;"
  1894. ,128,0,0,0
  1895. .stabs "name:sym_dec(struct tag)type_ref($vtbl_ptr_type)",N_LSYM,NIL,NIL,NIL
  1896. .stabs "$vtbl_ptr_type:T17",128,0,0,0
  1897. 
  1898. File: stabs.info, Node: Simple Classes, Next: Class Instance, Prev: Basic Cplusplus Types, Up: Cplusplus
  1899. 8.4 Simple Class Definition
  1900. ===========================
  1901. The stabs describing C++ language features are an extension of the stabs
  1902. describing C. Stabs representing C++ class types elaborate extensively
  1903. on the stab format used to describe structure types in C. Stabs
  1904. representing class type variables look just like stabs representing C
  1905. language variables.
  1906. Consider the following very simple class definition.
  1907. class baseA {
  1908. public:
  1909. int Adat;
  1910. int Ameth(int in, char other);
  1911. };
  1912. The class 'baseA' is represented by two stabs. The first stab
  1913. describes the class as a structure type. The second stab describes a
  1914. structure tag of the class type. Both stabs are of stab type 'N_LSYM'.
  1915. Since the stab is not located between an 'N_FUN' and an 'N_LBRAC' stab
  1916. this indicates that the class is defined at file scope. If it were,
  1917. then the 'N_LSYM' would signify a local variable.
  1918. A stab describing a C++ class type is similar in format to a stab
  1919. describing a C struct, with each class member shown as a field in the
  1920. structure. The part of the struct format describing fields is expanded
  1921. to include extra information relevant to C++ class members. In
  1922. addition, if the class has multiple base classes or virtual functions
  1923. the struct format outside of the field parts is also augmented.
  1924. In this simple example the field part of the C++ class stab
  1925. representing member data looks just like the field part of a C struct
  1926. stab. The section on protections describes how its format is sometimes
  1927. extended for member data.
  1928. The field part of a C++ class stab representing a member function
  1929. differs substantially from the field part of a C struct stab. It still
  1930. begins with 'name:' but then goes on to define a new type number for the
  1931. member function, describe its return type, its argument types, its
  1932. protection level, any qualifiers applied to the method definition, and
  1933. whether the method is virtual or not. If the method is virtual then the
  1934. method description goes on to give the vtable index of the method, and
  1935. the type number of the first base class defining the method.
  1936. When the field name is a method name it is followed by two colons
  1937. rather than one. This is followed by a new type definition for the
  1938. method. This is a number followed by an equal sign and the type of the
  1939. method. Normally this will be a type declared using the '#' type
  1940. descriptor; see *note Method Type Descriptor::; static member functions
  1941. are declared using the 'f' type descriptor instead; see *note Function
  1942. Types::.
  1943. The format of an overloaded operator method name differs from that of
  1944. other methods. It is 'op$::OPERATOR-NAME.' where OPERATOR-NAME is the
  1945. operator name such as '+' or '+='. The name ends with a period, and any
  1946. characters except the period can occur in the OPERATOR-NAME string.
  1947. The next part of the method description represents the arguments to
  1948. the method, preceded by a colon and ending with a semi-colon. The types
  1949. of the arguments are expressed in the same way argument types are
  1950. expressed in C++ name mangling. In this example an 'int' and a 'char'
  1951. map to 'ic'.
  1952. This is followed by a number, a letter, and an asterisk or period,
  1953. followed by another semicolon. The number indicates the protections
  1954. that apply to the member function. Here the 2 means public. The letter
  1955. encodes any qualifier applied to the method definition. In this case,
  1956. 'A' means that it is a normal function definition. The dot shows that
  1957. the method is not virtual. The sections that follow elaborate further
  1958. on these fields and describe the additional information present for
  1959. virtual methods.
  1960. .stabs "class_name:sym_desc(type)type_def(20)=type_desc(struct)struct_bytes(4)
  1961. field_name(Adat):type(int),bit_offset(0),field_bits(32);
  1962. method_name(Ameth)::type_def(21)=type_desc(method)return_type(int);
  1963. :arg_types(int char);
  1964. protection(public)qualifier(normal)virtual(no);;"
  1965. N_LSYM,NIL,NIL,NIL
  1966. .stabs "baseA:t20=s4Adat:1,0,32;Ameth::21=##1;:ic;2A.;;",128,0,0,0
  1967. .stabs "class_name:sym_desc(struct tag)",N_LSYM,NIL,NIL,NIL
  1968. .stabs "baseA:T20",128,0,0,0
  1969. 
  1970. File: stabs.info, Node: Class Instance, Next: Methods, Prev: Simple Classes, Up: Cplusplus
  1971. 8.5 Class Instance
  1972. ==================
  1973. As shown above, describing even a simple C++ class definition is
  1974. accomplished by massively extending the stab format used in C to
  1975. describe structure types. However, once the class is defined, C stabs
  1976. with no modifications can be used to describe class instances. The
  1977. following source:
  1978. main () {
  1979. baseA AbaseA;
  1980. }
  1981. yields the following stab describing the class instance. It looks no
  1982. different from a standard C stab describing a local variable.
  1983. .stabs "name:type_ref(baseA)", N_LSYM, NIL, NIL, frame_ptr_offset
  1984. .stabs "AbaseA:20",128,0,0,-20
  1985. 
  1986. File: stabs.info, Node: Methods, Next: Method Type Descriptor, Prev: Class Instance, Up: Cplusplus
  1987. 8.6 Method Definition
  1988. =====================
  1989. The class definition shown above declares Ameth. The C++ source below
  1990. defines Ameth:
  1991. int
  1992. baseA::Ameth(int in, char other)
  1993. {
  1994. return in;
  1995. };
  1996. This method definition yields three stabs following the code of the
  1997. method. One stab describes the method itself and following two describe
  1998. its parameters. Although there is only one formal argument all methods
  1999. have an implicit argument which is the 'this' pointer. The 'this'
  2000. pointer is a pointer to the object on which the method was called. Note
  2001. that the method name is mangled to encode the class name and argument
  2002. types. Name mangling is described in the ARM ('The Annotated C++
  2003. Reference Manual', by Ellis and Stroustrup, ISBN 0-201-51459-1);
  2004. 'gpcompare.texi' in Cygnus GCC distributions describes the differences
  2005. between GNU mangling and ARM mangling.
  2006. .stabs "name:symbol_descriptor(global function)return_type(int)",
  2007. N_FUN, NIL, NIL, code_addr_of_method_start
  2008. .stabs "Ameth__5baseAic:F1",36,0,0,_Ameth__5baseAic
  2009. Here is the stab for the 'this' pointer implicit argument. The name
  2010. of the 'this' pointer is always 'this'. Type 19, the 'this' pointer is
  2011. defined as a pointer to type 20, 'baseA', but a stab defining 'baseA'
  2012. has not yet been emitted. Since the compiler knows it will be emitted
  2013. shortly, here it just outputs a cross reference to the undefined symbol,
  2014. by prefixing the symbol name with 'xs'.
  2015. .stabs "name:sym_desc(register param)type_def(19)=
  2016. type_desc(ptr to)type_ref(baseA)=
  2017. type_desc(cross-reference to)baseA:",N_RSYM,NIL,NIL,register_number
  2018. .stabs "this:P19=*20=xsbaseA:",64,0,0,8
  2019. The stab for the explicit integer argument looks just like a
  2020. parameter to a C function. The last field of the stab is the offset
  2021. from the argument pointer, which in most systems is the same as the
  2022. frame pointer.
  2023. .stabs "name:sym_desc(value parameter)type_ref(int)",
  2024. N_PSYM,NIL,NIL,offset_from_arg_ptr
  2025. .stabs "in:p1",160,0,0,72
  2026. << The examples that follow are based on A1.C >>
  2027. 
  2028. File: stabs.info, Node: Method Type Descriptor, Next: Member Type Descriptor, Prev: Methods, Up: Cplusplus
  2029. 8.7 The '#' Type Descriptor
  2030. ===========================
  2031. This is used to describe a class method. This is a function which takes
  2032. an extra argument as its first argument, for the 'this' pointer.
  2033. If the '#' is immediately followed by another '#', the second one
  2034. will be followed by the return type and a semicolon. The class and
  2035. argument types are not specified, and must be determined by demangling
  2036. the name of the method if it is available.
  2037. Otherwise, the single '#' is followed by the class type, a comma, the
  2038. return type, a comma, and zero or more parameter types separated by
  2039. commas. The list of arguments is terminated by a semicolon. In the
  2040. debugging output generated by gcc, a final argument type of 'void'
  2041. indicates a method which does not take a variable number of arguments.
  2042. If the final argument type of 'void' does not appear, the method was
  2043. declared with an ellipsis.
  2044. Note that although such a type will normally be used to describe
  2045. fields in structures, unions, or classes, for at least some versions of
  2046. the compiler it can also be used in other contexts.
  2047. 
  2048. File: stabs.info, Node: Member Type Descriptor, Next: Protections, Prev: Method Type Descriptor, Up: Cplusplus
  2049. 8.8 The '@' Type Descriptor
  2050. ===========================
  2051. The '@' type descriptor is used for a pointer-to-non-static-member-data
  2052. type. It is followed by type information for the class (or union), a
  2053. comma, and type information for the member data.
  2054. The following C++ source:
  2055. typedef int A::*int_in_a;
  2056. generates the following stab:
  2057. .stabs "int_in_a:t20=21=@19,1",128,0,0,0
  2058. Note that there is a conflict between this and type attributes (*note
  2059. String Field::); both use type descriptor '@'. Fortunately, the '@'
  2060. type descriptor used in this C++ sense always will be followed by a
  2061. digit, '(', or '-', and type attributes never start with those things.
  2062. 
  2063. File: stabs.info, Node: Protections, Next: Method Modifiers, Prev: Member Type Descriptor, Up: Cplusplus
  2064. 8.9 Protections
  2065. ===============
  2066. In the simple class definition shown above all member data and functions
  2067. were publicly accessible. The example that follows contrasts public,
  2068. protected and privately accessible fields and shows how these
  2069. protections are encoded in C++ stabs.
  2070. If the character following the 'FIELD-NAME:' part of the string is
  2071. '/', then the next character is the visibility. '0' means private, '1'
  2072. means protected, and '2' means public. Debuggers should ignore
  2073. visibility characters they do not recognize, and assume a reasonable
  2074. default (such as public) (GDB 4.11 does not, but this should be fixed in
  2075. the next GDB release). If no visibility is specified the field is
  2076. public. The visibility '9' means that the field has been optimized out
  2077. and is public (there is no way to specify an optimized out field with a
  2078. private or protected visibility). Visibility '9' is not supported by
  2079. GDB 4.11; this should be fixed in the next GDB release.
  2080. The following C++ source:
  2081. class vis {
  2082. private:
  2083. int priv;
  2084. protected:
  2085. char prot;
  2086. public:
  2087. float pub;
  2088. };
  2089. generates the following stab:
  2090. # 128 is N_LSYM
  2091. .stabs "vis:T19=s12priv:/01,0,32;prot:/12,32,8;pub:12,64,32;;",128,0,0,0
  2092. 'vis:T19=s12' indicates that type number 19 is a 12 byte structure
  2093. named 'vis' The 'priv' field has public visibility ('/0'), type int
  2094. ('1'), and offset and size ',0,32;'. The 'prot' field has protected
  2095. visibility ('/1'), type char ('2') and offset and size ',32,8;'. The
  2096. 'pub' field has type float ('12'), and offset and size ',64,32;'.
  2097. Protections for member functions are signified by one digit embedded
  2098. in the field part of the stab describing the method. The digit is 0 if
  2099. private, 1 if protected and 2 if public. Consider the C++ class
  2100. definition below:
  2101. class all_methods {
  2102. private:
  2103. int priv_meth(int in){return in;};
  2104. protected:
  2105. char protMeth(char in){return in;};
  2106. public:
  2107. float pubMeth(float in){return in;};
  2108. };
  2109. It generates the following stab. The digit in question is to the
  2110. left of an 'A' in each case. Notice also that in this case two symbol
  2111. descriptors apply to the class name struct tag and struct type.
  2112. .stabs "class_name:sym_desc(struct tag&type)type_def(21)=
  2113. sym_desc(struct)struct_bytes(1)
  2114. meth_name::type_def(22)=sym_desc(method)returning(int);
  2115. :args(int);protection(private)modifier(normal)virtual(no);
  2116. meth_name::type_def(23)=sym_desc(method)returning(char);
  2117. :args(char);protection(protected)modifier(normal)virtual(no);
  2118. meth_name::type_def(24)=sym_desc(method)returning(float);
  2119. :args(float);protection(public)modifier(normal)virtual(no);;",
  2120. N_LSYM,NIL,NIL,NIL
  2121. .stabs "all_methods:Tt21=s1priv_meth::22=##1;:i;0A.;protMeth::23=##2;:c;1A.;
  2122. pubMeth::24=##12;:f;2A.;;",128,0,0,0
  2123. 
  2124. File: stabs.info, Node: Method Modifiers, Next: Virtual Methods, Prev: Protections, Up: Cplusplus
  2125. 8.10 Method Modifiers ('const', 'volatile', 'const volatile')
  2126. =============================================================
  2127. << based on a6.C >>
  2128. In the class example described above all the methods have the normal
  2129. modifier. This method modifier information is located just after the
  2130. protection information for the method. This field has four possible
  2131. character values. Normal methods use 'A', const methods use 'B',
  2132. volatile methods use 'C', and const volatile methods use 'D'. Consider
  2133. the class definition below:
  2134. class A {
  2135. public:
  2136. int ConstMeth (int arg) const { return arg; };
  2137. char VolatileMeth (char arg) volatile { return arg; };
  2138. float ConstVolMeth (float arg) const volatile {return arg; };
  2139. };
  2140. This class is described by the following stab:
  2141. .stabs "class(A):sym_desc(struct)type_def(20)=type_desc(struct)struct_bytes(1)
  2142. meth_name(ConstMeth)::type_def(21)sym_desc(method)
  2143. returning(int);:arg(int);protection(public)modifier(const)virtual(no);
  2144. meth_name(VolatileMeth)::type_def(22)=sym_desc(method)
  2145. returning(char);:arg(char);protection(public)modifier(volatile)virt(no)
  2146. meth_name(ConstVolMeth)::type_def(23)=sym_desc(method)
  2147. returning(float);:arg(float);protection(public)modifier(const volatile)
  2148. virtual(no);;", ...
  2149. .stabs "A:T20=s1ConstMeth::21=##1;:i;2B.;VolatileMeth::22=##2;:c;2C.;
  2150. ConstVolMeth::23=##12;:f;2D.;;",128,0,0,0
  2151. 
  2152. File: stabs.info, Node: Virtual Methods, Next: Inheritance, Prev: Method Modifiers, Up: Cplusplus
  2153. 8.11 Virtual Methods
  2154. ====================
  2155. << The following examples are based on a4.C >>
  2156. The presence of virtual methods in a class definition adds additional
  2157. data to the class description. The extra data is appended to the
  2158. description of the virtual method and to the end of the class
  2159. description. Consider the class definition below:
  2160. class A {
  2161. public:
  2162. int Adat;
  2163. virtual int A_virt (int arg) { return arg; };
  2164. };
  2165. This results in the stab below describing class A. It defines a new
  2166. type (20) which is an 8 byte structure. The first field of the class
  2167. struct is 'Adat', an integer, starting at structure offset 0 and
  2168. occupying 32 bits.
  2169. The second field in the class struct is not explicitly defined by the
  2170. C++ class definition but is implied by the fact that the class contains
  2171. a virtual method. This field is the vtable pointer. The name of the
  2172. vtable pointer field starts with '$vf' and continues with a type
  2173. reference to the class it is part of. In this example the type
  2174. reference for class A is 20 so the name of its vtable pointer field is
  2175. '$vf20', followed by the usual colon.
  2176. Next there is a type definition for the vtable pointer type (21).
  2177. This is in turn defined as a pointer to another new type (22).
  2178. Type 22 is the vtable itself, which is defined as an array, indexed
  2179. by a range of integers between 0 and 1, and whose elements are of type
  2180. 17. Type 17 was the vtable record type defined by the boilerplate C++
  2181. type definitions, as shown earlier.
  2182. The bit offset of the vtable pointer field is 32. The number of bits
  2183. in the field are not specified when the field is a vtable pointer.
  2184. Next is the method definition for the virtual member function
  2185. 'A_virt'. Its description starts out using the same format as the
  2186. non-virtual member functions described above, except instead of a dot
  2187. after the 'A' there is an asterisk, indicating that the function is
  2188. virtual. Since is is virtual some addition information is appended to
  2189. the end of the method description.
  2190. The first number represents the vtable index of the method. This is
  2191. a 32 bit unsigned number with the high bit set, followed by a
  2192. semi-colon.
  2193. The second number is a type reference to the first base class in the
  2194. inheritance hierarchy defining the virtual member function. In this
  2195. case the class stab describes a base class so the virtual function is
  2196. not overriding any other definition of the method. Therefore the
  2197. reference is to the type number of the class that the stab is describing
  2198. (20).
  2199. This is followed by three semi-colons. One marks the end of the
  2200. current sub-section, one marks the end of the method field, and the
  2201. third marks the end of the struct definition.
  2202. For classes containing virtual functions the very last section of the
  2203. string part of the stab holds a type reference to the first base class.
  2204. This is preceded by '~%' and followed by a final semi-colon.
  2205. .stabs "class_name(A):type_def(20)=sym_desc(struct)struct_bytes(8)
  2206. field_name(Adat):type_ref(int),bit_offset(0),field_bits(32);
  2207. field_name(A virt func ptr):type_def(21)=type_desc(ptr to)type_def(22)=
  2208. sym_desc(array)index_type_ref(range of int from 0 to 1);
  2209. elem_type_ref(vtbl elem type),
  2210. bit_offset(32);
  2211. meth_name(A_virt)::typedef(23)=sym_desc(method)returning(int);
  2212. :arg_type(int),protection(public)normal(yes)virtual(yes)
  2213. vtable_index(1);class_first_defining(A);;;~%first_base(A);",
  2214. N_LSYM,NIL,NIL,NIL
  2215. .stabs "A:t20=s8Adat:1,0,32;$vf20:21=*22=ar1;0;1;17,32;
  2216. A_virt::23=##1;:i;2A*-2147483647;20;;;~%20;",128,0,0,0
  2217. 
  2218. File: stabs.info, Node: Inheritance, Next: Virtual Base Classes, Prev: Virtual Methods, Up: Cplusplus
  2219. 8.12 Inheritance
  2220. ================
  2221. Stabs describing C++ derived classes include additional sections that
  2222. describe the inheritance hierarchy of the class. A derived class stab
  2223. also encodes the number of base classes. For each base class it tells
  2224. if the base class is virtual or not, and if the inheritance is private
  2225. or public. It also gives the offset into the object of the portion of
  2226. the object corresponding to each base class.
  2227. This additional information is embedded in the class stab following
  2228. the number of bytes in the struct. First the number of base classes
  2229. appears bracketed by an exclamation point and a comma.
  2230. Then for each base type there repeats a series: a virtual character,
  2231. a visibility character, a number, a comma, another number, and a
  2232. semi-colon.
  2233. The virtual character is '1' if the base class is virtual and '0' if
  2234. not. The visibility character is '2' if the derivation is public, '1'
  2235. if it is protected, and '0' if it is private. Debuggers should ignore
  2236. virtual or visibility characters they do not recognize, and assume a
  2237. reasonable default (such as public and non-virtual) (GDB 4.11 does not,
  2238. but this should be fixed in the next GDB release).
  2239. The number following the virtual and visibility characters is the
  2240. offset from the start of the object to the part of the object pertaining
  2241. to the base class.
  2242. After the comma, the second number is a type_descriptor for the base
  2243. type. Finally a semi-colon ends the series, which repeats for each base
  2244. class.
  2245. The source below defines three base classes 'A', 'B', and 'C' and the
  2246. derived class 'D'.
  2247. class A {
  2248. public:
  2249. int Adat;
  2250. virtual int A_virt (int arg) { return arg; };
  2251. };
  2252. class B {
  2253. public:
  2254. int B_dat;
  2255. virtual int B_virt (int arg) {return arg; };
  2256. };
  2257. class C {
  2258. public:
  2259. int Cdat;
  2260. virtual int C_virt (int arg) {return arg; };
  2261. };
  2262. class D : A, virtual B, public C {
  2263. public:
  2264. int Ddat;
  2265. virtual int A_virt (int arg ) { return arg+1; };
  2266. virtual int B_virt (int arg) { return arg+2; };
  2267. virtual int C_virt (int arg) { return arg+3; };
  2268. virtual int D_virt (int arg) { return arg; };
  2269. };
  2270. Class stabs similar to the ones described earlier are generated for
  2271. each base class.
  2272. .stabs "A:T20=s8Adat:1,0,32;$vf20:21=*22=ar1;0;1;17,32;
  2273. A_virt::23=##1;:i;2A*-2147483647;20;;;~%20;",128,0,0,0
  2274. .stabs "B:Tt25=s8Bdat:1,0,32;$vf25:21,32;B_virt::26=##1;
  2275. :i;2A*-2147483647;25;;;~%25;",128,0,0,0
  2276. .stabs "C:Tt28=s8Cdat:1,0,32;$vf28:21,32;C_virt::29=##1;
  2277. :i;2A*-2147483647;28;;;~%28;",128,0,0,0
  2278. In the stab describing derived class 'D' below, the information about
  2279. the derivation of this class is encoded as follows.
  2280. .stabs "derived_class_name:symbol_descriptors(struct tag&type)=
  2281. type_descriptor(struct)struct_bytes(32)!num_bases(3),
  2282. base_virtual(no)inheritance_public(no)base_offset(0),
  2283. base_class_type_ref(A);
  2284. base_virtual(yes)inheritance_public(no)base_offset(NIL),
  2285. base_class_type_ref(B);
  2286. base_virtual(no)inheritance_public(yes)base_offset(64),
  2287. base_class_type_ref(C); ...
  2288. .stabs "D:Tt31=s32!3,000,20;100,25;0264,28;$vb25:24,128;Ddat:
  2289. 1,160,32;A_virt::32=##1;:i;2A*-2147483647;20;;B_virt:
  2290. :32:i;2A*-2147483647;25;;C_virt::32:i;2A*-2147483647;
  2291. 28;;D_virt::32:i;2A*-2147483646;31;;;~%20;",128,0,0,0
  2292. 
  2293. File: stabs.info, Node: Virtual Base Classes, Next: Static Members, Prev: Inheritance, Up: Cplusplus
  2294. 8.13 Virtual Base Classes
  2295. =========================
  2296. A derived class object consists of a concatenation in memory of the data
  2297. areas defined by each base class, starting with the leftmost and ending
  2298. with the rightmost in the list of base classes. The exception to this
  2299. rule is for virtual inheritance. In the example above, class 'D'
  2300. inherits virtually from base class 'B'. This means that an instance of
  2301. a 'D' object will not contain its own 'B' part but merely a pointer to a
  2302. 'B' part, known as a virtual base pointer.
  2303. In a derived class stab, the base offset part of the derivation
  2304. information, described above, shows how the base class parts are
  2305. ordered. The base offset for a virtual base class is always given as 0.
  2306. Notice that the base offset for 'B' is given as 0 even though 'B' is not
  2307. the first base class. The first base class 'A' starts at offset 0.
  2308. The field information part of the stab for class 'D' describes the
  2309. field which is the pointer to the virtual base class 'B'. The vbase
  2310. pointer name is '$vb' followed by a type reference to the virtual base
  2311. class. Since the type id for 'B' in this example is 25, the vbase
  2312. pointer name is '$vb25'.
  2313. .stabs "D:Tt31=s32!3,000,20;100,25;0264,28;$vb25:24,128;Ddat:1,
  2314. 160,32;A_virt::32=##1;:i;2A*-2147483647;20;;B_virt::32:i;
  2315. 2A*-2147483647;25;;C_virt::32:i;2A*-2147483647;28;;D_virt:
  2316. :32:i;2A*-2147483646;31;;;~%20;",128,0,0,0
  2317. Following the name and a semicolon is a type reference describing the
  2318. type of the virtual base class pointer, in this case 24. Type 24 was
  2319. defined earlier as the type of the 'B' class 'this' pointer. The 'this'
  2320. pointer for a class is a pointer to the class type.
  2321. .stabs "this:P24=*25=xsB:",64,0,0,8
  2322. Finally the field offset part of the vbase pointer field description
  2323. shows that the vbase pointer is the first field in the 'D' object,
  2324. before any data fields defined by the class. The layout of a 'D' class
  2325. object is a follows, 'Adat' at 0, the vtable pointer for 'A' at 32,
  2326. 'Cdat' at 64, the vtable pointer for C at 96, the virtual base pointer
  2327. for 'B' at 128, and 'Ddat' at 160.
  2328. 
  2329. File: stabs.info, Node: Static Members, Prev: Virtual Base Classes, Up: Cplusplus
  2330. 8.14 Static Members
  2331. ===================
  2332. The data area for a class is a concatenation of the space used by the
  2333. data members of the class. If the class has virtual methods, a vtable
  2334. pointer follows the class data. The field offset part of each field
  2335. description in the class stab shows this ordering.
  2336. << How is this reflected in stabs? See Cygnus bug #677 for some
  2337. info. >>
  2338. 
  2339. File: stabs.info, Node: Stab Types, Next: Symbol Descriptors, Prev: Cplusplus, Up: Top
  2340. Appendix A Table of Stab Types
  2341. ******************************
  2342. The following are all the possible values for the stab type field, for
  2343. a.out files, in numeric order. This does not apply to XCOFF, but it
  2344. does apply to stabs in sections (*note Stab Sections::). Stabs in ECOFF
  2345. use these values but add 0x8f300 to distinguish them from non-stab
  2346. symbols.
  2347. The symbolic names are defined in the file 'include/aout/stabs.def'.
  2348. * Menu:
  2349. * Non-Stab Symbol Types:: Types from 0 to 0x1f
  2350. * Stab Symbol Types:: Types from 0x20 to 0xff
  2351. 
  2352. File: stabs.info, Node: Non-Stab Symbol Types, Next: Stab Symbol Types, Up: Stab Types
  2353. A.1 Non-Stab Symbol Types
  2354. =========================
  2355. The following types are used by the linker and assembler, not by stab
  2356. directives. Since this document does not attempt to describe aspects of
  2357. object file format other than the debugging format, no details are
  2358. given.
  2359. '0x0 N_UNDF'
  2360. Undefined symbol
  2361. '0x2 N_ABS'
  2362. File scope absolute symbol
  2363. '0x3 N_ABS | N_EXT'
  2364. External absolute symbol
  2365. '0x4 N_TEXT'
  2366. File scope text symbol
  2367. '0x5 N_TEXT | N_EXT'
  2368. External text symbol
  2369. '0x6 N_DATA'
  2370. File scope data symbol
  2371. '0x7 N_DATA | N_EXT'
  2372. External data symbol
  2373. '0x8 N_BSS'
  2374. File scope BSS symbol
  2375. '0x9 N_BSS | N_EXT'
  2376. External BSS symbol
  2377. '0x0c N_FN_SEQ'
  2378. Same as 'N_FN', for Sequent compilers
  2379. '0x0a N_INDR'
  2380. Symbol is indirected to another symbol
  2381. '0x12 N_COMM'
  2382. Common--visible after shared library dynamic link
  2383. '0x14 N_SETA'
  2384. '0x15 N_SETA | N_EXT'
  2385. Absolute set element
  2386. '0x16 N_SETT'
  2387. '0x17 N_SETT | N_EXT'
  2388. Text segment set element
  2389. '0x18 N_SETD'
  2390. '0x19 N_SETD | N_EXT'
  2391. Data segment set element
  2392. '0x1a N_SETB'
  2393. '0x1b N_SETB | N_EXT'
  2394. BSS segment set element
  2395. '0x1c N_SETV'
  2396. '0x1d N_SETV | N_EXT'
  2397. Pointer to set vector
  2398. '0x1e N_WARNING'
  2399. Print a warning message during linking
  2400. '0x1f N_FN'
  2401. File name of a '.o' file
  2402. 
  2403. File: stabs.info, Node: Stab Symbol Types, Prev: Non-Stab Symbol Types, Up: Stab Types
  2404. A.2 Stab Symbol Types
  2405. =====================
  2406. The following symbol types indicate that this is a stab. This is the
  2407. full list of stab numbers, including stab types that are used in
  2408. languages other than C.
  2409. '0x20 N_GSYM'
  2410. Global symbol; see *note Global Variables::.
  2411. '0x22 N_FNAME'
  2412. Function name (for BSD Fortran); see *note Procedures::.
  2413. '0x24 N_FUN'
  2414. Function name (*note Procedures::) or text segment variable (*note
  2415. Statics::).
  2416. '0x26 N_STSYM'
  2417. Data segment file-scope variable; see *note Statics::.
  2418. '0x28 N_LCSYM'
  2419. BSS segment file-scope variable; see *note Statics::.
  2420. '0x2a N_MAIN'
  2421. Name of main routine; see *note Main Program::.
  2422. '0x2c N_ROSYM'
  2423. Variable in '.rodata' section; see *note Statics::.
  2424. '0x30 N_PC'
  2425. Global symbol (for Pascal); see *note N_PC::.
  2426. '0x32 N_NSYMS'
  2427. Number of symbols (according to Ultrix V4.0); see *note N_NSYMS::.
  2428. '0x34 N_NOMAP'
  2429. No DST map; see *note N_NOMAP::.
  2430. '0x36 N_MAC_DEFINE'
  2431. Name and body of a '#define'd macro; see *note Macro define and
  2432. undefine::.
  2433. '0x38 N_OBJ'
  2434. Object file (Solaris2).
  2435. '0x3a N_MAC_UNDEF'
  2436. Name of an '#undef'ed macro; see *note Macro define and undefine::.
  2437. '0x3c N_OPT'
  2438. Debugger options (Solaris2).
  2439. '0x40 N_RSYM'
  2440. Register variable; see *note Register Variables::.
  2441. '0x42 N_M2C'
  2442. Modula-2 compilation unit; see *note N_M2C::.
  2443. '0x44 N_SLINE'
  2444. Line number in text segment; see *note Line Numbers::.
  2445. '0x46 N_DSLINE'
  2446. Line number in data segment; see *note Line Numbers::.
  2447. '0x48 N_BSLINE'
  2448. Line number in bss segment; see *note Line Numbers::.
  2449. '0x48 N_BROWS'
  2450. Sun source code browser, path to '.cb' file; see *note N_BROWS::.
  2451. '0x4a N_DEFD'
  2452. GNU Modula2 definition module dependency; see *note N_DEFD::.
  2453. '0x4c N_FLINE'
  2454. Function start/body/end line numbers (Solaris2).
  2455. '0x50 N_EHDECL'
  2456. GNU C++ exception variable; see *note N_EHDECL::.
  2457. '0x50 N_MOD2'
  2458. Modula2 info "for imc" (according to Ultrix V4.0); see *note
  2459. N_MOD2::.
  2460. '0x54 N_CATCH'
  2461. GNU C++ 'catch' clause; see *note N_CATCH::.
  2462. '0x60 N_SSYM'
  2463. Structure of union element; see *note N_SSYM::.
  2464. '0x62 N_ENDM'
  2465. Last stab for module (Solaris2).
  2466. '0x64 N_SO'
  2467. Path and name of source file; see *note Source Files::.
  2468. '0x80 N_LSYM'
  2469. Stack variable (*note Stack Variables::) or type (*note
  2470. Typedefs::).
  2471. '0x82 N_BINCL'
  2472. Beginning of an include file (Sun only); see *note Include Files::.
  2473. '0x84 N_SOL'
  2474. Name of include file; see *note Include Files::.
  2475. '0xa0 N_PSYM'
  2476. Parameter variable; see *note Parameters::.
  2477. '0xa2 N_EINCL'
  2478. End of an include file; see *note Include Files::.
  2479. '0xa4 N_ENTRY'
  2480. Alternate entry point; see *note Alternate Entry Points::.
  2481. '0xc0 N_LBRAC'
  2482. Beginning of a lexical block; see *note Block Structure::.
  2483. '0xc2 N_EXCL'
  2484. Place holder for a deleted include file; see *note Include Files::.
  2485. '0xc4 N_SCOPE'
  2486. Modula2 scope information (Sun linker); see *note N_SCOPE::.
  2487. '0xe0 N_RBRAC'
  2488. End of a lexical block; see *note Block Structure::.
  2489. '0xe2 N_BCOMM'
  2490. Begin named common block; see *note Common Blocks::.
  2491. '0xe4 N_ECOMM'
  2492. End named common block; see *note Common Blocks::.
  2493. '0xe8 N_ECOML'
  2494. Member of a common block; see *note Common Blocks::.
  2495. '0xea N_WITH'
  2496. Pascal 'with' statement: type,,0,0,offset (Solaris2).
  2497. '0xf0 N_NBTEXT'
  2498. Gould non-base registers; see *note Gould::.
  2499. '0xf2 N_NBDATA'
  2500. Gould non-base registers; see *note Gould::.
  2501. '0xf4 N_NBBSS'
  2502. Gould non-base registers; see *note Gould::.
  2503. '0xf6 N_NBSTS'
  2504. Gould non-base registers; see *note Gould::.
  2505. '0xf8 N_NBLCS'
  2506. Gould non-base registers; see *note Gould::.
  2507. 
  2508. File: stabs.info, Node: Symbol Descriptors, Next: Type Descriptors, Prev: Stab Types, Up: Top
  2509. Appendix B Table of Symbol Descriptors
  2510. **************************************
  2511. The symbol descriptor is the character which follows the colon in many
  2512. stabs, and which tells what kind of stab it is. *Note String Field::,
  2513. for more information about their use.
  2514. 'DIGIT'
  2515. '('
  2516. '-'
  2517. Variable on the stack; see *note Stack Variables::.
  2518. ':'
  2519. C++ nested symbol; see *Note Nested Symbols::.
  2520. 'a'
  2521. Parameter passed by reference in register; see *note Reference
  2522. Parameters::.
  2523. 'b'
  2524. Based variable; see *note Based Variables::.
  2525. 'c'
  2526. Constant; see *note Constants::.
  2527. 'C'
  2528. Conformant array bound (Pascal, maybe other languages); *note
  2529. Conformant Arrays::. Name of a caught exception (GNU C++). These
  2530. can be distinguished because the latter uses 'N_CATCH' and the
  2531. former uses another symbol type.
  2532. 'd'
  2533. Floating point register variable; see *note Register Variables::.
  2534. 'D'
  2535. Parameter in floating point register; see *note Register
  2536. Parameters::.
  2537. 'f'
  2538. File scope function; see *note Procedures::.
  2539. 'F'
  2540. Global function; see *note Procedures::.
  2541. 'G'
  2542. Global variable; see *note Global Variables::.
  2543. 'i'
  2544. *Note Register Parameters::.
  2545. 'I'
  2546. Internal (nested) procedure; see *note Nested Procedures::.
  2547. 'J'
  2548. Internal (nested) function; see *note Nested Procedures::.
  2549. 'L'
  2550. Label name (documented by AIX, no further information known).
  2551. 'm'
  2552. Module; see *note Procedures::.
  2553. 'p'
  2554. Argument list parameter; see *note Parameters::.
  2555. 'pP'
  2556. *Note Parameters::.
  2557. 'pF'
  2558. Fortran Function parameter; see *note Parameters::.
  2559. 'P'
  2560. Unfortunately, three separate meanings have been independently
  2561. invented for this symbol descriptor. At least the GNU and Sun uses
  2562. can be distinguished by the symbol type. Global Procedure (AIX)
  2563. (symbol type used unknown); see *note Procedures::. Register
  2564. parameter (GNU) (symbol type 'N_PSYM'); see *note Parameters::.
  2565. Prototype of function referenced by this file (Sun 'acc') (symbol
  2566. type 'N_FUN').
  2567. 'Q'
  2568. Static Procedure; see *note Procedures::.
  2569. 'R'
  2570. Register parameter; see *note Register Parameters::.
  2571. 'r'
  2572. Register variable; see *note Register Variables::.
  2573. 'S'
  2574. File scope variable; see *note Statics::.
  2575. 's'
  2576. Local variable (OS9000).
  2577. 't'
  2578. Type name; see *note Typedefs::.
  2579. 'T'
  2580. Enumeration, structure, or union tag; see *note Typedefs::.
  2581. 'v'
  2582. Parameter passed by reference; see *note Reference Parameters::.
  2583. 'V'
  2584. Procedure scope static variable; see *note Statics::.
  2585. 'x'
  2586. Conformant array; see *note Conformant Arrays::.
  2587. 'X'
  2588. Function return variable; see *note Parameters::.
  2589. 
  2590. File: stabs.info, Node: Type Descriptors, Next: Expanded Reference, Prev: Symbol Descriptors, Up: Top
  2591. Appendix C Table of Type Descriptors
  2592. ************************************
  2593. The type descriptor is the character which follows the type number and
  2594. an equals sign. It specifies what kind of type is being defined. *Note
  2595. String Field::, for more information about their use.
  2596. 'DIGIT'
  2597. '('
  2598. Type reference; see *note String Field::.
  2599. '-'
  2600. Reference to builtin type; see *note Negative Type Numbers::.
  2601. '#'
  2602. Method (C++); see *note Method Type Descriptor::.
  2603. '*'
  2604. Pointer; see *note Miscellaneous Types::.
  2605. '&'
  2606. Reference (C++).
  2607. '@'
  2608. Type Attributes (AIX); see *note String Field::. Member (class and
  2609. variable) type (GNU C++); see *note Member Type Descriptor::.
  2610. 'a'
  2611. Array; see *note Arrays::.
  2612. 'A'
  2613. Open array; see *note Arrays::.
  2614. 'b'
  2615. Pascal space type (AIX); see *note Miscellaneous Types::. Builtin
  2616. integer type (Sun); see *note Builtin Type Descriptors::. Const
  2617. and volatile qualified type (OS9000).
  2618. 'B'
  2619. Volatile-qualified type; see *note Miscellaneous Types::.
  2620. 'c'
  2621. Complex builtin type (AIX); see *note Builtin Type Descriptors::.
  2622. Const-qualified type (OS9000).
  2623. 'C'
  2624. COBOL Picture type. See AIX documentation for details.
  2625. 'd'
  2626. File type; see *note Miscellaneous Types::.
  2627. 'D'
  2628. N-dimensional dynamic array; see *note Arrays::.
  2629. 'e'
  2630. Enumeration type; see *note Enumerations::.
  2631. 'E'
  2632. N-dimensional subarray; see *note Arrays::.
  2633. 'f'
  2634. Function type; see *note Function Types::.
  2635. 'F'
  2636. Pascal function parameter; see *note Function Types::
  2637. 'g'
  2638. Builtin floating point type; see *note Builtin Type Descriptors::.
  2639. 'G'
  2640. COBOL Group. See AIX documentation for details.
  2641. 'i'
  2642. Imported type (AIX); see *note Cross-References::.
  2643. Volatile-qualified type (OS9000).
  2644. 'k'
  2645. Const-qualified type; see *note Miscellaneous Types::.
  2646. 'K'
  2647. COBOL File Descriptor. See AIX documentation for details.
  2648. 'M'
  2649. Multiple instance type; see *note Miscellaneous Types::.
  2650. 'n'
  2651. String type; see *note Strings::.
  2652. 'N'
  2653. Stringptr; see *note Strings::.
  2654. 'o'
  2655. Opaque type; see *note Typedefs::.
  2656. 'p'
  2657. Procedure; see *note Function Types::.
  2658. 'P'
  2659. Packed array; see *note Arrays::.
  2660. 'r'
  2661. Range type; see *note Subranges::.
  2662. 'R'
  2663. Builtin floating type; see *note Builtin Type Descriptors:: (Sun).
  2664. Pascal subroutine parameter; see *note Function Types:: (AIX).
  2665. Detecting this conflict is possible with careful parsing (hint: a
  2666. Pascal subroutine parameter type will always contain a comma, and a
  2667. builtin type descriptor never will).
  2668. 's'
  2669. Structure type; see *note Structures::.
  2670. 'S'
  2671. Set type; see *note Miscellaneous Types::.
  2672. 'u'
  2673. Union; see *note Unions::.
  2674. 'v'
  2675. Variant record. This is a Pascal and Modula-2 feature which is
  2676. like a union within a struct in C. See AIX documentation for
  2677. details.
  2678. 'w'
  2679. Wide character; see *note Builtin Type Descriptors::.
  2680. 'x'
  2681. Cross-reference; see *note Cross-References::.
  2682. 'Y'
  2683. Used by IBM's xlC C++ compiler (for structures, I think).
  2684. 'z'
  2685. gstring; see *note Strings::.
  2686. 
  2687. File: stabs.info, Node: Expanded Reference, Next: Questions, Prev: Type Descriptors, Up: Top
  2688. Appendix D Expanded Reference by Stab Type
  2689. ******************************************
  2690. For a full list of stab types, and cross-references to where they are
  2691. described, see *note Stab Types::. This appendix just covers certain
  2692. stabs which are not yet described in the main body of this document;
  2693. eventually the information will all be in one place.
  2694. Format of an entry:
  2695. The first line is the symbol type (see 'include/aout/stab.def').
  2696. The second line describes the language constructs the symbol type
  2697. represents.
  2698. The third line is the stab format with the significant stab fields
  2699. named and the rest NIL.
  2700. Subsequent lines expand upon the meaning and possible values for each
  2701. significant stab field.
  2702. Finally, any further information.
  2703. * Menu:
  2704. * N_PC:: Pascal global symbol
  2705. * N_NSYMS:: Number of symbols
  2706. * N_NOMAP:: No DST map
  2707. * N_M2C:: Modula-2 compilation unit
  2708. * N_BROWS:: Path to .cb file for Sun source code browser
  2709. * N_DEFD:: GNU Modula2 definition module dependency
  2710. * N_EHDECL:: GNU C++ exception variable
  2711. * N_MOD2:: Modula2 information "for imc"
  2712. * N_CATCH:: GNU C++ "catch" clause
  2713. * N_SSYM:: Structure or union element
  2714. * N_SCOPE:: Modula2 scope information (Sun only)
  2715. * Gould:: non-base register symbols used on Gould systems
  2716. * N_LENG:: Length of preceding entry
  2717. 
  2718. File: stabs.info, Node: N_PC, Next: N_NSYMS, Up: Expanded Reference
  2719. D.1 N_PC
  2720. ========
  2721. -- '.stabs': N_PC
  2722. Global symbol (for Pascal).
  2723. "name" -> "symbol_name" <<?>>
  2724. value -> supposedly the line number (stab.def is skeptical)
  2725. 'stabdump.c' says:
  2726. global pascal symbol: name,,0,subtype,line
  2727. << subtype? >>
  2728. 
  2729. File: stabs.info, Node: N_NSYMS, Next: N_NOMAP, Prev: N_PC, Up: Expanded Reference
  2730. D.2 N_NSYMS
  2731. ===========
  2732. -- '.stabn': N_NSYMS
  2733. Number of symbols (according to Ultrix V4.0).
  2734. 0, files,,funcs,lines (stab.def)
  2735. 
  2736. File: stabs.info, Node: N_NOMAP, Next: N_M2C, Prev: N_NSYMS, Up: Expanded Reference
  2737. D.3 N_NOMAP
  2738. ===========
  2739. -- '.stabs': N_NOMAP
  2740. No DST map for symbol (according to Ultrix V4.0). I think this
  2741. means a variable has been optimized out.
  2742. name, ,0,type,ignored (stab.def)
  2743. 
  2744. File: stabs.info, Node: N_M2C, Next: N_BROWS, Prev: N_NOMAP, Up: Expanded Reference
  2745. D.4 N_M2C
  2746. =========
  2747. -- '.stabs': N_M2C
  2748. Modula-2 compilation unit.
  2749. "string" -> "unit_name,unit_time_stamp[,code_time_stamp]"
  2750. desc -> unit_number
  2751. value -> 0 (main unit)
  2752. 1 (any other unit)
  2753. See 'Dbx and Dbxtool Interfaces', 2nd edition, by Sun, 1988, for
  2754. more information.
  2755. 
  2756. File: stabs.info, Node: N_BROWS, Next: N_DEFD, Prev: N_M2C, Up: Expanded Reference
  2757. D.5 N_BROWS
  2758. ===========
  2759. -- '.stabs': N_BROWS
  2760. Sun source code browser, path to '.cb' file
  2761. <<?>> "path to associated '.cb' file"
  2762. Note: N_BROWS has the same value as N_BSLINE.
  2763. 
  2764. File: stabs.info, Node: N_DEFD, Next: N_EHDECL, Prev: N_BROWS, Up: Expanded Reference
  2765. D.6 N_DEFD
  2766. ==========
  2767. -- '.stabn': N_DEFD
  2768. GNU Modula2 definition module dependency.
  2769. GNU Modula-2 definition module dependency. The value is the
  2770. modification time of the definition file. The other field is
  2771. non-zero if it is imported with the GNU M2 keyword '%INITIALIZE'.
  2772. Perhaps 'N_M2C' can be used if there are enough empty fields?
  2773. 
  2774. File: stabs.info, Node: N_EHDECL, Next: N_MOD2, Prev: N_DEFD, Up: Expanded Reference
  2775. D.7 N_EHDECL
  2776. ============
  2777. -- '.stabs': N_EHDECL
  2778. GNU C++ exception variable <<?>>.
  2779. "STRING is variable name"
  2780. Note: conflicts with 'N_MOD2'.
  2781. 
  2782. File: stabs.info, Node: N_MOD2, Next: N_CATCH, Prev: N_EHDECL, Up: Expanded Reference
  2783. D.8 N_MOD2
  2784. ==========
  2785. -- '.stab?': N_MOD2
  2786. Modula2 info "for imc" (according to Ultrix V4.0)
  2787. Note: conflicts with 'N_EHDECL' <<?>>
  2788. 
  2789. File: stabs.info, Node: N_CATCH, Next: N_SSYM, Prev: N_MOD2, Up: Expanded Reference
  2790. D.9 N_CATCH
  2791. ===========
  2792. -- '.stabn': N_CATCH
  2793. GNU C++ 'catch' clause
  2794. GNU C++ 'catch' clause. The value is its address. The desc field
  2795. is nonzero if this entry is immediately followed by a 'CAUGHT' stab
  2796. saying what exception was caught. Multiple 'CAUGHT' stabs means
  2797. that multiple exceptions can be caught here. If desc is 0, it
  2798. means all exceptions are caught here.
  2799. 
  2800. File: stabs.info, Node: N_SSYM, Next: N_SCOPE, Prev: N_CATCH, Up: Expanded Reference
  2801. D.10 N_SSYM
  2802. ===========
  2803. -- '.stabn': N_SSYM
  2804. Structure or union element.
  2805. The value is the offset in the structure.
  2806. <<?looking at structs and unions in C I didn't see these>>
  2807. 
  2808. File: stabs.info, Node: N_SCOPE, Next: Gould, Prev: N_SSYM, Up: Expanded Reference
  2809. D.11 N_SCOPE
  2810. ============
  2811. -- '.stab?': N_SCOPE
  2812. Modula2 scope information (Sun linker) <<?>>
  2813. 
  2814. File: stabs.info, Node: Gould, Next: N_LENG, Prev: N_SCOPE, Up: Expanded Reference
  2815. D.12 Non-base registers on Gould systems
  2816. ========================================
  2817. -- '.stab?': N_NBTEXT
  2818. -- '.stab?': N_NBDATA
  2819. -- '.stab?': N_NBBSS
  2820. -- '.stab?': N_NBSTS
  2821. -- '.stab?': N_NBLCS
  2822. These are used on Gould systems for non-base registers syms.
  2823. However, the following values are not the values used by Gould;
  2824. they are the values which GNU has been documenting for these values
  2825. for a long time, without actually checking what Gould uses. I
  2826. include these values only because perhaps some someone actually did
  2827. something with the GNU information (I hope not, why GNU knowingly
  2828. assigned wrong values to these in the header file is a complete
  2829. mystery to me).
  2830. 240 0xf0 N_NBTEXT ??
  2831. 242 0xf2 N_NBDATA ??
  2832. 244 0xf4 N_NBBSS ??
  2833. 246 0xf6 N_NBSTS ??
  2834. 248 0xf8 N_NBLCS ??
  2835. 
  2836. File: stabs.info, Node: N_LENG, Prev: Gould, Up: Expanded Reference
  2837. D.13 N_LENG
  2838. ===========
  2839. -- '.stabn': N_LENG
  2840. Second symbol entry containing a length-value for the preceding
  2841. entry. The value is the length.
  2842. 
  2843. File: stabs.info, Node: Questions, Next: Stab Sections, Prev: Expanded Reference, Up: Top
  2844. Appendix E Questions and Anomalies
  2845. **********************************
  2846. * For GNU C stabs defining local and global variables ('N_LSYM' and
  2847. 'N_GSYM'), the desc field is supposed to contain the source line
  2848. number on which the variable is defined. In reality the desc field
  2849. is always 0. (This behavior is defined in 'dbxout.c' and putting a
  2850. line number in desc is controlled by '#ifdef WINNING_GDB', which
  2851. defaults to false). GDB supposedly uses this information if you
  2852. say 'list VAR'. In reality, VAR can be a variable defined in the
  2853. program and GDB says 'function VAR not defined'.
  2854. * In GNU C stabs, there seems to be no way to differentiate tag
  2855. types: structures, unions, and enums (symbol descriptor 'T') and
  2856. typedefs (symbol descriptor 't') defined at file scope from types
  2857. defined locally to a procedure or other more local scope. They all
  2858. use the 'N_LSYM' stab type. Types defined at procedure scope are
  2859. emitted after the 'N_RBRAC' of the preceding function and before
  2860. the code of the procedure in which they are defined. This is
  2861. exactly the same as types defined in the source file between the
  2862. two procedure bodies. GDB over-compensates by placing all types in
  2863. block #1, the block for symbols of file scope. This is true for
  2864. default, '-ansi' and '-traditional' compiler options. (Bugs
  2865. gcc/1063, gdb/1066.)
  2866. * What ends the procedure scope? Is it the proc block's 'N_RBRAC' or
  2867. the next 'N_FUN'? (I believe its the first.)
  2868. 
  2869. File: stabs.info, Node: Stab Sections, Next: GNU Free Documentation License, Prev: Questions, Up: Top
  2870. Appendix F Using Stabs in Their Own Sections
  2871. ********************************************
  2872. Many object file formats allow tools to create object files with custom
  2873. sections containing any arbitrary data. For any such object file
  2874. format, stabs can be embedded in special sections. This is how stabs
  2875. are used with ELF and SOM, and aside from ECOFF and XCOFF, is how stabs
  2876. are used with COFF.
  2877. * Menu:
  2878. * Stab Section Basics:: How to embed stabs in sections
  2879. * ELF Linker Relocation:: Sun ELF hacks
  2880. 
  2881. File: stabs.info, Node: Stab Section Basics, Next: ELF Linker Relocation, Up: Stab Sections
  2882. F.1 How to Embed Stabs in Sections
  2883. ==================================
  2884. The assembler creates two custom sections, a section named '.stab' which
  2885. contains an array of fixed length structures, one struct per stab, and a
  2886. section named '.stabstr' containing all the variable length strings that
  2887. are referenced by stabs in the '.stab' section. The byte order of the
  2888. stabs binary data depends on the object file format. For ELF, it
  2889. matches the byte order of the ELF file itself, as determined from the
  2890. 'EI_DATA' field in the 'e_ident' member of the ELF header. For SOM, it
  2891. is always big-endian (is this true??? FIXME). For COFF, it matches the
  2892. byte order of the COFF headers. The meaning of the fields is the same
  2893. as for a.out (*note Symbol Table Format::), except that the 'n_strx'
  2894. field is relative to the strings for the current compilation unit (which
  2895. can be found using the synthetic N_UNDF stab described below), rather
  2896. than the entire string table.
  2897. The first stab in the '.stab' section for each compilation unit is
  2898. synthetic, generated entirely by the assembler, with no corresponding
  2899. '.stab' directive as input to the assembler. This stab contains the
  2900. following fields:
  2901. 'n_strx'
  2902. Offset in the '.stabstr' section to the source filename.
  2903. 'n_type'
  2904. 'N_UNDF'.
  2905. 'n_other'
  2906. Unused field, always zero. This may eventually be used to hold
  2907. overflows from the count in the 'n_desc' field.
  2908. 'n_desc'
  2909. Count of upcoming symbols, i.e., the number of remaining stabs for
  2910. this source file.
  2911. 'n_value'
  2912. Size of the string table fragment associated with this source file,
  2913. in bytes.
  2914. The '.stabstr' section always starts with a null byte (so that string
  2915. offsets of zero reference a null string), followed by random length
  2916. strings, each of which is null byte terminated.
  2917. The ELF section header for the '.stab' section has its 'sh_link'
  2918. member set to the section number of the '.stabstr' section, and the
  2919. '.stabstr' section has its ELF section header 'sh_type' member set to
  2920. 'SHT_STRTAB' to mark it as a string table. SOM and COFF have no way of
  2921. linking the sections together or marking them as string tables.
  2922. For COFF, the '.stab' and '.stabstr' sections may be simply
  2923. concatenated by the linker. GDB then uses the 'n_desc' fields to figure
  2924. out the extent of the original sections. Similarly, the 'n_value'
  2925. fields of the header symbols are added together in order to get the
  2926. actual position of the strings in a desired '.stabstr' section.
  2927. Although this design obviates any need for the linker to relocate or
  2928. otherwise manipulate '.stab' and '.stabstr' sections, it also requires
  2929. some care to ensure that the offsets are calculated correctly. For
  2930. instance, if the linker were to pad in between the '.stabstr' sections
  2931. before concatenating, then the offsets to strings in the middle of the
  2932. executable's '.stabstr' section would be wrong.
  2933. The GNU linker is able to optimize stabs information by merging
  2934. duplicate strings and removing duplicate header file information (*note
  2935. Include Files::). When some versions of the GNU linker optimize stabs
  2936. in sections, they remove the leading 'N_UNDF' symbol and arranges for
  2937. all the 'n_strx' fields to be relative to the start of the '.stabstr'
  2938. section.
  2939. 
  2940. File: stabs.info, Node: ELF Linker Relocation, Prev: Stab Section Basics, Up: Stab Sections
  2941. F.2 Having the Linker Relocate Stabs in ELF
  2942. ===========================================
  2943. This section describes some Sun hacks for Stabs in ELF; it does not
  2944. apply to COFF or SOM. While GDB no longer supports this hack for Sun
  2945. Stabs in ELF, this section is kept to document the issue.
  2946. To keep linking fast, you don't want the linker to have to relocate
  2947. very many stabs. Making sure this is done for 'N_SLINE', 'N_RBRAC', and
  2948. 'N_LBRAC' stabs is the most important thing (see the descriptions of
  2949. those stabs for more information). But Sun's stabs in ELF has taken
  2950. this further, to make all addresses in the 'n_value' field (functions
  2951. and static variables) relative to the source file. For the 'N_SO'
  2952. symbol itself, Sun simply omits the address. To find the address of
  2953. each section corresponding to a given source file, the compiler puts out
  2954. symbols giving the address of each section for a given source file.
  2955. Since these are ELF (not stab) symbols, the linker relocates them
  2956. correctly without having to touch the stabs section. They are named
  2957. 'Bbss.bss' for the bss section, 'Ddata.data' for the data section, and
  2958. 'Drodata.rodata' for the rodata section. For the text section, there is
  2959. no such symbol (but there should be, see below). For an example of how
  2960. these symbols work, *Note Stab Section Transformations::. GCC does not
  2961. provide these symbols; it instead relies on the stabs getting relocated.
  2962. Thus addresses which would normally be relative to 'Bbss.bss', etc., are
  2963. already relocated. The Sun linker provided with Solaris 2.2 and earlier
  2964. relocates stabs using normal ELF relocation information, as it would do
  2965. for any section. Sun has been threatening to kludge their linker to not
  2966. do this (to speed up linking), even though the correct way to avoid
  2967. having the linker do these relocations is to have the compiler no longer
  2968. output relocatable values. Last I heard they had been talked out of the
  2969. linker kludge. See Sun point patch 101052-01 and Sun bug 1142109. With
  2970. the Sun compiler this affects 'S' symbol descriptor stabs (*note
  2971. Statics::) and functions (*note Procedures::). In the latter case, to
  2972. adopt the clean solution (making the value of the stab relative to the
  2973. start of the compilation unit), it would be necessary to invent a
  2974. 'Ttext.text' symbol, analogous to the 'Bbss.bss', etc., symbols. I
  2975. recommend this rather than using a zero value and getting the address
  2976. from the ELF symbols.
  2977. Finding the correct 'Bbss.bss', etc., symbol is difficult, because
  2978. the linker simply concatenates the '.stab' sections from each '.o' file
  2979. without including any information about which part of a '.stab' section
  2980. comes from which '.o' file. The way GDB use to do this is to look for
  2981. an ELF 'STT_FILE' symbol which has the same name as the last component
  2982. of the file name from the 'N_SO' symbol in the stabs (for example, if
  2983. the file name is '../../gdb/main.c', it looks for an ELF 'STT_FILE'
  2984. symbol named 'main.c'). This loses if different files have the same
  2985. name (they could be in different directories, a library could have been
  2986. copied from one system to another, etc.). It would be much cleaner to
  2987. have the 'Bbss.bss' symbols in the stabs themselves. Having the linker
  2988. relocate them there is no more work than having the linker relocate ELF
  2989. symbols, and it solves the problem of having to associate the ELF and
  2990. stab symbols. However, no one has yet designed or implemented such a
  2991. scheme.
  2992. 
  2993. File: stabs.info, Node: GNU Free Documentation License, Next: Symbol Types Index, Prev: Stab Sections, Up: Top
  2994. Appendix G GNU Free Documentation License
  2995. *****************************************
  2996. Version 1.3, 3 November 2008
  2997. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  2998. <http://fsf.org/>
  2999. Everyone is permitted to copy and distribute verbatim copies
  3000. of this license document, but changing it is not allowed.
  3001. 0. PREAMBLE
  3002. The purpose of this License is to make a manual, textbook, or other
  3003. functional and useful document "free" in the sense of freedom: to
  3004. assure everyone the effective freedom to copy and redistribute it,
  3005. with or without modifying it, either commercially or
  3006. noncommercially. Secondarily, this License preserves for the
  3007. author and publisher a way to get credit for their work, while not
  3008. being considered responsible for modifications made by others.
  3009. This License is a kind of "copyleft", which means that derivative
  3010. works of the document must themselves be free in the same sense.
  3011. It complements the GNU General Public License, which is a copyleft
  3012. license designed for free software.
  3013. We have designed this License in order to use it for manuals for
  3014. free software, because free software needs free documentation: a
  3015. free program should come with manuals providing the same freedoms
  3016. that the software does. But this License is not limited to
  3017. software manuals; it can be used for any textual work, regardless
  3018. of subject matter or whether it is published as a printed book. We
  3019. recommend this License principally for works whose purpose is
  3020. instruction or reference.
  3021. 1. APPLICABILITY AND DEFINITIONS
  3022. This License applies to any manual or other work, in any medium,
  3023. that contains a notice placed by the copyright holder saying it can
  3024. be distributed under the terms of this License. Such a notice
  3025. grants a world-wide, royalty-free license, unlimited in duration,
  3026. to use that work under the conditions stated herein. The
  3027. "Document", below, refers to any such manual or work. Any member
  3028. of the public is a licensee, and is addressed as "you". You accept
  3029. the license if you copy, modify or distribute the work in a way
  3030. requiring permission under copyright law.
  3031. A "Modified Version" of the Document means any work containing the
  3032. Document or a portion of it, either copied verbatim, or with
  3033. modifications and/or translated into another language.
  3034. A "Secondary Section" is a named appendix or a front-matter section
  3035. of the Document that deals exclusively with the relationship of the
  3036. publishers or authors of the Document to the Document's overall
  3037. subject (or to related matters) and contains nothing that could
  3038. fall directly within that overall subject. (Thus, if the Document
  3039. is in part a textbook of mathematics, a Secondary Section may not
  3040. explain any mathematics.) The relationship could be a matter of
  3041. historical connection with the subject or with related matters, or
  3042. of legal, commercial, philosophical, ethical or political position
  3043. regarding them.
  3044. The "Invariant Sections" are certain Secondary Sections whose
  3045. titles are designated, as being those of Invariant Sections, in the
  3046. notice that says that the Document is released under this License.
  3047. If a section does not fit the above definition of Secondary then it
  3048. is not allowed to be designated as Invariant. The Document may
  3049. contain zero Invariant Sections. If the Document does not identify
  3050. any Invariant Sections then there are none.
  3051. The "Cover Texts" are certain short passages of text that are
  3052. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  3053. that says that the Document is released under this License. A
  3054. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  3055. be at most 25 words.
  3056. A "Transparent" copy of the Document means a machine-readable copy,
  3057. represented in a format whose specification is available to the
  3058. general public, that is suitable for revising the document
  3059. straightforwardly with generic text editors or (for images composed
  3060. of pixels) generic paint programs or (for drawings) some widely
  3061. available drawing editor, and that is suitable for input to text
  3062. formatters or for automatic translation to a variety of formats
  3063. suitable for input to text formatters. A copy made in an otherwise
  3064. Transparent file format whose markup, or absence of markup, has
  3065. been arranged to thwart or discourage subsequent modification by
  3066. readers is not Transparent. An image format is not Transparent if
  3067. used for any substantial amount of text. A copy that is not
  3068. "Transparent" is called "Opaque".
  3069. Examples of suitable formats for Transparent copies include plain
  3070. ASCII without markup, Texinfo input format, LaTeX input format,
  3071. SGML or XML using a publicly available DTD, and standard-conforming
  3072. simple HTML, PostScript or PDF designed for human modification.
  3073. Examples of transparent image formats include PNG, XCF and JPG.
  3074. Opaque formats include proprietary formats that can be read and
  3075. edited only by proprietary word processors, SGML or XML for which
  3076. the DTD and/or processing tools are not generally available, and
  3077. the machine-generated HTML, PostScript or PDF produced by some word
  3078. processors for output purposes only.
  3079. The "Title Page" means, for a printed book, the title page itself,
  3080. plus such following pages as are needed to hold, legibly, the
  3081. material this License requires to appear in the title page. For
  3082. works in formats which do not have any title page as such, "Title
  3083. Page" means the text near the most prominent appearance of the
  3084. work's title, preceding the beginning of the body of the text.
  3085. The "publisher" means any person or entity that distributes copies
  3086. of the Document to the public.
  3087. A section "Entitled XYZ" means a named subunit of the Document
  3088. whose title either is precisely XYZ or contains XYZ in parentheses
  3089. following text that translates XYZ in another language. (Here XYZ
  3090. stands for a specific section name mentioned below, such as
  3091. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  3092. To "Preserve the Title" of such a section when you modify the
  3093. Document means that it remains a section "Entitled XYZ" according
  3094. to this definition.
  3095. The Document may include Warranty Disclaimers next to the notice
  3096. which states that this License applies to the Document. These
  3097. Warranty Disclaimers are considered to be included by reference in
  3098. this License, but only as regards disclaiming warranties: any other
  3099. implication that these Warranty Disclaimers may have is void and
  3100. has no effect on the meaning of this License.
  3101. 2. VERBATIM COPYING
  3102. You may copy and distribute the Document in any medium, either
  3103. commercially or noncommercially, provided that this License, the
  3104. copyright notices, and the license notice saying this License
  3105. applies to the Document are reproduced in all copies, and that you
  3106. add no other conditions whatsoever to those of this License. You
  3107. may not use technical measures to obstruct or control the reading
  3108. or further copying of the copies you make or distribute. However,
  3109. you may accept compensation in exchange for copies. If you
  3110. distribute a large enough number of copies you must also follow the
  3111. conditions in section 3.
  3112. You may also lend copies, under the same conditions stated above,
  3113. and you may publicly display copies.
  3114. 3. COPYING IN QUANTITY
  3115. If you publish printed copies (or copies in media that commonly
  3116. have printed covers) of the Document, numbering more than 100, and
  3117. the Document's license notice requires Cover Texts, you must
  3118. enclose the copies in covers that carry, clearly and legibly, all
  3119. these Cover Texts: Front-Cover Texts on the front cover, and
  3120. Back-Cover Texts on the back cover. Both covers must also clearly
  3121. and legibly identify you as the publisher of these copies. The
  3122. front cover must present the full title with all words of the title
  3123. equally prominent and visible. You may add other material on the
  3124. covers in addition. Copying with changes limited to the covers, as
  3125. long as they preserve the title of the Document and satisfy these
  3126. conditions, can be treated as verbatim copying in other respects.
  3127. If the required texts for either cover are too voluminous to fit
  3128. legibly, you should put the first ones listed (as many as fit
  3129. reasonably) on the actual cover, and continue the rest onto
  3130. adjacent pages.
  3131. If you publish or distribute Opaque copies of the Document
  3132. numbering more than 100, you must either include a machine-readable
  3133. Transparent copy along with each Opaque copy, or state in or with
  3134. each Opaque copy a computer-network location from which the general
  3135. network-using public has access to download using public-standard
  3136. network protocols a complete Transparent copy of the Document, free
  3137. of added material. If you use the latter option, you must take
  3138. reasonably prudent steps, when you begin distribution of Opaque
  3139. copies in quantity, to ensure that this Transparent copy will
  3140. remain thus accessible at the stated location until at least one
  3141. year after the last time you distribute an Opaque copy (directly or
  3142. through your agents or retailers) of that edition to the public.
  3143. It is requested, but not required, that you contact the authors of
  3144. the Document well before redistributing any large number of copies,
  3145. to give them a chance to provide you with an updated version of the
  3146. Document.
  3147. 4. MODIFICATIONS
  3148. You may copy and distribute a Modified Version of the Document
  3149. under the conditions of sections 2 and 3 above, provided that you
  3150. release the Modified Version under precisely this License, with the
  3151. Modified Version filling the role of the Document, thus licensing
  3152. distribution and modification of the Modified Version to whoever
  3153. possesses a copy of it. In addition, you must do these things in
  3154. the Modified Version:
  3155. A. Use in the Title Page (and on the covers, if any) a title
  3156. distinct from that of the Document, and from those of previous
  3157. versions (which should, if there were any, be listed in the
  3158. History section of the Document). You may use the same title
  3159. as a previous version if the original publisher of that
  3160. version gives permission.
  3161. B. List on the Title Page, as authors, one or more persons or
  3162. entities responsible for authorship of the modifications in
  3163. the Modified Version, together with at least five of the
  3164. principal authors of the Document (all of its principal
  3165. authors, if it has fewer than five), unless they release you
  3166. from this requirement.
  3167. C. State on the Title page the name of the publisher of the
  3168. Modified Version, as the publisher.
  3169. D. Preserve all the copyright notices of the Document.
  3170. E. Add an appropriate copyright notice for your modifications
  3171. adjacent to the other copyright notices.
  3172. F. Include, immediately after the copyright notices, a license
  3173. notice giving the public permission to use the Modified
  3174. Version under the terms of this License, in the form shown in
  3175. the Addendum below.
  3176. G. Preserve in that license notice the full lists of Invariant
  3177. Sections and required Cover Texts given in the Document's
  3178. license notice.
  3179. H. Include an unaltered copy of this License.
  3180. I. Preserve the section Entitled "History", Preserve its Title,
  3181. and add to it an item stating at least the title, year, new
  3182. authors, and publisher of the Modified Version as given on the
  3183. Title Page. If there is no section Entitled "History" in the
  3184. Document, create one stating the title, year, authors, and
  3185. publisher of the Document as given on its Title Page, then add
  3186. an item describing the Modified Version as stated in the
  3187. previous sentence.
  3188. J. Preserve the network location, if any, given in the Document
  3189. for public access to a Transparent copy of the Document, and
  3190. likewise the network locations given in the Document for
  3191. previous versions it was based on. These may be placed in the
  3192. "History" section. You may omit a network location for a work
  3193. that was published at least four years before the Document
  3194. itself, or if the original publisher of the version it refers
  3195. to gives permission.
  3196. K. For any section Entitled "Acknowledgements" or "Dedications",
  3197. Preserve the Title of the section, and preserve in the section
  3198. all the substance and tone of each of the contributor
  3199. acknowledgements and/or dedications given therein.
  3200. L. Preserve all the Invariant Sections of the Document, unaltered
  3201. in their text and in their titles. Section numbers or the
  3202. equivalent are not considered part of the section titles.
  3203. M. Delete any section Entitled "Endorsements". Such a section
  3204. may not be included in the Modified Version.
  3205. N. Do not retitle any existing section to be Entitled
  3206. "Endorsements" or to conflict in title with any Invariant
  3207. Section.
  3208. O. Preserve any Warranty Disclaimers.
  3209. If the Modified Version includes new front-matter sections or
  3210. appendices that qualify as Secondary Sections and contain no
  3211. material copied from the Document, you may at your option designate
  3212. some or all of these sections as invariant. To do this, add their
  3213. titles to the list of Invariant Sections in the Modified Version's
  3214. license notice. These titles must be distinct from any other
  3215. section titles.
  3216. You may add a section Entitled "Endorsements", provided it contains
  3217. nothing but endorsements of your Modified Version by various
  3218. parties--for example, statements of peer review or that the text
  3219. has been approved by an organization as the authoritative
  3220. definition of a standard.
  3221. You may add a passage of up to five words as a Front-Cover Text,
  3222. and a passage of up to 25 words as a Back-Cover Text, to the end of
  3223. the list of Cover Texts in the Modified Version. Only one passage
  3224. of Front-Cover Text and one of Back-Cover Text may be added by (or
  3225. through arrangements made by) any one entity. If the Document
  3226. already includes a cover text for the same cover, previously added
  3227. by you or by arrangement made by the same entity you are acting on
  3228. behalf of, you may not add another; but you may replace the old
  3229. one, on explicit permission from the previous publisher that added
  3230. the old one.
  3231. The author(s) and publisher(s) of the Document do not by this
  3232. License give permission to use their names for publicity for or to
  3233. assert or imply endorsement of any Modified Version.
  3234. 5. COMBINING DOCUMENTS
  3235. You may combine the Document with other documents released under
  3236. this License, under the terms defined in section 4 above for
  3237. modified versions, provided that you include in the combination all
  3238. of the Invariant Sections of all of the original documents,
  3239. unmodified, and list them all as Invariant Sections of your
  3240. combined work in its license notice, and that you preserve all
  3241. their Warranty Disclaimers.
  3242. The combined work need only contain one copy of this License, and
  3243. multiple identical Invariant Sections may be replaced with a single
  3244. copy. If there are multiple Invariant Sections with the same name
  3245. but different contents, make the title of each such section unique
  3246. by adding at the end of it, in parentheses, the name of the
  3247. original author or publisher of that section if known, or else a
  3248. unique number. Make the same adjustment to the section titles in
  3249. the list of Invariant Sections in the license notice of the
  3250. combined work.
  3251. In the combination, you must combine any sections Entitled
  3252. "History" in the various original documents, forming one section
  3253. Entitled "History"; likewise combine any sections Entitled
  3254. "Acknowledgements", and any sections Entitled "Dedications". You
  3255. must delete all sections Entitled "Endorsements."
  3256. 6. COLLECTIONS OF DOCUMENTS
  3257. You may make a collection consisting of the Document and other
  3258. documents released under this License, and replace the individual
  3259. copies of this License in the various documents with a single copy
  3260. that is included in the collection, provided that you follow the
  3261. rules of this License for verbatim copying of each of the documents
  3262. in all other respects.
  3263. You may extract a single document from such a collection, and
  3264. distribute it individually under this License, provided you insert
  3265. a copy of this License into the extracted document, and follow this
  3266. License in all other respects regarding verbatim copying of that
  3267. document.
  3268. 7. AGGREGATION WITH INDEPENDENT WORKS
  3269. A compilation of the Document or its derivatives with other
  3270. separate and independent documents or works, in or on a volume of a
  3271. storage or distribution medium, is called an "aggregate" if the
  3272. copyright resulting from the compilation is not used to limit the
  3273. legal rights of the compilation's users beyond what the individual
  3274. works permit. When the Document is included in an aggregate, this
  3275. License does not apply to the other works in the aggregate which
  3276. are not themselves derivative works of the Document.
  3277. If the Cover Text requirement of section 3 is applicable to these
  3278. copies of the Document, then if the Document is less than one half
  3279. of the entire aggregate, the Document's Cover Texts may be placed
  3280. on covers that bracket the Document within the aggregate, or the
  3281. electronic equivalent of covers if the Document is in electronic
  3282. form. Otherwise they must appear on printed covers that bracket
  3283. the whole aggregate.
  3284. 8. TRANSLATION
  3285. Translation is considered a kind of modification, so you may
  3286. distribute translations of the Document under the terms of section
  3287. 4. Replacing Invariant Sections with translations requires special
  3288. permission from their copyright holders, but you may include
  3289. translations of some or all Invariant Sections in addition to the
  3290. original versions of these Invariant Sections. You may include a
  3291. translation of this License, and all the license notices in the
  3292. Document, and any Warranty Disclaimers, provided that you also
  3293. include the original English version of this License and the
  3294. original versions of those notices and disclaimers. In case of a
  3295. disagreement between the translation and the original version of
  3296. this License or a notice or disclaimer, the original version will
  3297. prevail.
  3298. If a section in the Document is Entitled "Acknowledgements",
  3299. "Dedications", or "History", the requirement (section 4) to
  3300. Preserve its Title (section 1) will typically require changing the
  3301. actual title.
  3302. 9. TERMINATION
  3303. You may not copy, modify, sublicense, or distribute the Document
  3304. except as expressly provided under this License. Any attempt
  3305. otherwise to copy, modify, sublicense, or distribute it is void,
  3306. and will automatically terminate your rights under this License.
  3307. However, if you cease all violation of this License, then your
  3308. license from a particular copyright holder is reinstated (a)
  3309. provisionally, unless and until the copyright holder explicitly and
  3310. finally terminates your license, and (b) permanently, if the
  3311. copyright holder fails to notify you of the violation by some
  3312. reasonable means prior to 60 days after the cessation.
  3313. Moreover, your license from a particular copyright holder is
  3314. reinstated permanently if the copyright holder notifies you of the
  3315. violation by some reasonable means, this is the first time you have
  3316. received notice of violation of this License (for any work) from
  3317. that copyright holder, and you cure the violation prior to 30 days
  3318. after your receipt of the notice.
  3319. Termination of your rights under this section does not terminate
  3320. the licenses of parties who have received copies or rights from you
  3321. under this License. If your rights have been terminated and not
  3322. permanently reinstated, receipt of a copy of some or all of the
  3323. same material does not give you any rights to use it.
  3324. 10. FUTURE REVISIONS OF THIS LICENSE
  3325. The Free Software Foundation may publish new, revised versions of
  3326. the GNU Free Documentation License from time to time. Such new
  3327. versions will be similar in spirit to the present version, but may
  3328. differ in detail to address new problems or concerns. See
  3329. <http://www.gnu.org/copyleft/>.
  3330. Each version of the License is given a distinguishing version
  3331. number. If the Document specifies that a particular numbered
  3332. version of this License "or any later version" applies to it, you
  3333. have the option of following the terms and conditions either of
  3334. that specified version or of any later version that has been
  3335. published (not as a draft) by the Free Software Foundation. If the
  3336. Document does not specify a version number of this License, you may
  3337. choose any version ever published (not as a draft) by the Free
  3338. Software Foundation. If the Document specifies that a proxy can
  3339. decide which future versions of this License can be used, that
  3340. proxy's public statement of acceptance of a version permanently
  3341. authorizes you to choose that version for the Document.
  3342. 11. RELICENSING
  3343. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  3344. World Wide Web server that publishes copyrightable works and also
  3345. provides prominent facilities for anybody to edit those works. A
  3346. public wiki that anybody can edit is an example of such a server.
  3347. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  3348. site means any set of copyrightable works thus published on the MMC
  3349. site.
  3350. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  3351. license published by Creative Commons Corporation, a not-for-profit
  3352. corporation with a principal place of business in San Francisco,
  3353. California, as well as future copyleft versions of that license
  3354. published by that same organization.
  3355. "Incorporate" means to publish or republish a Document, in whole or
  3356. in part, as part of another Document.
  3357. An MMC is "eligible for relicensing" if it is licensed under this
  3358. License, and if all works that were first published under this
  3359. License somewhere other than this MMC, and subsequently
  3360. incorporated in whole or in part into the MMC, (1) had no cover
  3361. texts or invariant sections, and (2) were thus incorporated prior
  3362. to November 1, 2008.
  3363. The operator of an MMC Site may republish an MMC contained in the
  3364. site under CC-BY-SA on the same site at any time before August 1,
  3365. 2009, provided the MMC is eligible for relicensing.
  3366. ADDENDUM: How to use this License for your documents
  3367. ====================================================
  3368. To use this License in a document you have written, include a copy of
  3369. the License in the document and put the following copyright and license
  3370. notices just after the title page:
  3371. Copyright (C) YEAR YOUR NAME.
  3372. Permission is granted to copy, distribute and/or modify this document
  3373. under the terms of the GNU Free Documentation License, Version 1.3
  3374. or any later version published by the Free Software Foundation;
  3375. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  3376. Texts. A copy of the license is included in the section entitled ``GNU
  3377. Free Documentation License''.
  3378. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  3379. Texts, replace the "with...Texts." line with this:
  3380. with the Invariant Sections being LIST THEIR TITLES, with
  3381. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  3382. being LIST.
  3383. If you have Invariant Sections without Cover Texts, or some other
  3384. combination of the three, merge those two alternatives to suit the
  3385. situation.
  3386. If your document contains nontrivial examples of program code, we
  3387. recommend releasing these examples in parallel under your choice of free
  3388. software license, such as the GNU General Public License, to permit
  3389. their use in free software.
  3390. 
  3391. File: stabs.info, Node: Symbol Types Index, Prev: GNU Free Documentation License, Up: Top
  3392. Symbol Types Index
  3393. ******************
  3394. �[index�]
  3395. * Menu:
  3396. * .bb: Block Structure. (line 25)
  3397. * .be: Block Structure. (line 25)
  3398. * C_BCOMM: Common Blocks. (line 10)
  3399. * C_BINCL: Include Files. (line 40)
  3400. * C_BLOCK: Block Structure. (line 25)
  3401. * C_BSTAT: Statics. (line 31)
  3402. * C_DECL, for types: Typedefs. (line 6)
  3403. * C_ECOML: Common Blocks. (line 17)
  3404. * C_ECOMM: Common Blocks. (line 10)
  3405. * C_EINCL: Include Files. (line 40)
  3406. * C_ENTRY: Alternate Entry Points.
  3407. (line 6)
  3408. * C_ESTAT: Statics. (line 31)
  3409. * C_FILE: Source Files. (line 53)
  3410. * C_FUN: Procedures. (line 17)
  3411. * C_GSYM: Global Variables. (line 6)
  3412. * C_LSYM: Stack Variables. (line 11)
  3413. * C_PSYM: Parameters. (line 12)
  3414. * C_RPSYM: Register Parameters. (line 15)
  3415. * C_RSYM: Register Variables. (line 6)
  3416. * C_STSYM: Statics. (line 31)
  3417. * N_BCOMM: Common Blocks. (line 10)
  3418. * N_BINCL: Include Files. (line 17)
  3419. * N_BROWS: N_BROWS. (line 6)
  3420. * N_BROWS <1>: N_BROWS. (line 7)
  3421. * N_BSLINE: Line Numbers. (line 12)
  3422. * N_CATCH: N_CATCH. (line 6)
  3423. * N_CATCH <1>: N_CATCH. (line 7)
  3424. * N_DEFD: N_DEFD. (line 6)
  3425. * N_DEFD <1>: N_DEFD. (line 7)
  3426. * N_DSLINE: Line Numbers. (line 12)
  3427. * N_ECOML: Common Blocks. (line 17)
  3428. * N_ECOMM: Common Blocks. (line 10)
  3429. * N_EHDECL: N_EHDECL. (line 6)
  3430. * N_EHDECL <1>: N_EHDECL. (line 7)
  3431. * N_EINCL: Include Files. (line 17)
  3432. * N_ENTRY: Alternate Entry Points.
  3433. (line 6)
  3434. * N_EXCL: Include Files. (line 17)
  3435. * N_FNAME: Procedures. (line 6)
  3436. * N_FUN, for functions: Procedures. (line 6)
  3437. * N_FUN, for variables: Statics. (line 12)
  3438. * N_GSYM: Global Variables. (line 6)
  3439. * N_GSYM, for functions (Sun acc): Procedures. (line 6)
  3440. * N_LBRAC: Block Structure. (line 6)
  3441. * N_LCSYM: Statics. (line 12)
  3442. * N_LENG: N_LENG. (line 6)
  3443. * N_LENG <1>: N_LENG. (line 7)
  3444. * N_LSYM, for parameter: Local Variable Parameters.
  3445. (line 35)
  3446. * N_LSYM, for stack variables: Stack Variables. (line 11)
  3447. * N_LSYM, for types: Typedefs. (line 6)
  3448. * N_M2C: N_M2C. (line 6)
  3449. * N_M2C <1>: N_M2C. (line 7)
  3450. * N_MAC_DEFINE: Macro define and undefine.
  3451. (line 11)
  3452. * N_MAC_UNDEF: Macro define and undefine.
  3453. (line 14)
  3454. * N_MAIN: Main Program. (line 6)
  3455. * N_MOD2: N_MOD2. (line 6)
  3456. * N_MOD2 <1>: N_MOD2. (line 7)
  3457. * N_NBBSS: Gould. (line 8)
  3458. * N_NBBSS <1>: Gould. (line 11)
  3459. * N_NBDATA: Gould. (line 7)
  3460. * N_NBDATA <1>: Gould. (line 11)
  3461. * N_NBLCS: Gould. (line 10)
  3462. * N_NBLCS <1>: Gould. (line 11)
  3463. * N_NBSTS: Gould. (line 9)
  3464. * N_NBSTS <1>: Gould. (line 11)
  3465. * N_NBTEXT: Gould. (line 6)
  3466. * N_NBTEXT <1>: Gould. (line 11)
  3467. * N_NOMAP: N_NOMAP. (line 6)
  3468. * N_NOMAP <1>: N_NOMAP. (line 7)
  3469. * N_NSYMS: N_NSYMS. (line 6)
  3470. * N_NSYMS <1>: N_NSYMS. (line 7)
  3471. * N_PC: N_PC. (line 6)
  3472. * N_PC <1>: N_PC. (line 7)
  3473. * N_PSYM: Parameters. (line 12)
  3474. * N_RBRAC: Block Structure. (line 6)
  3475. * N_ROSYM: Statics. (line 12)
  3476. * N_RSYM: Register Variables. (line 6)
  3477. * N_RSYM, for parameters: Register Parameters. (line 15)
  3478. * N_SCOPE: N_SCOPE. (line 6)
  3479. * N_SCOPE <1>: N_SCOPE. (line 7)
  3480. * N_SLINE: Line Numbers. (line 6)
  3481. * N_SO: Source Files. (line 6)
  3482. * N_SOL: Include Files. (line 11)
  3483. * N_SSYM: N_SSYM. (line 6)
  3484. * N_SSYM <1>: N_SSYM. (line 7)
  3485. * N_STSYM: Statics. (line 12)
  3486. * N_STSYM, for functions (Sun acc): Procedures. (line 6)
  3487. 
  3488. Tag Table:
  3489. Node: Top1360
  3490. Node: Overview2407
  3491. Node: Flow3821
  3492. Node: Stabs Format5347
  3493. Node: String Field6909
  3494. Node: C Example12338
  3495. Node: Assembly Code12883
  3496. Node: Program Structure14854
  3497. Node: Main Program15580
  3498. Node: Source Files16141
  3499. Node: Include Files18583
  3500. Node: Line Numbers21248
  3501. Node: Procedures22782
  3502. Node: Nested Procedures28673
  3503. Node: Block Structure29849
  3504. Node: Alternate Entry Points31253
  3505. Node: Constants31986
  3506. Node: Variables35097
  3507. Node: Stack Variables35785
  3508. Node: Global Variables37486
  3509. Node: Register Variables38641
  3510. Node: Common Blocks39463
  3511. Node: Statics40716
  3512. Node: Based Variables43295
  3513. Node: Parameters44681
  3514. Node: Register Parameters46292
  3515. Node: Local Variable Parameters48552
  3516. Node: Reference Parameters51467
  3517. Node: Conformant Arrays52087
  3518. Node: Types52805
  3519. Node: Builtin Types53752
  3520. Node: Traditional Builtin Types54898
  3521. Node: Traditional Integer Types55299
  3522. Node: Traditional Other Types57607
  3523. Node: Builtin Type Descriptors58521
  3524. Node: Negative Type Numbers62021
  3525. Node: Miscellaneous Types68376
  3526. Node: Cross-References70262
  3527. Node: Subranges71937
  3528. Node: Arrays73176
  3529. Node: Strings76401
  3530. Node: Enumerations77463
  3531. Node: Structures79847
  3532. Node: Typedefs82555
  3533. Node: Unions83877
  3534. Node: Function Types85458
  3535. Node: Macro define and undefine87039
  3536. Node: Symbol Tables88612
  3537. Node: Symbol Table Format89064
  3538. Node: Transformations On Symbol Tables90511
  3539. Node: Transformations On Static Variables91865
  3540. Node: Transformations On Global Variables92601
  3541. Node: Stab Section Transformations93845
  3542. Node: Cplusplus95228
  3543. Node: Class Names95811
  3544. Node: Nested Symbols96556
  3545. Node: Basic Cplusplus Types97402
  3546. Node: Simple Classes98962
  3547. Node: Class Instance103255
  3548. Node: Methods103972
  3549. Node: Method Type Descriptor106191
  3550. Node: Member Type Descriptor107391
  3551. Node: Protections108183
  3552. Node: Method Modifiers111273
  3553. Node: Virtual Methods112901
  3554. Node: Inheritance116701
  3555. Node: Virtual Base Classes120397
  3556. Node: Static Members122642
  3557. Node: Stab Types123112
  3558. Node: Non-Stab Symbol Types123736
  3559. Node: Stab Symbol Types125119
  3560. Node: Symbol Descriptors128902
  3561. Node: Type Descriptors131681
  3562. Node: Expanded Reference134893
  3563. Node: N_PC136311
  3564. Node: N_NSYMS136679
  3565. Node: N_NOMAP136920
  3566. Node: N_M2C137226
  3567. Node: N_BROWS137659
  3568. Node: N_DEFD137942
  3569. Node: N_EHDECL138399
  3570. Node: N_MOD2138650
  3571. Node: N_CATCH138887
  3572. Node: N_SSYM139381
  3573. Node: N_SCOPE139666
  3574. Node: Gould139856
  3575. Node: N_LENG140849
  3576. Node: Questions141077
  3577. Node: Stab Sections142718
  3578. Node: Stab Section Basics143328
  3579. Node: ELF Linker Relocation146670
  3580. Node: GNU Free Documentation License150189
  3581. Node: Symbol Types Index175349
  3582. 
  3583. End Tag Table