Skip to content

[Support] help getting unmapped memory address when error occurs #1589

@GTP95

Description

@GTP95

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

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