Skip to content

Commit

Permalink
'ghost exceptions' fix - spoof hit detection needs to occur based on …
Browse files Browse the repository at this point in the history
…the demon event's reported exception address, rather than wherever the instruction pointer happens to be at the time of the exception
  • Loading branch information
ryanfleury committed Jan 7, 2025
1 parent c1a2023 commit e82041e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ctrl/ctrl_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5331,7 +5331,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
if(spoof_mode &&
dmn_handle_match(target_process.dmn_handle, event->process) &&
dmn_handle_match(target_thread.dmn_handle, event->thread) &&
spoof.new_ip_value == event->instruction_pointer)
spoof.new_ip_value == event->address)
{
hit_spoof = 1;
log_infof("hit_spoof\n");
Expand Down
7 changes: 7 additions & 0 deletions src/raddbg/raddbg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -10933,6 +10933,7 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event)
if(thread != &ctrl_entity_nil)
{
dr_fancy_string_list_push_new(arena, &fstrs, rd_font_from_slot(RD_FontSlot_Icons), ui_top_font_size(), ui_top_palette()->text, rd_icon_kind_text_table[RD_IconKind_CircleFilled]);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit a breakpoint"));
}
Expand All @@ -10948,6 +10949,7 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event)
{
default:
{
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit an exception - "));
String8 exception_code_string = str8_from_u64(arena, event->exception_code, 16, 0, 0);
Expand All @@ -10961,13 +10963,15 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event)
}break;
case CTRL_ExceptionKind_CppThrow:
{
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit a C++ exception - "));
String8 exception_code_string = str8_from_u64(arena, event->exception_code, 16, 0, 0);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, exception_code_string);
}break;
case CTRL_ExceptionKind_MemoryRead:
{
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit an exception - "));
String8 exception_code_string = str8_from_u64(arena, event->exception_code, 16, 0, 0);
Expand All @@ -10976,6 +10980,7 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event)
}break;
case CTRL_ExceptionKind_MemoryWrite:
{
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit an exception - "));
String8 exception_code_string = str8_from_u64(arena, event->exception_code, 16, 0, 0);
Expand All @@ -10984,6 +10989,7 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event)
}break;
case CTRL_ExceptionKind_MemoryExecute:
{
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit an exception - "));
String8 exception_code_string = str8_from_u64(arena, event->exception_code, 16, 0, 0);
Expand Down Expand Up @@ -11011,6 +11017,7 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event)
case CTRL_EventCause_InterruptedByTrap:
{
dr_fancy_string_list_push_new(arena, &fstrs, rd_font_from_slot(RD_FontSlot_Icons), ui_top_font_size(), ui_top_palette()->text, rd_icon_kind_text_table[RD_IconKind_WarningBig]);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" "));
dr_fancy_string_list_concat_in_place(&fstrs, &thread_fstrs);
dr_fancy_string_list_push_new(arena, &fstrs, ui_top_font(), ui_top_font_size(), ui_top_palette()->text, str8_lit(" hit a trap"));
}break;
Expand Down

0 comments on commit e82041e

Please sign in to comment.