User forums > Embedded development
gdb break command
Jenna:
It's on windows, on linux it's SIGINT.
martind:
Hi Jens,
Ok so when you are debugging a windows program, the SIGTRAP signal occurs because a DebugBreakProcess Kernel32 call has been issued to the GDB child process (program being debugged), causing a debug exception. In this case, GDB receives this exception in the form of the SIGTRAP signal:
--- Code: ---long pid = m_State.GetDriver()->GetChildPID();
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."));
}
--- End code ---
When you connect to a remote host e.g target remote localhost:2000 (in the case of OpenOCD), GDB does not have a child process. Therefore the DebugBreak mechanism is unsuitable in this case.
If you run pure GDB from the command line, to break GDB you can press ctrl-C. But I am unsuccessfull in doing this programatically.
Martin.
starkeeper:
This annoying behaviour bothers me for at least two years now. And it doesn't seem to be fixed in the future, that is really frustrating.
And then there are these PC software gurus that don't stop to tell you that it works fine, when they hit the stop button. But none of them has even tried to debug a remote target.
This little neat "Bug" or missing feature makes codeblocks still unusable for embedded devlopement.
Btw. the arm-elf-insight debugger works fine, and the stop button really stops the target as expected.
martind:
Thats because they use GDB MI.
g2003p:
Good Day All!
I've found a partial solution to this problem, it works well for me. Not really found a method to send ctrl-C to the debugger process, but I did following change in DebuggerGDB::LaunchProcess:
//m_Pid = wxExecute(cmd, wxEXEC_ASYNC, m_pProcess);
m_Pid = wxExecute(cmd, wxEXEC_ASYNC | wxEXEC_NOHIDE, m_pProcess);
Now a console window appears when the debugger is started. If I hit the ctrl-C inside, the debugger breaks as expected....
Additionally, I changed behavior of start command to gdb, so that in case off remote debugging always continue and never run ist omitted.
If somebody is interested, I can post affected files etc. or a complete binary (trunk from 2008-09-12).
Gottfried
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version