[RFC PATCH v6 21/34] dyndbg: ddebug_add_module() handle headers.

Jim Cromie
2021-05-29T20:03:11Z

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 --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index e4a22f7b153f..ad9971ded09a 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;
}
--
2.31.1