From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21352 invoked by alias); 19 Dec 2012 07:56:15 -0000 Received: (qmail 21343 invoked by uid 22791); 19 Dec 2012 07:56:14 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_BJ X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Dec 2012 07:56:08 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TlEVc-0002o2-CI from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 18 Dec 2012 23:56:08 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 18 Dec 2012 23:56:08 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Tue, 18 Dec 2012 23:56:07 -0800 From: Yao Qi To: Subject: [PATCH 1/2] Move registering maint commands from maint.c to psymtalb.c Date: Wed, 19 Dec 2012 07:56:00 -0000 Message-ID: <1355903736-25543-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-12/txt/msg00678.txt.bz2 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 * 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) -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