Skip to content

Commit

Permalink
process name on stop-reason strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfleury committed May 23, 2024
1 parent bafc217 commit 35b97d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/df/gfx/df_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -9543,6 +9543,13 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event,
Temp scratch = scratch_begin(&arena, 1);
DF_Entity *thread = df_entity_from_ctrl_handle(event->machine_id, event->entity);
String8 thread_display_string = df_display_string_from_entity(scratch.arena, thread);
String8 process_thread_string = thread_display_string;
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
if(process->kind == DF_EntityKind_Process)
{
String8 process_display_string = df_display_string_from_entity(scratch.arena, process);
process_thread_string = push_str8f(scratch.arena, "%S: %S", process_display_string, thread_display_string);
}
switch(event->kind)
{
default:
Expand All @@ -9554,7 +9561,7 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event,
{
if(!df_entity_is_nil(thread))
{
explanation = push_str8f(arena, "%S completed step", thread_display_string);
explanation = push_str8f(arena, "%S completed step", process_thread_string);
}
else
{
Expand All @@ -9566,7 +9573,7 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event,
if(!df_entity_is_nil(thread))
{
icon = DF_IconKind_CircleFilled;
explanation = push_str8f(arena, "%S hit a breakpoint", thread_display_string);
explanation = push_str8f(arena, "%S hit a breakpoint", process_thread_string);
}
}break;
case CTRL_EventCause_InterruptedByException:
Expand All @@ -9579,30 +9586,30 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event,
default:
{
String8 exception_code_string = df_string_from_exception_code(event->exception_code);
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x%s%S", thread_display_string, event->exception_code, exception_code_string.size > 0 ? ": " : "", exception_code_string);
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x%s%S", process_thread_string, event->exception_code, exception_code_string.size > 0 ? ": " : "", exception_code_string);
}break;
case CTRL_ExceptionKind_CppThrow:
{
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x: C++ exception", thread_display_string, event->exception_code);
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x: C++ exception", process_thread_string, event->exception_code);
}break;
case CTRL_ExceptionKind_MemoryRead:
{
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x: Access violation reading 0x%I64x",
thread_display_string,
process_thread_string,
event->exception_code,
event->vaddr_rng.min);
}break;
case CTRL_ExceptionKind_MemoryWrite:
{
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x: Access violation writing 0x%I64x",
thread_display_string,
process_thread_string,
event->exception_code,
event->vaddr_rng.min);
}break;
case CTRL_ExceptionKind_MemoryExecute:
{
explanation = push_str8f(arena, "Exception thrown by %S - 0x%x: Access violation executing 0x%I64x",
thread_display_string,
process_thread_string,
event->exception_code,
event->vaddr_rng.min);
}break;
Expand All @@ -9617,7 +9624,7 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event,
case CTRL_EventCause_InterruptedByTrap:
{
icon = DF_IconKind_WarningBig;
explanation = push_str8f(arena, "%S interrupted by trap - 0x%x", thread_display_string, event->exception_code);
explanation = push_str8f(arena, "%S interrupted by trap - 0x%x", process_thread_string, event->exception_code);
}break;
case CTRL_EventCause_InterruptedByHalt:
{
Expand Down
1 change: 1 addition & 0 deletions src/mule/mule_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ dll_type_eval_tests(void)
Basics basics2 = {4, 5, 6, 7};
int x = 0;
(void)x;
*(int *)0 = 0;
}

0 comments on commit 35b97d9

Please sign in to comment.