Subject: bug#29020: [PATCH] gdb-mi doesn't display prompt when attaching

From: Mike Gulick <[email-masked]>
Date: Mon, 30 Oct 2017 10:23:49 -0400

On 10/27/2017 01:35 PM, Eli Zaretskii wrote:
>> From: Mike Gulick <[email-masked]>
>> Date: Fri, 27 Oct 2017 11:28:00 -0400
>>
>> This patch is pretty straightforward.  When we write a console message
>> to the GUD buffer, we now reset a variable that is used to determine
>> whether to print the gdb prompt on the next '^done' or '*stopped'
>> message.
> 
> Thanks, but could you please also provide a recipe that would
> demonstrate the effect of this change?
> 

Hi Eli,

Is the example I provided in the bug report sufficient?

E.g.

1) In shell:

$ sleep 1000 &
[1] 9924    # <--- NOTE PID

2) In shell:

$ emacs -Q

3) In emacs
M-x gdb
Run gdb (like this): gdb -i=mi -n

4) In *gud* buffer
(gdb) attach 9924   # <--- PID from earlier

5) Observe that (gdb) prompt is not displayed after output from GDB

With the patch, the (gdb) prompt will be displayed, e.g.

  (gdb) attach 9924
  Attaching to process 9924
  (gdb) Reading symbols from /bin/sleep...(no debugging symbols found)...done.
  Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug/.build-id/79/450f6e36287865d093ea209b85a222209925ff.debug...done.
  done.
  Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/.build-id/6f/150f33b150d6a81e26a425dd47d713d00f2d29.debug...done.
  done.
  0x00007f8f29196230 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:84
  84	../sysdeps/unix/syscall-template.S: No such file or directory.
  (gdb) 

Thanks,
Mike