[PUSHED 5/8] gdbserver: boolify regcache fields

Tankut Baris Aktemur
2024-12-17T08:25:17Z

The registers_valid and registers_owned fields of the regcache struct
are of type int. Make them bool.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
---
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 4a064f6374b..93bf5988a33 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -46,7 +46,7 @@ get_thread_regcache (thread_info *thread, bool fetch)
thread->set_regcache (regcache);
}

- if (fetch && regcache->registers_valid == 0)
+ if (fetch && !regcache->registers_valid)
{
scoped_restore_current_thread restore_thread;

@@ -55,7 +55,7 @@ get_thread_regcache (thread_info *thread, bool fetch)
memset (regcache->register_status, REG_UNAVAILABLE,
regcache->tdesc->reg_defs.size ());
fetch_inferior_registers (regcache, -1);
- regcache->registers_valid = 1;
+ regcache->registers_valid = true;
}

return regcache;
@@ -85,7 +85,7 @@ regcache_invalidate_thread (thread_info *thread)
store_inferior_registers (regcache, -1);
}

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

/* See regcache.h. */
@@ -127,7 +127,7 @@ init_register_cache (struct regcache *regcache,
regcache->tdesc = tdesc;
regcache->registers
= (unsigned char *) xcalloc (1, tdesc->registers_size);
- regcache->registers_owned = 1;
+ regcache->registers_owned = true;
regcache->register_status
= (unsigned char *) xmalloc (tdesc->reg_defs.size ());
memset ((void *) regcache->register_status, REG_UNAVAILABLE,
@@ -140,13 +140,13 @@ init_register_cache (struct regcache *regcache,
{
regcache->tdesc = tdesc;
regcache->registers = regbuf;
- regcache->registers_owned = 0;
+ regcache->registers_owned = false;
#ifndef IN_PROCESS_AGENT
regcache->register_status = NULL;
#endif
}

- regcache->registers_valid = 0;
+ regcache->registers_valid = false;

return regcache;
}
diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h
index db3b2425de6..c2e8e141d13 100644
--- a/gdbserver/regcache.h
+++ b/gdbserver/regcache.h
@@ -38,8 +38,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.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva