This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] RISC-V: Allow setting breakpoints at invalid addresses.
On Sat, Apr 13, 2019 at 4:16 PM Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
> I think that you can just use something like:
>
> /* Read the opcode byte to determine the instruction length. If
> the read fails this may be because we tried to set the
> breakpoint at an invalid address. We provide a fake result
> which will give a breakpoint length of 4, hopefully when we
> try to actually insert the breakpoint we will see a failure
> then too. */
> if (target_read_code (*pcptr, buf, 1) == -1)
> buf[0] = 0;
>
> and avoid the try/catch.
Yes, thanks, this looks a little simpler than what I suggested. I
confirmed that this works with a riscv64-linux gdb build and make
check.
Jim