No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

159 líneas
7.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>Arrays (STABS)</title>
  16. <meta name="description" content="Arrays (STABS)">
  17. <meta name="keywords" content="Arrays (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="Strings.html#Strings" rel="next" title="Strings">
  26. <link href="Subranges.html#Subranges" rel="prev" title="Subranges">
  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="Arrays"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Strings.html#Strings" accesskey="n" rel="next">Strings</a>, Previous: <a href="Subranges.html#Subranges" accesskey="p" rel="prev">Subranges</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="Array-Types"></a>
  63. <h3 class="section">5.5 Array Types</h3>
  64. <p>Arrays use the &lsquo;<samp>a</samp>&rsquo; type descriptor. Following the type descriptor
  65. is the type of the index and the type of the array elements. If the
  66. index type is a range type, it ends in a semicolon; otherwise
  67. (for example, if it is a type reference), there does not
  68. appear to be any way to tell where the types are separated. In an
  69. effort to clean up this mess, IBM documents the two types as being
  70. separated by a semicolon, and a range type as not ending in a semicolon
  71. (but this is not right for range types which are not array indexes,
  72. see <a href="Subranges.html#Subranges">Subranges</a>). I think probably the best solution is to specify
  73. that a semicolon ends a range type, and that the index type and element
  74. type of an array are separated by a semicolon, but that if the index
  75. type is a range type, the extra semicolon can be omitted. GDB (at least
  76. through version 4.9) doesn&rsquo;t support any kind of index type other than a
  77. range anyway; I&rsquo;m not sure about dbx.
  78. </p>
  79. <p>It is well established, and widely used, that the type of the index,
  80. unlike most types found in the stabs, is merely a type definition, not
  81. type information (see <a href="String-Field.html#String-Field">String Field</a>) (that is, it need not start with
  82. &lsquo;<samp><var>type-number</var>=</samp>&rsquo; if it is defining a new type). According to a
  83. comment in GDB, this is also true of the type of the array elements; it
  84. gives &lsquo;<samp>ar1;1;10;ar1;1;10;4</samp>&rsquo; as a legitimate way to express a two
  85. dimensional array. According to AIX documentation, the element type
  86. must be type information. GDB accepts either.
  87. </p>
  88. <p>The type of the index is often a range type, expressed as the type
  89. descriptor &lsquo;<samp>r</samp>&rsquo; and some parameters. It defines the size of the
  90. array. In the example below, the range &lsquo;<samp>r1;0;2;</samp>&rsquo; defines an index
  91. type which is a subrange of type 1 (integer), with a lower bound of 0
  92. and an upper bound of 2. This defines the valid range of subscripts of
  93. a three-element C array.
  94. </p>
  95. <p>For example, the definition:
  96. </p>
  97. <div class="example">
  98. <pre class="example">char char_vec[3] = {'a','b','c'};
  99. </pre></div>
  100. <p>produces the output:
  101. </p>
  102. <div class="example">
  103. <pre class="example">.stabs &quot;char_vec:G19=ar1;0;2;2&quot;,32,0,0,0
  104. .global _char_vec
  105. .align 4
  106. _char_vec:
  107. .byte 97
  108. .byte 98
  109. .byte 99
  110. </pre></div>
  111. <p>If an array is <em>packed</em>, the elements are spaced more
  112. closely than normal, saving memory at the expense of speed. For
  113. example, an array of 3-byte objects might, if unpacked, have each
  114. element aligned on a 4-byte boundary, but if packed, have no padding.
  115. One way to specify that something is packed is with type attributes
  116. (see <a href="String-Field.html#String-Field">String Field</a>). In the case of arrays, another is to use the
  117. &lsquo;<samp>P</samp>&rsquo; type descriptor instead of &lsquo;<samp>a</samp>&rsquo;. Other than specifying a
  118. packed array, &lsquo;<samp>P</samp>&rsquo; is identical to &lsquo;<samp>a</samp>&rsquo;.
  119. </p>
  120. <p>An open array is represented by the &lsquo;<samp>A</samp>&rsquo; type descriptor followed by
  121. type information specifying the type of the array elements.
  122. </p>
  123. <p>An N-dimensional dynamic array is represented by
  124. </p>
  125. <div class="example">
  126. <pre class="example">D <var>dimensions</var> ; <var>type-information</var>
  127. </pre></div>
  128. <p><var>dimensions</var> is the number of dimensions; <var>type-information</var>
  129. specifies the type of the array elements.
  130. </p>
  131. <p>A subarray of an N-dimensional array is represented by
  132. </p>
  133. <div class="example">
  134. <pre class="example">E <var>dimensions</var> ; <var>type-information</var>
  135. </pre></div>
  136. <p><var>dimensions</var> is the number of dimensions; <var>type-information</var>
  137. specifies the type of the array elements.
  138. </p>
  139. <hr>
  140. <div class="header">
  141. <p>
  142. Next: <a href="Strings.html#Strings" accesskey="n" rel="next">Strings</a>, Previous: <a href="Subranges.html#Subranges" accesskey="p" rel="prev">Subranges</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>
  143. </div>
  144. </body>
  145. </html>