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

View File

@ -140,7 +140,7 @@ sub execute_query {
my $postprocess = $module->can('postprocess')
or die "$module can't postprocess()";
my $querystring = $query->($experiment);
my $querystring = $query->($experiment, "$builds_dir/$experiment");
my $argsstring = $args->();
my $filenamestring = $filename->();
@ -171,6 +171,13 @@ sub format_number_sep {
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 {
my ($elffile) = @_;

View File

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