Commit 65289a3a by Neil Booth Committed by Neil Booth

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
parent f759eb8b
2001-01-07 Neil Booth <neil@daikokuya.demon.co.uk>
* 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.
2001-01-07 Alexandre Oliva <aoliva@redhat.com> 2001-01-07 Alexandre Oliva <aoliva@redhat.com>
* reload.c (subst_reloads): Take INSN argument. When * reload.c (subst_reloads): Take INSN argument. When
......
...@@ -92,6 +92,8 @@ static int dump_one_header PARAMS ((splay_tree_node, void *)); ...@@ -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_ident PARAMS ((cpp_reader *, const cpp_string *));
static void cb_file_change PARAMS ((cpp_reader *, const cpp_file_change *)); static void cb_file_change PARAMS ((cpp_reader *, const cpp_file_change *));
static void cb_def_pragma PARAMS ((cpp_reader *)); 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 * const char *
init_c_lex (filename) init_c_lex (filename)
...@@ -123,6 +125,14 @@ init_c_lex (filename) ...@@ -123,6 +125,14 @@ init_c_lex (filename)
parse_in->cb.file_change = cb_file_change; parse_in->cb.file_change = cb_file_change;
parse_in->cb.def_pragma = cb_def_pragma; 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, "-")) if (filename == 0 || !strcmp (filename, "-"))
filename = "stdin"; filename = "stdin";
...@@ -317,6 +327,24 @@ cb_def_pragma (pfile) ...@@ -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. /* Parse a '\uNNNN' or '\UNNNNNNNN' sequence.
[lex.charset]: The character designated by the universal-character-name [lex.charset]: The character designated by the universal-character-name
......
...@@ -5109,44 +5109,40 @@ debug_end_source_file (lineno) ...@@ -5109,44 +5109,40 @@ debug_end_source_file (lineno)
#endif #endif
} }
/* Called from check_newline in c-parse.y. The `buffer' parameter contains /* Called from cb_define in c-lex.c. The `buffer' parameter contains
the tail part of the directive line, i.e. the part which is past the the tail part of the directive line, i.e. the part which is past the
initial whitespace, #, whitespace, directive-name, whitespace part. */ initial whitespace, #, whitespace, directive-name, whitespace part. */
void void
debug_define (lineno, buffer) debug_define (lineno, buffer)
register unsigned lineno ATTRIBUTE_UNUSED; register unsigned lineno ATTRIBUTE_UNUSED;
register char *buffer ATTRIBUTE_UNUSED; register const char *buffer ATTRIBUTE_UNUSED;
{ {
#ifdef DWARF_DEBUGGING_INFO #ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE if (write_symbols == DWARF_DEBUG)
&& write_symbols == DWARF_DEBUG)
dwarfout_define (lineno, buffer); dwarfout_define (lineno, buffer);
#endif /* DWARF_DEBUGGING_INFO */ #endif /* DWARF_DEBUGGING_INFO */
#ifdef DWARF2_DEBUGGING_INFO #ifdef DWARF2_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE if (write_symbols == DWARF2_DEBUG)
&& write_symbols == DWARF2_DEBUG)
dwarf2out_define (lineno, buffer); dwarf2out_define (lineno, buffer);
#endif /* DWARF2_DEBUGGING_INFO */ #endif /* DWARF2_DEBUGGING_INFO */
} }
/* Called from check_newline in c-parse.y. The `buffer' parameter contains /* Called from cb_undef in c-lex.c. The `buffer' parameter contains
the tail part of the directive line, i.e. the part which is past the the tail part of the directive line, i.e. the part which is past the
initial whitespace, #, whitespace, directive-name, whitespace part. */ initial whitespace, #, whitespace, directive-name, whitespace part. */
void void
debug_undef (lineno, buffer) debug_undef (lineno, buffer)
register unsigned lineno ATTRIBUTE_UNUSED; register unsigned lineno ATTRIBUTE_UNUSED;
register char *buffer ATTRIBUTE_UNUSED; register const char *buffer ATTRIBUTE_UNUSED;
{ {
#ifdef DWARF_DEBUGGING_INFO #ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE if (write_symbols == DWARF_DEBUG)
&& write_symbols == DWARF_DEBUG)
dwarfout_undef (lineno, buffer); dwarfout_undef (lineno, buffer);
#endif /* DWARF_DEBUGGING_INFO */ #endif /* DWARF_DEBUGGING_INFO */
#ifdef DWARF2_DEBUGGING_INFO #ifdef DWARF2_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE if (write_symbols == DWARF2_DEBUG)
&& write_symbols == DWARF2_DEBUG)
dwarf2out_undef (lineno, buffer); dwarf2out_undef (lineno, buffer);
#endif /* DWARF2_DEBUGGING_INFO */ #endif /* DWARF2_DEBUGGING_INFO */
} }
......
...@@ -39,8 +39,8 @@ extern char *file_name_nondirectory PARAMS ((const char *)); ...@@ -39,8 +39,8 @@ extern char *file_name_nondirectory PARAMS ((const char *));
extern void print_time PARAMS ((const char *, long)); extern void print_time PARAMS ((const char *, long));
extern void debug_start_source_file PARAMS ((const char *)); extern void debug_start_source_file PARAMS ((const char *));
extern void debug_end_source_file PARAMS ((unsigned)); extern void debug_end_source_file PARAMS ((unsigned));
extern void debug_define PARAMS ((unsigned, char *)); extern void debug_define PARAMS ((unsigned, const char *));
extern void debug_undef PARAMS ((unsigned, char *)); extern void debug_undef PARAMS ((unsigned, const char *));
extern int debug_ignore_block PARAMS ((union tree_node *)); extern int debug_ignore_block PARAMS ((union tree_node *));
extern void fatal PARAMS ((const char *, ...)) extern void fatal PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment