From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16868 invoked by alias); 1 Oct 2011 11:03:16 -0000 Received: (qmail 16859 invoked by uid 22791); 1 Oct 2011 11:03:15 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 01 Oct 2011 11:02:57 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p91B2sKQ023454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 1 Oct 2011 07:02:54 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p91B2ph5028977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 1 Oct 2011 07:02:53 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p91B2omv019796; Sat, 1 Oct 2011 13:02:50 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p91B2oV1019795; Sat, 1 Oct 2011 13:02:50 +0200 Date: Sat, 01 Oct 2011 11:03:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Phil Muldoon , Paul Koning Subject: Re: Python: fetch value when building gdb.Value object Message-ID: <20111001110250.GA18699@host1.jankratochvil.net> References: <36B29E9D-F2B3-446F-AF8A-97254A3AAEE2@comcast.net> <20111001092852.GB11227@host1.jankratochvil.net> <201110011122.46865.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201110011122.46865.pedro@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2011-10/txt/msg00009.txt.bz2 On Sat, 01 Oct 2011 12:22:46 +0200, Pedro Alves wrote: > On Saturday 01 October 2011 10:28:52, Jan Kratochvil wrote: > > # Test memory error. > > gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" > > + gdb_test "python inval = gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" > > I see this is already the case, but just a reminder that this will fail > (or rather the write will succeed) on targets without an MMU. We should > skip it with something like: So checked it in (I am aware the existing code elsewhere in GDB testsuite is a bit different). Thanks, Jan http://sourceware.org/ml/gdb-cvs/2011-10/msg00002.html --- src/gdb/testsuite/ChangeLog 2011/09/30 15:07:32 1.2867 +++ src/gdb/testsuite/ChangeLog 2011/10/01 11:02:10 1.2868 @@ -1,3 +1,12 @@ +2011-10-01 Jan Kratochvil + Pedro Alves + + * gdb.python/py-value.exp (test_value_in_inferior): New variable + can_read_0, test for it. + (python print gdb.parse_and_eval('*(int*)0')): Rename to ... + (parse_and_eval with memory error): ... here, make it untested if + can_read_0. + 2011-09-30 Marek Polacek * gdb.python/python.exp (verify pagination beforehand) --- src/gdb/testsuite/gdb.python/py-value.exp 2011/07/26 18:38:55 1.22 +++ src/gdb/testsuite/gdb.python/py-value.exp 2011/10/01 11:02:11 1.23 @@ -216,8 +216,25 @@ # Test address attribute gdb_test "python print 'result =', arg0.address" "= 0x\[\[:xdigit:\]\]+" "Test address attribute" + # Test displaying a variable that is temporarily at a bad address. + # But if we can examine what's at memory address 0, then we'll also be + # able to display it without error. Don't run the test in that case. + set can_read_0 0 + gdb_test_multiple "x 0" "memory at address 0" { + -re "0x0:\[ \t\]*Cannot access memory at address 0x0\r\n$gdb_prompt $" { } + -re "0x0:\[ \t\]*Error accessing memory address 0x0\r\n$gdb_prompt $" { } + -re "\r\n$gdb_prompt $" { + set can_read_0 1 + } + } + # Test memory error. - gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" + set test "parse_and_eval with memory error" + if {$can_read_0} { + untested $test + } else { + gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test + } # Test string fetches, both partial and whole. gdb_test "print st" "\"divide et impera\""