From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18896 invoked by alias); 5 Nov 2003 23:11:38 -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 18886 invoked from network); 5 Nov 2003 23:11:37 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 5 Nov 2003 23:11:37 -0000 Received: by localhost.redhat.com (Postfix, from userid 469) id 203FD1A4291; Wed, 5 Nov 2003 18:11:37 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16297.33705.511.693199@localhost.redhat.com> Date: Wed, 05 Nov 2003 23:11:00 -0000 To: Grant Edwards Cc: Doug Evans , "Newman, Mark (N-Superior Technical Resource Inc)" , gdb@sources.redhat.com Subject: Re: filtering of commands during async operation In-Reply-To: <20031105220245.GA4424@grante.dsl.visi.com> References: <16297.28959.958906.509597@casey.transmeta.com> <20031105220245.GA4424@grante.dsl.visi.com> X-SW-Source: 2003-11/txt/msg00045.txt.bz2 Grant Edwards writes: > > > 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 > > Why not just strcmp() ? > > if (strcmp() > && strcmp() > && strcmp()) > Whoops. I agree, this is screwed up. I'll just make the fix now, no need to file a bug report. I am curious, did somebody get async native to work? So far there is only the remote async target. I do remember testing this, back 4 years ago, maybe the logic got turned around at some point. I think strcmp != 0 is ok. It is the preferred form in gdb. Is this in the ARI? mmmm... partially it is. It is not flagged in the counts though. elena