Synopsis

These functions are used to get some runtime information from the Just in Time compiler and also to control some aspects of the initialization and shutdown of the runtime.

typedef struct _MonoJitInfo MonoJitInfo; MonoJitInfo* mono_jit_info_table_find (MonoDomain *domain, char *addr); int mono_jit_info_get_code_size (MonoJitInfo* ji); gpointer mono_jit_info_get_code_start (MonoJitInfo* ji); MonoMethod* mono_jit_info_get_method (MonoJitInfo* ji); G_GNUC_UNUSED char * mono_pmip (void *ip); void mono_print_method_from_ip (void *ip); mono_print_thread_dump void mono_threads_request_thread_dump (void); void mono_assemblies_init (void); void mono_assemblies_cleanup (void); mono_environment_exitcode_get mono_environment_exitcode_set mono_install_runtime_cleanup void mono_runtime_set_shutting_down (void); mono_security_set_core_clr_platform_callback

Just-in-Time Compiled Method Information

Use the `MonoJitInfo` API to get data about a JITed method. These APIs are typically used by profiler modules added to Mono.

mono_jit_info_table_find
Syntax
MonoJitInfo* mono_jit_info_table_find (MonoDomain *domain, char *addr)

Parameters
domain Domain that you want to look up
addr Points to an address with JITed code.
Return value
NULL if the address does not belong to JITed code (it might be native code or a trampoline) or a valid pointer to a MonoJitInfo*.
Description

Use this function to obtain a MonoJitInfo* object that can be used to get some statistics. You should provide both the domain on which you will be performing the probe, and an address. Since application domains can share code the same address can be in use by multiple domains at once.

This does not return any results for trampolines.

mono_jit_info_get_code_size
Syntax
int mono_jit_info_get_code_size (MonoJitInfo* ji)

Parameters
ji the JIT information handle
Return value
Starting address with the native code.
Description

Use this function to get the code size for the method described by the ji object. You can use this plus the mono_jit_info_get_code_start to determine the start and end of the native code.

mono_jit_info_get_code_start
Syntax
gpointer mono_jit_info_get_code_start (MonoJitInfo* ji)

Parameters
ji the JIT information handle
Return value
Starting address with the native code.
Description

Use this function to get the starting address for the method described by the ji object. You can use this plus the mono_jit_info_get_code_size to determine the start and end of the native code.

mono_jit_info_get_method
Syntax
MonoMethod* mono_jit_info_get_method (MonoJitInfo* ji)

Parameters
ji the JIT information handle
Return value
The MonoMethod that represents the code tracked by ji.
Description

Use this function to get the `MonoMethod *` that backs the ji object.

Useful Debugging Functions

These functions are useful when running the Mono VM inside a debugger.

mono_pmip
Syntax
G_GNUC_UNUSED char * mono_pmip (void *ip)

Parameters
ip an instruction pointer address
Return value
the name of the method at address ip.
Description

This method is used from a debugger to get the name of the method at address ip. This routine is typically invoked from a debugger like this:

(gdb) print mono_pmip ($pc)

mono_print_method_from_ip
Syntax
#ifdef __GNUC__ /* Prevent the linker from optimizing this away in embedding setups to help debugging */ __attribute__ ((__used__)) #endif void mono_print_method_from_ip (void *ip)

Parameters
ip an instruction pointer address
Description

This method is used from a debugger to get the name of the method at address ip.

This prints the name of the method at address ip in the standard output. Unlike mono_pmip which returns a string, this routine prints the value on the standard output.

mono_print_thread_dump
Syntax
mono_print_thread_dump

mono_threads_request_thread_dump
Syntax
void mono_threads_request_thread_dump (void)

Description

Ask all threads except the current to print their stacktrace to stdout.

Advanced

mono_assemblies_init
Syntax
void mono_assemblies_init (void)

Description

Initialize global variables used by this module.

mono_assemblies_cleanup
Syntax
void mono_assemblies_cleanup (void)

Description

Free all resources used by this module.

mono_environment_exitcode_get
Syntax
mono_environment_exitcode_get

mono_environment_exitcode_set
Syntax
mono_environment_exitcode_set

mono_install_runtime_cleanup
Syntax
mono_install_runtime_cleanup

mono_runtime_set_shutting_down
Syntax
void mono_runtime_set_shutting_down (void)

Description

Invoked by System.Environment.Exit to flag that the runtime is shutting down.

Deprecated. This function can break the shutdown sequence.