From: Stafford Horne <shorne@gmail.com>
To: GDB patches <gdb-patches@sourceware.org>
Cc: Stafford Horne <shorne@gmail.com>
Subject: [PATCH] xtensa: Properly strdup string when building reggroup
Date: Sat, 10 Jun 2017 13:34:00 -0000 [thread overview]
Message-ID: <20170610133422.19913-1-shorne@gmail.com> (raw)
I noticed this while looking at the reggroup intializations. It seems
for xtensa the "cpN" reggroup->name is getting assigned to the same text
pointer for each iteration of XTENSA_MAX_COPROCESSOR.
Note 1, internally reggroup_new() does not do any xstrdup().
Note 2, I could not test this.
gdb/ChangeLog:
2017-06-10 Stafford Horne <shorne@gmail.com>
* xtensa-tdep.c (xtensa_init_reggroups): Use xstrdup for cpname.
---
gdb/xtensa-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index f9e8584..cfbddf2 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -746,7 +746,7 @@ xtensa_init_reggroups (void)
for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++)
{
cpname[2] = '0' + i;
- xtensa_cp[i] = reggroup_new (cpname, USER_REGGROUP);
+ xtensa_cp[i] = reggroup_new (xstrdup(cpname), USER_REGGROUP);
}
}
--
2.9.4
next reply other threads:[~2017-06-10 13:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-10 13:34 Stafford Horne [this message]
2017-06-12 8:22 ` Yao Qi
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=20170610133422.19913-1-shorne@gmail.com \
--to=shorne@gmail.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).