2006-07-28 Frederic Riss * breakpoint.c (threadnum_command): New function. (_initialize_breakpoint): Register new threadnum command. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.227 diff -u -p -r1.227 breakpoint.c --- breakpoint.c 2 Jun 2006 03:43:18 -0000 1.227 +++ breakpoint.c 27 Jul 2006 20:49:28 -0000 @@ -592,6 +592,43 @@ condition_command (char *arg, int from_t error (_("No breakpoint number %d."), bnum); } +/* threadnum N TID -- set thread of breakpoint N to TID. */ + +static void +threadnum_command (char *arg, int from_tty) +{ + struct breakpoint *b; + char *p; + int bnum, threadnum; + + if (arg == 0) + error_no_arg (_("breakpoint number")); + + p = arg; + bnum = get_number (&p); + if (bnum == 0) + error (_("Bad breakpoint argument: '%s'"), arg); + + arg = p; + threadnum = get_number (&p); + if (threadnum == 0) + error (_("Bad thread id argument: '%s'"), arg); + + if (threadnum != -1 && !valid_thread_id (threadnum)) + error (_("Unknown thread %d."), threadnum); + + ALL_BREAKPOINTS (b) + if (b->number == bnum) + { + b->thread = threadnum; + breakpoints_changed (); + breakpoint_modify_event (b->number); + return; + } + + error (_("No breakpoint number %d."), bnum); +} + static void commands_command (char *arg, int from_tty) { @@ -7796,6 +7833,12 @@ Specify breakpoint number N to break onl Usage is `condition N COND', where N is an integer and COND is an\n\ expression to be evaluated whenever breakpoint N is reached.")); + add_com ("threadnum", class_breakpoint, threadnum_command, _("\ +Specify breakpoint number N to break only in thread TID.\n\ +Usage is `threadnum N TID', where N is an integer and TID is a\n\ +thread identifier as printed by \"info threads\", or -1 for\n\ +any thread.")); + c = add_com ("tbreak", class_breakpoint, tbreak_command, _("\ Set a temporary breakpoint.\n\ Like \"break\" except the breakpoint is only temporary,\n\