Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in bad angr importing #3

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sailreval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.0.0"
__version__ = "1.0.1"

# create loggers
import logging
Expand Down
7 changes: 6 additions & 1 deletion sailreval/decompilers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ def _decompile(decompiler, binary_path, functions, source_path=None, sailr_targe
def decompile_file(filepath, sailr_target=None, src_dir=None, functions=None, decompilers=None, cores=1, symboless=False):
filepath = Path(filepath).absolute()
source_path = Path(src_dir).joinpath(filepath.with_suffix("").name).with_suffix(".c").absolute() if src_dir else None
functions = functions or get_all_funcs(filepath)

# fill functions only if the decompiler NEEDS it. It's expensive to get all functions (uses angr).
# this should always skip for only source
uneeded_decs = {SAILR_DECOMPILERS.SOURCE_CODE, SAILR_DECOMPILERS.GHIDRA, SAILR_DECOMPILERS.IDA}
if not functions and any([dec not in uneeded_decs for dec in decompilers]):
functions = get_all_funcs(filepath)

decompilers = decompilers or ALL_DECOMPILERS
if not cores or cores == 1:
Expand Down
5 changes: 3 additions & 2 deletions sailreval/utils/binary_debug_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ def gen_dwarf_addr_to_line_map(binary_path: Path, full_search=True):
total_addr_line, rebased_addr = _start_address(dwarf_info)
return total_addr_line

# XXX: uses angr to get all addresses (slow)
return _all_address(dwarf_info, binary_path)


def dump_dwarf_addr_to_line_map(binary_path: Path):
addr_to_line = gen_dwarf_addr_to_line_map(binary_path, full_search=False)
def dump_dwarf_addr_to_line_map(binary_path: Path, full_search=False):
addr_to_line = gen_dwarf_addr_to_line_map(binary_path, full_search=full_search)
output = {
str(k): v for k, v in addr_to_line.items()
}
Expand Down