add: static void get_team_debug_info(team_debug_info &teamDebugInfo);   static ssize_t kill_interruptable_read_port(port_id port, int32 *code, void *buffer, size_t bufferSize) { return read_port_etc(port, code, buffer, bufferSize, B_KILL_CAN_INTERRUPT, 0); }   static status_t kill_interruptable_write_port(port_id port, int32 code, const void *buffer, size_t bufferSize) { return write_port_etc(port, code, buffer, bufferSize, B_KILL_CAN_INTERRUPT, 0); }   static status_t debugger_write(port_id port, int32 code, const void *buffer, size_t bufferSize, bool dontWait) { TRACE(("debugger_write(): thread: %ld, team %ld, port: %ld, code: %lx, message: %p, " "size: %lu, dontWait: %d\n", thread_get_current_thread()->id, thread_get_current_thread()->team->id, port, code, buffer, bufferSize, dontWait));  status_t error = B_OK;   team_debug_info teamDebugInfo; get_team_debug_info(teamDebugInfo); sem_id writeLock = teamDebugInfo.debugger_write_lock;   TRACE(("debugger_write(): acquiring write lock...\n")); error = acquire_sem_etc(writeLock, 1, (dontWait ? B_RELATIVE_TIMEOUT : B_KILL_CAN_INTERRUPT), 0); if (error != B_OK) { TRACE(("debugger_write() done1: %lx\n", error)); return error; }   get_team_debug_info(teamDebugInfo);  if (teamDebugInfo.debugger_port != port || (teamDebugInfo.flags & B_TEAM_DEBUG_DEBUGGER_HANDOVER)) {    TRACE(("debugger_write(): %s\n", (teamDebugInfo.debugger_port != port ? "debugger port changed" : "handover flag set"))); } else { TRACE(("debugger_write(): writing to port...\n"));  error = write_port_etc(port, code, buffer, bufferSize, (dontWait ? B_RELATIVE_TIMEOUT : B_KILL_CAN_INTERRUPT), 0); }   release_sem(writeLock);  TRACE(("debugger_write() done: %lx\n", error));  return error; }    void clear_team_debug_info(struct team_debug_info *info, bool initLock) { if (info) { arch_clear_team_debug_info(&info->arch_info); atomic_set(&info->flags, B_TEAM_DEBUG_DEFAULT_FLAGS); info->debugger_team = -1; info->debugger_port = -1; info->nub_thread = -1; info->nub_port = -1; info->debugger_write_lock = -1;  if (initLock) info->lock = 0; } }   void destroy_team_debug_info(struct team_debug_info *info) { if (info) { arch_destroy_team_debug_info(&info->arch_info);   if (info->debugger_write_lock >= 0) { delete_sem(info->debugger_write_lock); info->debugger_write_lock = -1; }   if (info->nub_port >= 0) { set_port_owner(info->nub_port, B_CURRENT_TEAM); delete_port(info->nub_port); info->nub_port = -1; }   if (info->nub_thread >= 0) { int32 result; wait_for_thread(info->nub_thread, &result); info->nub_thread = -1; }  atomic_set(&info->flags, 0); info->debugger_team = -1; info->debugger_port = -1; } }   void clear_thread_debug_info(struct thread_debug_info *info, bool dying) { if (info) { arch_clear_thread_debug_info(&info->arch_info); atomic_set(&info->flags, B_THREAD_DEBUG_DEFAULT_FLAGS | (dying ? B_THREAD_DEBUG_DYING : 0)); info->debug_port = -1; } }   void destroy_thread_debug_info(struct thread_debug_info *info) { if (info) { arch_destroy_thread_debug_info(&info->arch_info);  if (info->debug_port >= 0) { delete_port(info->debug_port); info->debug_port = -1; }  atomic_set(&info->flags, 0); } }   static void
context: get_team_debug_info(team_debug_info &teamDebugInfo){	struct thread *thread = thread_get_current_thread();	cpu_status state = disable_interrupts();	GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);	memcpy(&teamDebugInfo, &thread->team->debug_info, sizeof(team_debug_info));	RELEASE_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);	restore_interrupts(state);}