gdb/riscv: Write 4-byte nop to dummy code region before inferior calls
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 19 Jul 2019 09:34:47 +0000 (10:34 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 19 Jul 2019 20:00:22 +0000 (21:00 +0100)
commit01e175fe1b21950982642713513e442fc09614e6
tree54950bd2fdf5fd046b12759f160160702cb22048
parentec38ac465d632cbc7fbecffcaadb7c6ffc4b5f39
gdb/riscv: Write 4-byte nop to dummy code region before inferior calls

When making inferior function calls GDB sets up a dummy code region on
the stack, and places a breakpoint within that region.  If the random
stack contents appear to be a compressed instruction then GDB  will
place a compressed breakpoint, which can cause problems if the target
doesn't support compressed instructions.

This commit prevents this issue by writing a 4-byte nop instruction to
the dummy region at the time the region is allocated.  With this nop
instruction in place, when we come to insert the breakpoint then an
uncompressed breakpoint will be used.

This is similar to other targets, for example mips.

gdb/ChangeLog:

* riscv-tdep.c (riscv_push_dummy_code): Write a 4-byte nop
instruction to the dummy code region.

gdb/testsuite/ChangeLog:

* gdb.arch/riscv-bp-infcall.c: New file.
* gdb.arch/riscv-bp-infcall.exp: New file.
gdb/ChangeLog
gdb/riscv-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/riscv-bp-infcall.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/riscv-bp-infcall.exp [new file with mode: 0644]
This page took 0.024979 seconds and 4 git commands to generate.