Skip to main content


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 09:38 Go to next message
Paul DeRocco is currently offline Paul DeRoccoFriend
Messages: 22
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 13:45 Go to previous message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
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: Tue Apr 16 16:32:53 GMT 2024

Powered by FUDForum. Page generated in 1.83692 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top