From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16985 invoked by alias); 5 Nov 2003 21:52:58 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 16978 invoked from network); 5 Nov 2003 21:52:57 -0000 Received: from unknown (HELO neon-gw.transmeta.com) (63.209.4.196) by sources.redhat.com with SMTP; 5 Nov 2003 21:52:57 -0000 Received: (from root@localhost) by neon-gw.transmeta.com (8.9.3/8.9.3) id NAA14766; Wed, 5 Nov 2003 13:52:51 -0800 Received: from mailhost.transmeta.com(10.1.1.15) by neon-gw.transmeta.com via smap (V2.1) id xma014758; Wed, 5 Nov 03 13:52:27 -0800 Received: from casey.transmeta.com (casey.transmeta.com [10.10.25.22]) by deepthought.transmeta.com (8.11.6/8.11.6) with ESMTP id hA5LqWM19787; Wed, 5 Nov 2003 13:52:32 -0800 (PST) Received: (from dje@localhost) by casey.transmeta.com (8.9.3/8.7.3) id NAA23647; Wed, 5 Nov 2003 13:52:32 -0800 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16297.28959.958906.509597@casey.transmeta.com> Date: Wed, 05 Nov 2003 21:52:00 -0000 To: "Newman, Mark (N-Superior Technical Resource Inc)" Cc: gdb@sources.redhat.com Subject: filtering of commands during async operation In-Reply-To: References: X-SW-Source: 2003-11/txt/msg00042.txt.bz2 Newman, Mark (N-Superior Technical Resource Inc) writes: > > In top.c there is an attempt to filter what commands can be issued during async operation. That code is not filtering (at least under RH on an Intel box). The code is > > if (event_loop_p && target_can_async_p () && target_executing) > if (!strcmp (c->name, "help") > && !strcmp (c->name, "pwd") > && !strcmp (c->name, "show") > && !strcmp (c->name, "stop")) > error ("Cannot execute this command while the target is running."); Good example of why it's useful to avoid using ! with strcmp. > The code should be: > > if (event_loop_p && target_can_async_p () && target_executing) { > if (!(strcmp (c->name, "help") == 0) > && !(strcmp (c->name, "pwd") == 0) > && !(strcmp (c->name, "show") == 0) > && !(strcmp (c->name, "stop") == 0)) { > error ("Cannot execute this command while the target is running."); > } > } > > Unless someone objects I am going to put in a bug report and a patch. Why not just strcmp () != 0