gdb/riscv: Allow breakpoints to be created at invalid addresses
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 16 Apr 2019 23:31:43 +0000 (00:31 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 16 Apr 2019 23:45:22 +0000 (00:45 +0100)
commitc01660c625766e848195285cc20581b9ed7ecfe2
tree22a3976de654cbb8e5e4e5d729ea7bde0dc95206
parentfe7e91e7764d8db4a45c9d7b3dd55cb635f44f5e
gdb/riscv: Allow breakpoints to be created at invalid addresses

Some testsuite cases (gdb.cp/nsalias.exp for example) construct dwarf2
debug info for fake functions to test that this debug info is handled
correctly.

We currently get an error trying to read from an invalid address while
creating breakpoints for these fake functions.

Other targets allow creating breakpoints on invalid addresses, and
only error when GDB actually tries to insert the breakpoints.

In order to make RISC-V behave in the same way as other targets, this
commit makes the failure to read memory during breakpoint creation
non-fatal, we then expect to see a failure when GDB tries to insert
the breakpoint, just like other targets.

Tested with a riscv64-linux native testsuite run.

gdb/ChangeLog:

* riscv-tdep.c (riscv_breakpoint_kind_from_pc): Hanndle case where
code read might fail, assume 4-byte breakpoint in that case.
gdb/ChangeLog
gdb/riscv-tdep.c