Skip to content

"unexpected TypeError" message when I expect the TypeError to be passed through #16

@jwise

Description

@jwise

I'm simulating a CortexM-based system, and trying to use an AddHook to trigger a Python action when I hit a certain pc in the simulation. I'm trying this:

>>> ams.sysbus.cpu0.AddHook(0x8001d7c, lambda: print("fired!"))

But I immediately get this:

>>> ams.sysbus.cpu0.AddHook(0x8001d7c, lambda: print("fired!"))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    ams.sysbus.cpu0.AddHook(0x8001d7c, lambda: print("fired!"))
  File "/home/joshua/bambu/ams_reveng/renode/renode_venv/lib/python3.12/site-packages/pyrenode3/wrapper.py", line 29, in __call__
    raise RuntimeError(msg) from e
RuntimeError: Unexpected 'TypeError' occured. This shouldn't happen unless Python.NET changes significantly.

I changed line 29 to just raise , and this gives a more familiar-looking error: TypeError: No method matches given arguments for CpuHooksExtensions.AddHook: (<class 'Antmicro.Renode.Peripherals.CPU.CortexM'>, <class 'int'>, <class 'function'>)

This error looks like an error I've seen before, at least:

>>> ams.sysbus.LoadBinary("bad")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    ams.sysbus.LoadBinary("bad")
TypeError: No method matches given arguments for FileLoaderExtensions.LoadBinary: (<class 'Antmicro.Renode.Peripherals.Bus.SystemBus'>, <class 'str'>)

So now I need to figure out how to call a (ulong, Action<ICpuSupportingGdb, ulong>). But that's more tractable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions