blob: 522d80a9939bd92eaaa5a735fa1e4e537b9f1cfe [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1992-2015 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: Builtin Type Descriptors</title>
<meta name="description" content="STABS: Builtin Type Descriptors">
<meta name="keywords" content="STABS: Builtin Type Descriptors">
<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="Negative-Type-Numbers.html#Negative-Type-Numbers" rel="next" title="Negative Type Numbers">
<link href="Traditional-Other-Types.html#Traditional-Other-Types" rel="prev" title="Traditional Other Types">
<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="Builtin-Type-Descriptors"></a>
<div class="header">
<p>
Next: <a href="Negative-Type-Numbers.html#Negative-Type-Numbers" accesskey="n" rel="next">Negative Type Numbers</a>, Previous: <a href="Traditional-Builtin-Types.html#Traditional-Builtin-Types" accesskey="p" rel="prev">Traditional Builtin Types</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="Defining-Builtin-Types-Using-Builtin-Type-Descriptors"></a>
<h4 class="subsection">5.1.2 Defining Builtin Types Using Builtin Type Descriptors</h4>
<p>This is the method used by Sun&rsquo;s <code>acc</code> for defining builtin types.
These are the type descriptors to define builtin types:
</p>
<dl compact="compact">
<dt><code>b <var>signed</var> <var>char-flag</var> <var>width</var> ; <var>offset</var> ; <var>nbits</var> ;</code></dt>
<dd><p>Define an integral type. <var>signed</var> is &lsquo;<samp>u</samp>&rsquo; for unsigned or
&lsquo;<samp>s</samp>&rsquo; for signed. <var>char-flag</var> is &lsquo;<samp>c</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>
<p>Note that type descriptor &lsquo;<samp>b</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>(</samp>&rsquo;, or &lsquo;<samp>-</samp>&rsquo; for a Pascal space type, or
&lsquo;<samp>u</samp>&rsquo; or &lsquo;<samp>s</samp>&rsquo; for a builtin type.
</p>
</dd>
<dt><code>w</code></dt>
<dd><p>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>).
</p>
</dd>
<dt><code>R <var>fp-type</var> ; <var>bytes</var> ;</code></dt>
<dd><p>Define a floating point type. <var>fp-type</var> has one of the following values:
</p>
<dl compact="compact">
<dt><code>1 (NF_SINGLE)</code></dt>
<dd><p>IEEE 32-bit (single precision) floating point format.
</p>
</dd>
<dt><code>2 (NF_DOUBLE)</code></dt>
<dd><p>IEEE 64-bit (double precision) floating point format.
</p>
</dd>
<dt><code>3 (NF_COMPLEX)</code></dt>
<dt><code>4 (NF_COMPLEX16)</code></dt>
<dt><code>5 (NF_COMPLEX32)</code></dt>
<dd><p>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?).
</p>
</dd>
<dt><code>6 (NF_LDOUBLE)</code></dt>
<dd><p>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).
</p></dd>
</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&rsquo;t
understand <var>fp-type</var>.
</p>
</dd>
<dt><code>g <var>type-information</var> ; <var>nbits</var></code></dt>
<dd><p>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>).
</p>
</dd>
<dt><code>c <var>type-information</var> ; <var>nbits</var></code></dt>
<dd><p>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>).
</p></dd>
</dl>
<p>The C <code>void</code> type is defined as a signed integral type 0 bits long:
</p><div class="example">
<pre class="example">.stabs &quot;void:t19=bs0;0;0&quot;,128,0,0,0
</pre></div>
<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>
<p>I&rsquo;m not sure how a boolean type is represented.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Negative-Type-Numbers.html#Negative-Type-Numbers" accesskey="n" rel="next">Negative Type Numbers</a>, Previous: <a href="Traditional-Builtin-Types.html#Traditional-Builtin-Types" accesskey="p" rel="prev">Traditional Builtin Types</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>