This is the mail archive of the
mailing list for the GDB project.
gdb fails to resume after "DebugBreak" (SigTrap)
- From: Martin <lazarus at mfriebe dot de>
- To: gdb at sourceware dot org
- Date: Wed, 21 Mar 2012 15:54:35 +0000
- Subject: 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),
Then the proccess is opened:
OpenProcess(PROCESS_CREATE_THREAD or PROCESS_QUERY_INFORMATION or
PROCESS_VM_OPERATION or PROCESS_VM_WRITE or PROCESS_VM_READ, False,
hThread := CreatRThread (hProcess, nil, 0, DebugBreakAddr, nil, 0,
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
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