Hello,
I'm trying to emulate a binary, but unfortunately it fails with the following error message: unicorn.unicorn.UcError: Invalid memory write (UC_ERR_WRITE_UNMAPPED). When such an error occurs, I would like to be able to get the offending memory address, so that I can check if my memory mappings are correct. My idea would be to add a hook via ql.hook_mem_unmapped(), but it is not clear to me how I could get the memory address from there. What I had in mind, is something like this:
def warn_unmapped(mem_addr):
print("Warning: attempted access to unmapped memory at address " + mem_addr)
ql.hook_mem_unmapped(warn_unmapped(mem_addr))
But I don't know where to get the value of mem_addr from. How can I get this to work? Or is there a better way to do this?
Thank you for your help,
GTP95