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

@ -12,6 +12,7 @@ if (!file.exists(datafile)) {
} }
data <- readr::read_csv(datafile) data <- readr::read_csv(datafile)
tibble::glimpse(data)
plot <- ggplot(data, aes(x = benchmark, y = faults, fill = resulttype)) + plot <- ggplot(data, aes(x = benchmark, y = faults, fill = resulttype)) +
geom_col(position = "dodge") + geom_col(position = "dodge") +

24
charts/single_scatter.r Normal file
View File

@ -0,0 +1,24 @@
library(ggplot2)
# Usage: Rscript single_scatter.r exp_abspath
args <- commandArgs(trailingOnly = TRUE)
experiment <- args[1]
datafile <- paste(experiment, "/faults.csv", sep = "")
if (!file.exists(datafile)) {
print(paste("Input file", datafile, "is missing"))
stop()
}
data <- readr::read_csv(datafile)
data$fault_address <- strtoi(data$fault_address)
tibble::glimpse(data)
plot <- ggplot(data, aes(x = fault_address, y = faults)) +
geom_point() +
scale_y_log10() +
labs(x = "Address", y = "Faults") +
theme_minimal()
ggsave(paste(experiment, "/scatter.svg", sep = ""), plot = plot)

View File

@ -30,6 +30,9 @@ my $selected_experiment = $selected_experiments[0];
my $cui = TUI::init_cui(); my $cui = TUI::init_cui();
# TODO: Add a TextEditor panel below the markers for notes.
# Store notes in ./notes/benchmark-type-address.txt
# ============================================================================= # =============================================================================
# Data handling # Data handling
# ============================================================================= # =============================================================================

View File

@ -13,6 +13,8 @@ use TUI;
use feature 'say'; 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_root = '/home/christoph/Notes/TU/MastersThesis/FailNix';
my $local_scripts_dir = "$local_root/scripts"; my $local_scripts_dir = "$local_root/scripts";
my $local_builds_dir = "$local_root/builds"; 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 # Generate R ggplot2 charts
my @experiments = Util::find_subdirs($local_archive_dir); my @experiments = Util::find_subdirs($local_archive_dir);
@ -129,28 +203,7 @@ my %handlers = (
} }
}, },
'07. Open Experiment in Ghidra' => sub { '95. Delete Builds' => 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 {
# Delete old build files # Delete old build files
my @builds = Util::find_subdirs($local_builds_dir); my @builds = Util::find_subdirs($local_builds_dir);

View File

@ -25,9 +25,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace(); fail_stop_trace();
if (X == 100) { if (X == 100) {
HOST_PRINT("result correct.\n");
fail_marker_positive(); fail_marker_positive();
return 0; return 0;
} else { } else {
HOST_PRINT("result incorrect.\n");
fail_marker_negative(); fail_marker_negative();
return 1; return 1;
} }