This is an automated email from Gerrit.

"zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can 
find at https://review.openocd.org/c/openocd/+/8021

-- gerrit

commit a17f91614881e72c6734d6cc3d2832d89e5d32fa
Author: Marc Schink <d...@zapb.de>
Date:   Sat Nov 18 12:48:33 2023 +0100

    target/target: Add 'debug_reason' to current target
    
    Change-Id: Ie35b13b3e06411b4866ffeada47b3262493dbf2e
    Signed-off-by: Marc Schink <d...@zapb.de>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 5d73fd1744..ca460dbe7c 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9126,6 +9126,18 @@ read_memory 0x20000000 32 2
 @end example
 @end deffn
 
+@deffn {Command} {debug_reason}
+Displays the current debug reason:
+@code{debug-request},
+@code{breakpoint},
+@code{watchpoint},
+@code{watchpoint-and-breakpoint},
+@code{single-step},
+@code{target-not-halted},
+@code{program-exit},
+@code{exception-catch} or @code{undefined}.
+@end deffn
+
 @deffn {Command} {halt} [ms]
 @deffnx {Command} {wait_halt} [ms]
 The @command{halt} command first sends a halt request to the target,
diff --git a/src/target/target.c b/src/target/target.c
index 9f43e2f911..54748468a0 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -7164,6 +7164,13 @@ static const struct command_registration 
target_exec_command_handlers[] = {
                .help = "Write Tcl list of 8/16/32/64 bit numbers to target 
memory",
                .usage = "address width data ['phys']",
        },
+       {
+               .name = "debug_reason",
+               .mode = COMMAND_EXEC,
+               .handler = handle_target_debug_reason,
+               .help = "displays the debug reason of this target",
+               .usage = "",
+       },
        {
                .name = "reset_nag",
                .handler = handle_target_reset_nag,

-- 

Reply via email to