You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
10 KiB
HTML
198 lines
10 KiB
HTML
4 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html>
|
||
|
<!-- 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". -->
|
||
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<title>String Field (STABS)</title>
|
||
|
|
||
|
<meta name="description" content="String Field (STABS)">
|
||
|
<meta name="keywords" content="String Field (STABS)">
|
||
|
<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="Overview.html#Overview" rel="up" title="Overview">
|
||
|
<link href="C-Example.html#C-Example" rel="next" title="C Example">
|
||
|
<link href="Stabs-Format.html#Stabs-Format" rel="prev" title="Stabs Format">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.summary-letter {text-decoration: none}
|
||
|
blockquote.indentedblock {margin-right: 0em}
|
||
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||
|
blockquote.smallquotation {font-size: smaller}
|
||
|
div.display {margin-left: 3.2em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
div.lisp {margin-left: 3.2em}
|
||
|
div.smalldisplay {margin-left: 3.2em}
|
||
|
div.smallexample {margin-left: 3.2em}
|
||
|
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.nolinebreak {white-space: nowrap}
|
||
|
span.roman {font-family: initial; font-weight: normal}
|
||
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||
|
ul.no-bullet {list-style: none}
|
||
|
-->
|
||
|
</style>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<a name="String-Field"></a>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="C-Example.html#C-Example" accesskey="n" rel="next">C Example</a>, Previous: <a href="Stabs-Format.html#Stabs-Format" accesskey="p" rel="prev">Stabs Format</a>, Up: <a href="Overview.html#Overview" accesskey="u" rel="up">Overview</a> [<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="The-String-Field"></a>
|
||
|
<h3 class="section">1.3 The String Field</h3>
|
||
|
|
||
|
<p>For most stabs the string field holds the meat of the
|
||
|
debugging information. The flexible nature of this field
|
||
|
is what makes stabs extensible. For some stab types the string field
|
||
|
contains only a name. For other stab types the contents can be a great
|
||
|
deal more complex.
|
||
|
</p>
|
||
|
<p>The overall format of the string field for most stab types is:
|
||
|
</p>
|
||
|
<div class="example">
|
||
|
<pre class="example">"<var>name</var>:<var>symbol-descriptor</var> <var>type-information</var>"
|
||
|
</pre></div>
|
||
|
|
||
|
<p><var>name</var> is the name of the symbol represented by the stab; it can
|
||
|
contain a pair of colons (see <a href="Nested-Symbols.html#Nested-Symbols">Nested Symbols</a>). <var>name</var> can be
|
||
|
omitted, which means the stab represents an unnamed object. For
|
||
|
example, ‘<samp>:t10=*2</samp>’ defines type 10 as a pointer to type 2, but does
|
||
|
not give the type a name. Omitting the <var>name</var> field is supported by
|
||
|
AIX dbx and GDB after about version 4.8, but not other debuggers. GCC
|
||
|
sometimes uses a single space as the name instead of omitting the name
|
||
|
altogether; apparently that is supported by most debuggers.
|
||
|
</p>
|
||
|
<p>The <var>symbol-descriptor</var> following the ‘<samp>:</samp>’ is an alphabetic
|
||
|
character that tells more specifically what kind of symbol the stab
|
||
|
represents. If the <var>symbol-descriptor</var> is omitted, but type
|
||
|
information follows, then the stab represents a local variable. For a
|
||
|
list of symbol descriptors, see <a href="Symbol-Descriptors.html#Symbol-Descriptors">Symbol Descriptors</a>. The ‘<samp>c</samp>’
|
||
|
symbol descriptor is an exception in that it is not followed by type
|
||
|
information. See <a href="Constants.html#Constants">Constants</a>.
|
||
|
</p>
|
||
|
<p><var>type-information</var> is either a <var>type-number</var>, or
|
||
|
‘<samp><var>type-number</var>=</samp>’. A <var>type-number</var> alone is a type
|
||
|
reference, referring directly to a type that has already been defined.
|
||
|
</p>
|
||
|
<p>The ‘<samp><var>type-number</var>=</samp>’ form is a type definition, where the
|
||
|
number represents a new type which is about to be defined. The type
|
||
|
definition may refer to other types by number, and those type numbers
|
||
|
may be followed by ‘<samp>=</samp>’ and nested definitions. Also, the Lucid
|
||
|
compiler will repeat ‘<samp><var>type-number</var>=</samp>’ more than once if it
|
||
|
wants to define several type numbers at once.
|
||
|
</p>
|
||
|
<p>In a type definition, if the character that follows the equals sign is
|
||
|
non-numeric then it is a <var>type-descriptor</var>, and tells what kind of
|
||
|
type is about to be defined. Any other values following the
|
||
|
<var>type-descriptor</var> vary, depending on the <var>type-descriptor</var>.
|
||
|
See <a href="Type-Descriptors.html#Type-Descriptors">Type Descriptors</a>, for a list of <var>type-descriptor</var> values. If
|
||
|
a number follows the ‘<samp>=</samp>’ then the number is a <var>type-reference</var>.
|
||
|
For a full description of types, <a href="Types.html#Types">Types</a>.
|
||
|
</p>
|
||
|
<p>A <var>type-number</var> is often a single number. The GNU and Sun tools
|
||
|
additionally permit a <var>type-number</var> to be a pair
|
||
|
(<var>file-number</var>,<var>filetype-number</var>) (the parentheses appear in the
|
||
|
string, and serve to distinguish the two cases). The <var>file-number</var>
|
||
|
is 0 for the base source file, 1 for the first included file, 2 for the
|
||
|
next, and so on. The <var>filetype-number</var> is a number starting with
|
||
|
1 which is incremented for each new type defined in the file.
|
||
|
(Separating the file number and the type number permits the
|
||
|
<code>N_BINCL</code> optimization to succeed more often; see <a href="Include-Files.html#Include-Files">Include Files</a>).
|
||
|
</p>
|
||
|
<p>There is an AIX extension for type attributes. Following the ‘<samp>=</samp>’
|
||
|
are any number of type attributes. Each one starts with ‘<samp>@</samp>’ and
|
||
|
ends with ‘<samp>;</samp>’. Debuggers, including AIX’s dbx and GDB 4.10, skip
|
||
|
any type attributes they do not recognize. GDB 4.9 and other versions
|
||
|
of dbx may not do this. Because of a conflict with C<tt>++</tt>
|
||
|
(see <a href="Cplusplus.html#Cplusplus">Cplusplus</a>), new attributes should not be defined which begin
|
||
|
with a digit, ‘<samp>(</samp>’, or ‘<samp>-</samp>’; GDB may be unable to distinguish
|
||
|
those from the C<tt>++</tt> type descriptor ‘<samp>@</samp>’. The attributes are:
|
||
|
</p>
|
||
|
<dl compact="compact">
|
||
|
<dt><code>a<var>boundary</var></code></dt>
|
||
|
<dd><p><var>boundary</var> is an integer specifying the alignment. I assume it
|
||
|
applies to all variables of this type.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>p<var>integer</var></code></dt>
|
||
|
<dd><p>Pointer class (for checking). Not sure what this means, or how
|
||
|
<var>integer</var> is interpreted.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>P</code></dt>
|
||
|
<dd><p>Indicate this is a packed type, meaning that structure fields or array
|
||
|
elements are placed more closely in memory, to save memory at the
|
||
|
expense of speed.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>s<var>size</var></code></dt>
|
||
|
<dd><p>Size in bits of a variable of this type. This is fully supported by GDB
|
||
|
4.11 and later.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>S</code></dt>
|
||
|
<dd><p>Indicate that this type is a string instead of an array of characters,
|
||
|
or a bitstring instead of a set. It doesn’t change the layout of the
|
||
|
data being represented, but does enable the debugger to know which type
|
||
|
it is.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>V</code></dt>
|
||
|
<dd><p>Indicate that this type is a vector instead of an array. The only
|
||
|
major difference between vectors and arrays is that vectors are
|
||
|
passed by value instead of by reference (vector coprocessor extension).
|
||
|
</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
<p>All of this can make the string field quite long. All versions of GDB,
|
||
|
and some versions of dbx, can handle arbitrarily long strings. But many
|
||
|
versions of dbx (or assemblers or linkers, I’m not sure which)
|
||
|
cretinously limit the strings to about 80 characters, so compilers which
|
||
|
must work with such systems need to split the <code>.stabs</code> directive
|
||
|
into several <code>.stabs</code> directives. Each stab duplicates every field
|
||
|
except the string field. The string field of every stab except the last
|
||
|
is marked as continued with a backslash at the end (in the assembly code
|
||
|
this may be written as a double backslash, depending on the assembler).
|
||
|
Removing the backslashes and concatenating the string fields of each
|
||
|
stab produces the original, long string. Just to be incompatible (or so
|
||
|
they don’t have to worry about what the assembler does with
|
||
|
backslashes), AIX can use ‘<samp>?</samp>’ instead of backslash.
|
||
|
</p>
|
||
|
<hr>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="C-Example.html#C-Example" accesskey="n" rel="next">C Example</a>, Previous: <a href="Stabs-Format.html#Stabs-Format" accesskey="p" rel="prev">Stabs Format</a>, Up: <a href="Overview.html#Overview" accesskey="u" rel="up">Overview</a> [<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>
|