Add elf symbol address helper + pass experiment path to queries

This commit is contained in:
2026-06-12 17:34:24 +02:00
parent 4b0a4b175b
commit b0cb01a7e4
3 changed files with 78 additions and 77 deletions

144
flake.nix
View File

@ -6,31 +6,27 @@ rec {
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
# TODO: Rewrite all perl scripts -> modularize common code and unify menu actions outputs = {
self,
outputs = nixpkgs,
{ flake-utils,
self, }:
nixpkgs, # Create a shell (and possibly package) for each possible system, not only x86_64-linux
flake-utils,
}:
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: system: let
let
# ========================================================================================= # =========================================================================================
# Define pkgs/stdenvs # Define pkgs/stdenvs
# ========================================================================================= # =========================================================================================
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ ]; overlays = [];
}; };
i386_pkgs = import nixpkgs { i386_pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ ]; overlays = [];
# Build crosscompiler # Build crosscompiler
crossSystem = { crossSystem = {
@ -41,23 +37,23 @@ rec {
boost_pkgs = boost_pkgs =
import import
(builtins.fetchTarball { (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/824421b1796332ad1bcb35bc7855da832c43305f.tar.gz"; url = "https://github.com/NixOS/nixpkgs/archive/824421b1796332ad1bcb35bc7855da832c43305f.tar.gz";
sha256 = "sha256:1w6cjnakz1yi66rs8c6nmhymsr7bj82vs2hz200ipi1sfiq8dy4y"; sha256 = "sha256:1w6cjnakz1yi66rs8c6nmhymsr7bj82vs2hz200ipi1sfiq8dy4y";
}) })
{ {
inherit system; inherit system;
}; };
libdwarf_pkgs = libdwarf_pkgs =
import import
(builtins.fetchTarball { (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/f597e7e9fcf37d8ed14a12835ede0a7d362314bd.tar.gz"; url = "https://github.com/NixOS/nixpkgs/archive/f597e7e9fcf37d8ed14a12835ede0a7d362314bd.tar.gz";
sha256 = "sha256:1l79hh7jh7m8yc5mvc8dbg6s8rf30bgm994kf07xriqbzwfn158r"; sha256 = "sha256:1l79hh7jh7m8yc5mvc8dbg6s8rf30bgm994kf07xriqbzwfn158r";
}) })
{ {
inherit system; inherit system;
}; };
inherit (pkgs) lib stdenv; inherit (pkgs) lib stdenv;
@ -66,39 +62,38 @@ rec {
# ========================================================================================= # =========================================================================================
# Setup the shell when entering the "nix develop" environment (bash script). # Setup the shell when entering the "nix develop" environment (bash script).
shellHook = shellHook = let
let # Add project-local fish abbrs here
# Add project-local fish abbrs here abbrs = {
abbrs = { fail = "perl ./scripts/menu.pl";
fail = "perl ./scripts/menu.pl";
# C/C++: # C/C++:
# cmake-debug = "${cmakeDebug}"; # cmake-debug = "${cmakeDebug}";
# cmake-release = "${cmakeRelease}"; # cmake-release = "${cmakeRelease}";
# build-debug = "${buildDebug}"; # build-debug = "${buildDebug}";
# build-release = "${buildRelease}"; # build-release = "${buildRelease}";
}; };
eraseAbbr = name: value: "abbr --erase ${name} 2>/dev/null"; eraseAbbr = name: value: "abbr --erase ${name} 2>/dev/null";
createAbbr = name: value: ''abbr -a ${name} "${value}"''; createAbbr = name: value: ''abbr -a ${name} "${value}"'';
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset # This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset
unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" '' unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" ''
echo "Unloading \"${description}\" environment..." echo "Unloading \"${description}\" environment..."
${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)} ${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)}
''; '';
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set # This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set
initProjectShell = pkgs.writers.writeFish "init-shell.fish" '' initProjectShell = pkgs.writers.writeFish "init-shell.fish" ''
# Unload just in case, to not have redefinition errors # Unload just in case, to not have redefinition errors
source ${unloadProjectShell} source ${unloadProjectShell}
echo "Sourcing \"${description}\" environment..." echo "Sourcing \"${description}\" environment..."
${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)} ${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)}
''; '';
in in
builtins.concatStringsSep "\n" [ builtins.concatStringsSep "\n" [
# Launch into pure fish shell # Launch into pure fish shell
'' ''
@ -119,12 +114,14 @@ rec {
# =========================================================================================== # ===========================================================================================
python = pkgs.python314.withPackages ( python = pkgs.python314.withPackages (
p: with p; [ p:
setuptools with p; [
flask setuptools
flask-mysqldb flask
pyyaml flask-mysqldb
] pyyaml
tabulate
]
); );
# perl = pkgs.perl.withPackages (p: # perl = pkgs.perl.withPackages (p:
@ -166,10 +163,9 @@ rec {
pname = "wasi-sdk"; pname = "wasi-sdk";
version = "29"; version = "29";
src = src = let
let baseurl = "https://github.com/WebAssembly/wasi-sdk/releases/download";
baseurl = "https://github.com/WebAssembly/wasi-sdk/releases/download"; in
in
builtins.fetchTarball { builtins.fetchTarball {
url = "${baseurl}/${pname}-${version}/${pname}-${version}.0-x86_64-linux.tar.gz"; url = "${baseurl}/${pname}-${version}/${pname}-${version}.0-x86_64-linux.tar.gz";
sha256 = "sha256:16afis71iqfvwiny4dz0lk9f7wbary0wa67ybwyhywr8g57ss6hq"; sha256 = "sha256:16afis71iqfvwiny4dz0lk9f7wbary0wa67ybwyhywr8g57ss6hq";
@ -199,10 +195,9 @@ rec {
pname = "iwasm"; pname = "iwasm";
version = "2.4.4"; version = "2.4.4";
src = src = let
let baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download"; in
in
builtins.fetchTarball { builtins.fetchTarball {
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz"; url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
sha256 = "sha256:05irihz3yf7hpc0a59qz9i62imhrsni9xy9nxwsn6b8s92c1yzrp"; sha256 = "sha256:05irihz3yf7hpc0a59qz9i62imhrsni9xy9nxwsn6b8s92c1yzrp";
@ -234,10 +229,9 @@ rec {
pname = "wamrc"; pname = "wamrc";
version = "2.4.4"; version = "2.4.4";
src = src = let
let baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download"; in
in
builtins.fetchTarball { builtins.fetchTarball {
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz"; url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
sha256 = "sha256:0264arh03gc35z0zdvw07qdvqgfvsxr3qgl1aszghwicmdmh4sqj"; sha256 = "sha256:0264arh03gc35z0zdvw07qdvqgfvsxr3qgl1aszghwicmdmh4sqj";
@ -302,7 +296,7 @@ rec {
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime: # Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
# - Libraries used by compilers, for example zlib # - Libraries used by compilers, for example zlib
# - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl # - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl
buildInputs = with pkgs; [ ]; buildInputs = with pkgs; [];
# =========================================================================================== # ===========================================================================================
# Define buildable + installable packages # Define buildable + installable packages
@ -357,8 +351,7 @@ rec {
runHook postInstall runHook postInstall
''; '';
}; };
in in {
{
# Provide package for "nix build" # Provide package for "nix build"
packages = { packages = {
default = fail-bin; default = fail-bin;
@ -368,7 +361,7 @@ rec {
wamrc = wamrc; wamrc = wamrc;
}; };
apps = { apps = {
default = flake-utils.lib.mkApp { drv = fail-bin; }; default = flake-utils.lib.mkApp {drv = fail-bin;};
fail = fail-bin; fail = fail-bin;
wasi-sdk = wasi-sdk; wasi-sdk = wasi-sdk;
iwasm = iwasm; iwasm = iwasm;
@ -391,6 +384,7 @@ rec {
# Those are read by compile.pl / build.pl # Those are read by compile.pl / build.pl
FAIL_SHARE = "${fail-bin}/share"; FAIL_SHARE = "${fail-bin}/share";
FAIL_PYTHON = "${python}/bin/python";
WASI_ROOT = wasi-sdk; WASI_ROOT = wasi-sdk;
WAMR_ROOT = "/home/christoph/Notes/TU/MastersThesis/FailNix/wamr"; WAMR_ROOT = "/home/christoph/Notes/TU/MastersThesis/FailNix/wamr";
CROSS_CC = "${i386_pkgs.stdenv.cc}/bin/i386-elf-gcc"; CROSS_CC = "${i386_pkgs.stdenv.cc}/bin/i386-elf-gcc";

View File

@ -140,7 +140,7 @@ sub execute_query {
my $postprocess = $module->can('postprocess') my $postprocess = $module->can('postprocess')
or die "$module can't postprocess()"; or die "$module can't postprocess()";
my $querystring = $query->($experiment); my $querystring = $query->($experiment, "$builds_dir/$experiment");
my $argsstring = $args->(); my $argsstring = $args->();
my $filenamestring = $filename->(); my $filenamestring = $filename->();
@ -171,6 +171,13 @@ sub format_number_sep {
return $number; return $number;
} }
sub elf_sym_addr {
my ($elffile, $sym) = @_;
my $line = qx{nm "$elffile" 2>/dev/null | grep " $sym\$"};
return undef unless $line =~ /^([0-9a-f]+)/i;
return hex($1);
}
sub elf_read_sections { sub elf_read_sections {
my ($elffile) = @_; my ($elffile) = @_;

View File

@ -386,7 +386,7 @@ make_heatmap <- function(target_resulttype, target_benchmark) {
xmin = -0.5, xmin = -0.5,
xmax = row_width - 0.5, xmax = row_width - 0.5,
fill = NA, fill = NA,
linewidth = 1.0, linewidth = 1.5,
inherit.aes = FALSE inherit.aes = FALSE
) + ) +
scale_colour_brewer(name = "Region", palette = "Dark2") scale_colour_brewer(name = "Region", palette = "Dark2")