public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Paul Smith <psmith@gnu.org>
To: Matt Rice <ratmice@gmail.com>
Cc: GDB <gdb@sourceware.org>
Subject: Re: GDB: Setting the prompt from python
Date: Sun, 18 Oct 2020 10:08:52 -0400	[thread overview]
Message-ID: <f95bb9dcdb5142813d4f485c32ec0314d3d5a24e.camel@gnu.org> (raw)
In-Reply-To: <CACTLOFrVPfSMXdn-v3ueUsP+LBLwDtH3=s2GZz7i3pyeadyQuw@mail.gmail.com>

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.


  reply	other threads:[~2020-10-18 14:08 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 [this message]
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=f95bb9dcdb5142813d4f485c32ec0314d3d5a24e.camel@gnu.org \
    --to=psmith@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=ratmice@gmail.com \
    /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).