diff mbox series

[RFC,v5,20/28] dyndbg: ddebug_add_module() handle headers.

Message ID 20210511185057.3815777-21-jim.cromie@gmail.com (mailing list archive)
State New
Headers show
Series dynamic debug diet plan | expand

Commit Message

Jim Cromie May 11, 2021, 6:50 p.m. UTC
Now that header records are in the __dyndbg* sections,
ddebug_add_module() sees them when they're present (when adding
loadable modules and the 1st builtin, but not 2nd..Nth).  Teach
ddebug_add_module() to recognize and account for them.

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

Patch

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 9d9cb36f40a6..462d364fc788 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1036,7 +1036,18 @@  static int __ddebug_add_module(struct _ddebug *tab, struct _ddebug_site *sites,
 	int i;
 
 	v3pr_info("add-module: %s.%d sites\n", modname, numdbgs);
-	if (!numdbgs) {
+
+	if (numdbgs && is_dyndbg_header_pair(tab, sites)) {
+
+		v3pr_info(" header: %d %s.%s.%d\n", tab[0]._index, modname,
+			  tab[0].site->function, tab[0].lineno);
+		WARN_ON(tab[0].site != &sites[0]);
+		if (numdbgs <= 1) {
+			v3pr_info(" skip header %s\n", modname);
+			return 0;
+		}
+
+	} else if (!numdbgs) {
 		v3pr_info(" skip %s\n", modname);
 		return 0;
 	}