cgdb shows escape sequence fragments instead of colors in gdb terminal

Bug #1850993 reported by Horst Schirmeier
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
cgdb (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

When running cgdb 0.6.7-2build5 in a Konsole (on Ubuntu 19.04 amd64), it shows colored text in the source-code window, but the gdb window displays something that looks like ANSI escape sequence fragments. This is the
output of the source-code window after running `cgdb a.out`:

There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
[...]
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from [32ma.out[m...
(gdb) b main
Breakpoint 1 at [34m0x117e[m: file [32mvptr.cc[m, line 20.
(gdb)

expected output: Colored text, saying e.g. "Reading symbols from a.out..."

TERM is xterm-256color, however `TERM=xterm cgdb a.out` exhibits the same behavior. This also happens inside tmux or screen.

Revision history for this message
Horst Schirmeier (horst) wrote :

Note that this works fine on Debian 10 (cgdb 0.6.7-2+b4).

description: updated
Revision history for this message
Horst Schirmeier (horst) wrote :

Further investigation reveals that this is actually an upstream cgdb 0.6.7 deficiency. Newer GDBs do output coloring, which cgdb can deal with starting with version 0.7.0. In other words, when Ubuntu moved to a newer GDB version, it should also have bumped cgdb to 0.7.0 or newer.

Possible workarounds:

 - Disable GDB colors when running cgdb:
    cgdb -ex 'set style enabled off' a.out
    (probably use a bash alias cgdb="cgdb -ex 'set style enabled off'")

    GDB still uses colors while it starts up, but doesn't during use.

 - Disable GDB colors permanently: add "set style enabled off" to ~/.gdbinit

For a proper fix, Ubuntu should switch to cgdb 0.7.0 or newer. See also bug #1826319.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cgdb (Ubuntu):
status: New → Confirmed
Revision history for this message
Horst Schirmeier (horst) wrote :

Still broken in Ubuntu 19.10 (eoan) and the yet unreleased 20.04 (focal).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.