Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

198 lines
10KB

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