Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Stafford Horne <shorne@gmail.com>
Cc: GDB patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] xtensa: Properly strdup string when building reggroup
Date: Mon, 12 Jun 2017 08:22:00 -0000	[thread overview]
Message-ID: <86poe9aa4y.fsf@gmail.com> (raw)
In-Reply-To: <20170610133422.19913-1-shorne@gmail.com> (Stafford Horne's	message of "Sat, 10 Jun 2017 22:34:22 +0900")

Stafford Horne <shorne@gmail.com> writes:

Patch is good to me, a nit,

> -      xtensa_cp[i] = reggroup_new (cpname, USER_REGGROUP);
> +      xtensa_cp[i] = reggroup_new (xstrdup(cpname), USER_REGGROUP);

"xstrdup (cpname)".

Before your patch is applied, GDB prints some garbage data,

(gdb) set architecture xtensa
The target architecture is assumed to be xtensa
(gdb) maintenance print reggroups 
 Group      Type      
 all        user      
 save       internal  
 restore    internal  
 system     user      
 vector     user      
 general    user      
 float      user      
 ar         user      
 user       user      
 vectra     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user      
 P�^\U     user
 P�^\U     user

with your patch applied, the output looks "right",

(gdb) maintenance print reggroups
 Group      Type      
 all        user      
 save       internal  
 restore    internal  
 system     user      
 vector     user      
 general    user      
 float      user      
 ar         user      
 user       user      
 vectra     user      
 cp0        user      
 cp1        user      
 cp2        user      
 cp3        user      
 cp4        user      
 cp5        user      
 cp6        user      
 cp7        user      
 cp8        user      
 cp9        user      
 cp:        user      
 cp;        user      
 cp<        user      
 cp=        user      
 cp>        user      
 cp?        user

This exposes another bug, IMO, here,

  for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++)
    {
      cpname[2] = '0' + i;
      xtensa_cp[i] = reggroup_new (cpname, USER_REGGROUP);
    }

and XTENSA_MAX_COPROCESSOR is 0x10, so we can see "cp:", "cp;", which
looks odd.

-- 
Yao (齐尧)


  reply	other threads:[~2017-06-12  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-10 13:34 Stafford Horne
2017-06-12  8:22 ` Yao Qi [this message]
2017-06-12  8:38   ` Simon Marchi
2017-06-13 10:06     ` Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86poe9aa4y.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=shorne@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox