[Crash-utility] [PATCH v2] Add ending identifier for union when parsing task structure
lijiang
lijiang at redhat.com
Wed Aug 31 08:59:00 UTC 2022
On Mon, Aug 29, 2022 at 3:21 PM <crash-utility-request at redhat.com> wrote:
> Date: Mon, 29 Aug 2022 07:15:15 +0000
> From: HAGIO KAZUHITO(?????) <k-hagio-ab at nec.com>
> To: "Discussion list for crash utility usage, maintenance and
> development" <crash-utility at redhat.com>, Tao Liu <ltao at redhat.com>
> Subject: Re: [Crash-utility] [PATCH v2] Add ending identifier for
> union when parsing task structure
> Message-ID: <b5f22630-9649-20a2-6233-f229f76353dc at nec.com>
> Content-Type: text/plain; charset="utf-8"
>
> On 2022/08/25 15:39, Tao Liu wrote:
> > Previously, the start and end identifier for union is " {\n"
> > and " }, \n". However the end identifier is not always as
> > expected. " },\n" can also be the end identifier. As a result,
> > variable "randomized" is in incorrect state after union, and
> > fails to identify the later struct members. For example, we can
> > reproduce the issue as follows:
> >
> > crash> task
> > PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND:
> "khungtaskd"
> > struct task_struct {
> > thread_info = {
> > flags = 2148024320,
> > status = 0,
> > preempt_lazy_count = 0
> > },
> > {
> > <the union>
> > },
> > ...
> > wake_entry = {
> > next = 0x0
> > },
> > ...
> >
> > Before patch:
> >
> > crash> task -R wake_entry
> > PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND:
> "khungtaskd"
> >
> > After patch:
> >
> > crash> task -R wake_entry
> > PID: 847 TASK: ffff94f8038f4000 CPU: 72 COMMAND:
> "khungtaskd"
> > wake_entry = {
> > next = 0x0
> > },
> >
> > Signed-off-by: Tao Liu <ltao at redhat.com>
> > ---
> >
> > v1 -> v2: Rewrite the commit log.
>
> Thanks for the update.
>
> I will add "with gdb-10.2" to the commit log when applying.
>
>
This is indeed a specific gdb-10.2 issue. They have different output styles
between gdb-7.6 and gdb-10.2.
> Acked-by: Kazuhito Hagio <k-hagio-ab at nec.com>
>
> Thanks,
> Kazu
>
>
> >
> > ---
> > 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")))
>
This change looks good, and the test is ok. So for the v2: Ack.
Thanks.
Lianbo
> randomized = FALSE;
> >
> > if (strlen(lookfor2)) {
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20220831/7d72f4e9/attachment-0001.htm>
More information about the Crash-utility
mailing list