From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21670 invoked by alias); 2 Sep 2011 17:22:22 -0000 Received: (qmail 21650 invoked by uid 22791); 2 Sep 2011 17:22:20 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Sep 2011 17:22:06 +0000 Received: (qmail 13556 invoked from network); 2 Sep 2011 17:22:05 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 2 Sep 2011 17:22:05 -0000 From: Pedro Alves To: pmuldoon@redhat.com Subject: Re: [patch] [python] Prompt substitution Date: Fri, 02 Sep 2011 17:41:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.0; x86_64; ; ) Cc: gdb-patches@sourceware.org, Tom Tromey References: <201108302118.18505.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109021822.02655.pedro@codesourcery.com> 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: 2011-09/txt/msg00039.txt.bz2 On Tuesday 30 August 2011 21:33:24, Phil Muldoon wrote: > Pedro Alves writes: > > > On Wednesday 20 July 2011 12:33:24, Phil Muldoon wrote: > >> +gdb_test_multiple "set prompt blah " "set blah in GDB" { > >> + -re "\[\r\n\]$newprompt2 $" { > >> + pass "set prompt blah overriden" > >> + } > >> +} > >> + > >> +gdb_test_multiple "python gdb.prompt_hook = None" "Delete hook" { > >> + -re "\[\r\n\]$newprompt2 $" { > >> + pass "Delete old hook" > >> + } > >> +} > > > > Hmm: > > > > ... > > PASS: gdb.python/python.exp: show prompt shows guarded prompt > > set prompt blah > > py prompt 2 PASS: gdb.python/python.exp: set prompt blah overriden > > python gdb.prompt_hook = None > > py prompt 2 PASS: gdb.python/python.exp: Delete old hook > > > > I think this last PASS is actually a bug. We've disabled the python > > hook, so we should get the "set prompt" prompt back ("blah") > > instead of still seeing the python prompt. Agree? > > > > (My WIP no-prompt-stack patch turned that into a FAIL, > > but it looks like it's a bug fix, not a regression.) > > I think in the case, display_gdb_prompt is just displaying what GDB > knows to be the prompt. If you delete the hook, whatever was the prompt > when the prompt was set will remain the prompt. So the hook set the > prompt whenever in time, and when you delete the hook, it won't restore > what the old prompt was. So if you disable the prompt, then set prompt > foo, then you will get "foo" now until you change it again manually. In > the case of "guarded prompt" (IE >) it won't attempt to alter that > display at all. I see. I assumed that the python hook worked by overriding "set prompt", but that the result wouldn't be seen by "show prompt". That is, set/show prompt always worked at the "this is what I want the prompt to look like if no scripting overrides it" level. Okay, I preserved the current behaviour. Matt's new (uncommitted) py-prompt.exp tests were great for making sure I did. :-) Thanks! -- Pedro Alves