status_t BTeamDebugger::Install(team_id team) { Uninstall(); // create a debugger port char name[B_OS_NAME_LENGTH]; snprintf(name, sizeof(name), "debugger for team %" B_PRId32, team); fDebuggerPort = create_port(100, name); if (fDebuggerPort < 0) return fDebuggerPort; port_id nubPort = install_team_debugger(team, fDebuggerPort); if (nubPort < 0) { delete_port(fDebuggerPort); fDebuggerPort = -1; return nubPort; } status_t error = BDebugContext::Init(team, nubPort); if (error != B_OK) { remove_team_debugger(team); delete_port(fDebuggerPort); fDebuggerPort = -1; return error; } return B_OK; }
static void haiku_child_detach (char *args, int from_tty) { int detached = 1; status_t result; TRACE(("haiku_child_detach(`%s', %d)\n", args, from_tty)); result = remove_team_debugger(sTeamDebugInfo.team); if (result != B_OK) { error("Failed to detach process %ld: %s\n", sTeamDebugInfo.team, strerror(result)); } delete_command (NULL, 0); if (from_tty) { char *exec_file = get_exec_file (0); if (exec_file == 0) exec_file = ""; printf_unfiltered ("Detaching from program: %s, Pid %ld\n", exec_file, sTeamDebugInfo.team); gdb_flush (gdb_stdout); } haiku_cleanup_team_debug_info(); inferior_ptid = null_ptid; unpush_target (sHaikuTarget); }
Team::~Team() { if (fDebugContext.nub_port >= 0) destroy_debug_context(&fDebugContext); if (fNubPort >= 0) remove_team_debugger(fID); for (int32 i = 0; Image* image = fImages.ItemAt(i); i++) image->ReleaseReference(); }
void DebuggerInterface::Close(bool killTeam) { if (killTeam) kill_team(fTeamID); else if (fNubPort >= 0) remove_team_debugger(fTeamID); if (fDebuggerPort >= 0) delete_port(fDebuggerPort); }
status_t BTeamDebugger::Uninstall() { if (Team() < 0) return B_BAD_VALUE; remove_team_debugger(Team()); delete_port(fDebuggerPort); BDebugContext::Uninit(); fDebuggerPort = -1; return B_OK; }
void LocalDebuggerInterface::Close(bool killTeam) { if (killTeam) kill_team(fTeamID); else if (fNubPort >= 0) remove_team_debugger(fTeamID); if (fDebuggerPort >= 0) { __stop_watching_system(fTeamID, B_WATCH_SYSTEM_THREAD_PROPERTIES, fDebuggerPort, 0); delete_port(fDebuggerPort); } fNubPort = -1; fDebuggerPort = -1; }