[Bug cli/33184] New: [gdb/cli] Can't use show prompt value to set prompt
vries at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Sat Jul 19 05:07:52 GMT 2025
https://sourceware.org/bugzilla/show_bug.cgi?id=33184
Bug ID: 33184
Summary: [gdb/cli] Can't use show prompt value to set prompt
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: cli
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
The documentation mentions the possibility to get a blue "(gdb)" prompt using:
...
$ gdb -q -ex "set extended-prompt \[\e[0;34m\](gdb)\[\e[0m\]"
(gdb)
...
and using:
...
(gdb)show extended-prompt
The extended prompt is: \[\e[0;34m\](gdb)\[\e[0m\]
...
we get back the identical string.
We can do the same with set prompt (see PR28887), meaning this also works
without python support:
...
$ gdb -q -ex "set prompt \001\033[0;34m\002(gdb)\001\033[0m\002"
(gdb)
...
But showing the prompt gets us a different string:
...
(gdb)show prompt
Gdb's prompt is "\001\e[0;34m\002(gdb)\001\e[0m\002".
(gdb)
...
And this breaks the property that a shown value can be used as set value:
...
$ gdb -q -ex "set prompt \001\e[0;34m\002(gdb)\001\e[0m\002"
e[0;34m(gdb)e[0m
...
The problem is that:
- we parse the string using parse_escape which doesn't handle \e, and
- we print the string using ui_file::printchar which prints \033 as \e.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list