gdb/ChangeLog:
2003-04-10 Jim Blandy <jimb@redhat.com> * symmisc.c: #include "gdb_regex.h". (maintenance_list_symtabs, maintenance_list_psymtabs): New functions. * maint.c (maintenance_list_command): New function. (_initialize_maint_cmds): Register the above as commands. * symtab.h (maintenance_list_symtabs, maintenance_list_psymtabs): New declarations. * cli/cli-cmds.c (maintenancelistlist): New variable. (init_cmd_lists): Initialize it. * cli/cli-cmds.h (maintenancelistlist): New declaration. * gdbcmd.h (maintenancelistlist): New declaration. * Makefile.in (symmisc.o): Update dependencies. gdb/doc/ChangeLog: 2003-04-09 Jim Blandy <jimb@redhat.com> * gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint list psymtabs'.
This commit is contained in:
parent
daf7c4ad3a
commit
44ea7b70f9
10 changed files with 266 additions and 1 deletions
|
@ -1,3 +1,18 @@
|
|||
2003-04-14 Jim Blandy <jimb@redhat.com>
|
||||
|
||||
* symmisc.c: #include "gdb_regex.h".
|
||||
(maintenance_list_symtabs, maintenance_list_psymtabs): New
|
||||
functions.
|
||||
* maint.c (maintenance_list_command): New function.
|
||||
(_initialize_maint_cmds): Register the above as commands.
|
||||
* symtab.h (maintenance_list_symtabs,
|
||||
maintenance_list_psymtabs): New declarations.
|
||||
* cli/cli-cmds.c (maintenancelistlist): New variable.
|
||||
(init_cmd_lists): Initialize it.
|
||||
* cli/cli-cmds.h (maintenancelistlist): New declaration.
|
||||
* gdbcmd.h (maintenancelistlist): New declaration.
|
||||
* Makefile.in (symmisc.o): Update dependencies.
|
||||
|
||||
2003-04-14 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* s390-nat.c: Include asm/types.h for addr_t.
|
||||
|
|
|
@ -2255,7 +2255,7 @@ symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
|
|||
symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \
|
||||
$(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \
|
||||
$(gdb_obstack_h) $(language_h) $(bcache_h) $(gdb_string_h) \
|
||||
$(readline_h) $(block_h)
|
||||
$(readline_h) $(block_h) $(gdb_regex_h)
|
||||
symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
|
||||
$(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \
|
||||
$(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
|
||||
|
|
|
@ -171,6 +171,10 @@ struct cmd_list_element *maintenanceinfolist;
|
|||
|
||||
struct cmd_list_element *maintenanceprintlist;
|
||||
|
||||
/* Chain containing all defined "maintenance list" subcommands. */
|
||||
|
||||
struct cmd_list_element *maintenancelistlist;
|
||||
|
||||
struct cmd_list_element *setprintlist;
|
||||
|
||||
struct cmd_list_element *showprintlist;
|
||||
|
@ -1032,6 +1036,7 @@ init_cmd_lists (void)
|
|||
maintenancelist = NULL;
|
||||
maintenanceinfolist = NULL;
|
||||
maintenanceprintlist = NULL;
|
||||
maintenancelistlist = NULL;
|
||||
setprintlist = NULL;
|
||||
showprintlist = NULL;
|
||||
setchecklist = NULL;
|
||||
|
|
|
@ -87,6 +87,10 @@ extern struct cmd_list_element *maintenanceinfolist;
|
|||
|
||||
extern struct cmd_list_element *maintenanceprintlist;
|
||||
|
||||
/* Chain containing all defined "maintenance list" subcommands. */
|
||||
|
||||
extern struct cmd_list_element *maintenancelistlist;
|
||||
|
||||
extern struct cmd_list_element *setprintlist;
|
||||
|
||||
extern struct cmd_list_element *showprintlist;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-04-09 Jim Blandy <jimb@redhat.com>
|
||||
|
||||
* gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint
|
||||
list psymtabs'.
|
||||
|
||||
2003-04-08 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* gdbint.texinfo (Target Architecture Definition): Delete
|
||||
|
|
|
@ -9033,8 +9033,66 @@ files that @value{GDBN} has skimmed, but not yet read completely. Finally,
|
|||
required for each object file from which @value{GDBN} has read some symbols.
|
||||
@xref{Files, ,Commands to specify files}, for a discussion of how
|
||||
@value{GDBN} reads symbols (in the description of @code{symbol-file}).
|
||||
|
||||
@kindex maint list symtabs
|
||||
@kindex maint list psymtabs
|
||||
@cindex listing @value{GDBN}'s internal symbol tables
|
||||
@cindex symbol tables, listing @value{GDBN}'s internal
|
||||
@cindex full symbol tables, listing @value{GDBN}'s internal
|
||||
@cindex partial symbol tables, listing @value{GDBN}'s internal
|
||||
@item maint list symtabs @r{[} @var{regexp} @r{]}
|
||||
@itemx maint list psymtabs @r{[} @var{regexp} @r{]}
|
||||
|
||||
List the @code{struct symtab} or @code{struct partial_symtab}
|
||||
structures whose names match @var{regexp}. If @var{regexp} is not
|
||||
given, list them all. The output includes expressions which you can
|
||||
copy into a @value{GDBN} debugging this one to examine a particular
|
||||
structure in more detail. For example:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) maint list psymtabs dwarf2read
|
||||
@{ objfile /home/gnu/build/gdb/gdb
|
||||
((struct objfile *) 0x82e69d0)
|
||||
@{ psymtab /home/gnu/src/gdb/dwarf2read.c
|
||||
((struct partial_symtab *) 0x8474b10)
|
||||
readin no
|
||||
fullname (null)
|
||||
text addresses 0x814d3c8 -- 0x8158074
|
||||
globals (* (struct partial_symbol **) 0x8507a08 @@ 9)
|
||||
statics (* (struct partial_symbol **) 0x40e95b78 @@ 2882)
|
||||
dependencies (none)
|
||||
@}
|
||||
@}
|
||||
(@value{GDBP}) maint list symtabs
|
||||
(@value{GDBP})
|
||||
@end smallexample
|
||||
@noindent
|
||||
We see that there is one partial symbol table whose filename contains
|
||||
the string @samp{dwarf2read}, belonging to the @samp{gdb} executable;
|
||||
and we see that @value{GDBN} has not read in any symtabs yet at all.
|
||||
If we set a breakpoint on a function, that will cause @value{GDBN} to
|
||||
read the symtab for the compilation unit containing that function:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) break dwarf2_psymtab_to_symtab
|
||||
Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
|
||||
line 1574.
|
||||
(@value{GDBP}) maint list symtabs
|
||||
@{ objfile /home/gnu/build/gdb/gdb
|
||||
((struct objfile *) 0x82e69d0)
|
||||
@{ symtab /home/gnu/src/gdb/dwarf2read.c
|
||||
((struct symtab *) 0x86c1f38)
|
||||
dirname (null)
|
||||
fullname (null)
|
||||
blockvector ((struct blockvector *) 0x86c1bd0) (primary)
|
||||
debugformat DWARF 2
|
||||
@}
|
||||
@}
|
||||
(@value{GDBP})
|
||||
@end smallexample
|
||||
@end table
|
||||
|
||||
|
||||
@node Altering
|
||||
@chapter Altering Execution
|
||||
|
||||
|
|
|
@ -98,6 +98,10 @@ extern struct cmd_list_element *maintenanceinfolist;
|
|||
|
||||
extern struct cmd_list_element *maintenanceprintlist;
|
||||
|
||||
/* Chain containing all defined "maintenance list" subcommands. */
|
||||
|
||||
extern struct cmd_list_element *maintenancelistlist;
|
||||
|
||||
extern struct cmd_list_element *setprintlist;
|
||||
|
||||
extern struct cmd_list_element *showprintlist;
|
||||
|
|
30
gdb/maint.c
30
gdb/maint.c
|
@ -434,6 +434,18 @@ maintenance_print_command (char *arg, int from_tty)
|
|||
help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout);
|
||||
}
|
||||
|
||||
/* The "maintenance list" command is defined as a prefix, with
|
||||
allow_unknown 0. Therefore, its own definition is called only for
|
||||
"maintenance list" with no args. */
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
maintenance_list_command (char *arg, int from_tty)
|
||||
{
|
||||
printf_unfiltered ("\"maintenance list\" must be followed by the name of a list command.\n");
|
||||
help_list (maintenancelistlist, "maintenance list ", -1, gdb_stdout);
|
||||
}
|
||||
|
||||
/* The "maintenance translate-address" command converts a section and address
|
||||
to a symbol. This can be called in two ways:
|
||||
maintenance translate-address <secname> <addr>
|
||||
|
@ -732,6 +744,11 @@ lists all sections from all object files, including shared libraries.",
|
|||
&maintenanceprintlist, "maintenance print ", 0,
|
||||
&maintenancelist);
|
||||
|
||||
add_prefix_cmd ("list", class_maintenance, maintenance_list_command,
|
||||
"Maintenance command for listing GDB internal state.",
|
||||
&maintenancelistlist, "maintenance list ", 0,
|
||||
&maintenancelist);
|
||||
|
||||
add_prefix_cmd ("set", class_maintenance, maintenance_set_cmd, "\
|
||||
Set GDB internal variables used by the GDB maintainer.\n\
|
||||
Configure variables internal to GDB that aid in GDB's maintenance",
|
||||
|
@ -810,6 +827,19 @@ If a SOURCE file is specified, dump only that file's partial symbols.",
|
|||
"Print dump of current object file definitions.",
|
||||
&maintenanceprintlist);
|
||||
|
||||
add_cmd ("symtabs", class_maintenance, maintenance_list_symtabs,
|
||||
"List the full symbol tables for all object files.\n\
|
||||
This does not include information about individual symbols, blocks, or\n\
|
||||
linetables --- just the symbol table structures themselves.\n\
|
||||
With an argument REGEXP, list the symbol tables whose names that match that.",
|
||||
&maintenancelistlist);
|
||||
|
||||
add_cmd ("psymtabs", class_maintenance, maintenance_list_psymtabs,
|
||||
"List the partial symbol tables for all object files.\n\
|
||||
This does not include information about individual partial symbols,\n\
|
||||
just the symbol table structures themselves.",
|
||||
&maintenancelistlist);
|
||||
|
||||
add_cmd ("statistics", class_maintenance, maintenance_print_statistics,
|
||||
"Print statistics about internal gdb state.",
|
||||
&maintenanceprintlist);
|
||||
|
|
140
gdb/symmisc.c
140
gdb/symmisc.c
|
@ -33,6 +33,7 @@
|
|||
#include "language.h"
|
||||
#include "bcache.h"
|
||||
#include "block.h"
|
||||
#include "gdb_regex.h"
|
||||
|
||||
#include "gdb_string.h"
|
||||
#include <readline/readline.h>
|
||||
|
@ -985,6 +986,145 @@ maintenance_print_objfiles (char *ignore, int from_tty)
|
|||
immediate_quit--;
|
||||
}
|
||||
|
||||
|
||||
/* List all the symbol tables. */
|
||||
void
|
||||
maintenance_list_symtabs (char *regexp, int from_tty)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
if (regexp)
|
||||
re_comp (regexp);
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
struct symtab *symtab;
|
||||
|
||||
/* We don't want to print anything for this objfile until we
|
||||
actually find a symtab whose name matches. */
|
||||
int printed_objfile_start = 0;
|
||||
|
||||
ALL_OBJFILE_SYMTABS (objfile, symtab)
|
||||
if (! regexp
|
||||
|| re_exec (symtab->filename))
|
||||
{
|
||||
if (! printed_objfile_start)
|
||||
{
|
||||
printf_filtered ("{ objfile %s ", objfile->name);
|
||||
wrap_here (" ");
|
||||
printf_filtered ("((struct objfile *) %p)\n", objfile);
|
||||
printed_objfile_start = 1;
|
||||
}
|
||||
|
||||
printf_filtered (" { symtab %s ", symtab->filename);
|
||||
wrap_here (" ");
|
||||
printf_filtered ("((struct symtab *) %p)\n", symtab);
|
||||
printf_filtered (" dirname %s\n",
|
||||
symtab->dirname ? symtab->dirname : "(null)");
|
||||
printf_filtered (" fullname %s\n",
|
||||
symtab->fullname ? symtab->fullname : "(null)");
|
||||
printf_filtered (" blockvector ((struct blockvector *) %p)%s\n",
|
||||
symtab->blockvector,
|
||||
symtab->primary ? " (primary)" : "");
|
||||
printf_filtered (" debugformat %s\n", symtab->debugformat);
|
||||
printf_filtered (" }\n");
|
||||
}
|
||||
|
||||
if (printed_objfile_start)
|
||||
printf_filtered ("}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* List all the partial symbol tables. */
|
||||
void
|
||||
maintenance_list_psymtabs (char *regexp, int from_tty)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
if (regexp)
|
||||
re_comp (regexp);
|
||||
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
struct partial_symtab *psymtab;
|
||||
|
||||
/* We don't want to print anything for this objfile until we
|
||||
actually find a symtab whose name matches. */
|
||||
int printed_objfile_start = 0;
|
||||
|
||||
ALL_OBJFILE_PSYMTABS (objfile, psymtab)
|
||||
if (! regexp
|
||||
|| re_exec (psymtab->filename))
|
||||
{
|
||||
if (! printed_objfile_start)
|
||||
{
|
||||
printf_filtered ("{ objfile %s ", objfile->name);
|
||||
wrap_here (" ");
|
||||
printf_filtered ("((struct objfile *) %p)\n", objfile);
|
||||
printed_objfile_start = 1;
|
||||
}
|
||||
|
||||
printf_filtered (" { psymtab %s ", psymtab->filename);
|
||||
wrap_here (" ");
|
||||
printf_filtered ("((struct partial_symtab *) %p)\n", psymtab);
|
||||
printf_filtered (" readin %s\n",
|
||||
psymtab->readin ? "yes" : "no");
|
||||
printf_filtered (" fullname %s\n",
|
||||
psymtab->fullname ? psymtab->fullname : "(null)");
|
||||
printf_filtered (" text addresses ");
|
||||
print_address_numeric (psymtab->textlow, 1, gdb_stdout);
|
||||
printf_filtered (" -- ");
|
||||
print_address_numeric (psymtab->texthigh, 1, gdb_stdout);
|
||||
printf_filtered ("\n");
|
||||
printf_filtered (" globals ");
|
||||
if (psymtab->n_global_syms)
|
||||
{
|
||||
printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n",
|
||||
(psymtab->objfile->global_psymbols.list
|
||||
+ psymtab->globals_offset),
|
||||
psymtab->n_global_syms);
|
||||
}
|
||||
else
|
||||
printf_filtered ("(none)\n");
|
||||
printf_filtered (" statics ");
|
||||
if (psymtab->n_static_syms)
|
||||
{
|
||||
printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n",
|
||||
(psymtab->objfile->static_psymbols.list
|
||||
+ psymtab->statics_offset),
|
||||
psymtab->n_static_syms);
|
||||
}
|
||||
else
|
||||
printf_filtered ("(none)\n");
|
||||
printf_filtered (" dependencies ");
|
||||
if (psymtab->number_of_dependencies)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf_filtered ("{\n");
|
||||
for (i = 0; i < psymtab->number_of_dependencies; i++)
|
||||
{
|
||||
struct partial_symtab *dep = psymtab->dependencies[i];
|
||||
|
||||
/* Note the string concatenation there --- no comma. */
|
||||
printf_filtered (" psymtab %s "
|
||||
"((struct partial_symtab *) %p)\n",
|
||||
dep->filename, dep);
|
||||
}
|
||||
printf_filtered (" }\n");
|
||||
}
|
||||
else
|
||||
printf_filtered ("(none)\n");
|
||||
printf_filtered (" }\n");
|
||||
}
|
||||
|
||||
if (printed_objfile_start)
|
||||
printf_filtered ("}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check consistency of psymtabs and symtabs. */
|
||||
|
||||
void
|
||||
|
|
|
@ -1233,6 +1233,10 @@ void maintenance_print_msymbols (char *, int);
|
|||
|
||||
void maintenance_print_objfiles (char *, int);
|
||||
|
||||
void maintenance_list_symtabs (char *, int);
|
||||
|
||||
void maintenance_list_psymtabs (char *, int);
|
||||
|
||||
void maintenance_check_symtabs (char *, int);
|
||||
|
||||
/* maint.c */
|
||||
|
|
Loading…
Reference in a new issue