From patchwork Wed Feb 25 15:16:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 5282 Received: (qmail 69581 invoked by alias); 25 Feb 2015 15:16:23 -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 69565 invoked by uid 89); 25 Feb 2015 15:16:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_FROM_URIBL_PCCC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pd0-f180.google.com Received: from mail-pd0-f180.google.com (HELO mail-pd0-f180.google.com) (209.85.192.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 25 Feb 2015 15:16:22 +0000 Received: by pdbnh10 with SMTP id nh10so5455937pdb.11 for ; Wed, 25 Feb 2015 07:16:20 -0800 (PST) X-Received: by 10.69.16.99 with SMTP id fv3mr6237701pbd.98.1424877380054; Wed, 25 Feb 2015 07:16:20 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id pp9sm41549084pbb.65.2015.02.25.07.16.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 07:16:19 -0800 (PST) From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Dwarf assembler: handle one instruction function Date: Wed, 25 Feb 2015 15:16:15 +0000 Message-Id: <1424877375-14752-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes From: Yao Qi On aarch64, we got the following fail: (gdb) disassemble func Dump of assembler code for function func: 0x0000000000400730 <+0>: ret End of assembler dump.^M (gdb) x/2i func+0^M 0x400730 : ret^M 0x400734
: stp x29, x30, [sp,#-16]!^M (gdb) FAIL: gdb.dwarf2/dw2-ifort-parameter.exp: x/2i func+0 the pattern in proc function_range expects to match , however, GDB doesn't display the offset when it is zero. This patch is to adjust the pattern when $func_length. gdb/testsuite: 2015-02-25 Yao Qi * lib/dwarf.exp (function_range): Adjust pattern when $func_length is zero. --- gdb/testsuite/lib/dwarf.exp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 8ea7a0f..19963c4 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -146,9 +146,14 @@ proc function_range { func src } { } # Compute the size of the last instruction. + if { $func_length == 0 } then { + set func_pattern "$func" + } else { + set func_pattern "$func\\+$func_length" + } set test "x/2i $func+$func_length" gdb_test_multiple $test $test { - -re ".*($hex) <$func\\+$func_length>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" { + -re ".*($hex) <$func_pattern>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" { set start $expect_out(1,string) set end $expect_out(2,string)