Dump instruction trace for all error exceptions, not just illegal opcode
Wrap opcode execution with try-except to catch all ZCpuError subclasses except ZCpuQuit and ZCpuRestart, which are normal control flow. This ensures we get trace dumps for divide by zero, not implemented, and other errors.
This commit is contained in:
parent
0f5fada29e
commit
8ba1701c9f
1 changed files with 9 additions and 1 deletions
|
|
@ -216,7 +216,15 @@ class ZCpu:
|
||||||
|
|
||||||
# The returned function is unbound, so we must pass
|
# The returned function is unbound, so we must pass
|
||||||
# self to it ourselves.
|
# self to it ourselves.
|
||||||
|
try:
|
||||||
func(self, *operands)
|
func(self, *operands)
|
||||||
|
except (ZCpuQuit, ZCpuRestart):
|
||||||
|
# Normal control flow - don't dump trace
|
||||||
|
raise
|
||||||
|
except ZCpuError:
|
||||||
|
# All other ZCpu errors - dump trace for debugging
|
||||||
|
self._dump_trace()
|
||||||
|
raise
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue