From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9052 invoked by alias); 30 Apr 2008 16:22:03 -0000 Received: (qmail 9042 invoked by uid 22791); 30 Apr 2008 16:22:02 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Apr 2008 16:21:45 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 858EB2A98A6; Wed, 30 Apr 2008 12:21:43 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jDKk5FX+fukW; Wed, 30 Apr 2008 12:21:43 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 466102A98A0; Wed, 30 Apr 2008 12:21:43 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 0CDEBE7ACD; Wed, 30 Apr 2008 09:21:41 -0700 (PDT) Date: Wed, 30 Apr 2008 18:27:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: Thiago Jung Bauermann , gdb-patches@sourceware.org Subject: Re: [RFC][patch 3/9] export hooks mechanism to Python Message-ID: <20080430162140.GA3801@adacore.com> References: <20080429155212.444237503@br.ibm.com> <20080429155304.641779989@br.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i 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-04/txt/msg00707.txt.bz2 > The Python code installs hooks so that users can write Python that > reacts to gdb events. I wasn't sure what would be an acceptable > approach here, and for the short term I just disabled this code. But, > this is not a good solution. > > A lot of this stuff is marked deprecated. Why is that? Is there some > other approach the Python code should use instead? I am not 100% sure why these hooks were marked as deprecated, I haven't checked the exact history, but if these are meant to be called when something specific happens, we prefer now to use "observers". With hooks, you can have only one user of the hook - although we did manage to get around this limitation with a little tap dance but that was hardly satisfactory. Observers are a relatively recent addition to our code compared to these hooks - see doc/observer.texi, and the generated file observer.h (and observer-inc.c I think). The generation is performed by observer.sh. Since you need to be able to write some python code that "reacts to *GDB events*", I think that observers are exactly what you are looking for. -- Joel