From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21836 invoked by alias); 15 Mar 2011 12:51:17 -0000 Received: (qmail 21826 invoked by uid 22791); 15 Mar 2011 12:51:17 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Mar 2011 12:51:12 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2FCp3aX025096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Mar 2011 08:51:04 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2FCoxRl021654; Tue, 15 Mar 2011 08:51:02 -0400 From: Phil Muldoon To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [patch] gdb_unload - account for another termination message References: <201103151219.11392.pedro@codesourcery.com> Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Tue, 15 Mar 2011 14:06:00 -0000 In-Reply-To: <201103151219.11392.pedro@codesourcery.com> (Pedro Alves's message of "Tue, 15 Mar 2011 12:19:11 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00770.txt.bz2 Pedro Alves writes: > On Tuesday 15 March 2011 10:56:31, Phil Muldoon wrote: >> >> While working on another bug I attempted to use gdb_unload in the >> testsuite. I noticed that it did not account for a termination >> message. (This was the one message I was getting). This would lead to a >> timeout and failure. Is it ok to just add another -re test in the >> original test here? > > The current code reads: > > proc gdb_unload {} { > global verbose > global GDB > global gdb_prompt > send_gdb "file\n" > gdb_expect 60 { > -re "No executable file now\[^\r\n\]*\[\r\n\]" { exp_continue } > -re "No symbol file now\[^\r\n\]*\[\r\n\]" { exp_continue } > -re "A program is being debugged already..*Kill it.*y or n. $"\ > { send_gdb "y\n" > verbose "\t\tKilling previous program being debugged" > exp_continue > } > > I don't think the "Kill it" message can ever appear in response > to a "file" command. This may be old behavior. I'd rather we > replace this part with current reality. Yeah I just wasn't sure here, I did the grep before I wrote the patch: [pmuldoon@localhost gdb]$ egrep -irs "A program is being debugged" *.c exec.c:326: && !query (_("A program is being debugged already.\n" infcmd.c:2433: if (query (_("A program is being debugged already. Kill it? "))) target.c:2446: || query (_("A program is being debugged already. Kill it? "))) And there are three exit points. I thought briefly about standardizing the message. Anyway, I'll replace the old message in gdb_unload. > The full message I see is: > > (top-gdb) file gdb > A program is being debugged already. > Are you sure you want to change the file? (y or n) > > So please adjust the regex to catch the whole frase, > not just the "Are you sure" part, which could paper > over other questions. Also, "Killing previous program..." isn't > what answering 'y' does. >From my previous grep that could be the only response. But I take your point well (and caution here costs nothing). I see no need for the verbose, tbh. I'm not sure why I put it there. -- diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1b601af..0d29428 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -137,9 +137,8 @@ proc gdb_unload {} { gdb_expect 60 { -re "No executable file now\[^\r\n\]*\[\r\n\]" { exp_continue } -re "No symbol file now\[^\r\n\]*\[\r\n\]" { exp_continue } - -re "A program is being debugged already..*Kill it.*y or n. $"\ - { send_gdb "y\n" - verbose "\t\tKilling previous program being debugged" + -re "A program is being debugged already.*Are you sure you want to change the file?.*y or n. $" { + send_gdb "y\n" exp_continue } -re "Discard symbol table from .*y or n.*$" {