]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Replace regcache::dump with class register_dump
authorYao Qi <yao.qi@linaro.org>
Tue, 28 Nov 2017 17:52:12 +0000 (17:52 +0000)
committerYao Qi <yao.qi@linaro.org>
Mon, 22 Jan 2018 11:21:18 +0000 (11:21 +0000)
commit7e58b2bb292bf40bec07f50e52d8447e6c983654
tree1aaffb8076f6049acf47762922b5ecad17db28ff
parentfd57b1a23bbf3a8ebd8491935a4f36e1c1f2325d
Replace regcache::dump with class register_dump

Nowadays, we need to dump registers contents from "readwrite" regcache and
"readonly" regcache,

  if (target_has_registers)
    get_current_regcache ()->dump (out, what_to_dump);
  else
    {
      /* For the benefit of "maint print registers" & co when
         debugging an executable, allow dumping a regcache even when
         there is no thread selected / no registers.  */
      regcache dummy_regs (target_gdbarch ());
      dummy_regs.dump (out, what_to_dump);
    }

since we'll have two different types/classes for "readwrite" regcache and
"readonly" regcache, we have to move dump method to their parent class,
reg_buffer.  However, the functionality of "dump" looks unnecessary to
reg_buffer (because some dump modes like regcache_dump_none,
regcache_dump_remote and regcache_dump_groups don't need reg_buffer at
all, they need gdbarch to do the dump), so I decide to move "dump" into a
separate classes, and each sub-class is about each mode of dump.

gdb:

2017-11-28  Yao Qi  <yao.qi@linaro.org>

* regcache.c (class register_dump): New class.
(register_dump_regcache, register_dump_none): New class.
(register_dump_remote, register_dump_groups): New class.
(regcache_print): Update.
* regcache.h (regcache_dump_what): Move it to regcache.c.
(regcache) <dump>: Remove.
gdb/regcache.c
gdb/regcache.h