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] Make gdb1476.exp more robust
Date: Wed, 07 Jan 2004 22:13:00 -0000	[thread overview]
Message-ID: <200401072213.i07MDiD1014224@elgar.kettenis.dyndns.org> (raw)

Peter Schauer pointed out to me that excuting code at address 0 might
have ill effects on targets that don't have an MMU.  He suggested
testing whether we could read from that address, and only run the
tests if we can't.

This makes sense to me, so I checked this patch in.

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

	* gdb.base/gdb1476.exp: Only run the tests if we can't read the
	memory at address 0.

Index: gdb.base/gdb1476.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gdb1476.exp,v
retrieving revision 1.1
diff -u -p -r1.1 gdb1476.exp
--- gdb.base/gdb1476.exp 5 Jan 2004 22:55:33 -0000 1.1
+++ gdb.base/gdb1476.exp 7 Jan 2004 22:07:02 -0000
@@ -48,6 +48,21 @@ if ![runto_main] then {
     gdb_suppress_tests
 }
 
+# If we can examine what's at memory address 0, it is possible that we
+# could also execute it.  This could pobably make us run away,
+# executing random code, which could have all sorts of ill effects,
+# especially on targets without an MMU.  Don't run the tests in that
+# case.
+
+send_gdb "x 0\n"
+gdb_expect {
+    -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
+    -re ".*$gdb_prompt $" {
+	untested "Memory at address 0 is possibly executable"
+	return
+    }
+}
+
 gdb_test "continue" "Program received signal SIGSEGV.*" \
 	"continue to null pointer call"
 


             reply	other threads:[~2004-01-07 22:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 22:13 Mark Kettenis [this message]
2004-01-07 22:41 ` Daniel Jacobowitz

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=200401072213.i07MDiD1014224@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