[PATCH] gdb/riscv: Write 4-byte nop to dummy code region before inferior calls

Pedro Alves palves@redhat.com
Fri Jul 19 15:22:00 GMT 2019


Hi Andrew,

Just pointing out a few minor typos that jumped out at me when
I skimmed this.

On 7/19/19 11:57 AM, Andrew Burgess wrote:
> When making inferior function calls GDB sets up a dummy code region on
> the stack, and places a breakpoint within that region.  If the random
> stack contents appear to be a compressed instruction then GDB  will
> place a compressed instruction, which can cause problems if the target

"place a compressed breakpoint" I gather.

> doesn't support compressed instructions.

> index 7f3a1f6cbc3..817e76a423d 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -1621,11 +1621,44 @@ riscv_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
>  		       struct type *value_type, CORE_ADDR *real_pc,
>  		       CORE_ADDR *bp_addr, struct regcache *regcache)
>  {
> +  /* A nop instruction is 'add x0, x0, 0'.  */
> +  static gdb_byte nop_insn[] = { 0x13, 0x00, 0x00, 0x00 };

static const

> +# Figure out where the breakpoint will be placed taking account for
> +# stack alignment, and alloction of the dummy code area.

Typo: "alloction".

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list