From 6c5218dfdb7b38cc1617be7753cc1ec6d0612382 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 2 Nov 2017 15:05:12 +0000 Subject: [PATCH] Remove regcache_descr fields sizeof_raw_register_status and sizeof_cooked_register_status struct regcache_descr has two fields sizeof_raw_register_status and sizeof_cooked_register_status, but they equal to nr_cooked_registers and nr_raw_registers respectively, so this patch removes them. gdb: 2017-11-02 Yao Qi * regcache.c (struct regcache_descr) : Remove. : Remove. (init_regcache_descr): Update. (regcache::regcache): Use nr_cooked_registers and nr_raw_registers. (regcache::save): Likewise. (regcache::dump): Likewise. --- gdb/ChangeLog | 10 ++++++++++ gdb/regcache.c | 13 ++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f3100f48cdd..5f9bf3bb320 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2017-11-02 Yao Qi + + * regcache.c (struct regcache_descr) : + Remove. + : Remove. + (init_regcache_descr): Update. + (regcache::regcache): Use nr_cooked_registers and nr_raw_registers. + (regcache::save): Likewise. + (regcache::dump): Likewise. + 2017-11-01 James Bowman * ft32-tdep.c (ft32_fetch_instruction): New function. diff --git a/gdb/regcache.c b/gdb/regcache.c index 1ba49ad5955..5a1152e9b8a 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -53,7 +53,6 @@ struct regcache_descr cache. */ int nr_raw_registers; long sizeof_raw_registers; - long sizeof_raw_register_status; /* The cooked register space. Each cooked register in the range [0..NR_RAW_REGISTERS) is direct-mapped onto the corresponding raw @@ -63,7 +62,6 @@ struct regcache_descr gdbarch_pseudo_register_read and gdbarch_pseudo_register_write. */ int nr_cooked_registers; long sizeof_cooked_registers; - long sizeof_cooked_register_status; /* Offset and size (in 8 bit bytes), of each register in the register cache. All registers (including those in the range @@ -92,8 +90,6 @@ init_regcache_descr (struct gdbarch *gdbarch) either mapped onto raw-registers or memory. */ descr->nr_cooked_registers = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); - descr->sizeof_cooked_register_status - = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); /* Fill in a table of register types. */ descr->register_type @@ -105,7 +101,6 @@ init_regcache_descr (struct gdbarch *gdbarch) /* Construct a strictly RAW register cache. Don't allow pseudo's into the register cache. */ descr->nr_raw_registers = gdbarch_num_regs (gdbarch); - descr->sizeof_raw_register_status = gdbarch_num_regs (gdbarch); /* Lay out the register cache. @@ -199,13 +194,13 @@ regcache::regcache (gdbarch *gdbarch, address_space *aspace_, { m_registers = XCNEWVEC (gdb_byte, m_descr->sizeof_cooked_registers); m_register_status = XCNEWVEC (signed char, - m_descr->sizeof_cooked_register_status); + m_descr->nr_cooked_registers); } else { m_registers = XCNEWVEC (gdb_byte, m_descr->sizeof_raw_registers); m_register_status = XCNEWVEC (signed char, - m_descr->sizeof_raw_register_status); + m_descr->nr_raw_registers); } m_ptid = minus_one_ptid; } @@ -306,7 +301,7 @@ regcache::save (regcache_cooked_read_ftype *cooked_read, gdb_assert (m_readonly_p); /* Clear the dest. */ memset (m_registers, 0, m_descr->sizeof_cooked_registers); - memset (m_register_status, 0, m_descr->sizeof_cooked_register_status); + memset (m_register_status, 0, m_descr->nr_cooked_registers); /* Copy over any registers (identified by their membership in the save_reggroup) and mark them as valid. The full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) range is checked since some architectures need @@ -1343,7 +1338,7 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump) fprintf_unfiltered (file, "sizeof_raw_registers %ld\n", m_descr->sizeof_raw_registers); fprintf_unfiltered (file, "sizeof_raw_register_status %ld\n", - m_descr->sizeof_raw_register_status); + m_descr->nr_raw_registers); fprintf_unfiltered (file, "gdbarch_num_regs %d\n", gdbarch_num_regs (gdbarch)); fprintf_unfiltered (file, "gdbarch_num_pseudo_regs %d\n", -- 2.30.2