[Crash-utility] [PATCH] Add ending identifier for task structure parsing

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Aug 25 01:34:29 UTC 2022


On 2022/08/24 19:01, Tao Liu wrote:
>>> 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;
>>
>> Looks fine but it looks like gdb-10.2 does not print a space before "\n",
>> I think we can _replace_ the STREQ(), not add, because the current branch
>> only supports gdb-10.2.
> ?>
> 
> Did you mean remove STREQ(buf, "  }, \n") check, only to keep
> STREQ(buf, "  },\n") check?

Yes.

> I'm not 100% sure if  no-space-before-"\n"
> is the way gdb-10.2 always works. I suggest we keep the two checks,
> just in case...

ok, it's a light function and I merely checked if gdb doesn't print
a space at end of lines with a few vmcores and outputs below, and
have not looked into the gdb source.  It's ok to keep the two checks.

crash-dev> gdb p *(struct task_struct *)0xffff8f96c159c8c0 | grep ' $'
crash-dev>

Thanks,
Kazu


More information about the Crash-utility mailing list