A GDB plugin for powerlevel10k-like prompt written in pure gdb script without dependency on the python port of gdb!
paru -S gdb-prompt-git
nix-env -iA nixos.nur.repos.Freed-Wu.gdb-prompt
Add the following code to ~/.config/gdb/gdbinit
:
source /the/path/of/this/directory/gdb-prompt
Or just gdb-prompt
(Yes, this file has a shebang) to open a gdb with
a powerlevel10k-like prompt.
set_ps1 [prompt_string] [[text:fg_color_value:bg_color_value] [separator]] ...
- See Color Handling of
man 5 terminfo
for color name/value. - See powerline-extra-symbols for separator.
- See gdb.prompt for prompt escape code.
- Escape
"\\"
to many times by the reverse order of 2, 4, 8, ... gdb script doesn't have string concatenate functions. We must useeval "set $str = \"%s%s\"", $str1, $str2
to do it, whicheval
will convert"\\\\"
to"\\"
.
If you hate gdb script and want a more common language, you can try python.