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

trace, tplist, argdist: UDST probe miscellaneous fixes #909

Merged
merged 5 commits into from
Jan 17, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
argdist: Generated streq-helper to ignore null terminator
Oftentimes we want to use the STRCMP helper to compare strings that
are not null-terminated, e.g. in USDT probes this often happens.
Ignore the null terminator (i.e. loop until the last character
excluding the null terminator).
  • Loading branch information
goldshtn committed Jan 17, 2017
commit fd44cd244afa088303ee4b5a878980dda0f836ce
2 changes: 1 addition & 1 deletion tools/argdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def _generate_streq_function(self, string):
char needle[] = %s;
char haystack[sizeof(needle)];
bpf_probe_read(&haystack, sizeof(haystack), (void *)str);
for (int i = 0; i < sizeof(needle); ++i) {
for (int i = 0; i < sizeof(needle)-1; ++i) {
Copy link
Member

Choose a reason for hiding this comment

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

coding style nit: should be space before and after '-'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, there's actually a couple of places in the Python script that I did the same. Will fix and force-push.

if (needle[i] != haystack[i]) {
return false;
}
Expand Down