From: David Taylor <dtaylor@emc.com>
To: gdb-patches@sourceware.org
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: Re: stabs.texinfo update for macro define/undefine
Date: Mon, 30 Oct 2006 22:25:00 -0000 [thread overview]
Message-ID: <200610302225.k9UMPLZ9001050@mailhub.lss.emc.com> (raw)
In-Reply-To: Your message of "Wed, 25 Oct 2006 22:35:29 +0200." <ud58guoa6.fsf@gnu.org>
Patch to add information about recording macro define and undefine
information in stabs.
Index: stabs.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/stabs.texinfo,v
retrieving revision 1.18
diff -u -r1.18 stabs.texinfo
--- stabs.texinfo 2 Aug 2006 03:31:21 -0000 1.18
+++ stabs.texinfo 30 Oct 2006 22:19:10 -0000
@@ -67,6 +67,7 @@
* Constants:: Constants
* Variables::
* Types:: Type definitions
+* Macro define and undefine:: Representation of #define and #undef
* Symbol Tables:: Symbol information in symbol tables
* Cplusplus:: Stabs specific to C++
* Stab Types:: Symbol types in a.out files
@@ -2220,6 +2221,69 @@
The variable defines a new type, 24, which is a pointer to another new
type, 25, which is a function returning @code{int}.
+@node Macro define and undefine
+@chapter Representation of #define and #undef
+
+Macro define and undefine.
+
+This section describes the stabs support for macro define and undefine
+information, supported on some systems. (e.g., with -g3 -gstabs when
+using gcc).
+
+A @code{#define @var{macro-name} @var{macro-body}} is represented with
+an @code{N_MAC_DEFINE} stab with a string field of
+@code{@var{macro-name} @var{macro-body}}.
+@findex N_MAC_DEFINE
+
+An @code{#undef @var{macro-name}} is represented with an
+@code{N_MAC_UNDEF} stabs with a string field of simply
+@code{@var{macro-name}}.
+@findex N_MAC_UNDEF
+
+For both @code{N_MAC_DEFINE} and @code{N_MAC_UNDEF}, the desc field is
+the line number within the file where the corresponding @code{#define}
+or @code{#undef} occurred.
+@findex N_MAC_DEFINE
+@findex N_MAC_UNDEF
+
+For example, the following C code:
+
+@example
+ #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;
+ @}
+@end example
+
+produces the following stabs (as well as many others):
+
+@example
+ .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
+@end example
+
@node Symbol Tables
@chapter Symbol Information in Symbol Tables
@@ -3276,11 +3340,17 @@
@item 0x34 N_NOMAP
No DST map; see @ref{N_NOMAP}.
+@item 0x36 N_MAC_DEFINE
+Name and body of a @code{#define}d macro; see @ref{Macro define and undefine}.
+
@c FIXME: describe this solaris feature in the body of the text (see
@c comments in include/aout/stab.def).
@item 0x38 N_OBJ
Object file (Solaris2).
+@item 0x3a N_MAC_UNDEF
+Name of an @code{#undef}ed macro; see @ref{Macro define and undefine}.
+
@c See include/aout/stab.def for (a little) more info.
@item 0x3c N_OPT
Debugger options (Solaris2).
next parent reply other threads:[~2006-10-30 22:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200610251931.k9PJVRDO011265@mailhub.lss.emc.com>
[not found] ` <ud58guoa6.fsf@gnu.org>
2006-10-30 22:25 ` David Taylor [this message]
2006-10-31 4:19 ` Eli Zaretskii
2006-10-31 14:18 ` David Taylor
2006-10-31 22:39 ` Eli Zaretskii
2006-10-31 23:23 ` Jim Blandy
2006-11-01 3:21 ` David Taylor
2006-11-01 19:32 ` Jim Blandy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200610302225.k9UMPLZ9001050@mailhub.lss.emc.com \
--to=dtaylor@emc.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox