public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
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 14:45:31 +0000	[thread overview]
Message-ID: <CACTLOFovFWP1Wj8Q+yZ=FDGsg0H-MKnEhS0HUWce_Qy2YWaD=Q@mail.gmail.com> (raw)
In-Reply-To: <f95bb9dcdb5142813d4f485c32ec0314d3d5a24e.camel@gnu.org>

On Sun, Oct 18, 2020 at 2:08 PM Paul Smith <psmith@gnu.org> wrote:
>
> On Sun, 2020-10-18 at 09:24 +0000, Matt Rice wrote:
> > > 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
>
> Aha!  Thanks.
>
> Well, it kind of makes sense to me but is unfortunate.  The problem is
> probably that GDB is stripping the command that is passed to it via
> gdb.execute() before running it so the whitespace goes away before GDB
> tries to run the command.
>
> In the prompt_hook version the static string containing the space is
> returned and so is preserved.
>

I forgot to mention, I believe when doing this via the prompt hook,
neither set prompt, or set extended-prompt are going to work again
unless the user also sets the prompt hook to None,
which may or may not be an issue for you, but something to be aware of.

      reply	other threads:[~2020-10-18 14:45 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
2020-10-18 14:08   ` Paul Smith
2020-10-18 14:45     ` Matt Rice [this message]

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='CACTLOFovFWP1Wj8Q+yZ=FDGsg0H-MKnEhS0HUWce_Qy2YWaD=Q@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).