This is the mail archive of the gdb-patches@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]

Re: [PATCH v2 2/4] Use the existing instruction to determine the RISC-V breakpoint kind.


On 2018-09-24 04:51 PM, John Baldwin wrote:
> @@ -417,7 +411,21 @@ riscv_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
>  {
>    if (use_compressed_breakpoints == AUTO_BOOLEAN_AUTO)
>      {
> -      if (riscv_has_feature (gdbarch, 'C'))
> +      gdb_byte buf[1];
> +      int status;
> +
> +      /* Read the opcode byte to determine the instruction length.  */
> +      status = target_read_code (*pcptr, buf, 1);
> +      if (status)
> +	memory_error (TARGET_XFER_E_IO, *pcptr);

Here you could use read_code if you want, which takes care of throwing an exception
on failure.

Based on the discussion you guys had about v1, this looks good to me, but the RISC-V
experts should take a look.

Simon

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