Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix PR testsuite/1504
@ 2004-01-18 18:35 Mark Kettenis
  2004-01-18 18:51 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2004-01-18 18:35 UTC (permalink / raw)
  To: gdb-patches

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"


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR testsuite/1504
  2004-01-18 18:35 [PATCH] Fix PR testsuite/1504 Mark Kettenis
@ 2004-01-18 18:51 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2004-01-18 18:51 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> 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.

Yes, definitly.  Kfail instead - that would flush out those cases?

Andrew



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-18 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-18 18:35 [PATCH] Fix PR testsuite/1504 Mark Kettenis
2004-01-18 18:51 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox