Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA/RFC: dump symtab and psymtab lists
@ 2003-04-07 23:41 Jim Blandy
  2003-04-08  7:39 ` Andrew Cagney
  0 siblings, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2003-04-07 23:41 UTC (permalink / raw)
  To: gdb-patches


This patch adds two new commands, 'maint print symtabs' and 'maint
print psymtabs', that print out the full and partial symtab lists.
You can supply a regexp to match against the (p)symtab name to just
list a few.

The existing 'maint print symbols' and 'maint print psymbols' are
exhaustive, which is useful sometimes, but they produce so much output
that they're a pain to use when you just want to see what's up with
the symtab and psymtab lists themselves.

The output includes expressions you can cut-and-paste into GDB to get
a pointer to a specific symtab, psymtab, etc., and it's parenthesized
to make the Emacs balanced motion commands work usefully.  The
documentation includes examples.

(This includes a documentation change, which needs approval.)

gdb/ChangeLog:
2003-04-07  Jim Blandy  <jimb@redhat.com>

	* symmisc.c (maintenance_print_symtabs,
	maintenance_print_psymtabs): New functions.
	* maint.c (_initialize_maint_cmds): Add commands for the above.
	* symtab.h (maintenance_print_symtabs,
	maintenance_print_psymtabs): New declarations.
	* Makefile.in (symmisc.o): Update dependencies.

gdb/doc/ChangeLog:
2003-04-07  Jim Blandy  <jimb@redhat.com>

	* gdb.texinfo (Symbols): Document 'maint print symtabs' and 'maint
	print psymtabs'.

Index: gdb/symmisc.c
===================================================================
RCS file: /cvs/src/src/gdb/symmisc.c,v
retrieving revision 1.19
diff -c -r1.19 symmisc.c
*** gdb/symmisc.c	25 Feb 2003 21:36:20 -0000	1.19
--- gdb/symmisc.c	7 Apr 2003 23:35:27 -0000
***************
*** 33,38 ****
--- 33,39 ----
  #include "language.h"
  #include "bcache.h"
  #include "block.h"
+ #include "gdb_regex.h"
  
  #include "gdb_string.h"
  #include <readline/readline.h>
***************
*** 984,989 ****
--- 985,1129 ----
      dump_objfile (objfile);
    immediate_quit--;
  }
+ 
+ 
+ /* List all the symbol tables.  */
+ void
+ maintenance_print_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_print_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.  */
  
Index: gdb/maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.36
diff -c -r1.36 maint.c
*** gdb/maint.c	2 Apr 2003 03:02:46 -0000	1.36
--- gdb/maint.c	7 Apr 2003 23:35:26 -0000
***************
*** 810,815 ****
--- 810,828 ----
  	   "Print dump of current object file definitions.",
  	   &maintenanceprintlist);
  
+   add_cmd ("symtabs", class_maintenance, maintenance_print_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.",
+ 	   &maintenanceprintlist);
+ 
+   add_cmd ("psymtabs", class_maintenance, maintenance_print_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.",
+ 	   &maintenanceprintlist);
+ 
    add_cmd ("statistics", class_maintenance, maintenance_print_statistics,
  	   "Print statistics about internal gdb state.",
  	   &maintenanceprintlist);
Index: gdb/symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.65
diff -c -r1.65 symtab.h
*** gdb/symtab.h	3 Mar 2003 18:34:12 -0000	1.65
--- gdb/symtab.h	7 Apr 2003 23:35:30 -0000
***************
*** 1231,1236 ****
--- 1231,1240 ----
  
  void maintenance_print_objfiles (char *, int);
  
+ void maintenance_print_symtabs (char *, int);
+ 
+ void maintenance_print_psymtabs (char *, int);
+ 
  void maintenance_check_symtabs (char *, int);
  
  /* maint.c */
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.360
diff -c -r1.360 Makefile.in
*** gdb/Makefile.in	6 Apr 2003 01:13:58 -0000	1.360
--- gdb/Makefile.in	7 Apr 2003 23:35:26 -0000
***************
*** 2254,2260 ****
  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)
  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) \
--- 2254,2260 ----
  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) $(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) \
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.155
diff -c -r1.155 gdb.texinfo
*** gdb/doc/gdb.texinfo	2 Apr 2003 22:10:35 -0000	1.155
--- gdb/doc/gdb.texinfo	7 Apr 2003 23:35:46 -0000
***************
*** 9033,9039 ****
--- 9033,9095 ----
  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 print symtabs
+ @kindex maint print psymtabs
+ @cindex listing GDB's internal symbol tables
+ @cindex symbol tables, listing GDB's internal
+ @item maint print symtabs [@var{regexp}]
+ @itemx maint print psymtabs [@var{regexp}]
+ 
+ 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 print 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 print 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 GDB 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 print 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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-07 23:41 RFA/RFC: dump symtab and psymtab lists Jim Blandy
@ 2003-04-08  7:39 ` Andrew Cagney
  2003-04-08 17:52   ` Jim Blandy
  0 siblings, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2003-04-08  7:39 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> This patch adds two new commands, 'maint print symtabs' and 'maint
> print psymtabs', that print out the full and partial symtab lists.
> You can supply a regexp to match against the (p)symtab name to just
> list a few.
> 
> The existing 'maint print symbols' and 'maint print psymbols' are
> exhaustive, which is useful sometimes, but they produce so much output
> that they're a pain to use when you just want to see what's up with
> the symtab and psymtab lists themselves.
> 
> The output includes expressions you can cut-and-paste into GDB to get
> a pointer to a specific symtab, psymtab, etc., and it's parenthesized
> to make the Emacs balanced motion commands work usefully.  The
> documentation includes examples.

Jim,

The `maint print' series of commands should all use the syntax:

	(gdb) maint print <component> [ <output-file> ]

(things todo is check that this is consistent).

Andrew


> gdb/ChangeLog:
> 2003-04-07  Jim Blandy  <jimb@redhat.com>
> 
> 	* symmisc.c (maintenance_print_symtabs,
> 	maintenance_print_psymtabs): New functions.
> 	* maint.c (_initialize_maint_cmds): Add commands for the above.
> 	* symtab.h (maintenance_print_symtabs,
> 	maintenance_print_psymtabs): New declarations.
> 	* Makefile.in (symmisc.o): Update dependencies.
> 
> gdb/doc/ChangeLog:
> 2003-04-07  Jim Blandy  <jimb@redhat.com>
> 
> 	* gdb.texinfo (Symbols): Document 'maint print symtabs' and 'maint
> 	print psymtabs'.
> 



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-08  7:39 ` Andrew Cagney
@ 2003-04-08 17:52   ` Jim Blandy
  2003-04-08 21:13     ` Andrew Cagney
  0 siblings, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2003-04-08 17:52 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney <ac131313@redhat.com> writes:

> > This patch adds two new commands, 'maint print symtabs' and 'maint
> > print psymtabs', that print out the full and partial symtab lists.
> > You can supply a regexp to match against the (p)symtab name to just
> > list a few.
> > The existing 'maint print symbols' and 'maint print psymbols' are
> > exhaustive, which is useful sometimes, but they produce so much output
> > that they're a pain to use when you just want to see what's up with
> > the symtab and psymtab lists themselves.
> > The output includes expressions you can cut-and-paste into GDB to get
> > a pointer to a specific symtab, psymtab, etc., and it's parenthesized
> > to make the Emacs balanced motion commands work usefully.  The
> > documentation includes examples.
> 
> Jim,
> 
> The `maint print' series of commands should all use the syntax:
> 
> 	(gdb) maint print <component> [ <output-file> ]
> 
> (things todo is check that this is consistent).

Right, but that doesn't make sense for this command.  It doesn't
produce so much output that it needs to be directed to a file ---
that's the reason the existing 'maint print' commands didn't suffice,
even though they include all the info the new commands do.  And the
regexp is really helpful.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-08 17:52   ` Jim Blandy
@ 2003-04-08 21:13     ` Andrew Cagney
  2003-04-09  0:09       ` Jim Blandy
  0 siblings, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2003-04-08 21:13 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> 
> Right, but that doesn't make sense for this command.  It doesn't
> produce so much output that it needs to be directed to a file ---
> that's the reason the existing 'maint print' commands didn't suffice,
> even though they include all the info the new commands do.  And the
> regexp is really helpful.

Helpful or not, the proposed syntax intentionally introduces an 
unnecessary inconsistency into the CLI.

Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-08 21:13     ` Andrew Cagney
@ 2003-04-09  0:09       ` Jim Blandy
  2003-04-10  2:10         ` Andrew Cagney
  0 siblings, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2003-04-09  0:09 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney <ac131313@redhat.com> writes:

> >
> > Right, but that doesn't make sense for this command.  It doesn't
> > produce so much output that it needs to be directed to a file ---
> > that's the reason the existing 'maint print' commands didn't suffice,
> > even though they include all the info the new commands do.  And the
> > regexp is really helpful.
> 
> Helpful or not, the proposed syntax intentionally introduces an
> unnecessary inconsistency into the CLI.

Could you suggest a way I can provide the utility I need, without
introducing an unnecessary inconsistency?  I'm not sure what you're
looking for.

How about 'maint print symtabs [-matching REGEXP] [outfile]'?


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-09  0:09       ` Jim Blandy
@ 2003-04-10  2:10         ` Andrew Cagney
  2003-04-10 20:29           ` Jim Blandy
  0 siblings, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2003-04-10  2:10 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> Andrew Cagney <ac131313@redhat.com> writes:
> 
> 
>> >
>> > Right, but that doesn't make sense for this command.  It doesn't
>> > produce so much output that it needs to be directed to a file ---
>> > that's the reason the existing 'maint print' commands didn't suffice,
>> > even though they include all the info the new commands do.  And the
>> > regexp is really helpful.
> 
>> 
>> Helpful or not, the proposed syntax intentionally introduces an
>> unnecessary inconsistency into the CLI.
> 
> 
> Could you suggest a way I can provide the utility I need, without
> introducing an unnecessary inconsistency?  I'm not sure what you're
> looking for.

Some level of consistency with the rest of the CLI (which isn't easy).

> How about 'maint print symtabs [-matching REGEXP] [outfile]'?

maint grep <table> <expression>
maint search <table> <expression>

?
Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-10  2:10         ` Andrew Cagney
@ 2003-04-10 20:29           ` Jim Blandy
  2003-04-10 21:49             ` Andrew Cagney
  2003-04-12  9:34             ` Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: Jim Blandy @ 2003-04-10 20:29 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches


Andrew Cagney <ac131313@redhat.com> writes:
> > Could you suggest a way I can provide the utility I need, without
> > introducing an unnecessary inconsistency?  I'm not sure what you're
> > looking for.
> 
> Some level of consistency with the rest of the CLI (which isn't easy).
> 
> > How about 'maint print symtabs [-matching REGEXP] [outfile]'?
> 
> maint grep <table> <expression>
> maint search <table> <expression>

Okay, here's a revised patch that calls them "maint list {,p}symtab".

Perhaps commands that produce so much output that they need to be able
to send it to a file should be renamed to "maint dump"?

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'.

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.360
diff -c -r1.360 Makefile.in
*** gdb/Makefile.in	6 Apr 2003 01:13:58 -0000	1.360
--- gdb/Makefile.in	10 Apr 2003 20:21:00 -0000
***************
*** 2254,2260 ****
  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)
  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) \
--- 2254,2260 ----
  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) $(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) \
Index: gdb/gdbcmd.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbcmd.h,v
retrieving revision 1.8
diff -c -r1.8 gdbcmd.h
*** gdb/gdbcmd.h	17 Jan 2002 22:15:17 -0000	1.8
--- gdb/gdbcmd.h	10 Apr 2003 20:21:00 -0000
***************
*** 98,103 ****
--- 98,107 ----
  
  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;
Index: gdb/maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.36
diff -c -r1.36 maint.c
*** gdb/maint.c	2 Apr 2003 03:02:46 -0000	1.36
--- gdb/maint.c	10 Apr 2003 20:21:01 -0000
***************
*** 434,439 ****
--- 434,451 ----
    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 print" 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,737 ****
--- 744,754 ----
  		  &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",
***************
*** 809,814 ****
--- 826,844 ----
    add_cmd ("objfiles", class_maintenance, maintenance_print_objfiles,
  	   "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.",
Index: gdb/symmisc.c
===================================================================
RCS file: /cvs/src/src/gdb/symmisc.c,v
retrieving revision 1.19
diff -c -r1.19 symmisc.c
*** gdb/symmisc.c	25 Feb 2003 21:36:20 -0000	1.19
--- gdb/symmisc.c	10 Apr 2003 20:21:02 -0000
***************
*** 33,38 ****
--- 33,39 ----
  #include "language.h"
  #include "bcache.h"
  #include "block.h"
+ #include "gdb_regex.h"
  
  #include "gdb_string.h"
  #include <readline/readline.h>
***************
*** 984,989 ****
--- 985,1129 ----
      dump_objfile (objfile);
    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.  */
  
Index: gdb/symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.65
diff -c -r1.65 symtab.h
*** gdb/symtab.h	3 Mar 2003 18:34:12 -0000	1.65
--- gdb/symtab.h	10 Apr 2003 20:21:03 -0000
***************
*** 1231,1236 ****
--- 1231,1240 ----
  
  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 */
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.28
diff -c -r1.28 cli-cmds.c
*** gdb/cli/cli-cmds.c	20 Feb 2003 17:17:25 -0000	1.28
--- gdb/cli/cli-cmds.c	10 Apr 2003 20:21:03 -0000
***************
*** 171,176 ****
--- 171,180 ----
  
  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,1037 ****
--- 1036,1042 ----
    maintenancelist = NULL;
    maintenanceinfolist = NULL;
    maintenanceprintlist = NULL;
+   maintenancelistlist = NULL;
    setprintlist = NULL;
    showprintlist = NULL;
    setchecklist = NULL;
Index: gdb/cli/cli-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.h,v
retrieving revision 1.3
diff -c -r1.3 cli-cmds.h
*** gdb/cli/cli-cmds.h	23 Feb 2002 20:12:13 -0000	1.3
--- gdb/cli/cli-cmds.h	10 Apr 2003 20:21:03 -0000
***************
*** 87,92 ****
--- 87,96 ----
  
  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;
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.155
diff -c -r1.155 gdb.texinfo
*** gdb/doc/gdb.texinfo	2 Apr 2003 22:10:35 -0000	1.155
--- gdb/doc/gdb.texinfo	10 Apr 2003 20:21:21 -0000
***************
*** 9033,9039 ****
--- 9033,9097 ----
  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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-10 20:29           ` Jim Blandy
@ 2003-04-10 21:49             ` Andrew Cagney
  2003-04-10 21:56               ` Daniel Jacobowitz
  2003-04-12  9:34             ` Eli Zaretskii
  1 sibling, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2003-04-10 21:49 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> Andrew Cagney <ac131313@redhat.com> writes:
> 
>> > Could you suggest a way I can provide the utility I need, without
>> > introducing an unnecessary inconsistency?  I'm not sure what you're
>> > looking for.
> 
>> 
>> Some level of consistency with the rest of the CLI (which isn't easy).
>> 
> 
>> > How about 'maint print symtabs [-matching REGEXP] [outfile]'?
> 
>> 
>> maint grep <table> <expression>
>> maint search <table> <expression>
> 
> 
> Okay, here's a revised patch that calls them "maint list {,p}symtab".

Unfortunatly, there is `(gdb) list' command, so one would expect a 
certain level of correspondance between `(gdb) list' and `(gdb maint 
list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info 
breakpoints'.

This also rules out my `maint search' suggestion :-(
`maint query <db> <query>'?

> Perhaps commands that produce so much output that they need to be able
> to send it to a file should be renamed to "maint dump"?

True.

Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-10 21:49             ` Andrew Cagney
@ 2003-04-10 21:56               ` Daniel Jacobowitz
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Jacobowitz @ 2003-04-10 21:56 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Jim Blandy, gdb-patches

On Thu, Apr 10, 2003 at 05:49:11PM -0400, Andrew Cagney wrote:
> >Andrew Cagney <ac131313@redhat.com> writes:
> >
> >>> Could you suggest a way I can provide the utility I need, without
> >>> introducing an unnecessary inconsistency?  I'm not sure what you're
> >>> looking for.
> >
> >>
> >>Some level of consistency with the rest of the CLI (which isn't easy).
> >>
> >
> >>> How about 'maint print symtabs [-matching REGEXP] [outfile]'?
> >
> >>
> >>maint grep <table> <expression>
> >>maint search <table> <expression>
> >
> >
> >Okay, here's a revised patch that calls them "maint list {,p}symtab".
> 
> Unfortunatly, there is `(gdb) list' command, so one would expect a 
> certain level of correspondance between `(gdb) list' and `(gdb maint 
> list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info 
> breakpoints'.
> 
> This also rules out my `maint search' suggestion :-(
> `maint query <db> <query>'?
> 
> >Perhaps commands that produce so much output that they need to be able
> >to send it to a file should be renamed to "maint dump"?
> 
> True.

I think this is an excellent idea.

It does point out that expecting the correspondence may be unwise.  We
already have both print and dump.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-10 20:29           ` Jim Blandy
  2003-04-10 21:49             ` Andrew Cagney
@ 2003-04-12  9:34             ` Eli Zaretskii
  2003-04-14 18:43               ` Jim Blandy
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2003-04-12  9:34 UTC (permalink / raw)
  To: jimb; +Cc: ac131313, gdb-patches

> From: Jim Blandy <jimb@redhat.com>
> Date: 10 Apr 2003 15:30:03 -0500
> 
> Okay, here's a revised patch that calls them "maint list {,p}symtab".

The patch for the manual is okay with me.  Thanks!


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-12  9:34             ` Eli Zaretskii
@ 2003-04-14 18:43               ` Jim Blandy
  2003-04-14 18:52                 ` Andrew Cagney
  0 siblings, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2003-04-14 18:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: ac131313, gdb-patches

"Eli Zaretskii" <eliz@elta.co.il> writes:

> > From: Jim Blandy <jimb@redhat.com>
> > Date: 10 Apr 2003 15:30:03 -0500
> > 
> > Okay, here's a revised patch that calls them "maint list {,p}symtab".
> 
> The patch for the manual is okay with me.  Thanks!

I've committed this patch; thanks.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-14 18:43               ` Jim Blandy
@ 2003-04-14 18:52                 ` Andrew Cagney
  2003-04-14 19:05                   ` David Carlton
  2003-04-14 22:41                   ` Jim Blandy
  0 siblings, 2 replies; 21+ messages in thread
From: Andrew Cagney @ 2003-04-14 18:52 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Eli Zaretskii, gdb-patches

> 
> Okay, here's a revised patch that calls them "maint list {,p}symtab".
> 
> Unfortunatly, there is `(gdb) list' command, so one would expect a certain level of correspondance between `(gdb) list' and `(gdb maint list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info breakpoints'.
> 
> This also rules out my `maint search' suggestion :-(
> `maint query <db> <query>'? 

Jim, did you see this point?

Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-14 18:52                 ` Andrew Cagney
@ 2003-04-14 19:05                   ` David Carlton
  2003-04-14 19:27                     ` Andrew Cagney
  2003-04-14 22:41                   ` Jim Blandy
  1 sibling, 1 reply; 21+ messages in thread
From: David Carlton @ 2003-04-14 19:05 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Jim Blandy, gdb-patches

On Mon, 14 Apr 2003 14:52:29 -0400, Andrew Cagney <ac131313@redhat.com> said:

>> Okay, here's a revised patch that calls them "maint list {,p}symtab".
>> Unfortunatly, there is `(gdb) list' command, so one would expect a
>> certain level of correspondance between `(gdb) list' and `(gdb maint
>> list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info
>> breakpoints'.

>> This also rules out my `maint search' suggestion :-(

>> `maint query <db> <query>'?

> Jim, did you see this point?

For what it's worth, the existing 'maint print' commands already break
this correspondence: 'print' doesn't send output to a file, but 'maint
print' does.  There might be some way of naming GDB's commands to
preserve this correspondence, to make the arguments consistent, and to
be easy to remember, but I think it will take a fair amount of
cleaning up.

David Carlton
carlton@math.stanford.edu


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-14 19:05                   ` David Carlton
@ 2003-04-14 19:27                     ` Andrew Cagney
  0 siblings, 0 replies; 21+ messages in thread
From: Andrew Cagney @ 2003-04-14 19:27 UTC (permalink / raw)
  To: David Carlton; +Cc: Jim Blandy, gdb-patches

> On Mon, 14 Apr 2003 14:52:29 -0400, Andrew Cagney <ac131313@redhat.com> said:
> 
> 
>>> Okay, here's a revised patch that calls them "maint list {,p}symtab".
>>> Unfortunatly, there is `(gdb) list' command, so one would expect a
>>> certain level of correspondance between `(gdb) list' and `(gdb maint
>>> list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info
>>> breakpoints'.
> 
> 
>>> This also rules out my `maint search' suggestion :-(
> 
> 
>>> `maint query <db> <query>'?
> 
> 
>> Jim, did you see this point?
> 
> 
> For what it's worth, the existing 'maint print' commands already break
> this correspondence: 'print' doesn't send output to a file, but 'maint
> print' does.  There might be some way of naming GDB's commands to
> preserve this correspondence, to make the arguments consistent, and to
> be easy to remember, but I think it will take a fair amount of
> cleaning up.

I know, that doesn't excuse new commands though.

Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-14 18:52                 ` Andrew Cagney
  2003-04-14 19:05                   ` David Carlton
@ 2003-04-14 22:41                   ` Jim Blandy
  2003-04-14 23:40                     ` Andrew Cagney
  1 sibling, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2003-04-14 22:41 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Eli Zaretskii, gdb-patches

Andrew Cagney <ac131313@redhat.com> writes:

> >
> > Okay, here's a revised patch that calls them "maint list {,p}symtab".
> > Unfortunatly, there is `(gdb) list' command, so one would expect a
> > certain level of correspondance between `(gdb) list' and `(gdb maint
> > list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info
> > breakpoints'.
> > This also rules out my `maint search' suggestion :-(
> > `maint query <db> <query>'?
> 
> Jim, did you see this point?

Err, yes; I just forgot about it.

How about 'maint show {,p}symtab'?  That's consistent with the main
'show' command (which displays information about GDB's state), and has
no conflicting precedent.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-14 22:41                   ` Jim Blandy
@ 2003-04-14 23:40                     ` Andrew Cagney
  2003-04-15  1:45                       ` Jim Blandy
  0 siblings, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2003-04-14 23:40 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Eli Zaretskii, gdb-patches

> Andrew Cagney <ac131313@redhat.com> writes:
> 
> 
>> >
>> > Okay, here's a revised patch that calls them "maint list {,p}symtab".
>> > Unfortunatly, there is `(gdb) list' command, so one would expect a
>> > certain level of correspondance between `(gdb) list' and `(gdb maint
>> > list'.  This is like `(gdb) info breakpoints' vs `(gdb) maint info
>> > breakpoints'.
>> > This also rules out my `maint search' suggestion :-(
>> > `maint query <db> <query>'?
> 
>> 
>> Jim, did you see this point?
> 
> 
> Err, yes; I just forgot about it.
> 
> How about 'maint show {,p}symtab'?  That's consistent with the main
> 'show' command (which displays information about GDB's state), and has
> no conflicting precedent.

No.

`show' is for ``showing [and setting] things about the debugger'' - show 
remote, show debug.  Just ignore `set variable ...'.

info is for ``showing things about the program being debugged]] - info 
frame, info registers, info symbols

There can be overlap between a `set/show' and `info', but I don't think 
that occures here.

Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-14 23:40                     ` Andrew Cagney
@ 2003-04-15  1:45                       ` Jim Blandy
  2003-04-15 15:49                         ` Andrew Cagney
  0 siblings, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2003-04-15  1:45 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches


Andrew Cagney <ac131313@redhat.com> writes:
> > How about 'maint show {,p}symtab'?  That's consistent with the main
> > 'show' command (which displays information about GDB's state), and has
> > no conflicting precedent.
> 
> No.
> 
> `show' is for ``showing [and setting] things about the debugger'' -
> show remote, show debug.  Just ignore `set variable ...'.
> 
> info is for ``showing things about the program being debugged]] - info
> frame, info registers, info symbols
> 
> There can be overlap between a `set/show' and `info', but I don't
> think that occures here.

So, you'd prefer "maint info {,p}symtabs", then?

Existing commands:
- info sources
- info functions


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-15  1:45                       ` Jim Blandy
@ 2003-04-15 15:49                         ` Andrew Cagney
  2003-04-17 22:09                           ` Jim Blandy
  0 siblings, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2003-04-15 15:49 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> Andrew Cagney <ac131313@redhat.com> writes:
> 
>> > How about 'maint show {,p}symtab'?  That's consistent with the main
>> > 'show' command (which displays information about GDB's state), and has
>> > no conflicting precedent.
> 
>> 
>> No.
>> 
>> `show' is for ``showing [and setting] things about the debugger'' -
>> show remote, show debug.  Just ignore `set variable ...'.
>> 
>> info is for ``showing things about the program being debugged]] - info
>> frame, info registers, info symbols
>> 
>> There can be overlap between a `set/show' and `info', but I don't
>> think that occures here.
> 
> 
> So, you'd prefer "maint info {,p}symtabs", then?

It isn't a question of personal preference.  `maint show' would be wrong.

`maint info ....'

appears to be the best fit.

> Existing commands:
> - info sources
> - info functions

Andrew



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-15 15:49                         ` Andrew Cagney
@ 2003-04-17 22:09                           ` Jim Blandy
  2003-04-19  7:40                             ` Eli Zaretskii
  2003-05-07 21:43                             ` Jim Blandy
  0 siblings, 2 replies; 21+ messages in thread
From: Jim Blandy @ 2003-04-17 22:09 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches


gdb/ChangeLog:
2003-04-17  Jim Blandy  <jimb@redhat.com>

	Rename commands 'maint list symtabs' and 'maint list psymtabs' to
	'maint info symtabs' and 'maint info psymtabs'.
	* symmisc.c (maintenance_info_symtabs, maintenance_info_psymtabs):
	Renamed from maintenance_list_symtabs and maintenance_list_psymtabs.
	* symtab.h (maintenance_info_symtabs, maintenance_info_psymtabs):
	Declarations updated.
	* maint.c (maintenance_list_command): Delete.
	(_initialize_maint_cmds): Update calls to add_cmd.
	* gdbcmd.h (maintenancelistlist): Delete declaration.
	* cli/cli-cmds.c (maintenancelistlist): Delete.
	(init_cmd_lists): Don't initialize it.
	* cli/cli-cmds.h (maintenancelistlist): Delete declaration.

gdb/doc/ChangeLog:
2003-04-17  Jim Blandy  <jimb@redhat.com>

	* gdb.texinfo (Symbols): Update documentation: 'maint list
	symtabs' and 'maint list psymtabs' have been renamed 'maint info
	symtabs' and 'maint info psymtabs'.

Index: gdb/gdbcmd.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbcmd.h,v
retrieving revision 1.9
diff -c -r1.9 gdbcmd.h
*** gdb/gdbcmd.h	14 Apr 2003 18:42:27 -0000	1.9
--- gdb/gdbcmd.h	17 Apr 2003 22:02:03 -0000
***************
*** 98,107 ****
  
  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;
--- 98,103 ----
Index: gdb/maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.37
diff -c -r1.37 maint.c
*** gdb/maint.c	14 Apr 2003 18:42:27 -0000	1.37
--- gdb/maint.c	17 Apr 2003 22:02:04 -0000
***************
*** 434,451 ****
    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>
--- 434,439 ----
***************
*** 744,754 ****
  		  &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",
--- 732,737 ----
***************
*** 827,844 ****
  	   "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.",
--- 810,827 ----
  	   "Print dump of current object file definitions.",
  	   &maintenanceprintlist);
  
!   add_cmd ("symtabs", class_maintenance, maintenance_info_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.",
! 	   &maintenanceinfolist);
  
!   add_cmd ("psymtabs", class_maintenance, maintenance_info_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.",
! 	   &maintenanceinfolist);
  
    add_cmd ("statistics", class_maintenance, maintenance_print_statistics,
  	   "Print statistics about internal gdb state.",
Index: gdb/symmisc.c
===================================================================
RCS file: /cvs/src/src/gdb/symmisc.c,v
retrieving revision 1.20
diff -c -r1.20 symmisc.c
*** gdb/symmisc.c	14 Apr 2003 18:42:27 -0000	1.20
--- gdb/symmisc.c	17 Apr 2003 22:02:05 -0000
***************
*** 987,995 ****
  }
  
  
! /* List all the symbol tables.  */
  void
! maintenance_list_symtabs (char *regexp, int from_tty)
  {
    struct objfile *objfile;
  
--- 987,995 ----
  }
  
  
! /* List all the symbol tables whose names match REGEXP (optional).  */
  void
! maintenance_info_symtabs (char *regexp, int from_tty)
  {
    struct objfile *objfile;
  
***************
*** 1036,1044 ****
  }
  
  
! /* List all the partial symbol tables.  */
  void
! maintenance_list_psymtabs (char *regexp, int from_tty)
  {
    struct objfile *objfile;
  
--- 1036,1044 ----
  }
  
  
! /* List all the partial symbol tables whose names match REGEXP (optional).  */
  void
! maintenance_info_psymtabs (char *regexp, int from_tty)
  {
    struct objfile *objfile;
  
Index: gdb/symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.68
diff -c -r1.68 symtab.h
*** gdb/symtab.h	14 Apr 2003 19:55:27 -0000	1.68
--- gdb/symtab.h	17 Apr 2003 22:02:06 -0000
***************
*** 1233,1241 ****
  
  void maintenance_print_objfiles (char *, int);
  
! void maintenance_list_symtabs (char *, int);
  
! void maintenance_list_psymtabs (char *, int);
  
  void maintenance_check_symtabs (char *, int);
  
--- 1233,1241 ----
  
  void maintenance_print_objfiles (char *, int);
  
! void maintenance_info_symtabs (char *, int);
  
! void maintenance_info_psymtabs (char *, int);
  
  void maintenance_check_symtabs (char *, int);
  
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.29
diff -c -r1.29 cli-cmds.c
*** gdb/cli/cli-cmds.c	14 Apr 2003 18:42:28 -0000	1.29
--- gdb/cli/cli-cmds.c	17 Apr 2003 22:02:06 -0000
***************
*** 171,180 ****
  
  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;
--- 171,176 ----
***************
*** 1036,1042 ****
    maintenancelist = NULL;
    maintenanceinfolist = NULL;
    maintenanceprintlist = NULL;
-   maintenancelistlist = NULL;
    setprintlist = NULL;
    showprintlist = NULL;
    setchecklist = NULL;
--- 1032,1037 ----
Index: gdb/cli/cli-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.h,v
retrieving revision 1.4
diff -c -r1.4 cli-cmds.h
*** gdb/cli/cli-cmds.h	14 Apr 2003 18:42:28 -0000	1.4
--- gdb/cli/cli-cmds.h	17 Apr 2003 22:02:06 -0000
***************
*** 87,96 ****
  
  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;
--- 87,92 ----
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.156
diff -c -r1.156 gdb.texinfo
*** gdb/doc/gdb.texinfo	14 Apr 2003 18:42:28 -0000	1.156
--- gdb/doc/gdb.texinfo	17 Apr 2003 22:02:23 -0000
***************
*** 9034,9047 ****
  @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
--- 9034,9047 ----
  @xref{Files, ,Commands to specify files}, for a discussion of how
  @value{GDBN} reads symbols (in the description of @code{symbol-file}).
  
! @kindex maint info symtabs
! @kindex maint info 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 info symtabs @r{[} @var{regexp} @r{]}
! @itemx maint info 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
***************
*** 9050,9056 ****
  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 
--- 9050,9056 ----
  structure in more detail.  For example:
  
  @smallexample
! (@value{GDBP}) maint info psymtabs dwarf2read
  @{ objfile /home/gnu/build/gdb/gdb
    ((struct objfile *) 0x82e69d0)
    @{ psymtab /home/gnu/src/gdb/dwarf2read.c 
***************
*** 9063,9069 ****
      dependencies (none)
    @}
  @}
! (@value{GDBP}) maint list symtabs
  (@value{GDBP})
  @end smallexample
  @noindent
--- 9063,9069 ----
      dependencies (none)
    @}
  @}
! (@value{GDBP}) maint info symtabs
  (@value{GDBP})
  @end smallexample
  @noindent
***************
*** 9077,9083 ****
  (@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 
--- 9077,9083 ----
  (@value{GDBP}) break dwarf2_psymtab_to_symtab
  Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
  line 1574.
! (@value{GDBP}) maint info symtabs
  @{ objfile /home/gnu/build/gdb/gdb 
    ((struct objfile *) 0x82e69d0)
    @{ symtab /home/gnu/src/gdb/dwarf2read.c 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-17 22:09                           ` Jim Blandy
@ 2003-04-19  7:40                             ` Eli Zaretskii
  2003-05-07 21:43                             ` Jim Blandy
  1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2003-04-19  7:40 UTC (permalink / raw)
  To: jimb; +Cc: ac131313, gdb-patches

> From: Jim Blandy <jimb@redhat.com>
> Date: 17 Apr 2003 17:11:28 -0500
> 
> 	Rename commands 'maint list symtabs' and 'maint list psymtabs' to
> 	'maint info symtabs' and 'maint info psymtabs'.
> 	* symmisc.c (maintenance_info_symtabs, maintenance_info_psymtabs):
> 	Renamed from maintenance_list_symtabs and maintenance_list_psymtabs.
> 	* symtab.h (maintenance_info_symtabs, maintenance_info_psymtabs):
> 	Declarations updated.
> 	* maint.c (maintenance_list_command): Delete.
> 	(_initialize_maint_cmds): Update calls to add_cmd.
> 	* gdbcmd.h (maintenancelistlist): Delete declaration.
> 	* cli/cli-cmds.c (maintenancelistlist): Delete.
> 	(init_cmd_lists): Don't initialize it.
> 	* cli/cli-cmds.h (maintenancelistlist): Delete declaration.
> 
> gdb/doc/ChangeLog:
> 2003-04-17  Jim Blandy  <jimb@redhat.com>
> 
> 	* gdb.texinfo (Symbols): Update documentation: 'maint list
> 	symtabs' and 'maint list psymtabs' have been renamed 'maint info
> 	symtabs' and 'maint info psymtabs'.

Okay for the gdb.texinfo patch.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: RFA/RFC: dump symtab and psymtab lists
  2003-04-17 22:09                           ` Jim Blandy
  2003-04-19  7:40                             ` Eli Zaretskii
@ 2003-05-07 21:43                             ` Jim Blandy
  1 sibling, 0 replies; 21+ messages in thread
From: Jim Blandy @ 2003-05-07 21:43 UTC (permalink / raw)
  To: gdb-patches


I've committed this patch.

Jim Blandy <jimb@redhat.com> writes:

> gdb/ChangeLog:
> 2003-04-17  Jim Blandy  <jimb@redhat.com>
> 
> 	Rename commands 'maint list symtabs' and 'maint list psymtabs' to
> 	'maint info symtabs' and 'maint info psymtabs'.
> 	* symmisc.c (maintenance_info_symtabs, maintenance_info_psymtabs):
> 	Renamed from maintenance_list_symtabs and maintenance_list_psymtabs.
> 	* symtab.h (maintenance_info_symtabs, maintenance_info_psymtabs):
> 	Declarations updated.
> 	* maint.c (maintenance_list_command): Delete.
> 	(_initialize_maint_cmds): Update calls to add_cmd.
> 	* gdbcmd.h (maintenancelistlist): Delete declaration.
> 	* cli/cli-cmds.c (maintenancelistlist): Delete.
> 	(init_cmd_lists): Don't initialize it.
> 	* cli/cli-cmds.h (maintenancelistlist): Delete declaration.
> 
> gdb/doc/ChangeLog:
> 2003-04-17  Jim Blandy  <jimb@redhat.com>
> 
> 	* gdb.texinfo (Symbols): Update documentation: 'maint list
> 	symtabs' and 'maint list psymtabs' have been renamed 'maint info
> 	symtabs' and 'maint info psymtabs'.


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2003-05-07 21:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-07 23:41 RFA/RFC: dump symtab and psymtab lists Jim Blandy
2003-04-08  7:39 ` Andrew Cagney
2003-04-08 17:52   ` Jim Blandy
2003-04-08 21:13     ` Andrew Cagney
2003-04-09  0:09       ` Jim Blandy
2003-04-10  2:10         ` Andrew Cagney
2003-04-10 20:29           ` Jim Blandy
2003-04-10 21:49             ` Andrew Cagney
2003-04-10 21:56               ` Daniel Jacobowitz
2003-04-12  9:34             ` Eli Zaretskii
2003-04-14 18:43               ` Jim Blandy
2003-04-14 18:52                 ` Andrew Cagney
2003-04-14 19:05                   ` David Carlton
2003-04-14 19:27                     ` Andrew Cagney
2003-04-14 22:41                   ` Jim Blandy
2003-04-14 23:40                     ` Andrew Cagney
2003-04-15  1:45                       ` Jim Blandy
2003-04-15 15:49                         ` Andrew Cagney
2003-04-17 22:09                           ` Jim Blandy
2003-04-19  7:40                             ` Eli Zaretskii
2003-05-07 21:43                             ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox