aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2023-01-06 11:35:35 -0800
committerGitHub <noreply@github.com>2023-01-06 11:35:35 -0800
commit1753fda262809ce55d09b529cd975f4016bcc2f0 (patch)
tree471a7e38aebba3e1067f3d18cc9fb74193800e04 /debug
parent0d397a64d880a83a249e926f985e3cf57ce03620 (diff)
parentcbe0dd1405cd2f33ef1cbbc67eda73bfe65d067e (diff)
downloadriscv-tests-1753fda262809ce55d09b529cd975f4016bcc2f0.zip
riscv-tests-1753fda262809ce55d09b529cd975f4016bcc2f0.tar.gz
riscv-tests-1753fda262809ce55d09b529cd975f4016bcc2f0.tar.bz2
Merge pull request #447 from riscv-software-src/etrigger
debug: Add etrigger test.
Diffstat (limited to 'debug')
-rwxr-xr-xdebug/gdbserver.py19
-rw-r--r--debug/programs/debug.c2
2 files changed, 20 insertions, 1 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py
index af8ddcf..1ffb15f 100755
--- a/debug/gdbserver.py
+++ b/debug/gdbserver.py
@@ -1953,6 +1953,25 @@ class StepThread2Test(GdbTest):
# GDB's conception of the current thread
assertEqual(before, after)
+class EtriggerTest(DebugTest):
+ def setup(self):
+ DebugTest.setup(self)
+ self.gdb.b("main:start")
+ self.gdb.c()
+ self.gdb.b("handle_trap")
+
+ def test(self):
+ # Set trigger on Load access fault
+ self.gdb.command("monitor riscv etrigger set m 0x20")
+ # Set fox to a null pointer so we'll get a load access exception later.
+ self.gdb.p("fox=(char*)0")
+ output = self.gdb.c()
+ # We should not be at handle_trap
+ assertNotIn("handle_trap", output)
+ # Instead, we should have hit a breakpoint at trap_entry, which is the
+ # actual exception handler.
+ assertIn("breakpoint", output)
+ assertIn("trap_entry", self.gdb.where())
parsed = None
def main():
diff --git a/debug/programs/debug.c b/debug/programs/debug.c
index 641aa4e..a5693a5 100644
--- a/debug/programs/debug.c
+++ b/debug/programs/debug.c
@@ -53,7 +53,7 @@ int main()
volatile int i = 0;
int j = 0;
- char fox[] = "The quick brown fox jumps of the lazy dog.";
+ char *fox = "The quick brown fox jumps of the lazy dog.";
unsigned int checksum = 0;
volatile uint32_t i32 = 0xdeadbeef;
volatile uint64_t i64 = 0x1122334455667788;