From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28107 invoked by alias); 21 Nov 2013 14:35:40 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 28084 invoked by uid 48); 21 Nov 2013 14:35:39 -0000 From: "david.schulz at digia dot com" To: gdb-prs@sourceware.org Subject: [Bug win32/14018] Win32 fails to continue with "winerr 5" (pc register not available) after SigTrap while process paused Date: Thu, 21 Nov 2013 14:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: win32 X-Bugzilla-Version: 7.4 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.schulz at digia dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-q4/txt/msg00344.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=14018 David Schulz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david.schulz at digia dot com --- Comment #3 from David Schulz --- Can also be reproduced with the following C++ Code: #include int main() { while (true) DebugBreakProcess(GetCurrentProcess()); } Start gdb: gdb -ex run .exe After startup enter: break main.cpp:6 command continue end handle SIGTRAP nostop continue After some lines telling you that the program received a SIGTRAP the following error is shown: &"warning: SuspendThread failed. (winerr 5)\n" ^error,msg="PC register is not available" The breakpoint is important because SuspendThread is just called when the gdb requests the thread contexts (see gdb/windows-nat.c:thread_rec()). The gdb commands and the code above actually emulates the QtCreator which inserts a breakpoint to a running inferior, and this breakpoint is hit directly after it was inserted. To give you a time line of the QtCreator behavior: - everything runs (QtCreator, gdb, inferior) - request insert breakpoint - interrupt inferior - wait for gdb to tell QtCreator it has stopped - insert breakpoint - tell the gdb to continue execution - breakpoint in inferior is hit - BOOM: gdb stops with the error message: PC register is not available The actual problem is that the gdb has not the rights to suspend the Thread (winerr 5 == ERROR_ACCESS_DENIED). As the only threads in this process are the main thread and the DebugBreak threads it looks like the gdb has not the rights to suspend the DebugBreak threads in some states (it occures not on every break so it has to be a special thread state). A possible Solution could be to check if you have the rights to suspend that thread (should be done anyway according to the documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686345(v=vs.85).aspx). -- You are receiving this mail because: You are on the CC list for the bug.