This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
stabs.texinfo update for macro define/undefine
- From: David Taylor <dtaylor at emc dot com>
- To: gdb at sourceware dot org
- Date: Wed, 25 Oct 2006 15:31:27 -0400
- Subject: stabs.texinfo update for macro define/undefine
This relates to my stabs and define/undef patches posted to
gcc-patches and gdb-patches.
The following still needs to be texified. But, before worrying about
that, I'd like to get comments on the contents. In the patch and in
the .s file extract below, N_MAC_DEFINE and N_MAC_UNDEF have the
values 0x36 and 0x3a, respectively. I'm also unsure *where* in
stabs.texinfo to put this information.
Macro define and undefine.
Sometimes macro define and undefine information is recorded in stabs
(e.g., with -g3 -gstabs when using gcc).
A ``#define macro-name macro-body'' is represented with an
N_MAC_DEFINE stab with a `string' field of ``macro-name macro-body''.
An ``#undef macro-name'' is represented with an N_MAC_UNDEF stabs with
a `string' field of simply ``macro-name''.
For both N_MAC_DEFINE and N_MAC_UNDEF, the `desc' field is the line
number within the file where the corresponding #define or #undef
occurred.
For example, the following C code:
#define NONE 42
#define TWO(a, b) (a + (a) + 2 * b)
#define ONE(c) (c + 19)
main(int argc, char *argv[])
{
func(NONE, TWO(10, 11));
func(NONE, ONE(23));
#undef ONE
#define ONE(c) (c + 23)
func(NONE, ONE(-23));
return (0);
}
int global;
func(int arg1, int arg2)
{
global = arg1 + arg2;
}
produces the following stabs (as well as many others):
.stabs "NONE 42",54,0,1,0 # 54 is N_MAC_DEFINE
.stabs "TWO(a,b) (a + (a) + 2 * b)",54,0,2,0 # 54 is N_MAC_DEFINE
.stabs "ONE(c) (c + 19)",54,0,3,0 # 54 is N_MAC_DEFINE
.stabs "ONE",58,0,10,0 # 58 is N_MAC_UNDEF
.stabs "ONE(c) (c + 23)",54,0,11,0 # 54 is N_MAC_DEFINE