You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 satır
6.2KB

  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>Enumerations (STABS)</title>
  16. <meta name="description" content="Enumerations (STABS)">
  17. <meta name="keywords" content="Enumerations (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="Types.html#Types" rel="up" title="Types">
  25. <link href="Structures.html#Structures" rel="next" title="Structures">
  26. <link href="Strings.html#Strings" rel="prev" title="Strings">
  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="Enumerations"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Structures.html#Structures" accesskey="n" rel="next">Structures</a>, Previous: <a href="Strings.html#Strings" accesskey="p" rel="prev">Strings</a>, Up: <a href="Types.html#Types" accesskey="u" rel="up">Types</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="Enumerations-1"></a>
  63. <h3 class="section">5.7 Enumerations</h3>
  64. <p>Enumerations are defined with the &lsquo;<samp>e</samp>&rsquo; type descriptor.
  65. </p>
  66. <p>The source line below declares an enumeration type at file scope.
  67. The type definition is located after the <code>N_RBRAC</code> that marks the end of
  68. the previous procedure&rsquo;s block scope, and before the <code>N_FUN</code> that marks
  69. the beginning of the next procedure&rsquo;s block scope. Therefore it does not
  70. describe a block local symbol, but a file local one.
  71. </p>
  72. <p>The source line:
  73. </p>
  74. <div class="example">
  75. <pre class="example">enum e_places {first,second=3,last};
  76. </pre></div>
  77. <p>generates the following stab:
  78. </p>
  79. <div class="example">
  80. <pre class="example">.stabs &quot;e_places:T22=efirst:0,second:3,last:4,;&quot;,128,0,0,0
  81. </pre></div>
  82. <p>The symbol descriptor (&lsquo;<samp>T</samp>&rsquo;) says that the stab describes a
  83. structure, enumeration, or union tag. The type descriptor &lsquo;<samp>e</samp>&rsquo;,
  84. following the &lsquo;<samp>22=</samp>&rsquo; of the type definition narrows it down to an
  85. enumeration type. Following the &lsquo;<samp>e</samp>&rsquo; is a list of the elements of
  86. the enumeration. The format is &lsquo;<samp><var>name</var>:<var>value</var>,</samp>&rsquo;. The
  87. list of elements ends with &lsquo;<samp>;</samp>&rsquo;. The fact that <var>value</var> is
  88. specified as an integer can cause problems if the value is large. GCC
  89. 2.5.2 tries to output it in octal in that case with a leading zero,
  90. which is probably a good thing, although GDB 4.11 supports octal only in
  91. cases where decimal is perfectly good. Negative decimal values are
  92. supported by both GDB and dbx.
  93. </p>
  94. <p>There is no standard way to specify the size of an enumeration type; it
  95. is determined by the architecture (normally all enumerations types are
  96. 32 bits). Type attributes can be used to specify an enumeration type of
  97. another size for debuggers which support them; see <a href="String-Field.html#String-Field">String Field</a>.
  98. </p>
  99. <p>Enumeration types are unusual in that they define symbols for the
  100. enumeration values (<code>first</code>, <code>second</code>, and <code>third</code> in the
  101. above example), and even though these symbols are visible in the file as
  102. a whole (rather than being in a more local namespace like structure
  103. member names), they are defined in the type definition for the
  104. enumeration type rather than each having their own symbol. In order to
  105. be fast, GDB will only get symbols from such types (in its initial scan
  106. of the stabs) if the type is the first thing defined after a &lsquo;<samp>T</samp>&rsquo; or
  107. &lsquo;<samp>t</samp>&rsquo; symbol descriptor (the above example fulfills this
  108. requirement). If the type does not have a name, the compiler should
  109. emit it in a nameless stab (see <a href="String-Field.html#String-Field">String Field</a>); GCC does this.
  110. </p>
  111. <hr>
  112. <div class="header">
  113. <p>
  114. Next: <a href="Structures.html#Structures" accesskey="n" rel="next">Structures</a>, Previous: <a href="Strings.html#Strings" accesskey="p" rel="prev">Strings</a>, Up: <a href="Types.html#Types" accesskey="u" rel="up">Types</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>
  115. </div>
  116. </body>
  117. </html>