add run in gdb menu action

This commit is contained in:
2026-04-20 23:52:06 +02:00
parent 495f74ade7
commit 19048ed4bf
5 changed files with 106 additions and 23 deletions

View File

@ -13,6 +13,8 @@ use TUI;
use feature 'say';
my $local_wamr = '/home/christoph/Notes/TU/MastersThesis/05 WAMR';
my $local_newlib = '/home/christoph/Notes/TU/MastersThesis/07 NewLib';
my $local_root = '/home/christoph/Notes/TU/MastersThesis/FailNix';
my $local_scripts_dir = "$local_root/scripts";
my $local_builds_dir = "$local_root/builds";
@ -92,7 +94,79 @@ my %handlers = (
}
},
'06. Plot Results' => sub {
'10. Open Experiment In Explorer' =>
sub { do "$local_scripts_dir/explore.pl" },
'11. Open Experiment in Ghidra' => sub {
my @projects =
map { s/\.gpr//r } Util::find_files($local_ghidra_projects);
my @selected_projects =
TUI::select_from_list( "Select Project to Open in Ghidra",
0, @projects );
die "No project selected" unless @selected_projects;
my $project = $selected_projects[0];
system(
join " ",
(
"_JAVA_AWT_WM_NONREPARENTING=1", "ghidra",
"$local_ghidra_projects/$project.gpr",
)
);
},
'12. Open Experiment in Binsider' => sub {
my @experiments = Util::find_subdirs($local_archive_dir);
my @selected_experiments =
TUI::select_from_list( "Select Experiments to Plot", 0,
@experiments );
die "No experiment selected" unless @selected_experiments;
my $selected_experiment = $selected_experiments[0];
system( 'binsider',
"$local_archive_dir/$selected_experiment/system.elf" );
},
'13. Run Build in GDB' => sub {
my @builds = Util::find_subdirs($local_builds_dir);
my @selected_builds =
TUI::select_from_list( "Select Build to Run", 0, @builds );
die "No experiment selected" unless @selected_builds;
my $selected_build = $selected_builds[0];
my $build_dir = "$local_builds_dir/$selected_build";
my $build_name = $selected_build =~ s/.*-.*-.*:.*:.*?_(.*)-.*-.*/$1/r;
my $module_source = "$local_root/build-$build_name";
say "$build_name";
system(
'gdb',
'--tui',
'-q',
"$build_dir/system.elf",
'-ex',
"set substitute-path '$module_source' '$build_dir'",
'-ex',
"set substitute-path '/build/source/core' '$local_wamr/core'",
'-ex',
'break main',
'-ex',
'break fail_start_trace',
'-ex',
'break fail_stop_trace',
'-ex',
'break fail_marker_positive',
'-ex',
'break fail_marker_detected',
'-ex',
'break fail_marker_negative',
'-ex',
'run',
);
},
'20. Plot Results' => sub {
# Generate R ggplot2 charts
my @experiments = Util::find_subdirs($local_archive_dir);
@ -129,28 +203,7 @@ my %handlers = (
}
},
'07. Open Experiment in Ghidra' => sub {
my @projects =
map { s/\.gpr//r } Util::find_files($local_ghidra_projects);
my @selected_projects =
TUI::select_from_list( "Select Project to Open in Ghidra",
0, @projects );
die "No project selected" unless @selected_projects;
my $project = $selected_projects[0];
system(
join " ",
(
"_JAVA_AWT_WM_NONREPARENTING=1", "ghidra",
"$local_ghidra_projects/$project.gpr",
)
);
},
'08. Open Experiment In Explorer' =>
sub { do "$local_scripts_dir/explore.pl" },
'95. Delete Builds (Local)' => sub {
'95. Delete Builds' => sub {
# Delete old build files
my @builds = Util::find_subdirs($local_builds_dir);