emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 358208dfaa3: Remove low-level keyboard hook when attaching GDB to


From: Eli Zaretskii
Subject: master 358208dfaa3: Remove low-level keyboard hook when attaching GDB to Emacs on Windows
Date: Sat, 7 Sep 2024 04:18:55 -0400 (EDT)

branch: master
commit 358208dfaa374cc71c4a1c081c2d5bff9127c55a
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Remove low-level keyboard hook when attaching GDB to Emacs on Windows
    
    This fixes the problem whereby attaching GDB to a running Emacs
    on MS-Windows would slow down keyboard input, because the
    low-level keyboard hook installed by Emacs at startup was still
    installed, but with Emacs stopped, the hook code couldn't run,
    and therefore the OS would time-out waiting for the hook to
    return.  Now when GDB is attached to Emacs, it will remove the
    hook right away.
    * src/.gdbinit: Call 'remove_w32_kbdhook' if the keyboard hook is
    already installed.
    * src/alloc.c (defined_WINDOWSNT): New enum.
    (gdb_make_enums_visible): Add 'defined_WINDOWSNT'.
---
 src/.gdbinit |  5 +++++
 src/alloc.c  | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/.gdbinit b/src/.gdbinit
index 0f55cc18699..d13134a4e3f 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1308,6 +1308,11 @@ if defined_HAVE_X_WINDOWS
   break x_error_quitter
 end
 
+if defined_WINDOWSNT
+  while kbdhook.hook_count > 0
+    call remove_w32_kbdhook()
+  end
+end
 
 # Put the Python code at the end of .gdbinit so that if GDB does not
 # support Python, GDB will do all the above initializations before
diff --git a/src/alloc.c b/src/alloc.c
index c22a5a787e4..066ec9fefe5 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -8297,6 +8297,9 @@ N should be nonnegative.  */);
   DEFSYM (QCemergency, ":emergency");
 }
 
+/* The below is for being able to do platform-specific stuff in .gdbinit
+   without risking error messages from GDB about missing types and
+   variables on other platforms.  */
 #ifdef HAVE_X_WINDOWS
 enum defined_HAVE_X_WINDOWS { defined_HAVE_X_WINDOWS = true };
 #else
@@ -8309,6 +8312,12 @@ enum defined_HAVE_PGTK { defined_HAVE_PGTK = true };
 enum defined_HAVE_PGTK { defined_HAVE_PGTK = false };
 #endif
 
+#ifdef WINDOWSNT
+enum defined_WINDOWSNT { defined_WINDOWSNT = true };
+#else
+enum defined_WINDOWSNT { defined_WINDOWSNT = false };
+#endif
+
 /* When compiled with GCC, GDB might say "No enum type named
    pvec_type" if we don't have at least one symbol with that type, and
    then xbacktrace could fail.  Similarly for the other enums and
@@ -8329,6 +8338,7 @@ extern union enums_for_gdb
   enum pvec_type pvec_type;
   enum defined_HAVE_X_WINDOWS defined_HAVE_X_WINDOWS;
   enum defined_HAVE_PGTK defined_HAVE_PGTK;
+  enum defined_WINDOWSNT defined_WINDOWSNT;
 } const gdb_make_enums_visible;
 union enums_for_gdb const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
 #endif /* __GNUC__ */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]