From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20840 invoked by alias); 28 May 2014 20:44:32 -0000 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 Received: (qmail 20828 invoked by uid 89); 28 May 2014 20:44:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f50.google.com Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 28 May 2014 20:44:31 +0000 Received: by mail-wg0-f50.google.com with SMTP id x12so11693256wgg.21 for ; Wed, 28 May 2014 13:44:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=v+4xwoVfQIv9FnhlESm9q2j44+Nyu9bHGBBuS1pOWpQ=; b=PRM2bp9IVlksGjRtabprcT4ePJVsS4raOui8cTF3dPDEU/2Dl/rBa2vnOFKyhcuKrP NgbpqYOJrcMoGArSYroFFyoaZ3HLCYYiFi4xrK3IUihCMRHT+mxD8RevhfVmz7B/X2av hY0dY5CTEAgkxrGUZqNGCrsOjM4oLKFkwnAuJA/jlb9t8no8ZQMw498TJFzoZaBq6gVV Q0AHvYk2AfvG7XNnGF6ogFha5Vb1SipY0ZKZvEQgppXU6ButahuYYPY3akL2j0cQzkgb CfKdrq6HZgnNIEflmgRG5AwZApePedOIss2RLKy8ysA8fl/PBZcO7Bq6Ige4oIXGKJ5t uU0w== X-Gm-Message-State: ALoCoQmcmDv6k0BEIzEpJ0dAXtJNWZ6luHGvr1d2hmqJWDbGIut9VTnRGliIBaVxrBB9Q3qCS9WX MIME-Version: 1.0 X-Received: by 10.194.22.100 with SMTP id c4mr2879969wjf.89.1401309866616; Wed, 28 May 2014 13:44:26 -0700 (PDT) Received: by 10.217.51.7 with HTTP; Wed, 28 May 2014 13:44:26 -0700 (PDT) In-Reply-To: References: Date: Wed, 28 May 2014 20:44:00 -0000 Message-ID: Subject: Re: [Patch v18 4/4] Add xmethod support to the Python API From: Siva Chandra To: Doug Evans Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00704.txt.bz2 On Tue, May 27, 2014 at 10:02 PM, Doug Evans wrote: > Ok, let's do this. > > extension.c:invoke_xmethod will throw an error if this function > returns EXT_LANG_RC_ERROR: > > if (rc == EXT_LANG_RC_ERROR) > { > error (_("Error while invoking a xmethod defined in %s"), > worker->extlang->capitalized_name); > } I did not understand this part. Since you suggest below that gdbpy_invoke_xmethod return value * and throw GDB errors for Python errors as well, where would invoke_xmethod get RC from? > > So there's no real difference between a gdb-detected error in, say, > value_cast and a python-detected error from invoking the xmethod. > So why not have gdbpy_invoke_xmethod return a struct value *, > and if a python error is detected then throw a gdb error. > > IOW: > > struct value * > gdbpy_invoke_xmethod (const struct extension_language_defn *extlang, > struct xmethod_worker *worker, > struct value *obj, struct value **args, int nargs) > { > ... > if (error_return_from_python) > { > gdbpy_print_stack (); > error (_("Error while executing Python code.")); > } > ... > }