This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFC] "maint print symbols" uses current language to print all symbols?
- From: Joel Brobecker <brobecker at gnat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 3 Jan 2003 17:47:21 +0400
- Subject: [RFC] "maint print symbols" uses current language to print all symbols?
I was reading some code, and saw the following inside "print_symbol"
(symmisc.c):
/* Print details of types, except for enums where it's clutter. */
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), SYMBOL_SOURCE_NAME (symbol),
outfile,
TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM,
depth);
print_symbol() can be called from dump_symtab() inside an ALL_BLOCK_SYMBOLS
loop:
ALL_BLOCK_SYMBOLS (b, j, sym)
{
struct print_symbol_args s;
s.symbol = sym;
s.depth = depth + 1;
s.outfile = outfile;
catch_errors (print_symbol, &s, "Error printing symbol:\n",
RETURN_MASK_ALL);
}
I can't find anywhere inside print_symbol some code that sets the
current_language, so concluded that the "maint print symbols" command
uses for _all_ the symbols the print_type function of the language
that was in effect when the user entered the command.
It would seem to me a bit more logical to define a function called
language_print_type along these lines:
void
language_print_type (struct type *type, enum language lang,
const char *name, [...])
{
const struct language_defn *lang_defn = language_def (lang);
if (lang_defn == NULL)
error (...); /* FIXME: Is this check really necessary? */
lang_defn->la_print_type (type, name, outfile, [...]);
}
And then replace the LA_PRINT_TYPEs by calls to la_print_type().
Comments?
--
Joel