This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [python] Prompt substitution
- From: Pedro Alves <pedro at codesourcery dot com>
- To: pmuldoon at redhat dot com
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Fri, 2 Sep 2011 18:22:02 +0100
- Subject: Re: [patch] [python] Prompt substitution
- References: <m3oc0r1tjk.fsf@redhat.com> <201108302118.18505.pedro@codesourcery.com> <m38vqar65n.fsf@redhat.com>
On Tuesday 30 August 2011 21:33:24, Phil Muldoon wrote:
> Pedro Alves <pedro@codesourcery.com> 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