trace: Generated streq-helper to ignore null terminator
authorSasha Goldshtein <goldshtn@gmail.com>
Mon, 16 Jan 2017 18:41:22 +0000 (18:41 +0000)
committerSasha Goldshtein <goldshtn@gmail.com>
Tue, 17 Jan 2017 07:42:39 +0000 (07:42 +0000)
tools/trace.py

index 8ac9201..d12e26b 100755 (executable)
@@ -217,11 +217,11 @@ class Probe(object):
                 fname = "streq_%d" % Probe.streq_index
                 Probe.streq_index += 1
                 self.streq_functions += """
-static inline bool %s(char const *ignored, unsigned long str) {
+static inline bool %s(char const *ignored, uintptr_t str) {
         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) {
                 if (needle[i] != haystack[i]) {
                         return false;
                 }