Skip to content

retdec_decompiler.py: Pass correct selected ranges and functions to config tool #354

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

Merged
merged 1 commit into from
Jul 13, 2018
Merged
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
14 changes: 9 additions & 5 deletions scripts/retdec_decompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,12 @@ def _check_arguments(self):

# Check if first <= last.
ranges = r.split('-')

# parser line into array
if int(ranges[0]) > int(ranges[1]):
start_range = int(ranges[0], 16 if ranges[0].startswith('0x') else 10)
end_range = int(ranges[1], 16 if ranges[1].startswith('0x') else 10)

if start_range > end_range:
Utils.print_error(
'Range \'%s\' in option --select-ranges is not a valid range: '
'second address must be greater or equal than the first one.' % ranges)
Expand Down Expand Up @@ -1078,12 +1082,12 @@ def decompile(self):
cmd.run_cmd([config.CONFIGTOOL, self.config_file, '--write', '--decode-only-selected', 'false'])

# Store selected functions or selected ranges into config for frontend.
if self.args.selected_functions:
for f in self.args.selected_functions:
if self.selected_functions:
for f in self.selected_functions:
cmd.run_cmd([config.CONFIGTOOL, self.config_file, '--write', '--selected-func', f])

if self.args.selected_ranges:
for r in self.args.selected_ranges:
if self.selected_ranges:
for r in self.selected_ranges:
cmd.run_cmd([config.CONFIGTOOL, self.config_file, '--write', '--selected-range', r])

# Assignment of other used variables.
Expand Down