Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create copyright #8

Closed
wants to merge 145 commits into from
Closed

Commits on May 21, 2020

  1. create copyright

    sravyamks committed May 21, 2020
    Configuration menu
    Copy the full SHA
    21f9751 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2020

  1. NFC: Use a struct for usdt_probe_entry instead of a tuple

    Non functional change.
    
    Tuples become hard to read after you get enough entries.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2637923 View commit details
    Browse the repository at this point in the history
  2. NFC: Hoist inner probe codegen to helper function

    We had two codepaths with almost duplicate code. This commit factors out
    the common code.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b42aafc View commit details
    Browse the repository at this point in the history
  3. NFC: Remove unnecessary variable and const-ify loop variable

    Non functional change.
    
    Just some small code cleanup.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5d1606c View commit details
    Browse the repository at this point in the history
  4. Attach to duplicated USDT markers

    This commit adds support for duplicated USDT markers. Duplication in
    this context means identical provider and name. See the later runtime
    test for an example of how this can occur.
    
    With this commit, bpftrace will generate separate programs for each
    duplicated marker. We need to generate separate programs because the
    location of the usdt arguments may not be the same in each call site.
    The later runtime test does not reproduce this behavior but I've
    observed this happening in production before.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b8c4eb6 View commit details
    Browse the repository at this point in the history
  5. Update and add unit tests

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    90bc9f6 View commit details
    Browse the repository at this point in the history
  6. Add runtime test

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    8bf11d5 View commit details
    Browse the repository at this point in the history
  7. Update changelog

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    e5504f5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    1637343 View commit details
    Browse the repository at this point in the history
  9. Add Tuple to AST

    This commit sets up all the scaffolding for actual implementation.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    82e36a8 View commit details
    Browse the repository at this point in the history
  10. Add tuple to type system

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    140b9f0 View commit details
    Browse the repository at this point in the history
  11. Add aggregate type helper

    This helper is used to determine if a memcpy is necessary or if a simple
    load will work.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5c53aad View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    8997514 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    4c1e649 View commit details
    Browse the repository at this point in the history
  14. Improve error message for non-tuple field access

    Before:
    ```
    stdin:1:9-16: ERROR: Can not access field '' on expression of type 'int64'
    BEGIN { (1+2).2 }
            ~~~~~~~
    ```
    
    After:
    ```
    stdin:1:9-16: ERROR: Can not access index 2 on expression of type 'int64'
    BEGIN { (1+2).2 }
            ~~~~~~~
    ```
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2a5ee22 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    b37e7d6 View commit details
    Browse the repository at this point in the history
  16. Implement codegen for tuple

    This commit implements codegen for tuple creation and tuple indexing.
    
    Note that tuples are allocated on the stack because we can't really
    contain aggregate types in registers.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    468140e View commit details
    Browse the repository at this point in the history
  17. Add runtime tests for core features

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    6b3c52c View commit details
    Browse the repository at this point in the history
  18. NFC: Refactor map_value_to_str

    Have `map_value_to_str` take a SizedType instead of an `IMap` reference
    so we can later reuse this method to print tuple elements.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b7d0cb1 View commit details
    Browse the repository at this point in the history
  19. Add tuple support to print()

    Support for both text and json output
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    c172da4 View commit details
    Browse the repository at this point in the history
  20. Add runtime test for output

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    1da5ef3 View commit details
    Browse the repository at this point in the history
  21. Add docs

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    456712f View commit details
    Browse the repository at this point in the history
  22. Update changelog

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    0c6b2be View commit details
    Browse the repository at this point in the history
  23. tests: Fix embedded build tests

    Forgot to add checks for <sys/sdt.h> headers.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    3867573 View commit details
    Browse the repository at this point in the history
  24. types: add _ to indicate private member

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    364354d View commit details
    Browse the repository at this point in the history
  25. Reimplement Type::array

    Arrays used the `size`, `elem_type` and `pointee_size` fields to store
    array type information. This is confusing as `pointee_size` indicates a
    pointer and also incomplete as an array of pointers cannot be stored
    without losing pointee size information.
    
    This fixes that by storing the complete type (`SizedType *`) instead of
    just a few fields.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    cd9e9bf View commit details
    Browse the repository at this point in the history
  26. Fix KBUILD_MODNAME

    Use "bpftrace" instead of '"bpftrace"'. Previously this causes build
    error if included header files use KBUILD_MODNAME.
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    18d747f View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    9d61934 View commit details
    Browse the repository at this point in the history
  28. Refactor list.cpp

    Split a long function and call functions only when necessary
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    02cad8b View commit details
    Browse the repository at this point in the history
  29. Support enum in BTF::c_def()

    BTF::c_def() now accepts enum name, such as "enum bpf_prog_type"
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    6edfc26 View commit details
    Browse the repository at this point in the history
  30. Support listing struct/union/enum definitions using BTF

    '-l' option now can take struct/union/enum name and dump its definition
    using BTF. For example:
    
    ```
    % sudo ./src/bpftrace -l "enum bpf*"
    enum bpf_access_type
    enum bpf_adj_room_mode
    enum bpf_arg_type
    enum bpf_attach_type
    enum bpf_cgroup_storage_type
    [...]
    ```
    
    and
    
    ```
    % sudo ./src/bpftrace -lv "struct path"
    BTF: using data from /sys/kernel/btf/vmlinux
    struct path {
            struct vfsmount *mnt;
            struct dentry *dentry;
    };
    ```
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    7048fff View commit details
    Browse the repository at this point in the history
  31. Update changelog

    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    f54f36c View commit details
    Browse the repository at this point in the history
  32. List only usdt and uprobe when a pid is given

    Now `bpftrace -l -p 11234` only lists uprobe and usdt probes.
    `bpftrace -l "k:*" -p 11234` lists kprobe, which is the same as before.
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    c938117 View commit details
    Browse the repository at this point in the history
  33. Remove RLIMIT_AS limit

    We haven't seen any OOM issues in a while so I suspect either our type
    fixes in bpftrace or upstream llvm changes have resolved the issue.
    
    This closes #1355.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    bb6a7f7 View commit details
    Browse the repository at this point in the history
  34. Update changelog

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    48979d4 View commit details
    Browse the repository at this point in the history
  35. Fix typo

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2f88730 View commit details
    Browse the repository at this point in the history
  36. fix error message

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    aa729e6 View commit details
    Browse the repository at this point in the history
  37. Fix printing Type::array

    GetElementTy() returns a pointer so we need to deref. We don't expect
    GetElementTy() to return null b/c an array type should have the element
    type set.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    0fc46d5 View commit details
    Browse the repository at this point in the history
  38. Add libbpf build info into --info

    Helps with debugging things on the issue tracker.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    3e08a1d View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    7f19a09 View commit details
    Browse the repository at this point in the history
  40. Add template param

    Not sure how it used to compile. Magic, I guess.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5f2e4e3 View commit details
    Browse the repository at this point in the history
  41. Fix calling ntop on tracepoint args

    Commit f05b4cd ("Introduce Type::ctx") introduced a `ctx` type
    for values that come from the bpf prog context. This subtly broke ntop()
    because ntop was not yet aware of Type::ctx.
    
    Fix this by relaxing semantic analyser check to include Type::ctx.
    Similarly relax for codegen.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    85b9bf5 View commit details
    Browse the repository at this point in the history
  42. Update changelog

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    8cbd4d9 View commit details
    Browse the repository at this point in the history
  43. CI: Fix IRC notification on build failure

    I think to prevent job `irc` from being skipped you need to specify the
    dependency.
    
    See
    https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    e0eaa54 View commit details
    Browse the repository at this point in the history
  44. CI: Don't use TLS for irc notifications

    I think TLS support from notify-irc is kinda broken.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    911ed78 View commit details
    Browse the repository at this point in the history
  45. NFC: Move usdt helper routines out of utils

    This commit just cut and pastes code around. It's nicer to have
    small, orthogonal modules.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    3155952 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    1d9b4ee View commit details
    Browse the repository at this point in the history
  47. NFC: Remove unused method and privatize internal methods

    Keeping unused code around is asking for bit rot and bugs. Also hide
    some methods that are used for internal caching.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b090f93 View commit details
    Browse the repository at this point in the history
  48. usdt: Fix caching logic

    USDTHelper caching logic was previously incorrect. It would mark the
    cache as loaded if any pid or path was processed. This would cause
    scripts that place usdt probes on different binaries to silently fail
    (because a default usdt_probe_entry would be returned).
    
    This commit breaks up the cache by pid or by path. Also switch
    usdt_provider_cache to an unordered_map b/c we don't need ordering and
    unordered data structures are faster.
    
    Next commit will get rid of the silent failure behavior.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    083895f View commit details
    Browse the repository at this point in the history
  49. usdt: Return optional in find()

    It's good to have an error reporting mechanism. Returning a default
    value caused a lot of headache when trying to debug usdt lookup failures
    that were fixed in the previous commit.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    ed07edd View commit details
    Browse the repository at this point in the history
  50. Add runtime test

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    ebc2a8a View commit details
    Browse the repository at this point in the history
  51. Update changelog

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    ac515db View commit details
    Browse the repository at this point in the history
  52. Improve missing usdt error message

    Before:
    
        $ sudo ./build/src/bpftrace -e 'usdt:/usr/bin/python3:python:asdf { 1 }'
        terminate called after throwing an instance of 'std::runtime_error'
          what():  Failed to find usdt probe: usdt:/usr/bin/python3:python:asdf
        [1]    865191 abort      sudo ./build/src/bpftrace -e
    
    After:
    
        $ sudo ./build/src/bpftrace -e 'usdt:/usr/bin/python3:python:asdf { 1 }'
        Failed to compile: Failed to find usdt probe:
        usdt:/usr/bin/python3:python:asdf
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    f91f4ba View commit details
    Browse the repository at this point in the history
  53. Syscall generator, for issue#1334 (#1376)

    This patch aims to replace the external tools which are used in runtime tests to trigger syscalls. It can generate sys_nanosleep, sys_open, sys_openat, sys_read and sys_execve.
    
    There are two reasons why it is important not to rely on external tools to trigger syscalls. The first is that some tools are not always available on some systems. And the other is that, the tools don't essentially work to generate certain syscalls. It would be more portable if we can have an program working to provide these syscalls.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    f24a0d1 View commit details
    Browse the repository at this point in the history
  54. syncsnoop: trace sync_file_range2 when needed

    Some architecture like ppc64, don't use sync_file_range but
    sync_file_range2. We can use a wildcard to get them both cover.
    
    Fixes the following error:
    
    $ /usr/share/bpftrace/tools/syncsnoop.bt
    Attaching 7 probes...
    open(/sys/kernel/debug/tracing/events/syscalls/sys_enter_sync_file_range/id): No such file or directory
    Error attaching probe: tracepoint:syscalls:sys_enter_sync_file_range
    jeromemarchand authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b97325d View commit details
    Browse the repository at this point in the history
  55. man: fix quotes in bpftrace manual

    The bpftrace man page uses the escape \' to presumably print quote, but this troff escape is meant to print an acute accent. Beside making the man page look strange, it also prevents copy-pasting examples.
    jeromemarchand authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    9caf00b View commit details
    Browse the repository at this point in the history
  56. Silence curl

    This prevents curl from spamming the terminal.
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    adb05a3 View commit details
    Browse the repository at this point in the history
  57. Add time units for interval probe (#1377)

    This patch adds support for new time units us and hz for probe interval.
    
    Such changes make the time units of interval consistent with those of profile.
    
    This closes #1335 .
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    19f1b49 View commit details
    Browse the repository at this point in the history
  58. usdt: Decrement usdt semaphore value during probe detach

    Before, I think we were intentionally leaking the bcc usdt context so
    that usdt semaphore values would not go back to zero. Reason is that
    bcc_usdt_close() decrements usdt semaphore value.
    
    However, this causes issues if we don't eventually decrement the counter
    as the tracee will forever be on more expensive code paths.
    
    This commit defers semaphore decrement until probe is detached.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    e40bcec View commit details
    Browse the repository at this point in the history
  59. usdt: Use new usdt_addsem_probe* helpers

    While debugging a high memory consumption issue, I noticed that a
    USDT::Context object can take ~10M per instance [0]. Along with the new
    --usdt-file-activation, bpftrace can potentially hold onto many dozens
    of USDT:Context instances, causing memory issues.
    
    This patch makes use of the new bcc usdt semaphore helpers (
    iovisor/bcc#2953 ) to avoid holding onto
    USDT::Context instances for the lifetime of the tracing session.
    
    The new algorithm is:
    
    1. create a USDT::Context
    2. increment the semaphore count for the probe we care about
    3. destroy the USDT::Context
    4. repeat 1-3 for all probes we want to attach to
    5. do our tracing
    6. create a USDT::Context for the probe we care about
    7. decrement the semaphore count
    8. destroy the USDT::Context
    9. repeat 6-8 for all the probes we're attached to
    
    This approach also has the benefit of 1 USDT::Context instance being
    alive at a time which can help keep memory high watermark low.
    
    [0]: Through gdb single stepping and /proc/pid/status. Exact process is
    not described here b/c memory usage probably varies based on tracee
    binary.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    cb3a0d0 View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    5f9058e View commit details
    Browse the repository at this point in the history
  61. Return 0 in detach_kfunc

    willfindlay authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    dac0759 View commit details
    Browse the repository at this point in the history
  62. Only emit hist & lhist functions when they're used

    These two functions add a lot of noise in the "before optimized" output,
    which is annoying when debugging.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5290f41 View commit details
    Browse the repository at this point in the history
  63. Fix all tests

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    562067b View commit details
    Browse the repository at this point in the history
  64. Remove registers that are not in struct pt_regs (x86-64)

    cf. [x86-64 struct pt_regs](https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/ptrace.h).
    
    Fixes the following errors.
    
    ```
    % ./src/bpftrace -e 'k:f {  printf("%d\n", reg("fs_base")); }'
    Attaching 1 probe...
    Error loading program: kprobe:f (try -v)
    ```
    
    ```
    % sudo ./src/bpftrace -e 'i:s:1 {  printf("%d, %d\n", reg("fs_base"), ctx->sample_period); }'
    Attaching 1 probe...
    1000000000, 1000000000
    ^C
    ```
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    f3077b8 View commit details
    Browse the repository at this point in the history
  65. Add clang build in CI

    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b1c5018 View commit details
    Browse the repository at this point in the history
  66. Display LLVM version when running CMake

    Example:
    
    ```
    % cmake ..
    [...]
    -- Found LLVM 10.0.1: /usr/lib/llvm-10/lib/cmake/llvm
    ```
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    d41692b View commit details
    Browse the repository at this point in the history
  67. Support non-map print() (#1381)

    This implements non-map prints as described in #356.
    
    Note that non-map print()s are synchronous, meaning they do not
    work the same as map print()s. I think this is a pretty nice feature.
    
    Example:
    ```
    # bpftrace -e 'BEGIN { $t = (1, "string"); print(123); print($t); print(comm) }'
    Attaching 1 probe...
    123
    (1, string)
    bpftrace
    ^C
    ```
    
    We have a growing number of types in the type system so I may have
    missed a corner case somewhere. I think I got most of it right, though.
    
    This closes #356.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    8cce6bf View commit details
    Browse the repository at this point in the history
  68. Fix call_print_non_map test

    Fix a bad check in.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    c71c84a View commit details
    Browse the repository at this point in the history
  69. bpftrace: Fix cpid for Big endian

    Issue:
    - cpid is written to higher 32 bits in BE
    - bpftrace -v -e 'BEGIN { printf("%d", cpid); }'
    Bytecode:
    0: (bf) r6 = r1
    1: (b7) r1 = 0
    2: (7b) *(u64 *)(r10 -8) = r1
    last_idx 2 first_idx 0
    regs=2 stack=0 before 1: (b7) r1 = 0
    3: (b7) r2 = 122768
    4: (63) *(u32 *)(r10 -8) = r2 <-----
    5: (7b) *(u64 *)(r10 -16) = r1
    (...)
    
    Fix:
    - Promote it to 64 bits.
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b79dc61 View commit details
    Browse the repository at this point in the history
  70. bpftrace: Fix buf builtin for Big endian

    Issue:
    - Length is not interpreted properly in buf builtin for BE.
    - Format of buf: (length: 1 byte | buf: char *), Also see resolve_buf().
    
    bpftrace -v -e 'kprobe:__sys_sendto { printf("hello: %r", buf((arg1),
    4)); exit(); }'
    Bytecode:
    0: (bf) r6 = r1
    1: (b7) r1 = 0
    2: (7b) *(u64 *)(r10 -24) = r1
    last_idx 2 first_idx 0
    regs=2 stack=0 before 1: (b7) r1 = 0
    3: (7b) *(u64 *)(r10 -16) = r1
    4: (b7) r1 = 4
    5: (7b) *(u64 *)(r10 -8) = r1  <--- Intepreted size as 8 bytes
    6: (79) r3 = *(u64 *)(r6 +104)
    7: (bf) r1 = r10
    8: (07) r1 += -7
    9: (b7) r2 = 4
    10: (85) call bpf_probe_read#4
    last_idx 10 first_idx 0
    regs=4 stack=0 before 9: (b7) r2 = 4
    11: (61) r1 = *(u32 *)(r10 -8) <---- Here size + some bytes of buf is
                                         interpreted as zero for BE
    12: (63) *(u32 *)(r10 -16) = r1
    13: (71) r1 = *(u8 *)(r10 -4)
    14: (73) *(u8 *)(r10 -12) = r1
    15: (18) r7 = 0xffff9eac33c9f800
    17: (85) call bpf_get_smp_processor_id#8
    18: (bf) r4 = r10
    19: (07) r4 += -24
    20: (bf) r1 = r6
    21: (bf) r2 = r7
    22: (bf) r3 = r0
    23: (b7) r5 = 16
    24: (85) call bpf_perf_event_output
    (...)
    
    Fix:
    - Fix it by casting length of buf to 1 byte.
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    3431339 View commit details
    Browse the repository at this point in the history
  71. bpftrace: Fix ntop builtin for BE

    Issue:
    - ./bpftrace -e '#include <linux/socket.h>
      BEGIN { @=ntop(AF_INET, 0x0100007f);}'
      @: ntop() got unsupported AF type: 0
    
    Fix:
    - aftype size is 64 bits in codegen. Hence cast aftype to 64bit
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    1280bbc View commit details
    Browse the repository at this point in the history
  72. bpftrace: Fix unop deref for Big endian

    Issue:
    - 32 bit unop deferences does not work for Big endian
    - Example: bpftrace -v -e 'uprobe:testprogs/uprobe_test:function1 {
                    printf("0x%lx -- 0x%lx\n", *uaddr("GLOBAL_A"),
                    *uaddr("GLOBAL_C")); }' fails.
    
    Fix:
    - Promote the expr in codegen to 64 bit. Integer types are already
      promoted to 64bits. Hence casting performed in get_arg_values() and
      codegen matches.
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    7f82c8d View commit details
    Browse the repository at this point in the history
  73. bpftrace: Fix FieldAccess deref for Big endian

    Issue:
    - 32 bit dereferences fails for Big endian
    - Example: bpftrace -v -e 'tracepoint:random:urandom_read { $i =
      args->got_bits; printf("bits: %d\n", $i); if ($i == 24) { exit() } }'
      - Example: bpftrace -v -e 'struct Foo { int a; char b[10]; }
        uprobe:testprogs/uprobe_test:function2 { $foo = (struct Foo *)arg0;
        $foo2 = (struct Foo *)arg1; printf("%d\n", $foo->a) }' fails
    
    Fix:
    - Promote Fieldaccess expr_ for these cases to 64 bit.
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    08e52f9 View commit details
    Browse the repository at this point in the history
  74. bpftrace: Fix Arrayaccess in Big endian

    Issue:
    bpftrace -v -e 'struct MyStruct { int y[4]; }
    uprobe:./testprogs/array_access:test_struct { $s = (struct MyStruct *)
    arg0; $x = $s->y[0]; printf("Result: %d\n", $x); exit(); }' fails
    
    Bytecode:
    0: (bf) r6 = r1
    1: (79) r3 = *(u64 *)(r6 +40)
    2: (bf) r1 = r10
    3: (07) r1 += -16
    4: (b7) r2 = 4  <--- Read four bytes (field.type.size is 4)
    5: (85) call bpf_probe_read#112
    last_idx 5 first_idx 0
    regs=4 stack=0 before 4: (b7) r2 = 4
    6: (b7) r1 = 0
    7: (7b) *(u64 *)(r10 -8) = r1
    last_idx 7 first_idx 0
    regs=2 stack=0 before 6: (b7) r1 = 0
    8: (61) r2 = *(u32 *)(r10 -16) <--- Reads the topmost bytes in BE. which
                                        is zero.
    9: (63) *(u32 *)(r10 -8) = r2
    (...)
    
    Fix:
    - Promote the ArrayAccess to 64 bit.
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    d208b71 View commit details
    Browse the repository at this point in the history
  75. bpftrace: Fix tests intptrcast for s390x

    Issue:
    The first sarg value should be 0xfed. Only five reg args for s390x.
    
    Fix:
    Fix this in intptrcast tests
    
    Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
    sumanthkorikkar authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    d9418b3 View commit details
    Browse the repository at this point in the history
  76. Enable ternary operators to evaluate builtin calls

    Currently, the ternary operator can only works to evaluate strings and
    integers. This tries to include builtin calls:
    ```
    # bpftrace -e 'BEGIN { pid > 10000 ? printf("%s %d\n", comm, pid) : exit(); }'
    ```
    
    Although if-else statement can serve the purpose, using ternary can be
    more concise especially when users run bpftrace in comand line. In
    bpftrace, builtin calls have `none` types so it makes sense for the
    ternary operator to support them. Resolves #1333.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    94f4aa8 View commit details
    Browse the repository at this point in the history
  77. Configuration menu
    Copy the full SHA
    6794c9b View commit details
    Browse the repository at this point in the history
  78. Use llvm-as to validate generated IR

    llvm-as emits warnings when the IR has typing issues:
    
    ```
     error: '%2' defined with type 'i8*'
      call void @llvm.lifetime.start.p0i8(i64 -1, i64* nonnull %2)
    ```
    
    We can use this to validate that the IR we generate is valid and avoid
    regressions (like the OOM error).
    
    As the codegen reference output is LLVM 7 based this is currently only
    enabled for LLVM 7. Testing the version specific things is not
    necessary as we don't have any version specific logic in the codegen.
    
    The tests that do not pass are ignored. Eventually we shouldn't have to
    ignore any of them. Adding new entries to this list should be avoided,
    unless the test overlaps with something currently on the list.
    
    builtin_func_1.ll
    builtin_func_uprobe_2.ll
    call_buf_implicit_size.ll
    call_buf_size_literal.ll
    call_buf_size_nonliteral.ll
    call_print_non_map.ll
    call_printf.ll
    if_else_printf.ll
    if_nested_printf.ll
    if_printf.ll
    
    Related to #1091
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    4204215 View commit details
    Browse the repository at this point in the history
  79. NFC: Use higher level find_wildcard_matches API

    Does the same thing and less code to maintain.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    8e250c0 View commit details
    Browse the repository at this point in the history
  80. NFC: Hide lower level find_wildcard_matches helper

    This helper makes a lot of assumptions about the input and probably
    shouldn't be a public API if we can help it.
    
    Also rename the lower level helper b/c it doesn't look like function
    overloading works correctly with class member and non-class member.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    d6b30a9 View commit details
    Browse the repository at this point in the history
  81. Ignore trailing kernel module annotation

    Before, `find_wildcard_matches` would choke on lines in
    available_filter_functions like:
    
        ehci_disable_ASE [ehci_hcd]
    
    This patch has k[ret]probes ignore the module annotation.
    
    This closes #1036 .
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    9ecdf82 View commit details
    Browse the repository at this point in the history
  82. Add tests

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    510b3aa View commit details
    Browse the repository at this point in the history
  83. Update changelog

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    40615f6 View commit details
    Browse the repository at this point in the history
  84. Enable printf, cat, system to have more args

    This enables printf, cat and system to have more than 7 arguments. It can be
    more user-friendly to allow any reasonable number of arguments for these builtin
    calls which use formatted strings. Resolves #1336.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    891b0a8 View commit details
    Browse the repository at this point in the history
  85. Remove redundant codes in print_maps

    print_map will do the same type checkings again.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    3aa563d View commit details
    Browse the repository at this point in the history
  86. 0.11 release

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    46830a3 View commit details
    Browse the repository at this point in the history
  87. Currently printf does not allow string format specifiers to be dire…

    …ctly
    
    followed by any alphabetic characters since it would take all the following
    letters as part of the specifiers. As an example:
    
    ```
    bpftrace -e 'BEGIN { @start = nsecs; } i:s:1 { printf("Elapsed: %ds\n", (nsecs - @start)/1000000000); }'
    stdin:1:35-95: ERROR: printf: Unknown format string token: %ds
    BEGIN { @start = nsecs; } i:s:1 { printf("Elapsed: %ds\n", (nsecs - @start)/1000000000); }
    ```
    I think it's good to fix it since I could not think of any obvious downsides.
    This works to address this issue by changing the way `printf` parse the
    format strings. It would also affect `cat` and `system` as well. With this PR:
    
    ```
    bpftrace -e 'BEGIN { @start = nsecs; } i:s:1 { printf("Elapsed: %ds\n", (nsecs - @start)/1000000000); }'
    Attaching 2 probes...
    Elapsed: 1s
    Elapsed: 2s
    Elapsed: 3s
    Elapsed: 4s
    Elapsed: 5s
    ^C
    
    @start: 2976003477708
    ```
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b563c97 View commit details
    Browse the repository at this point in the history
  88. changelog: pr was merged after 0.11 release

    This PR has been merged right after the 0.11 release so it shouldn't be
    in the 0.11 release.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2dd186c View commit details
    Browse the repository at this point in the history
  89. vagrant: add fedora 32

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    fef4b4a View commit details
    Browse the repository at this point in the history
  90. Mark btf as depending on libbpf in --info

    The implicit dependency is confusing for users who somehow have a
    bpftrace built without libbpf.
    
    This closes #1422 .
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    7aea83c View commit details
    Browse the repository at this point in the history
  91. Generate vfs_read for some runtime tests

    Some runtime tests in builtin and probe expect the system to generate vfs_read
    events for them, which in some cases might cause timeout error. This commit
    explicitly generates the event for the tests with testprog/syscall.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    9f374bf View commit details
    Browse the repository at this point in the history
  92. Configuration menu
    Copy the full SHA
    d076477 View commit details
    Browse the repository at this point in the history
  93. Add CodeGen for strftime() builtin

    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2669342 View commit details
    Browse the repository at this point in the history
  94. Add runtime support for strftime()

    This introduces a new builtin function `strftime`. This function makes it
    possible to print the current time with `printf`:
    
    ``` bpftrace -e 'i:s:1 { printf("%s\n", strftime("%H:%M:%S", nsecs)); }' ```
    
    Although `time` can print current time on its own, printing timestamp with
    `printf` can produce more concise and more readable output. Resolves #1337 .
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    737abe7 View commit details
    Browse the repository at this point in the history
  95. Configuration menu
    Copy the full SHA
    f96cf17 View commit details
    Browse the repository at this point in the history
  96. tests: do not run optimize pass on codegen tests

    Currently we test codegen after optimization. this has 2 issues:
    
    We don't actually test the code we generate, we test what LLVM does to
    it. This makes harder to relate a change in the codegen to a change in
    the LLVM output.
    
    We have to maintain more version specific codegen files as we cannot
    rewrite big changes the optimizer has done.
    
    Fixes: #1368
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    ae93bb1 View commit details
    Browse the repository at this point in the history
  97. codegen: fix argument reordering issue

    When building with clang a few codegen tests fail due to argument
    reordering. This normally doesn't show up as the optimizer step fixes
    that, but as we're now testing before optimization it get's in our way.
    
    This means that a "complex" call like:
    ```
    b_.CreateUDiv(b_.CreateSub(b_.CreateLoad(value_alloc), b_.CreateLoad(min_alloc)), b_.CreateLoad(step_alloc))
    ```
    
    Will have to be split into:
    ```
    Value *step = b_.CreateLoad(step_alloc);
    Value *min = b_.CreateLoad(min_alloc);
    Value *val = b_.CreateLoad(value_alloc);
    Value *div3 = b_.CreateUDiv(b_.CreateSub(val, min), step);
    ```
    
    To ensure that all arguments are always evaluated in the same order.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    8d83996 View commit details
    Browse the repository at this point in the history
  98. tests: Avoid validating broken codegen output

    The move to unoptimized codegen uncovered more type issues that we have
    to fix. Fixing those now will blow up this PR even more and make it hard
    to review so lets just ignore them for now.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5f28f1a View commit details
    Browse the repository at this point in the history
  99. codegen: Add helper for managing expr_deleter_

    This helps make it harder to forget to run expr_deleter_.
    
    In general this is also better because the piece of code most likely to
    know if it's OK to end the lifetime of an alloca is where the alloca was
    created.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b7fbe54 View commit details
    Browse the repository at this point in the history
  100. codegen: Use new accept() helper

    This commit updates all sites where manual CreateLifetimeEnd(expr_)
    was being called.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    4a34d07 View commit details
    Browse the repository at this point in the history
  101. codegen: End CreateAllocaBpf() lifetimes

    This commit cleans up the unmatched CreateAllocaBpf()s due to the
    alloca'd values being returned through `expr_`.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    17541e5 View commit details
    Browse the repository at this point in the history
  102. codegen: Update all callsites to use safer accept()

    This commit also includes some lifetime annotation changes.
    Overall the lifetimes should be more accurate.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    e33ef05 View commit details
    Browse the repository at this point in the history
  103. Update codegen samples

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    4932465 View commit details
    Browse the repository at this point in the history
  104. Add feature specific runtime testcase support

    This adds `REQUIRES_FEATURE` field for a runtime test script. This allows
    a feature specific testcase without manually writing
    `REQUIRES bpftrace --info | grep xxxx`. The current supported features
    are "loop" and "btf".
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    622ea0f View commit details
    Browse the repository at this point in the history
  105. Rename FieldAnalyser::builtin_args_ to FieldAnalyser::has_builtin_args_

    More bools are comming so it's convenient they follow same name pattern.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    olsajiri authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    50dbd18 View commit details
    Browse the repository at this point in the history
  106. Add error display support to FieldAnalyser class

    Adding error and warning functions to emit
    error with location and allow to fail from
    FieldAnalyser class with some nice output.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    olsajiri authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    ba05558 View commit details
    Browse the repository at this point in the history
  107. Add kfunc argument checks for multiple attach points

    Currently we allow to attach multiple attach points for a single
    probe code which uses args->X. If arguments of all the functions
    are not the same, bad things will happen ;-)
    
    Adding the arguments check for multiple attach points and failing
    only if arguments are used in the code.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    olsajiri authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    15fb4c1 View commit details
    Browse the repository at this point in the history
  108. Add test for multiple kfunc attachpoints

    Adding automated tests for multiple kfunc attachpoints.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    olsajiri authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5439d7c View commit details
    Browse the repository at this point in the history
  109. Factor BTF::get_kfuncs from BTF::display_funcs

    New get_funcs function will be used in wildcard matching
    later in following changes.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    olsajiri authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5a801d2 View commit details
    Browse the repository at this point in the history
  110. Add wildcard support for kfunc probe types

    Adding wildcard support for kfunc probe types. It's now possible
    to use following probes:
    
      # bpftrace -e 'kfunc:ksys_* { @[comm, probe] = kstack; }'
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    olsajiri authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    db71026 View commit details
    Browse the repository at this point in the history
  111. codegen: add option to emit elf file

    While debugging it is sometimes useful to see the BPF created by LLVM.
    Currently the only way to do that is to use bpftool to dump the program
    after it has been loaded into the kernel, which is quite a lot of
    hassle.
    
    This adds a simple pass that emits an elf file. This pass can
    (currently) only be called after the optimization pass as that does some
    setup. To prevent some programmer errors I've added some assert() to
    make sure all passes are called in the correct order.
    
    LLVM 6 doesn't support the raw_fd_ostream API so that uses the svector
    based one, that part is basically a copy of
    `tools/perf/util/c++/clang.cpp` in the linux kernel.
    
    This new flag hasn't been documented as I don't want to expose it to
    users.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    e9d8685 View commit details
    Browse the repository at this point in the history
  112. testing: add script to compare BPF between versions

    This uses the ELF output option to compare the generated BPF between two
    versions.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    c736335 View commit details
    Browse the repository at this point in the history
  113. Enable top&div args for printing avg() maps

    The top and div arguments of `print()` currently does not work for avg maps
    because it wasn't implemented. It makes sense to have them supported.
    
    Resolves #1385.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5555d5b View commit details
    Browse the repository at this point in the history
  114. codegen: remove unused files

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    837b6b9 View commit details
    Browse the repository at this point in the history
  115. codegen: avoid accidental checking of LLVM bytecode

    These get created when running `llvm-as`
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    3fc5970 View commit details
    Browse the repository at this point in the history
  116. codegen: cast buf len to correct size before store

    A store needs both types to be of the same size so we have to cast it to
    match the size of the struct element.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    84d81b1 View commit details
    Browse the repository at this point in the history
  117. codegen: resize probe_read size arg

    The function expect an i32 so lets give it that. As shrinking an i64 to
    i32 might potentially be an issue a check was added for it, these should
    be fix in the codegen.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    569e45f View commit details
    Browse the repository at this point in the history
  118. codegen: ensure equal types for store in print()

    As we know that the array is properly sized it is safe to cast types.
    
    This adds an additional codegen test too that uses the `memcpy` code
    path.
    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2339a71 View commit details
    Browse the repository at this point in the history
  119. codegen: boolean is 1 bit

    fbs authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    5333695 View commit details
    Browse the repository at this point in the history
  120. Add a semantic warning for printing stats maps with top/div args

    Both `top` and `div` are ambiguous when printing stats maps. `top` does not
    specify which statistic it's based on and it would cause confusion to define a
    default behavior for it. As for `div`, it would also somehow be strange: if use
    `div` on all three statistics, then the output does not have avg * count == sum
    anymore; if only on sum and avg, it might be misleading.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    8286878 View commit details
    Browse the repository at this point in the history
  121. changelog: Add fixed section

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    98a5e99 View commit details
    Browse the repository at this point in the history
  122. Add discourse shield to README

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    7eabf26 View commit details
    Browse the repository at this point in the history
  123. Configuration menu
    Copy the full SHA
    0e4129a View commit details
    Browse the repository at this point in the history
  124. Normalize capitalization

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    442cd64 View commit details
    Browse the repository at this point in the history
  125. Remove period

    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    280688c View commit details
    Browse the repository at this point in the history
  126. Ensure symbols are exported for bpftrace executable

    bpftrace executable needs to lookup `BEGIN_trigger` and `END_trigger`
    symbols. Since the bump of the minimal versin of CMake in
    1a1a4a9, these symbols are stripped
    from bpftrace: the executable is built without the `-rdynamic` option
    and the symbol is not present anymore (tested with GCC 10). To restore
    this compile option, we can instruct CMake to export symbols for
    bpftrace executable.
    
    Also, see #954.
    vincentbernat authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    0b1c22c View commit details
    Browse the repository at this point in the history
  127. Fix FieldAnalyzer::error

    Use `err_` instead of `out_` so that we can check whether errors
    occur later by checking the length of `err_`.
    Also fix tests to prevent an error message from being printed to stderr.
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    e3a2362 View commit details
    Browse the repository at this point in the history
  128. Fix: print() no output when used on hist() maps with large top args

    Currently, using `print` with a large `top` arg (any number larger than number
    of map keys) on `hist` maps would result in a negative overflow bug, which will
    make `print` fail to produce any output. This patch resolves this issue.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    41ad2e8 View commit details
    Browse the repository at this point in the history
  129. btf: tracepoint: Prefer BTF data if available

    Before, if a tracepoint argument was accessed, bpftrace would prefer
    using headers instead of BTF. This causes some friction for users/hosts
    that don't have headers installed. They would have to pass in --btf to
    override the default headers behavior.
    
    This commit makes BTF the default if it's available. Now, users don't
    need to pass in --btf.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    afc80bc View commit details
    Browse the repository at this point in the history
  130. Fix PR #1416: unsigned int overflow bug and unstable tests

    The merged PR which enables `top` and `div` args of `print` for `avg` maps has
    two issues that need addressing:
    
    1. It came with subtractions of unsigned integers which can easily cause
    negative overflows.
    2. The runtime tests it came with are somehow unstable and fails randomly. This
    patch brings more straightforward tests.
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    9b0dcce View commit details
    Browse the repository at this point in the history
  131. Revert "Ensure symbols are exported for bpftrace executable"

    This reverts commit 38f1c69.
    
    It was breaking the embedded builds.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    d56909e View commit details
    Browse the repository at this point in the history
  132. ci: Run embedded build on PRs

    The embedded build / test takes a while to run but it's probably better
    than having master randomly break. Every time that breaks it takes at
    least a couple days to get a fix up.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    83a9619 View commit details
    Browse the repository at this point in the history
  133. Add logging infra to bpftrace

    This introduces a stream-style logging infrastructure. It supports the basic
    functionalities for now and can be extended with future PRs.
    
    There are several benefits for including it in bpftrace:
    
    - It would be more convinient for developers to keep track of inner status of
    bpftrace and debug.
    - It can help to print consistent error/warning messages.
    - Future work will offer users the option to toggle on/off certain messages.
    
    Related to #1411
    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    c9d24c6 View commit details
    Browse the repository at this point in the history
  134. Add tests for the logging framework

    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    468bcf3 View commit details
    Browse the repository at this point in the history
  135. Configuration menu
    Copy the full SHA
    47aa1ea View commit details
    Browse the repository at this point in the history
  136. Configuration menu
    Copy the full SHA
    4bf92f5 View commit details
    Browse the repository at this point in the history
  137. Configuration menu
    Copy the full SHA
    0885b81 View commit details
    Browse the repository at this point in the history
  138. Logging: move logging out of bpftrace

    suyuee authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    9273666 View commit details
    Browse the repository at this point in the history
  139. Add missing TIMEOUT

    TIMEOUT field is necessary
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    2d93cf6 View commit details
    Browse the repository at this point in the history
  140. Stop runtime tests if the parser error occurs

    Currently, the runtime tests will continue even if there is a parser error.
    Fix this by calling exit(1) if the parser error occurs.
    mmisono authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    af085fd View commit details
    Browse the repository at this point in the history
  141. Filter out non-traceable kfunc symbols

    The list of available kfunc symbols is taken from the BTF data, however,
    it should not include non-traceable functions (those that are not listed
    in /sys/kernel/debug/tracing/available_filter_functions) as tracing of
    these may fail or be unstable. These are usually inlined functions or
    functions marked as "notrace".
    
    Resolves iovisor#1366.
    viktormalik authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    659a2a5 View commit details
    Browse the repository at this point in the history
  142. Filter out kfunc symbols having too many params

    Currently, when creating a BPF trampoline (in function
    arch_prepare_bpf_trampoline), kernel only supports saving arguments of
    the probed function that are passed in registers (at least for x86,
    which is now the only architecture that has BPF trampolines). If the
    function has more arguments, it is not attached, causing bpftrace to
    fail.
    
    This patch disables tracing of functions that have more arguments than
    the number passed in registers for the current architecture.
    viktormalik authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    b4acbb3 View commit details
    Browse the repository at this point in the history
  143. Improve error messages for kfunc

    Most of the errors for kfunc (non-existing or non-traceable function
    etc.) occur when resolving kfunc arguments. Instead of printing a
    generic "resolving kfunc arguments failed", print a better message that
    could help the user to identify the problem.
    viktormalik authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    7f6d596 View commit details
    Browse the repository at this point in the history
  144. Fix array indexing regression

    We regressed on array indexing because the CreateArray() helper forgot
    to set pointee_size. This caused all array indexes to silently index to
    index 0.
    danobi authored and sravyamks committed Aug 7, 2020
    Configuration menu
    Copy the full SHA
    beaa7cd View commit details
    Browse the repository at this point in the history