Skip to content

Commit 22688e8

Browse files
committed
update debugger for latest dev
1 parent 36e38ec commit 22688e8

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

binjaplug.py

+16-22
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tempfile
88

99
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
1111
post3 = True
1212
except:
1313
from binaryninja import Architecture, BinaryView, Symbol, SymbolType, Type, Structure, StructureType, FunctionGraphType, LowLevelILOperation, MediumLevelILOperation, core_ui_enabled, get_text_line_input, get_choice_input
@@ -16,17 +16,17 @@
1616
from . import DebugAdapter, ProcessView, dbgeng, gdblike, QueuedAdapter
1717

1818
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")
2828
else:
29-
have_ui = False
29+
have_ui = False
3030

3131
#------------------------------------------------------------------------------
3232
# Globals
@@ -580,23 +580,17 @@ def update_memory_view(self):
580580
if width > 0x1000:
581581
width = 0x1000
582582
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)
591584
else:
592585
struct = Structure()
593586
struct.type = StructureType.StructStructureType
594587
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):
596589
var_name = "var_{:x}".format(width - i)
597590
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"))
600594
self.old_symbols.append(self.memory_view.get_symbol_by_raw_name("$stack_frame"))
601595
self.old_dvs.add(self.registers['rsp'])
602596

0 commit comments

Comments
 (0)