From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6543 invoked by alias); 21 Dec 2010 17:33:42 -0000 Received: (qmail 6513 invoked by uid 22791); 21 Dec 2010 17:33:39 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Dec 2010 17:33:31 +0000 Received: from wpaz17.hot.corp.google.com (wpaz17.hot.corp.google.com [172.24.198.81]) by smtp-out.google.com with ESMTP id oBLHXRbN001160 for ; Tue, 21 Dec 2010 09:33:28 -0800 Received: from qyk7 (qyk7.prod.google.com [10.241.83.135]) by wpaz17.hot.corp.google.com with ESMTP id oBLHWaYo003053 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Tue, 21 Dec 2010 09:33:26 -0800 Received: by qyk7 with SMTP id 7so4946740qyk.0 for ; Tue, 21 Dec 2010 09:33:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.3.4 with SMTP id 4mr5476106qal.127.1292952806487; Tue, 21 Dec 2010 09:33:26 -0800 (PST) Received: by 10.220.66.13 with HTTP; Tue, 21 Dec 2010 09:33:26 -0800 (PST) In-Reply-To: References: Date: Tue, 21 Dec 2010 17:33:00 -0000 Message-ID: Subject: Re: [patch] Add an evaluation function hook to Python breakpoints. From: Doug Evans To: Tom Tromey Cc: pmuldoon@redhat.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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: 2010-12/txt/msg00381.txt.bz2 On Wed, Dec 15, 2010 at 12:57 PM, Tom Tromey wrote: > Tom> Having two methods seems worse to me. =A0It is more complicated with= out > Tom> any added benefits. > > Doug> One thought I had was that maybe one might have a situation where i= t'd > Doug> be useful to run all the collect methods first, and then run all the > Doug> stop_p methods. > > Could you give an example? Nothing specific, it was just a thought. > Doug> Plus I still like the API design of keeping data collection separate > Doug> from stop/don't-stop. > > Can you say why? They're orthogonal requests, and I've had better success with keeping such things separate. [But as I say, since they are orthogonal requests, one could add a data-collection API in a separate patch.] > Doug> Btw, if some mutex-checker or whatever detected a condition that it > Doug> wanted to report to the user, IWBN to be able to throw an error that > Doug> some higher level construct could recognize and deal with. > Doug> Is a simple boolean result from stop_p (I'm only calling that for > Doug> clarity's sake) going to be sufficient? > > I don't understand. =A0What higher level are you thinking of? > Could you give an example of when we would want to throw an exception > and what that would mean? [For reference sake, this subthread isn't about an either/or choice of stop_p or something else. stop_p is sufficient for some uses.] For checkers for rule violations (and such) it's nice to stop the program and notify the user (obviously). It's also nice for a script driving the program (say in automated tests) to know why the program stopped (e.g. you might want to take different actions, e.g. to further isolate the cause). For example, what happens after a checker employing stop_p says "stop"? There's nothing more in the API that helps the user know *why* the checker said "stop". At the moment the API doesn't provide anything. Checkers will have to print an error message, but I have a feeling something more will be useful. [Did you have something in mind, or am I missing something?] One thought, and it's just a thought, is to treat rule violations like segv's. One could do that in various ways, I'm not suggesting a particular implementation. But some of the aspects of getting a segv are useful here. E.g., the program can't be resumed until the rule violation is fixed, and the reason why the program has stopped is encoded in the program's state.