diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-08 15:36:23 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-08 15:46:02 -0500 |
commit | c583a2520616c2736cffc389c89a48b159366e6c (patch) | |
tree | b4925f26506fcee96c16119431c01760f05db95d /gdb/regcache.c | |
parent | ca7f92c2f15b86b09c4a8ad14806bef666308d31 (diff) | |
download | binutils-users/simark/clang-format.zip binutils-users/simark/clang-format.tar.gz binutils-users/simark/clang-format.tar.bz2 |
Run clang-format.shusers/simark/clang-format
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r-- | gdb/regcache.c | 262 |
1 files changed, 120 insertions, 142 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c index 7aee1c1..c185ac3 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -74,7 +74,7 @@ struct regcache_descr }; static const registry<gdbarch>::key<struct regcache_descr> - regcache_descr_handle; + regcache_descr_handle; static struct regcache_descr * init_regcache_descr (struct gdbarch *gdbarch) @@ -197,32 +197,33 @@ reg_buffer::reg_buffer (gdbarch *gdbarch, bool has_pseudo) if (has_pseudo) { m_registers.reset (new gdb_byte[m_descr->sizeof_cooked_registers]); - m_register_status.reset - (new register_status[m_descr->nr_cooked_registers] ()); + m_register_status.reset ( + new register_status[m_descr->nr_cooked_registers]()); } else { m_registers.reset (new gdb_byte[m_descr->sizeof_raw_registers]); - m_register_status.reset - (new register_status[gdbarch_num_regs (gdbarch)] ()); + m_register_status.reset ( + new register_status[gdbarch_num_regs (gdbarch)]()); } } regcache::regcache (process_stratum_target *target, gdbarch *gdbarch, const address_space *aspace_) -/* The register buffers. A read/write register cache can only hold + /* The register buffers. A read/write register cache can only hold [0 .. gdbarch_num_regs). */ - : detached_regcache (gdbarch, false), m_aspace (aspace_), m_target (target) + : detached_regcache (gdbarch, false), + m_aspace (aspace_), + m_target (target) { m_ptid = minus_one_ptid; } readonly_detached_regcache::readonly_detached_regcache (regcache &src) : readonly_detached_regcache (src.arch (), - [&src] (int regnum, gdb_byte *buf) - { - return src.cooked_read (regnum, buf); - }) + [&src] (int regnum, gdb_byte *buf) { + return src.cooked_read (regnum, buf); + }) { } @@ -348,9 +349,8 @@ using target_pid_ptid_regcache_map static target_pid_ptid_regcache_map regcaches; struct regcache * -get_thread_arch_aspace_regcache (process_stratum_target *target, - ptid_t ptid, gdbarch *arch, - struct address_space *aspace) +get_thread_arch_aspace_regcache (process_stratum_target *target, ptid_t ptid, + gdbarch *arch, struct address_space *aspace) { gdb_assert (target != nullptr); @@ -396,8 +396,7 @@ static struct gdbarch *current_thread_arch; struct regcache * get_thread_regcache (process_stratum_target *target, ptid_t ptid) { - if (!current_thread_arch - || target != current_thread_target + if (!current_thread_arch || target != current_thread_target || current_thread_ptid != ptid) { gdb_assert (ptid != null_ptid); @@ -418,8 +417,7 @@ get_thread_regcache (process_stratum_target *target, ptid_t ptid) struct regcache * get_thread_regcache (thread_info *thread) { - return get_thread_regcache (thread->inf->process_target (), - thread->ptid); + return get_thread_regcache (thread->inf->process_target (), thread->ptid); } struct regcache * @@ -450,15 +448,15 @@ regcache_observer_target_changed (struct target_ops *target) /* Update regcaches related to OLD_PTID to now use NEW_PTID. */ static void -regcache_thread_ptid_changed (process_stratum_target *target, - ptid_t old_ptid, ptid_t new_ptid) +regcache_thread_ptid_changed (process_stratum_target *target, ptid_t old_ptid, + ptid_t new_ptid) { /* Look up map for target. */ auto pid_ptid_regc_map_it = regcaches.find (target); if (pid_ptid_regc_map_it == regcaches.end ()) return; - /* Look up map for pid. */ + /* Look up map for pid. */ pid_ptid_regcache_map &pid_ptid_regc_map = pid_ptid_regc_map_it->second; auto ptid_regc_map_it = pid_ptid_regc_map.find (old_ptid.pid ()); if (ptid_regc_map_it == pid_ptid_regc_map.end ()) @@ -530,12 +528,10 @@ registers_changed_ptid (process_stratum_target *target, ptid_t ptid) = pid_ptid_regc_map_it->second; /* Look up map for pid. */ - auto ptid_regc_map_it - = pid_ptid_regc_map.find (ptid.pid ()); + auto ptid_regc_map_it = pid_ptid_regc_map.find (ptid.pid ()); if (ptid_regc_map_it != pid_ptid_regc_map.end ()) { - ptid_regcache_map &ptid_regc_map - = ptid_regc_map_it->second; + ptid_regcache_map &ptid_regc_map = ptid_regc_map_it->second; ptid_regc_map.erase (ptid); } @@ -543,7 +539,7 @@ registers_changed_ptid (process_stratum_target *target, ptid_t ptid) } else { - /* Non-NULL target and minus_one_ptid, delete all regcaches + /* Non-NULL target and minus_one_ptid, delete all regcaches associated to this target. */ regcaches.erase (target); } @@ -610,8 +606,7 @@ readable_regcache::raw_read (int regnum, gdb_byte *buf) if (m_register_status[regnum] != REG_VALID) memset (buf, 0, m_descr->sizeof_register[regnum]); else - memcpy (buf, register_buffer (regnum), - m_descr->sizeof_register[regnum]); + memcpy (buf, register_buffer (regnum), m_descr->sizeof_register[regnum]); return m_register_status[regnum]; } @@ -632,7 +627,7 @@ readable_regcache::raw_read (int regnum, T *val) gdb_byte *buf = (gdb_byte *) alloca (len); register_status status = raw_read (regnum, buf); if (status == REG_VALID) - *val = extract_integer<T> ({buf, len}, + *val = extract_integer<T> ({ buf, len }, gdbarch_byte_order (m_descr->gdbarch)); else *val = 0; @@ -683,8 +678,8 @@ regcache_raw_get_signed (struct regcache *regcache, int regnum) status = regcache_raw_read_signed (regcache, regnum, &value); if (status == REG_UNAVAILABLE) - throw_error (NOT_AVAILABLE_ERROR, - _("Register %d is not available"), regnum); + throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"), + regnum); return value; } @@ -695,8 +690,7 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf) gdb_assert (regnum < m_descr->nr_cooked_registers); if (regnum < num_raw_registers ()) return raw_read (regnum, buf); - else if (m_has_pseudo - && m_register_status[regnum] != REG_UNKNOWN) + else if (m_has_pseudo && m_register_status[regnum] != REG_UNKNOWN) { if (m_register_status[regnum] == REG_VALID) memcpy (buf, register_buffer (regnum), @@ -713,8 +707,8 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf) scoped_value_mark mark; - computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch, - this, regnum); + computed + = gdbarch_pseudo_register_read_value (m_descr->gdbarch, this, regnum); if (value_entirely_available (computed)) memcpy (buf, value_contents_raw (computed).data (), m_descr->sizeof_register[regnum]); @@ -727,8 +721,7 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf) return result; } else - return gdbarch_pseudo_register_read (m_descr->gdbarch, this, - regnum, buf); + return gdbarch_pseudo_register_read (m_descr->gdbarch, this, regnum, buf); } struct value * @@ -750,16 +743,15 @@ readable_regcache::cooked_read_value (int regnum) /* It is more efficient in general to do this delegation in this direction than in the other one, even though the value-based API is preferred. */ - if (cooked_read (regnum, - value_contents_raw (result).data ()) == REG_UNAVAILABLE) + if (cooked_read (regnum, value_contents_raw (result).data ()) + == REG_UNAVAILABLE) mark_value_bytes_unavailable (result, 0, value_type (result)->length ()); return result; } else - return gdbarch_pseudo_register_read_value (m_descr->gdbarch, - this, regnum); + return gdbarch_pseudo_register_read_value (m_descr->gdbarch, this, regnum); } enum register_status @@ -779,7 +771,7 @@ readable_regcache::cooked_read (int regnum, T *val) gdb_byte *buf = (gdb_byte *) alloca (len); register_status status = cooked_read (regnum, buf); if (status == REG_VALID) - *val = extract_integer<T> ({buf, len}, + *val = extract_integer<T> ({ buf, len }, gdbarch_byte_order (m_descr->gdbarch)); else *val = 0; @@ -808,7 +800,7 @@ regcache::cooked_write (int regnum, T val) { gdb_byte *buf; - gdb_assert (regnum >=0 && regnum < m_descr->nr_cooked_registers); + gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers); buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]); store_integer (buf, m_descr->sizeof_register[regnum], gdbarch_byte_order (m_descr->gdbarch), val); @@ -826,7 +818,6 @@ regcache_cooked_write_unsigned (struct regcache *regcache, int regnum, void regcache::raw_write (int regnum, const gdb_byte *buf) { - gdb_assert (buf != NULL); assert_regnum (regnum); @@ -839,7 +830,8 @@ regcache::raw_write (int regnum, const gdb_byte *buf) value, then don't bother doing the actual store. */ if (get_register_status (regnum) == REG_VALID && (memcmp (register_buffer (regnum), buf, - m_descr->sizeof_register[regnum]) == 0)) + m_descr->sizeof_register[regnum]) + == 0)) return; target_prepare_to_store (this); @@ -847,8 +839,7 @@ regcache::raw_write (int regnum, const gdb_byte *buf) /* Invalidate the register after it is written, in case of a failure. */ - auto invalidator - = make_scope_exit ([&] { this->invalidate (regnum); }); + auto invalidator = make_scope_exit ([&] { this->invalidate (regnum); }); target_store_registers (this, regnum); @@ -865,15 +856,14 @@ regcache::cooked_write (int regnum, const gdb_byte *buf) if (regnum < num_raw_registers ()) raw_write (regnum, buf); else - gdbarch_pseudo_register_write (m_descr->gdbarch, this, - regnum, buf); + gdbarch_pseudo_register_write (m_descr->gdbarch, this, regnum, buf); } /* See regcache.h. */ enum register_status -readable_regcache::read_part (int regnum, int offset, int len, - gdb_byte *out, bool is_raw) +readable_regcache::read_part (int regnum, int offset, int len, gdb_byte *out, + bool is_raw) { int reg_size = register_size (arch (), regnum); @@ -939,8 +929,8 @@ reg_buffer::raw_collect_part (int regnum, int offset, int len, /* See regcache.h. */ enum register_status -regcache::write_part (int regnum, int offset, int len, - const gdb_byte *in, bool is_raw) +regcache::write_part (int regnum, int offset, int len, const gdb_byte *in, + bool is_raw) { int reg_size = register_size (arch (), regnum); @@ -1020,8 +1010,7 @@ readable_regcache::raw_read_part (int regnum, int offset, int len, /* See regcache.h. */ void -regcache::raw_write_part (int regnum, int offset, int len, - const gdb_byte *buf) +regcache::raw_write_part (int regnum, int offset, int len, const gdb_byte *buf) { assert_regnum (regnum); write_part (regnum, offset, len, buf, true); @@ -1078,8 +1067,8 @@ reg_buffer::raw_supply (int regnum, const void *buf) /* See regcache.h. */ void -reg_buffer::raw_supply_integer (int regnum, const gdb_byte *addr, - int addr_len, bool is_signed) +reg_buffer::raw_supply_integer (int regnum, const gdb_byte *addr, int addr_len, + bool is_signed) { enum bfd_endian byte_order = gdbarch_byte_order (m_descr->gdbarch); gdb_byte *regbuf; @@ -1186,16 +1175,15 @@ regcache::transfer_regset_register (struct regcache *out_regcache, int regnum, void regcache::transfer_regset (const struct regset *regset, int regbase, - struct regcache *out_regcache, - int regnum, const gdb_byte *in_buf, - gdb_byte *out_buf, size_t size) const + struct regcache *out_regcache, int regnum, + const gdb_byte *in_buf, gdb_byte *out_buf, + size_t size) const { const struct regcache_map_entry *map; int offs = 0, count; for (map = (const struct regcache_map_entry *) regset->regmap; - (count = map->count) != 0; - map++) + (count = map->count) != 0; map++) { int regno = map->regno; int slot_size = map->size; @@ -1207,9 +1195,8 @@ regcache::transfer_regset (const struct regset *regset, int regbase, slot_size = m_descr->sizeof_register[regno]; if (regno == REGCACHE_MAP_SKIP - || (regnum != -1 - && (regnum < regno || regnum >= regno + count))) - offs += count * slot_size; + || (regnum != -1 && (regnum < regno || regnum >= regno + count))) + offs += count * slot_size; else if (regnum == -1) for (; count--; regno++, offs += slot_size) @@ -1239,8 +1226,7 @@ regcache::transfer_regset (const struct regset *regset, int regbase, If BUF is NULL, set the register(s) to "unavailable" status. */ void -regcache_supply_regset (const struct regset *regset, - struct regcache *regcache, +regcache_supply_regset (const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size) { regcache->supply_regset (regset, regnum, (const gdb_byte *) buf, size); @@ -1249,8 +1235,8 @@ regcache_supply_regset (const struct regset *regset, /* See regcache.h. */ void -regcache::supply_regset (const struct regset *regset, int regbase, - int regnum, const void *buf, size_t size) +regcache::supply_regset (const struct regset *regset, int regbase, int regnum, + const void *buf, size_t size) { transfer_regset (regset, regbase, this, regnum, (const gdb_byte *) buf, nullptr, size); @@ -1262,8 +1248,8 @@ regcache::supply_regset (const struct regset *regset, int regbase, void regcache_collect_regset (const struct regset *regset, - const struct regcache *regcache, - int regnum, void *buf, size_t size) + const struct regcache *regcache, int regnum, + void *buf, size_t size) { regcache->collect_regset (regset, regnum, (gdb_byte *) buf, size); } @@ -1271,8 +1257,8 @@ regcache_collect_regset (const struct regset *regset, /* See regcache.h */ void -regcache::collect_regset (const struct regset *regset, int regbase, - int regnum, void *buf, size_t size) const +regcache::collect_regset (const struct regset *regset, int regbase, int regnum, + void *buf, size_t size) const { transfer_regset (regset, regbase, nullptr, regnum, nullptr, (gdb_byte *) buf, size); @@ -1334,15 +1320,15 @@ regcache_read_pc (struct regcache *regcache) { ULONGEST raw_val; - if (regcache_cooked_read_unsigned (regcache, - gdbarch_pc_regnum (gdbarch), - &raw_val) == REG_UNAVAILABLE) - throw_error (NOT_AVAILABLE_ERROR, _("PC register is not available")); + if (regcache_cooked_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch), + &raw_val) + == REG_UNAVAILABLE) + throw_error (NOT_AVAILABLE_ERROR, _ ("PC register is not available")); pc_val = gdbarch_addr_bits_remove (gdbarch, raw_val); } else - internal_error (_("regcache_read_pc: Unable to find PC")); + internal_error (_ ("regcache_read_pc: Unable to find PC")); return pc_val; } @@ -1372,10 +1358,9 @@ regcache_write_pc (struct regcache *regcache, CORE_ADDR pc) if (gdbarch_write_pc_p (gdbarch)) gdbarch_write_pc (gdbarch, regcache, pc); else if (gdbarch_pc_regnum (gdbarch) >= 0) - regcache_cooked_write_unsigned (regcache, - gdbarch_pc_regnum (gdbarch), pc); + regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch), pc); else - internal_error (_("regcache_write_pc: Unable to update PC")); + internal_error (_ ("regcache_write_pc: Unable to update PC")); /* Writing the PC (for instance, from "load") invalidates the current frame. */ @@ -1389,15 +1374,14 @@ reg_buffer::num_raw_registers () const } void -regcache::debug_print_register (const char *func, int regno) +regcache::debug_print_register (const char *func, int regno) { struct gdbarch *gdbarch = arch (); gdb_printf (gdb_stdlog, "%s ", func); if (regno >= 0 && regno < gdbarch_num_regs (gdbarch) && gdbarch_register_name (gdbarch, regno)[0] != '\0') - gdb_printf (gdb_stdlog, "(%s)", - gdbarch_register_name (gdbarch, regno)); + gdb_printf (gdb_stdlog, "(%s)", gdbarch_register_name (gdbarch, regno)); else gdb_printf (gdb_stdlog, "(%d)", regno); if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)) @@ -1415,8 +1399,8 @@ regcache::debug_print_register (const char *func, int regno) { ULONGEST val = extract_unsigned_integer (buf, size, byte_order); - gdb_printf (gdb_stdlog, " %s %s", - core_addr_to_string_nz (val), plongest (val)); + gdb_printf (gdb_stdlog, " %s %s", core_addr_to_string_nz (val), + plongest (val)); } } gdb_printf (gdb_stdlog, "\n"); @@ -1430,7 +1414,7 @@ reg_flush_command (const char *command, int from_tty) /* Force-flush the register cache. */ registers_changed (); if (from_tty) - gdb_printf (_("Register cache flushed.\n")); + gdb_printf (_ ("Register cache flushed.\n")); } void @@ -1472,22 +1456,19 @@ register_dump::dump (ui_file *file) else if (regnum < gdbarch_num_regs (m_gdbarch)) gdb_printf (file, " %4d", regnum); else - gdb_printf (file, " %4d", - (regnum - gdbarch_num_regs (m_gdbarch))); + gdb_printf (file, " %4d", (regnum - gdbarch_num_regs (m_gdbarch))); /* Offset. */ if (regnum < 0) gdb_printf (file, " %6s ", "Offset"); else { - gdb_printf (file, " %6ld", - descr->register_offset[regnum]); + gdb_printf (file, " %6ld", descr->register_offset[regnum]); if (register_offset != descr->register_offset[regnum] || (regnum > 0 && (descr->register_offset[regnum] != (descr->register_offset[regnum - 1] - + descr->sizeof_register[regnum - 1]))) - ) + + descr->sizeof_register[regnum - 1])))) { if (!footnote_register_offset) footnote_register_offset = ++footnote_nr; @@ -1521,8 +1502,8 @@ register_dump::dump (ui_file *file) { if (!footnote_register_type_name_null) footnote_register_type_name_null = ++footnote_nr; - name_holder = string_printf ("*%d", - footnote_register_type_name_null); + name_holder + = string_printf ("*%d", footnote_register_type_name_null); t = name_holder.c_str (); } /* Chop a leading builtin_type. */ @@ -1544,8 +1525,7 @@ register_dump::dump (ui_file *file) gdb_printf (file, "*%d: Inconsistent register offsets.\n", footnote_register_offset); if (footnote_register_type_name_null) - gdb_printf (file, - "*%d: Register type's name NULL.\n", + gdb_printf (file, "*%d: Register type's name NULL.\n", footnote_register_type_name_null); } @@ -1554,7 +1534,8 @@ register_dump::dump (ui_file *file) #include "selftest-arch.h" #include "target-float.h" -namespace selftests { +namespace selftests +{ static size_t regcaches_size () @@ -1562,18 +1543,15 @@ regcaches_size () size_t size = 0; for (auto pid_ptid_regc_map_it = regcaches.cbegin (); - pid_ptid_regc_map_it != regcaches.cend (); - ++pid_ptid_regc_map_it) + pid_ptid_regc_map_it != regcaches.cend (); ++pid_ptid_regc_map_it) { const pid_ptid_regcache_map &pid_ptid_regc_map = pid_ptid_regc_map_it->second; for (auto ptid_regc_map_it = pid_ptid_regc_map.cbegin (); - ptid_regc_map_it != pid_ptid_regc_map.cend (); - ++ptid_regc_map_it) + ptid_regc_map_it != pid_ptid_regc_map.cend (); ++ptid_regc_map_it) { - const ptid_regcache_map &ptid_regc_map - = ptid_regc_map_it->second; + const ptid_regcache_map &ptid_regc_map = ptid_regc_map_it->second; size += ptid_regc_map.size (); } @@ -1670,13 +1648,13 @@ populate_regcaches_for_test () { for (long lwp : { 1, 2, 3 }) { - get_thread_arch_aspace_regcache_and_check - (&data->test_target1, ptid_t (pid, lwp)); + get_thread_arch_aspace_regcache_and_check (&data->test_target1, + ptid_t (pid, lwp)); expected_regcache_size++; SELF_CHECK (regcaches_size () == expected_regcache_size); - get_thread_arch_aspace_regcache_and_check - (&data->test_target2, ptid_t (pid, lwp)); + get_thread_arch_aspace_regcache_and_check (&data->test_target2, + ptid_t (pid, lwp)); expected_regcache_size++; SELF_CHECK (regcaches_size () == expected_regcache_size); } @@ -1694,11 +1672,12 @@ get_thread_arch_aspace_regcache_test () size_t regcaches_size_before = regcaches_size (); /* Test that getting an existing regcache doesn't create a new one. */ - get_thread_arch_aspace_regcache_and_check (&data->test_target1, ptid_t (2, 2)); + get_thread_arch_aspace_regcache_and_check (&data->test_target1, + ptid_t (2, 2)); SELF_CHECK (regcaches_size () == regcaches_size_before); } - /* Test marking all regcaches of all targets as changed. */ +/* Test marking all regcaches of all targets as changed. */ static void registers_changed_ptid_all_test () @@ -1758,9 +1737,11 @@ registers_changed_ptid_target_ptid_test () class target_ops_no_register : public test_target_ops { public: + target_ops_no_register () : test_target_ops {} - {} + { + } void reset () { @@ -1813,10 +1794,11 @@ target_ops_no_register::xfer_partial (enum target_object object, class readwrite_regcache : public regcache { public: - readwrite_regcache (process_stratum_target *target, - struct gdbarch *gdbarch) + + readwrite_regcache (process_stratum_target *target, struct gdbarch *gdbarch) : regcache (target, gdbarch, nullptr) - {} + { + } }; /* Return true if regcache::cooked_{read,write}_test should be skipped for @@ -1833,8 +1815,7 @@ selftest_skiparch (struct gdbarch *gdbarch) Stack backtrace will not work. We could instead capture the output and then filter out the warning, but that seems more trouble than it's worth. */ - return (strcmp (name, "m68hc11") == 0 - || strcmp (name, "m68hc12") == 0 + return (strcmp (name, "m68hc11") == 0 || strcmp (name, "m68hc12") == 0 || strcmp (name, "m68hc12:HCS12") == 0); } @@ -1854,8 +1835,7 @@ cooked_read_test (struct gdbarch *gdbarch) /* Find a raw register which size isn't zero. */ int nonzero_regnum; - for (nonzero_regnum = 0; - nonzero_regnum < gdbarch_num_regs (gdbarch); + for (nonzero_regnum = 0; nonzero_regnum < gdbarch_num_regs (gdbarch); nonzero_regnum++) { if (register_size (gdbarch, nonzero_regnum) != 0) @@ -1886,8 +1866,8 @@ cooked_read_test (struct gdbarch *gdbarch) gdb::def_vector<gdb_byte> inner_buf (register_size (gdbarch, regnum)); - SELF_CHECK (REG_VALID == readwrite.cooked_read (regnum, - inner_buf.data ())); + SELF_CHECK (REG_VALID + == readwrite.cooked_read (regnum, inner_buf.data ())); SELF_CHECK (mockctx.mock_target.fetch_registers_called == 0); SELF_CHECK (mockctx.mock_target.store_registers_called == 0); @@ -1908,22 +1888,22 @@ cooked_read_test (struct gdbarch *gdbarch) continue; gdb::def_vector<gdb_byte> inner_buf (register_size (gdbarch, regnum)); - enum register_status status = readonly.cooked_read (regnum, - inner_buf.data ()); + enum register_status status + = readonly.cooked_read (regnum, inner_buf.data ()); if (regnum < gdbarch_num_regs (gdbarch)) { auto bfd_arch = gdbarch_bfd_arch_info (gdbarch)->arch; - if (bfd_arch == bfd_arch_amdgcn - || bfd_arch == bfd_arch_frv || bfd_arch == bfd_arch_h8300 - || bfd_arch == bfd_arch_m32c || bfd_arch == bfd_arch_sh - || bfd_arch == bfd_arch_alpha || bfd_arch == bfd_arch_v850 - || bfd_arch == bfd_arch_msp430 || bfd_arch == bfd_arch_mep - || bfd_arch == bfd_arch_mips || bfd_arch == bfd_arch_v850_rh850 - || bfd_arch == bfd_arch_tic6x || bfd_arch == bfd_arch_mn10300 - || bfd_arch == bfd_arch_rl78 || bfd_arch == bfd_arch_score - || bfd_arch == bfd_arch_riscv || bfd_arch == bfd_arch_csky) + if (bfd_arch == bfd_arch_amdgcn || bfd_arch == bfd_arch_frv + || bfd_arch == bfd_arch_h8300 || bfd_arch == bfd_arch_m32c + || bfd_arch == bfd_arch_sh || bfd_arch == bfd_arch_alpha + || bfd_arch == bfd_arch_v850 || bfd_arch == bfd_arch_msp430 + || bfd_arch == bfd_arch_mep || bfd_arch == bfd_arch_mips + || bfd_arch == bfd_arch_v850_rh850 || bfd_arch == bfd_arch_tic6x + || bfd_arch == bfd_arch_mn10300 || bfd_arch == bfd_arch_rl78 + || bfd_arch == bfd_arch_score || bfd_arch == bfd_arch_riscv + || bfd_arch == bfd_arch_csky) { /* Raw registers. If raw registers are not in save_reggroup, their status are unknown. */ @@ -1946,13 +1926,10 @@ cooked_read_test (struct gdbarch *gdbarch) of them are unknown. */ auto bfd_arch = gdbarch_bfd_arch_info (gdbarch)->arch; - if (bfd_arch == bfd_arch_frv - || bfd_arch == bfd_arch_m32c - || bfd_arch == bfd_arch_mep - || bfd_arch == bfd_arch_sh) + if (bfd_arch == bfd_arch_frv || bfd_arch == bfd_arch_m32c + || bfd_arch == bfd_arch_mep || bfd_arch == bfd_arch_sh) SELF_CHECK (status == REG_VALID || status == REG_UNKNOWN); - else if (bfd_arch == bfd_arch_mips - || bfd_arch == bfd_arch_h8300) + else if (bfd_arch == bfd_arch_mips || bfd_arch == bfd_arch_h8300) SELF_CHECK (status == REG_UNKNOWN); else SELF_CHECK (status == REG_VALID); @@ -2016,8 +1993,7 @@ cooked_write_test (struct gdbarch *gdbarch) { if (bfd_arch == bfd_arch_ia64 || (regnum >= gdbarch_num_regs (gdbarch) - && (bfd_arch == bfd_arch_xtensa - || bfd_arch == bfd_arch_bfin + && (bfd_arch == bfd_arch_xtensa || bfd_arch == bfd_arch_bfin || bfd_arch == bfd_arch_m32c /* m68hc11 pseudo registers are in memory. */ || bfd_arch == bfd_arch_m68hc11 @@ -2122,6 +2098,7 @@ regcache_thread_ptid_changed () #endif /* GDB_SELF_TEST */ void _initialize_regcache (); + void _initialize_regcache () { @@ -2134,7 +2111,7 @@ _initialize_regcache () cmd_list_element *maintenance_flush_register_cache_cmd = add_cmd ("register-cache", class_maintenance, reg_flush_command, - _("Force gdb to flush its register and frame cache."), + _ ("Force gdb to flush its register and frame cache."), &maintenanceflushlist); c = add_com_alias ("flushregs", maintenance_flush_register_cache_cmd, class_maintenance, 0); @@ -2149,8 +2126,9 @@ _initialize_regcache () selftests::registers_changed_ptid_target_test); selftests::register_test ("registers_changed_ptid_target_pid", selftests::registers_changed_ptid_target_pid_test); - selftests::register_test ("registers_changed_ptid_target_ptid", - selftests::registers_changed_ptid_target_ptid_test); + selftests::register_test ( + "registers_changed_ptid_target_ptid", + selftests::registers_changed_ptid_target_ptid_test); selftests::register_test_foreach_arch ("regcache::cooked_read_test", selftests::cooked_read_test); |