This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR testsuite/1504


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"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]