Subject: 24.5; GDB interface gets confused by non-ASCII

From: Göran Uddeborg <[email-masked]>
Date: Tue, 17 Nov 2015 16:28:32 +0100

It seems something has broken in the interface between Gdb and Emacs.
I'm not sure which side is to blame, but I'll start with a report here.
Let me know if I should report to gdb instead.

With the most recent versions of Emacs and Gdb on Fedora, the debugging
mode gets confused if the path to the program being debugged contains a
non-ASCII letter.  To reproduce it do like this:

1. cd /tmp
2. mkdir göran
3. cd göran
4. cat > c.c << EOF
int main()
{
  return 0;
}
EOF
5. cc -g c.c -o c
6. emacs -Q
7. M-x gdb <return> <return>
8. (in *gud-c* buffer) b main <return>
9. r <return>

The first strange thing happens at step 8.  After having printed the
message "Breakpoint 1 at 0x4004fa: file c.c, line 3" and a "(gdb)"
prompt, there is also a listing of the c.c file inserted in the
"*gud-c*" buffer.

After running the program in step 9, the line where the program stops
is listed in the "*gud-c*" buffer, and then the file c.c is listed
AGAIN.

I also get a question in the minibuffer: File /tmp/göran/"/tmp/g\303\266ran/c.c" is read-only on disk.  Make buffer read-only, too? (y or n)

Note that "/tmp/göran" is repeated here, quoted with octal codes once.
The quotation signs also look strangely placed.

If I replace the "ö" in the name of the directory created in step 2, the
debugger behaves as I'm used to.  When it reaches the breakpoint in step
9, the file c.c is popped up in a separate window, with a little marker
at line 3 where the process has stopped.

This is on Fedora 23:

emacs-24.5-6.fc23.x86_64
gdb-7.10-29.fc23.x86_64
LANG=sv_SE.utf8

In GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.17.8)
 of 2015-09-11 on buildvm-21.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11799902
System Description:	Fedora release 14 (Laughlin)

Configured using:
 `configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -m64 -mtune=generic' LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: sv_SE.utf8
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  which-function-mode: t
  global-auto-complete-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Wrote /home/göran/Hämtat/todo/mimmi/23β
Saving file /home/göran/Hämtat/todo/freddi/23 ...
Wrote /home/göran/Hämtat/todo/freddi/23 
Saving file /home/göran/Hämtat/todo/freddi/23β...
Wrote /home/göran/Hämtat/todo/freddi/23β
(No files need saving)
Compilation finished
Removed 6 items.
Auto-saving...
Making completion list...

Load-path shadows:
/usr/share/emacs/site-lisp/goodies/htmlize hides /usr/share/emacs/site-lisp/htmlize/htmlize
/usr/share/emacs/site-lisp/goodies/emacs-goodies-loaddefs hides /usr/share/emacs/site-lisp/site-start.d/emacs-goodies-loaddefs
/usr/share/emacs/site-lisp/site-start.d/maxima-modes hides /usr/share/emacs/site-lisp/maxima/site_start.d/maxima-modes
/usr/share/emacs/site-lisp/gnus-bonus/nnir hides /usr/share/emacs/24.5/lisp/gnus/nnir
/usr/share/emacs/site-lisp/gnus-bonus/spam-stat hides /usr/share/emacs/24.5/lisp/gnus/spam-stat
/usr/share/emacs/site-lisp/gnus-bonus/nnnil hides /usr/share/emacs/24.5/lisp/gnus/nnnil

Features:
(shadow sort gnus-util mail-extr warnings emacsbug jka-compr misearch
multi-isearch po-mode po message idna format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 gmm-utils mailheader
flyspell ispell mailabbrev mailalias vm-save tapestry qp vm-pgg vm-reply
pgg pgg-parse pgg-def vm-rfaddons sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils vm-menu vm-window vm-toolbar vm-folder
vm-mime vm-undo vm-summary vm-mouse vm-page vm-motion vm-minibuf
vm-message vm-misc vm-macro vm add-log compile comint ansi-color ring
help-mode cmake-mode thingatpt server which-func imenu flow-ctrl advice
help-fns u-vm-color vm-autoloads vm-vars vm-version preview-latex
muse-journal muse-book muse-wiki muse-docbook muse-texinfo texnfo-upd
texinfo muse-latex muse-html muse-xml-common cus-edit cus-start cus-load
muse-publish muse-project muse-protocols info easymenu muse-regexps
wid-edit derived muse muse-nested-tags muse-mode emacs-goodies-loaddefs
easy-mmode bbdb-autoloads auto-complete-config auto-complete edmacro
kmacro cl-loaddefs cl-lib popup tex-site auto-loads time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 337622 37316)
 (symbols 48 36266 0)
 (miscs 40 26286 853)
 (strings 32 101296 15109)
 (string-bytes 1 2222681)
 (vectors 16 42480)
 (vector-slots 8 1574704 14223)
 (floats 8 138 247)
 (intervals 56 29670 33)
 (buffers 960 76)
 (heap 1024 70864 2417))