Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit 64d6efe

Browse files
Implement breakpoint_kind_from_pc, sw_breakpoint_from_kind
This should fix #34
1 parent 95f3fbf commit 64d6efe

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

gdb/riscv-tdep.c

+19
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,23 @@ riscv_breakpoint_from_pc (struct gdbarch *gdbarch,
172172
return sbreak_insn;
173173
}
174174

175+
static int
176+
riscv_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
177+
{
178+
/* TODO: Support C.EBREAK for compressed (16-bit) insns. */
179+
/* TODO: Support NOPs for >=6 byte insns. */
180+
return 4;
181+
}
182+
183+
static const gdb_byte *
184+
riscv_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
185+
{
186+
/* TODO: Support C.EBREAK for compressed (16-bit) insns. */
187+
/* TODO: Support NOPs for >=6 byte insns. */
188+
gdb_assert(kind == 4);
189+
return riscv_breakpoint_from_pc(gdbarch, NULL, size);
190+
}
191+
175192
static struct value *
176193
value_of_riscv_user_reg (struct frame_info *frame, const void *baton)
177194
{
@@ -1216,6 +1233,8 @@ riscv_gdbarch_init (struct gdbarch_info info,
12161233
/* Information about the target architecture. */
12171234
set_gdbarch_return_value (gdbarch, riscv_return_value);
12181235
set_gdbarch_breakpoint_from_pc (gdbarch, riscv_breakpoint_from_pc);
1236+
set_gdbarch_breakpoint_kind_from_pc (gdbarch, riscv_breakpoint_kind_from_pc);
1237+
set_gdbarch_sw_breakpoint_from_kind (gdbarch, riscv_sw_breakpoint_from_kind);
12191238
set_gdbarch_print_insn (gdbarch, print_insn_riscv);
12201239

12211240
/* Register architecture. */

0 commit comments

Comments
 (0)