Doghouse: gdb

At work, I've been forced into using Linux a good deal. Since my jobs involve writing code, I've also had occasion to use gdb on those Linux machines.

At some point in its evolution, gdb started printing, by default, X3.64 escape sequences intermixed with its normal output...even though my terminal type is recognized (programs such as less and vi handle it correctly) and gdb thus has reason to think that X3.64 won't do anything useful. Here, for example, is what I see in a sample run, cut-and-pasted directly from the window, edited only to HTMLify it:

Reading symbols from [32mui[m...
[?2004h(gdb) b start_paged_fetch
Breakpoint 1 at [34m0xc3d7[m: file [32m/home/mouse/gitlab-scripts/ui.c[m, line 853.
[?2004h(gdb) run
Starting program: [32m/home/mouse/gitlab-scripts/ui[m 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "[32m/lib/x86_64-linux-gnu/libthread_db.so.1[m".

Breakpoint 1, [33mstart_paged_fetch[m ([36mdone[m=0x5555555681e6 <projects_fetch_done>, [36mdonearg[m=0x0, [36mfmt[m=0x55555556aca6 "/api/v4/projects", [36mparams[m=0x0) at [32m/home/mouse/gitlab-scripts/ui.c[m:853
853	[31m{[m
[?2004h(gdb) l

This has annoyed me for a long time; it makes gdb borderline unusable. (This is far from the worst example.) I actually filed a bug report with Debian about this (bug 1001322); as far as I can tell nobody's done anything at all with it.

Today, I got sufficiently fed up to actually go digging. I had to dig way more than I should have (and this should not have needed me to do anything at all when $TERM doesn't indicate X3.64 will work!). And I had to actually grovel through the gdb source to find the last bit of it. I eventually found `set style enabled off' in ~/.gdbinit, which did most of it, but the prompt was still coming out as "?2004h(gdb)" instead of just "(gdb)". I fetched the gdb source and went digging. Turns out disabling that is done with `set enable-bracketed-paste off' in ~/.inputrc!

No thanks to the gdb people for wasting half my day today working around a `feature' that, if designed properly, would have silently gone away when it saw my terminal type didn't support it.

I can't help but wonder how long it will take until these become non-disableable, like (as far as I've been able to tell) gcc's insistence on using UTF-8 U+2018 and U+2019 to quote things in error messages.

Main