Skip to content

Commit 34fb040

Browse files
authored
Merge pull request #503 from lz-bro/dis_timer
Disable timer interrupt to fix some bugs
2 parents 9905a43 + ecf4fde commit 34fb040

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

debug/gdbserver.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,10 @@ def test(self):
10391039
local = self.gdb.p("local")
10401040
if interrupt_count > 1000 and \
10411041
local > 1000:
1042+
self.disable_timer()
10421043
return
10431044

1045+
self.disable_timer()
10441046
assertGreater(interrupt_count, 1000)
10451047
assertGreater(local, 1000)
10461048

@@ -1191,6 +1193,8 @@ def test(self):
11911193
time.sleep(1)
11921194
self.gdb.p("buf", fmt="")
11931195

1196+
self.disable_timer(interrupt=True)
1197+
11941198
class MulticoreRtosSwitchActiveHartTest(GdbTest):
11951199
compile_args = ("programs/multicore.c", "-DMULTICORE")
11961200

@@ -1220,6 +1224,8 @@ def test(self):
12201224
assertIn("set_trap_handler", output)
12211225
assertNotIn("received signal SIGTRAP", output)
12221226

1227+
self.disable_timer()
1228+
12231229
class SmpSimultaneousRunHalt(GdbTest):
12241230
compile_args = ("programs/run_halt_timing.S", "-DMULTICORE")
12251231

debug/testlib.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,13 @@ def disable_pmp(self):
14481448
# PMP registers are optional
14491449
pass
14501450

1451+
def disable_timer(self, interrupt=False):
1452+
for hart in self.target.harts:
1453+
self.gdb.select_hart(hart)
1454+
if interrupt:
1455+
self.gdb.interrupt()
1456+
self.gdb.p("$mie=$mie & ~0x80")
1457+
14511458
def exit(self, expected_result=10):
14521459
self.gdb.command("delete")
14531460
self.gdb.b("_exit")

0 commit comments

Comments
 (0)