From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 817 invoked by alias); 25 Nov 2009 17:59:23 -0000 Received: (qmail 808 invoked by uid 22791); 25 Nov 2009 17:59:23 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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; Wed, 25 Nov 2009 17:59:15 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAPHwWhQ013668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 Nov 2009 12:58:32 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAPHwV3J018203; Wed, 25 Nov 2009 12:58:31 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id nAPHwTXu016393; Wed, 25 Nov 2009 12:58:30 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 67631C8816A; Wed, 25 Nov 2009 10:58:29 -0700 (MST) From: Tom Tromey To: Joel Brobecker Cc: Hui Zhu , "gdb-patches\@sourceware.org" , Michael Snyder Subject: Re: [RFA] let record_resume fail immediately on error References: <4AF07CF2.1050902@vmware.com> <20091125162458.GF26004@adacore.com> Reply-To: Tom Tromey Date: Wed, 25 Nov 2009 17:59:00 -0000 In-Reply-To: <20091125162458.GF26004@adacore.com> (Joel Brobecker's message of "Wed, 25 Nov 2009 08:24:58 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-11/txt/msg00552.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: >> I don't like use TRY_CATCH or catch_errors directly. Joel> I confess that I don't like catch_errors, because of the need to Joel> artificially create a container type that contains all the function Joel> parameters. In this code, we already have the container type and untyped trampoline function. The problem I have with it is that there are direct calls to the untyped trampoline function. I think the general approach for using catch_errors in gdb ought to be: * Have a properly-typed function that does all the work. * If you need catch_errors, introduce a new type to hold the actual arguments, and write an untyped trampoline function. Then, *only* call this trampoline function via catch_errors. * ... However, prefer TRY_CATCH in most cases, because it does not require a new type and is generally safer (though not completely safe). And FWIW, I think this rule is generally followed in practice. My reason for the above is that it is generally best to write a type-safe program and let the compiler diagnose errors. We can't do this for catch_errors, due to limitations in C, but we can at least limit the damage. Also, this patch introduces an argument indicating whether or not to catch. This is bad, because it is confusing, but also particularly bad in this case because the actual argument is always a constant. Tom