This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Add unit test to aarch64 prologue analyzer


*** TEST RESULTS FOR COMMIT 4d9a9006139d1ceea787cdda871dff8943e493f0 ***

Author: Yao Qi <yao.qi@linaro.org>
Branch: master
Commit: 4d9a9006139d1ceea787cdda871dff8943e493f0

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]