User forums > General (but related to Code::Blocks)
[OT] unofficial MinGW GDB gdb with python released
ironhead:
How is C::B attempting to 'pause' gdb.exe?
ollydbg:
--- Quote from: ironhead on October 10, 2009, 01:47:58 pm ---How is C::B attempting to 'pause' gdb.exe?
--- End quote ---
Read the source code of the Break() function. You will see it.
ollydbg:
In the code:
--- Code: ---void DebuggerGDB::Break()
{
// m_Process is PipedProcess I/O; m_Pid is debugger pid
if (m_pProcess && m_Pid && !IsStopped())
{
long pid = m_State.GetDriver()->GetChildPID();
if (pid <= 0)
pid = m_Pid; // try poking gdb directly
#ifndef __WXMSW__
// non-windows gdb can interrupt the running process. yay!
if (pid <= 0) // look out for the "fake" PIDs (killall)
cbMessageBox(_("Unable to stop the debug process!"), _("Error"), wxOK | wxICON_WARNING);
else
wxKill(pid, wxSIGINT);
#else
// windows gdb can interrupt the running process too. yay!
bool done = false;
if (DebugBreakProcessFunc && pid > 0)
{
Log(_("Trying to pause the running process..."));
HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
if (proc)
{
DebugBreakProcessFunc(proc); // yay!
CloseHandle(proc);
done = true;
}
else
Log(_("Failed."));
}
#endif
// Notify debugger plugins for end of debug session
PluginManager *plm = Manager::Get()->GetPluginManager();
CodeBlocksEvent evt(cbEVT_DEBUGGER_PAUSED);
plm->NotifyPlugins(evt);
}
}
--- End code ---
The main task is call the DebugBreakProcessFunc function. Which is defined by :
--- Code: --- kernelLib = LoadLibrary(TEXT("kernel32.dll"));
if (kernelLib)
DebugBreakProcessFunc = (DebugBreakProcessApiCall)GetProcAddress(kernelLib, "DebugBreakProcess");
#endif
}
--- End code ---
Also, you can find a stand alone program in this page:
http://cygwin.com/ml/cygwin/2006-06/msg00321.html
or
http://forums.codeblocks.org/index.php?topic=8577.0
or
http://www.nabble.com/GDB-Ctrl-C-Break-td1782635.html
or
http://forums.codeblocks.org/index.php/topic,7964.msg59677.html#msg59677
ironhead:
As posted in this message:
http://forums.codeblocks.org/index.php/topic,7964.msg61123.html#msg61123
Wouldn't sending a:
--- Code: ---mi interrupt
--- End code ---
Make the most sense, since it works cross platform and uses the GDB internals as opposed to relying on a win32api call that only exists in XP and above?
ollydbg:
--- Quote from: ironhead on October 10, 2009, 04:36:04 pm ---As posted in this message:
http://forums.codeblocks.org/index.php/topic,7964.msg61123.html#msg61123
Wouldn't sending a:
--- Code: ---mi interrupt
--- End code ---
Make the most sense, since it works cross platform and uses the GDB internals as opposed to relying on a win32api call that only exists in XP and above?
--- End quote ---
I personally think this command make no sense, because when the debuggee is running, GDB.exe can't accept any command.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version