Ruminate
Type introspection for C
 All Classes Files Functions Enumerations Enumerator Macros Pages
ruminate.h File Reference

Top-level and utility functions. More...

Macros

#define ruminate_get_type(expr, error)
 Get the type of an expression. More...
 

Functions

bool ruminate_destroy (GError **error)
 De-initialize the ruminate framework. More...
 
bool ruminate_init (const char *program_name, GError **error)
 Initialize the ruminate framework. More...
 
RFrameListruminate_backtrace (GError **error)
 Generate a backtrace. More...
 
GPtrArray * ruminate_get_types_by_name (const char *type_name, GError **error)
 Retrieve RTypes by name. More...
 
RTyperuminate_get_type_by_variable_name (const char *, GError **)
 
RStringruminate_get_function_name (void *addr, GError **error)
 Get the name of a function by address. More...
 

Detailed Description

Top-level and utility functions.

Macro Definition Documentation

#define ruminate_get_type (   expr,
  error 
)

Get the type of an expression.

Gets an instance of an RType representing the type of the provided expression.

Note that you must first have initialized the ruminate library via a call to ruminate_init().

Parameters
[in]exprThe expression to determine the type of.
[out]errorsee errors.h
Returns
A pointer to an RType or NULL if an error occurred. This RType must be freed using r_type_unref().

Function Documentation

RFrameList* ruminate_backtrace ( GError **  error)

Generate a backtrace.

This function generates a backtrace of the caller's call stack.

Returns
A pointer to an RFrameList representing the frames found in the caller's call stack. This RFrameList must be freed using r_frame_list_unref().
Todo:
This method should return a GPtrArray rather than a custom list implementation.
Parameters
[out]errorsee errors.h
bool ruminate_destroy ( GError **  error)

De-initialize the ruminate framework.

This function frees all internal resources of the ruminate framework. Undefined behavior results if any ruminate framework functions are called after this function returns true.

Returns
Whether or not an error occurred.
Parameters
[out]errorsee errors.h
RString* ruminate_get_function_name ( void *  addr,
GError **  error 
)

Get the name of a function by address.

Returns
A RString containing the name of the function.
Parameters
[in]addrthe address of the function to get the name of
[out]errorsee errors.h
RType* ruminate_get_type_by_variable_name ( const char *  ,
GError **   
)
Todo:
document
GPtrArray* ruminate_get_types_by_name ( const char *  type_name,
GError **  error 
)

Retrieve RTypes by name.

This function retrieves all the types which are named type_name.

Returns
A GPtrArray of the types which are named type_name
Parameters
[in]type_namethe name of the types to find
[out]errorsee errors.h
bool ruminate_init ( const char *  program_name,
GError **  error 
)

Initialize the ruminate framework.

This must be called before any other ruminate functions.

The argument program_name must either be the name of this program or NULL. If null, g_get_prgname() will be called to get the name of this program. If the program name has not been previously set via a call to g_set_prgname(), an error will occur.

Returns
Whether or not an error occurred.
See Also
g_set_prgname
Parameters
[in]program_namethe name of this program, e.g. argv[0] or NULL
[out]errorsee errors.h