diff options
Diffstat (limited to 'utils/mcpu-run-options.h')
| -rw-r--r-- | utils/mcpu-run-options.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/utils/mcpu-run-options.h b/utils/mcpu-run-options.h new file mode 100644 index 0000000..06f9412 --- /dev/null +++ b/utils/mcpu-run-options.h @@ -0,0 +1,105 @@ +#ifndef __MCPU_RUN_OPTIONS_H__ +#define __MCPU_RUN_OPTIONS_H__ 1 + +#include <stddef.h> + +#include <libmcpu.h> + +#include "mcpu-tool-options.h" + +typedef enum __print_kind +{ + PRINT_NONE = 0, + PRINT_INTEGER_REGISTER, + PRINT_REAL_REGISTER, + PRINT_INTEGER_MEMORY, + PRINT_REAL_MEMORY, + PRINT_RAW_MEMORY +} print_kind; + +typedef enum __memory_kind +{ + MEMORY_NONE = 0, + MEMORY_DATA, + MEMORY_CONTROL, + MEMORY_HEAP, + MEMORY_INPUT, + MEMORY_OUTPUT, + MEMORY_TRACE +} memory_kind; + +typedef struct __print_spec +{ + print_kind kind; + memory_kind memory; + unsigned int bits; + __mpu_uint64_t address; + __mpu_uint64_t count; +} print_spec; + +typedef enum __action_kind +{ + ACTION_NONE = 0, + ACTION_PRINT_INTEGER_REGISTER, + ACTION_PRINT_REAL_REGISTER, + ACTION_SET_INTEGER_REGISTER, + ACTION_SET_REAL_REGISTER, + ACTION_PRINT_INTEGER_MEMORY, + ACTION_PRINT_REAL_MEMORY, + ACTION_SET_INTEGER_MEMORY, + ACTION_SET_REAL_MEMORY, + ACTION_PRINT_RAW_MEMORY +} action_kind; + +typedef struct __action_item +{ + unsigned int bits; + __mpu_uint64_t address; + char *value; +} action_item; + +typedef struct __stage_action +{ + action_kind kind; + memory_kind memory; + action_item *item; + size_t count; + print_spec raw; +} stage_action; + +typedef struct __stage_action_list +{ + stage_action *action; + size_t count; + size_t capacity; +} stage_action_list; + +typedef struct mcpu_run_options mcpu_run_options; +struct mcpu_run_options +{ + mcpu_tool_options common; + print_spec output; + stage_action_list before_run; + stage_action_list after_init; + stage_action_list on_step; + stage_action_list after_run; + unsigned int digits; + __mpu_uint64_t steps; + int steps_set; + int init_only; + const char *exe; + const char *env_ldpreload; + const char *ldpreload; + int program_argc; + char **program_argv; +}; + +void mcpu_run_options_init( mcpu_run_options *options, const char *progname ); +void mcpu_run_options_free( mcpu_run_options *options ); +int mcpu_run_handle_options( mcpu_run_options *options, + int argc, char **argv ); +void mcpu_run_usage( const mcpu_run_options *options ); +int mcpu_run_resolve_preload( const mcpu_run_options *options, + char **resolved, char *err, size_t errsz ); + +#endif /* __MCPU_RUN_OPTIONS_H__ */ |
