Comment 8 for bug 1275210

Revision history for this message
Лъчезар Георгиев (luchezar) wrote :

I managed to build from source code a gdb which correctly shows Cyrillic characters (and probably all other UTF-8 encoded characters which the console font supports) in the source code window. But in order to write an acceptable gdb patch, I would need to study the configuration scripts, which isn't easy. So, for now, may the following information be useful to anyone who would like to build their own gdb which correctly displays UTF-8 encoded characters in the source code window.

In order to do this, gdb needs to be:

1) patched so that instead of the "ncurses" headers and library, it uses the wide-character "ncursesw", which decodes the UTF-8 encoded multi-byte characters correctly.

2) configured with --enable-tui and --with-curses switches, among the other eventually needed switches (the existing ones can be examined with the "show config" gdb command, and then applied to "configure". Sure, several needed additional packages will have to be installed, too).

To accomplish (1), I wrote the following "slow and dirty" script which changes many more occurrences of "ncurses" than necessary, but surely changes also those that really need to be changed, among them:

# Please be patient: this script is very slow!
find gdb -type f | xargs sed -si 's/ncurses/ncursesw/g'
find gdb -type f | xargs sed -si 's|ncursesw/ncursesw|ncursesw/curses|g'

It's written for the case when "sudo apt-get install gdb-source" is executed to get the current gdb source archive, which is then extracted. If extracting another archive with some other top level directory name, the "gdb" in the above script must be changed to match that name.

Hope this helps, and once again, sorry that at least at the moment I can't provide a good patch. By the way, the bug is fixed in FreeBSD-11, albeit its gdb is an older version (6.1.1). If someone could find their patch that accomplished this, that would be even more helpful. But, as I wrote, it would be a patch against version 6.1.1, so it would probably need to be edited for the newer one. Why this new release of FreeBSD uses an old gdb version? I don't know, ask them.