User forums > Help
gdb with custom makefiles: unabled to interrupt while running
pasdVn:
It does not run as a daemon.
I'm not that familiar with the unix fork, but if you want to know that: It is a multithreaded application, running under several PIDs. It does not use fork(), as much as I know.
oBFusCATed:
--- Quote from: pasdVn on February 15, 2011, 03:09:33 pm ---It does not run as a daemon.
--- End quote ---
To be a daemon doesn't mean to be run with &, there a few things an app should do to be a daemon and it should be explicit.
--- Quote from: pasdVn on February 15, 2011, 03:09:33 pm ---I'm not that familiar with the unix fork, but if you want to know that: It is a multithreaded application, running under several PIDs. It does not use fork(), as much as I know.
--- End quote ---
Can you try:
1. printf("start pid: %d\n", getpid()); after int main(....) {
2. printf("work pid: %d\n", getpid()); at the point where you want to interrupt your program (make sure it is on the main thread).
C::B can debug multi-threadeds apps
pasdVn:
--- Quote ---To be a daemon doesn't mean to be run with &, there a few things an app should do to be a daemon and it should be explicit.
--- End quote ---
Ok :-)
--- Quote ---start pid: 14836
work pid: 14836
--- End quote ---
Additionally I'm really sure now,. that it does not fork, after reading a bit about that topic (and stepping through the code, what works already really nice <3).
Thank you for patience with me, btw!
oBFusCATed:
Can you try to rebuild C::B debugger's branch with this patch applied:
--- Code: ---Index: src/plugins/debuggergdb/debuggergdb.cpp
===================================================================
--- src/plugins/debuggergdb/debuggergdb.cpp (revision 6974)
+++ src/plugins/debuggergdb/debuggergdb.cpp (working copy)
@@ -1570,7 +1570,8 @@
// m_Process is PipedProcess I/O; m_Pid is debugger pid
if (m_pProcess && m_Pid && !IsStopped())
{
- long pid = m_State.GetDriver()->GetChildPID();
+ long childPid = m_State.GetDriver()->GetChildPID();
+ long pid = childPid;
#ifndef __WXMSW__
if (pid <= 0)
pid = m_Pid; // try poking gdb directly
@@ -1578,7 +1579,11 @@
if (pid <= 0) // look out for the "fake" PIDs (killall)
cbMessageBox(_("Unable to stop the debug process!"), _("Error"), wxOK | wxICON_WARNING);
else
+ {
+ DebugLog(wxString::Format(_("Code::Blocks is trying to interrupt process with pid: %ld; child pid: %ld gdb pid: %ld"),
+ pid, childPid, m_Pid));
wxKill(pid, wxSIGINT);
+ }
#else
// windows gdb can interrupt the running process too. yay!
if ( (pid <=0)
--- End code ---
After you've applied the patch and recompiled (remember to execute ./update).
You should see info in the debugger's debug log what C::B is trying to interrupt.
Another option is to build C::B with debug info (install -dbg package if there is such) and debug C::B itself with gdb.
You should put breakpoint in DebuggerGDB::DoBreak.
pasdVn:
After trying to Debug the Version of the packet-manager, which gave me only a <value optimized out> here my result with your patch:
--- Code: ---Code::Blocks is trying to interrupt process with pid: 13748; child pid: 13748 gdb pid: 13736
--- End code ---
Edit: Hmm ok. This seems to be the Problem: There is no process with this pid running :-/
Edit 2: Hmm Ok, strange. I started my app and breaked at main. The main thread has PID 14386. But later, if I want to set a breakpoint in main he want's to interrupt PID 14389 wich is not exsisting. Those things are too high for me, I guess :-/. Probably it really has to do with the mechanism you mentioned. All other threads in this example have 14392-14398, so probably there has been anything in between.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version