diff mbox series

[v2,10/27] dyndbg: let query-modname override defaulting modname

Message ID 20220516225640.3102269-11-jim.cromie@gmail.com (mailing list archive)
State New, archived
Headers show
Series DRM.debug on DYNAMIC_DEBUG, add trace events | expand

Commit Message

Jim Cromie May 16, 2022, 10:56 p.m. UTC
dyndbg's control-parser: ddebug_parse_query(), requires that search
terms: module, func, file, lineno, are not used 2x in a query; a thing
cannot be named both foo and bar (not even wildcards, no OR is
contemplated).

Amend the treatment of module; while still enforcing the 2x rule on
it, set the default module at end, if none was given in the query
itself, so the preset doesn't spoil the check.

Background:

ddebug_parse_query() got a modname arg to support boot-args with
compound queries, all with "module aMod" added by default.

  aMod.dyndbg="func foo +p; func bar +p"

With default module at end, this becomes possible; "module *" in the
query overrides the default "module aMod".

  aMod.dyndbg="module * class FOO +p"

This means aMod can modify (by explicit means) any FOO class'd
pr_debugs in other modules.  It is intended for use by DRM, which
generally would want sub-system wide coordination.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index b67bf9efec07..42dce2e76014 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -425,10 +425,6 @@  static int ddebug_parse_query(char *words[], int nwords,
 		return -EINVAL;
 	}
 
-	if (modname)
-		/* support $modname.dyndbg=<multiple queries> */
-		query->module = modname;
-
 	for (i = 0; i < nwords; i += 2) {
 		char *keyword = words[i];
 		char *arg = words[i+1];
@@ -471,6 +467,13 @@  static int ddebug_parse_query(char *words[], int nwords,
 		if (rc)
 			return rc;
 	}
+	if (!query->module && modname)
+		/*
+		 * support $modname.dyndbg=<multiple queries>,
+		 * allowing query.module to override $modname
+		 */
+		query->module = modname;
+
 	vpr_info_dq(query, "parsed");
 	return 0;
 }