Issue
I log into a remote CentOS system using PuTTY and do my development using g++ and gdb. My PuTTY is set to interpret terminal output as UTF-8 and render it accordingly. This setting is configured as shown below.
While debugging with gdb --tui
I observe that the borders around the source code pane is not drawn properly with lines. It looks like a terminal character encoding issue.
The terminal is able to display Unicode characters correctly. Here are some example outputs:
[root@gel ~]# python -c "print u'\u2665'"
♥
[root@gel ~]# printf "\xe2\x99\xa5\n"
♥
Here are my terminal settings:
[root@gel ~]# echo $LANG
en_US.UTF-8
[root@gel ~]# echo $LC_CTYPE
[root@gel ~]# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[root@gel ~]# echo $TERM
xterm
However, when I launch gdb -tui
the
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x x
x x
x x
x x
x x
x x
x [ No Source Available ] x
x x
x x
x x
x x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
None No process In: Line: ?? PC: ??
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
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-redhat-linux-gnu".
---Type <return> to continue, or q <return> to quit---
You can see that the border around the source code pane is drawn with q's, and x's.
Question
How can I resolve this issue such that gdb -tui
output draws the borders with proper lines?
Workaround
Right now, I am working around the issue by configuring PuTTY to interpret the terminal data as ISO-8859-1 as shown below. With this setting the terminal output looks like the following.
[root@gel ~]# python -c "print u'\u2665'"
â¥
[root@gel ~]# printf "\xe2\x99\xa5\n"
â¥
With this setting gdb --tui
output looks proper.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ │
│ │
│ │
│ │
│ │
│ [ No Source Available ] │
│ │
│ │
│ │
│ │
│ │
│ │
└───────────────────────────────────────────────────────────────────────────┘
None No process In: Line: ?? PC: ??
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
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-redhat-linux-gnu".
---Type <return> to continue, or q <return> to quit---