Fix IDA 7 unhandled DecompilationFailure (#455)

pull/456/head
Disconnect3d 8 years ago committed by GitHub
parent 448dd066e4
commit 9cb502277e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -102,11 +102,25 @@ def register_module(module):
server.register_function(wrap(function), name)
def decompile(addr):
"""
Function that overwrites `idaapi.decompile` for xmlrpc so that instead
of throwing an exception on `idaapi.DecompilationFailure` it just returns `None`.
(so that we don't have to parse xmlrpc Fault's exception string on pwndbg side
as it differs between IDA versions).
"""
try:
return idaapi.decompile(addr)
except idaapi.DecompilationFailure:
return None
server = SimpleXMLRPCServer((host, port), logRequests=True, allow_none=True)
register_module(idc)
register_module(idautils)
register_module(idaapi)
server.register_function(lambda a: eval(a, globals(), locals()), 'eval')
server.register_function(decompile) # overwrites idaapi/ida_hexrays.decompie
server.register_introspection_functions()
print('IDA Pro xmlrpc hosted on http://%s:%s' % (host, port))

@ -388,13 +388,7 @@ def has_cached_cfunc(addr):
@takes_address
@pwndbg.memoize.reset_on_stop
def decompile(addr):
try:
return _ida.decompile(addr)
except xmlrpclib.Fault as f:
if str(f) == '''<Fault 1: "<class 'idaapi.DecompilationFailure'>:Decompilation failed: ">''':
print('Returning an empty string')
return None
raise
@withIDA

Loading…
Cancel
Save