Subject: 25.0.94; Issues with GUD (gdb-mi) after upgrade from Emacs 23 to 24/25

From: Guilhem Bichot <[email-masked]>
Date: Tue, 7 Jun 2016 11:30:06 +0200

Hello.

[ Thank you for all the work on Emacs, it so much helps my daily work ]

I'm debugging the MySQL Server with "M-x gdb".
Works great in Emacs23, for years. But it seems to break with upgrade to 
24 (package of Ubuntu 15.10), and similarly in 25 pretest 
built-from-source. Here is my experience today with emacs 25; it's been 
consistently my experience for the last months, and a colleague has seen 
this too.

Using "emacs -Q".
M-x gdb, then I chdir to the directory where MySQL is, then
"file ./mysqld".

Using all-stop mode (that is the default choice).

After issuing the "run" command, MySQL is waiting for client
connections. Ok so far.

ISSUE 1: STOPPING
=================

STOP button doesn't stop (prints "command: -exec-interrupt")
Menu Signals->STOP doesn't stop.
C-c C-z  doesn't stop.

(In Emacs23 the STOP button did stop and it was sending
SIGINT)

Menu Signals->Break, or C-c C-c, stop properly.

Suggestion: make the STOP button do as Signals->Break does
(=send SIGINT), and like it did in emacs23.

Perhaps another factor is MySQL ignoring STOP, but I don't think so, as
doing 'kill -STOP' to the PID of mysql, in a shell, does stop it (but 
then it's hell to resume it, have to press "continue" for tens of times,
perhaps because it has tens of threads).

ISSUE 2: FRAMES MOVING AROUND
=============================

After a "c"(continue) above, now MySQL is resumed, waiting for
client connections.
I wish to set a breakpoint.

I do C-c C-c to interrupt, then in the menu Gud->gdb-mi->"display other
windows": screen gets split in 6 frames (ok).
All frames show the same gdb output.
In the middle left frame, I open a source file (C-x C-f).
I click in the left fringe near a code line: no breakpoint gets set
alas.
I put cursor on that line, press C-x SPC: prints "mark set (rectangle
mode)"; doesn't set breakpoint either.
(Both techniques worked in emacs23.)
When putting the cursor in the source file, GUD-specific menu is
replaced by ordinary menu; like if GUD wasn't considering this file.

However, C-x C-a C-b sets breakpoint.

After the breakpoint is set, I type "c".
Run a MySQL query, gdb stops at breakpoint.
Then, clicking on left fringe near a code line in the same source
file, few lines below the breakpoint, sets a breakpoint: unlike at the 
first try above, it works. Like if GUD was now considering the file, now 
that it has broken into it?

MySQL is stopped at the breakpoint. I click the "step line" button: as 
this stepping leads to another function in another source file, that 
other source file is opened (fine) but in the "breakpoints" frame 
(bottom right frame); this has the effect that:
- breakpoints list is invisible
- I'm always scanning through frames with my eyes to find where the
execution pointer is now.
(In Emacs23, the new file just replaces the old file. And when stepping
out later, the old file would replace the new file).

I do "restore window layout" which properly restores the
"breakpoints" list in its frame, and puts the stepped-in file in the
middle left. It's a workaround, but it's tedious as I have to do it
frequently.

ISSUE 3: STEPPING OUT DOESN'T PRINT RETURN VALUE
================================================

The program is in the stepped-in function, clicking "Step out" steps out
of it, but this doesn't print the returned value.
Emacs23 prints it ("Value returned is $1 = false").

After "c" the query finishes. I send the same query again, but this
time the issue 2 doesn't happen anymore (i.e. the stepped-in
source file is displayed where it should, replacing the old file, and
not in the "breakpoints" frame).

Using
"GNU gdb (Ubuntu 7.10-1ubuntu2) 7.10"

Sames issues with
"GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.6)
  of 2015-09-17 on lgw01-52, modified by Debian"
As workaround, I'm currently using a built-from-source 23.4.1 which
works fine.

In GNU Emacs 25.0.94.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll 
bars)
  of 2016-06-07 built on t3500
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	Ubuntu 15.10

Configured features:
XPM JPEG TIFF GIF PNG SOUND NOTIFY ZLIB TOOLKIT_SCROLL_BARS LUCID X11

Important settings:
   value of $LANG: fr_FR.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
   gdb-many-windows: t
   diff-auto-refine-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent messages:
Command: -exec-next 1 [2 times]
Command: -exec-step 1
Command: -exec-finish
Command: -exec-step 1
Command: -exec-next 1 [4 times]
Command: -exec-finish
Command: -exec-step 1 [3 times]
Auto-saving...
Making completion list...
After 0 kbd macro iterations: mouse-posn-property: Args out of range: 7601

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils rect
misearch multi-isearch cus-start cus-load kmacro cl-seq gdb-mi bindat
json map seq byte-opt gv bytecomp byte-compile cconv gud comint
ansi-color ring vc-git diff-mode easy-mmode cl-extra help-mode cc-mode
cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs cl-loaddefs pcase cl-lib time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded 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
inotify dynamic-setting x-toolkit x multi-tty make-network-process
emacs)

Memory information:
((conses 16 162903 9524)
  (symbols 48 25219 0)
  (miscs 40 193 205)
  (strings 32 31416 5195)
  (string-bytes 1 976520)
  (vectors 16 18314)
  (vector-slots 8 503194 5768)
  (floats 8 233 199)
  (intervals 56 3629 313)
  (buffers 976 26)
  (heap 1024 38968 11749))

-- 
Mr. Guilhem Bichot <[email-masked]>
Oracle / MySQL / Optimizer team, Lead Software Engineer
Bordeaux, France
www.oracle.com / www.mysql.com
http://guilhembichot.blogspot.com/