mdebug

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9c73597781b798b1f50f36a575ffb21509e3715d
parent 78e92d3effc4c8413b3e727cda2009a69040cb17
Author: Brian Swetland <swetland@frotz.net>
Date:   Mon, 22 Jun 2015 01:58:52 -0700

debugger: command to disable watch/breakpoints

Also have the agent invoker disable the watchpoint it
sets once it no longer needs it.

Todo: fancier, more dynamic watch/breakpoint management

Diffstat:
Mtools/debugger-commands.c | 6++++++
Mtools/rswdp.c | 4++++
Mtools/rswdp.h | 1+
3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/debugger-commands.c b/tools/debugger-commands.c @@ -421,6 +421,10 @@ int do_watch_rw(int argc, param *argv) { return swdp_watchpoint_rw(0, argv[0].n); } +int do_watch_off(int argc, param *argv) { + return swdp_watchpoint_disable(0); +} + int do_print(int argc, param *argv) { while (argc-- > 0) xprintf("%08x ", argv++[0].n); @@ -581,6 +585,7 @@ int run_flash_agent(u32 flashaddr, void *data, size_t data_sz) { } swdp_core_resume(); swdp_core_wait_for_halt(); + swdp_watchpoint_disable(0); // todo: timeout? // todo: confirm halted } @@ -704,6 +709,7 @@ struct debugger_command debugger_commands[] = { { "reset-hw", "", do_reset_hw, "strobe /RESET pin" }, { "watch-pc", "", do_watch_pc, "set watchpoint at addr" }, { "watch-rw", "", do_watch_rw, "set watchpoint at addr" }, + { "watch-off", "", do_watch_off, "disable watchpoint" }, { "print", "", do_print, "print numeric arguments" }, { "echo", "", do_echo, "echo command line" }, { "bootloader", "", do_bootloader, "reboot into bootloader" }, diff --git a/tools/rswdp.c b/tools/rswdp.c @@ -505,6 +505,10 @@ int swdp_watchpoint_rw(unsigned n, u32 addr) { return swdp_watchpoint(n, addr, FUNC_WATCH_RW); } +int swdp_watchpoint_disable(unsigned n) { + return swdp_watchpoint(n, 0, FUNC_DISABLED); +} + int swdp_bootloader(void) { struct txn t; q_init(&t); diff --git a/tools/rswdp.h b/tools/rswdp.h @@ -45,6 +45,7 @@ int swdp_watchpoint_pc(unsigned n, u32 addr); int swdp_watchpoint_rd(unsigned n, u32 addr); int swdp_watchpoint_wr(unsigned n, u32 addr); int swdp_watchpoint_rw(unsigned n, u32 addr); +int swdp_watchpoint_disable(unsigned n); /* attempt to clear any error state from previous transactions */ /* return 0 if successful (or no error state existed) */