blob: bc6973c40fe779baa4abe556379e50649b32172d [file] [log] [blame]
<html lang="en">
<head>
<title>Builtin Type Descriptors - STABS</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="STABS">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Builtin-Types.html#Builtin-Types" title="Builtin Types">
<link rel="prev" href="Traditional-Builtin-Types.html#Traditional-Builtin-Types" title="Traditional Builtin Types">
<link rel="next" href="Negative-Type-Numbers.html#Negative-Type-Numbers" title="Negative Type Numbers">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1992-2019 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''.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Builtin-Type-Descriptors"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Negative-Type-Numbers.html#Negative-Type-Numbers">Negative Type Numbers</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Traditional-Builtin-Types.html#Traditional-Builtin-Types">Traditional Builtin Types</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Builtin-Types.html#Builtin-Types">Builtin Types</a>
<hr>
</div>
<h4 class="subsection">5.1.2 Defining Builtin Types Using Builtin Type Descriptors</h4>
<p>This is the method used by Sun's <code>acc</code> for defining builtin types.
These are the type descriptors to define builtin types:
<dl>
<!-- FIXME: clean up description of width and offset, once we figure out -->
<!-- what they mean -->
<dt><code>b </code><var>signed</var> <var>char-flag</var> <var>width</var><code> ; </code><var>offset</var><code> ; </code><var>nbits</var><code> ;</code><dd>Define an integral type. <var>signed</var> is &lsquo;<samp><span class="samp">u</span></samp>&rsquo; for unsigned or
&lsquo;<samp><span class="samp">s</span></samp>&rsquo; for signed. <var>char-flag</var> is &lsquo;<samp><span class="samp">c</span></samp>&rsquo; which indicates this
is a character type, or is omitted. I assume this is to distinguish an
integral type from a character type of the same size, for example it
might make sense to set it for the C type <code>wchar_t</code> so the debugger
can print such variables differently (Solaris does not do this). Sun
sets it on the C types <code>signed char</code> and <code>unsigned char</code> which
arguably is wrong. <var>width</var> and <var>offset</var> appear to be for small
objects stored in larger ones, for example a <code>short</code> in an
<code>int</code> register. <var>width</var> is normally the number of bytes in the
type. <var>offset</var> seems to always be zero. <var>nbits</var> is the number
of bits in the type.
<p>Note that type descriptor &lsquo;<samp><span class="samp">b</span></samp>&rsquo; used for builtin types conflicts with
its use for Pascal space types (see <a href="Miscellaneous-Types.html#Miscellaneous-Types">Miscellaneous Types</a>); they can
be distinguished because the character following the type descriptor
will be a digit, &lsquo;<samp><span class="samp">(</span></samp>&rsquo;, or &lsquo;<samp><span class="samp">-</span></samp>&rsquo; for a Pascal space type, or
&lsquo;<samp><span class="samp">u</span></samp>&rsquo; or &lsquo;<samp><span class="samp">s</span></samp>&rsquo; for a builtin type.
<br><dt><code>w</code><dd>Documented by AIX to define a wide character type, but their compiler
actually uses negative type numbers (see <a href="Negative-Type-Numbers.html#Negative-Type-Numbers">Negative Type Numbers</a>).
<br><dt><code>R </code><var>fp-type</var><code> ; </code><var>bytes</var><code> ;</code><dd>Define a floating point type. <var>fp-type</var> has one of the following values:
<dl>
<dt><code>1 (NF_SINGLE)</code><dd>IEEE 32-bit (single precision) floating point format.
<br><dt><code>2 (NF_DOUBLE)</code><dd>IEEE 64-bit (double precision) floating point format.
<br><dt><code>3 (NF_COMPLEX)</code><br><dt><code>4 (NF_COMPLEX16)</code><br><dt><code>5 (NF_COMPLEX32)</code><dd><!-- "GDB source" really means @file{include/aout/stab_gnu.h}, but trying -->
<!-- to put that here got an overfull hbox. -->
These are for complex numbers. A comment in the GDB source describes
them as Fortran <code>complex</code>, <code>double complex</code>, and
<code>complex*16</code>, respectively, but what does that mean? (i.e., Single
precision? Double precision?).
<br><dt><code>6 (NF_LDOUBLE)</code><dd>Long double. This should probably only be used for Sun format
<code>long double</code>, and new codes should be used for other floating
point formats (<code>NF_DOUBLE</code> can be used if a <code>long double</code> is
really just an IEEE double, of course).
</dl>
<p><var>bytes</var> is the number of bytes occupied by the type. This allows a
debugger to perform some operations with the type even if it doesn't
understand <var>fp-type</var>.
<br><dt><code>g </code><var>type-information</var><code> ; </code><var>nbits</var><dd>Documented by AIX to define a floating type, but their compiler actually
uses negative type numbers (see <a href="Negative-Type-Numbers.html#Negative-Type-Numbers">Negative Type Numbers</a>).
<br><dt><code>c </code><var>type-information</var><code> ; </code><var>nbits</var><dd>Documented by AIX to define a complex type, but their compiler actually
uses negative type numbers (see <a href="Negative-Type-Numbers.html#Negative-Type-Numbers">Negative Type Numbers</a>).
</dl>
<p>The C <code>void</code> type is defined as a signed integral type 0 bits long:
<pre class="example"> .stabs "void:t19=bs0;0;0",128,0,0,0
</pre>
<p>The Solaris compiler seems to omit the trailing semicolon in this case.
Getting sloppy in this way is not a swift move because if a type is
embedded in a more complex expression it is necessary to be able to tell
where it ends.
<p>I'm not sure how a boolean type is represented.
</body></html>