binutils-gdb/gdb/testsuite/gdb.arch/powerpc-addpcis.s
Will Schmidt e3d528d7e6 [PATCH, rs6000, v3][PR gdb/27525] displaced stepping across addpcis/lnia.
This addresses PR gdb/27525.     The lnia and other variations
of the addpcis instruction write the value of the NIA into a target register.
If we are single-stepping across a breakpoint, the instruction is executed
from a displaced location, and thusly the written value of the PC/NIA
will be incorrect.   The changes here will measure the displacement
offset, and adjust the target register value to compensate.

YYYY-MM-DD  Will Schmidt  <will_schmidt@vnet.ibm.com>

gdb/ChangeLog:

        * rs6000-tdep.c (ppc_displaced_step_fixup): Update to handle
        the addpcis/lnia instruction.

gdb/testsuite/ChangeLog:

        * gdb.arch/powerpc-addpcis.exp: Testcase harness to
        exercise single-stepping over subpcis,lnia,addpcis instructions
        with displacement.
        * gdb.arch/powerpc-addpcis.s: Testcase with stream
        of addpcis/lnia/subpcis instructions.
        * gdb.arch/powerpc-lnia.exp: Testcase harness to exercise
        single-stepping over lnia instructions with displacement.
        * gdb.arch/powerpc-lnia.s: Testcase with stream of
        lnia instructions.
2021-04-12 13:35:54 -05:00

36 lines
1.2 KiB
ArmAsm

/* This testcase is part of GDB, the GNU debugger.
Copyright 2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Test to confirm that gdb is properly single stepping over the
displaced addpcis instruction. */
.global main
.type main,function
# addpcis: the sum of NIA + ( D || 0x0000) is placed in RT.
main:
subpcis 3,+0x100 # /* set r3 */
subpcis 4,+0x10 # /* set r4 */
subpcis 5,+0x1 # /* set r5 */
lnia 6 # /* set r6 */
addpcis 7,+0x1 # /* set r7 */
addpcis 8,+0x10 # /* set r8 */
addpcis 9,+0x100 # /* set r9 */
blr