Lines Matching defs:team

28 #include <team.h>
83 TRACE(("debugger_write(): thread: %" B_PRId32 ", team %" B_PRId32 ", "
86 thread_get_current_thread()->team->id, port, code, buffer, bufferSize,
91 // get the team debug info
105 // re-get the team debug info
153 Team* team = thread->team;
155 if (arch_has_breakpoints(&team->debug_info.arch_info))
163 threads of the current team.
168 Team* team = thread_get_current_thread()->team;
170 TeamLocker teamLocker(team);
172 Thread* thread = team->thread_list;
174 if (arch_has_breakpoints(&team->debug_info.arch_info)) {
190 Team* team = thread->team;
192 if (atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_DEBUGGER_INSTALLED)
200 threads of the given team.
201 The team's lock must be held.
204 update_threads_debugger_installed_flag(Team* team)
206 Thread* thread = team->thread_list;
208 if (atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_DEBUGGER_INSTALLED) {
247 * \a info must not be a member of a team struct (or the team struct must no
248 * longer be accessible, i.e. the team should already be removed).
250 * In case the team is still accessible, the procedure is:
252 * 2. copy the team debug info on stack
253 * 3. call clear_team_debug_info() on the team debug info
255 * 5. call destroy_team_debug_info() on the copied team debug info
373 Team*& team)
375 // We look up the team by ID, even in case of the current team, so we can be
376 // sure, that the team is not already dying.
378 teamID = thread_get_current_thread()->team->id;
381 // get the team
382 team = Team::GetAndLock(teamID);
383 if (team == NULL)
385 BReference<Team> teamReference(team, true);
386 TeamLocker teamLocker(team, true);
388 // don't allow messing with the kernel team
389 if (team == team_get_kernel_team())
393 InterruptsSpinLocker debugInfoLocker(team->debug_info.lock);
395 if (team->debug_info.debugger_changed_condition == NULL) {
397 team->debug_info.debugger_changed_condition = &condition;
403 team->debug_info.debugger_changed_condition->Add(&entry);
414 prepare_debugger_change(Team* team, ConditionVariable& condition)
418 InterruptsSpinLocker debugInfoLocker(team->debug_info.lock);
420 if (team->debug_info.debugger_changed_condition == NULL) {
422 team->debug_info.debugger_changed_condition = &condition;
428 team->debug_info.debugger_changed_condition->Add(&entry);
438 finish_debugger_change(Team* team)
441 InterruptsSpinLocker debugInfoLocker(team->debug_info.lock);
443 ConditionVariable* condition = team->debug_info.debugger_changed_condition;
444 team->debug_info.debugger_changed_condition = NULL;
454 Team *team = thread->team;
456 // If a debugger is installed for the team and the thread debug stuff
458 // to the kernel team, since exec_team() deletes all ports owned by this
459 // team. We change the ownership back later.
460 if (atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_DEBUGGER_INSTALLED) {
482 Team *team = thread->team;
484 // If a debugger is installed for the team and the thread debug stuff
486 // back to this team.
487 if (atomic_get(&team->debug_info.flags) & B_TEAM_DEBUG_DEBUGGER_INSTALLED) {
500 set_port_owner(debugPort, team->id);
520 GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
522 memcpy(&teamDebugInfo, &thread->team->debug_info, sizeof(team_debug_info));
524 RELEASE_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
566 GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
572 = (thread->team->debug_info.flags & B_TEAM_DEBUG_DEBUGGER_INSTALLED);
573 if (thread->id == thread->team->debug_info.nub_thread) {
581 debuggerPort = thread->team->debug_info.debugger_port;
582 nubPort = thread->team->debug_info.nub_port;
614 RELEASE_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
632 origin->team = thread->team->id;
741 // check, if the team is still being debugged
742 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
794 Team* team = thread_get_current_thread()->team;
796 debugChangeCondition.Init(team, "debug change condition");
797 prepare_debugger_change(team, debugChangeCondition);
799 if (team->debug_info.breakpoint_manager != NULL) {
803 team->debug_info.breakpoint_manager->PrepareToContinue(pc);
806 finish_debugger_change(team);
816 // ensure that a debugger is installed for this team
836 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
840 // check whether pre-syscall tracing is enabled for team or thread
868 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
872 // check whether post-syscall tracing is enabled for team or thread
910 // If so, we don't want to install a debugger for the team. We always send
936 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
984 // check, if a debugger is installed and is interested in team creation
987 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
1006 TRACE(("user_debug_team_deleted(team: %" B_PRId32 ", debugger port: "
1011 message.origin.team = teamID;
1022 // check, if a debugger is installed and is interested in team creation
1025 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
1033 message.image_event = atomic_add(&thread->team->debug_info.image_event, 1)
1062 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
1081 // the debugged team (but to the kernel). So we can't use debugger_write().
1083 // get the team debug flags and debugger port
1084 Team* team = Team::Get(teamID);
1085 if (team == NULL)
1087 BReference<Team> teamReference(team, true);
1089 InterruptsSpinLocker debugInfoLocker(team->debug_info.lock);
1091 int32 teamDebugFlags = atomic_get(&team->debug_info.flags);
1092 port_id debuggerPort = team->debug_info.debugger_port;
1093 sem_id writeLock = team->debug_info.debugger_write_lock;
1108 // re-get the team debug info -- we need to check whether anything changed
1111 teamDebugFlags = atomic_get(&team->debug_info.flags);
1112 port_id newDebuggerPort = team->debug_info.debugger_port;
1117 // the team is about to be handed over.
1122 message.origin.team = teamID;
1141 // thread is the current thread, so using team is safe
1142 Team* team = thread->team;
1146 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
1148 int32 teamDebugFlags = atomic_get(&team->debug_info.flags);
1149 port_id debuggerPort = team->debug_info.debugger_port;
1151 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
1184 message.origin.team = thread->team->id;
1210 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
1219 message.image_event = atomic_add(&thread->team->debug_info.image_event, 1)
1232 int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
1241 message.image_event = atomic_add(&thread->team->debug_info.image_event, 1)
1323 int32 imageEvent = thread->team->debug_info.image_event;
1514 /*! \brief Called by the debug nub thread of a team to broadcast a message to
1515 all threads of the team that are initialized for debugging (and
1525 while (get_next_thread_info(nubThread->team->id, &cookie, &threadInfo)
1539 if (thread && thread != nubThread && thread->team == nubThread->team
1566 nubThread->id, nubThread->team->debug_info.debugger_port));
1569 debugChangeCondition.Init(nubThread->team, "debug change condition");
1570 prepare_debugger_change(nubThread->team, debugChangeCondition);
1575 TeamLocker teamLocker(nubThread->team);
1579 GRAB_TEAM_DEBUG_INFO_LOCK(nubThread->team->debug_info);
1581 team_debug_info &info = nubThread->team->debug_info;
1590 update_threads_debugger_installed_flag(nubThread->team);
1592 RELEASE_TEAM_DEBUG_INFO_LOCK(nubThread->team->debug_info);
1600 finish_debugger_change(nubThread->team);
1612 * a thread of the same team.
1630 if (thread->team != nubThread->team)
1653 GRAB_TEAM_DEBUG_INFO_LOCK(nubThread->team->debug_info);
1655 if (nubThread->team->debug_info.nub_thread != nubThread->id) {
1656 RELEASE_TEAM_DEBUG_INFO_LOCK(nubThread->team->debug_info);
1661 port_id port = nubThread->team->debug_info.nub_port;
1662 sem_id writeLock = nubThread->team->debug_info.debugger_write_lock;
1664 = nubThread->team->debug_info.breakpoint_manager;
1666 RELEASE_TEAM_DEBUG_INFO_LOCK(nubThread->team->debug_info);
1669 TRACE(("debug_nub_thread() thread: %" B_PRId32 ", team %" B_PRId32 ", nub "
1670 "port: %" B_PRId32 "\n", nubThread->id, nubThread->team->id, port));
1685 // signal: If we are still listed in the team's debug info as nub
1791 Team *team = thread_get_current_thread()->team;
1795 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
1797 flags |= team->debug_info.flags & B_TEAM_DEBUG_KERNEL_FLAG_MASK;
1798 atomic_set(&team->debug_info.flags, flags);
1800 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
1827 if (thread->team == thread_get_current_thread()->team) {
2088 if (thread->team == thread_get_current_thread()->team) {
2205 Team *team = nubThread->team;
2213 // set the respective team debug flag
2215 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2217 atomic_or(&team->debug_info.flags,
2220 = team->debug_info.breakpoint_manager;
2222 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2298 int32 imageEvent = nubThread->team->debug_info.image_event;
2304 if (thread != NULL && thread->team == nubThread->team) {
2379 if (thread && thread->team == nubThread->team) {
2474 /** \brief Helper function for install_team_debugger(), that sets up the team
2477 The caller must hold the team's lock as well as the team debug info lock.
2479 The function also clears the arch specific team and thread debug infos
2483 install_team_debugger_init_debug_infos(Team *team, team_id debuggerTeam,
2487 atomic_set(&team->debug_info.flags,
2489 team->debug_info.nub_port = nubPort;
2490 team->debug_info.nub_thread = nubThread;
2491 team->debug_info.debugger_team = debuggerTeam;
2492 team->debug_info.debugger_port = debuggerPort;
2493 team->debug_info.debugger_write_lock = debuggerPortWriteLock;
2494 team->debug_info.causing_thread = causingThread;
2496 arch_clear_team_debug_info(&team->debug_info.arch_info);
2499 for (Thread *thread = team->thread_list; thread;
2518 update_threads_debugger_installed_flag(team);
2526 TRACE(("install_team_debugger(team: %" B_PRId32 ", port: %" B_PRId32 ", "
2533 // get the debugger team
2541 team_id debuggerTeam = debuggerPortInfo.team;
2543 // Check the debugger team: It must neither be the kernel team nor the
2544 // debugged team.
2546 TRACE(("install_team_debugger(): Can't debug kernel or debugger team. "
2552 // get the team
2553 Team* team;
2556 error = prepare_debugger_change(teamID, debugChangeCondition, team);
2560 // get the real team ID
2561 teamID = team->id;
2571 TeamLocker teamLocker(team);
2573 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2575 int32 teamDebugFlags = team->debug_info.flags;
2584 result = team->debug_info.nub_port;
2589 atomic_or(&team->debug_info.flags,
2592 oldDebuggerPort = team->debug_info.debugger_port;
2593 result = nubPort = team->debug_info.nub_port;
2595 causingThread = team->debug_info.causing_thread;
2598 install_team_debugger_init_debug_infos(team, debuggerTeam,
2599 debuggerPort, nubPort, team->debug_info.nub_thread,
2600 team->debug_info.debugger_write_lock, causingThread);
2609 result = team->debug_info.nub_port;
2618 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2635 notification.origin.team = teamID;
2652 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2654 atomic_and(&team->debug_info.flags,
2658 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2661 finish_debugger_change(team);
2676 TRACE(("install_team_debugger() done: handed over to debugger: team: "
2686 finish_debugger_change(team);
2692 snprintf(nameBuffer, sizeof(nameBuffer), "team %" B_PRId32 " debugger port "
2699 snprintf(nameBuffer, sizeof(nameBuffer), "team %" B_PRId32 " debug", teamID);
2708 // make the debugger team the port owner; thus we know, if the debugger is
2726 snprintf(nameBuffer, sizeof(nameBuffer), "team %" B_PRId32 " debug task",
2736 TeamLocker teamLocker(team);
2738 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2740 team->debug_info.breakpoint_manager = breakpointManager;
2741 install_team_debugger_init_debug_infos(team, debuggerTeam,
2745 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2749 finish_debugger_change(team);
2817 Team *team = thread_get_current_thread()->team;
2819 TRACE(("_user_disable_debugger(%d): team: %" B_PRId32 "\n", state,
2820 team->id));
2823 GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2827 oldFlags = atomic_or(&team->debug_info.flags,
2830 oldFlags = atomic_and(&team->debug_info.flags,
2834 RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
2856 // the debugger team must not be the kernel team
2857 if (portInfo.team == team_get_kernel_team_id())
2880 Team* team;
2884 team);
2888 InterruptsSpinLocker debugInfoLocker(team->debug_info.lock);
2893 if (team->debug_info.flags & B_TEAM_DEBUG_DEBUGGER_INSTALLED) {
2895 nubThread = team->debug_info.nub_thread;
2896 nubPort = team->debug_info.nub_port;
2909 finish_debugger_change(team);
2932 // we can't debug the kernel team
2933 if (thread->team == team_get_kernel_team())
2962 SpinLocker locker(thread->team->signal_lock);