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

apparser: Improve error messages when APs are missing commas #2781

Merged
merged 3 commits into from
Oct 2, 2023

Commits on Sep 30, 2023

  1. apparser: kfunc: Report better errors for missing comma

    Given the following script (that's missing a comma):
    
    ```
    kfunc:xfrm4_esp_rcv
    kfunc:xfrm4_rcv
    {
        exit()
    }
    ```
    
    you get this error:
    
    ```
    Attaching 1 probe...
    ERROR: No BTF found for xfrm4_rcv
    ```
    
    which is too vague.
    
    This is b/c the parser effectively ignores spaces and combines the two
    attachpoints into one string (sans space) when creating the
    input to AttachPointParser. This is an unfortunate result of the
    attachpoint parser design.
    
    It's a bit too unwieldy to teach the parser about spaces (cuz we'd have
    to sprinkle it everywhere), so opt to do the next best thing and have a
    slightly more informative error instead.
    
    With this commit, the error is now:
    
    ```
    Attaching 1 probe...
    ERROR: No BTF found for xfrm4_esp_rcvkfunc:xfrm4_rcv
    ```
    
    which should provide a better hint to the user.
    danobi committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    720d002 View commit details
    Browse the repository at this point in the history
  2. apparser: Provide better error messages for bad argument counts

    Given the following script (that's missing a comma):
    
    ```
    t:syscalls:sys_enter_openat
    t:syscalls:sys_exit_openat
    {
        exit();
    }
    ```
    
    you get this error:
    
    ```
    repro.bt:1-2: ERROR: tracepoint probe type requires 2 arguments
    ```
    
    This is too ambiguous.
    
    The underlying reason is b/c the parser effectively ignores spaces and
    combines the two attachpoints into one string (sans space) when creating
    the input to AttachPointParser. This is an unfortunate result of the
    attachpoint parser design.
    
    It's a bit too unwieldy to teach the parser about spaces (cuz we'd have
    to sprinkle it everywhere), so opt to do the next best thing and have a
    slightly more informative error instead.
    
    With this commit, the error is now:
    
    ```
    repro.bt:1-2: ERROR: tracepoint probe type requires 2 arguments, found 4
    ```
    
    which should provide a better hint to the user.
    danobi committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    eb58a61 View commit details
    Browse the repository at this point in the history
  3. Update CHANGELOG

    danobi committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    3f7d55c View commit details
    Browse the repository at this point in the history