ModuleNameAndOffset represents an address that is relative to the start of module. It is useful when ASLR is on. * ``module``: the name of the module for which the address is in * ``offset``: the offset of the address to the start of the module
| 259 | |
| 260 | |
| 261 | class ModuleNameAndOffset: |
| 262 | """ |
| 263 | ModuleNameAndOffset represents an address that is relative to the start of module. It is useful when ASLR is on. |
| 264 | |
| 265 | * ``module``: the name of the module for which the address is in |
| 266 | * ``offset``: the offset of the address to the start of the module |
| 267 | |
| 268 | """ |
| 269 | def __init__(self, module, offset): |
| 270 | self.module = module |
| 271 | self.offset = offset |
| 272 | |
| 273 | def __eq__(self, other): |
| 274 | if not isinstance(other, self.__class__): |
| 275 | return NotImplemented |
| 276 | return self.module == other.module and self.offset == other.offset |
| 277 | |
| 278 | def __ne__(self, other): |
| 279 | if not isinstance(other, self.__class__): |
| 280 | return NotImplemented |
| 281 | return not (self == other) |
| 282 | |
| 283 | def __lt__(self, other): |
| 284 | if self.module < other.module: |
| 285 | return True |
| 286 | elif self.module > other.module: |
| 287 | return False |
| 288 | return self.offset < other.offset |
| 289 | |
| 290 | def __gt__(self, other): |
| 291 | if self.module > other.module: |
| 292 | return True |
| 293 | elif self.module < other.module: |
| 294 | return False |
| 295 | return self.offset > other.offset |
| 296 | |
| 297 | def __hash__(self): |
| 298 | return hash((self.module, self.offset)) |
| 299 | |
| 300 | def __setattr__(self, name, value): |
| 301 | try: |
| 302 | object.__setattr__(self, name, value) |
| 303 | except AttributeError: |
| 304 | raise AttributeError(f"attribute '{name}' is read only") |
| 305 | |
| 306 | |
| 307 | class DebugFrame: |