From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Phil Muldoon <pmuldoon@redhat.com>,
Paul Koning <paulkoning@comcast.net>
Subject: Re: Python: fetch value when building gdb.Value object
Date: Sat, 01 Oct 2011 11:03:00 -0000 [thread overview]
Message-ID: <20111001110250.GA18699@host1.jankratochvil.net> (raw)
In-Reply-To: <201110011122.46865.pedro@codesourcery.com>
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 <jan.kratochvil@redhat.com>
+ Pedro Alves <pedro@codesourcery.com>
+
+ * 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 <mpolacek@redhat.com>
* 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\""
next prev parent reply other threads:[~2011-10-01 11:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 16:17 Paul Koning
2011-09-28 19:29 ` Phil Muldoon
2011-09-28 20:06 ` Paul Koning
2011-10-04 15:43 ` Tom Tromey
2011-09-28 20:42 ` Paul Koning
2011-10-01 9:05 ` Jan Kratochvil
2011-10-03 10:22 ` Phil Muldoon
2011-10-04 15:40 ` Tom Tromey
2011-10-01 9:29 ` Jan Kratochvil
2011-10-01 10:23 ` Pedro Alves
2011-10-01 11:03 ` Jan Kratochvil [this message]
2011-10-01 12:17 ` Python: fetch value when building gdb.Value object [rediff] Jan Kratochvil
2011-10-01 18:58 ` Paul Koning
2011-10-03 10:19 ` Phil Muldoon
2011-10-03 16:16 ` Paul Koning
2011-10-01 1:00 ` [PING] [RFA] Re: Python: fetch value when building gdb.Value object Paul Koning
2011-10-04 15:45 ` Tom Tromey
2011-10-04 15:51 ` Paul Koning
2011-10-14 20:03 ` Tom Tromey
2011-10-14 20:30 ` Paul Koning
2011-10-19 20:56 ` Tom Tromey
2011-10-19 20:58 ` Paul Koning
2011-10-20 15:09 ` Tom Tromey
2011-10-21 7:46 ` Paul Koning
2011-10-21 17:13 ` Tom Tromey
2011-10-14 23:36 ` Jim Blandy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111001110250.GA18699@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=paulkoning@comcast.net \
--cc=pedro@codesourcery.com \
--cc=pmuldoon@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox