GDB Server cannot read some registers in Monitor mode

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • GDB Server cannot read some registers in Monitor mode

    Hi,

    I use SEGGER J-Link EDU with official gdb server v4.98c in Arch Linux.
    The command is :
    sudo /opt/SEGGER/JLink/JLinkGDBServer -device cortex-a7 -endian little -speed auto

    I tried to debug a TWR-LS1021A board, which has 2 Cortex-A7 board.

    In the secure PL1 mode, I can read all registers correctly.
    However, after the board switched to Non-secure monitor mode, I cannot read sp and lr registers.
    For example, I executed following instructions:
    ldr r0, =0x1000
    mov sp, r0
    mov r1, sp
    then, I read these regisnter value. r0 and r1 values are 0x1000, but sp value is 0x0.
    In addition, GDB Server says "WARNING: Register with index 74 could not be read. Reason: CPSR indicates a non-valid CPU mode.
    "
    But the cpsr[4:0] value showed the monitor mode correctly.

    How can I read the correct sp value?