From patchwork Fri Oct 20 15:54:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 23734 Received: (qmail 38340 invoked by alias); 20 Oct 2017 15:54:55 -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 38321 invoked by uid 89); 20 Oct 2017 15:54:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Oct 2017 15:54:54 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 280E410F2C; Fri, 20 Oct 2017 15:54:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 280E410F2C Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39CF45D9C1; Fri, 20 Oct 2017 15:54:51 +0000 (UTC) Subject: [PATCH] Enhance gdb.base/print-file-var.exp testcase (Re: [PATCH V4] symlookup: improves symbol lookup when a file is specified.) To: Simon Marchi , "Tedeschi, Walfred" , Simon Marchi References: <1508317280-31265-1-git-send-email-walfred.tedeschi@intel.com> <327caaf3429595c07a29d455ea3ed6a0@polymtl.ca> Cc: "gdb-patches@sourceware.org" From: Pedro Alves Message-ID: <99fc3750-dc0d-45a8-d030-e37c0e1a2b77@redhat.com> Date: Fri, 20 Oct 2017 16:54:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: On 10/20/2017 04:28 PM, Pedro Alves wrote: > Actually, the patch introduces what looks like a related clear > regression to me. With the print-file-var.exp test program, try > stepping into get_version_2, and printing the this_version_id > global. And then type finish. Vis: > > (gdb) s > get_version_2 () at gdb.base/print-file-var-lib2.c:22 > 22 return this_version_id; > (gdb) p this_version_id > $1 = 203 > (gdb) finish > Run till exit from #0 get_version_2 () at gdb.base/print-file-var-lib2.c:22 > 0x000000000040073b in main () at gdb.base/print-file-var-main.c:24 > 24 int v2 = get_version_2 (); > Value returned is $2 = 104 > (gdb) > > GDB says "203", while the program returns "104". > That looks like a bug to me. I'd expect the print > to show me the current value of the variable in scope. > > In current master (without the patch), we get: > > (gdb) s > get_version_2 () at gdb.base/print-file-var-lib2.c:22 > 22 return this_version_id; > (gdb) p this_version_id > $1 = 104 > (gdb) finish > Run till exit from #0 get_version_2 () at gdb.base/print-file-var-lib2.c:22 > 0x000000000040073b in main () at gdb.base/print-file-var-main.c:24 > 24 int v2 = get_version_2 (); > Value returned is $2 = 104 Now in testsuite patch form... This is against master, where it passes cleanly. Walfred's patch results in: FAIL: gdb.base/print-file-var.exp: GDB sees same value as inferior sees while stopped in lib2 (Note: I haven't really looked deep in detail on why that is so.) From c389985174ac2b87d14e864d1eff9b5a7e9051db Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 20 Oct 2017 16:30:46 +0100 Subject: [PATCH] Enhance gdb.base/print-file-var.exp testcase Make sure that GDB sees the same value the inferior sees when stopped in each library. gdb/testsuite/ChangeLog: 2017-10-20 Pedro Alves * gdb.base/print-file-var.exp: Check that GDB sees same value as inferior in each library. --- gdb/testsuite/gdb.base/print-file-var.exp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp index 223a67d..60b8e08 100644 --- a/gdb/testsuite/gdb.base/print-file-var.exp +++ b/gdb/testsuite/gdb.base/print-file-var.exp @@ -74,6 +74,17 @@ if ![runto_main] { set bp_location \ [gdb_get_line_number "STOP" "${executable}.c"] + +# Stop in both libraries and save the value of 'this_version_id' as +# seen from those contexts. +gdb_breakpoint "get_version_1" +gdb_test "continue" "Breakpoint .* get_version_1.*" +set v1_lib1 [get_integer_valueof "this_version_id" -1] + +gdb_breakpoint "get_version_2" +gdb_test "continue" "Breakpoint .* get_version_2.*" +set v2_lib2 [get_integer_valueof "this_version_id" -1] + gdb_test "break $executable.c:$bp_location" \ "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: .*" \ "breapoint past v1 & v2 initialization" @@ -82,6 +93,16 @@ gdb_test "continue" \ "Breakpoint \[0-9\]+, main \\(\\) at.*STOP.*" \ "continue to STOP marker" +# Check that the values of 'this_version_id' that we saved above when +# stopped in both print-file-var-lib1.c:get_version_1 and +# print-file-var-lib2.c:get_version_2 match what those functions +# actually returned. + +gdb_test "print v1" " = $v1_lib1" \ + "GDB sees same value as inferior sees while stopped in lib1" +gdb_test "print v2" " = $v2_lib2" \ + "GDB sees same value as inferior sees while stopped in lib2" + # Now check the value of this_version_id in both print-file-var-lib1.c # and print-file-var-lib2.c.