• Sasha Goldshtein's avatar
    trace: STRCMP helper function · f4797b0c
    Sasha Goldshtein authored
    `trace` filters and print expressions can now use the
    magic STRCMP helper function to compare strings. The first
    string must be a compile-time constant literal string,
    such as "test", and the second string can be determined at
    runtime (e.g., from a function argument). The codegen for
    STRCMP is on a case-by-case basis for each literal string,
    and it generates an inline function with a constant-length
    loop that compares the string's characters. This is a
    decent workaround until we get something more reasonable
    from the kernel side, such as a `bpf_strcmp` helper.
    
    Usage example:
    
    ```
    trace 'p:c:open (STRCMP("test.txt", arg1)) "%s", arg1'
    ``
    f4797b0c
trace.8 6.41 KB