[v4,30/39] dyndbg-test: fixup search-trace-name help

Message ID 20240210235009.2405808-31-ukaszb@chromium.org
State New
Headers
Series dyndbg: add support for writing debug logs to trace |

Commit Message

Ɓukasz Bartosik Feb. 10, 2024, 11:50 p.m. UTC
  From: Jim Cromie <jim.cromie@gmail.com>

The recent change to do whole-buf search (not just single line) had
the side-effect of printing too much $output, which hides the
information in clutter.  Print the search pattern instead.

Also add -v last arg handling, like in check_match_ct().  This lets a
single caller enable verbose output, to see the trace-bufs content.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index a48cb57aa5cb..d1f447eef4c0 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -159,6 +159,7 @@  function search_trace() {
 # $1 - trace instance name, 0 for global event trace
 # $2 - line number counting from the bottom
 # $3 - text to search for
+# $4 - optional -v to see verbose results
 function search_trace_name() {
 	if [ "$1" = "0" ]; then
 	    buf=$(cat /sys/kernel/debug/tracing/trace)
@@ -179,8 +180,9 @@  function search_trace_name() {
 		    in line '$line' or '$buf'"
 	    exit
 	fi
-	if [ $v_search_trace = 1 ]; then
-	    echo -e "${MAGENTA}: search_trace_name in $1 found: \n$output \nin:${BLUE} $buf ${NC}"
+	if [[ "$4" == "-v" || "$v_search_trace" = 1 ]]; then
+	    echo -e "${MAGENTA}: search_trace_name in $1 found: \n${YELLOW}$3 \
+		    \nin:${BLUE} $buf ${NC}"
         fi
 }