Skip to content

Commit bdfbf07

Browse files
committed
DEBUG: Log string allocations.
1 parent 826f318 commit bdfbf07

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

mono/metadata/boehm-gc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,15 @@ mono_gchandle_new_weakref_internal (MonoObject *obj, gboolean track_resurrection
18671867
return alloc_handle (track_resurrection? HANDLE_WEAK_TRACK: HANDLE_WEAK, obj, track_resurrection);
18681868
}
18691869

1870+
void
1871+
mono_debug_log_string(MonoString* str)
1872+
{
1873+
//char* s = mono_string_to_utf8(str);
1874+
//g_print("STR %s\n",s);
1875+
//mono_free(s);
1876+
g_print("STR %S\n", mono_string_chars_fast(str));
1877+
}
1878+
18701879
/**
18711880
* mono_gchandle_get_target_internal:
18721881
* \param gchandle a GCHandle's handle.

mono/metadata/jit-icall-reg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ MONO_JIT_ICALL (mono_context_set_icall) \
172172
MONO_JIT_ICALL (mono_create_corlib_exception_0) \
173173
MONO_JIT_ICALL (mono_create_corlib_exception_1) \
174174
MONO_JIT_ICALL (mono_create_corlib_exception_2) \
175+
MONO_JIT_ICALL (mono_debug_log_string) \
175176
MONO_JIT_ICALL (mono_debug_personality) \
176177
MONO_JIT_ICALL (mono_debugger_agent_breakpoint_from_context) \
177178
MONO_JIT_ICALL (mono_debugger_agent_single_step_from_context) \

mono/metadata/marshal-ilgen.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6533,6 +6533,8 @@ emit_create_string_hack_ilgen (MonoMethodBuilder *mb, MonoMethodSignature *csig,
65336533
for (i = 1; i <= csig->param_count; i++)
65346534
mono_mb_emit_ldarg (mb, i);
65356535
mono_mb_emit_managed_call (mb, res, NULL);
6536+
mono_mb_emit_byte(mb, CEE_DUP);
6537+
mono_mb_emit_icall(mb, mono_debug_log_string);
65366538
mono_mb_emit_byte (mb, CEE_RET);
65376539
}
65386540

mono/metadata/marshal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ mono_marshal_init (void)
249249
register_icall (mono_delegate_begin_invoke, mono_icall_sig_object_object_ptr, FALSE);
250250
register_icall (mono_delegate_end_invoke, mono_icall_sig_object_object_ptr, FALSE);
251251
register_icall (mono_gc_wbarrier_generic_nostore_internal, mono_icall_sig_void_ptr, FALSE);
252+
register_icall (mono_debug_log_string, mono_icall_sig_void_ptr, FALSE);
252253
register_icall (mono_gchandle_get_target_internal, mono_icall_sig_object_ptr, TRUE);
253254
register_icall (mono_marshal_isinst_with_cache, mono_icall_sig_object_object_ptr_ptr, FALSE);
254255
register_icall (mono_threads_enter_gc_safe_region_unbalanced, mono_icall_sig_ptr_ptr, TRUE);

mono/metadata/object-internals.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,10 @@ ICALL_EXTERN_C
23822382
MonoObject*
23832383
mono_gchandle_get_target_internal (MonoGCHandle gchandle);
23842384

2385+
ICALL_EXTERN_C
2386+
void
2387+
mono_debug_log_string(MonoString* str);
2388+
23852389
void mono_gchandle_free_internal (MonoGCHandle gchandle);
23862390

23872391
GCHandleType mono_gchandle_get_type_internal (MonoGCHandle gchandle);

0 commit comments

Comments
 (0)