From: neder <nicolas.e...@lauterbach.com> --- mcdstub/internals.h | 9 +++++++++ mcdstub/mcdstub.c | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/mcdstub/internals.h b/mcdstub/internals.h index 5af705a12a..ce3bffe7e6 100644 --- a/mcdstub/internals.h +++ b/mcdstub/internals.h @@ -11,6 +11,14 @@ #define MAX_PACKET_LENGTH 1024 +// trigger defines +#define MCD_TRIG_TYPE_IP 0x00000001 +#define MCD_TRIG_TYPE_READ 0x00000002 +#define MCD_TRIG_TYPE_WRITE 0x00000004 +#define MCD_TRIG_TYPE_RW 0x00000008 +#define MCD_TRIG_OPT_DATA_IS_CONDITION 0x00000008 +#define MCD_TRIG_ACTION_DBG_DEBUG 0x00000001 + /* * lookuptable for transmitted signals */ @@ -180,6 +188,7 @@ CPUState *find_cpu(uint32_t thread_id); void handle_core_open(GArray *params, void *user_ctx); void handle_query_reset(GArray *params, void *user_ctx); void handle_detach(GArray *params, void *user_ctx); +void handle_query_trigger(GArray *params, void *user_ctx); void mcd_continue(void); /* sycall handling */ diff --git a/mcdstub/mcdstub.c b/mcdstub/mcdstub.c index 75b38d910a..1d066c8169 100644 --- a/mcdstub/mcdstub.c +++ b/mcdstub/mcdstub.c @@ -57,6 +57,10 @@ static const MCDCmdParseEntry mcd_gen_query_table[] = { .handler = handle_query_reset, .cmd = "reset", }, + { + .handler = handle_query_trigger, + .cmd = "trigger", + }, }; void mcd_init_mcdserver_state(void) @@ -991,7 +995,8 @@ void handle_core_open(GArray *params, void *user_ctx) { void handle_query_reset(GArray *params, void *user_ctx) { // resetting has to be done over a monitor (look ar Rcmd) so we tell MCD that we can reset but this still need to be implemented // we only support one reset over this monitor and that would be a fully "system_restart" - mcd_put_packet("info_rst=\"results in a full system restart\""); + mcd_put_packet("nr=\"3\",info=\"0,full_system_reset;1,gpr_reset;2,memory_reset;\""); + // TODO: we still need to implement the gpr and memory reset here! } void handle_detach(GArray *params, void *user_ctx) { @@ -1022,6 +1027,18 @@ void handle_detach(GArray *params, void *user_ctx) { } } +void handle_query_trigger(GArray *params, void *user_ctx) { + // set the type, option and action bitmask and send it + + uint32_t type = (MCD_TRIG_TYPE_IP | MCD_TRIG_TYPE_READ | MCD_TRIG_TYPE_WRITE | MCD_TRIG_TYPE_RW); + uint32_t option = (MCD_TRIG_OPT_DATA_IS_CONDITION); + uint32_t action = (MCD_TRIG_ACTION_DBG_DEBUG); + uint32_t nr_trigger = 4; + + g_string_append_printf(mcdserver_state.str_buf, "nr=\"%d\",info=\"%d;%d;%d;\"", nr_trigger, type, option, action); + mcd_put_strbuf(); +} + void mcd_continue(void) { if (!runstate_needs_reset()) { -- 2.34.1