Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to adjust source code highlighting in GDB cli?

Tags:

c++

c

gnu

gdb

I am using basic GDB CLI tool, no any TUI frontends. It highlights some parts of code with the same color as my terminal background making them indistinguishable. I know it is possible to disable source code highlighting but I would like to have it.
I didn't find much about this in documentation besides the fact that either GNU Source Highlight library, or Python Pygments package provide highlighting, but not a single word about how to check which of them GDB actually use or how to configure them and adjust colors.

like image 936
vatosarmat Avatar asked Oct 22 '25 18:10

vatosarmat


1 Answers

Edit esc.style in /usr/share/source-highlight/esc.style

GDB uses source-highlight which should not be confused with similar tool called just 'highlight' and provided by some distributions including Debian and Ubuntu. It is possilbe to check if GDB is actually linked with it: there should be --enable-source-highlight line in gdb --configuration output. It is documented in info source-highlight and is configured by .lang and .style files. esc means 'escape' and used for output in terminal, esc.style usage is hardcoded in GDB sources, it would be more correct to check terminfo and use esc256.style if appropriate, but it is written the way it is written.

like image 60
vatosarmat Avatar answered Oct 25 '25 09:10

vatosarmat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!