static void kgdb_switch_to_thread(int tid) { char buf[16]; int thread_id; thread_id = pid_to_thread_id(pid_to_ptid(tid)); if (thread_id == 0) error ("invalid tid"); snprintf(buf, sizeof(buf), "%d", thread_id); gdb_thread_select(uiout, buf); }
enum mi_cmd_result mi_cmd_thread_select (char *command, char **argv, int argc) { enum gdb_rc rc; if (argc != 1) { mi_error_message = xstrprintf ("mi_cmd_thread_select: USAGE: threadnum."); return MI_CMD_ERROR; } else rc = gdb_thread_select (uiout, argv[0], &mi_error_message); if (rc == GDB_RC_FAIL) return MI_CMD_ERROR; else return MI_CMD_DONE; }
enum mi_cmd_result mi_cmd_thread_select (char *command, char **argv, int argc) { enum gdb_rc rc; if (argc != 1) { mi_error_message = xstrprintf ("mi_cmd_thread_select: USAGE: threadnum."); return MI_CMD_ERROR; } else rc = gdb_thread_select (uiout, argv[0], &mi_error_message); /* RC is enum gdb_rc if it is successful (>=0) enum return_reason if not (<0). */ if ((int) rc < 0 && (enum return_reason) rc == RETURN_ERROR) return MI_CMD_ERROR; else if ((int) rc >= 0 && rc == GDB_RC_FAIL) return MI_CMD_ERROR; else return MI_CMD_DONE; }