summaryrefslogtreecommitdiff
path: root/utils/mcpu-run-options.h
diff options
context:
space:
mode:
authorkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
committerkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
commit065da3509019b15dd0e678072e6be629e5330bef (patch)
tree69c934c9e786ac048b4fbe8f4c4c5571661521f4 /utils/mcpu-run-options.h
parentd130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff)
downloadlibmcpu-0.4.0.tar.xz
Version 0.4.00.4.0
Diffstat (limited to 'utils/mcpu-run-options.h')
-rw-r--r--utils/mcpu-run-options.h105
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__ */