Remove the last cleanup from regcache.c
This removes the last cleanup from regcache.c by changing one function to use std::string. gdb/ChangeLog 2017-09-25 Tom Tromey <tom@tromey.com> * regcache.c (regcache::dump): Use string_printf.
This commit is contained in:
parent
b292235f66
commit
6c3e20f177
2 changed files with 8 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2017-09-25 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* regcache.c (regcache::dump): Use string_printf.
|
||||||
|
|
||||||
2017-09-25 Tom Tromey <tom@tromey.com>
|
2017-09-25 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* regcache.c (class regcache_invalidator): New.
|
* regcache.c (class regcache_invalidator): New.
|
||||||
|
|
|
@ -1350,7 +1350,6 @@ reg_flush_command (char *command, int from_tty)
|
||||||
void
|
void
|
||||||
regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
|
regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
|
||||||
{
|
{
|
||||||
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
|
||||||
struct gdbarch *gdbarch = m_descr->gdbarch;
|
struct gdbarch *gdbarch = m_descr->gdbarch;
|
||||||
int regnum;
|
int regnum;
|
||||||
int footnote_nr = 0;
|
int footnote_nr = 0;
|
||||||
|
@ -1442,6 +1441,7 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
|
||||||
/* Type. */
|
/* Type. */
|
||||||
{
|
{
|
||||||
const char *t;
|
const char *t;
|
||||||
|
std::string name_holder;
|
||||||
|
|
||||||
if (regnum < 0)
|
if (regnum < 0)
|
||||||
t = "Type";
|
t = "Type";
|
||||||
|
@ -1452,13 +1452,11 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
|
||||||
t = TYPE_NAME (register_type (arch (), regnum));
|
t = TYPE_NAME (register_type (arch (), regnum));
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
{
|
{
|
||||||
char *n;
|
|
||||||
|
|
||||||
if (!footnote_register_type_name_null)
|
if (!footnote_register_type_name_null)
|
||||||
footnote_register_type_name_null = ++footnote_nr;
|
footnote_register_type_name_null = ++footnote_nr;
|
||||||
n = xstrprintf ("*%d", footnote_register_type_name_null);
|
name_holder = string_printf ("*%d",
|
||||||
make_cleanup (xfree, n);
|
footnote_register_type_name_null);
|
||||||
t = n;
|
t = name_holder.c_str ();
|
||||||
}
|
}
|
||||||
/* Chop a leading builtin_type. */
|
/* Chop a leading builtin_type. */
|
||||||
if (startswith (t, blt))
|
if (startswith (t, blt))
|
||||||
|
@ -1592,7 +1590,6 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
|
||||||
fprintf_unfiltered (file,
|
fprintf_unfiltered (file,
|
||||||
"*%d: Register type's name NULL.\n",
|
"*%d: Register type's name NULL.\n",
|
||||||
footnote_register_type_name_null);
|
footnote_register_type_name_null);
|
||||||
do_cleanups (cleanups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Reference in a new issue