show experiment info when importing into ghidra
This commit is contained in:
@ -110,7 +110,7 @@ my %handlers = (
|
||||
my @existing = Util::find_files($local_ghidra_projects);
|
||||
|
||||
# Determine if an experiment was already imported
|
||||
my $is_old = sub {
|
||||
my $project_exists = sub {
|
||||
my ($name) = @_;
|
||||
$name =~ s/:/-/g;
|
||||
|
||||
@ -119,23 +119,37 @@ my %handlers = (
|
||||
|
||||
# Import archived experiments into ghidra
|
||||
my @dirs =
|
||||
grep { !$is_old->($_) } Util::find_subdirs($local_archive_dir);
|
||||
grep { !$project_exists->($_) }
|
||||
Util::find_subdirs($local_archive_dir);
|
||||
|
||||
my @dirs_with_notes;
|
||||
foreach my $dir (@dirs) {
|
||||
my $info = Util::read_experiment_info($dir);
|
||||
|
||||
push @dirs_with_notes,
|
||||
( defined $info && length($info) > 0 )
|
||||
? sprintf( "%-50s (%s)", $dir, $info )
|
||||
: $dir;
|
||||
}
|
||||
|
||||
my @selected_dirs =
|
||||
TUI::select_from_list( "Select Experiments to Import into Ghidra",
|
||||
1, @dirs );
|
||||
1, @dirs_with_notes );
|
||||
|
||||
foreach (@selected_dirs) {
|
||||
say "Creating Ghidra project for $_...";
|
||||
my $experiment = $_ =~ s/(.*?)\s+\(.+\)$/$1/r;
|
||||
|
||||
say "Creating Ghidra project for $experiment...";
|
||||
system(
|
||||
'ghidra-analyzeHeadless',
|
||||
|
||||
$local_ghidra_projects, $_ =~ s/:/-/gr,
|
||||
'-import', "$local_archive_dir/$_/system.elf",
|
||||
'-scriptPath', $local_ghidra_scripts,
|
||||
'-postScript', 'DWARFLineInfoSourceMapScript',
|
||||
'-postScript', 'DWARFLineInfoCommentScript',
|
||||
'-postScript', 'ImportMarkersAsBookmarks',
|
||||
"$local_archive_dir/$_/faults.csv"
|
||||
$local_ghidra_projects, $experiment =~ s/:/-/gr,
|
||||
'-import', "$local_archive_dir/$experiment/system.elf",
|
||||
'-scriptPath', $local_ghidra_scripts,
|
||||
'-postScript', 'DWARFLineInfoSourceMapScript',
|
||||
'-postScript', 'DWARFLineInfoCommentScript',
|
||||
'-postScript', 'ImportMarkersAsBookmarks',
|
||||
"$local_archive_dir/$experiment/faults.csv"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user