Skip to content

Commit

Permalink
Disable timer interrupt to fix some bugs
Browse files Browse the repository at this point in the history
Signed-off-by: liangzhen <[email protected]>
  • Loading branch information
lz-bro committed Oct 10, 2023
1 parent d4eaa5b commit ecf4fde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,10 @@ def test(self):
local = self.gdb.p("local")
if interrupt_count > 1000 and \
local > 1000:
self.disable_timer()
return

self.disable_timer()
assertGreater(interrupt_count, 1000)
assertGreater(local, 1000)

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

self.disable_timer(interrupt=True)

class MulticoreRtosSwitchActiveHartTest(GdbTest):
compile_args = ("programs/multicore.c", "-DMULTICORE")

Expand Down Expand Up @@ -1220,6 +1224,8 @@ def test(self):
assertIn("set_trap_handler", output)
assertNotIn("received signal SIGTRAP", output)

self.disable_timer()

class SmpSimultaneousRunHalt(GdbTest):
compile_args = ("programs/run_halt_timing.S", "-DMULTICORE")

Expand Down
7 changes: 7 additions & 0 deletions debug/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,13 @@ def disable_pmp(self):
# PMP registers are optional
pass

def disable_timer(self, interrupt=False):
for hart in self.target.harts:
self.gdb.select_hart(hart)
if interrupt:
self.gdb.interrupt()
self.gdb.p("$mie=$mie & ~0x80")

def exit(self, expected_result=10):
self.gdb.command("delete")
self.gdb.b("_exit")
Expand Down

0 comments on commit ecf4fde

Please sign in to comment.