Skip to contentSkip to conversation

libtraceevent: Warn when kallsyms exits due to parsing error

PATCH New Steven Rostedt 1 participant 1 message Jun 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtraceevent: Warn when kallsyms exits due to parsing error

From: "Steven Rostedt (Google)" <[email protected]>

If the kallsyms has a corrupted line, it will exit the parsing. This can be confusing to users that expect to see function address converted into names.

Add a tep_warning() when this happens. At least the library will warn about it (although trace-cmd requires --verbose to see it).

---
 src/event-parse.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/event-parse.c +4 -1
index 4bbf29727e9f..823333a3bde4 100644
@@ -739,8 +739,11 @@ int tep_parse_kallsyms(struct tep_handle *tep, const char *kallsyms)
 		if (errno)
 			goto out;
 
-		if (n != 2 || !func_end)
+		if (n != 2 || !func_end) {
+			tep_warning("Failed to parse kallsyms n=%d func_end=%d",
+				    n, func_end);
 			goto out;
+		}
 
 		func = line + func_start;
 		/*
Signature · 1 line
2.35.1