Firmware: allow multiple transient breakpoints

Change-Id: I7a6e929698ec395eff6e22e2aeb507b3c3146dca
This commit is contained in:
David Banks
2019-10-31 11:49:49 +00:00
parent ceedc701ca
commit 3b90dc82fc

View File

@@ -306,7 +306,7 @@ unsigned int masks[MAXBKPTS];
unsigned int modes[MAXBKPTS]; unsigned int modes[MAXBKPTS];
// The number of different watch/breakpoint modes // The number of different watch/breakpoint modes
#define NUM_MODES 10 #define NUM_MODES 11
// The following watch/breakpoint modes are defined // The following watch/breakpoint modes are defined
#define BRKPT_MEM_READ 0 #define BRKPT_MEM_READ 0
@@ -319,6 +319,7 @@ unsigned int modes[MAXBKPTS];
#define WATCH_IO_WRITE 7 #define WATCH_IO_WRITE 7
#define BRKPT_EXEC 8 #define BRKPT_EXEC 8
#define WATCH_EXEC 9 #define WATCH_EXEC 9
#define TRANSIENT 10
// Breakpoint Mode Strings, should match the modes above // Breakpoint Mode Strings, should match the modes above
char *modeStrings[NUM_MODES] = { char *modeStrings[NUM_MODES] = {
@@ -331,7 +332,8 @@ char *modeStrings[NUM_MODES] = {
"IO Wr Brkpt", "IO Wr Brkpt",
"IO Wr Watch", "IO Wr Watch",
"Ex Brkpt", "Ex Brkpt",
"Ex Watch" "Ex Watch",
"Transient"
}; };
// For convenience, several masks are defined that group similar types of breakpoint/watch // For convenience, several masks are defined that group similar types of breakpoint/watch
@@ -395,14 +397,10 @@ unsigned int memAddr = 0;
// The address of the next instruction // The address of the next instruction
unsigned int nextAddr = 0; unsigned int nextAddr = 0;
// The address of the transient breakpoint
unsigned int transientAddr = 0xffff;
// When single stepping, trace (i.e. log) event N instructions // When single stepping, trace (i.e. log) event N instructions
// Setting this to 0 will disable logging // Setting this to 0 will disable logging
long trace; long trace;
/******************************************************** /********************************************************
* User Command Processor * User Command Processor
********************************************************/ ********************************************************/
@@ -1300,8 +1298,7 @@ void doCmdNext(char *params) {
logTooManyBreakpoints(); logTooManyBreakpoints();
return; return;
} }
transientAddr = nextAddr; setBreakpoint(numbkpts++, nextAddr, 0xffff, (1 << BRKPT_EXEC) | (1 << TRANSIENT), TRIGGER_ALWAYS);
setBreakpoint(numbkpts++, nextAddr, 0xffff, 1 << BRKPT_EXEC, TRIGGER_ALWAYS);
doCmdContinue(params); doCmdContinue(params);
} }
@@ -1372,14 +1369,10 @@ void doCmdContinue(char *params) {
// Show current instruction // Show current instruction
logAddr(); logAddr();
// Check if we have hit the transient breakpoint // If we have hit the transient breakpoint, clear it
if (memAddr == transientAddr) { int n = lookupBreakpointN(memAddr);
// Attempt to remove the transient breakpoint if ((n >= 0) && (modes[n] & (1 << TRANSIENT))) {
int n = lookupBreakpointN(transientAddr); clearBreakpoint(n);
if (n >= 0) {
clearBreakpoint(n);
}
transientAddr = 0xFFFF;
} }
} }