Skip to contentSkip to conversation

trace-cmd list: Add --proto option to show fuction prototype

PATCH New Steven Rostedt 1 participant 1 message Feb 2 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 trace-cmd list: Add --proto option to show fuction prototype

From: "Steven Rostedt (Google)" <[email protected]>

If BTF is available and the user adds --proto to the command line, the function list (-f) will include the prototypes of the functions.

---
Changes since v1: https://lore.kernel.org/[email protected]

- Have it still build with libtraceevent 1.8 (no BTF)

 Documentation/trace-cmd/trace-cmd-list.1.txt |  7 ++
 tracecmd/trace-cmd.bash                      |  2 +-
 tracecmd/trace-list.c                        | 94 +++++++++++++++++++-
 tracecmd/trace-usage.c                       |  1 +
 4 files changed, 99 insertions(+), 5 deletions(-)
Documentation/trace-cmd/trace-cmd-list.1.txt +7 -0
index b77e3460c647..e0a1a3b86c9f 100644
@@ -58,6 +58,13 @@ OPTIONS
 
     trace-cmd list -f '^sched.*'
 
+    If *--proto* is also added to the command line, the functions will also have
+    show their prototypes if BTF is available.
+
+*--proto*::
+    If BTF is available on the running kernel, it will also show the function
+    parameters with *-f*.
+
 *-P*::
     List the plugin files that get loaded on trace-cmd report.
 
tracecmd/trace-cmd.bash +1 -1
index a7e81e0ded4a..fca772011593 100644
@@ -108,7 +108,7 @@ __trace_cmd_list_complete()
     case "$prev" in
 	list)
 	    local cmds=$(trace-cmd list -h |egrep "^ {10}-" | \
-				 sed -e 's/.*\(-.\).*/\1/')
+				 sed -e 's/^ *\(-[^ ]*\).*/\1/')
 	    COMPREPLY=( $(compgen -W "${cmds}" -- "${cur}") )
 	    ;;
 	-e)
tracecmd/trace-list.c +90 -4

142 lines not on this page · raw message

tracecmd/trace-usage.c +1 -0
index 3fd975c00a6b..f5a1c74c2ddf 100644
@@ -391,6 +391,7 @@ static struct usage_help usage_help[] = {
 		"          -B list defined buffer instances\n"
 		"          -C list the defined clocks (and active one)\n"
 		"          -c list the supported trace file compression algorithms\n"
+		"          --proto list the prototype of a function (if BTF is available)\n"
 	},
 	{
 		"restore",
Signature · 1 line
2.51.0