diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-01-07 03:25:07 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-01-07 03:25:07 +0000 |
commit | 65289a3a42e60ebfe23f858ccfa0e66b13e844ed (patch) | |
tree | 2c0fbef84f707d26233ad70de66c06425970b8f8 /gcc/c-lex.c | |
parent | f759eb8bf0d98603f2e6930126e517ed995a64a8 (diff) | |
download | gcc-65289a3a42e60ebfe23f858ccfa0e66b13e844ed.zip gcc-65289a3a42e60ebfe23f858ccfa0e66b13e844ed.tar.gz gcc-65289a3a42e60ebfe23f858ccfa0e66b13e844ed.tar.bz2 |
c-lex.c (init_c_lex): Request #define / #undef callbacks for verbose DWARF[2] debugging.
* c-lex.c (init_c_lex): Request #define / #undef callbacks
for verbose DWARF[2] debugging.
(cb_define, cb_undef): The new callbacks.
* toplev.h (debug_define, debug_undef): Make const correct.
* toplev.c (debug_define, debug_undef): Similarly. Do not
perform the verbosity tests here anymore.
From-SVN: r38756
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 4dee1ef..0cddf7e 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -92,6 +92,8 @@ static int dump_one_header PARAMS ((splay_tree_node, void *)); static void cb_ident PARAMS ((cpp_reader *, const cpp_string *)); static void cb_file_change PARAMS ((cpp_reader *, const cpp_file_change *)); static void cb_def_pragma PARAMS ((cpp_reader *)); +static void cb_define PARAMS ((cpp_reader *, cpp_hashnode *)); +static void cb_undef PARAMS ((cpp_reader *, cpp_hashnode *)); const char * init_c_lex (filename) @@ -123,6 +125,14 @@ init_c_lex (filename) parse_in->cb.file_change = cb_file_change; parse_in->cb.def_pragma = cb_def_pragma; + /* Set the debug callbacks if we can use them. */ + if (debug_info_level == DINFO_LEVEL_VERBOSE + && (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)) + { + parse_in->cb.define = cb_define; + parse_in->cb.undef = cb_undef; + } + if (filename == 0 || !strcmp (filename, "-")) filename = "stdin"; @@ -317,6 +327,24 @@ cb_def_pragma (pfile) } } +/* #define callback for DWARF and DWARF2 debug info. */ +static void +cb_define (pfile, node) + cpp_reader *pfile; + cpp_hashnode *node; +{ + debug_define (lineno, (const char *) cpp_macro_definition (pfile, node)); +} + +/* #undef callback for DWARF and DWARF2 debug info. */ +static void +cb_undef (pfile, node) + cpp_reader *pfile ATTRIBUTE_UNUSED; + cpp_hashnode *node; +{ + debug_undef (lineno, (const char *) node->name); +} + /* Parse a '\uNNNN' or '\UNNNNNNNN' sequence. [lex.charset]: The character designated by the universal-character-name |