Broken source view with Pygments and non-UTF-8 encoded source

Andrew Burgess aburgess@redhat.com
Fri Nov 26 11:16:21 GMT 2021


* Simon Sobisch via Gdb <gdb@sourceware.org> [2021-11-25 20:28:18 +0100]:

> I _really_ like the Pygments option, but it sadly doesn't work when the
> source code as invalid UTF8 data in it.
> As soon as this is the case "list" does not show a nice highlighted code any
> more but instead Python Exception is raised (UnicodeDecodeError) and then
> non-colored lines are shown.
> 
> This is especially bad when you "step" through the code because you get the
> python exception for every line.

Could you post here, or provide a link to, an example source file that
triggers the error please.

Thanks,
Andrew


> 
> I _think_ this is related to GDB not passing the source encoding it knows of
> (likely get from LANG) to Pygments.
> 
> More details about that: https://pygments.org/docs/unicode/
> 
> 
> Additional to the kind request of fixing that in GDB 11.x/12
> 
> Is there a way to disable the source highlighting for a single file or only
> globally?
> 
> 
> Simon



More information about the Gdb mailing list