Previously, the ending identifier for parsing the task structure
member is " }, \n". However the ending identifier is not always
as expected. " },\n" can also be the ending identifier. For example,
if we have the following struct, the parsing will fail.
tasks = {\n
next = 0xffff94f8038f8838,\n
prev = 0xffff94f8036f8838\n
},\n
Before:
crash> task -R tasks ffff94f8038f4000
PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND: "khungtaskd"
After:
crash> task -R tasks ffff94f8038f4000
PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND: "khungtaskd"
tasks = {
next = 0xffff94f8038f8838,
prev = 0xffff94f8036f8838
},
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
task.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/task.c b/task.c
index 071c787..db2abc8 100644
--- a/task.c
+++ b/task.c
@@ -3436,7 +3436,8 @@ parse_task_thread(int argcnt, char *arglist[], struct task_context
*tc) {
while (fgets(buf, BUFSIZE, pc->tmpfile)) {
if (STREQ(buf, " {\n"))
randomized = TRUE;
- else if (randomized && STREQ(buf, " }, \n"))
+ else if (randomized &&
+ (STREQ(buf, " }, \n") || STREQ(buf, " },\n")))
randomized = FALSE;
if (strlen(lookfor2)) {
--
2.33.1