Implement support for catching rename and thread priority change events.

This lets us keep up to date with thread names, which makes, for example
Tracker a bit more tolerable to debug since it employs thread renaming
to set the names of its windows.

Implements #4430.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39847 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2010-12-14 05:11:21 +00:00
parent 7040b50df5
commit 8fb7eb8b17
5 changed files with 113 additions and 0 deletions
+42
View File
@@ -884,6 +884,25 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
handled = _HandleThreadCreated(threadEvent);
break;
}
case B_DEBUGGER_MESSAGE_THREAD_RENAMED:
{
ThreadRenamedEvent* threadEvent
= dynamic_cast<ThreadRenamedEvent*>(event);
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_RENAMED: thread: %ld "
"(\"%s\")\n",
threadEvent->RenamedThread(), threadEvent->NewName());
handled = _HandleThreadRenamed(threadEvent);
break;
}
case B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED:
{
ThreadPriorityChangedEvent* threadEvent
= dynamic_cast<ThreadPriorityChangedEvent*>(event);
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED: thread:"
" %ld\n", threadEvent->ChangedThread());
handled = _HandleThreadPriorityChanged(threadEvent);
break;
}
case B_DEBUGGER_MESSAGE_THREAD_DELETED:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DELETED: thread: %ld\n",
event->Thread());
@@ -953,6 +972,29 @@ TeamDebugger::_HandleThreadCreated(ThreadCreatedEvent* event)
}
bool
TeamDebugger::_HandleThreadRenamed(ThreadRenamedEvent* event)
{
AutoLocker< ::Team> locker(fTeam);
::Thread* thread = fTeam->ThreadByID(event->RenamedThread());
if (thread != NULL)
thread->SetName(event->NewName());
return false;
}
bool
TeamDebugger::_HandleThreadPriorityChanged(ThreadPriorityChangedEvent*)
{
// TODO: implement once we actually track thread priorities
return false;
}
bool
TeamDebugger::_HandleThreadDeleted(ThreadDeletedEvent* event)
{