This is an automated email from Gerrit.

"Peter Collingbourne <p...@google.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7952

-- gerrit

commit 17da5af00ee579100b4aea7a556ed6b0635b48b1
Author: Peter Collingbourne <p...@google.com>
Date:   Thu Oct 19 19:07:29 2023 -0700

    target: Add a debug_reason command
    
    This allows programmatically determining the debug reason.
    
    Change-Id: I0c3e85cebb6dc28fc0fc212beca84a484ac654a5
    Signed-off-by: Peter Collingbourne <p...@google.com>

diff --git a/src/target/target.c b/src/target/target.c
index 10d0088d53..107877f1f0 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5874,6 +5874,18 @@ COMMAND_HANDLER(handle_target_current_state)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(handle_target_debug_reason)
+{
+       if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       struct target *target = get_current_target(CMD_CTX);
+
+       command_print(CMD, "%s", debug_reason_name(target));
+
+       return ERROR_OK;
+}
+
 static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj 
*const *argv)
 {
        struct jim_getopt_info goi;
@@ -6025,6 +6037,13 @@ static const struct command_registration 
target_instance_command_handlers[] = {
                .help = "displays the current state of this target",
                .usage = "",
        },
+       {
+               .name = "debug_reason",
+               .mode = COMMAND_EXEC,
+               .handler = handle_target_debug_reason,
+               .help = "displays the debug reason of this target",
+               .usage = "",
+       },
        {
                .name = "arp_examine",
                .mode = COMMAND_EXEC,

-- 

Reply via email to