Skip to content

Commit

Permalink
Handle some decompiler failuer in AM (#104)
Browse files Browse the repository at this point in the history
* Handle some decompiler failuer in AM

* bump
  • Loading branch information
mahaloz authored Jul 18, 2024
1 parent 39379b0 commit 06d35cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion decomp2dbg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.9.4"
__version__ = "3.9.5"

try:
from .clients.client import DecompilerClient
Expand Down
7 changes: 6 additions & 1 deletion decompilers/d2d_angr/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ def decompile(self, addr: int):
func_addr = self._instance.cfg.get_any_node(addr, anyaddr=True).function_address
func = self._instance.kb.functions[func_addr]
decomp = self._decompile_function(func)
pos = decomp.map_addr_to_pos.get_nearest_pos(addr)
try:
pos = decomp.map_addr_to_pos.get_nearest_pos(addr)
except Exception as e:
print(f"Failed to get nearest pos: {e} for {hex(addr)}, skipping decomp")
return resp

size = len(decomp.text)
line_end = decomp.text.find("\n", pos)
line_start = size - decomp.text[::-1].find("\n", size - line_end)
Expand Down

0 comments on commit 06d35cf

Please sign in to comment.