public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Don't close thread handles provided by WaitForDebugEvent
@ 2020-05-29  9:27 gdb-buildbot
  2020-05-29  9:27 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gdb-buildbot @ 2020-05-29  9:27 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT ac637ec30dd9a3b19a02d1967a80e4ddf739706e ***

commit ac637ec30dd9a3b19a02d1967a80e4ddf739706e
Author:     Hannes Domani <ssbssa@yahoo.de>
AuthorDate: Sun May 24 22:59:33 2020 +0200
Commit:     Hannes Domani <ssbssa@yahoo.de>
CommitDate: Wed May 27 19:15:53 2020 +0200

    Don't close thread handles provided by WaitForDebugEvent
    
    I sometimes encountered a weird breakpoint failure when using start:
    
    (gdb) start
    Temporary breakpoint 2 at 0x40162d: file gdb-25911.c, line 4.
    Starting program: C:\src\tests\gdb-25911.exe
    Warning:
    Cannot insert breakpoint 2.
    Cannot access memory at address 0x401628
    
    After trying a lot of combinations, I found a way to reproduce it:
    
    (gdb) file gdb-25987.exe
    Reading symbols from gdb-25987.exe...
    (gdb) start
    Temporary breakpoint 1 at 0x401638: file gdb-25987.cpp, line 13.
    Starting program: C:\src\tests\gdb-25987.exe
    
    Temporary breakpoint 1, main () at gdb-25987.cpp:13
    13      int main() {
    (gdb) c
    Continuing.
    
    Program received signal SIGSEGV, Segmentation fault.
    MyClass::call (this=0x3d20d0) at gdb-25987.cpp:8
    8           *(char*)(nullptr) = 1;
    (gdb) kill
    Kill the program being debugged? (y or n) y
    [Inferior 1 (process 1140) killed]
    (gdb) file gdb-25911.exe
    Load new symbol table from "gdb-25911.exe"? (y or n) y
    Reading symbols from gdb-25911.exe...
    (gdb) start
    Temporary breakpoint 2 at 0x40162d: file gdb-25911.c, line 4.
    Starting program: C:\src\tests\gdb-25911.exe
    Warning:
    Cannot insert breakpoint 2.
    Cannot access memory at address 0x401628
    
    Command aborted.
    
    The actual failure was that ReadProcessMemory used a process handle that
    was no longer valid.
    And the underlying reason was that the windows_thread_info destructor
    closes a thread handle that was provided earlier by WaitForDebugEvent.
    
    But since this is not allowed (and it was actually already closed at this
    point, and the handle value reused), this closed another still-needed handle.
    
    gdb/ChangeLog:
    
    2020-05-27  Hannes Domani  <ssbssa@yahoo.de>
    
            * nat/windows-nat.c (windows_thread_info::~windows_thread_info):
            Don't close thread handle.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0879dfab5c..08641e5721 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-27  Hannes Domani  <ssbssa@yahoo.de>
+
+	* nat/windows-nat.c (windows_thread_info::~windows_thread_info):
+	Don't close thread handle.
+
 2020-05-27  Tom Tromey  <tom@tromey.com>
 	    Simon Marchi  <simon.marchi@efficios.com>
 
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 8c2092a51d..709a9d3a31 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -51,7 +51,6 @@ bool ignore_first_breakpoint = false;
 
 windows_thread_info::~windows_thread_info ()
 {
-  CloseHandle (h);
 }
 
 void


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-06-27 19:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  9:27 [binutils-gdb] Don't close thread handles provided by WaitForDebugEvent gdb-buildbot
2020-05-29  9:27 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2020-05-29  9:46 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2020-05-29 10:04 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-06-27 17:18 ` Failures on Fedora-i686, " gdb-buildbot
2020-06-27 17:56 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-06-27 18:29 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-06-27 18:40 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-06-27 19:14 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-06-27 19:18 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-06-27 19:51 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).