[24/26] gdbserver: return tracked register status in regcache_raw_read_unsigned

Message ID 232ee024f5b957a07c047c724d7065074da1ef34.1677582745.git.tankut.baris.aktemur@intel.com
State New
Headers
Series gdbserver: refactor regcache and allow gradually populating |

Commit Message

Aktemur, Tankut Baris Feb. 28, 2023, 11:28 a.m. UTC
  In regcache_raw_read_unsigned, we unconditionally return REG_VALID as
the register status.  This does not seem right, since the register may
in fact be in another state, such as REG_UNAVAILABLE.  Return the
tracked status.
---
 gdbserver/regcache.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Simon Marchi Dec. 22, 2023, 4:42 a.m. UTC | #1
On 2023-02-28 06:28, Tankut Baris Aktemur via Gdb-patches wrote:
> In regcache_raw_read_unsigned, we unconditionally return REG_VALID as
> the register status.  This does not seem right, since the register may
> in fact be in another state, such as REG_UNAVAILABLE.  Return the
> tracked status.
> ---
>  gdbserver/regcache.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
> index 32f0e1109e6..4533e9e9b12 100644
> --- a/gdbserver/regcache.cc
> +++ b/gdbserver/regcache.cc
> @@ -451,7 +451,7 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
>    *val = 0;
>    collect_register (regcache, regnum, val);
>  
> -  return REG_VALID;
> +  return regcache->get_register_status (regnum);
>  }
>  
>  #ifndef IN_PROCESS_AGENT

LGTM.  You can push it right away, if you think it makes sense.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  

Patch

diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 32f0e1109e6..4533e9e9b12 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -451,7 +451,7 @@  regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
   *val = 0;
   collect_register (regcache, regnum, val);
 
-  return REG_VALID;
+  return regcache->get_register_status (regnum);
 }
 
 #ifndef IN_PROCESS_AGENT