|
7 | 7 | import tempfile |
8 | 8 |
|
9 | 9 | try: |
10 | | - from binaryninja import Architecture, BinaryView, Symbol, SymbolType, Type, StructureBuilder, StructureType, FunctionGraphType, LowLevelILOperation, MediumLevelILOperation, core_ui_enabled, get_text_line_input, get_choice_input |
| 10 | + from binaryninja import Architecture, BinaryView, Symbol, SymbolType, Type, StructureBuilder, StructureVariant, FunctionGraphType, LowLevelILOperation, MediumLevelILOperation, core_ui_enabled, get_text_line_input, get_choice_input |
11 | 11 | post3 = True |
12 | 12 | except: |
13 | 13 | from binaryninja import Architecture, BinaryView, Symbol, SymbolType, Type, Structure, StructureType, FunctionGraphType, LowLevelILOperation, MediumLevelILOperation, core_ui_enabled, get_text_line_input, get_choice_input |
|
16 | 16 | from . import DebugAdapter, ProcessView, dbgeng, gdblike, QueuedAdapter |
17 | 17 |
|
18 | 18 | if core_ui_enabled(): |
19 | | - try: |
20 | | - # create the widgets, debugger, etc. |
21 | | - from . import ui |
22 | | - ui.initialize_ui() |
23 | | - have_ui = True |
24 | | - except (ModuleNotFoundError, ImportError, IndexError) as e: |
25 | | - have_ui = False |
26 | | - print(e) |
27 | | - print("Could not initialize UI, using headless mode only") |
| 19 | + try: |
| 20 | + # create the widgets, debugger, etc. |
| 21 | + from . import ui |
| 22 | + ui.initialize_ui() |
| 23 | + have_ui = True |
| 24 | + except (ModuleNotFoundError, ImportError, IndexError) as e: |
| 25 | + have_ui = False |
| 26 | + print(e) |
| 27 | + print("Could not initialize UI, using headless mode only") |
28 | 28 | else: |
29 | | - have_ui = False |
| 29 | + have_ui = False |
30 | 30 |
|
31 | 31 | #------------------------------------------------------------------------------ |
32 | 32 | # Globals |
@@ -580,23 +580,17 @@ def update_memory_view(self): |
580 | 580 | if width > 0x1000: |
581 | 581 | width = 0x1000 |
582 | 582 | if post3: |
583 | | - with StructureBuilder.create() as struct: |
584 | | - struct.type = Type.structure_type |
585 | | - struct.width = width |
586 | | - for i in range(0, width, self.remote_arch.address_size): |
587 | | - var_name = "var_{:x}".format(width - i) |
588 | | - struct.insert(i, Type.pointer(self.remote_arch, Type.void()), var_name) |
589 | | - self.memory_view.define_data_var(self.registers['rsp'], Type.structure_type(struct)) |
590 | | - self.memory_view.define_auto_symbol(Symbol(SymbolType.ExternalSymbol, self.registers['rsp'], "$stack_frame", raw_name="$stack_frame")) |
| 583 | + struct = StructureBuilder.create(type=StructureVariant.StructStructureType, width=width) |
591 | 584 | else: |
592 | 585 | struct = Structure() |
593 | 586 | struct.type = StructureType.StructStructureType |
594 | 587 | struct.width = width |
595 | | - for i in range(0, width, self.remote_arch.address_size): |
| 588 | + for i in range(0, width, self.remote_arch.address_size): |
596 | 589 | var_name = "var_{:x}".format(width - i) |
597 | 590 | struct.insert(i, Type.pointer(self.remote_arch, Type.void()), var_name) |
598 | | - self.memory_view.define_data_var(self.registers['rsp'], Type.structure_type(struct)) |
599 | | - self.memory_view.define_auto_symbol(Symbol(SymbolType.ExternalSymbol, self.registers['rsp'], "$stack_frame", raw_name="$stack_frame")) |
| 591 | + self.memory_view.define_data_var(self.registers['rsp'], struct if post3 else Type.structure_type(struct)) |
| 592 | + |
| 593 | + self.memory_view.define_auto_symbol(Symbol(SymbolType.ExternalSymbol, self.registers['rsp'], "$stack_frame", raw_name="$stack_frame")) |
600 | 594 | self.old_symbols.append(self.memory_view.get_symbol_by_raw_name("$stack_frame")) |
601 | 595 | self.old_dvs.add(self.registers['rsp']) |
602 | 596 |
|
|
0 commit comments