DebugModule represents a module in the target. It has the following fields: * ``name``: the path of the module * ``short_name``: the name of the module * ``address``: the base load address of the module * ``size``: the size of the module * ``loaded``: not used
| 98 | |
| 99 | |
| 100 | class DebugModule: |
| 101 | """ |
| 102 | DebugModule represents a module in the target. It has the following fields: |
| 103 | |
| 104 | * ``name``: the path of the module |
| 105 | * ``short_name``: the name of the module |
| 106 | * ``address``: the base load address of the module |
| 107 | * ``size``: the size of the module |
| 108 | * ``loaded``: not used |
| 109 | |
| 110 | """ |
| 111 | def __init__(self, name, short_name, address, size, loaded): |
| 112 | self.name = name |
| 113 | self.short_name = short_name |
| 114 | self.address = address |
| 115 | self.size = size |
| 116 | self.loaded = loaded |
| 117 | |
| 118 | @staticmethod |
| 119 | def is_same_base_module(module1: str, module2: str) -> bool: |
| 120 | return dbgcore.BNDebuggerIsSameBaseModule(module1, module2) |
| 121 | |
| 122 | def __eq__(self, other): |
| 123 | if not isinstance(other, self.__class__): |
| 124 | return NotImplemented |
| 125 | return self.name == other.name and self.short_name == other.short_name and self.address == other.address\ |
| 126 | and self.size == other.size and self.loaded == other.loaded |
| 127 | |
| 128 | def __ne__(self, other): |
| 129 | if not isinstance(other, self.__class__): |
| 130 | return NotImplemented |
| 131 | return not (self == other) |
| 132 | |
| 133 | def __hash__(self): |
| 134 | return hash((self.name, self.short_name, self.address. self.size, self.loaded)) |
| 135 | |
| 136 | def __setattr__(self, name, value): |
| 137 | try: |
| 138 | object.__setattr__(self, name, value) |
| 139 | except AttributeError: |
| 140 | raise AttributeError(f"attribute '{name}' is read only") |
| 141 | |
| 142 | def __repr__(self): |
| 143 | return f"<DebugModule: {self.name}, {self.address:#x}, {self.size:#x}>" |
| 144 | |
| 145 | |
| 146 | class DebugRegister: |