Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.773 diff -u -p -r1.773 breakpoint.c --- breakpoint.c 24 Jul 2013 19:50:32 -0000 1.773 +++ breakpoint.c 23 Aug 2013 05:15:34 -0000 @@ -2928,6 +2928,24 @@ remove_breakpoints (void) return val; } +/* Used when a thread exits, it will remove breakpoints which + are related to that thread. */ + +static void +remove_threaded_breakpoints (struct thread_info *tp, int silent) +{ + struct breakpoint *b, *b_tmp; + + ALL_BREAKPOINTS_SAFE (b, b_tmp) + { + if (b->thread == tp->num) + { + b->disposition = disp_del_at_next_stop; + b->number = 0; + } + } +} + /* Remove breakpoints of process PID. */ int @@ -16568,4 +16586,5 @@ agent-printf \"printf format string\", a automatic_hardware_breakpoints = 1; observer_attach_about_to_proceed (breakpoint_about_to_proceed); + observer_attach_thread_exit (remove_threaded_breakpoints); }