From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19101 invoked by alias); 7 Jan 2004 22:13:48 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19080 invoked from network); 7 Jan 2004 22:13:46 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 7 Jan 2004 22:13:46 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i07MDjd8000472 for ; Wed, 7 Jan 2004 23:13:45 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i07MDiRn014227 for ; Wed, 7 Jan 2004 23:13:44 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i07MDiD1014224; Wed, 7 Jan 2004 23:13:44 +0100 (CET) Date: Wed, 07 Jan 2004 22:13:00 -0000 Message-Id: <200401072213.i07MDiD1014224@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Make gdb1476.exp more robust X-SW-Source: 2004-01/txt/msg00177.txt.bz2 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 * 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"