From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73330 invoked by alias); 22 Jul 2016 10:22: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 73313 invoked by uid 89); 22 Jul 2016 10:22:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=handed X-HELO: mail-io0-f169.google.com Received: from mail-io0-f169.google.com (HELO mail-io0-f169.google.com) (209.85.223.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 22 Jul 2016 10:22:21 +0000 Received: by mail-io0-f169.google.com with SMTP id 38so101301956iol.0 for ; Fri, 22 Jul 2016 03:22:21 -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:from:date :message-id:subject:to:cc; bh=80s3vh/JHZkY4tWngaYrc2rRlI7LoKgfC7B1sBTVUHo=; b=j8FcDzdCi7a9sjSjV33DPdD9RQXq+mMTcaZjl3hM+IBtuYoY74szlb+rrtbGljtEhj NVxqFvwiIISTUkpVm3mIOWTvsJTJ/xq8oPxWsapW6GywjVwHroK8OoU0C7+F+7F9FWhY mXBNuIy9OChnVJIcV35qA4Do5gTCQvFkZbXx3aEPdUskGRetkftjx1Qc1RyESSkhIyfS 3T5Iih0wrfmlDKvT/xFd1WOyvBQuGEGC5g6mBbdDMs6gBYgG0GX4w3TuOhSbkdWeeiYd 3Cz2HfUDqBZcG26nLuAo3e+2FqjGDgNUkzXI6DRD44OVQCFd2ojPbdYmgPj2gvcCCWdk Q8+Q== X-Gm-Message-State: AEkoouvwbh6lKrLiu2atNfSwPy7DZe2e1BVOwb2LJg1tdcggy12xnH+PG1J99WFUJvYaPqlOYpwrUYpAYQfT0w== X-Received: by 10.107.15.218 with SMTP id 87mr4338977iop.0.1469182939178; Fri, 22 Jul 2016 03:22:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.140.9 with HTTP; Fri, 22 Jul 2016 03:22:18 -0700 (PDT) In-Reply-To: References: <1463806850-11001-1-git-send-email-tom@tromey.com> From: Matt Rice Date: Fri, 22 Jul 2016 10:22:00 -0000 Message-ID: Subject: Re: [RFA] PR python/13598 - add before_prompt event To: Yao Qi Cc: Tom Tromey , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00287.txt.bz2 On Fri, Jul 22, 2016 at 3:01 AM, Yao Qi wrote: > Hi Tom, > > On Sat, May 21, 2016 at 6:00 AM, Tom Tromey wrote: >> This adds an event that is emitted just before GDB presents a prompt >> to the user. This provides Python code a way to react to whatever >> changes might have been made by the previous command. For example, in >> my GUI I use this to track changes to the selected frame and reflect >> them in the UI. > > I read this patch multiple times, but don't know the motivation of adding this > event. In PR python/13598, you mentioned you want to get event when > something is changed. If so, why don't you add the python event for the changes > you are interested in? What is your use case of using python code in GDB? FWIW, I have long used or more precisely abused the prompt_hook function for controlling vi by vi --remote to have an editor that tracks the current file/line which gdb is stopped at, a mechanism for this which doesn't abuse the actual prompt string formatting functions by producing some side-effect before returning the prompt string. such as that proposed by Tom would be nice. in particular abusing the prompt_hook in this fashion inhibits the ability to use the python extended-prompt stuff for controlling the prompt, because the extended-prompt stuff uses the prompt_hook itself! In particular it's just a nice time to take a snapshot of some otherwise obtainable property from gdb right before control is handed back to the user.