From patchwork Wed Aug 6 06:50:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 2313 Received: (qmail 31090 invoked by alias); 6 Aug 2014 06:54:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 30946 invoked by uid 89); 6 Aug 2014 06:54:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Aug 2014 06:54:34 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1XEv7H-00039T-Ln from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 05 Aug 2014 23:54:31 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 5 Aug 2014 23:54:31 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Tue, 5 Aug 2014 23:53:24 -0700 From: Yao Qi To: Subject: [PATCH 2/2] Check function is GC'ed Date: Wed, 6 Aug 2014 14:50:13 +0800 Message-ID: <1407307813-5321-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1407307813-5321-1-git-send-email-yao@codesourcery.com> References: <53D8A264.1050103@codesourcery.com> <1407307813-5321-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes I see the following fail on arm-none-eabi target, (gdb) b 24^M Breakpoint 1 at 0x4: file ../../../../git/gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc, line 24.^M (gdb) FAIL: gdb.base/break-on-linker-gcd-function.exp: b 24 Currently, we are using flag has_section_at_zero to determine whether address zero in debug info means the corresponding code has been GC'ed, like this: case DW_LNE_set_address: address = read_address (abfd, line_ptr, cu, &bytes_read); if (address == 0 && !dwarf2_per_objfile->has_section_at_zero) { /* This line table is for a function which has been GCd by the linker. Ignore it. PR gdb/12528 */ However, this is incorrect on some bare metal targets, as .text section is located at 0x0. In this patch, we choose 'textlow' field of partial symtabl. This patch fixes the fail above. It is regression tested on x86_64-linux, arm-none-eabi, arm-none-linux-gnueabi. OK to apply? gdb: 2014-08-06 Yao Qi * dwarf2read.c (dwarf_decode_lines_1): Skip the line table if PST->textlow is greater than zero. --- gdb/dwarf2read.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8011e4e..5e292f2 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -17229,6 +17229,8 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir, /* Decode the table. */ while (!end_sequence) { + struct partial_symtab *pst = NULL; + op_code = read_1_byte (abfd, line_ptr); line_ptr += 1; if (line_ptr > line_end) @@ -17291,7 +17293,12 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir, case DW_LNE_set_address: address = read_address (abfd, line_ptr, cu, &bytes_read); - if (address == 0 && !dwarf2_per_objfile->has_section_at_zero) + if (!decode_for_pst_p) + pst = cu->per_cu->v.psymtab; + + if (address == 0 + && (!dwarf2_per_objfile->has_section_at_zero + || (pst != NULL && pst->textlow > address))) { /* This line table is for a function which has been GCd by the linker. Ignore it. PR gdb/12528 */