gdb/riscv: Improve non-dwarf stack unwinding
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 12 Sep 2018 16:35:08 +0000 (17:35 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 26 Sep 2018 13:08:39 +0000 (14:08 +0100)
commitd354055e6ee0b2640006e1b9f900eb0e91a6883c
tree689a68e4b6c574de123a40b6a6cab16d0e620c1a
parent853924149dfc2a3b67fda0a491dc5716d7322a74
gdb/riscv: Improve non-dwarf stack unwinding

This commit improves the prologue scanning stack unwinder, to better
support AUIPC, LUI, and more variants of ADD and ADDI.

This allows unwinding over frames containing large local variables,
where the frame size does not fit into a single instruction immediate,
and is first loaded into a temporary register, before being added to
the stack pointer.

A new test is added that tests this behaviour.  As there's nothing
truely RiscV specific about this test I've added it into gdb.base, but
as this depends on target specific code to perform the unwind it is
possible that some targets might fail this new test.

gdb/ChangeLog:

* riscv-tdep.c (riscv_insn::decode): Decode c.lui.
(riscv_scan_prologue): Split handling of AUIPC, LUI, ADD, ADDI,
and NOP.

gdb/testsuite/ChangeLog:

* gdb.base/large-frame-1.c: New file.
* gdb.base/large-frame-2.c: New file.
* gdb.base/large-frame.exp: New file.
* gdb.base/large-frame.h: New file.
gdb/ChangeLog
gdb/riscv-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/large-frame-1.c [new file with mode: 0644]
gdb/testsuite/gdb.base/large-frame-2.c [new file with mode: 0644]
gdb/testsuite/gdb.base/large-frame.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/large-frame.h [new file with mode: 0644]