From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5846 invoked by alias); 19 Sep 2008 22:02:11 -0000 Received: (qmail 5838 invoked by uid 22791); 19 Sep 2008 22:02:10 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 19 Sep 2008 22:01:32 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id A59CD104AC; Fri, 19 Sep 2008 22:01:29 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 6E7F11049B; Fri, 19 Sep 2008 22:01:29 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1Kgo2a-00074W-QR; Fri, 19 Sep 2008 18:01:28 -0400 Date: Fri, 19 Sep 2008 22:02:00 -0000 From: Daniel Jacobowitz To: Tom Tromey Cc: Paul Pluzhnikov , gdb-patches@sourceware.org Subject: Re: GDB aborts on missing command args. Which way to fix? Message-ID: <20080919220128.GA27150@caradoc.them.org> Mail-Followup-To: Tom Tromey , Paul Pluzhnikov , gdb-patches@sourceware.org References: <8ac60eac0809161049t6bd917bbk8127317a7d8b42cb@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2008-05-11) 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: 2008-09/txt/msg00424.txt.bz2 On Fri, Sep 19, 2008 at 03:50:03PM -0600, Tom Tromey wrote: > >>>>> "Paul" == Paul Pluzhnikov writes: > > Paul> There are many instances of calls to buildargv() which aren't > Paul> protected by 'if (args != NULL)', and cause gdb to abort. > [...] > Paul> I can fix this by adding the 'if (args != NULL)' checks everywhere, > Paul> or by switching to 'buildargv_not_null(args, "appropriate missing > Paul> argument error")' > > Paul> Which way is preferred? (I prefer the second way). > > That seems reasonable to me. > > I think you might as well make it call nomem if the result is NULL, > too. I don't like passing error messages to functions that might fail; I find it very confusing. If you want to give usage errors, why not combine it with the existing checks for wrong arguments? Tom's got a good point about nomem, though. -- Daniel Jacobowitz CodeSourcery