Re: [PATCH v2 0/3] Initial trace-cmd support for ftrace uprobes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tzvetomir,

I really like this patch set. Great job!

To get it working on my laptop, I had to make the following changes. I
ran this on a new VM which didn't have libbfd and it failed to build.
Then the check wasn't quite working, and it was saying that libbfd
wasn't installed even though it was. Finally, I tested it against a
small program that had numbers in the function name, and I had to
change your sanitizer to not convert numbers into underscores.

Also, all strdup()s need to be tested. But other than that, it looks
great!

Below is the changes I made.

-- Steve

diff --git a/Makefile b/Makefile
index 0d657969..240043e1 100644
--- a/Makefile
+++ b/Makefile
@@ -245,7 +245,7 @@ endif
 CUNIT_INSTALLED := $(shell if (printf "$(pound)include <CUnit/Basic.h>\n void main(){CU_initialize_registry();}" | $(CC) -x c - -lcunit >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
 export CUNIT_INSTALLED
 
-BFD_INSTALLED := $(shell if (echo -e "\#include <bfd.h>\n void main(){bfd_init();}" | $(CC) -xc  - -lbfd >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
+BFD_INSTALLED := $(shell if (printf "$(pound)include <bfd.h>\n void main(){bfd_init();}" | $(CC) -x c  - -lbfd >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi)
 
 export BFD_INSTALLED
 ifeq ($(BFD_INSTALLED), 1)
diff --git a/tracecmd/trace-obj-debug.c b/tracecmd/trace-obj-debug.c
index 93b0dfee..254bfb38 100644
--- a/tracecmd/trace-obj-debug.c
+++ b/tracecmd/trace-obj-debug.c
@@ -8,13 +8,13 @@
 #include <string.h>
 #include <limits.h>
 #include <errno.h>
-#include <bfd.h>
 #include <unistd.h>
 
 #include "trace-local.h"
 #include "trace-cmd.h"
 
 #ifdef BFD_INSTALLED
+#include <bfd.h>
 
 struct trace_debug_handle {
 	bfd *bfd;
diff --git a/tracecmd/trace-uprobes.c b/tracecmd/trace-uprobes.c
index 87f8c148..75bebd6f 100644
--- a/tracecmd/trace-uprobes.c
+++ b/tracecmd/trace-uprobes.c
@@ -31,7 +31,7 @@ static char *uprobe_event_name(char *file, char *func, bool pret)
 	asprintf(&event, "%c_%.*s_%.10s", pret ? 'r':'p', 10, fname, func);
 	if (event) {
 		for (i = 0; event[i]; i++) {
-			if (!isalpha(event[i]))
+			if (!isalnum(event[i]))
 				event[i] = '_';
 		}
 	}



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux