[PATCH v3 16/22] dyndbg: disambiguate quoting in a debug msg

Łukasz Bartosik posted 22 patches 2 years ago
There is a newer version of this series
[PATCH v3 16/22] dyndbg: disambiguate quoting in a debug msg
Posted by Łukasz Bartosik 2 years ago
From: Jim Cromie <jim.cromie@gmail.com>

When debugging a query parsing error, the debug message wraps the
query in escaped-double-quotes.  This is confusing when mixed with any
quoted args where quotes are stripped by the shell.

So this replaces the \"%s\" with <%s> in the format string, allowing a
user to see how the shell strips quotes:

lx]# echo  module "foo" format ,_ -f > /proc/dynamic_debug/control
[  716.037430] dyndbg: read 26 bytes from userspace
[  716.037966] dyndbg: query 0: <module foo format ,_ -f> on module: <*>

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 65dafdec7b76..8ce485fc84ff 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -955,7 +955,7 @@ static int ddebug_exec_queries(char *query, const char *modname)
 		if (!query || !*query || *query == '#')
 			continue;
 
-		vpr_info("query %d: \"%s\" mod:%s\n", i, query, modname ?: "*");
+		vpr_info("query %d: <%s> on module: <%s>\n", i, query, modname ?: "*");
 
 		rc = ddebug_exec_query(query, modname);
 		if (rc < 0) {
-- 
2.43.0.472.g3155946c3a-goog