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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 10 Jun 2016 12:52:14 +0300

> Cc: [email-masked]
> From: Guilhem Bichot <[email-masked]>
> Date: Fri, 10 Jun 2016 10:41:27 +0200
> 
> >    (defun gud-stop-subjob ()
> >      (interactive)
> >      (with-current-buffer gud-comint-buffer
> >        (cond ((string-equal gud-target-name "emacs")
> > 	     (comint-stop-subjob))
> > 	    ((eq gud-minor-mode 'jdb)
> > 	     (gud-call "suspend"))
> > 	    ((eq gud-minor-mode 'gdbmi)
> > 	     (gud-call (gdb-gud-context-command "-exec-interrupt")))
> > 	    (t
> > 	     (comint-interrupt-subjob)))))
> >
> > As you see i works differently depending on whether gdb-mi is used or
> > not.  What I don't understand is why -exec-interrupt doesn't do its
> > job in your case.
> 
> It's isn't mysql-related. I create the simple a.cc:
> 
> int main()
> {
>    long long int x;
>    for (x= 1; x; x++)
>      ;
>    return 0;
> }
> 
> I compile:
> g++ -g a.cc
> 
> I open a.cc in emacs25, M-x gdb, "run"; it prints
> (gdb) r
> Starting program: /home/mysql_src/tmp/a.out
> 
> the long "for" loop is running, I press the STOP button, it prints 
> "command: -exec-interrupt", and the program apparently doesn't stop (as 
> there is no change at the prompt). To be sure about "doesn't stop", I 
> try with this program
> 
> #include <iostream>
> #include <unistd.h>
> int main()
> {
>    long long int x;
>    for (x= 1; x; x++)
>    {
>      std::cout << x << std::endl;
>      sleep(1);
>    }
>    return 0;
> }
> 
> And, likewise, the printouts continue, undisturbed by the click on STOP.
> 
> For what it's worth, the menu Signals->Break interrupts it and I 
> properly get:
> 
> Program received signal SIGINT, Interrupt.
> 0x0000000000400509 in main () at a.cc:4
> 4	  for (x= 1; x; x++)
> (gdb)
> 
> I'm using Ubuntu 15.10.

I suggest to ask this question on the GDB mailing list.