stabs and #define/#undef
David Taylor
dtaylor@emc.com
Fri Nov 3 20:47:00 GMT 2006
Here is an update of the patch for recording #define/#undef in stabs.
I do not have write after approval privileges.
2006-11-03 David Taylor <dtaylor@emc.com>
* c-lex.c (init_c_lex): Set debug callbacks for DBX_DEBUG also,
as it's now implemented.
* dbxout.c (dbxout_define, dbxout_undef): New functions.
(dbx_debug_hooks): Add initializations for dbxout_define and
dbxout_undef.
* stab.def (N_MAC_DEFINE, N_MAC_UNDEF): Define. Update stab
matrix.
Index: gcc/c-lex.c
===================================================================
--- gcc/c-lex.c (revision 117374)
+++ gcc/c-lex.c (working copy)
@@ -102,6 +102,7 @@
/* Set the debug callbacks if we can use them. */
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& (write_symbols == DWARF2_DEBUG
+ || write_symbols == DBX_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG))
{
cb->define = cb_define;
Index: gcc/dbxout.c
===================================================================
--- gcc/dbxout.c (revision 117374)
+++ gcc/dbxout.c (working copy)
@@ -312,6 +312,8 @@
static void dbxout_init (const char *);
static void dbxout_finish (const char *);
+static void dbxout_define (unsigned, const char *);
+static void dbxout_undef (unsigned, const char *);
static void dbxout_start_source_file (unsigned, const char *);
static void dbxout_end_source_file (unsigned);
static void dbxout_typedefs (tree);
@@ -348,8 +350,8 @@
{
dbxout_init,
dbxout_finish,
- debug_nothing_int_charstar,
- debug_nothing_int_charstar,
+ dbxout_define,
+ dbxout_undef,
dbxout_start_source_file,
dbxout_end_source_file,
dbxout_begin_block,
@@ -1147,6 +1149,34 @@
emit_pending_bincls_if_required (void) {}
#endif
+/* The `buffer' parameter contains the tail part of the directive
+ line, i.e. the part which is past the initial whitespace, #,
+ whitespace, directive-name, whitespace part. */
+
+static void
+dbxout_define (unsigned lineno, const char *buffer)
+{
+ if (debug_info_level >= DINFO_LEVEL_VERBOSE)
+ {
+ dbxout_begin_simple_stabs_desc (buffer, N_MAC_DEFINE, lineno);
+ dbxout_stab_value_zero ();
+ }
+}
+
+/* The `buffer' parameter contains the tail part of the directive
+ line, i.e. the part which is past the initial whitespace, #,
+ whitespace, directive-name, whitespace part. */
+
+static void
+dbxout_undef (unsigned lineno, const char *buffer)
+{
+ if (debug_info_level >= DINFO_LEVEL_VERBOSE)
+ {
+ dbxout_begin_simple_stabs_desc (buffer, N_MAC_UNDEF, lineno);
+ dbxout_stab_value_zero ();
+ }
+}
+
/* Change to reading from a new source file. Generate a N_BINCL stab. */
static void
Index: gcc/stab.def
===================================================================
--- gcc/stab.def (revision 117374)
+++ gcc/stab.def (working copy)
@@ -59,10 +59,16 @@
/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */
__define_stab (N_NOMAP, 0x34, "NOMAP")
+/* GNU extension. Macro define. */
+__define_stab(N_MAC_DEFINE, 0x36, "MAC_DEFINE")
+
/* New stab from Solaris. I don't know what it means, but it
don't seem to contain useful information. */
__define_stab (N_OBJ, 0x38, "OBJ")
+/* GNU extension. Macro undefine. */
+__define_stab(N_MAC_UNDEF, 0x3a, "MAC_UNDEF")
+
/* New stab from Solaris. I don't know what it means, but it
don't seem to contain useful information. Possibly related to the
optimization flags used in this module. */
@@ -188,53 +194,53 @@
/* The above information, in matrix format.
STAB MATRIX
- _________________________________________________
- | 00 - 1F are not dbx stab symbols |
- | In most cases, the low bit is the EXTernal bit|
+ _________________________________________________________________
+ | 00 - 1F are not dbx stab symbols |
+ | In most cases, the low bit is the EXTernal bit |
- | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
- | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
+ | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
+ | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
- | 08 BSS | 0A INDR | 0C FN_SEQ | 0E |
- | 09 |EXT | 0B | 0D | 0F |
+ | 08 BSS | 0A INDR | 0C FN_SEQ | 0E |
+ | 09 |EXT | 0B | 0D | 0F |
- | 10 | 12 COMM | 14 SETA | 16 SETT |
- | 11 | 13 | 15 | 17 |
+ | 10 | 12 COMM | 14 SETA | 16 SETT |
+ | 11 | 13 | 15 | 17 |
- | 18 SETD | 1A SETB | 1C SETV | 1E WARNING|
- | 19 | 1B | 1D | 1F FN |
+ | 18 SETD | 1A SETB | 1C SETV | 1E WARNING |
+ | 19 | 1B | 1D | 1F FN |
- |_______________________________________________|
- | Debug entries with bit 01 set are unused. |
- | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
- | 28 LCSYM | 2A MAIN | 2C | 2E BNSYM |
- | 30 PC | 32 NSYMS | 34 NOMAP | 36 |
- | 38 OBJ | 3A | 3C OPT | 3E |
- | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
- | 48 BSLINE*| 4A DEFD | 4C | 4E ENSYM |
- | 50 EHDECL*| 52 | 54 CATCH | 56 |
- | 58 | 5A | 5C | 5E |
- | 60 SSYM | 62 | 64 SO | 66 |
- | 68 | 6A | 6C | 6E |
- | 70 | 72 | 74 | 76 |
- | 78 | 7A | 7C | 7E |
- | 80 LSYM | 82 BINCL | 84 SOL | 86 |
- | 88 | 8A | 8C | 8E |
- | 90 | 92 | 94 | 96 |
- | 98 | 9A | 9C | 9E |
- | A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
- | A8 | AA | AC | AE |
- | B0 | B2 | B4 | B6 |
- | B8 | BA | BC | BE |
- | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
- | C8 | CA | CC | CE |
- | D0 | D2 | D4 | D6 |
- | D8 | DA | DC | DE |
- | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
- | E8 ECOML | EA | EC | EE |
- | F0 | F2 | F4 | F6 |
- | F8 | FA | FC | FE LENG |
- +-----------------------------------------------+
+ |_______________________________________________ |
+ | Debug entries with bit 01 set are unused. |
+ | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
+ | 28 LCSYM | 2A MAIN | 2C | 2E BNSYM |
+ | 30 PC | 32 NSYMS | 34 NOMAP | 36 MAC_DEFINE |
+ | 38 OBJ | 3A MAC_UNDEF | 3C OPT | 3E |
+ | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
+ | 48 BSLINE* | 4A DEFD | 4C | 4E ENSYM |
+ | 50 EHDECL* | 52 | 54 CATCH | 56 |
+ | 58 | 5A | 5C | 5E |
+ | 60 SSYM | 62 | 64 SO | 66 |
+ | 68 | 6A | 6C | 6E |
+ | 70 | 72 | 74 | 76 |
+ | 78 | 7A | 7C | 7E |
+ | 80 LSYM | 82 BINCL | 84 SOL | 86 |
+ | 88 | 8A | 8C | 8E |
+ | 90 | 92 | 94 | 96 |
+ | 98 | 9A | 9C | 9E |
+ | A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
+ | A8 | AA | AC | AE |
+ | B0 | B2 | B4 | B6 |
+ | B8 | BA | BC | BE |
+ | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
+ | C8 | CA | CC | CE |
+ | D0 | D2 | D4 | D6 |
+ | D8 | DA | DC | DE |
+ | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
+ | E8 ECOML | EA | EC | EE |
+ | F0 | F2 | F4 | F6 |
+ | F8 | FA | FC | FE LENG |
+ +---------------------------------------------------------------+
* 50 EHDECL is also MOD2.
* 48 BSLINE is also BROWS.
*/
David
--
David Taylor
dtaylor@emc.com
More information about the Gcc-patches
mailing list