String-Field.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1992-2019 Free Software Foundation, Inc.
  4. Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon,
  5. and David MacKenzie.
  6. Permission is granted to copy, distribute and/or modify this document
  7. under the terms of the GNU Free Documentation License, Version 1.3 or
  8. any later version published by the Free Software Foundation; with no
  9. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  10. Texts. A copy of the license is included in the section entitled "GNU
  11. Free Documentation License". -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>STABS: String Field</title>
  15. <meta name="description" content="STABS: String Field">
  16. <meta name="keywords" content="STABS: String Field">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="Symbol-Types-Index.html#Symbol-Types-Index" rel="index" title="Symbol Types Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Overview.html#Overview" rel="up" title="Overview">
  25. <link href="C-Example.html#C-Example" rel="next" title="C Example">
  26. <link href="Stabs-Format.html#Stabs-Format" rel="prev" title="Stabs Format">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style:oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="String-Field"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="C-Example.html#C-Example" accesskey="n" rel="next">C Example</a>, Previous: <a href="Stabs-Format.html#Stabs-Format" accesskey="p" rel="prev">Stabs Format</a>, Up: <a href="Overview.html#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Types-Index.html#Symbol-Types-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="The-String-Field"></a>
  64. <h3 class="section">1.3 The String Field</h3>
  65. <p>For most stabs the string field holds the meat of the
  66. debugging information. The flexible nature of this field
  67. is what makes stabs extensible. For some stab types the string field
  68. contains only a name. For other stab types the contents can be a great
  69. deal more complex.
  70. </p>
  71. <p>The overall format of the string field for most stab types is:
  72. </p>
  73. <div class="example">
  74. <pre class="example">&quot;<var>name</var>:<var>symbol-descriptor</var> <var>type-information</var>&quot;
  75. </pre></div>
  76. <p><var>name</var> is the name of the symbol represented by the stab; it can
  77. contain a pair of colons (see <a href="Nested-Symbols.html#Nested-Symbols">Nested Symbols</a>). <var>name</var> can be
  78. omitted, which means the stab represents an unnamed object. For
  79. example, &lsquo;<samp>:t10=*2</samp>&rsquo; defines type 10 as a pointer to type 2, but does
  80. not give the type a name. Omitting the <var>name</var> field is supported by
  81. AIX dbx and GDB after about version 4.8, but not other debuggers. GCC
  82. sometimes uses a single space as the name instead of omitting the name
  83. altogether; apparently that is supported by most debuggers.
  84. </p>
  85. <p>The <var>symbol-descriptor</var> following the &lsquo;<samp>:</samp>&rsquo; is an alphabetic
  86. character that tells more specifically what kind of symbol the stab
  87. represents. If the <var>symbol-descriptor</var> is omitted, but type
  88. information follows, then the stab represents a local variable. For a
  89. list of symbol descriptors, see <a href="Symbol-Descriptors.html#Symbol-Descriptors">Symbol Descriptors</a>. The &lsquo;<samp>c</samp>&rsquo;
  90. symbol descriptor is an exception in that it is not followed by type
  91. information. See <a href="Constants.html#Constants">Constants</a>.
  92. </p>
  93. <p><var>type-information</var> is either a <var>type-number</var>, or
  94. &lsquo;<samp><var>type-number</var>=</samp>&rsquo;. A <var>type-number</var> alone is a type
  95. reference, referring directly to a type that has already been defined.
  96. </p>
  97. <p>The &lsquo;<samp><var>type-number</var>=</samp>&rsquo; form is a type definition, where the
  98. number represents a new type which is about to be defined. The type
  99. definition may refer to other types by number, and those type numbers
  100. may be followed by &lsquo;<samp>=</samp>&rsquo; and nested definitions. Also, the Lucid
  101. compiler will repeat &lsquo;<samp><var>type-number</var>=</samp>&rsquo; more than once if it
  102. wants to define several type numbers at once.
  103. </p>
  104. <p>In a type definition, if the character that follows the equals sign is
  105. non-numeric then it is a <var>type-descriptor</var>, and tells what kind of
  106. type is about to be defined. Any other values following the
  107. <var>type-descriptor</var> vary, depending on the <var>type-descriptor</var>.
  108. See <a href="Type-Descriptors.html#Type-Descriptors">Type Descriptors</a>, for a list of <var>type-descriptor</var> values. If
  109. a number follows the &lsquo;<samp>=</samp>&rsquo; then the number is a <var>type-reference</var>.
  110. For a full description of types, <a href="Types.html#Types">Types</a>.
  111. </p>
  112. <p>A <var>type-number</var> is often a single number. The GNU and Sun tools
  113. additionally permit a <var>type-number</var> to be a pair
  114. (<var>file-number</var>,<var>filetype-number</var>) (the parentheses appear in the
  115. string, and serve to distinguish the two cases). The <var>file-number</var>
  116. is 0 for the base source file, 1 for the first included file, 2 for the
  117. next, and so on. The <var>filetype-number</var> is a number starting with
  118. 1 which is incremented for each new type defined in the file.
  119. (Separating the file number and the type number permits the
  120. <code>N_BINCL</code> optimization to succeed more often; see <a href="Include-Files.html#Include-Files">Include Files</a>).
  121. </p>
  122. <p>There is an AIX extension for type attributes. Following the &lsquo;<samp>=</samp>&rsquo;
  123. are any number of type attributes. Each one starts with &lsquo;<samp>@</samp>&rsquo; and
  124. ends with &lsquo;<samp>;</samp>&rsquo;. Debuggers, including AIX&rsquo;s dbx and GDB 4.10, skip
  125. any type attributes they do not recognize. GDB 4.9 and other versions
  126. of dbx may not do this. Because of a conflict with C<tt>++</tt>
  127. (see <a href="Cplusplus.html#Cplusplus">Cplusplus</a>), new attributes should not be defined which begin
  128. with a digit, &lsquo;<samp>(</samp>&rsquo;, or &lsquo;<samp>-</samp>&rsquo;; GDB may be unable to distinguish
  129. those from the C<tt>++</tt> type descriptor &lsquo;<samp>@</samp>&rsquo;. The attributes are:
  130. </p>
  131. <dl compact="compact">
  132. <dt><code>a<var>boundary</var></code></dt>
  133. <dd><p><var>boundary</var> is an integer specifying the alignment. I assume it
  134. applies to all variables of this type.
  135. </p>
  136. </dd>
  137. <dt><code>p<var>integer</var></code></dt>
  138. <dd><p>Pointer class (for checking). Not sure what this means, or how
  139. <var>integer</var> is interpreted.
  140. </p>
  141. </dd>
  142. <dt><code>P</code></dt>
  143. <dd><p>Indicate this is a packed type, meaning that structure fields or array
  144. elements are placed more closely in memory, to save memory at the
  145. expense of speed.
  146. </p>
  147. </dd>
  148. <dt><code>s<var>size</var></code></dt>
  149. <dd><p>Size in bits of a variable of this type. This is fully supported by GDB
  150. 4.11 and later.
  151. </p>
  152. </dd>
  153. <dt><code>S</code></dt>
  154. <dd><p>Indicate that this type is a string instead of an array of characters,
  155. or a bitstring instead of a set. It doesn&rsquo;t change the layout of the
  156. data being represented, but does enable the debugger to know which type
  157. it is.
  158. </p>
  159. </dd>
  160. <dt><code>V</code></dt>
  161. <dd><p>Indicate that this type is a vector instead of an array. The only
  162. major difference between vectors and arrays is that vectors are
  163. passed by value instead of by reference (vector coprocessor extension).
  164. </p>
  165. </dd>
  166. </dl>
  167. <p>All of this can make the string field quite long. All versions of GDB,
  168. and some versions of dbx, can handle arbitrarily long strings. But many
  169. versions of dbx (or assemblers or linkers, I&rsquo;m not sure which)
  170. cretinously limit the strings to about 80 characters, so compilers which
  171. must work with such systems need to split the <code>.stabs</code> directive
  172. into several <code>.stabs</code> directives. Each stab duplicates every field
  173. except the string field. The string field of every stab except the last
  174. is marked as continued with a backslash at the end (in the assembly code
  175. this may be written as a double backslash, depending on the assembler).
  176. Removing the backslashes and concatenating the string fields of each
  177. stab produces the original, long string. Just to be incompatible (or so
  178. they don&rsquo;t have to worry about what the assembler does with
  179. backslashes), AIX can use &lsquo;<samp>?</samp>&rsquo; instead of backslash.
  180. </p>
  181. <hr>
  182. <div class="header">
  183. <p>
  184. Next: <a href="C-Example.html#C-Example" accesskey="n" rel="next">C Example</a>, Previous: <a href="Stabs-Format.html#Stabs-Format" accesskey="p" rel="prev">Stabs Format</a>, Up: <a href="Overview.html#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Types-Index.html#Symbol-Types-Index" title="Index" rel="index">Index</a>]</p>
  185. </div>
  186. </body>
  187. </html>