diff options
author | Yao Qi <yao.qi@linaro.org> | 2016-12-02 09:37:30 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2016-12-02 09:37:30 +0000 |
commit | 4d9a9006139d1ceea787cdda871dff8943e493f0 (patch) | |
tree | e52116c2358af3d557f2939ddac9cfdb7c6ac913 /gdb/trad-frame.h | |
parent | 018572b88885ae67d22612937fa1e4fd98d5f5ad (diff) | |
download | gdb-4d9a9006139d1ceea787cdda871dff8943e493f0.zip gdb-4d9a9006139d1ceea787cdda871dff8943e493f0.tar.gz gdb-4d9a9006139d1ceea787cdda871dff8943e493f0.tar.bz2 |
Add unit test to aarch64 prologue analyzer
We don't have an effective way to test prologue analyzer which is
highly dependent on instruction patterns in prologue generated by
compiler. GDB prologue analyzer may not handle the new sequences
generated by new compiler, or may still handle some sequences that
generated by very old compilers which are no longer used. The
former is a functionality issue, while the latter is a maintenance
issue.
The input and output of prologue analyzer is quite clear, so it
fits for unit test. The input is series of instructions, and the
output are 1) where prologue end, 2) where registers are saved.
In aarch64, they are represented in 'struct aarch64_prologue_cache'.
This patch refactors aarch64_analyze_prologue so it can read
instructions from either real target or test harness. In unit
test aarch64_analyze_prologue_test, aarch64_analyze_prologue gets
instructions we prepared in the test, as the input of prologue
analyzer. Then, we checked various fields in
'struct aarch64_prologue_cache'.
gdb:
2016-12-02 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* aarch64-tdep.c: Include "selftest.h".
(abstract_instruction_reader): New class.
(instruction_reader): New class.
(aarch64_analyze_prologue): Add new parameter reader. Call
reader.read instead of read_memory_unsigned_integer.
[GDB_SELF_TEST] (instruction_reader_test): New class.
(aarch64_analyze_prologue_test): New function.
(_initialize_aarch64_tdep) [GDB_SELF_TEST]: Register
selftests::aarch64_analyze_prologue_test.
* trad-frame.c (trad_frame_cache_zalloc):
(trad_frame_alloc_saved_regs): Add a new function.
* trad-frame.h (trad_frame_alloc_saved_regs): Declare.
Diffstat (limited to 'gdb/trad-frame.h')
-rw-r--r-- | gdb/trad-frame.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h index b8aed16..d1c24b0 100644 --- a/gdb/trad-frame.h +++ b/gdb/trad-frame.h @@ -104,6 +104,7 @@ int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[], /* Return a freshly allocated (and initialized) trad_frame array. */ struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *); +struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct gdbarch *); /* Given the trad_frame info, return the location of the specified register. */ |