From: Matt Rice <ratmice@gmail.com>
To: Paul Smith <psmith@gnu.org>
Cc: GDB <gdb@sourceware.org>
Subject: Re: GDB: Setting the prompt from python
Date: Sun, 18 Oct 2020 09:24:53 +0000 [thread overview]
Message-ID: <CACTLOFrVPfSMXdn-v3ueUsP+LBLwDtH3=s2GZz7i3pyeadyQuw@mail.gmail.com> (raw)
In-Reply-To: <46a8f2123a154c4b86b8f38fff332f059b72fc77.camel@gnu.org>
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
next prev parent reply other threads:[~2020-10-18 9:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-18 3:26 Paul Smith
2020-10-18 9:24 ` Matt Rice [this message]
2020-10-18 14:08 ` Paul Smith
2020-10-18 14:45 ` Matt Rice
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACTLOFrVPfSMXdn-v3ueUsP+LBLwDtH3=s2GZz7i3pyeadyQuw@mail.gmail.com' \
--to=ratmice@gmail.com \
--cc=gdb@sourceware.org \
--cc=psmith@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).