[PATCH 0/9] Unit test to gdbarch methods register_to_value and value_to_register

Yao Qi qiyaoltc@gmail.com
Thu Apr 13 07:26:00 GMT 2017


Alan recently has some patches removing/replacing MAX_REGISTER_SIZE, and
they touch some target dependent code that we can't test, which makes
me a little nervous.  So patch #9 adds
a unit test to gdbarch methods register_to_value and value_to_register.
Patches 1-8 are to fix problems found by this unit test.  So far, the
test to register_to_value doesn't check value contents got from register,
but the functions we are going to change in Alan's patches are covered
by this test at least.  I'll further improve this test to check value
contents by sub-class regcache which returns some unique contents.

Patch #2 and #3 are quite obvious.  Patch #5 - #8 are to restrict the
$ARCH_convert_register_p for some cases only exists in the unit test.

I recommend to review/read patch #9 first, and it helps to understand
what do the rest do.

I build GDB with all targets enabled, run unittest.exp on x86_64-linux,
and collect coverage data,
http://people.linaro.org/~yao.qi/gdb/coverage/unittest/gdb/ functions
$ARCH_register_to_value and $ARCH_value_to_register are covered.  Click
files ia64-tdep.c, alpha-tdep.c, and mips-tdep.c, search
"convert_register".

*** BLURB HERE ***

Yao Qi (9):
  Clear GDB internal state after each unit test
  XCNEW gdbarch_tdep in rl78 and rx
  Fix a typo in rx_fpsw_type
  Use XCNEW gdbarch_tdep
  Restrict m68k_convert_register_p
  Restrict ia64_convert_register_p
  Restrict alpha_convert_register_p
  Restrict i387_convert_register_p
  Add unit test to gdbarch methods register_to_value and
    value_to_register

 gdb/Makefile.in         |   2 +
 gdb/alpha-tdep.c        |  27 ++++-------
 gdb/avr-tdep.c          |   2 +-
 gdb/bfin-tdep.c         |   2 +-
 gdb/cris-tdep.c         |   2 +-
 gdb/findvar.c           |   1 -
 gdb/frame.c             |  16 +++++++
 gdb/frame.h             |   4 ++
 gdb/ft32-tdep.c         |   2 +-
 gdb/gdbarch-selftests.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/i387-tdep.c         |   5 +-
 gdb/ia64-tdep.c         |   1 +
 gdb/lm32-tdep.c         |   2 +-
 gdb/m32r-tdep.c         |   2 +-
 gdb/m68hc11-tdep.c      |   2 +-
 gdb/m68k-tdep.c         |  13 +----
 gdb/mep-tdep.c          |   2 +-
 gdb/microblaze-tdep.c   |   2 +-
 gdb/mips-tdep.c         |   2 +-
 gdb/mn10300-tdep.c      |   2 +-
 gdb/moxie-tdep.c        |   2 +-
 gdb/msp430-tdep.c       |   2 +-
 gdb/rl78-tdep.c         |   2 +-
 gdb/rx-tdep.c           |   4 +-
 gdb/selftest-arch.c     |   4 ++
 gdb/selftest.c          |   4 ++
 gdb/sh64-tdep.c         |   2 +-
 gdb/v850-tdep.c         |   2 +-
 28 files changed, 185 insertions(+), 51 deletions(-)
 create mode 100644 gdb/gdbarch-selftests.c

-- 
1.9.1



More information about the Gdb-patches mailing list