This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/riscv: Write 4-byte nop to dummy code region before inferior calls
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Jim Wilson <jimw at sifive dot com>, Palmer Dabbelt <palmer at sifive dot com>, John Baldwin <jhb at freebsd dot org>
- Date: Fri, 19 Jul 2019 21:02:31 +0100
- Subject: Re: [PATCH] gdb/riscv: Write 4-byte nop to dummy code region before inferior calls
- References: <20190719105707.26806-1-andrew.burgess@embecosm.com> <33a56513-1fb5-dfed-92ca-6867af3cb244@redhat.com>
* Pedro Alves <palves@redhat.com> [2019-07-19 16:22:34 +0100]:
> 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 for the feedback. I've pushed this patch with the corrections
you identified.
thanks,
Andrew