This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/14018] New: Win32 fails to continue with "winerr 5" (pcregister not available) after SigTrap while process paused


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]