* [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c
@ 2012-12-19 7:56 Yao Qi
2012-12-19 7:56 ` [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c Yao Qi
2012-12-19 14:23 ` [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Yao Qi @ 2012-12-19 7:56 UTC (permalink / raw)
To: gdb-patches
Hi,
I don't see the reason we have to register 'maint commands' inside
maint.c. This patch moves code registering commands out of maint.c so
that the command functions can be 'static'.
gdb:
2012-12-19 Yao Qi <yao@codesourcery.com>
* maint.c (_initialize_maint_cmds): Move code to ...
* psymtab.c (_initialize_psymtab): ... here. New.
Include "gdbcmd.h".
(maintenance_print_psymbols): Make it static.
(maintenance_info_psymtabs, maintenance_check_symtabs): Likewise.
* symtab.h (maintenance_print_psymbols): Remove declaration.
(maintenance_check_symtabs, maintenance_info_psymtabs): Likewise.
---
gdb/maint.c | 16 ----------------
gdb/psymtab.c | 29 ++++++++++++++++++++++++++---
gdb/symtab.h | 6 ------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/gdb/maint.c b/gdb/maint.c
index afb9968..4c7a588 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -833,12 +833,6 @@ Entries in the minimal symbol table are dumped to file OUTFILE.\n\
If a SOURCE file is specified, dump only that file's minimal symbols."),
&maintenanceprintlist);
- add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _("\
-Print dump of current partial symbol definitions.\n\
-Entries in the partial symbol table are dumped to file OUTFILE.\n\
-If a SOURCE file is specified, dump only that file's partial symbols."),
- &maintenanceprintlist);
-
add_cmd ("objfiles", class_maintenance, maintenance_print_objfiles,
_("Print dump of current object file definitions."),
&maintenanceprintlist);
@@ -850,12 +844,6 @@ 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."),
&maintenanceprintlist);
@@ -866,10 +854,6 @@ Print the internal architecture configuration.\n\
Takes an optional file parameter."),
&maintenanceprintlist);
- add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs,
- _("Check consistency of psymtabs and symtabs."),
- &maintenancelist);
-
add_cmd ("translate-address", class_maintenance,
maintenance_translate_address,
_("Translate a section name and address to a symbol."),
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index d6dba3e..186a92c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -35,6 +35,7 @@
#include "dictionary.h"
#include "language.h"
#include "cp-support.h"
+#include "gdbcmd.h"
#ifndef DEV_TTY
#define DEV_TTY "/dev/tty"
@@ -1818,7 +1819,7 @@ discard_psymtab (struct objfile *objfile, struct partial_symtab *pst)
\f
-void
+static void
maintenance_print_psymbols (char *args, int from_tty)
{
char **argv;
@@ -1867,7 +1868,7 @@ print-psymbols takes an output file name and optional symbol file name"));
}
/* List all the partial symbol tables whose names match REGEXP (optional). */
-void
+static void
maintenance_info_psymtabs (char *regexp, int from_tty)
{
struct program_space *pspace;
@@ -1973,7 +1974,7 @@ maintenance_info_psymtabs (char *regexp, int from_tty)
/* Check consistency of psymtabs and symtabs. */
-void
+static void
maintenance_check_symtabs (char *ignore, int from_tty)
{
struct symbol *sym;
@@ -2086,3 +2087,25 @@ map_partial_symbol_filenames (symbol_filename_ftype *fun, void *data,
need_fullname);
}
}
+
+void _initialize_psymtab (void);
+
+void
+_initialize_psymtab (void)
+{
+ add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _("\
+Print dump of current partial symbol definitions.\n\
+Entries in the partial symbol table are dumped to file OUTFILE.\n\
+If a SOURCE file is specified, dump only that file's partial symbols."),
+ &maintenanceprintlist);
+
+ 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 ("check-symtabs", class_maintenance, maintenance_check_symtabs,
+ _("Check consistency of psymtabs and symtabs."),
+ &maintenancelist);
+}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index b3c084d..bdabb0c 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1162,18 +1162,12 @@ extern void resolve_sal_pc (struct symtab_and_line *);
void maintenance_print_symbols (char *, int);
-void maintenance_print_psymbols (char *, int);
-
void maintenance_print_msymbols (char *, int);
void maintenance_print_objfiles (char *, int);
void maintenance_info_symtabs (char *, int);
-void maintenance_info_psymtabs (char *, int);
-
-void maintenance_check_symtabs (char *, int);
-
/* Symbol-reading stuff in symfile.c and solib.c. */
extern void clear_solib (void);
--
1.7.7.6
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c.
2012-12-19 7:56 [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Yao Qi
@ 2012-12-19 7:56 ` Yao Qi
2012-12-19 14:23 ` Tom Tromey
2012-12-19 14:23 ` [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Tom Tromey
1 sibling, 1 reply; 5+ messages in thread
From: Yao Qi @ 2012-12-19 7:56 UTC (permalink / raw)
To: gdb-patches
Similar to the previous patch.
gdb:
2012-12-19 Yao Qi <yao@codesourcery.com>
* maint.c (_initialize_maint_cmds): Move code ...
* symmisc.c (_initialize_symmisc): ... to here.
(maintenance_print_msymbols): Make it static.
(maintenance_print_objfiles): Likewise.
(maintenance_print_symbols): Likewise.
(maintenance_info_symtabs): Likewise.
* symtab.h (maintenance_print_msymbols): Remove declaration.
(maintenance_print_objfiles, maintenance_print_symbols): Likewise.
(maintenance_info_symtabs): Likewise.
---
gdb/maint.c | 23 -----------------------
gdb/symmisc.c | 32 ++++++++++++++++++++++++++++----
gdb/symtab.h | 10 ----------
3 files changed, 28 insertions(+), 37 deletions(-)
diff --git a/gdb/maint.c b/gdb/maint.c
index 4c7a588..cba67a7 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -821,29 +821,6 @@ For each node in a type chain, print the raw data for each member of\n\
the type structure, and the interpretation of the data."),
&maintenanceprintlist);
- add_cmd ("symbols", class_maintenance, maintenance_print_symbols, _("\
-Print dump of current symbol definitions.\n\
-Entries in the full symbol table are dumped to file OUTFILE.\n\
-If a SOURCE file is specified, dump only that file's symbols."),
- &maintenanceprintlist);
-
- add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _("\
-Print dump of current minimal symbol definitions.\n\
-Entries in the minimal symbol table are dumped to file OUTFILE.\n\
-If a SOURCE file is specified, dump only that file's minimal symbols."),
- &maintenanceprintlist);
-
- add_cmd ("objfiles", class_maintenance, maintenance_print_objfiles,
- _("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 ("statistics", class_maintenance, maintenance_print_statistics,
_("Print statistics about internal gdb state."),
&maintenanceprintlist);
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 694a84a..c88e36c 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -36,6 +36,7 @@
#include "gdb_stat.h"
#include "dictionary.h"
#include "typeprint.h"
+#include "gdbcmd.h"
#include "gdb_string.h"
#include "readline/readline.h"
@@ -401,7 +402,7 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab,
dump_symtab_1 (objfile, symtab, outfile);
}
-void
+static void
maintenance_print_symbols (char *args, int from_tty)
{
char **argv;
@@ -626,7 +627,7 @@ print_symbol (void *args)
return 1;
}
-void
+static void
maintenance_print_msymbols (char *args, int from_tty)
{
char **argv;
@@ -682,7 +683,7 @@ maintenance_print_msymbols (char *args, int from_tty)
do_cleanups (cleanups);
}
-void
+static void
maintenance_print_objfiles (char *ignore, int from_tty)
{
struct program_space *pspace;
@@ -700,7 +701,7 @@ maintenance_print_objfiles (char *ignore, int from_tty)
/* List all the symbol tables whose names match REGEXP (optional). */
-void
+static void
maintenance_info_symtabs (char *regexp, int from_tty)
{
struct program_space *pspace;
@@ -784,4 +785,27 @@ _initialize_symmisc (void)
std_in = stdin;
std_out = stdout;
std_err = stderr;
+
+ add_cmd ("symbols", class_maintenance, maintenance_print_symbols, _("\
+Print dump of current symbol definitions.\n\
+Entries in the full symbol table are dumped to file OUTFILE.\n\
+If a SOURCE file is specified, dump only that file's symbols."),
+ &maintenanceprintlist);
+
+ add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _("\
+Print dump of current minimal symbol definitions.\n\
+Entries in the minimal symbol table are dumped to file OUTFILE.\n\
+If a SOURCE file is specified, dump only that file's minimal symbols."),
+ &maintenanceprintlist);
+
+ add_cmd ("objfiles", class_maintenance, maintenance_print_objfiles,
+ _("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);
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index bdabb0c..e2845e9 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1158,16 +1158,6 @@ extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
extern void resolve_sal_pc (struct symtab_and_line *);
-/* Symmisc.c */
-
-void maintenance_print_symbols (char *, int);
-
-void maintenance_print_msymbols (char *, int);
-
-void maintenance_print_objfiles (char *, int);
-
-void maintenance_info_symtabs (char *, int);
-
/* Symbol-reading stuff in symfile.c and solib.c. */
extern void clear_solib (void);
--
1.7.7.6
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c.
2012-12-19 7:56 ` [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c Yao Qi
@ 2012-12-19 14:23 ` Tom Tromey
2012-12-20 1:12 ` [committed] : " Yao Qi
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2012-12-19 14:23 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> 2012-12-19 Yao Qi <yao@codesourcery.com>
Yao> * maint.c (_initialize_maint_cmds): Move code ...
Yao> * symmisc.c (_initialize_symmisc): ... to here.
Yao> (maintenance_print_msymbols): Make it static.
Yao> (maintenance_print_objfiles): Likewise.
Yao> (maintenance_print_symbols): Likewise.
Yao> (maintenance_info_symtabs): Likewise.
Yao> * symtab.h (maintenance_print_msymbols): Remove declaration.
Yao> (maintenance_print_objfiles, maintenance_print_symbols): Likewise.
Yao> (maintenance_info_symtabs): Likewise.
Ok.
I forgot to mention, the previous patch is ok.
You can make the initialize_file_ftype change if you want.
I don't think it matters very much either way.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* [committed] : [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c.
2012-12-19 14:23 ` Tom Tromey
@ 2012-12-20 1:12 ` Yao Qi
0 siblings, 0 replies; 5+ messages in thread
From: Yao Qi @ 2012-12-20 1:12 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 12/19/2012 10:23 PM, Tom Tromey wrote:
> Ok.
>
> I forgot to mention, the previous patch is ok.
> You can make the initialize_file_ftype change if you want.
> I don't think it matters very much either way.
Tom, thanks for the review. I made the change and committed.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c
2012-12-19 7:56 [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Yao Qi
2012-12-19 7:56 ` [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c Yao Qi
@ 2012-12-19 14:23 ` Tom Tromey
1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2012-12-19 14:23 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> I don't see the reason we have to register 'maint commands' inside
Yao> maint.c. This patch moves code registering commands out of maint.c so
Yao> that the command functions can be 'static'.
Thanks.
Yao> +void _initialize_psymtab (void);
I've been writing
initialize_file_ftype _initialize_psymtab;
in similar cases.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-20 1:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 7:56 [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Yao Qi
2012-12-19 7:56 ` [PATCH 2/2] Move registering maint cmd from maint.c to symmisc.c Yao Qi
2012-12-19 14:23 ` Tom Tromey
2012-12-20 1:12 ` [committed] : " Yao Qi
2012-12-19 14:23 ` [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox