]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
arc: Determine a branch target of DBNZ correctly
authorYuriy Kolerov <kolerov93@gmail.com>
Wed, 14 Feb 2024 18:16:16 +0000 (18:16 +0000)
committerShahab Vahedi <shahab@synopsys.com>
Wed, 21 Feb 2024 13:15:09 +0000 (14:15 +0100)
commit33283d91d94e205ba34306cd1c253b9faceb4dd9
treee1b95cde3748e56e0c51fa28e4f349efde2fd360
parentf96127310144d360eac93444c1b6efe80497d163
arc: Determine a branch target of DBNZ correctly

DBNZ instruction was moved from BRANCH class to a separate one - DBNZ.
Thus, it must be processed separately in arc_insn_get_branch_target
to correctly determine an offset for a possible branch.

The testsuite for DBNZ instruction verifies these cases:

     1. Check that dbnz does not branch and falls through if its source
        register is 0 after decrementing. GDB must successfully break
        on the following instruction after stepping over.
     2. Check that dbnz branches to the target correctly if its source register
        is not 0 after decrementing - GDB must successfully break on the target
        instruction if a forward branch is performed after stepping over.
     3. The same as point 2 but for a backward branching case.

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
gdb/arc-tdep.c
gdb/testsuite/gdb.arch/arc-dbnz.S [new file with mode: 0644]
gdb/testsuite/gdb.arch/arc-dbnz.exp [new file with mode: 0644]