From 17aaabcee461b8f66a35766831afba51fe0aaa03 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Tue, 5 Feb 2019 14:53:03 +0100 Subject: [PATCH] GDB: Added support for single step. Signed-off-by: Marcin Rajwa --- src/gdb/gdb.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gdb/gdb.c b/src/gdb/gdb.c index 0419c4581..d7a42f549 100644 --- a/src/gdb/gdb.c +++ b/src/gdb/gdb.c @@ -205,7 +205,8 @@ while (1) { break; } break; - case 'z': /* remove HW breakpoint */ + /* remove HW breakpoint */ + case 'z': switch (*request++) { /* remove HW breakpoint */ case '1': @@ -238,6 +239,19 @@ while (1) { break; } break; + /* Single step in the code */ + case 's': + if (hex_to_int(&request, &addr)) + sregs[DEBUG_PC] = addr; + /* leave debug just for one instruction */ + sregs[ICOUNT] = 0xfffffffe; + sregs[ICOUNTLEVEL] = XCHAL_DEBUGLEVEL; + /* disable low level interrupts */ + sregs[INTENABLE] &= ~DISABLE_LOWER_INTERRUPTS_MASK; + write_sr(ICOUNTLEVEL); + write_sr(ICOUNT); + write_sr(INTENABLE); + return; default: gdb_log_exception("Unknown GDB command."); break;