Patchwork [7/8] Remove readline hack from gdb_select

login
register
mail settings
Submitter Tom Tromey
Date Aug. 6, 2019, 8:43 p.m.
Message ID <20190806204334.13441-8-tom@tromey.com>
Download mbox | patch
Permalink /patch/33983/
State New
Headers show

Comments

Tom Tromey - Aug. 6, 2019, 8:43 p.m.
As discussed on gdb-patches, this removes the readline hack from the
mingw-hdep.c version of gdb_select.  It's believed that this is not
needed any more.

2019-08-04  Tom Tromey  <tom@tromey.com>

	* mingw-hdep.c (gdb_select): Remove readline hack.
---
 gdb/ChangeLog    | 4 ++++
 gdb/mingw-hdep.c | 9 ---------
 2 files changed, 4 insertions(+), 9 deletions(-)
Pedro Alves - Aug. 7, 2019, 2:29 p.m.
On 8/6/19 9:43 PM, Tom Tromey wrote:
> As discussed on gdb-patches, this removes the readline hack from the
> mingw-hdep.c version of gdb_select.  It's believed that this is not
> needed any more.

I may be hard to find the discussion later on.
Please add a link to the discussion to the commit log
pointing here:

 https://sourceware.org/ml/gdb-patches/2019-03/msg00465.html

Thanks,
Pedro Alves

> 
> 2019-08-04  Tom Tromey  <tom@tromey.com>
> 
> 	* mingw-hdep.c (gdb_select): Remove readline hack.
> ---
>  gdb/ChangeLog    | 4 ++++
>  gdb/mingw-hdep.c | 9 ---------
>  2 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
> index 8ed4b44ddce..44fb22e9a16 100644
> --- a/gdb/mingw-hdep.c
> +++ b/gdb/mingw-hdep.c
> @@ -23,7 +23,6 @@
>  #include "event-loop.h"
>  
>  #include "gdb_select.h"
> -#include "readline/readline.h"
>  
>  #include <windows.h>
>  
> @@ -167,14 +166,6 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
>  	}
>      }
>  
> -  /* With multi-threaded SIGINT handling, there is a race between the
> -     readline signal handler and GDB.  It may still be in
> -     rl_prep_terminal in another thread.  Do not return until it is
> -     done; we can check the state here because we never longjmp from
> -     signal handlers on Windows.  */
> -  while (RL_ISSTATE (RL_STATE_SIGHANDLER))
> -    Sleep (1);
> -
>    return num_ready;
>  }
>  
>
Tom Tromey - Aug. 7, 2019, 10:03 p.m.
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 8/6/19 9:43 PM, Tom Tromey wrote:
>> As discussed on gdb-patches, this removes the readline hack from the
>> mingw-hdep.c version of gdb_select.  It's believed that this is not
>> needed any more.

Pedro> I may be hard to find the discussion later on.
Pedro> Please add a link to the discussion to the commit log
Pedro> pointing here:

Pedro>  https://sourceware.org/ml/gdb-patches/2019-03/msg00465.html

Thanks, I did this.

Also, Christian Biesinger managed to build this branch on Windows and
try it, which is very good news.

Tom
Doug Evans via gdb-patches - Aug. 7, 2019, 10:15 p.m.
On Wed, Aug 7, 2019 at 5:03 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> On 8/6/19 9:43 PM, Tom Tromey wrote:
> >> As discussed on gdb-patches, this removes the readline hack from the
> >> mingw-hdep.c version of gdb_select.  It's believed that this is not
> >> needed any more.
>
> Pedro> I may be hard to find the discussion later on.
> Pedro> Please add a link to the discussion to the commit log
> Pedro> pointing here:
>
> Pedro>  https://sourceware.org/ml/gdb-patches/2019-03/msg00465.html
>
> Thanks, I did this.
>
> Also, Christian Biesinger managed to build this branch on Windows and
> try it, which is very good news.

Yep, it worked fine (up/down arrow worked, Ctrl+R worked).

For reference, I compiled in cygwin but with mingw, using:
 ../configure --disable-binutils --disable-gas --disable-gold
--disable-gprof --disable-ld --disable-werror --disable-nls

I had to copy libwinpthread-1.dll to out/gdb.

Christian

Patch

diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 8ed4b44ddce..44fb22e9a16 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -23,7 +23,6 @@ 
 #include "event-loop.h"
 
 #include "gdb_select.h"
-#include "readline/readline.h"
 
 #include <windows.h>
 
@@ -167,14 +166,6 @@  gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
 	}
     }
 
-  /* With multi-threaded SIGINT handling, there is a race between the
-     readline signal handler and GDB.  It may still be in
-     rl_prep_terminal in another thread.  Do not return until it is
-     done; we can check the state here because we never longjmp from
-     signal handlers on Windows.  */
-  while (RL_ISSTATE (RL_STATE_SIGHANDLER))
-    Sleep (1);
-
   return num_ready;
 }