Line 1... |
Line 1... |
This is stabs.info, produced by Makeinfo version 3.12f from
|
This is stabs.info, produced by makeinfo version 4.0 from
|
./stabs.texinfo.
|
./stabs.texinfo.
|
|
|
START-INFO-DIR-ENTRY
|
START-INFO-DIR-ENTRY
|
* Stabs: (stabs). The "stabs" debugging information format.
|
* Stabs: (stabs). The "stabs" debugging information format.
|
END-INFO-DIR-ENTRY
|
END-INFO-DIR-ENTRY
|
Line 56... |
Line 56... |
the University of California at Berkeley, for the `pdx' Pascal
|
the University of California at Berkeley, for the `pdx' Pascal
|
debugger; the format has spread widely since then.
|
debugger; the format has spread widely since then.
|
|
|
This document is one of the few published sources of documentation on
|
This document is one of the few published sources of documentation on
|
stabs. It is believed to be comprehensive for stabs used by C. The
|
stabs. It is believed to be comprehensive for stabs used by C. The
|
lists of symbol descriptors (*note Symbol Descriptors::.) and type
|
lists of symbol descriptors (*note Symbol Descriptors::) and type
|
descriptors (*note Type Descriptors::.) are believed to be completely
|
descriptors (*note Type Descriptors::) are believed to be completely
|
comprehensive. Stabs for COBOL-specific features and for variant
|
comprehensive. Stabs for COBOL-specific features and for variant
|
records (used by Pascal and Modula-2) are poorly documented here.
|
records (used by Pascal and Modula-2) are poorly documented here.
|
|
|
Other sources of information on stabs are `Dbx and Dbxtool
|
Other sources of information on stabs are `Dbx and Dbxtool
|
Interfaces', 2nd edition, by Sun, 1988, and `AIX Version 3.2 Files
|
Interfaces', 2nd edition, by Sun, 1988, and `AIX Version 3.2 Files
|
Line 158... |
Line 158... |
The overall format of the string field for most stab types is:
|
The overall format of the string field for most stab types is:
|
|
|
"NAME:SYMBOL-DESCRIPTOR TYPE-INFORMATION"
|
"NAME:SYMBOL-DESCRIPTOR TYPE-INFORMATION"
|
|
|
NAME is the name of the symbol represented by the stab; it can
|
NAME is the name of the symbol represented by the stab; it can
|
contain a pair of colons (*note Nested Symbols::.). NAME can be
|
contain a pair of colons (*note Nested Symbols::). NAME can be
|
omitted, which means the stab represents an unnamed object. For
|
omitted, which means the stab represents an unnamed object. For
|
example, `:t10=*2' defines type 10 as a pointer to type 2, but does not
|
example, `:t10=*2' defines type 10 as a pointer to type 2, but does not
|
give the type a name. Omitting the NAME field is supported by AIX dbx
|
give the type a name. Omitting the NAME field is supported by AIX dbx
|
and GDB after about version 4.8, but not other debuggers. GCC
|
and GDB after about version 4.8, but not other debuggers. GCC
|
sometimes uses a single space as the name instead of omitting the name
|
sometimes uses a single space as the name instead of omitting the name
|
Line 208... |
Line 208... |
|
|
There is an AIX extension for type attributes. Following the `='
|
There is an AIX extension for type attributes. Following the `='
|
are any number of type attributes. Each one starts with `@' and ends
|
are any number of type attributes. Each one starts with `@' and ends
|
with `;'. Debuggers, including AIX's dbx and GDB 4.10, skip any type
|
with `;'. Debuggers, including AIX's dbx and GDB 4.10, skip any type
|
attributes they do not recognize. GDB 4.9 and other versions of dbx
|
attributes they do not recognize. GDB 4.9 and other versions of dbx
|
may not do this. Because of a conflict with C++ (*note Cplusplus::.),
|
may not do this. Because of a conflict with C++ (*note Cplusplus::),
|
new attributes should not be defined which begin with a digit, `(', or
|
new attributes should not be defined which begin with a digit, `(', or
|
`-'; GDB may be unable to distinguish those from the C++ type
|
`-'; GDB may be unable to distinguish those from the C++ type
|
descriptor `@'. The attributes are:
|
descriptor `@'. The attributes are:
|
|
|
`aBOUNDARY'
|
`aBOUNDARY'
|
Line 469... |
Line 469... |
============
|
============
|
|
|
An `N_SLINE' symbol represents the start of a source line. The desc
|
An `N_SLINE' symbol represents the start of a source line. The desc
|
field contains the line number and the value contains the code address
|
field contains the line number and the value contains the code address
|
for the start of that source line. On most machines the address is
|
for the start of that source line. On most machines the address is
|
absolute; for stabs in sections (*note Stab Sections::.), it is
|
absolute; for stabs in sections (*note Stab Sections::), it is relative
|
relative to the function in which the `N_SLINE' symbol occurs.
|
to the function in which the `N_SLINE' symbol occurs.
|
|
|
GNU documents `N_DSLINE' and `N_BSLINE' symbols for line numbers in
|
GNU documents `N_DSLINE' and `N_BSLINE' symbols for line numbers in
|
the data or bss segments, respectively. They are identical to
|
the data or bss segments, respectively. They are identical to
|
`N_SLINE' but are relocated differently by the linker. They were
|
`N_SLINE' but are relocated differently by the linker. They were
|
intended to be used to describe the source location of a variable
|
intended to be used to describe the source location of a variable
|
Line 490... |
Line 490... |
|
|
XCOFF does not use stabs for line numbers. Instead, it uses COFF
|
XCOFF does not use stabs for line numbers. Instead, it uses COFF
|
line numbers (which are outside the scope of this document). Standard
|
line numbers (which are outside the scope of this document). Standard
|
COFF line numbers cannot deal with include files, but in XCOFF this is
|
COFF line numbers cannot deal with include files, but in XCOFF this is
|
fixed with the `C_BINCL' method of marking include files (*note Include
|
fixed with the `C_BINCL' method of marking include files (*note Include
|
Files::.).
|
Files::).
|
|
|
|
|
File: stabs.info, Node: Procedures, Next: Nested Procedures, Prev: Line Numbers, Up: Program Structure
|
File: stabs.info, Node: Procedures, Next: Nested Procedures, Prev: Line Numbers, Up: Program Structure
|
|
|
Procedures
|
Procedures
|
Line 544... |
Line 544... |
are being passed, whose types and number may vary (`...' in ANSI C).
|
are being passed, whose types and number may vary (`...' in ANSI C).
|
GDB has tolerated this extension (parsed the syntax, if not necessarily
|
GDB has tolerated this extension (parsed the syntax, if not necessarily
|
used the information) since at least version 4.8; I don't know whether
|
used the information) since at least version 4.8; I don't know whether
|
all versions of dbx tolerate it. The argument types given here are not
|
all versions of dbx tolerate it. The argument types given here are not
|
redundant with the symbols for the formal parameters (*note
|
redundant with the symbols for the formal parameters (*note
|
Parameters::.); they are the types of the arguments as they are passed,
|
Parameters::); they are the types of the arguments as they are passed,
|
before any conversions might take place. For example, if a C function
|
before any conversions might take place. For example, if a C function
|
which is declared without a prototype takes a `float' argument, the
|
which is declared without a prototype takes a `float' argument, the
|
value is passed as a `double' but then converted to a `float'.
|
value is passed as a `double' but then converted to a `float'.
|
Debuggers need to use the types given in the arguments when printing
|
Debuggers need to use the types given in the arguments when printing
|
values, but when calling the function they need to use the types given
|
values, but when calling the function they need to use the types given
|
Line 561... |
Line 561... |
where the function is defined was also compiled with debugging symbols.
|
where the function is defined was also compiled with debugging symbols.
|
As an extension the Solaris compiler uses symbol descriptor `P'
|
As an extension the Solaris compiler uses symbol descriptor `P'
|
followed by the return type of the function, followed by the arguments,
|
followed by the return type of the function, followed by the arguments,
|
each preceded by `;', as in a stab with symbol descriptor `f' or `F'.
|
each preceded by `;', as in a stab with symbol descriptor `f' or `F'.
|
This use of symbol descriptor `P' can be distinguished from its use for
|
This use of symbol descriptor `P' can be distinguished from its use for
|
register parameters (*note Register Parameters::.) by the fact that it
|
register parameters (*note Register Parameters::) by the fact that it
|
has symbol type `N_FUN'.
|
has symbol type `N_FUN'.
|
|
|
The AIX documentation also defines symbol descriptor `J' as an
|
The AIX documentation also defines symbol descriptor `J' as an
|
internal function. I assume this means a function nested within another
|
internal function. I assume this means a function nested within another
|
function. It also says symbol descriptor `m' is a module in Modula-2
|
function. It also says symbol descriptor `m' is a module in Modula-2
|
Line 651... |
Line 651... |
machine, and Sun `acc' compilers, put the variables after the `N_LBRAC'
|
machine, and Sun `acc' compilers, put the variables after the `N_LBRAC'
|
symbol. The values of the `N_LBRAC' and `N_RBRAC' symbols are the
|
symbol. The values of the `N_LBRAC' and `N_RBRAC' symbols are the
|
start and end addresses of the code of the block, respectively. For
|
start and end addresses of the code of the block, respectively. For
|
most machines, they are relative to the starting address of this source
|
most machines, they are relative to the starting address of this source
|
file. For the Gould NP1, they are absolute. For stabs in sections
|
file. For the Gould NP1, they are absolute. For stabs in sections
|
(*note Stab Sections::.), they are relative to the function in which
|
(*note Stab Sections::), they are relative to the function in which
|
they occur.
|
they occur.
|
|
|
The `N_LBRAC' and `N_RBRAC' stabs that describe the block scope of a
|
The `N_LBRAC' and `N_RBRAC' stabs that describe the block scope of a
|
procedure are located after the `N_FUN' stab that represents the
|
procedure are located after the `N_FUN' stab that represents the
|
procedure itself.
|
procedure itself.
|
Line 703... |
Line 703... |
Character constant. VALUE is the numeric value of the constant.
|
Character constant. VALUE is the numeric value of the constant.
|
|
|
`e TYPE-INFORMATION , VALUE'
|
`e TYPE-INFORMATION , VALUE'
|
Constant whose value can be represented as integral.
|
Constant whose value can be represented as integral.
|
TYPE-INFORMATION is the type of the constant, as it would appear
|
TYPE-INFORMATION is the type of the constant, as it would appear
|
after a symbol descriptor (*note String Field::.). VALUE is the
|
after a symbol descriptor (*note String Field::). VALUE is the
|
numeric value of the constant. GDB 4.9 does not actually get the
|
numeric value of the constant. GDB 4.9 does not actually get the
|
right value if VALUE does not fit in a host `int', but it does not
|
right value if VALUE does not fit in a host `int', but it does not
|
do anything violent, and future debuggers could be extended to
|
do anything violent, and future debuggers could be extended to
|
accept integers of any size (whether unsigned or not). This
|
accept integers of any size (whether unsigned or not). This
|
constant type is usually documented as being only for enumeration
|
constant type is usually documented as being only for enumeration
|
Line 732... |
Line 732... |
`\'' or `"' (in which case `"' characters within the string are
|
`\'' or `"' (in which case `"' characters within the string are
|
represented as `\"').
|
represented as `\"').
|
|
|
`S TYPE-INFORMATION , ELEMENTS , BITS , PATTERN'
|
`S TYPE-INFORMATION , ELEMENTS , BITS , PATTERN'
|
Set constant. TYPE-INFORMATION is the type of the constant, as it
|
Set constant. TYPE-INFORMATION is the type of the constant, as it
|
would appear after a symbol descriptor (*note String Field::.).
|
would appear after a symbol descriptor (*note String Field::).
|
ELEMENTS is the number of elements in the set (does this means how
|
ELEMENTS is the number of elements in the set (does this means how
|
many bits of PATTERN are actually used, which would be redundant
|
many bits of PATTERN are actually used, which would be redundant
|
with the type, or perhaps the number of bits set in PATTERN? I
|
with the type, or perhaps the number of bits set in PATTERN? I
|
don't get it), BITS is the number of bits in the constant (meaning
|
don't get it), BITS is the number of bits in the constant (meaning
|
it specifies the length of PATTERN, I think), and PATTERN is a
|
it specifies the length of PATTERN, I think), and PATTERN is a
|
Line 780... |
Line 780... |
==========================================
|
==========================================
|
|
|
If a variable's scope is local to a function and its lifetime is
|
If a variable's scope is local to a function and its lifetime is
|
only as long as that function executes (C calls such variables
|
only as long as that function executes (C calls such variables
|
"automatic"), it can be allocated in a register (*note Register
|
"automatic"), it can be allocated in a register (*note Register
|
Variables::.) or on the stack.
|
Variables::) or on the stack.
|
|
|
Each variable allocated on the stack has a stab with the symbol
|
Each variable allocated on the stack has a stab with the symbol
|
descriptor omitted. Since type information should begin with a digit,
|
descriptor omitted. Since type information should begin with a digit,
|
`-', or `(', only those characters precluded from being used for symbol
|
`-', or `(', only those characters precluded from being used for symbol
|
descriptors. However, the Acorn RISC machine (ARM) is said to get this
|
descriptors. However, the Acorn RISC machine (ARM) is said to get this
|
Line 824... |
Line 824... |
================
|
================
|
|
|
A variable whose scope is not specific to just one source file is
|
A variable whose scope is not specific to just one source file is
|
represented by the `G' symbol descriptor. These stabs use the `N_GSYM'
|
represented by the `G' symbol descriptor. These stabs use the `N_GSYM'
|
stab type (C_GSYM for XCOFF). The type information for the stab (*note
|
stab type (C_GSYM for XCOFF). The type information for the stab (*note
|
String Field::.) gives the type of the variable.
|
String Field::) gives the type of the variable.
|
|
|
For example, the following source code:
|
For example, the following source code:
|
|
|
char g_foo = 'c';
|
char g_foo = 'c';
|
|
|
Line 1084... |
Line 1084... |
descriptor `i' is supposed to deal with this case (it is said to mean
|
descriptor `i' is supposed to deal with this case (it is said to mean
|
"value parameter by reference, indirect access"; I don't know the
|
"value parameter by reference, indirect access"; I don't know the
|
source for this information), but I don't know details or what
|
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
|
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
|
clear to me whether this case needs to be dealt with differently than
|
parameters passed by reference (*note Reference Parameters::.).
|
parameters passed by reference (*note Reference Parameters::).
|
|
|
|
|
File: stabs.info, Node: Local Variable Parameters, Next: Reference Parameters, Prev: Register Parameters, Up: Parameters
|
File: stabs.info, Node: Local Variable Parameters, Next: Reference Parameters, Prev: Register Parameters, Up: Parameters
|
|
|
Storing Parameters as Local Variables
|
Storing Parameters as Local Variables
|
Line 1119... |
Line 1119... |
|
|
.stabs "f:p13",160,0,3,8 # 160 is `N_PSYM', here 13 is `double'
|
.stabs "f:p13",160,0,3,8 # 160 is `N_PSYM', here 13 is `double'
|
.stabs "f:r12",64,0,3,0 # 64 is `N_RSYM', here 12 is `float'
|
.stabs "f:r12",64,0,3,0 # 64 is `N_RSYM', here 12 is `float'
|
|
|
In both stabs 3 is the line number where `f' is declared (*note Line
|
In both stabs 3 is the line number where `f' is declared (*note Line
|
Numbers::.).
|
Numbers::).
|
|
|
GCC, at least on the 960, has another solution to the same problem.
|
GCC, at least on the 960, has another solution to the same problem.
|
It uses a single `p' symbol descriptor for an argument which is stored
|
It uses a single `p' symbol descriptor for an argument which is stored
|
as a local variable but uses `N_LSYM' instead of `N_PSYM'. In this
|
as a local variable but uses `N_LSYM' instead of `N_PSYM'. In this
|
case, the value of the symbol is an offset relative to the local
|
case, the value of the symbol is an offset relative to the local
|