On Mon, Aug 29, 2022 at 3:21 PM <crash-utility-request@xxxxxxxxxx> wrote:
Date: Mon, 29 Aug 2022 07:15:15 +0000
From: HAGIO KAZUHITO(?????) <k-hagio-ab@xxxxxxx>
To: "Discussion list for crash utility usage, maintenance and
development" <crash-utility@xxxxxxxxxx>, Tao Liu <ltao@xxxxxxxxxx>
Subject: Re: [PATCH v2] Add ending identifier for
union when parsing task structure
Message-ID: <b5f22630-9649-20a2-6233-f229f76353dc@xxxxxxx>
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@xxxxxxxxxx>
> ---
>
> 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@xxxxxxx>
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)) {
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility Contribution Guidelines: https://github.com/crash-utility/crash/wiki