From e36f65eeff173489193471490bc00d0e4592af89 Mon Sep 17 00:00:00 2001 From: Thays Date: Tue, 13 Jul 2021 17:23:42 -0300 Subject: [PATCH 1/4] Fix deug after hotreload. --- src/mono/mono.proj | 1 - src/mono/mono/metadata/mono-debug.c | 9 +++++++-- src/mono/mono/mini/interp/transform.c | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index a329c0ac29940..94f5311a5a2a5 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -508,7 +508,6 @@ <_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy - diff --git a/src/mono/mono/metadata/mono-debug.c b/src/mono/mono/metadata/mono-debug.c index 58ecee24d4590..c083d46d4a451 100644 --- a/src/mono/mono/metadata/mono-debug.c +++ b/src/mono/mono/metadata/mono-debug.c @@ -1120,8 +1120,13 @@ mono_debug_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrA if (img->has_updates) { int idx = mono_metadata_token_index (minfo->method->token); gpointer ptr = mono_metadata_update_get_updated_method_ppdb (img, idx); - mono_ppdb_get_seq_points_enc (ptr, seq_points, n_seq_points); - } else if (minfo->handle->ppdb) + if (ptr != NULL) + { + mono_ppdb_get_seq_points_enc (ptr, seq_points, n_seq_points); + return; + } + } + if (minfo->handle->ppdb) mono_ppdb_get_seq_points (minfo, source_file, source_file_list, source_files, seq_points, n_seq_points); else mono_debug_symfile_get_seq_points (minfo, source_file, source_file_list, source_files, seq_points, n_seq_points); diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index e75fefe393c7a..188cd41821230 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -9758,7 +9758,10 @@ mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context, Mon MonoJitMemoryManager *jit_mm = get_default_jit_mm (); jit_mm_lock (jit_mm); - g_hash_table_replace (jit_mm->seq_points, imethod->method, imethod->jinfo->seq_points); + gpointer seq_points = g_hash_table_lookup (jit_mm->seq_points, imethod->method); + if (!seq_points || seq_points != imethod->jinfo->seq_points) + g_hash_table_replace (jit_mm->seq_points, imethod->method, imethod->jinfo->seq_points); + jit_mm_unlock (jit_mm); // FIXME: Add a different callback ? From 7e8f5389b9388eeff7be5d2fe3165d886723d332 Mon Sep 17 00:00:00 2001 From: Thays Date: Tue, 13 Jul 2021 17:24:31 -0300 Subject: [PATCH 2/4] do not change mono.proj --- src/mono/mono.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 94f5311a5a2a5..a329c0ac29940 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -508,6 +508,7 @@ <_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy + From 4be3dc086403b09dcfbda3e2ebdcdbbbebd4874c Mon Sep 17 00:00:00 2001 From: Thays Date: Tue, 13 Jul 2021 17:28:27 -0300 Subject: [PATCH 3/4] fix formatting. --- src/mono/mono/metadata/mono-debug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mono/mono/metadata/mono-debug.c b/src/mono/mono/metadata/mono-debug.c index c083d46d4a451..b45574c402b54 100644 --- a/src/mono/mono/metadata/mono-debug.c +++ b/src/mono/mono/metadata/mono-debug.c @@ -1120,8 +1120,7 @@ mono_debug_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrA if (img->has_updates) { int idx = mono_metadata_token_index (minfo->method->token); gpointer ptr = mono_metadata_update_get_updated_method_ppdb (img, idx); - if (ptr != NULL) - { + if (ptr != NULL) { mono_ppdb_get_seq_points_enc (ptr, seq_points, n_seq_points); return; } From d08962b2b173c2fb2167488931978cc72d656b58 Mon Sep 17 00:00:00 2001 From: Thays Date: Tue, 13 Jul 2021 17:29:35 -0300 Subject: [PATCH 4/4] Remove extra space. --- src/mono/mono/metadata/mono-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/metadata/mono-debug.c b/src/mono/mono/metadata/mono-debug.c index b45574c402b54..10554e663ef4b 100644 --- a/src/mono/mono/metadata/mono-debug.c +++ b/src/mono/mono/metadata/mono-debug.c @@ -1121,7 +1121,7 @@ mono_debug_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrA int idx = mono_metadata_token_index (minfo->method->token); gpointer ptr = mono_metadata_update_get_updated_method_ppdb (img, idx); if (ptr != NULL) { - mono_ppdb_get_seq_points_enc (ptr, seq_points, n_seq_points); + mono_ppdb_get_seq_points_enc (ptr, seq_points, n_seq_points); return; } }