public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/14018] New: Win32 fails to continue with "winerr 5" (pc register not available) after SigTrap while process paused
@ 2012-04-24 22:45 gdb.bugs at mfriebe dot de
  2012-04-28 14:02 ` [Bug win32/14018] " gdb.bugs at mfriebe dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gdb.bugs at mfriebe dot de @ 2012-04-24 22:45 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14018

             Bug #: 14018
           Summary: Win32 fails to continue with "winerr 5" (pc register
                    not available) after SigTrap while process paused
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: gdb.bugs@mfriebe.de
    Classification: Unclassified


Created attachment 6366
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6366
pascal (src and bin) for reproducing

This bug appears to be a regression. It is present it 7.3 and 7.4. But was not
in previous 7.x)

On Windows in order to pause a running process for debugging, it is custom to
call 
CreateRemoteThread(handle_to_debugged_process, 0,0, GetProcAddress(hMod,
'DebugBreak') ...)

This leads to GDB reporting:
*stopped,reason="signal-received",signal-name="SIGTRAP",signal-meaning="Trace/breakpoint
trap",frame=


However if the above happens, while the app is already paused (e.g. after
reaching a breakpoint) then the app can not be continued.
This can not always be avoided. It may happen as a race condition, where the
breakpoint is hit, just before the signal could be sent.

The first continue will correctly lead to another pause/interrupt reporting the
SigTrap.
Trying to continue from this will report 

-exec-continue
&"warning: SuspendThread failed. (winerr 5)\n"
^error,msg="PC register is not available"

-exec-continue
&"warning: SuspendThread failed. (winerr 5)\n"
^error,msg="PC register is not available"


**** To reproduce (using Free Pascal)  Win 32 / Vista (probably any other too)
intel

I have included a helper app (in pascal) to trigger the SigTrap (source and
bin).
Compile with:  fpc.exe dbgbrk.pas 

The app to be debugged is test.exe 
compile:   fpc.exe -g test.pas

Run gdb:
   gdb -i mi test.exe

-break-insert test.pas:4
-exec-run

~"Starting program: B:\\dbg\\test.exe \n"
=thread-group-started,id="i1",pid="8372"
=thread-created,id="1",group-id="i1"
~"[New Thread 8372.0x26c4]\n"
....
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x004013f9",func="FOO"

Take the PID reported by gdb (in the example 8372) and run (while the app is
paused at the break point)

   dbgbrk.exe 8372


-exec-continue

^running
....
*stopped,reason="signal-received",signal-name="SIGTRAP",signal-meaning="Trace/breakpoint
trap",

-exec-continue
^running
....
&"warning: SuspendThread failed. (winerr 5)\n"
^error,msg="PC register is not available"


-exec-continue
&"warning: SuspendThread failed. (winerr 5)\n"
^error,msg="PC register is not available"

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2021-09-22 17:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 22:45 [Bug gdb/14018] New: Win32 fails to continue with "winerr 5" (pc register not available) after SigTrap while process paused gdb.bugs at mfriebe dot de
2012-04-28 14:02 ` [Bug win32/14018] " gdb.bugs at mfriebe dot de
2012-11-01 14:39 ` andre.poenitz at digia dot com
2013-09-09 13:27 ` orgads at gmail dot com
2013-11-21 14:35 ` david.schulz at digia dot com
2013-11-21 14:49 ` brobecker at gnat dot com
2014-04-19  8:20 ` cvs-commit at gcc dot gnu.org
2014-04-19  8:27 ` cvs-commit at gcc dot gnu.org
2014-04-21 15:40 ` brobecker at gnat dot com
2014-05-05 21:54 ` cvs-commit at gcc dot gnu.org
2021-09-22 16:58 ` mervegunesli at aol dot com
2021-09-22 17:04 ` mark at klomp dot org

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).