Skip to content

Commit 019f89a

Browse files
committed
target/riscv: extend trigger controls
* Add control for action mode. * Introduce `riscv mtrigger` command. * Introduce `riscv *trigger list` command
1 parent 1aebdf8 commit 019f89a

File tree

2 files changed

+387
-52
lines changed

2 files changed

+387
-52
lines changed

doc/openocd.texi

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11728,12 +11728,15 @@ set those triggers directly. (It's also possible to do so by writing the
1172811728
appropriate CSRs.)
1172911729

1173011730
@deffn {Command} {riscv etrigger set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}] exception_codes
11731-
Set an exception trigger (type 5) on the current target, which halts the target when it
11732-
fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu} control
11733-
which execution modes the trigger fires in. @var{exception_codes} is a bit
11734-
field, where each bit corresponds to an exception code in mcause (defined in the
11735-
RISC-V Privileged Spec). The etrigger will fire on the exceptions whose bits are
11736-
set in @var{exception_codes}.
11731+
[@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}]
11732+
Set an exception trigger (type 5) on the current target, which sets the desired behavior on
11733+
the target when it fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu}
11734+
control which execution modes the trigger fires in. @var{exception_codes} is a bit field,
11735+
where each bit corresponds to an exception code in mcause (defined in the RISC-V Privileged Spec).
11736+
The etrigger will fire on the exceptions whose bits are set in @var{exception_codes}.
11737+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11738+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11739+
which halts the target.
1173711740

1173811741
For details on this trigger type, see the RISC-V Debug Specification.
1173911742
@end deffn
@@ -11742,15 +11745,21 @@ For details on this trigger type, see the RISC-V Debug Specification.
1174211745
Clear the type 5 trigger that was set using @command{riscv etrigger set}.
1174311746
@end deffn
1174411747

11748+
@deffn {Command} {riscv etrigger list}
11749+
List the type 5 trigger that was set using @command{riscv etrigger set}.
11750+
@end deffn
11751+
1174511752
@deffn {Command} {riscv icount set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}] [@option{pending}] count
11746-
Set an instruction count
11747-
trigger (type 3) on the current target, which halts the target when it fires.
11748-
@option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu} control which
11749-
execution modes the trigger fires in. If [@option{pending}] is passed then the
11750-
pending bit is set, which is unlikely to be useful unless you're debugging the
11751-
hardware implementation of this trigger.
11752-
@var{count} sets the number of instructions to execute before the trigger is
11753-
taken.
11753+
[@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}]
11754+
Set an instruction count trigger (type 3) on the current target, which sets the desired behavior
11755+
on the target when it fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu}
11756+
control which execution modes the trigger fires in. If [@option{pending}] is passed then the
11757+
pending bit is set, which is unlikely to be useful unless you're debugging the hardware
11758+
implementation of this trigger. @var{count} sets the number of instructions to execute before
11759+
the trigger is taken.
11760+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11761+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11762+
which halts the target.
1175411763

1175511764
For details on this trigger type, see the RISC-V Debug Specification.
1175611765
@end deffn
@@ -11759,13 +11768,21 @@ For details on this trigger type, see the RISC-V Debug Specification.
1175911768
Clear the type 3 trigger that was set using @command{riscv icount set}.
1176011769
@end deffn
1176111770

11771+
@deffn {Command} {riscv icount list}
11772+
List the type 3 trigger that was set using @command{riscv icount set}.
11773+
@end deffn
11774+
1176211775
@deffn {Command} {riscv itrigger set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}] [@option{nmi}] mie_bits
11763-
Set an interrupt trigger (type 4) on the current target, which halts the target when it
11764-
fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu} control
11765-
which execution modes the trigger fires in. If [@option{nmi}] is passed then
11766-
the trigger will fire on non-maskable interrupts in those modes. @var{mie_bits}
11767-
controls which interrupts the trigger fires on, using the same bit assignments
11768-
as in the mie CSR (defined in the RISC-V Privileged Spec).
11776+
[@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}]
11777+
Set an interrupt trigger (type 4) on the current target, which sets the desired behavior on
11778+
the target when it fires. @option{m}, @option{s}, @option{u}, @option{vs}, and @option{vu}
11779+
control which execution modes the trigger fires in. If [@option{nmi}] is passed then the
11780+
trigger will fire on non-maskable interrupts in those modes. @var{mie_bits} controls which
11781+
interrupts the trigger fires on, using the same bit assignments as in the mie CSR (defined
11782+
in the RISC-V Privileged Spec).
11783+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11784+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11785+
which halts the target.
1176911786

1177011787
For details on this trigger type, see the RISC-V Debug Specification.
1177111788
@end deffn
@@ -11789,6 +11806,31 @@ control over the trigger. By default there are no reserved triggers.
1178911806
Clear the type 4 trigger that was set using @command{riscv itrigger set}.
1179011807
@end deffn
1179111808

11809+
@deffn {Command} {riscv itrigger list}
11810+
List the type 4 trigger that was set using @command{riscv itrigger set}.
11811+
@end deffn
11812+
11813+
@deffn {Command} {riscv mtrigger set} [@option{m}] [@option{s}] [@option{u}] [@option{vs}] [@option{vu}]
11814+
[@option{execute}] [@option{store}] [@option{load}] [@option{exception}|@option{halt}|@option{trace_on}|
11815+
@option{trace_off}|@option{trace_notify}] Set an match trigger (type 2 or 6) on the current target,
11816+
which sets the desired behavior on the target when it fires. @option{m}, @option{s}, @option{u},
11817+
@option{vs}, and @option{vu} control which execution modes the trigger fires in. @option{execute},
11818+
@option{store}, and @option{load} control the trigger how to fire.
11819+
@option{exception}|@option{halt}|@option{trace_on}|@option{trace_off}|@option{trace_notify}
11820+
control the desired behavior on the target when the trigger fires. Defaults to @option{halt},
11821+
which halts the target.
11822+
11823+
For details on this trigger type, see the RISC-V Debug Specification.
11824+
@end deffn
11825+
11826+
@deffn {Command} {riscv mtrigger clear}
11827+
Clear the type 2 or 6 trigger that was set using @command{riscv mtrigger set}.
11828+
@end deffn
11829+
11830+
@deffn {Command} {riscv mtrigger list}
11831+
List the type 2 or 6 trigger that was set using @command{riscv mtrigger set}.
11832+
@end deffn
11833+
1179211834
@subsection RISC-V Program Buffer Commands
1179311835

1179411836
Program Buffer is an optional feature of RISC-V targets - it is a mechanism that debuggers

0 commit comments

Comments
 (0)