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

Improve error messages for kfunc #1451

Merged
merged 1 commit into from
Aug 6, 2020

Conversation

viktormalik
Copy link
Contributor

@viktormalik viktormalik commented Aug 4, 2020

Most of the errors for kfunc (including, e.g., detecting a non-existing or a non-traceable function) occur when resolving kfunc arguments. This PR proposes to print more informative messages (instead of a generic "resolving kfunc arguments failed") that could help user to identify the problem.

Related to #841

Checklist
  • Language changes are updated in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md

src/btf.cpp Outdated
@@ -439,23 +440,37 @@ int BTF::resolve_args(const std::string &func,

t = btf__type_by_id(btf, t->type);
if (!btf_is_func_proto(t))
return -1;
{
throw std::runtime_error("not a function\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw std::runtime_error("not a function\n");
throw std::runtime_error("not a function");

Copy link
Contributor

@fbs fbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a changelog item?

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.
@fbs fbs merged commit 4e82ba1 into bpftrace:master Aug 6, 2020
@viktormalik viktormalik deleted the kfunc-error-messages branch August 10, 2020 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants