GDB: Setting the prompt from python
Matt Rice
ratmice@gmail.com
Sun Oct 18 09:24:53 GMT 2020
On Sun, Oct 18, 2020 at 3:27 AM Paul Smith via Gdb <gdb@sourceware.org> wrote:
>
> Is it possible to change the GDB prompt from within Python, such that
> the prompt contains a trailing space (like the default prompt)?
>
> I cannot figure it out.
>
> If I run set prompt from the normal command interpreter I can easily
> just put a space at the end and it works:
>
> (gdb) set prompt XXX\n
> XXXprint 1
> 1
>
> (gdb) set prompt XXX \n
> XXX print 1
> 1
>
> showing \n to indicate where I type ENTER
>
> Fine. But this doesn't work from Python:
>
> (gdb) python
> > gdb.execute('set prompt XXX ', True)
> > ^D
> XXXprint 1
> 1
>
> It seems that no matter what I do, the trailing space is stripped off.
> Is there some other way to set the prompt from Python?
Weird, using the python prompt hook does work.
(gdb) python
>gdb.prompt_hook = lambda old_prompt: "XXX "
>end
XXX quit
More information about the Gdb
mailing list