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.
125 lines
6.4 KiB
HTML
125 lines
6.4 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>Register Parameters (STABS)</title>
|
||
|
|
||
|
<meta name="description" content="Register Parameters (STABS)">
|
||
|
<meta name="keywords" content="Register Parameters (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="Parameters.html#Parameters" rel="up" title="Parameters">
|
||
|
<link href="Local-Variable-Parameters.html#Local-Variable-Parameters" rel="next" title="Local Variable Parameters">
|
||
|
<link href="Parameters.html#Parameters" rel="prev" title="Parameters">
|
||
|
<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="Register-Parameters"></a>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="Local-Variable-Parameters.html#Local-Variable-Parameters" accesskey="n" rel="next">Local Variable Parameters</a>, Up: <a href="Parameters.html#Parameters" accesskey="u" rel="up">Parameters</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="Passing-Parameters-in-Registers"></a>
|
||
|
<h4 class="subsection">4.7.1 Passing Parameters in Registers</h4>
|
||
|
|
||
|
<p>If the parameter is passed in a register, then traditionally there are
|
||
|
two symbols for each argument:
|
||
|
</p>
|
||
|
<div class="example">
|
||
|
<pre class="example">.stabs "arg:p1" . . . ; N_PSYM
|
||
|
.stabs "arg:r1" . . . ; N_RSYM
|
||
|
</pre></div>
|
||
|
|
||
|
<p>Debuggers use the second one to find the value, and the first one to
|
||
|
know that it is an argument.
|
||
|
</p>
|
||
|
<a name="index-C_005fRPSYM"></a>
|
||
|
<a name="index-N_005fRSYM_002c-for-parameters"></a>
|
||
|
<p>Because that approach is kind of ugly, some compilers use symbol
|
||
|
descriptor ‘<samp>P</samp>’ or ‘<samp>R</samp>’ to indicate an argument which is in a
|
||
|
register. Symbol type <code>C_RPSYM</code> is used in XCOFF and <code>N_RSYM</code>
|
||
|
is used otherwise. The symbol’s value is the register number. ‘<samp>P</samp>’
|
||
|
and ‘<samp>R</samp>’ mean the same thing; the difference is that ‘<samp>P</samp>’ is a
|
||
|
GNU invention and ‘<samp>R</samp>’ is an IBM (XCOFF) invention. As of version
|
||
|
4.9, GDB should handle either one.
|
||
|
</p>
|
||
|
<p>There is at least one case where GCC uses a ‘<samp>p</samp>’ and ‘<samp>r</samp>’ pair
|
||
|
rather than ‘<samp>P</samp>’; this is where the argument is passed in the
|
||
|
argument list and then loaded into a register.
|
||
|
</p>
|
||
|
<p>According to the AIX documentation, symbol descriptor ‘<samp>D</samp>’ is for a
|
||
|
parameter passed in a floating point register. This seems
|
||
|
unnecessary—why not just use ‘<samp>R</samp>’ with a register number which
|
||
|
indicates that it’s a floating point register? I haven’t verified
|
||
|
whether the system actually does what the documentation indicates.
|
||
|
</p>
|
||
|
<p>On the sparc and hppa, for a ‘<samp>P</samp>’ symbol whose type is a structure
|
||
|
or union, the register contains the address of the structure. On the
|
||
|
sparc, this is also true of a ‘<samp>p</samp>’ and ‘<samp>r</samp>’ pair (using Sun
|
||
|
<code>cc</code>) or a ‘<samp>p</samp>’ symbol. However, if a (small) structure is
|
||
|
really in a register, ‘<samp>r</samp>’ is used. And, to top it all off, on the
|
||
|
hppa it might be a structure which was passed on the stack and loaded
|
||
|
into a register and for which there is a ‘<samp>p</samp>’ and ‘<samp>r</samp>’ pair! I
|
||
|
believe that symbol descriptor ‘<samp>i</samp>’ is supposed to deal with this
|
||
|
case (it is said to mean "value parameter by reference, indirect
|
||
|
access"; I don’t know the source for this information), but I don’t know
|
||
|
details or what compilers or debuggers use it, if any (not GDB or GCC).
|
||
|
It is not clear to me whether this case needs to be dealt with
|
||
|
differently than parameters passed by reference (see <a href="Reference-Parameters.html#Reference-Parameters">Reference Parameters</a>).
|
||
|
</p>
|
||
|
<hr>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="Local-Variable-Parameters.html#Local-Variable-Parameters" accesskey="n" rel="next">Local Variable Parameters</a>, Up: <a href="Parameters.html#Parameters" accesskey="u" rel="up">Parameters</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>
|