From patchwork Wed Sep 3 01:15:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 2634 Received: (qmail 23212 invoked by alias); 3 Sep 2014 01:23:06 -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 23181 invoked by uid 89); 3 Sep 2014 01:23:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, SUBJ_OBFU_PUNCT_FEW autolearn=no 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, 03 Sep 2014 01:23:00 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1XOzHh-0000dE-So from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 02 Sep 2014 18:22:55 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.2.247.3; Tue, 2 Sep 2014 18:20:09 -0700 From: Yao Qi To: Subject: [PATCH] Fix gdb.dwarf2/dwz.exp for thumb mode Date: Wed, 3 Sep 2014 09:15:36 +0800 Message-ID: <1409706936-11220-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi, We see the fail in gdb.dwarf2/dwz.exp in thumb mode, p the_int^M $2 = 99^M (gdb) FAIL: gdb.dwarf2/dwz.exp: p the_int In thumb mode, the lsb of references to 'main' in the assembly (produced by dwarf assember) is set, so the generated debug information is incorrect. This patch copies the approach from [PATCH 4/4] Fix gdb.trace/entry-values.exp for thumb mode https://sourceware.org/ml/gdb-patches/2014-07/msg00041.html introduce new label 'main_start' which is the correct function address (without lsb set). This patch fixes these fails we've seen. Regression tested on arm-none-eabi and x86_64-linux. gdb/testsuite: 2014-09-03 Yao Qi * gdb.dwarf2/dwz.exp: Use main_start instead of main. * gdb.dwarf2/main.c: Define label 'main_start' at the beginning function 'main'. --- gdb/testsuite/gdb.dwarf2/dwz.exp | 4 ++-- gdb/testsuite/gdb.dwarf2/main.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp index 9175f9e..ef19631 100644 --- a/gdb/testsuite/gdb.dwarf2/dwz.exp +++ b/gdb/testsuite/gdb.dwarf2/dwz.exp @@ -79,8 +79,8 @@ Dwarf::assemble $asm_file { partial_label: partial_unit {} { subprogram { {name main} - {low_pc main addr} - {high_pc "main + $main_length" addr} + {low_pc main_start addr} + {high_pc "main_start + $main_length" addr} } } } diff --git a/gdb/testsuite/gdb.dwarf2/main.c b/gdb/testsuite/gdb.dwarf2/main.c index 3ddd194..5a4cbc3 100644 --- a/gdb/testsuite/gdb.dwarf2/main.c +++ b/gdb/testsuite/gdb.dwarf2/main.c @@ -17,6 +17,10 @@ /* Dummy main function. */ +asm (".section \".text\""); +asm (".balign 8"); +asm ("main_start: .globl main_start"); + int main() {