Add support for thread rename and priority change notifications to the
debugger API/message set. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39846 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
95acfc2225
commit
7040b50df5
@ -180,6 +180,8 @@ typedef enum {
|
||||
B_DEBUGGER_MESSAGE_TEAM_DELETED, // the debugged team is gone
|
||||
B_DEBUGGER_MESSAGE_TEAM_EXEC, // the debugged team executes exec()
|
||||
B_DEBUGGER_MESSAGE_THREAD_CREATED, // a thread has been created
|
||||
B_DEBUGGER_MESSAGE_THREAD_RENAMED, // a thread has been renamed
|
||||
B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED, // a thread has had its priority altered
|
||||
B_DEBUGGER_MESSAGE_THREAD_DELETED, // a thread has been deleted
|
||||
B_DEBUGGER_MESSAGE_IMAGE_CREATED, // an image has been created
|
||||
B_DEBUGGER_MESSAGE_IMAGE_DELETED, // an image has been deleted
|
||||
@ -545,9 +547,25 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin; // the thread that created the new thread
|
||||
team_id new_thread; // the newly created thread
|
||||
thread_id new_thread; // the newly created thread
|
||||
} debug_thread_created;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_THREAD_RENAMED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
thread_id renamed_thread; // the thread whose name has changed
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
} debug_thread_renamed;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
thread_id changed_thread; // the thread whose priority has changed
|
||||
int32 new_priority; // the new priority
|
||||
} debug_thread_priority_changed;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_THREAD_DELETED
|
||||
|
||||
typedef struct {
|
||||
@ -619,6 +637,8 @@ typedef union {
|
||||
debug_team_deleted team_deleted;
|
||||
debug_team_exec team_exec;
|
||||
debug_thread_created thread_created;
|
||||
debug_thread_renamed thread_renamed;
|
||||
debug_thread_priority_changed thread_priority_changed;
|
||||
debug_thread_deleted thread_deleted;
|
||||
debug_image_created image_created;
|
||||
debug_image_deleted image_deleted;
|
||||
|
@ -42,6 +42,11 @@ public:
|
||||
const debug_team_exec& message);
|
||||
virtual bool HandleThreadCreated(
|
||||
const debug_thread_created& message);
|
||||
virtual bool HandleThreadRenamed(
|
||||
const debug_thread_renamed& message);
|
||||
virtual bool HandleThreadPriorityChanged(
|
||||
const debug_thread_priority_changed&
|
||||
message);
|
||||
virtual bool HandleThreadDeleted(
|
||||
const debug_thread_deleted& message);
|
||||
virtual bool HandleImageCreated(
|
||||
|
@ -234,6 +234,8 @@ void user_debug_team_deleted(team_id teamID, port_id debuggerPort);
|
||||
void user_debug_team_exec();
|
||||
void user_debug_update_new_thread_flags(thread_id threadID);
|
||||
void user_debug_thread_created(thread_id threadID);
|
||||
void user_debug_thread_renamed(thread_id threadID, const char* name);
|
||||
void user_debug_thread_priority_changed(thread_id threadID, int32 priority);
|
||||
void user_debug_thread_deleted(team_id teamID, thread_id threadID);
|
||||
void user_debug_thread_exiting(struct thread* thread);
|
||||
void user_debug_image_created(const image_info *imageInfo);
|
||||
|
@ -54,6 +54,8 @@ BDebugMessageHandler::HandleDebugMessage(int32 messageCode,
|
||||
return HandleThreadCreated(message.thread_created);
|
||||
case B_DEBUGGER_MESSAGE_THREAD_DELETED:
|
||||
return HandleThreadDeleted(message.thread_deleted);
|
||||
case B_DEBUGGER_MESSAGE_THREAD_RENAMED:
|
||||
return HandleThreadRenamed(message.thread_renamed);
|
||||
case B_DEBUGGER_MESSAGE_IMAGE_CREATED:
|
||||
return HandleImageCreated(message.image_created);
|
||||
case B_DEBUGGER_MESSAGE_IMAGE_DELETED:
|
||||
@ -173,6 +175,23 @@ BDebugMessageHandler::HandleThreadCreated(const debug_thread_created& message)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDebugMessageHandler::HandleThreadRenamed(const debug_thread_renamed& message)
|
||||
{
|
||||
return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_THREAD_RENAMED,
|
||||
(const debug_debugger_message_data&)message);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDebugMessageHandler::HandleThreadPriorityChanged(
|
||||
const debug_thread_priority_changed& message)
|
||||
{
|
||||
return UnhandledDebugMessage(B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED,
|
||||
(const debug_debugger_message_data&)message);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BDebugMessageHandler::HandleThreadDeleted(const debug_thread_deleted& message)
|
||||
{
|
||||
|
@ -1077,6 +1077,48 @@ user_debug_thread_created(thread_id threadID)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
user_debug_thread_renamed(thread_id threadID, const char *name)
|
||||
{
|
||||
// check, if a debugger is installed and is interested in thread events
|
||||
struct thread *thread = thread_get_current_thread();
|
||||
int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
|
||||
if (~teamDebugFlags
|
||||
& (B_TEAM_DEBUG_DEBUGGER_INSTALLED | B_TEAM_DEBUG_THREADS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// prepare the message
|
||||
debug_thread_renamed message;
|
||||
message.renamed_thread = threadID;
|
||||
strlcpy(message.name, name, sizeof(message.name));
|
||||
|
||||
thread_hit_debug_event(B_DEBUGGER_MESSAGE_THREAD_RENAMED, &message,
|
||||
sizeof(message), true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
user_debug_thread_priority_changed(thread_id threadID, int32 priority)
|
||||
{
|
||||
// check, if a debugger is installed and is interested in thread events
|
||||
struct thread *thread = thread_get_current_thread();
|
||||
int32 teamDebugFlags = atomic_get(&thread->team->debug_info.flags);
|
||||
if (~teamDebugFlags
|
||||
& (B_TEAM_DEBUG_DEBUGGER_INSTALLED | B_TEAM_DEBUG_THREADS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// prepare the message
|
||||
debug_thread_priority_changed message;
|
||||
message.changed_thread = threadID;
|
||||
message.new_priority = priority;
|
||||
|
||||
thread_hit_debug_event(B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED, &message,
|
||||
sizeof(message), true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
user_debug_thread_deleted(team_id teamID, thread_id threadID)
|
||||
{
|
||||
|
@ -2559,6 +2559,9 @@ rename_thread(thread_id id, const char *name)
|
||||
RELEASE_THREAD_LOCK();
|
||||
restore_interrupts(state);
|
||||
|
||||
if (status == B_OK)
|
||||
user_debug_thread_renamed(id, name);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -2601,6 +2604,8 @@ set_thread_priority(thread_id id, int32 priority)
|
||||
scheduler_set_thread_priority(thread, priority);
|
||||
}
|
||||
|
||||
user_debug_thread_priority_changed(id, priority);
|
||||
|
||||
return oldPriority;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user