Skip to contentSkip to conversation

libtraceevent: Add support for \t char in print fmt

PATCH New Ruben Devos 1 participant 1 message Feb 27, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtraceevent: Add support for \t char in print fmt

Events can have \t characters in their print format strings. An example is the smb3_cmd_done event from the cifs module. It has print format string:

	 "\tsid=0x%llx tid=0x%x cmd=%u mid=%llu", ...

Add \t as an accepted character in the while loop that parses the format string. This prevents the "[FAILED TO PARSE]" message and imporperly parsed output in trace-cmd report.

---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/event-parse.c +1 -1
index f2e50b0..06dfd52 100644
@@ -1307,7 +1307,7 @@ static enum tep_event_type __read_token(struct tep_handle *tep, char **tok)
 			/* Break out if the file is corrupted and giving non print chars */
 			if (ch <= 0)
 				break;
-		} while ((ch != quote_ch && isprint(ch)) || last_ch == '\\' || ch == '\n');
+		} while ((ch != quote_ch && isprint(ch)) || last_ch == '\\' || ch == '\n' || ch == '\t');
 		/* remove the last quote */
 		i--;
 
Signature · 1 line
2.48.1