flip priority of (handle, id) thread name events; prefer id if it is there, to correctly work with the set-suspended-thread-name-by-ID case

This commit is contained in:
Ryan Fleury
2025-05-03 16:17:10 -07:00
parent ad8ae313f4
commit 473f84cbda
3 changed files with 56 additions and 8 deletions
+5 -5
View File
@@ -1251,15 +1251,15 @@ ctrl_entity_store_apply_events(CTRL_EntityStore *store, CTRL_EventList *list)
{
CTRL_Entity *process = ctrl_entity_from_handle(store, event->parent);
CTRL_Entity *thread = ctrl_entity_from_handle(store, event->entity);
if(thread != &ctrl_entity_nil)
{
ctrl_entity_equip_string(store, thread, event->string);
}
else
if(event->entity_id != 0)
{
CTRL_Entity *pending_name = ctrl_entity_alloc(store, process, CTRL_EntityKind_PendingThreadName, Arch_Null, ctrl_handle_zero(), event->entity_id);
ctrl_entity_equip_string(store, pending_name, event->string);
}
else if(thread != &ctrl_entity_nil)
{
ctrl_entity_equip_string(store, thread, event->string);
}
}break;
case CTRL_EventKind_ThreadColor:
{
+1 -1
View File
@@ -209,7 +209,7 @@ raddbg_encode_utf16(wchar_t *str, unsigned __int32 codepoint)
static inline int
raddbg_is_attached__impl(void)
{
return !!raddbg_is_attached_byte_marker;
return !!raddbg_is_attached_byte_marker[0];
}
static inline void
+50 -2
View File
@@ -451,14 +451,14 @@ type_coverage_eval_tests(void)
Has_Enums has_enums = {(Kind)4, (Flag)7};
Crazy_Union crazy_union = {0};
Crazy_Union crazy_union = {};
crazy_union.kind = Kind_First;
crazy_union.kind = Kind_Second;
crazy_union.kind = Kind_Third;
crazy_union.kind = Kind_Fourth;
Discriminated_Union discriminated_union = {0};
Discriminated_Union discriminated_union = {};
discriminated_union.kind = Kind_First;
discriminated_union.first.x = 16;
@@ -2580,6 +2580,52 @@ debug_string_tests(void)
#endif
}
////////////////////////////////
//~ rjf: Thread Name Test
#if _WIN32
DWORD dummy_thread(void *p)
{
Sleep(10);
return 0;
}
#endif
static void
thread_name_tests(void)
{
#if _WIN32
DWORD id = 0;
HANDLE h = CreateThread(0, 0, dummy_thread, 0, CREATE_SUSPENDED, &id);
{
#pragma pack(push, 8)
typedef struct THREADNAME_INFO THREADNAME_INFO;
struct THREADNAME_INFO
{
DWORD dwType;
LPCSTR szName;
DWORD dwThreadID;
DWORD dwFlags;
};
#pragma pack(pop)
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = "dummy_thread";
info.dwThreadID = id;
info.dwFlags = 0;
__try
{
RaiseException(0x406D1388, 0, sizeof(info) / sizeof(void *), (const ULONG_PTR *)&info);
}
__except(1)
{
}
}
ResumeThread(h);
WaitForSingleObject(h, INFINITE);
#endif
}
////////////////////////////////
//~ rjf: Interrupt Stepping Tests
@@ -2946,6 +2992,8 @@ mule_main(int argc, char** argv)
debug_string_tests();
thread_name_tests();
jit_stepping_tests();
interrupt_stepping_tests();