Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix PR testsuite/1504
Date: Sun, 18 Jan 2004 18:35:00 -0000	[thread overview]
Message-ID: <200401181835.i0IIZcwu054181@elgar.kettenis.dyndns.org> (raw)

Turns out there is an inconsistency between platforms in the error
message one gets when reading from a bit of memory that isn't
readable:

void
memory_error (int status, CORE_ADDR memaddr)
{
  struct ui_file *tmp_stream = mem_fileopen ();
  make_cleanup_ui_file_delete (tmp_stream);

  if (status == EIO)
    {
      /* Actually, address between memaddr and memaddr + len
         was out of bounds. */
      fprintf_unfiltered (tmp_stream, "Cannot access memory at address ");
      print_address_numeric (memaddr, 1, tmp_stream);
    }
  else
    {
      fprintf_filtered (tmp_stream, "Error accessing memory address ");
      print_address_numeric (memaddr, 1, tmp_stream);
      fprintf_filtered (tmp_stream, ": %s.",
                       safe_strerror (status));
    }

  error_stream (tmp_stream);
}

I wonder whether we should try to unify this.  In the meantime, this
patch fixes the fall-out in the testsuite.

Mark


Index: testsuite/ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* gdb.base/gdb1476.exp: Accept alternat pattern for failed memory
	read at address 0.  This fixes PR testsuite/1504.

Index: testsuite/gdb.base/gdb1476.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gdb1476.exp,v
retrieving revision 1.3
diff -u -p -r1.3 gdb1476.exp
--- testsuite/gdb.base/gdb1476.exp 9 Jan 2004 16:43:05 -0000 1.3
+++ testsuite/gdb.base/gdb1476.exp 18 Jan 2004 15:55:05 -0000
@@ -56,6 +56,7 @@ if ![runto_main] then {
 
 send_gdb "x 0\n"
 gdb_expect {
+    -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
     -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
     -re ".*$gdb_prompt $" {
 	untested "Memory at address 0 is possibly executable"
@@ -68,4 +69,4 @@ gdb_test "continue" "Program received si
 
 gdb_test "backtrace 10" \
 	"#0\[ \t\]*0x0* in .*\r\n#1\[ \t\]*$hex in x.*\r\n#2\[ \t\]*$hex in main.*" \
-	"backtrace from null pointer call"
\ No newline at end of file
+	"backtrace from null pointer call"


             reply	other threads:[~2004-01-18 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-18 18:35 Mark Kettenis [this message]
2004-01-18 18:51 ` Andrew Cagney

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=200401181835.i0IIZcwu054181@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=gdb-patches@sources.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