Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / stabs / Register-Parameters.html
blob5bca1af768a7ca876532d6a7d67985154ab942cf
1 <html lang="en">
2 <head>
3 <title>STABS</title>
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">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Register%20Parameters">Register Parameters</a>,
13 Next:<a rel="next" accesskey="n" href="Local-Variable-Parameters.html#Local%20Variable%20Parameters">Local Variable Parameters</a>,
14 Up:<a rel="up" accesskey="u" href="Parameters.html#Parameters">Parameters</a>
15 <hr><br>
16 </div>
18 <h4 class="subsection">Passing Parameters in Registers</h4>
20 <p>If the parameter is passed in a register, then traditionally there are
21 two symbols for each argument:
23 <pre class="example"> .stabs "arg:p1" . . . ; N_PSYM
24 .stabs "arg:r1" . . . ; N_RSYM
25 </pre>
27 <p>Debuggers use the second one to find the value, and the first one to
28 know that it is an argument.
30 <p>Because that approach is kind of ugly, some compilers use symbol
31 descriptor <code>P</code> or <code>R</code> to indicate an argument which is in a
32 register. Symbol type <code>C_RPSYM</code> is used in XCOFF and <code>N_RSYM</code>
33 is used otherwise. The symbol's value is the register number. <code>P</code>
34 and <code>R</code> mean the same thing; the difference is that <code>P</code> is a
35 GNU invention and <code>R</code> is an IBM (XCOFF) invention. As of version
36 4.9, GDB should handle either one.
38 <p>There is at least one case where GCC uses a <code>p</code> and <code>r</code> pair
39 rather than <code>P</code>; this is where the argument is passed in the
40 argument list and then loaded into a register.
42 <p>According to the AIX documentation, symbol descriptor <code>D</code> is for a
43 parameter passed in a floating point register. This seems
44 unnecessary--why not just use <code>R</code> with a register number which
45 indicates that it's a floating point register? I haven't verified
46 whether the system actually does what the documentation indicates.
48 <p>On the sparc and hppa, for a <code>P</code> symbol whose type is a structure
49 or union, the register contains the address of the structure. On the
50 sparc, this is also true of a <code>p</code> and <code>r</code> pair (using Sun
51 <code>cc</code>) or a <code>p</code> symbol. However, if a (small) structure is
52 really in a register, <code>r</code> is used. And, to top it all off, on the
53 hppa it might be a structure which was passed on the stack and loaded
54 into a register and for which there is a <code>p</code> and <code>r</code> pair! I
55 believe that symbol descriptor <code>i</code> is supposed to deal with this
56 case (it is said to mean "value parameter by reference, indirect
57 access"; I don't know the source for this information), but I don't know
58 details or what compilers or debuggers use it, if any (not GDB or GCC).
59 It is not clear to me whether this case needs to be dealt with
60 differently than parameters passed by reference (see <a href="Reference-Parameters.html#Reference%20Parameters">Reference Parameters</a>).
62 </body></html>