From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18677 invoked by alias); 20 Nov 2012 09:36:50 -0000 Received: (qmail 18617 invoked by uid 22791); 20 Nov 2012 09:36:49 -0000 X-SWARE-Spam-Status: No, hits=-3.7 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; Tue, 20 Nov 2012 09:36:43 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TakG1-0000i8-VT from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 20 Nov 2012 01:36:41 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 20 Nov 2012 01:36:41 -0800 Received: from qiyao.dyndns.org.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; Tue, 20 Nov 2012 01:36:40 -0800 From: Yao Qi To: Subject: [PATCH] use gdbarch_addr_bits_remove for entry point address Date: Tue, 20 Nov 2012 09:36:00 -0000 Message-ID: <1353404184-22073-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-11/txt/msg00532.txt.bz2 Hi, This patch attempts to clear the lsb of the entry address, which might be set by compiler for thumb code. This patch does something similar to this one, RFC: Handle ISA bits for the entry point http://sourceware.org/ml/gdb-patches/2009-07/msg00682.html Regression tested on arm-none-linux-gnueabi. Is it OK? gdb: 2012-11-20 Daniel Jacobowitz Kazu Hirata Yao Qi * objfiles.c (init_entry_point_info): Use gdbarch_addr_bits_remove. * solib-svr4.c (exec_entry_point): Likewise. * symfile.c (generic_load): Call gdbarch_addr_bits_remove on the entry address. --- gdb/objfiles.c | 5 +++++ gdb/solib-svr4.c | 5 ++++- gdb/symfile.c | 1 + 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index a1db8c6..3374c68 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -353,6 +353,11 @@ init_entry_point_info (struct objfile *objfile) /* Examination of non-executable.o files. Short-circuit this stuff. */ objfile->ei.entry_point_p = 0; } + + if (objfile->ei.entry_point_p) + objfile->ei.entry_point + = gdbarch_addr_bits_remove (objfile->gdbarch, + objfile->ei.entry_point); } /* If there is a valid and known entry point, function fills *ENTRY_P with it diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 37cc654..02e45a3 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1388,6 +1388,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc) static CORE_ADDR exec_entry_point (struct bfd *abfd, struct target_ops *targ) { + CORE_ADDR addr; + /* KevinB wrote ... for most targets, the address returned by bfd_get_start_address() is the entry point for the start function. But, for some targets, bfd_get_start_address() returns @@ -1396,9 +1398,10 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ) gdbarch_convert_from_func_ptr_addr(). The method gdbarch_convert_from_func_ptr_addr() is the merely the identify function for targets which don't use function descriptors. */ - return gdbarch_convert_from_func_ptr_addr (target_gdbarch (), + addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), bfd_get_start_address (abfd), targ); + return gdbarch_addr_bits_remove (target_gdbarch (), addr); } /* Helper function for gdb_bfd_lookup_symbol. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index 55af541..70f631f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2132,6 +2132,7 @@ generic_load (char *args, int from_tty) gettimeofday (&end_time, NULL); entry = bfd_get_start_address (loadfile_bfd); + entry = gdbarch_addr_bits_remove (target_gdbarch (), entry); ui_out_text (uiout, "Start address "); ui_out_field_fmt (uiout, "address", "%s", paddress (target_gdbarch (), entry)); ui_out_text (uiout, ", load size "); -- 1.7.7.6