From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9579 invoked by alias); 30 Apr 2010 16:01:49 -0000 Received: (qmail 9292 invoked by uid 22791); 30 Apr 2010 16:01:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cam-admin0.cambridge.arm.com (HELO cam-admin0.cambridge.arm.com) (217.140.96.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Apr 2010 16:01:44 +0000 Received: from cam-owa2.Emea.Arm.com (cam-owa2.emea.arm.com [10.1.105.18]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id o3UG1feI026451 for ; Fri, 30 Apr 2010 17:01:41 +0100 (BST) Received: from [10.1.79.63] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 30 Apr 2010 17:01:41 +0100 Subject: [RFA] Fix display of entry point address From: Matthew Gretton-Dann To: gdb-patches@sourceware.org Content-Type: multipart/mixed; boundary="=-f1u0BCpd709hM1fcgs0l" Date: Fri, 30 Apr 2010 16:01:00 -0000 Message-Id: <1272643300.25147.14.camel@e102111-lin.cambridge.arm.com> Mime-Version: 1.0 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: 2010-04/txt/msg00995.txt.bz2 --=-f1u0BCpd709hM1fcgs0l Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1528 Hi, Please can someone review the attached patch? When displaying the entry point to a file (for instance as part of the output of `info files') gdb prints the raw address it has calculated. This is misleading on some platforms (notably on ARM when the entry point is to a Thumb-state function) as the address will contain additional information. For example (from the break-entry.exp test): (gdb) file /home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry Reading symbols from /home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry...(no debugging symbols found)...done. (gdb) info files Symbols from "/home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry". Local exec file: `/home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry', file type elf32-littlearm. Entry point: 0x8171 This is confusing as trying to set a breakpoint at 0x8171 causes a warning like the following to be displayed: (gdb) break *0x8171 warning: Breakpoint address adjusted from 0x00008171 to 0x00008170. Breakpoint 1 at 0x8170 The attached patch changes gdb's behaviour to strip the arch specific bits off the entry point before displaying it. A testsuite run shows no regressions, and the gdb.base/break-entry.exp test now passes in its entirety. Suggested ChangeLog entry: 2010-04-30 Matthew Gretton-Dann * exec.c (print_section_info): Display entry point without arch specific parts. Thanks, Matt -- Matthew Gretton-Dann Principal Engineer - Tools, PD Software ARM Limited --=-f1u0BCpd709hM1fcgs0l Content-Disposition: attachment; filename=1004-gdb-entry-point.patch Content-Type: text/x-patch; name=1004-gdb-entry-point.patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 1068 Index: gdb/exec.c =================================================================== RCS file: /cvs/src/src/gdb/exec.c,v retrieving revision 1.97 diff -u -p -u -p -r1.97 exec.c --- gdb/exec.c 14 Apr 2010 17:26:11 -0000 1.97 +++ gdb/exec.c 30 Apr 2010 13:05:27 -0000 @@ -669,6 +669,7 @@ print_section_info (struct target_sectio { /* gcc-3.4 does not like the initialization in

sections_end>. */ bfd_vma displacement = 0; + bfd_vma entry_point; for (p = t->sections; p < t->sections_end; p++) { @@ -690,9 +691,11 @@ print_section_info (struct target_sectio warning (_("Cannot find section for the entry point of %s.\n"), bfd_get_filename (abfd)); + entry_point = gdbarch_addr_bits_remove (gdbarch, + bfd_get_start_address (abfd) + + displacement); printf_filtered (_("\tEntry point: %s\n"), - paddress (gdbarch, (bfd_get_start_address (abfd) - + displacement))); + paddress (gdbarch, entry_point)); } for (p = t->sections; p < t->sections_end; p++) { --=-f1u0BCpd709hM1fcgs0l--