1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- Copyright (C) 1992-2021 Free Software Foundation, Inc. 4Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon, 5and David MacKenzie. 6 7Permission is granted to copy, distribute and/or modify this document 8under the terms of the GNU Free Documentation License, Version 1.3 or 9any later version published by the Free Software Foundation; with no 10Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 11Texts. A copy of the license is included in the section entitled "GNU 12Free Documentation License". --> 13<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 14<head> 15<title>STABS: Parameters</title> 16 17<meta name="description" content="STABS: Parameters"> 18<meta name="keywords" content="STABS: Parameters"> 19<meta name="resource-type" content="document"> 20<meta name="distribution" content="global"> 21<meta name="Generator" content="makeinfo"> 22<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 23<link href="index.html#Top" rel="start" title="Top"> 24<link href="Symbol-Types-Index.html#Symbol-Types-Index" rel="index" title="Symbol Types Index"> 25<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 26<link href="Variables.html#Variables" rel="up" title="Variables"> 27<link href="Register-Parameters.html#Register-Parameters" rel="next" title="Register Parameters"> 28<link href="Based-Variables.html#Based-Variables" rel="previous" title="Based Variables"> 29<style type="text/css"> 30<!-- 31a.summary-letter {text-decoration: none} 32blockquote.smallquotation {font-size: smaller} 33div.display {margin-left: 3.2em} 34div.example {margin-left: 3.2em} 35div.indentedblock {margin-left: 3.2em} 36div.lisp {margin-left: 3.2em} 37div.smalldisplay {margin-left: 3.2em} 38div.smallexample {margin-left: 3.2em} 39div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 40div.smalllisp {margin-left: 3.2em} 41kbd {font-style:oblique} 42pre.display {font-family: inherit} 43pre.format {font-family: inherit} 44pre.menu-comment {font-family: serif} 45pre.menu-preformatted {font-family: serif} 46pre.smalldisplay {font-family: inherit; font-size: smaller} 47pre.smallexample {font-size: smaller} 48pre.smallformat {font-family: inherit; font-size: smaller} 49pre.smalllisp {font-size: smaller} 50span.nocodebreak {white-space:nowrap} 51span.nolinebreak {white-space:nowrap} 52span.roman {font-family:serif; font-weight:normal} 53span.sansserif {font-family:sans-serif; font-weight:normal} 54ul.no-bullet {list-style: none} 55--> 56</style> 57 58 59</head> 60 61<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 62<a name="Parameters"></a> 63<div class="header"> 64<p> 65Previous: <a href="Based-Variables.html#Based-Variables" accesskey="p" rel="previous">Based Variables</a>, Up: <a href="Variables.html#Variables" accesskey="u" rel="up">Variables</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> 66</div> 67<hr> 68<a name="Parameters-1"></a> 69<h3 class="section">4.7 Parameters</h3> 70 71<p>Formal parameters to a function are represented by a stab (or sometimes 72two; see below) for each parameter. The stabs are in the order in which 73the debugger should print the parameters (i.e., the order in which the 74parameters are declared in the source file). The exact form of the stab 75depends on how the parameter is being passed. 76</p> 77<a name="index-N_005fPSYM"></a> 78<a name="index-C_005fPSYM"></a> 79<p>Parameters passed on the stack use the symbol descriptor ‘<samp>p</samp>’ and 80the <code>N_PSYM</code> symbol type (or <code>C_PSYM</code> for XCOFF). The value 81of the symbol is an offset used to locate the parameter on the stack; 82its exact meaning is machine-dependent, but on most machines it is an 83offset from the frame pointer. 84</p> 85<p>As a simple example, the code: 86</p> 87<div class="example"> 88<pre class="example">main (argc, argv) 89 int argc; 90 char **argv; 91</pre></div> 92 93<p>produces the stabs: 94</p> 95<div class="example"> 96<pre class="example">.stabs "main:F1",36,0,0,_main # <span class="roman">36 is N_FUN</span> 97.stabs "argc:p1",160,0,0,68 # <span class="roman">160 is N_PSYM</span> 98.stabs "argv:p20=*21=*2",160,0,0,72 99</pre></div> 100 101<p>The type definition of <code>argv</code> is interesting because it contains 102several type definitions. Type 21 is pointer to type 2 (char) and 103<code>argv</code> (type 20) is pointer to type 21. 104</p> 105<p>The following symbol descriptors are also said to go with <code>N_PSYM</code>. 106The value of the symbol is said to be an offset from the argument 107pointer (I’m not sure whether this is true or not). 108</p> 109<div class="example"> 110<pre class="example">pP (<<??>>) 111pF Fortran function parameter 112X (function result variable) 113</pre></div> 114 115<table class="menu" border="0" cellspacing="0"> 116<tr><td align="left" valign="top">• <a href="Register-Parameters.html#Register-Parameters" accesskey="1">Register Parameters</a>:</td><td> </td><td align="left" valign="top"> 117</td></tr> 118<tr><td align="left" valign="top">• <a href="Local-Variable-Parameters.html#Local-Variable-Parameters" accesskey="2">Local Variable Parameters</a>:</td><td> </td><td align="left" valign="top"> 119</td></tr> 120<tr><td align="left" valign="top">• <a href="Reference-Parameters.html#Reference-Parameters" accesskey="3">Reference Parameters</a>:</td><td> </td><td align="left" valign="top"> 121</td></tr> 122<tr><td align="left" valign="top">• <a href="Conformant-Arrays.html#Conformant-Arrays" accesskey="4">Conformant Arrays</a>:</td><td> </td><td align="left" valign="top"> 123</td></tr> 124</table> 125 126<hr> 127<div class="header"> 128<p> 129Previous: <a href="Based-Variables.html#Based-Variables" accesskey="p" rel="previous">Based Variables</a>, Up: <a href="Variables.html#Variables" accesskey="u" rel="up">Variables</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> 130</div> 131 132 133 134</body> 135</html> 136