hc
2023-11-06 15ade055295d13f95d49e3d99b09f3bbfb4a43e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1992-2017 Free Software Foundation, Inc.
Contributed by Cygnus Support.  Written by Julia Menapace, Jim Kingdon,
and David MacKenzie.
 
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.  A copy of the license is included in the section entitled "GNU
Free Documentation License". -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>STABS: Negative Type Numbers</title>
 
<meta name="description" content="STABS: Negative Type Numbers">
<meta name="keywords" content="STABS: Negative Type Numbers">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Symbol-Types-Index.html#Symbol-Types-Index" rel="index" title="Symbol Types Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Builtin-Types.html#Builtin-Types" rel="up" title="Builtin Types">
<link href="Miscellaneous-Types.html#Miscellaneous-Types" rel="next" title="Miscellaneous Types">
<link href="Builtin-Type-Descriptors.html#Builtin-Type-Descriptors" rel="prev" title="Builtin Type Descriptors">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
 
 
</head>
 
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Negative-Type-Numbers"></a>
<div class="header">
<p>
Previous: <a href="Builtin-Type-Descriptors.html#Builtin-Type-Descriptors" accesskey="p" rel="prev">Builtin Type Descriptors</a>, Up: <a href="Builtin-Types.html#Builtin-Types" accesskey="u" rel="up">Builtin 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>
</div>
<hr>
<a name="Negative-Type-Numbers-1"></a>
<h4 class="subsection">5.1.3 Negative Type Numbers</h4>
 
<p>This is the method used in XCOFF for defining builtin types.
Since the debugger knows about the builtin types anyway, the idea of
negative type numbers is simply to give a special type number which
indicates the builtin type.  There is no stab defining these types.
</p>
<p>There are several subtle issues with negative type numbers.
</p>
<p>One is the size of the type.  A builtin type (for example the C types
<code>int</code> or <code>long</code>) might have different sizes depending on
compiler options, the target architecture, the ABI, etc.  This issue
doesn&rsquo;t come up for IBM tools since (so far) they just target the
RS/6000; the sizes indicated below for each size are what the IBM
RS/6000 tools use.  To deal with differing sizes, either define separate
negative type numbers for each size (which works but requires changing
the debugger, and, unless you get both AIX dbx and GDB to accept the
change, introduces an incompatibility), or use a type attribute
(see <a href="String-Field.html#String-Field">String Field</a>) to define a new type with the appropriate size
(which merely requires a debugger which understands type attributes,
like AIX dbx or GDB).  For example,
</p>
<div class="example">
<pre class="example">.stabs &quot;boolean:t10=@s8;-16&quot;,128,0,0,0
</pre></div>
 
<p>defines an 8-bit boolean type, and
</p>
<div class="example">
<pre class="example">.stabs &quot;boolean:t10=@s64;-16&quot;,128,0,0,0
</pre></div>
 
<p>defines a 64-bit boolean type.
</p>
<p>A similar issue is the format of the type.  This comes up most often for
floating-point types, which could have various formats (particularly
extended doubles, which vary quite a bit even among IEEE systems).
Again, it is best to define a new negative type number for each
different format; changing the format based on the target system has
various problems.  One such problem is that the Alpha has both VAX and
IEEE floating types.  One can easily imagine one library using the VAX
types and another library in the same executable using the IEEE types.
Another example is that the interpretation of whether a boolean is true
or false can be based on the least significant bit, most significant
bit, whether it is zero, etc., and different compilers (or different
options to the same compiler) might provide different kinds of boolean.
</p>
<p>The last major issue is the names of the types.  The name of a given
type depends <em>only</em> on the negative type number given; these do not
vary depending on the language, the target system, or anything else.
One can always define separate type numbers&mdash;in the following list you
will see for example separate <code>int</code> and <code>integer*4</code> types
which are identical except for the name.  But compatibility can be
maintained by not inventing new negative type numbers and instead just
defining a new type with a new name.  For example:
</p>
<div class="example">
<pre class="example">.stabs &quot;CARDINAL:t10=-8&quot;,128,0,0,0
</pre></div>
 
<p>Here is the list of negative type numbers.  The phrase <em>integral
type</em> is used to mean twos-complement (I strongly suspect that all
machines which use stabs use twos-complement; most machines use
twos-complement these days).
</p>
<dl compact="compact">
<dt><code>-1</code></dt>
<dd><p><code>int</code>, 32 bit signed integral type.
</p>
</dd>
<dt><code>-2</code></dt>
<dd><p><code>char</code>, 8 bit type holding a character.   Both GDB and dbx on AIX
treat this as signed.  GCC uses this type whether <code>char</code> is signed
or not, which seems like a bad idea.  The AIX compiler (<code>xlc</code>) seems to
avoid this type; it uses -5 instead for <code>char</code>.
</p>
</dd>
<dt><code>-3</code></dt>
<dd><p><code>short</code>, 16 bit signed integral type.
</p>
</dd>
<dt><code>-4</code></dt>
<dd><p><code>long</code>, 32 bit signed integral type.
</p>
</dd>
<dt><code>-5</code></dt>
<dd><p><code>unsigned char</code>, 8 bit unsigned integral type.
</p>
</dd>
<dt><code>-6</code></dt>
<dd><p><code>signed char</code>, 8 bit signed integral type.
</p>
</dd>
<dt><code>-7</code></dt>
<dd><p><code>unsigned short</code>, 16 bit unsigned integral type.
</p>
</dd>
<dt><code>-8</code></dt>
<dd><p><code>unsigned int</code>, 32 bit unsigned integral type.
</p>
</dd>
<dt><code>-9</code></dt>
<dd><p><code>unsigned</code>, 32 bit unsigned integral type.
</p>
</dd>
<dt><code>-10</code></dt>
<dd><p><code>unsigned long</code>, 32 bit unsigned integral type.
</p>
</dd>
<dt><code>-11</code></dt>
<dd><p><code>void</code>, type indicating the lack of a value.
</p>
</dd>
<dt><code>-12</code></dt>
<dd><p><code>float</code>, IEEE single precision.
</p>
</dd>
<dt><code>-13</code></dt>
<dd><p><code>double</code>, IEEE double precision.
</p>
</dd>
<dt><code>-14</code></dt>
<dd><p><code>long double</code>, IEEE double precision.  The compiler claims the size
will increase in a future release, and for binary compatibility you have
to avoid using <code>long double</code>.  I hope when they increase it they
use a new negative type number.
</p>
</dd>
<dt><code>-15</code></dt>
<dd><p><code>integer</code>.  32 bit signed integral type.
</p>
</dd>
<dt><code>-16</code></dt>
<dd><p><code>boolean</code>.  32 bit type.  GDB and GCC assume that zero is false,
one is true, and other values have unspecified meaning.  I hope this
agrees with how the IBM tools use the type.
</p>
</dd>
<dt><code>-17</code></dt>
<dd><p><code>short real</code>.  IEEE single precision.
</p>
</dd>
<dt><code>-18</code></dt>
<dd><p><code>real</code>.  IEEE double precision.
</p>
</dd>
<dt><code>-19</code></dt>
<dd><p><code>stringptr</code>.  See <a href="Strings.html#Strings">Strings</a>.
</p>
</dd>
<dt><code>-20</code></dt>
<dd><p><code>character</code>, 8 bit unsigned character type.
</p>
</dd>
<dt><code>-21</code></dt>
<dd><p><code>logical*1</code>, 8 bit type.  This Fortran type has a split
personality in that it is used for boolean variables, but can also be
used for unsigned integers.  0 is false, 1 is true, and other values are
non-boolean.
</p>
</dd>
<dt><code>-22</code></dt>
<dd><p><code>logical*2</code>, 16 bit type.  This Fortran type has a split
personality in that it is used for boolean variables, but can also be
used for unsigned integers.  0 is false, 1 is true, and other values are
non-boolean.
</p>
</dd>
<dt><code>-23</code></dt>
<dd><p><code>logical*4</code>, 32 bit type.  This Fortran type has a split
personality in that it is used for boolean variables, but can also be
used for unsigned integers.  0 is false, 1 is true, and other values are
non-boolean.
</p>
</dd>
<dt><code>-24</code></dt>
<dd><p><code>logical</code>, 32 bit type.  This Fortran type has a split
personality in that it is used for boolean variables, but can also be
used for unsigned integers.  0 is false, 1 is true, and other values are
non-boolean.
</p>
</dd>
<dt><code>-25</code></dt>
<dd><p><code>complex</code>.  A complex type consisting of two IEEE single-precision
floating point values.
</p>
</dd>
<dt><code>-26</code></dt>
<dd><p><code>complex</code>.  A complex type consisting of two IEEE double-precision
floating point values.
</p>
</dd>
<dt><code>-27</code></dt>
<dd><p><code>integer*1</code>, 8 bit signed integral type.
</p>
</dd>
<dt><code>-28</code></dt>
<dd><p><code>integer*2</code>, 16 bit signed integral type.
</p>
</dd>
<dt><code>-29</code></dt>
<dd><p><code>integer*4</code>, 32 bit signed integral type.
</p>
</dd>
<dt><code>-30</code></dt>
<dd><p><code>wchar</code>.  Wide character, 16 bits wide, unsigned (what format?
Unicode?).
</p>
</dd>
<dt><code>-31</code></dt>
<dd><p><code>long long</code>, 64 bit signed integral type.
</p>
</dd>
<dt><code>-32</code></dt>
<dd><p><code>unsigned long long</code>, 64 bit unsigned integral type.
</p>
</dd>
<dt><code>-33</code></dt>
<dd><p><code>logical*8</code>, 64 bit unsigned integral type.
</p>
</dd>
<dt><code>-34</code></dt>
<dd><p><code>integer*8</code>, 64 bit signed integral type.
</p></dd>
</dl>
 
<hr>
<div class="header">
<p>
Previous: <a href="Builtin-Type-Descriptors.html#Builtin-Type-Descriptors" accesskey="p" rel="prev">Builtin Type Descriptors</a>, Up: <a href="Builtin-Types.html#Builtin-Types" accesskey="u" rel="up">Builtin 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>
</div>
 
 
 
</body>
</html>