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);
|
my @existing = Util::find_files($local_ghidra_projects);
|
||||||
|
|
||||||
# Determine if an experiment was already imported
|
# Determine if an experiment was already imported
|
||||||
my $is_old = sub {
|
my $project_exists = sub {
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
$name =~ s/:/-/g;
|
$name =~ s/:/-/g;
|
||||||
|
|
||||||
@ -119,23 +119,37 @@ my %handlers = (
|
|||||||
|
|
||||||
# Import archived experiments into ghidra
|
# Import archived experiments into ghidra
|
||||||
my @dirs =
|
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 =
|
my @selected_dirs =
|
||||||
TUI::select_from_list( "Select Experiments to Import into Ghidra",
|
TUI::select_from_list( "Select Experiments to Import into Ghidra",
|
||||||
1, @dirs );
|
1, @dirs_with_notes );
|
||||||
|
|
||||||
foreach (@selected_dirs) {
|
foreach (@selected_dirs) {
|
||||||
say "Creating Ghidra project for $_...";
|
my $experiment = $_ =~ s/(.*?)\s+\(.+\)$/$1/r;
|
||||||
|
|
||||||
|
say "Creating Ghidra project for $experiment...";
|
||||||
system(
|
system(
|
||||||
'ghidra-analyzeHeadless',
|
'ghidra-analyzeHeadless',
|
||||||
|
|
||||||
$local_ghidra_projects, $_ =~ s/:/-/gr,
|
$local_ghidra_projects, $experiment =~ s/:/-/gr,
|
||||||
'-import', "$local_archive_dir/$_/system.elf",
|
'-import', "$local_archive_dir/$experiment/system.elf",
|
||||||
'-scriptPath', $local_ghidra_scripts,
|
'-scriptPath', $local_ghidra_scripts,
|
||||||
'-postScript', 'DWARFLineInfoSourceMapScript',
|
'-postScript', 'DWARFLineInfoSourceMapScript',
|
||||||
'-postScript', 'DWARFLineInfoCommentScript',
|
'-postScript', 'DWARFLineInfoCommentScript',
|
||||||
'-postScript', 'ImportMarkersAsBookmarks',
|
'-postScript', 'ImportMarkersAsBookmarks',
|
||||||
"$local_archive_dir/$_/faults.csv"
|
"$local_archive_dir/$experiment/faults.csv"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user