This is the mail archive of the 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]

gdb fails to resume after "DebugBreak" (SigTrap)

Here is an issue I discovered with GDB. Unfortunately, I have no exact steps for reproduction. (I have an app using Lazarus and FreePascal, that can reproduce it, but that is too big)

The problem is, if an app, receives a "pause request" while already paused. GDB will then fail to resume.

I believe this is a windows problem. (All GDB I use are from the mingw site)

It appears that the issue may have been fixed in 7.0.50 (was still present in 7.0.0) and been re-introduced in 7.3. At least I have not yet been able to get it with any of the versions in between. (But it might just have been luck)

Anyway here is what I have.

In order to interrupt a debugged app on windows, the following functions are used. (pascal, but should be similar in other languages)
DebugBreakAddr := GetProcAddress(GetModuleHandle(kernel32), 'DebugBreak');
CreatRThread := GetProcAddress(GetModuleHandle(kernel32)'CreateRemoteThread');
Then the proccess is opened:
hThread := CreatRThread (hProcess, nil, 0, DebugBreakAddr, nil, 0, FPauseRequestInThreadID);

AFAIK This will lead to a SigTrap being sent to the app, and gdb will interrupt the app.

if the app has reached a breakpoint, and is in paused state, then if the above signal is sent it will be seen by gdb, as soon as gdb continues the app.

gdb will correctly stop, in response to the SigTrap:

Trying to continue the app, sometimes result in this error:


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

Earlier version (6.x) of gdb, would just return the app "exited normally" (despite it certainly didn't exit "normally", as it did not finish)

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