Skip to content

Commit aa15f70

Browse files
committed
Support instruction count limit in IcountTest
This is taking into account that the hardware limits count to 1. Signed-off-by: liangzhen <[email protected]>
1 parent d020e20 commit aa15f70

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

debug/gdbserver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,9 +2129,13 @@ def setup(self):
21292129
def test(self):
21302130
# Execute 2 instructions.
21312131
output = self.gdb.command("monitor riscv icount set m 2")
2132-
assertNotIn("Failed", output)
2132+
if self.target.icount_limit > 1:
2133+
assertNotIn("Failed", output)
2134+
else:
2135+
assertIn("Failed", output)
2136+
self.gdb.b("main_post_csrr")
21332137
output = self.gdb.c()
2134-
assertIn("breakpoint", output)
2138+
assertIn("main_post_csrr", output)
21352139
main_post_csrr = self.gdb.p("&main_post_csrr")
21362140
assertEqual(self.gdb.p("$pc"), main_post_csrr)
21372141

debug/targets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class Target:
138138
# Supports controlling hart availability through DMCUSTOM.
139139
support_unavailable_control = False
140140

141+
# Instruction count limit
142+
icount_limit = 4
143+
141144
# Internal variables:
142145
directory = None
143146
temporary_files = []

0 commit comments

Comments
 (0)