]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
No longer create readonly regcache
authorYao Qi <yao.qi@linaro.org>
Wed, 1 Nov 2017 16:29:16 +0000 (16:29 +0000)
committerYao Qi <yao.qi@linaro.org>
Wed, 7 Feb 2018 09:53:40 +0000 (09:53 +0000)
commitd1b4f173f1496e34605ddd51aa1ebe01b9c33486
treeb55fff4bf7703786548f14e6ea1aba47ebf89d19
parent2112d91dadb35783a2120f8f3b71a44d56538ed4
No longer create readonly regcache

Nowadays, we create a readonly regcache in get_return_value, and pass it
to gdbarch_return_value to get the return value.  In theory, we can pass a
readable_regcache instance and get the return value, because we don't need
to modify the regcache.  Unfortunately, gdbarch_return_value is designed
to multiplex regcache, according to READBUF and WRITEBUF.

 # If READBUF is not NULL, extract the return value and save it in this
 # buffer.
 #
 # If WRITEBUF is not NULL, it contains a return value which will be
 # stored into the appropriate register.

In fact, gdbarch_return_value should be split to three functions, 1) only
return return_value_convention, 2) pass regcache_readonly and readbuf, 3)
pass regcache and writebuf.  These changes are out of the scope of this
patch series, so I pass regcache to gdbarch_return_value even for read,
and trust each gdbarch backend doesn't modify regcache.

gdb:

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

* infcmd.c (get_return_value): Let stop_regs point to
get_current_regcache.
* regcache.c (regcache::regcache): Remove.
(register_dump_reg_buffer): New class.
(regcache_print): Adjust.
* regcache.h (regcache): Remove constructors.
gdb/infcmd.c
gdb/regcache.c
gdb/regcache.h