Compare commits

..

5 Commits

13 changed files with 122 additions and 24 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/mars-db.conf
/.direnv
/db.conf
/fail/bin/resultbrowser/app/__pycache__

View File

@ -322,8 +322,9 @@ rec {
domain = "gitea.local.chriphost.de";
owner = "christoph";
repo = "wamr";
rev = "4e7aed33fe53bf3ee4a3f2fe582c74816f850759";
hash = "sha256-/4BKwoFDRfkA+DmbWagxdtkCDAED5rxbz5e4xvjvVWU=";
rev = "cda2009deb85511089b04b0ac736ad4da2d07e58";
hash = "sha256-CN6xTiwzF4Jbrpf21TF5c/C03Xb3urwkibRuIXjoU/w=";
};
nativeBuildInputs = with pkgs; [cmake];

BIN
ggplot2_a.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
ggplot2_b.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -35,6 +35,7 @@ sub ssh_connect {
master_opts => [
-o => 'BatchMode=yes',
-o => 'StrictHostKeyChecking=accept-new',
-o => 'ServerAliveInterval=60',
],
);
$_remote->error and die 'SSH connection failed: ' . $_remote->error;

View File

@ -35,6 +35,8 @@ my $cui = TUI::init_cui();
# TODO: Add a more exhaustive faults query that also retrieves
# what fault has been injected. Then add an info popup or
# display it in the markers panel
# TODO: Add a filter for address ranges
# TODO: Add a filter for segments
# =============================================================================
# Data handling

View File

@ -13,6 +13,9 @@ use TUI;
use feature 'say';
my $local_obsidian = '/home/christoph/Notes/Obsidian/Chriphost';
my $local_obsidian_attach = "$local_obsidian/attach";
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';
@ -24,6 +27,9 @@ my $local_ghidra_projects = "$local_root/ghidra/projects";
my $local_ghidra_scripts = "$local_root/ghidra/scripts";
my $local_db_conf = "$local_root/db.conf";
my $resultbrowser_port = '5000';
my $resultbrowser = 'resultbrowser.py';
my $remote_root = '/home/lab/smchurla/Documents/failnix';
my $remote_builds_dir = "$remote_root/builds";
@ -38,7 +44,8 @@ my %handlers = (
# Download ran experiments from mars
my @dirs = Mars::find_remote_subdirs($remote_builds_dir);
my @selected_dirs =
TUI::select_from_list( "Select Experiments to Download", 1, @dirs );
TUI::select_from_list( "Select Experiments to Download from Mars",
1, @dirs );
die "No experiment selected" unless @selected_dirs;
Mars::download_dir( "$remote_builds_dir/$_",
"$local_archive_dir/" . $_ =~ s/:/-/gr )
@ -89,7 +96,8 @@ my %handlers = (
grep { !$is_old->($_) } Util::find_subdirs($local_archive_dir);
my @selected_dirs =
TUI::select_from_list( "Select Experiments to Import", 1, @dirs );
TUI::select_from_list( "Select Experiments to Import into Ghidra",
1, @dirs );
foreach (@selected_dirs) {
say "Creating Ghidra project for $_...";
system(
@ -106,6 +114,72 @@ my %handlers = (
}
},
'06. Import Experiments Into Obsidian' => sub {
my @experiments = Util::find_subdirs($local_archive_dir);
# Filter experiments that already have notes
my @new_experiments;
my @existing_notes = split "\n", qx{obsidian files};
foreach my $experiment (@experiments) {
push @new_experiments, $experiment
unless ( grep { /zettel\/$experiment/ } @existing_notes );
}
my @selected_experiments =
TUI::select_from_list( "Select Experiments to Import into Obsidian",
1, @new_experiments );
die "No experiment selected" unless @selected_experiments;
foreach my $experiment (@selected_experiments) {
# Create note
system(
'obsidian', 'create',
"name=$experiment", 'path=zettel',
'template=FailExperiment', 'open',
'newtab'
);
# Insert results
if ( -f "$local_archive_dir/$experiment/results.txt" ) {
open( my $fhandle, '<',
"$local_archive_dir/$experiment/results.txt" )
or return;
my $results = join "", <$fhandle>;
close($fhandle);
say "$local_archive_dir/$experiment/results.txt does not exist";
system( 'obsidian', 'append', "file=zettel/$experiment",
"content=## Results\n\n```\n$results```\n" );
}
# Insert charts
my $attach_image = sub {
my ($name) = @_;
return unless ( -f "$local_archive_dir/$experiment/$name.svg" );
system(
'cp', '-i',
"$local_archive_dir/$experiment/$name.svg",
"$local_obsidian_attach/${experiment}_$name.svg"
);
system( 'obsidian', 'append', "file=zettel/$experiment",
"content=![[${experiment}_$name.svg]]\n" );
};
system(
'obsidian', 'append',
"file=zettel/$experiment", "content=## Charts\n\n"
);
$attach_image->("single_result");
$attach_image->("scatter");
}
},
'10. Open Experiment In Explorer' =>
sub { do "$local_scripts_dir/explore.pl" },
@ -130,8 +204,8 @@ my %handlers = (
'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 );
TUI::select_from_list( "Select Experiments to Open in Binsider",
0, @experiments );
die "No experiment selected" unless @selected_experiments;
my $selected_experiment = $selected_experiments[0];
@ -141,14 +215,24 @@ my %handlers = (
'13. Open Experiment in ResultBrowser' => sub {
# TODO: Select from existing DBs, rewrite db.conf,
# launch resultbrowser + firefox
my @db_names = Mars::db_list();
my @selected_dbs =
TUI::select_from_list( "Select Database for ResultBrowser",
0, @db_names );
die "No database selected" unless @selected_dbs;
my $selected_db = $selected_dbs[0];
Util::rewrite_file( $local_db_conf, "database=",
"database=$selected_db\n" );
system( $resultbrowser, '-c', $local_db_conf, '--host=0.0.0.0',
"--port=$resultbrowser_port" );
},
'14. Run Build in GDB' => sub {
my @builds = grep { /linux/ } Util::find_subdirs($local_builds_dir);
my @selected_builds =
TUI::select_from_list( "Select Build to Run", 0, @builds );
TUI::select_from_list( "Select Build to Run in GDB", 0, @builds );
die "No experiment selected" unless @selected_builds;
my $selected_build = $selected_builds[0];
@ -234,7 +318,8 @@ my %handlers = (
# Delete ran experiments from mars
my @builds = Mars::find_remote_subdirs($remote_builds_dir);
my @selected_builds =
TUI::select_from_list( "Select Experiments to Delete", 1, @builds );
TUI::select_from_list( "Select Builds to Delete from Mars",
1, @builds );
die "No experiment selected" unless @selected_builds;
Mars::ssh_system( 'rm', '-rf', "$remote_builds_dir/$_" )
for @selected_builds;
@ -246,7 +331,8 @@ my %handlers = (
my @projects =
map { s/\.gpr//r } Util::find_files($local_ghidra_projects);
my @selected_projects =
TUI::select_from_list( "Select Projects to Delete", 1, @projects );
TUI::select_from_list( "Select Ghidra Projects to Delete",
1, @projects );
die "No project selected" unless @selected_projects;
system( 'rm', '-rf', "$local_ghidra_projects/$_.gpr" )
for @selected_projects;
@ -271,7 +357,8 @@ my %handlers = (
# Drop databases on mars
my @db_names = Mars::db_list();
my @selected_dbs =
TUI::select_from_list( "Select Databases to Drop", 1, @db_names );
TUI::select_from_list( "Select Databases to Drop from Mars",
1, @db_names );
die "No database selected" unless @selected_dbs;
Mars::db_drop($_) for @selected_dbs;
},

View File

@ -51,8 +51,8 @@ SECTIONS {
/* Data and Stacks */
/* NOTE: When including the WAMR mmap region inside .text, it has to be large */
. = 0x200000;
/* . = ALIGN(4096); */
/* . = 0x200000; */
. = ALIGN(4096);
.data : {
KEEP (*(".startup_stack"))
KEEP (*(".kernel_stack"))

View File

@ -8,7 +8,7 @@ static plain_t sum_out[REPLICA_COUNT];
template <const unsigned int N> static INLINE void sum(void) {
int sum = 0;
for (int i = 0; i < 100; ++i) {
for (int i = 0; i < 5; ++i) {
sum += 1;
}
@ -24,7 +24,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace();
if (X == 100) {
if (X == 5) {
HOST_PRINT("result correct.\n");
fail_marker_positive();
return 0;

View File

@ -24,7 +24,7 @@ static void naive_vote(void) {
template <const unsigned int N> static INLINE void sum(void) {
int sum = 0;
for (int i = 0; i < 100; ++i) {
for (int i = 0; i < 5; ++i) {
sum += 1;
}
@ -46,7 +46,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace();
if (vote_res == 100) {
if (vote_res == 5) {
HOST_PRINT("vote success.\n");
fail_marker_positive();
return 0;

View File

@ -57,7 +57,7 @@ static sign_t cored_vote(void) {
template <const unsigned int N, const sign_t S> static INLINE void sum(void) {
int sum = 0;
for (int i = 0; i < 100; ++i) {
for (int i = 0; i < 5; ++i) {
sum += 1;
}
@ -105,7 +105,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
}
plain_t res = decode(cored_res, THE_A, vote_result_sig);
if (res == 100) {
if (res == 5) {
HOST_PRINT("cored success.\n");
fail_marker_positive();
return 0;

View File

@ -24,7 +24,7 @@ static void naive_vote(void) {
template <const unsigned int N> static INLINE void sum(void) {
int sum = 0;
for (int i = 0; i < 100; ++i) {
for (int i = 0; i < 5; ++i) {
sum += 1;
}
@ -46,7 +46,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace();
if (vote_res == 100) {
if (vote_res == 5) {
HOST_PRINT("vote success.\n");
fail_marker_positive();
return 0;

View File

@ -57,7 +57,7 @@ static sign_t cored_vote(void) {
template <const unsigned int N, const sign_t S> static INLINE void sum(void) {
int sum = 0;
for (int i = 0; i < 100; ++i) {
for (int i = 0; i < 5; ++i) {
sum += 1;
}
@ -105,7 +105,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
}
plain_t res = decode(cored_res, THE_A, vote_result_sig);
if (res == 100) {
if (res == 5) {
HOST_PRINT("cored success.\n");
fail_marker_positive();
return 0;