Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package bpftrace for openSUSE:Factory checked in at 2022-04-26 20:15:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bpftrace (Old) and /work/SRC/openSUSE:Factory/.bpftrace.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bpftrace" Tue Apr 26 20:15:49 2022 rev:15 rq:972846 version:0.14.1 Changes: -------- --- /work/SRC/openSUSE:Factory/bpftrace/bpftrace.changes 2021-11-08 17:25:12.432733614 +0100 +++ /work/SRC/openSUSE:Factory/.bpftrace.new.1538/bpftrace.changes 2022-04-26 20:17:45.968760510 +0200 @@ -1,0 +2,8 @@ +Fri Apr 22 07:35:09 UTC 2022 - Shung-Hsi Yu <[email protected]> + +- Update to 0.14.1 + + Fix precedence of multiplicative operations +- Add Detect-new-BTF-api-btf_dump__new-btf_dump__new_v0_6_0.patch to fix + compilation error when building with libbpf v0.6 + +------------------------------------------------------------------- Old: ---- bpftrace-0.14.0.tar.gz New: ---- Detect-new-BTF-api-btf_dump__new-btf_dump__new_v0_6_0.patch bpftrace-0.14.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bpftrace.spec ++++++ --- /var/tmp/diff_new_pack.B4DPHu/_old 2022-04-26 20:17:46.380761008 +0200 +++ /var/tmp/diff_new_pack.B4DPHu/_new 2022-04-26 20:17:46.384761013 +0200 @@ -1,7 +1,7 @@ # # spec file for package bpftrace # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,13 +31,15 @@ %endif Name: bpftrace -Version: 0.14.0 +Version: 0.14.1 Release: 0 Summary: High-level tracing language for Linux eBPF License: Apache-2.0 Group: Development/Tools/Debuggers URL: https://github.com/iovisor/bpftrace Source: https://github.com/iovisor/bpftrace/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Upstream https://github.com/iovisor/bpftrace/pull/2190 +Patch1: Detect-new-BTF-api-btf_dump__new-btf_dump__new_v0_6_0.patch BuildRequires: binutils BuildRequires: binutils-devel BuildRequires: bison @@ -77,6 +79,7 @@ %prep %setup -q +%autopatch -p1 # Correct the #!-line to avoid rpmlint warnings. find tools -name '*.bt' -type f \ ++++++ Detect-new-BTF-api-btf_dump__new-btf_dump__new_v0_6_0.patch ++++++ >From 3d451feeddf725d11bb52dfbc49b616724d24fd0 Mon Sep 17 00:00:00 2001 From: Jiri Olsa <[email protected]> Date: Tue, 22 Feb 2022 16:36:44 +0100 Subject: [PATCH 1/1] Detect new BTF api btf_dump__new/btf_dump__new_v0_6_0 Some of the libbpf functions we use got deprecated and replaced with new versions. btf__get_nr_types to btf__type_cnt btf_dump__new changed arguments Adding detection of this and making bpftrace to compile against latest libbpf. Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Shung-Hsi Yu <[email protected]> --- CMakeLists.txt | 8 +++++++ cmake/FindLibBpf.cmake | 25 ++++++++++++++++++++ src/btf.cpp | 52 +++++++++++++++++++++++++++--------------- 3 files changed, 66 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffbddf9c..7e5338db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,6 +274,14 @@ if (LIBBPF_BTF_DUMP_FOUND) endif() endif(LIBBPF_BTF_DUMP_FOUND) +if (HAVE_LIBBPF_BTF_TYPE_CNT) + set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" HAVE_LIBBPF_BTF_TYPE_CNT) +endif(HAVE_LIBBPF_BTF_TYPE_CNT) + +if (HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0) + set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0) +endif(HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0) + if (LIBDW_FOUND) set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" HAVE_LIBDW) endif () diff --git a/cmake/FindLibBpf.cmake b/cmake/FindLibBpf.cmake index 86eb8050..b088415f 100644 --- a/cmake/FindLibBpf.cmake +++ b/cmake/FindLibBpf.cmake @@ -55,4 +55,29 @@ if (LIBBPF_FOUND) check_symbol_exists(bpf_link_create "${LIBBPF_INCLUDE_DIRS}/bpf/bpf.h" HAVE_LIBBPF_LINK_CREATE) SET(CMAKE_REQUIRED_DEFINITIONS) SET(CMAKE_REQUIRED_LIBRARIES) + + INCLUDE(CheckCXXSourceCompiles) + SET(CMAKE_REQUIRED_INCLUDES ${LIBBPF_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBBPF_LIBRARIES} elf z) + CHECK_CXX_SOURCE_COMPILES(" +#include <bpf/btf.h> + +int main(void) { + btf__type_cnt(NULL); + return 0; +} +" HAVE_LIBBPF_BTF_TYPE_CNT) + + CHECK_CXX_SOURCE_COMPILES(" +#include <bpf/btf.h> + +int main(void) { + const struct btf_dump_opts *opts = (const struct btf_dump_opts*) 1; + + btf_dump__new(NULL, NULL, NULL, opts); + return 0; +} +" HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0) + SET(CMAKE_REQUIRED_INCLUDES) + SET(CMAKE_REQUIRED_LIBRARIES) endif() diff --git a/src/btf.cpp b/src/btf.cpp index 7d83cf68..c08ef17b 100644 --- a/src/btf.cpp +++ b/src/btf.cpp @@ -28,6 +28,15 @@ namespace bpftrace { +static __u32 type_cnt(const struct btf *btf) +{ +#ifdef HAVE_LIBBPF_BTF_TYPE_CNT + return btf__type_cnt(btf); +#else + return btf__get_nr_types(btf); +#endif +} + static unsigned char *get_data(const char *file, ssize_t *sizep) { struct stat st; @@ -185,6 +194,21 @@ static void dump_printf(void *ctx, const char *fmt, va_list args) free(str); } +static struct btf_dump *dump_new(const struct btf *btf, + btf_dump_printf_fn_t dump_printf, + void *ctx) +{ +#ifdef HAVE_LIBBPF_BTF_DUMP_NEW_V0_6_0 + return btf_dump__new(btf, dump_printf, ctx, nullptr); +#else + struct btf_dump_opts opts = { + .ctx = ctx, + }; + + return btf_dump__new(btf, nullptr, &opts, dump_printf); +#endif +} + static const char *btf_str(const struct btf *btf, __u32 off) { if (!off) @@ -220,12 +244,11 @@ std::string BTF::c_def(const std::unordered_set<std::string> &set) const return std::string(""); std::string ret = std::string(""); - struct btf_dump_opts opts = { .ctx = &ret, }; struct btf_dump *dump; char err_buf[256]; int err; - dump = btf_dump__new(btf, nullptr, &opts, dump_printf); + dump = dump_new(btf, dump_printf, &ret); err = libbpf_get_error(dump); if (err) { @@ -235,7 +258,7 @@ std::string BTF::c_def(const std::unordered_set<std::string> &set) const } std::unordered_set<std::string> myset(set); - __s32 id, max = (__s32) btf__get_nr_types(btf); + __s32 id, max = (__s32)type_cnt(btf); for (id = 1; id <= max && myset.size(); id++) { @@ -415,7 +438,7 @@ int BTF::resolve_args(const std::string &func, if (!has_data()) throw std::runtime_error("BTF data not available"); - __s32 id, max = (__s32)btf__get_nr_types(btf); + __s32 id, max = (__s32)type_cnt(btf); std::string name = func; for (id = 1; id <= max; id++) @@ -486,17 +509,14 @@ int BTF::resolve_args(const std::string &func, std::unique_ptr<std::istream> BTF::get_all_funcs() const { - __s32 id, max = (__s32)btf__get_nr_types(btf); + __s32 id, max = (__s32)type_cnt(btf); std::string type = std::string(""); - struct btf_dump_opts opts = { - .ctx = &type, - }; struct btf_dump *dump; std::string funcs; char err_buf[256]; int err; - dump = btf_dump__new(btf, nullptr, &opts, dump_printf); + dump = dump_new(btf, dump_printf, &type); err = libbpf_get_error(dump); if (err) { @@ -545,16 +565,13 @@ std::map<std::string, std::vector<std::string>> BTF::get_params( const std::set<std::string> &funcs) const { #ifdef HAVE_LIBBPF_BTF_DUMP_EMIT_TYPE_DECL - __s32 id, max = (__s32)btf__get_nr_types(btf); + __s32 id, max = (__s32)type_cnt(btf); std::string type = std::string(""); - struct btf_dump_opts opts = { - .ctx = &type, - }; struct btf_dump *dump; char err_buf[256]; int err; - dump = btf_dump__new(btf, nullptr, &opts, dump_printf); + dump = dump_new(btf, dump_printf, &type); err = libbpf_get_error(dump); if (err) { @@ -639,16 +656,13 @@ std::map<std::string, std::vector<std::string>> BTF::get_params( std::set<std::string> BTF::get_all_structs() const { std::set<std::string> struct_set; - __s32 id, max = (__s32)btf__get_nr_types(btf); + __s32 id, max = (__s32)type_cnt(btf); std::string types = std::string(""); - struct btf_dump_opts opts = { - .ctx = &types, - }; struct btf_dump *dump; char err_buf[256]; int err; - dump = btf_dump__new(btf, nullptr, &opts, dump_printf); + dump = dump_new(btf, dump_printf, &types); err = libbpf_get_error(dump); if (err) { -- 2.35.3 ++++++ bpftrace-0.14.0.tar.gz -> bpftrace-0.14.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/.github/workflows/ci.yml new/bpftrace-0.14.1/.github/workflows/ci.yml --- old/bpftrace-0.14.0/.github/workflows/ci.yml 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/.github/workflows/ci.yml 2021-12-29 18:05:34.000000000 +0100 @@ -27,75 +27,33 @@ strategy: matrix: env: - - NAME: LLVM 6 Debug - TYPE: Debug - LLVM_VERSION: "6.0" - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic - VENDOR_GTEST: ON - - NAME: LLVM 6 Release - TYPE: Release - LLVM_VERSION: "6.0" - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic - VENDOR_GTEST: ON - - NAME: LLVM 7 Debug - TYPE: Debug - LLVM_VERSION: 7 - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic - VENDOR_GTEST: ON - - NAME: LLVM 7 Release - TYPE: Release - LLVM_VERSION: 7 - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic - VENDOR_GTEST: ON - - NAME: LLVM 8 Debug - TYPE: Debug - LLVM_VERSION: 8 - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic - VENDOR_GTEST: ON - - NAME: LLVM 8 Release - TYPE: Release - LLVM_VERSION: 8 - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic - VENDOR_GTEST: ON - NAME: LLVM 9 Debug TYPE: Debug LLVM_VERSION: 9 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 9 Release TYPE: Release LLVM_VERSION: 9 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 10 Debug TYPE: Debug LLVM_VERSION: 10 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 10 Release TYPE: Release LLVM_VERSION: 10 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 10 Clang Debug TYPE: Debug @@ -104,28 +62,28 @@ CXX: clang++-10 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 11 Debug TYPE: Debug LLVM_VERSION: 11 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 11 Release TYPE: Release LLVM_VERSION: 11 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 12 Release TYPE: Release LLVM_VERSION: 12 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 13 Release TYPE: Release @@ -133,27 +91,27 @@ RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size GTEST_FILTER: '-clang_parser.nested_struct_no_type' - BASE: bionic + BASE: focal VENDOR_GTEST: ON - NAME: LLVM 12 Release + libbpf TYPE: Release LLVM_VERSION: 12 RUN_ALL_TESTS: 1 RUNTIME_TEST_DISABLE: probe.kprobe_offset_fail_size - BASE: bionic + BASE: focal VENDOR_GTEST: ON BUILD_LIBBPF: ON - NAME: Memleak test (LLVM 11 Debug) TYPE: Debug LLVM_VERSION: 11 - BASE: bionic + BASE: focal RUN_MEMLEAK_TEST: 1 RUN_TESTS: 0 VENDOR_GTEST: ON - NAME: Memleak test (LLVM 11 Release) TYPE: Release LLVM_VERSION: 11 - BASE: bionic + BASE: focal RUN_MEMLEAK_TEST: 1 RUN_TESTS: 0 VENDOR_GTEST: ON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/.github/workflows/embedded.yml new/bpftrace-0.14.1/.github/workflows/embedded.yml --- old/bpftrace-0.14.0/.github/workflows/embedded.yml 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/.github/workflows/embedded.yml 2021-12-29 18:05:34.000000000 +0100 @@ -19,6 +19,7 @@ BASE: bionic DISTRO: ubuntu-glibc VENDOR_GTEST: ON + BUILD_LIBBPF: ON - TYPE: Release NAME: vanilla_llvm12+clang+glibc2.23 LLVM_VERSION: 12 @@ -32,31 +33,7 @@ DISTRO: ubuntu-glibc CMAKE_EXTRA_FLAGS: "-DCMAKE_CXX_FLAGS='-include /usr/local/include/bcc/compat/linux/bpf.h -D__LINUX_BPF_H__'" VENDOR_GTEST: ON - - TYPE: Release - NAME: vanilla_llvm+clang+glibc2.27 - LLVM_VERSION: 8 - STATIC_LINKING: ON - STATIC_LIBC: OFF - EMBED_BUILD_LLVM: OFF - EMBED_USE_LLVM: ON - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: builtin.cgroup,probe.kprobe_offset_fail_size - BASE: bionic - DISTRO: ubuntu-glibc - VENDOR_GTEST: ON - - TYPE: Release - NAME: vanilla_llvm+clang+glibc2.23 - LLVM_VERSION: 8 - STATIC_LINKING: ON - STATIC_LIBC: OFF - EMBED_BUILD_LLVM: OFF - EMBED_USE_LLVM: ON - RUN_ALL_TESTS: 1 - RUNTIME_TEST_DISABLE: builtin.cgroup,probe.kprobe_offset_fail_size,other.string compare map lookup - BASE: xenial - DISTRO: ubuntu-glibc - CMAKE_EXTRA_FLAGS: "-DCMAKE_CXX_FLAGS='-include /usr/local/include/bcc/compat/linux/bpf.h -D__LINUX_BPF_H__'" - VENDOR_GTEST: ON + BUILD_LIBBPF: ON - TYPE: Debug NAME: alpine LLVM_VERSION: 9 @@ -113,6 +90,7 @@ -e TEST_GROUPS_DISABLE="${TEST_GROUPS_DISABLE}" -e RUNTIME_TEST_DISABLE="${RUNTIME_TEST_DISABLE}" -e VENDOR_GTEST="${VENDOR_GTEST}" + -e BUILD_LIBBPF="${BUILD_LIBBPF}" bpftrace-embedded-${{ matrix.env['BASE'] }} $(pwd)/build-embedded ${TYPE} -j`nproc` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/CHANGELOG.md new/bpftrace-0.14.1/CHANGELOG.md --- old/bpftrace-0.14.0/CHANGELOG.md 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/CHANGELOG.md 2021-12-29 18:05:34.000000000 +0100 @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.14.1] 2021-12-29 + +#### Fixed + +- Fix precedence of multiplicative operations + - [#2096](https//github.com/iovisor/bpftrace/pull/2096) + ## [0.14.0] 2021-10-22 #### Added diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/CMakeLists.txt new/bpftrace-0.14.1/CMakeLists.txt --- old/bpftrace-0.14.0/CMakeLists.txt 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/CMakeLists.txt 2021-12-29 18:05:34.000000000 +0100 @@ -4,7 +4,7 @@ # bpftrace version number components. set(bpftrace_VERSION_MAJOR 0) set(bpftrace_VERSION_MINOR 14) -set(bpftrace_VERSION_PATCH 0) +set(bpftrace_VERSION_PATCH 1) include(GNUInstallDirs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/build-docker-image.sh new/bpftrace-0.14.1/build-docker-image.sh --- old/bpftrace-0.14.0/build-docker-image.sh 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/build-docker-image.sh 2021-12-29 18:05:34.000000000 +0100 @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -eu pushd docker -docker build --network host -t bpftrace-builder-alpine -f Dockerfile.alpine . +docker build --network host -t bpftrace-builder-${BASE} --build-arg LLVM_VERSION=${LLVM_VERSION} -f Dockerfile.${BASE} . popd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/build-release.sh new/bpftrace-0.14.1/build-release.sh --- old/bpftrace-0.14.0/build-release.sh 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/build-release.sh 2021-12-29 18:05:34.000000000 +0100 @@ -1,3 +1,3 @@ #!/bin/bash -set -e -docker run --network host --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) -e STATIC_LINKING=ON -e STATIC_LIBC=ON -e ALLOW_UNSAFE_PROBE=OFF -e RUN_TESTS=0 bpftrace-builder-alpine "$(pwd)/build-release" Release "$@" +set -eu +docker run --network host --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) -e STATIC_LINKING=OFF -e STATIC_LIBC=OFF -e ALLOW_UNSAFE_PROBE=OFF -e VENDOR_GTEST=ON -e RUN_TESTS=${RUN_TESTS} bpftrace-builder-${BASE} "$(pwd)/build-release-${BASE}" Release "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/build.sh new/bpftrace-0.14.1/build.sh --- old/bpftrace-0.14.0/build.sh 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/build.sh 2021-12-29 18:05:34.000000000 +0100 @@ -1,4 +1,7 @@ #!/bin/bash set -e +export BASE=focal +export LLVM_VERSION=12 +export RUN_TESTS=1 ./build-docker-image.sh ./build-release.sh "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/docker/Dockerfile.bionic new/bpftrace-0.14.1/docker/Dockerfile.bionic --- old/bpftrace-0.14.0/docker/Dockerfile.bionic 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/docker/Dockerfile.bionic 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -FROM ubuntu:bionic - -ARG LLVM_VERSION -ENV LLVM_VERSION=$LLVM_VERSION - -RUN apt-get update && apt-get install -y curl gnupg &&\ - llvmRepository="\n\ -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main\n\ -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main\n\ -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${LLVM_VERSION} main\n\ -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${LLVM_VERSION} main\n" &&\ - echo $llvmRepository >> /etc/apt/sources.list && \ - curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD && \ - echo "deb https://repo.iovisor.org/apt/bionic bionic main" | tee /etc/apt/sources.list.d/iovisor.list - -RUN curl -L --output /tmp/cmake.tar.gz \ - https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.tar.gz \ - && tar -xf /tmp/cmake.tar.gz -C /usr/local/ --strip-components=1 - -RUN apt-get update && apt-get install -y \ - make \ - pkg-config \ - asciidoctor \ - bison \ - binutils-dev \ - flex \ - g++-8 \ - git \ - libelf-dev \ - zlib1g-dev \ - libbcc \ - libcereal-dev \ - libdw-dev \ - clang-${LLVM_VERSION} \ - libclang-${LLVM_VERSION}-dev \ - libclang-common-${LLVM_VERSION}-dev \ - libclang1-${LLVM_VERSION} \ - llvm-${LLVM_VERSION} \ - llvm-${LLVM_VERSION}-dev \ - llvm-${LLVM_VERSION}-runtime \ - libllvm${LLVM_VERSION} \ - systemtap-sdt-dev \ - python3 \ - xxd - -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-8 - -COPY build.sh /build.sh -RUN chmod 755 /build.sh -ENTRYPOINT ["bash", "/build.sh"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/docker/Dockerfile.focal new/bpftrace-0.14.1/docker/Dockerfile.focal --- old/bpftrace-0.14.0/docker/Dockerfile.focal 1970-01-01 01:00:00.000000000 +0100 +++ new/bpftrace-0.14.1/docker/Dockerfile.focal 2021-12-29 18:05:34.000000000 +0100 @@ -0,0 +1,50 @@ +FROM ubuntu:focal + +ARG LLVM_VERSION +ENV LLVM_VERSION=$LLVM_VERSION + +RUN apt-get update && apt-get install -y curl gnupg &&\ + llvmRepository="\n\ +deb http://apt.llvm.org/focal/ llvm-toolchain-focal main\n\ +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main\n\ +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_VERSION} main\n\ +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_VERSION} main\n" &&\ + echo $llvmRepository >> /etc/apt/sources.list && \ + curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD + +RUN curl -L --output /tmp/cmake.tar.gz \ + https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.tar.gz \ + && tar -xf /tmp/cmake.tar.gz -C /usr/local/ --strip-components=1 + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y \ + make \ + pkg-config \ + asciidoctor \ + bison \ + binutils-dev \ + flex \ + g++ \ + git \ + libelf-dev \ + zlib1g-dev \ + libbpfcc-dev \ + libcereal-dev \ + libdw-dev \ + clang-${LLVM_VERSION} \ + libclang-${LLVM_VERSION}-dev \ + libclang-common-${LLVM_VERSION}-dev \ + libclang1-${LLVM_VERSION} \ + llvm-${LLVM_VERSION} \ + llvm-${LLVM_VERSION}-dev \ + llvm-${LLVM_VERSION}-runtime \ + libllvm${LLVM_VERSION} \ + systemtap-sdt-dev \ + python3 \ + xxd + +RUN ln -s /usr/bin/python3 /usr/bin/python +COPY build.sh /build.sh +RUN chmod 755 /build.sh +ENTRYPOINT ["bash", "/build.sh"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/docker/Dockerfile.ubuntu-glibc new/bpftrace-0.14.1/docker/Dockerfile.ubuntu-glibc --- old/bpftrace-0.14.0/docker/Dockerfile.ubuntu-glibc 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/docker/Dockerfile.ubuntu-glibc 2021-12-29 18:05:34.000000000 +0100 @@ -9,7 +9,6 @@ ARG CMAKE_BUILD="2" ARG bcc_ref="v0.22.0" ARG bcc_org="iovisor" -ARG libbpf_ref="092a606856" ENV LLVM_VERSION=$LLVM_VERSION ENV CMAKE_VER=${CMAKE_VER} @@ -31,6 +30,7 @@ libedit-dev \ systemtap-sdt-dev \ python3 \ + python3-setuptools \ quilt \ && apt-get install --no-install-recommends -y \ pkg-config @@ -55,11 +55,6 @@ && cp ./src/cc/libbcc_bpf.a /usr/local/lib/libbpf.a \ && cp ./src/cc/libbcc_bpf.a /usr/local/lib/libbcc_bpf.a -RUN git clone https://github.com/libbpf/libbpf.git /src/libbpf \ - && cd /src/libbpf/src \ - && git checkout $libbpf_ref \ - && CC=gcc make -j$(nproc) install install_uapi_headers - COPY build.sh /build.sh RUN chmod 755 /build.sh ENTRYPOINT ["bash", "/build.sh"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/docker/build.sh new/bpftrace-0.14.1/docker/build.sh --- old/bpftrace-0.14.0/docker/build.sh 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/docker/build.sh 2021-12-29 18:05:34.000000000 +0100 @@ -23,9 +23,10 @@ fi if [[ $BUILD_LIBBPF = ON ]]; then - mkdir /src + mkdir -p /src git clone https://github.com/libbpf/libbpf.git /src/libbpf cd /src/libbpf/src + git checkout v0.5.0 CC=gcc make -j$(nproc) # libbpf defaults to /usr/lib64 which doesn't work on debian like systems # this should work on both diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/scripts/update_codegen_tests.sh new/bpftrace-0.14.1/scripts/update_codegen_tests.sh --- old/bpftrace-0.14.0/scripts/update_codegen_tests.sh 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/scripts/update_codegen_tests.sh 2021-12-29 18:05:34.000000000 +0100 @@ -14,8 +14,8 @@ docker build \ --network host \ --build-arg LLVM_VERSION=12 \ - -t bpftrace-builder-bionic \ - -f Dockerfile.bionic \ + -t bpftrace-builder-focal \ + -f Dockerfile.focal \ . popd @@ -28,4 +28,4 @@ -e BPFTRACE_UPDATE_TESTS=1 \ -e TEST_ARGS="--gtest_filter=codegen.*" \ -e VENDOR_GTEST="ON" \ - bpftrace-builder-bionic "$(pwd)/build-codegen-update" Debug "$@" + bpftrace-builder-focal "$(pwd)/build-codegen-update" Debug "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/src/parser.yy new/bpftrace-0.14.1/src/parser.yy --- old/bpftrace-0.14.0/src/parser.yy 2021-10-22 20:59:32.000000000 +0200 +++ new/bpftrace-0.14.1/src/parser.yy 2021-12-29 18:05:34.000000000 +0100 @@ -125,7 +125,7 @@ %type <ast::AttachPoint *> attach_point %type <ast::AttachPointList *> attach_points %type <ast::Call *> call -%type <ast::Expression *> and_expr arith_expr primary_expr cast_expr conditional_expr equality_expr expr logical_and_expr +%type <ast::Expression *> and_expr addi_expr primary_expr cast_expr conditional_expr equality_expr expr logical_and_expr muli_expr %type <ast::Expression *> logical_or_expr map_or_var or_expr postfix_expr relational_expr shift_expr tuple_access_expr unary_expr xor_expr %type <ast::ExpressionList *> vargs %type <ast::Integer *> int @@ -442,18 +442,22 @@ ; shift_expr: - arith_expr { $$ = $1; } - | shift_expr LEFT arith_expr { $$ = new ast::Binop($1, ast::Operator::LEFT, $3, @2); } - | shift_expr RIGHT arith_expr { $$ = new ast::Binop($1, ast::Operator::RIGHT, $3, @2); } + addi_expr { $$ = $1; } + | shift_expr LEFT addi_expr { $$ = new ast::Binop($1, ast::Operator::LEFT, $3, @2); } + | shift_expr RIGHT addi_expr { $$ = new ast::Binop($1, ast::Operator::RIGHT, $3, @2); } ; -arith_expr: +muli_expr: cast_expr { $$ = $1; } - | arith_expr PLUS cast_expr { $$ = new ast::Binop($1, ast::Operator::PLUS, $3, @2); } - | arith_expr MINUS cast_expr { $$ = new ast::Binop($1, ast::Operator::MINUS, $3, @2); } - | arith_expr MUL cast_expr { $$ = new ast::Binop($1, ast::Operator::MUL, $3, @2); } - | arith_expr DIV cast_expr { $$ = new ast::Binop($1, ast::Operator::DIV, $3, @2); } - | arith_expr MOD cast_expr { $$ = new ast::Binop($1, ast::Operator::MOD, $3, @2); } + | muli_expr MUL cast_expr { $$ = new ast::Binop($1, ast::Operator::MUL, $3, @2); } + | muli_expr DIV cast_expr { $$ = new ast::Binop($1, ast::Operator::DIV, $3, @2); } + | muli_expr MOD cast_expr { $$ = new ast::Binop($1, ast::Operator::MOD, $3, @2); } + ; + +addi_expr: + muli_expr { $$ = $1; } + | addi_expr PLUS muli_expr { $$ = new ast::Binop($1, ast::Operator::PLUS, $3, @2); } + | addi_expr MINUS muli_expr { $$ = new ast::Binop($1, ast::Operator::MINUS, $3, @2); } ; cast_expr: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bpftrace-0.14.0/tests/runtime/precedence new/bpftrace-0.14.1/tests/runtime/precedence --- old/bpftrace-0.14.0/tests/runtime/precedence 1970-01-01 01:00:00.000000000 +0100 +++ new/bpftrace-0.14.1/tests/runtime/precedence 2021-12-29 18:05:34.000000000 +0100 @@ -0,0 +1,19 @@ +NAME operator_precedence_1 +PROG BEGIN { print(1 + 2 * 3 ); exit() } +EXPECT 7 +TIMEOUT 5 + +NAME operator_precedence_2 +PROG BEGIN { print(1 + 2 * 3 + 1); exit() } +EXPECT 8 +TIMEOUT 5 + +NAME operator_precedence_3 +PROG BEGIN { print(1 + 2 * 3 + 1 * 10); exit() } +EXPECT 17 +TIMEOUT 5 + +NAME operator_precedence_3 +PROG BEGIN { print(1 + 2 / 2 * 3); exit() } +EXPECT 4 +TIMEOUT 5
