From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48569 invoked by alias); 20 Jan 2017 14:37:28 -0000 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 Received: (qmail 41066 invoked by uid 89); 20 Jan 2017 14:37:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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; Fri, 20 Jan 2017 14:37:15 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1cUaJV-0007XB-U4 from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Fri, 20 Jan 2017 06:37:13 -0800 Received: from Opsys.world.mentorg.com (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Fri, 20 Jan 2017 06:37:12 -0800 From: Luis Machado To: Subject: [PATCH] Make gdb.python/python.exp more robust Date: Fri, 20 Jan 2017 14:37:00 -0000 Message-ID: <1484923030-16656-1-git-send-email-lgustavo@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00410.txt.bz2 I noticed gdb.python/python.exp failing on aarch64-elf like so: FAIL: gdb.python/python.exp: Test decode_line func1 line number This particular test expects the line number for func1 to be 19, hardcoded. In my aarch64-elf tests gdb thinks func1 is at line 20, making the test fail. The following patch addresses this by reading the line number information from GDB and comparing it against the python decoded symtab information. Regression tested on x86-64/Ubuntu 16.04. gdb/testsuite/ChangeLog: 2017-01-20 Luis Machado * gdb.python/python.exp: Check line number against what GDB thinks the line number is for func1. --- gdb/testsuite/gdb.python/python.exp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 95ec74e..f099cc0 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -246,7 +246,17 @@ if { [is_remote host] } { set python_1_c [string_to_regexp "gdb.python/python-1.c"] } gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_1_c}" "test decode_line func1 filename" -gdb_test "python print (symtab\[1\]\[0\].line)" "19" "test decode_line func1 line number" + +# Fetch the line GDB thinks func1 starts at. This may change depending +# on the architecture and on how GDB handles the prologue of the function. +gdb_test_multiple "info line func1" "info line func1" { + -re "Line ($decimal) of .* starts at address $hex and ends at $hex \.\[\r\n\]+$gdb_prompt $" { + # Fetch the line number. + set func1_lineno $expect_out(1,string) + } +} + +gdb_test "python print (symtab\[1\]\[0\].line)" "$func1_lineno" "test decode_line func1 line number" gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \ "test decode_line func1,func2" 1 gdb_test {python print (symtab[0])} ",func2" "stop at comma in linespec" -- 2.7.4