mirror of https://github.com/pwndbg/pwndbg
Fix decompile error (#716)
This commit is contained in:
parent
c46417f709
commit
64ca9a66cf
|
@ -119,7 +119,7 @@ def get_decompile_coord_by_ea(cfunc, addr):
|
||||||
item = cfunc.body.find_closest_addr(addr)
|
item = cfunc.body.find_closest_addr(addr)
|
||||||
y_holder = idaapi.int_pointer()
|
y_holder = idaapi.int_pointer()
|
||||||
if not cfunc.find_item_coords(item, None, y_holder):
|
if not cfunc.find_item_coords(item, None, y_holder):
|
||||||
return cfunc
|
return None
|
||||||
y = y_holder.value()
|
y = y_holder.value()
|
||||||
else:
|
else:
|
||||||
lnmap = {}
|
lnmap = {}
|
||||||
|
@ -130,7 +130,7 @@ def get_decompile_coord_by_ea(cfunc, addr):
|
||||||
ret = cfunc.get_line_item(line.line, 0, True, phead, pitem, ptail)
|
ret = cfunc.get_line_item(line.line, 0, True, phead, pitem, ptail)
|
||||||
if ret and pitem.it:
|
if ret and pitem.it:
|
||||||
lnmap[pitem.it.ea] = i
|
lnmap[pitem.it.ea] = i
|
||||||
y = -1
|
y = None
|
||||||
closest_ea = BADADDR
|
closest_ea = BADADDR
|
||||||
for ea,line in lnmap.items():
|
for ea,line in lnmap.items():
|
||||||
if closest_ea == BADADDR or abs(closest_ea - addr) > abs(ea - addr):
|
if closest_ea == BADADDR or abs(closest_ea - addr) > abs(ea - addr):
|
||||||
|
@ -144,8 +144,9 @@ def decompile_context(addr, context_lines):
|
||||||
cfunc = decompile(addr)
|
cfunc = decompile(addr)
|
||||||
if cfunc is None:
|
if cfunc is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
y = get_decompile_coord_by_ea(cfunc, addr)
|
y = get_decompile_coord_by_ea(cfunc, addr)
|
||||||
|
if y is None:
|
||||||
|
return cfunc
|
||||||
lines = cfunc.get_pseudocode()
|
lines = cfunc.get_pseudocode()
|
||||||
retlines = []
|
retlines = []
|
||||||
for lnnum in range(max(0, y - context_lines), min(len(lines), y + context_lines)):
|
for lnnum in range(max(0, y - context_lines), min(len(lines), y + context_lines)):
|
||||||
|
|
Loading…
Reference in New Issue