Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Breakpoints unreliable in multithreaded program
Breakpoints unreliable in multithreaded program [message #852765] Sun, 22 April 2012 05:38 Go to next message
Paul DeRocco is currently offline Paul DeRocco
Messages: 8
Registered: April 2012
Junior Member
I'm using clone() to start a new thread. Breakpoints seem to work at first, but at some point in the execution, they stop working in the first thread, but continue to work in the second thread. When I set a breakpoint on code that is being executed by the first thread, the breakpoint decoration appears, and it is added to the breakpoint list, but the break never occurs. Here's a gdb trace of setting a single breakpoint:

376,073 ~"[Switching to Thread 0xb7feba60 (LWP 4808)]\n"
376,073 *stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",frame={add\
r="0x00130416",func="__kernel_vsyscall",args=[]},thread-id="1",stopped-threads="all",core="0"
376,073 =thread-selected,id="1"
376,073 (gdb) 
376,075 72-break-insert --thread-group i1 -f /home/pauld/workspace/chroma/chroma.cpp:134
376,086 72^done,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x0804e3bc",func="e\
vent_check(int)",file="../chroma.cpp",fullname="/home/pauld/workspace/chroma/chroma.cpp",line="134",\
times="0",original-location="/home/pauld/workspace/chroma/chroma.cpp:134"}
376,086 =thread-selected,id="2"
376,090 73-exec-continue --thread-group i1
376,090 (gdb) 
376,099 73^running
376,099 *running,thread-id="all"


It looks like all threads should be affected by the breakpoint. Anyone have any experience with this?
Re: Breakpoints unreliable in multithreaded program [message #853942 is a reply to message #852765] Mon, 23 April 2012 09:45 Go to previous message
Marc Khouzam is currently offline Marc Khouzam
Messages: 272
Registered: July 2009
Senior Member
According to 'man clone': "clone() creates a new process, in a manner similar to fork(2)". You debug session may be multi-process instead of multi-thread. Try using the option to "Automatically debug forked processes":
http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_use_multi-process_debugging.3F

Multi-process is relatively new to CDT and I don't know if this case (clone) will work properly. Please let us know and we can follow-up.

Thanks

marc
Previous Topic:Finding source files
Next Topic:Need help getting a fresh Indigo+MinGW install to build and run
Goto Forum:
  


Current Time: Wed Jul 30 09:11:14 EDT 2014

Powered by FUDForum. Page generated in 0.02078 seconds