blob: 3b00bbb9b699f31736d20160a3fcfbb30dd25ac5 [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: Parameters</title>
<meta name="description" content="STABS: Parameters">
<meta name="keywords" content="STABS: Parameters">
<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="Variables.html#Variables" rel="up" title="Variables">
<link href="Register-Parameters.html#Register-Parameters" rel="next" title="Register Parameters">
<link href="Based-Variables.html#Based-Variables" rel="prev" title="Based Variables">
<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="Parameters"></a>
<div class="header">
<p>
Previous: <a href="Based-Variables.html#Based-Variables" accesskey="p" rel="prev">Based Variables</a>, Up: <a href="Variables.html#Variables" accesskey="u" rel="up">Variables</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="Parameters-1"></a>
<h3 class="section">4.7 Parameters</h3>
<p>Formal parameters to a function are represented by a stab (or sometimes
two; see below) for each parameter. The stabs are in the order in which
the debugger should print the parameters (i.e., the order in which the
parameters are declared in the source file). The exact form of the stab
depends on how the parameter is being passed.
</p>
<a name="index-N_005fPSYM"></a>
<a name="index-C_005fPSYM"></a>
<p>Parameters passed on the stack use the symbol descriptor &lsquo;<samp>p</samp>&rsquo; and
the <code>N_PSYM</code> symbol type (or <code>C_PSYM</code> for XCOFF). The value
of the symbol is an offset used to locate the parameter on the stack;
its exact meaning is machine-dependent, but on most machines it is an
offset from the frame pointer.
</p>
<p>As a simple example, the code:
</p>
<div class="example">
<pre class="example">main (argc, argv)
int argc;
char **argv;
</pre></div>
<p>produces the stabs:
</p>
<div class="example">
<pre class="example">.stabs &quot;main:F1&quot;,36,0,0,_main # <span class="roman">36 is N_FUN</span>
.stabs &quot;argc:p1&quot;,160,0,0,68 # <span class="roman">160 is N_PSYM</span>
.stabs &quot;argv:p20=*21=*2&quot;,160,0,0,72
</pre></div>
<p>The type definition of <code>argv</code> is interesting because it contains
several type definitions. Type 21 is pointer to type 2 (char) and
<code>argv</code> (type 20) is pointer to type 21.
</p>
<p>The following symbol descriptors are also said to go with <code>N_PSYM</code>.
The value of the symbol is said to be an offset from the argument
pointer (I&rsquo;m not sure whether this is true or not).
</p>
<div class="example">
<pre class="example">pP (&lt;&lt;??&gt;&gt;)
pF Fortran function parameter
X (function result variable)
</pre></div>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="Register-Parameters.html#Register-Parameters" accesskey="1">Register Parameters</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Local-Variable-Parameters.html#Local-Variable-Parameters" accesskey="2">Local Variable Parameters</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Reference-Parameters.html#Reference-Parameters" accesskey="3">Reference Parameters</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Conformant-Arrays.html#Conformant-Arrays" accesskey="4">Conformant Arrays</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<div class="header">
<p>
Previous: <a href="Based-Variables.html#Based-Variables" accesskey="p" rel="prev">Based Variables</a>, Up: <a href="Variables.html#Variables" accesskey="u" rel="up">Variables</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>