* [PATCH] Make gdb1476.exp more robust
@ 2004-01-07 22:13 Mark Kettenis
2004-01-07 22:41 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2004-01-07 22:13 UTC (permalink / raw)
To: gdb-patches
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"
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Make gdb1476.exp more robust
2004-01-07 22:13 [PATCH] Make gdb1476.exp more robust Mark Kettenis
@ 2004-01-07 22:41 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-01-07 22:41 UTC (permalink / raw)
To: gdb-patches
On Wed, Jan 07, 2004 at 11:13:44PM +0100, Mark Kettenis wrote:
> 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.
I suppose that's some incentive for me to fix gdbserver... it currently
allows invalid reads.
> +# 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,
Typo, probably.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-07 22:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-07 22:13 [PATCH] Make gdb1476.exp more robust Mark Kettenis
2004-01-07 22:41 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox