From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19885 invoked by alias); 15 Feb 2003 11:01:46 -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 19877 invoked from network); 15 Feb 2003 11:01:44 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (62.163.169.212) by 172.16.49.205 with SMTP; 15 Feb 2003 11:01:44 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6/8.12.5) with ESMTP id h1FB1hqC000350 for ; Sat, 15 Feb 2003 12:01:43 +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.6/8.12.6) with ESMTP id h1FB1hc8000506 for ; Sat, 15 Feb 2003 12:01:43 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6/8.12.6/Submit) id h1FB1hgH000503; Sat, 15 Feb 2003 12:01:43 +0100 (CET) Date: Sat, 15 Feb 2003 11:01:00 -0000 Message-Id: <200302151101.h1FB1hgH000503@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [RFA] Testsuite: fix attach.exp test for FreeBSD 5.0 X-SW-Source: 2003-02/txt/msg00341.txt.bz2 This fixes some testsuite failures on FreeBSD 5.0, where PID 0 is an existing process. I also tweaked the comments a bit such that they don't imply that the various pattaerns are completely HP-specific. OK to check this in? Mark Index: ChangeLog from Mark Kettenis * gdb.base/attach.exp: When trying to attach to a nonexistent process, make it possible to specify the PID based on the target. Index: gdb.base/attach.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/attach.exp,v retrieving revision 1.8 diff -u -p -r1.8 attach.exp --- gdb.base/attach.exp 22 Dec 2002 23:53:48 -0000 1.8 +++ gdb.base/attach.exp 15 Feb 2003 10:59:35 -0000 @@ -106,30 +106,39 @@ proc do_attach_tests {} { } # Verify that we cannot attach to what appears to be a valid - # process ID, but is a process that doesn't exist. (I don't - # believe any process is ever assigned #0, at least on HPUX.) + # process ID, but is a process that doesn't exist. Traditionally, + # most systems didn't have a process with ID 0, so we take that as + # the default. However, there are a few exceptions. # - send_gdb "attach 0\n" + set boguspid 0 + if { [istarget "*-*-freebsd*"] } { + # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead + # (which should have the desired effect on any version of FreeBSD). + set boguspid -1 + } + send_gdb "attach $boguspid\n" gdb_expect { - -re "Attaching to.*, process 0.*No such process.*$gdb_prompt $"\ - { - # Response expected on HP-UX 10.20 (i.e., ptrace-based). - pass "attach to nonexistent process is prohibited" - } - -re "Attaching to.*, process 0 failed.*Hint.*$gdb_prompt $"\ - { - # Response expected on HP-UX 11.0 (i.e., ttrace-based). - pass "attach to nonexistent process is prohibited" - } - -re "Attaching to.*, process 0.*denied.*$gdb_prompt $"\ - {pass "attach to nonexistent process is prohibited"} - -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ - { - # Response expected from /proc-based systems. - pass "attach to nonexistent process is prohibited" - } - -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} - timeout {fail "(timeout) attach to nonexistent process is prohibited"} + -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\ + { + # Response expected on ptrace-based systems (i.e. HP-UX 10.20). + pass "attach to nonexistent process is prohibited" + } + -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\ + { + # Response expected on ttrace-based systems (i.e. HP-UX 11.0). + pass "attach to nonexistent process is prohibited" + } + -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\ + {pass "attach to nonexistent process is prohibited"} + -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ + { + # Response expected from /proc-based systems. + pass "attach to nonexistent process is prohibited" + } + -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} + timeout { + fail "(timeout) attach to nonexistent process is prohibited" + } } # Verify that we can attach to the process by first giving its