| 2332 | self.handle = handle |
| 2333 | |
| 2334 | def format_description(self, description: dict) -> str: |
| 2335 | formatted_description = "" |
| 2336 | for entry in description['MemoryMap']: |
| 2337 | formatted_description += f"<region: {hex(entry['address'])} - {hex(entry['address'] + entry['length'])}>\n" |
| 2338 | formatted_description += f"\tsize: {hex(entry['length'])}\n" |
| 2339 | formatted_description += "\tobjects:\n" |
| 2340 | for obj in entry['objects']: |
| 2341 | if obj['target']: |
| 2342 | mapped_state = f"Mapped<{'Absolute' if obj['absolute_address_mode'] else 'Relative'}>" |
| 2343 | else: |
| 2344 | mapped_state = "Unmapped" |
| 2345 | formatted_description += f"\t\t'{obj['name']}' | {mapped_state}" |
| 2346 | r = "r" if obj['flags'] & SegmentFlag.SegmentReadable else "-" |
| 2347 | w = "w" if obj['flags'] & SegmentFlag.SegmentWritable else "-" |
| 2348 | x = "x" if obj['flags'] & SegmentFlag.SegmentExecutable else "-" |
| 2349 | formatted_description += f" | <{r}{w}{x}>" |
| 2350 | if not obj['target']: |
| 2351 | formatted_description += f" | FILL<{hex(obj['fill'])}>" |
| 2352 | if not obj['enabled']: |
| 2353 | formatted_description += f" | <DISABLED>" |
| 2354 | formatted_description += "\n" |
| 2355 | formatted_description += "\n" |
| 2356 | |
| 2357 | return formatted_description |
| 2358 | |
| 2359 | def description(self, base: bool = False) -> dict: |
| 2360 | if base: |