[PATCH 16/26] gdbserver: boolify regcache fields

Tankut Baris Aktemur via Gdb-patches
2023-02-28T11:31:22Z

The registers_valid and registers_owned fields of the regcache struct
are of type int. Make them bool.
---
gdbserver/regcache.cc | 12 ++++++------
gdbserver/regcache.h | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 0c6f1eb392b..4b56750d06a 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -57,7 +57,7 @@ get_thread_regcache (struct thread_info *thread, bool fetch)
void
regcache::fetch ()
{
- if (registers_valid == 0)
+ if (!registers_valid)
{
scoped_restore_current_thread restore_thread;
gdb_assert (this->thread != nullptr);
@@ -66,7 +66,7 @@ regcache::fetch ()
/* Invalidate all registers, to prevent stale left-overs. */
memset (register_status, REG_UNAVAILABLE, tdesc->reg_defs.size ());
fetch_inferior_registers (this, -1);
- registers_valid = 1;
+ registers_valid = true;
}
}

@@ -128,7 +128,7 @@ regcache_invalidate (void)
void
regcache::discard ()
{
- registers_valid = 0;
+ registers_valid = false;
}

void
@@ -145,7 +145,7 @@ regcache::initialize (const target_desc *tdesc,
this->tdesc = tdesc;
this->registers
= (unsigned char *) xcalloc (1, tdesc->registers_size);
- this->registers_owned = 1;
+ this->registers_owned = true;
this->register_status
= (unsigned char *) xmalloc (tdesc->reg_defs.size ());
memset ((void *) this->register_status, REG_UNAVAILABLE,
@@ -158,13 +158,13 @@ regcache::initialize (const target_desc *tdesc,
{
this->tdesc = tdesc;
this->registers = regbuf;
- this->registers_owned = 0;
+ this->registers_owned = false;
#ifndef IN_PROCESS_AGENT
this->register_status = nullptr;
#endif
}

- this->registers_valid = 0;
+ this->registers_valid = false;
}

#ifndef IN_PROCESS_AGENT
diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h
index ceef28086ce..f155ac631eb 100644
--- a/gdbserver/regcache.h
+++ b/gdbserver/regcache.h
@@ -41,8 +41,8 @@ struct regcache : public reg_buffer_common
register cache is _not_ pass-through, unlike GDB's. Note that
"valid" here is unrelated to whether the registers are available
in a traceframe. For that, check REGISTER_STATUS below. */
- int registers_valid = 0;
- int registers_owned = 0;
+ bool registers_valid = false;
+ bool registers_owned = false;
unsigned char *registers = nullptr;
#ifndef IN_PROCESS_AGENT
/* One of REG_UNAVAILABLE or REG_VALID. */
--
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva