GDB: Setting the prompt from python

Paul Smith psmith@gnu.org
Sun Oct 18 03:26:24 GMT 2020


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?

Help!!



More information about the Gdb mailing list