From f45796191baa34d56125c1be10052390c8bdfdf8 Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Wed, 6 Aug 2025 13:45:13 -0300 Subject: [PATCH 1/2] Fix assertion when stepping --- src/mono/mono/mini/mini-arm64.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index f65c45313ea71f..6faaaf07b0f482 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -4204,7 +4204,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) arm_ldrx (code, ARMREG_IP1, info_var->inst_basereg, GTMREG_TO_INT (info_var->inst_offset)); /* Add the bp_tramp_offset */ - val = ((bp_tramp_offset / 4) * sizeof (target_mgreg_t)) + MONO_STRUCT_OFFSET (SeqPointInfo, bp_addrs); + val = (bp_tramp_offset * sizeof (target_mgreg_t)) + MONO_STRUCT_OFFSET (SeqPointInfo, bp_addrs); /* Load the info->bp_addrs [bp_tramp_offset], which is either 0 or the address of the bp trampoline */ code = emit_ldrx (code, ARMREG_IP1, ARMREG_IP1, val); /* Skip the load if its 0 */ @@ -6876,9 +6876,7 @@ mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip) if (enable_ptrauth) NOT_IMPLEMENTED; - g_assert (native_offset % 4 == 0); - g_assert (info->bp_addrs [native_offset / 4] == 0); - info->bp_addrs [native_offset / 4] = (guint8*)mini_get_breakpoint_trampoline (); + info->bp_addrs [native_offset] = (guint8*)mini_get_breakpoint_trampoline (); } else { /* ip points to an ldrx */ code += 4; @@ -6901,8 +6899,7 @@ mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip) if (enable_ptrauth) NOT_IMPLEMENTED; - g_assert (native_offset % 4 == 0); - info->bp_addrs [native_offset / 4] = NULL; + info->bp_addrs [native_offset] = NULL; } else { /* ip points to an ldrx */ code += 4; From ce8b4943a4c0c427d0344896aad89e4e5b209c5c Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Wed, 6 Aug 2025 13:54:58 -0300 Subject: [PATCH 2/2] Removing comment. --- src/mono/mono/mini/mini-arm64.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index 6faaaf07b0f482..572cf53831c984 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -4203,7 +4203,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) guint32 val; arm_ldrx (code, ARMREG_IP1, info_var->inst_basereg, GTMREG_TO_INT (info_var->inst_offset)); - /* Add the bp_tramp_offset */ val = (bp_tramp_offset * sizeof (target_mgreg_t)) + MONO_STRUCT_OFFSET (SeqPointInfo, bp_addrs); /* Load the info->bp_addrs [bp_tramp_offset], which is either 0 or the address of the bp trampoline */ code = emit_ldrx (code, ARMREG_IP1, ARMREG_IP1, val);