[PATCH] xtensa: Properly strdup string when building reggroup
Stafford Horne
shorne@gmail.com
Sat Jun 10 13:34:00 GMT 2017
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
More information about the Gdb-patches
mailing list