4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"STABS">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Unions">Unions
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Function-Types.html#Function%20Types">Function Types
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Typedefs.html#Typedefs">Typedefs
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"Types.html#Types">Types
</a>
19 <h3 class=
"section">Unions
</h3>
21 <pre class=
"example"> union u_tag {
28 <p>This code generates a stab for a union tag and a stab for a union
29 variable. Both use the
<code>N_LSYM
</code> stab type. If a union variable is
30 scoped locally to the procedure in which it is defined, its stab is
31 located immediately preceding the
<code>N_LBRAC
</code> for the procedure's block
34 <p>The stab for the union tag, however, is located preceding the code for
35 the procedure in which it is defined. The stab type is
<code>N_LSYM
</code>. This
36 would seem to imply that the union type is file scope, like the struct
37 type
<code>s_tag
</code>. This is not true. The contents and position of the stab
38 for
<code>u_type
</code> do not convey any information about its procedure local
41 <pre class=
"smallexample"> #
128 is N_LSYM
42 .stabs
"u_tag:T23=u4u_int:1,0,32;u_float:12,0,32;u_char:21,0,32;;",
46 <p>The symbol descriptor
<code>T
</code>, following the
<code>name:
</code> means that
47 the stab describes an enumeration, structure, or union tag. The type
48 descriptor
<code>u
</code>, following the
<code>23=
</code> of the type definition,
49 narrows it down to a union type definition. Following the
<code>u
</code> is
50 the number of bytes in the union. After that is a list of union element
51 descriptions. Their format is
<var>name:type, bit offset into the
52 union, number of bytes for the element;
</var>.
54 <p>The stab for the union variable is:
56 <pre class=
"example"> .stabs
"an_u:23",
128,
0,
0,-
20 #
128 is N_LSYM
59 <p><code>-
20</code> specifies where the variable is stored (see
<a href=
"Stack-Variables.html#Stack%20Variables">Stack Variables
</a>).