Re: GDB: Setting the prompt from python
Matt Rice via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CACTLOFovFWP1Wj8Q+yZ=FDGsg0H-MKnEhS0HUWce_Qy2YWaD=Q@mail.gmail.com> |
On Sun, Oct 18, 2020 at 2:08 PM Paul Smith <[email protected]> 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.