Re: [PATCH 4/7] Implements aarch64 process record and reverse debugging support

Yao Qi
2014-08-30T03:27:24Z

Omair Javaid <omair.javaid@linaro.org> writes:

> This patch defines structures, macros and functions required for process record
> and reverse debugging support on aarch64-linux targets. Also implements
> support for recording most if not all of instructions from a64 instruction set.
>
> gdb:
>
> 2014-06-04 Omair Javaid <omair.javaid@linaro.org>
>
> * aarch64-linux-tdep.c (aarch64_linux_init_abi): Updated.
> * aarch64-tdep.c (record.h): Include.
> (record-full.h): Include.
> (aarch64_record_data_proc_reg): New function.
> (aarch64_record_data_proc_imm): New function.
> (aarch64_record_branch_except_sys): New function.
> (aarch64_record_load_store): New function.
> (aarch64_record_decode_insn_handler): New function.
> (deallocate_reg_mem): New function.
> (aarch64_process_record): New function.
> * aarch64-tdep.h (submask): New macro.
> (bit): New macro.
> (bits): New macro.
> (REG_ALLOC): New macro.
> (MEM_ALLOC): New macro.
> (struct aarch64_mem_r): Defined.
> (aarch64_record_result): New enum.
> (struct insn_decode_record): Defined.
> (insn_decode_record): New typedef.
> (aarch64_process_record): New extern declaration.

We want to support process record on aarch64-linux, but the code is
added to aarch64-tdep.c. Does aarch64-elf target need process record?
I prefer to add code to aarch64-linux-tdep.c. I know that code for
process record on arm was added to arm-tdep.c too, but I don't think it
is correct either.

> diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
> index 78fb779..8a193f4 100644
> --- a/gdb/aarch64-tdep.h
> +++ b/gdb/aarch64-tdep.h
> @@ -90,4 +90,69 @@ struct gdbarch_tdep
> struct type *vnb_type;
> };
>
> +/* aarch64 process record-replay related structures, defines etc. */
> +
> +#define submask(x) ((1L << ((x) + 1)) - 1)
> +#define bit(obj,st) (((obj) >> (st)) & 1)
> +#define bits(obj,st,fn) (((obj) >> (st)) & submask ((fn) - (st)))

If they are only used in aarch64-tdep.c, please define them there.

> +
> +/* ARM memory record structure. */

s/ARM/AArch64/

> +struct aarch64_mem_r
> +{
> + uint64_t len; /* Record length. */
> + uint64_t addr; /* Memory address. */
> +};
> +
> +enum aarch64_record_result
> +{
> + AARCH64_RECORD_SUCCESS,
> + AARCH64_RECORD_FAILURE,
> + AARCH64_RECORD_USUPPORTED
> +};
> +
> +/* ARM instruction record contains opcode of current insn

Likewise.

--
Yao (齐尧)