Unverified Commit 69b95fa6 authored by dish's avatar dish Committed by GitHub
Browse files

bpftrace: 0.23.5 -> 0.24.1 (#450486)

parents c7d7d38a 27bb09b9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -21,7 +21,12 @@
    # simple BEGIN probe (user probe on bpftrace itself)
    print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
    # tracepoint
    print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
    # workaround: this needs more than the default of 1k FD to attach ~350 probes, bump fd limit
    # see https://github.com/bpftrace/bpftrace/issues/2110
    print(machine.succeed("""
        ulimit -n 2048
        bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'
    """))
    # kprobe
    print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
    # BTF
+16 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  llvmPackages,
  elfutils,
  bcc,
@@ -16,20 +17,30 @@
  flex,
  bison,
  util-linux,
  xxd,
  nixosTests,
}:

stdenv.mkDerivation rec {
  pname = "bpftrace";
  version = "0.23.5";
  version = "0.24.1";

  src = fetchFromGitHub {
    owner = "bpftrace";
    repo = "bpftrace";
    rev = "v${version}";
    hash = "sha256-Shtf4PSXxUV0Bd7ORYyP06lbWf3LE6BQi7WfTIGDOfk=";
    hash = "sha256-Wt1MXKOg48477HMszq1GAjs+ZELbfAfp+P2AYa+dg+Q=";
  };

  patches = [
    (fetchpatch {
      name = "attach_tracepoint_with_enums.patch";
      url = "https://github.com/bpftrace/bpftrace/pull/4714.patch";
      includes = [ "src/ast/passes/clang_parser.cpp" ];
      hash = "sha256-xk+/eBNJJJSUqNTs0HFr0BAaqRB5B7CNWRSmnoBMTs0=";
    })
  ];

  buildInputs = with llvmPackages; [
    llvm
    libclang
@@ -49,11 +60,12 @@ stdenv.mkDerivation rec {
    bison
    llvmPackages.llvm.dev
    util-linux
    xxd
  ];

  cmakeFlags = [
    "-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
    "-DINSTALL_TOOL_DOCS=OFF"
    "-DUSE_SYSTEM_LIBBPF=ON"
    "-DSYSTEM_INCLUDE_PATHS=${glibc.dev}/include"
  ];

@@ -72,7 +84,7 @@ stdenv.mkDerivation rec {
  ];

  passthru.tests = {
    bpf = nixosTests.bpf;
    inherit (nixosTests) bpf;
  };

  meta = {