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-2021 Free Software Foundation, Inc.
4Contributed by Cygnus Support.  Written by Julia Menapace, Jim Kingdon,
5and David MacKenzie.
6
7Permission is granted to copy, distribute and/or modify this document
8under the terms of the GNU Free Documentation License, Version 1.3 or
9any later version published by the Free Software Foundation; with no
10Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
11Texts.  A copy of the license is included in the section entitled "GNU
12Free Documentation License". -->
13<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
14<head>
15<title>STABS: String Field</title>
16
17<meta name="description" content="STABS: String Field">
18<meta name="keywords" content="STABS: String Field">
19<meta name="resource-type" content="document">
20<meta name="distribution" content="global">
21<meta name="Generator" content="makeinfo">
22<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
23<link href="index.html#Top" rel="start" title="Top">
24<link href="Symbol-Types-Index.html#Symbol-Types-Index" rel="index" title="Symbol Types Index">
25<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
26<link href="Overview.html#Overview" rel="up" title="Overview">
27<link href="C-Example.html#C-Example" rel="next" title="C Example">
28<link href="Stabs-Format.html#Stabs-Format" rel="previous" title="Stabs Format">
29<style type="text/css">
30<!--
31a.summary-letter {text-decoration: none}
32blockquote.smallquotation {font-size: smaller}
33div.display {margin-left: 3.2em}
34div.example {margin-left: 3.2em}
35div.indentedblock {margin-left: 3.2em}
36div.lisp {margin-left: 3.2em}
37div.smalldisplay {margin-left: 3.2em}
38div.smallexample {margin-left: 3.2em}
39div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
40div.smalllisp {margin-left: 3.2em}
41kbd {font-style:oblique}
42pre.display {font-family: inherit}
43pre.format {font-family: inherit}
44pre.menu-comment {font-family: serif}
45pre.menu-preformatted {font-family: serif}
46pre.smalldisplay {font-family: inherit; font-size: smaller}
47pre.smallexample {font-size: smaller}
48pre.smallformat {font-family: inherit; font-size: smaller}
49pre.smalllisp {font-size: smaller}
50span.nocodebreak {white-space:nowrap}
51span.nolinebreak {white-space:nowrap}
52span.roman {font-family:serif; font-weight:normal}
53span.sansserif {font-family:sans-serif; font-weight:normal}
54ul.no-bullet {list-style: none}
55-->
56</style>
57
58
59</head>
60
61<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
62<a name="String-Field"></a>
63<div class="header">
64<p>
65Next: <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="previous">Stabs Format</a>, Up: <a href="Overview.html#Overview" accesskey="u" rel="up">Overview</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>
66</div>
67<hr>
68<a name="The-String-Field"></a>
69<h3 class="section">1.3 The String Field</h3>
70
71<p>For most stabs the string field holds the meat of the
72debugging information.  The flexible nature of this field
73is what makes stabs extensible.  For some stab types the string field
74contains only a name.  For other stab types the contents can be a great
75deal more complex.
76</p>
77<p>The overall format of the string field for most stab types is:
78</p>
79<div class="example">
80<pre class="example">&quot;<var>name</var>:<var>symbol-descriptor</var> <var>type-information</var>&quot;
81</pre></div>
82
83<p><var>name</var> is the name of the symbol represented by the stab; it can
84contain a pair of colons (see <a href="Nested-Symbols.html#Nested-Symbols">Nested Symbols</a>).  <var>name</var> can be
85omitted, which means the stab represents an unnamed object.  For
86example, &lsquo;<samp>:t10=*2</samp>&rsquo; defines type 10 as a pointer to type 2, but does
87not give the type a name.  Omitting the <var>name</var> field is supported by
88AIX dbx and GDB after about version 4.8, but not other debuggers.  GCC
89sometimes uses a single space as the name instead of omitting the name
90altogether; apparently that is supported by most debuggers.
91</p>
92<p>The <var>symbol-descriptor</var> following the &lsquo;<samp>:</samp>&rsquo; is an alphabetic
93character that tells more specifically what kind of symbol the stab
94represents. If the <var>symbol-descriptor</var> is omitted, but type
95information follows, then the stab represents a local variable.  For a
96list of symbol descriptors, see <a href="Symbol-Descriptors.html#Symbol-Descriptors">Symbol Descriptors</a>.  The &lsquo;<samp>c</samp>&rsquo;
97symbol descriptor is an exception in that it is not followed by type
98information.  See <a href="Constants.html#Constants">Constants</a>.
99</p>
100<p><var>type-information</var> is either a <var>type-number</var>, or
101&lsquo;<samp><var>type-number</var>=</samp>&rsquo;.  A <var>type-number</var> alone is a type
102reference, referring directly to a type that has already been defined.
103</p>
104<p>The &lsquo;<samp><var>type-number</var>=</samp>&rsquo; form is a type definition, where the
105number represents a new type which is about to be defined.  The type
106definition may refer to other types by number, and those type numbers
107may be followed by &lsquo;<samp>=</samp>&rsquo; and nested definitions.  Also, the Lucid
108compiler will repeat &lsquo;<samp><var>type-number</var>=</samp>&rsquo; more than once if it
109wants to define several type numbers at once.
110</p>
111<p>In a type definition, if the character that follows the equals sign is
112non-numeric then it is a <var>type-descriptor</var>, and tells what kind of
113type is about to be defined.  Any other values following the
114<var>type-descriptor</var> vary, depending on the <var>type-descriptor</var>.
115See <a href="Type-Descriptors.html#Type-Descriptors">Type Descriptors</a>, for a list of <var>type-descriptor</var> values.  If
116a number follows the &lsquo;<samp>=</samp>&rsquo; then the number is a <var>type-reference</var>.
117For a full description of types, <a href="Types.html#Types">Types</a>.
118</p>
119<p>A <var>type-number</var> is often a single number.  The GNU and Sun tools
120additionally permit a <var>type-number</var> to be a pair
121(<var>file-number</var>,<var>filetype-number</var>) (the parentheses appear in the
122string, and serve to distinguish the two cases).  The <var>file-number</var>
123is 0 for the base source file, 1 for the first included file, 2 for the
124next, and so on.  The <var>filetype-number</var> is a number starting with
1251 which is incremented for each new type defined in the file.
126(Separating the file number and the type number permits the
127<code>N_BINCL</code> optimization to succeed more often; see <a href="Include-Files.html#Include-Files">Include Files</a>).
128</p>
129<p>There is an AIX extension for type attributes.  Following the &lsquo;<samp>=</samp>&rsquo;
130are any number of type attributes.  Each one starts with &lsquo;<samp>@</samp>&rsquo; and
131ends with &lsquo;<samp>;</samp>&rsquo;.  Debuggers, including AIX&rsquo;s dbx and GDB 4.10, skip
132any type attributes they do not recognize.  GDB 4.9 and other versions
133of dbx may not do this.  Because of a conflict with C<tt>++</tt>
134(see <a href="Cplusplus.html#Cplusplus">Cplusplus</a>), new attributes should not be defined which begin
135with a digit, &lsquo;<samp>(</samp>&rsquo;, or &lsquo;<samp>-</samp>&rsquo;; GDB may be unable to distinguish
136those from the C<tt>++</tt> type descriptor &lsquo;<samp>@</samp>&rsquo;.  The attributes are:
137</p>
138<dl compact="compact">
139<dt><code>a<var>boundary</var></code></dt>
140<dd><p><var>boundary</var> is an integer specifying the alignment.  I assume it
141applies to all variables of this type.
142</p>
143</dd>
144<dt><code>p<var>integer</var></code></dt>
145<dd><p>Pointer class (for checking).  Not sure what this means, or how
146<var>integer</var> is interpreted.
147</p>
148</dd>
149<dt><code>P</code></dt>
150<dd><p>Indicate this is a packed type, meaning that structure fields or array
151elements are placed more closely in memory, to save memory at the
152expense of speed.
153</p>
154</dd>
155<dt><code>s<var>size</var></code></dt>
156<dd><p>Size in bits of a variable of this type.  This is fully supported by GDB
1574.11 and later.
158</p>
159</dd>
160<dt><code>S</code></dt>
161<dd><p>Indicate that this type is a string instead of an array of characters,
162or a bitstring instead of a set.  It doesn&rsquo;t change the layout of the
163data being represented, but does enable the debugger to know which type
164it is.
165</p>
166</dd>
167<dt><code>V</code></dt>
168<dd><p>Indicate that this type is a vector instead of an array.  The only
169major difference between vectors and arrays is that vectors are
170passed by value instead of by reference (vector coprocessor extension).
171</p>
172</dd>
173</dl>
174
175<p>All of this can make the string field quite long.  All versions of GDB,
176and some versions of dbx, can handle arbitrarily long strings.  But many
177versions of dbx (or assemblers or linkers, I&rsquo;m not sure which)
178cretinously limit the strings to about 80 characters, so compilers which
179must work with such systems need to split the <code>.stabs</code> directive
180into several <code>.stabs</code> directives.  Each stab duplicates every field
181except the string field.  The string field of every stab except the last
182is marked as continued with a backslash at the end (in the assembly code
183this may be written as a double backslash, depending on the assembler).
184Removing the backslashes and concatenating the string fields of each
185stab produces the original, long string.  Just to be incompatible (or so
186they don&rsquo;t have to worry about what the assembler does with
187backslashes), AIX can use &lsquo;<samp>?</samp>&rsquo; instead of backslash.
188</p>
189<hr>
190<div class="header">
191<p>
192Next: <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="previous">Stabs Format</a>, Up: <a href="Overview.html#Overview" accesskey="u" rel="up">Overview</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>
193</div>
194
195
196
197</body>
198</html>
199