From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7521 invoked by alias); 14 Jan 2013 12:42:49 -0000 Received: (qmail 7439 invoked by uid 22791); 14 Jan 2013 12:42:47 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,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; Mon, 14 Jan 2013 12:42:41 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TuhLw-0003ez-7W from Yao_Qi@mentor.com ; Mon, 14 Jan 2013 02:33:16 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 14 Jan 2013 02:33:16 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Mon, 14 Jan 2013 02:33:15 -0800 Message-ID: <50F3DEBC.3020203@codesourcery.com> Date: Mon, 14 Jan 2013 12:42:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Tom Tromey CC: Joel Brobecker , Subject: [committed]: [PATCH] Don't check PST is NULL in read_symtab References: <1357869440-23451-1-git-send-email-yao@codesourcery.com> <20130111045233.GK6143@adacore.com> <87libzu6tn.fsf@fleche.redhat.com> <50F027E4.5010702@codesourcery.com> <87txqnsqsg.fsf@fleche.redhat.com> In-Reply-To: <87txqnsqsg.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: 2013-01/txt/msg00269.txt.bz2 On 01/11/2013 11:06 PM, Tom Tromey wrote: > Sure. Though I am ok with just a comment as well. Below is what I committed, with the comments added. -- Yao (齐尧) gdb: 2013-01-14 Yao Qi * dbxread.c (dbx_psymtab_to_symtab_1): Don't check PST is NULL. (dbx_psymtab_to_symtab): Likewise. * dwarf2read.c (dwarf2_psymtab_to_symtab): Likewise. * mdebugread.c (mdebug_psymtab_to_symtab): Likewise. * xcoffread.c (xcoff_psymtab_to_symtab_1): Likewise. diff --git a/gdb/dbxread.c b/gdb/dbxread.c index ebe4237..16496d1 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2406,9 +2406,6 @@ dbx_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst) struct cleanup *old_chain; int i; - if (!pst) - return; - if (pst->readin) { fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. " @@ -2455,7 +2452,7 @@ dbx_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst) } /* Read in all of the symbols for a given psymtab for real. - Be verbose about it if the user wants that. */ + Be verbose about it if the user wants that. PST is not NULL. */ static void dbx_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) @@ -2463,9 +2460,6 @@ dbx_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) bfd *sym_bfd; struct cleanup *back_to = NULL; - if (!pst) - return; - if (pst->readin) { fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. " diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e2088f1..7af89c6 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6405,52 +6405,50 @@ locate_pdi_sibling (const struct die_reader_specs *reader, return skip_children (reader, info_ptr); } -/* Expand this partial symbol table into a full symbol table. */ +/* Expand this partial symbol table into a full symbol table. PST is + not NULL. */ static void dwarf2_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) { - if (pst != NULL) + if (pst->readin) { - if (pst->readin) + warning (_("bug: psymtab for %s is already read in."), + pst->filename); + } + else + { + if (info_verbose) { - warning (_("bug: psymtab for %s is already read in."), - pst->filename); + printf_filtered (_("Reading in symbols for %s..."), + pst->filename); + gdb_flush (gdb_stdout); } - else - { - if (info_verbose) - { - printf_filtered (_("Reading in symbols for %s..."), - pst->filename); - gdb_flush (gdb_stdout); - } - /* Restore our global data. */ - dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); + /* Restore our global data. */ + dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); - /* If this psymtab is constructed from a debug-only objfile, the - has_section_at_zero flag will not necessarily be correct. We - can get the correct value for this flag by looking at the data - associated with the (presumably stripped) associated objfile. */ - if (objfile->separate_debug_objfile_backlink) - { - struct dwarf2_per_objfile *dpo_backlink - = objfile_data (objfile->separate_debug_objfile_backlink, - dwarf2_objfile_data_key); + /* If this psymtab is constructed from a debug-only objfile, the + has_section_at_zero flag will not necessarily be correct. We + can get the correct value for this flag by looking at the data + associated with the (presumably stripped) associated objfile. */ + if (objfile->separate_debug_objfile_backlink) + { + struct dwarf2_per_objfile *dpo_backlink + = objfile_data (objfile->separate_debug_objfile_backlink, + dwarf2_objfile_data_key); - dwarf2_per_objfile->has_section_at_zero - = dpo_backlink->has_section_at_zero; - } + dwarf2_per_objfile->has_section_at_zero + = dpo_backlink->has_section_at_zero; + } - dwarf2_per_objfile->reading_partial_symbols = 0; + dwarf2_per_objfile->reading_partial_symbols = 0; - psymtab_to_symtab_1 (pst); + psymtab_to_symtab_1 (pst); - /* Finish up the debug error message. */ - if (info_verbose) - printf_filtered (_("done.\n")); - } + /* Finish up the debug error message. */ + if (info_verbose) + printf_filtered (_("done.\n")); } process_cu_includes (); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 856ca9d..2eb0536 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -273,14 +273,11 @@ static char *mdebug_next_symbol_text (struct objfile *); /* Exported procedure: Builds a symtab from the PST partial one. Restores the environment in effect when PST was created, delegates most of the work to an ancillary procedure, and sorts - and reorders the symtab list at the end. */ + and reorders the symtab list at the end. PST is not NULL. */ static void mdebug_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) { - if (!pst) - return; - if (info_verbose) { printf_filtered (_("Reading in symbols for %s..."), pst->filename); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 9fe8621..41aaf02 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1855,14 +1855,11 @@ xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst) } /* Read in all of the symbols for a given psymtab for real. - Be verbose about it if the user wants that. */ + Be verbose about it if the user wants that. PST is not NULL. */ static void xcoff_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst) { - if (!pst) - return; - if (pst->readin) { fprintf_unfiltered