From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3229 invoked by alias); 15 Dec 2012 13:14:31 -0000 Received: (qmail 3210 invoked by uid 22791); 15 Dec 2012 13:14:29 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 15 Dec 2012 13:14:20 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 528C12E2C1; Sat, 15 Dec 2012 08:14:19 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id c74lGDC8TSDk; Sat, 15 Dec 2012 08:14:19 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B7C8E2E0E6; Sat, 15 Dec 2012 08:14:18 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id E8670C14DC; Sat, 15 Dec 2012 17:14:07 +0400 (RET) Date: Sat, 15 Dec 2012 13:14:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: Yao Qi , Pedro Alves , gdb-patches@sourceware.org Subject: Re: crash/regression with ia64 targets Message-ID: <20121215131407.GE3654@adacore.com> References: <1353404184-22073-1-git-send-email-yao@codesourcery.com> <50AFD573.1090601@gmail.com> <50B0ABF9.1080606@codesourcery.com> <20121213120528.GA19986@adacore.com> <87y5h01x8u.fsf@fleche.redhat.com> <20121214153326.GC3654@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6sX45UoQRIJXqkqR" Content-Disposition: inline In-Reply-To: <20121214153326.GC3654@adacore.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00518.txt.bz2 --6sX45UoQRIJXqkqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 439 > > It seems like a good idea to me. > > (I think you meant symfile.c here.) Here is a patch. I don't think it would be controversial, so I checked it in right away. It's easy to adjust or revert if requested. gdb/ChangeLog: * objfiles.c (init_entry_point_info): Move function from here... * symfile.c (init_entry_point_info): ... to there. Make static. * objfiles.h (objfiles.h): Delete declaration. -- Joel --6sX45UoQRIJXqkqR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-Move-init_entry_point_info-to-symfile.c-and-make-it-.patch" Content-length: 5060 >From aa833475f7e589719e2dd59f8241096f925dc69f Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Sat, 15 Dec 2012 16:07:26 +0400 Subject: [PATCH 2/2] Move init_entry_point_info to symfile.c and make it static. gdb/ChangeLog: * objfiles.c (init_entry_point_info): Move function from here... * symfile.c (init_entry_point_info): ... to there. Make static. * objfiles.h (objfiles.h): Delete declaration. --- gdb/objfiles.c | 48 ------------------------------------------------ gdb/objfiles.h | 2 -- gdb/symfile.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 50 deletions(-) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e5681fa..feb387b 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -324,54 +324,6 @@ get_objfile_arch (struct objfile *objfile) return objfile->gdbarch; } -/* Initialize entry point information for this objfile. */ - -void -init_entry_point_info (struct objfile *objfile) -{ - /* Save startup file's range of PC addresses to help blockframe.c - decide where the bottom of the stack is. */ - - if (bfd_get_file_flags (objfile->obfd) & EXEC_P) - { - /* Executable file -- record its entry point so we'll recognize - the startup file because it contains the entry point. */ - objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); - objfile->ei.entry_point_p = 1; - } - else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC - && bfd_get_start_address (objfile->obfd) != 0) - { - /* Some shared libraries may have entry points set and be - runnable. There's no clear way to indicate this, so just check - for values other than zero. */ - objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); - objfile->ei.entry_point_p = 1; - } - else - { - /* Examination of non-executable.o files. Short-circuit this stuff. */ - objfile->ei.entry_point_p = 0; - } - - if (objfile->ei.entry_point_p) - { - CORE_ADDR entry_point = objfile->ei.entry_point; - - /* Make certain that the address points at real code, and not a - function descriptor. */ - entry_point - = gdbarch_convert_from_func_ptr_addr (objfile->gdbarch, - entry_point, - ¤t_target); - - /* Remove any ISA markers, so that this matches entries in the - symbol table. */ - objfile->ei.entry_point - = gdbarch_addr_bits_remove (objfile->gdbarch, entry_point); - } -} - /* If there is a valid and known entry point, function fills *ENTRY_P with it and returns non-zero; otherwise it returns zero. */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 877c9e0..c794598 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -443,8 +443,6 @@ extern struct objfile *allocate_objfile (bfd *, int); extern struct gdbarch *get_objfile_arch (struct objfile *); -extern void init_entry_point_info (struct objfile *); - extern int entry_point_address_query (CORE_ADDR *entry_p); extern CORE_ADDR entry_point_address (void); diff --git a/gdb/symfile.c b/gdb/symfile.c index 2a15293..fc908b3 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -893,6 +893,54 @@ read_symbols (struct objfile *objfile, int add_flags) require_partial_symbols (objfile, 0); } +/* Initialize entry point information for this objfile. */ + +static void +init_entry_point_info (struct objfile *objfile) +{ + /* Save startup file's range of PC addresses to help blockframe.c + decide where the bottom of the stack is. */ + + if (bfd_get_file_flags (objfile->obfd) & EXEC_P) + { + /* Executable file -- record its entry point so we'll recognize + the startup file because it contains the entry point. */ + objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); + objfile->ei.entry_point_p = 1; + } + else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC + && bfd_get_start_address (objfile->obfd) != 0) + { + /* Some shared libraries may have entry points set and be + runnable. There's no clear way to indicate this, so just check + for values other than zero. */ + objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); + objfile->ei.entry_point_p = 1; + } + else + { + /* Examination of non-executable.o files. Short-circuit this stuff. */ + objfile->ei.entry_point_p = 0; + } + + if (objfile->ei.entry_point_p) + { + CORE_ADDR entry_point = objfile->ei.entry_point; + + /* Make certain that the address points at real code, and not a + function descriptor. */ + entry_point + = gdbarch_convert_from_func_ptr_addr (objfile->gdbarch, + entry_point, + ¤t_target); + + /* Remove any ISA markers, so that this matches entries in the + symbol table. */ + objfile->ei.entry_point + = gdbarch_addr_bits_remove (objfile->gdbarch, entry_point); + } +} + /* Process a symbol file, as either the main file or as a dynamically loaded file. -- 1.7.10.4 --6sX45UoQRIJXqkqR--