* stabs.texinfo (Parameters): Re-do "local parameters" section.

This commit is contained in:
Jim Kingdon
1993-04-19 15:02:51 +00:00
parent 7e4db2548b
commit b82ea042b4
2 changed files with 35 additions and 27 deletions

View File

@ -1,3 +1,7 @@
Mon Apr 19 08:00:51 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Parameters): Re-do "local parameters" section.
Sun Apr 18 09:47:45 1993 Jim Kingdon (kingdon@cygnus.com) Sun Apr 18 09:47:45 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Symbol descriptors): Re-do using @table and @xref. * stabs.texinfo (Symbol descriptors): Re-do using @table and @xref.

View File

@ -984,52 +984,56 @@ The stab for @code{s_flap} is located just before the @code{N_LBRAC} for
@section Parameters @section Parameters
The symbol descriptor @samp{p} is used to refer to parameters which are The symbol descriptor @samp{p} is used to refer to parameters which are
in the arglist. They follow the symbol that represents the procedure in the arglist. Symbols have symbol type @samp{N_PSYM}. The value of
itself. The value of the symbol is the offset relative to the argument the symbol is the offset relative to the argument list.
list.
If the parameter is passed in a register, or is allocated as a local If the parameter is passed in a register, then the traditional way to do
variable rather than an argument (the latter distinction is important
for machines in which the argument list offset is relative to something
different from a local variable offset), then the traditional way to do
this is to provide two symbols for each argument: this is to provide two symbols for each argument:
@example @example
.stabs "arg:p1" . . . .stabs "arg:p1" . . . ; N_PSYM
.stabs "arg:r1" . . . .stabs "arg:r1" . . . ; N_RSYM
@end example @end example
Debuggers are expected to use the second one to find the value, and the Debuggers are expected to use the second one to find the value, and the
first one to know that it is an argument. first one to know that it is an argument.
Because this is kind of ugly, some compilers use symbol descriptor @samp{P} Because this is kind of ugly, some compilers use symbol descriptor
or @samp{R} to indicate an argument which is in a register. The symbol @samp{P} or @samp{R} to indicate an argument which is in a register.
value is the register number. @samp{P} and @samp{R} mean the same The symbol value is the register number. @samp{P} and @samp{R} mean the
thing, the difference is that @samp{P} is a GNU invention and @samp{R} same thing, the difference is that @samp{P} is a GNU invention and
is an IBM (xcoff) invention. As of version 4.9, GDB should handle @samp{R} is an IBM (xcoff) invention. As of version 4.9, GDB should
either one. handle either one. Symbol type @samp{C_RPSYM} is used with @samp{R} and
@samp{N_RSYM} is used with @samp{P}.
There is no symbol descriptor analogous to @samp{P} for local variables. There is another case similar to an argument in a register, which is an
Some compilers are said to use the pair of symbols approach described argument which is actually stored as a local variable. The only case I
above, but I don't know which ones. On the intel 960, the type of the know of where this happens is when the argument was passed in a register
variable indicates whether a @samp{p} symbol's value is an the argument and then the compiler stores it as a local variable. In this case the
list offset or a local variable offset. compiler would probably be much better off claiming that it's in a
register, but at least in one case this isn't done. Some compilers are
said to use the pair of symbols approach described above ("arg:p"
followed by "arg:"), but I don't which if any. GCC, at least on the
960, uses a @samp{p} symbol descriptor for this case but uses
@samp{N_LSYM} instead of @samp{N_PSYM} to distinguish it. In this case
the value of the symbol is an offset relative to the local variables for
that function, not relative to the arguments.
As a simple example, the code As a simple example, the code
@example @example
17 main (argc, argv) main (argc, argv)
18 int argc; int argc;
19 char **argv; char **argv;
20 @{ @{
@end example @end example
produces the stabs produces the stabs
@example @example
94 .stabs "main:F1",36,0,0,_main ; 36 is N_FUN .stabs "main:F1",36,0,0,_main ; 36 is N_FUN
95 .stabs "argc:p1",160,0,0,68 ; 160 is N_PSYM .stabs "argc:p1",160,0,0,68 ; 160 is N_PSYM
96 .stabs "argv:p20=*21=*2",160,0,0,72 .stabs "argv:p20=*21=*2",160,0,0,72
@end example @end example
The type definition of argv is interesting because it contains several The type definition of argv is interesting because it contains several