#ifndef __MCPU_RUN_OPTIONS_H__ #define __MCPU_RUN_OPTIONS_H__ 1 #include #include #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__ */