~thread_info ()
{
- free_register_cache (m_regcache);
+ delete m_regcache;
}
/* Return the process owning this thread. */
tdesc->reg_defs.size ());
}
-void
-free_register_cache (struct regcache *regcache)
+regcache::~regcache ()
{
- if (regcache)
- {
- if (regcache->registers_owned)
- free (regcache->registers);
- free (regcache->register_status);
- delete regcache;
- }
+ if (registers_owned)
+ free (registers);
+ free (register_status);
}
#endif
if (regcache != NULL)
{
regcache_invalidate_thread (thread);
- free_register_cache (regcache);
+ delete regcache;
thread->set_regcache (nullptr);
}
}
The regcache dynamically allocates its register buffer. */
regcache (const target_desc *tdesc);
+
+ /* Destructor. */
+ ~regcache ();
#endif
/* Construct a regcache using the register layout described by TDESC
regcache *get_thread_regcache (thread_info *thread, bool fetch = true);
-/* Release all memory associated with the register cache for INFERIOR. */
-
-void free_register_cache (struct regcache *regcache);
-
/* Invalidate cached registers for one thread. */
void regcache_invalidate_thread (thread_info *);
require_running_or_break (cs.own_buf);
if (cs.current_traceframe >= 0)
{
- struct regcache *regcache
- = new struct regcache (current_target_desc ());
+ regcache a_regcache (current_target_desc ());
if (fetch_traceframe_registers (cs.current_traceframe,
- regcache, -1) == 0)
- registers_to_string (regcache, cs.own_buf);
+ &a_regcache, -1) == 0)
+ registers_to_string (&a_regcache, cs.own_buf);
else
write_enn (cs.own_buf);
- free_register_cache (regcache);
}
else
{