summaryrefslogtreecommitdiff
path: root/share/doc/stabs/Unions.html
diff options
context:
space:
mode:
Diffstat (limited to 'share/doc/stabs/Unions.html')
-rw-r--r--share/doc/stabs/Unions.html118
1 files changed, 118 insertions, 0 deletions
diff --git a/share/doc/stabs/Unions.html b/share/doc/stabs/Unions.html
new file mode 100644
index 0000000..cf4563d
--- /dev/null
+++ b/share/doc/stabs/Unions.html
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- Copyright (C) 1992-2023 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.1, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>STABS: Unions</title>
+
+<meta name="description" content="STABS: Unions">
+<meta name="keywords" content="STABS: Unions">
+<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="Types.html#Types" rel="up" title="Types">
+<link href="Function-Types.html#Function-Types" rel="next" title="Function Types">
+<link href="Typedefs.html#Typedefs" rel="previous" title="Typedefs">
+<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="Unions"></a>
+<div class="header">
+<p>
+Next: <a href="Function-Types.html#Function-Types" accesskey="n" rel="next">Function Types</a>, Previous: <a href="Typedefs.html#Typedefs" accesskey="p" rel="previous">Typedefs</a>, Up: <a href="Types.html#Types" accesskey="u" rel="up">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="Unions-1"></a>
+<h3 class="section">5.10 Unions</h3>
+
+<div class="example">
+<pre class="example">union u_tag {
+ int u_int;
+ float u_float;
+ char* u_char;
+} an_u;
+</pre></div>
+
+<p>This code generates a stab for a union tag and a stab for a union
+variable. Both use the <code>N_LSYM</code> stab type. If a union variable is
+scoped locally to the procedure in which it is defined, its stab is
+located immediately preceding the <code>N_LBRAC</code> for the procedure&rsquo;s block
+start.
+</p>
+<p>The stab for the union tag, however, is located preceding the code for
+the procedure in which it is defined. The stab type is <code>N_LSYM</code>. This
+would seem to imply that the union type is file scope, like the struct
+type <code>s_tag</code>. This is not true. The contents and position of the stab
+for <code>u_type</code> do not convey any information about its procedure local
+scope.
+</p>
+<div class="smallexample">
+<pre class="smallexample"># <span class="roman">128 is N_LSYM</span>
+.stabs &quot;u_tag:T23=u4u_int:1,0,32;u_float:12,0,32;u_char:21,0,32;;&quot;,
+ 128,0,0,0
+</pre></div>
+
+<p>The symbol descriptor &lsquo;<samp>T</samp>&rsquo;, following the &lsquo;<samp>name:</samp>&rsquo; means that
+the stab describes an enumeration, structure, or union tag. The type
+descriptor &lsquo;<samp>u</samp>&rsquo;, following the &lsquo;<samp>23=</samp>&rsquo; of the type definition,
+narrows it down to a union type definition. Following the &lsquo;<samp>u</samp>&rsquo; is
+the number of bytes in the union. After that is a list of union element
+descriptions. Their format is &lsquo;<samp><var>name</var>:<var>type</var>, <var>bit
+offset into the union</var>, <var>number of bytes for the element</var>;</samp>&rsquo;.
+</p>
+<p>The stab for the union variable is:
+</p>
+<div class="example">
+<pre class="example">.stabs &quot;an_u:23&quot;,128,0,0,-20 # <span class="roman">128 is N_LSYM</span>
+</pre></div>
+
+<p>&lsquo;<samp>-20</samp>&rsquo; specifies where the variable is stored (see <a href="Stack-Variables.html#Stack-Variables">Stack Variables</a>).
+</p>
+
+
+
+</body>
+</html>