Refactor gdb.reverse/insn-reverse.c
authorLuis Machado <lgustavo@codesourcery.com>
Thu, 26 Jan 2017 16:34:42 +0000 (10:34 -0600)
committerLuis Machado <lgustavo@codesourcery.com>
Thu, 26 Jan 2017 16:34:42 +0000 (10:34 -0600)
commit8b00c176168dc7b0d78d0dc1f7d42f915375dc4a
tree11aa1b6e0ecdd276a75281f5a347df570ed9c5d9
parent874a1c8c32036f790fa527acfab3f6f18740f089
Refactor gdb.reverse/insn-reverse.c

Changes in v2:

- Renamed arch-specific files to insn-reverse-<arch>.c.
- Adjusted according to reviews.

This patch prepares things for an upcoming testcase for record/replay support
on x86. As is, gdb.reverse/insn-reverse.c is divided into sections guarded by
a few #if blocks, and right now it only handles arm/aarch64.

If we move forward with requiring more tests for record/replay on different
architectures, i think this has the potential to become cluttered with a lot
of differing arch-specific code in the same file.

I've broken up the main file into other files with arch-specific bits
(insn-reverse-<arch>.c). The main file will hold the generic pieces that will
take care of calling the tests.

The arch-specific c files are then included at the top of the generic c file.

I've also added a generic initialize function since we need to run pre-test
checks on x86 to make sure the rdrand/rdseed instructions are supported,
otherwise we will run into a SIGILL.

The arch-specific files will implement their own initialize function with
whatever makes sense. Right now the aarch64 and arm files have an empty
initialization function.

Does this look reasonable?

gdb/testsuite/ChangeLog:

2017-01-26  Luis Machado  <lgustavo@codesourcery.com>

* gdb.reverse/insn-reverse.c: Move arm and aarch64 code to their own
files.
(initialize): New function conditionally defined.
(testcases): Move within conditional block.
(main): Call initialize.
* gdb.reverse/insn-reverse-aarch64.c: New file, based on aarch64 bits
of gdb.reverse/insn-reverse.c.
* gdb.reverse/insn-reverse-arm.c: New file, based on arm bits of
gdb.reverse/insn-reverse.c.
gdb/testsuite/gdb.reverse/insn-reverse.c
This page took 0.034684 seconds and 4 git commands to generate.