diff options
author | Jim Wilson <jimw@sifive.com> | 2018-08-08 10:53:12 -0700 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2018-08-08 10:53:12 -0700 |
commit | 5c720ed8861b461193a507e61e3665b1cc840055 (patch) | |
tree | ffc91abb31f2c9026038adda51649223a4345f4e /gdb/riscv-tdep.h | |
parent | 411baa470ef354e50b488c0c736ac7af8d856ded (diff) | |
download | gdb-5c720ed8861b461193a507e61e3665b1cc840055.zip gdb-5c720ed8861b461193a507e61e3665b1cc840055.tar.gz gdb-5c720ed8861b461193a507e61e3665b1cc840055.tar.bz2 |
RISC-V: Add software single step support.
This adds software single step support that is needed by the linux native port.
This is modeled after equivalent code in the MIPS port.
This also fixes a few bugs in the compressed instruction decode support. Some
instructions are RV32/RV64 specific, and this wasn't being checked. Also, a
few instructions were accidentally using the non-compressed is_* function.
This has been tested on a HiFive Unleashed running Fedora, by putting a
breakpoint on start, typing stepi, and then holding down the return key until
it finishes, and observing that I see everything I expect to see along the way.
There is a problem in _dl_addr where I get into an infinite loop, but it seems
to be some synchronization code that doesn't agree with single step, so I have
to find the end of the loop, put a breakpoint there, continue, and then single
step again until the end.
gdb/
* riscv-tdep.c (enum opcode): Add jump, branch, lr, and sc opcodes.
(decode_register_index_short): New.
(decode_j_type_insn, decode_cj_type_insn): New.
(decode_b_type_insn, decode_cb_type_insn): New.
(riscv_insn::decode): Add support for jumps, branches, lr, and sc. New
local xlen. Check xlen when decoding ambiguous compressed insns. In
compressed decode, use is_c_lui_insn instead of is_lui_insn, and
is_c_sw_insn instead of is_sw_insn.
(riscv_next_pc, riscv_next_pc_atomic_sequence): New.
(riscv_software_single_step): New.
* riscv-tdep.h (riscv_software_single_step): Declare.
Diffstat (limited to 'gdb/riscv-tdep.h')
-rw-r--r-- | gdb/riscv-tdep.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/riscv-tdep.h b/gdb/riscv-tdep.h index b35266d..8591116 100644 --- a/gdb/riscv-tdep.h +++ b/gdb/riscv-tdep.h @@ -79,4 +79,8 @@ struct gdbarch_tdep /* Return the width in bytes of the general purpose registers for GDBARCH. */ extern int riscv_isa_xlen (struct gdbarch *gdbarch); +/* Single step based on where the current instruction will take us. */ +extern std::vector<CORE_ADDR> +riscv_software_single_step (struct regcache *regcache); + #endif /* RISCV_TDEP_H */ |