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;

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, gpointer 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
MONO_ATTR_USED 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
void mono_print_thread_dump (void *sigctx)

Description

Print information about the current thread to stdout. sigctx can be NULL, allowing this to be called from gdb.

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
gint32 mono_environment_exitcode_get (void)

mono_environment_exitcode_set
Syntax
void mono_environment_exitcode_set (gint32 value)

mono_install_runtime_cleanup
Syntax
void mono_install_runtime_cleanup (MonoDomainFunc func)

mono_runtime_set_shutting_down

Deprecated: This function can break the shutdown sequence.
Syntax
void mono_runtime_set_shutting_down (void)

Description

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