target/armv7m: fix register number in armv7m_get_core_reg() 03/5203/2
authorTomas Vanek <vanekt@fbl.cz>
Tue, 4 Jun 2019 23:09:15 +0000 (01:09 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Mon, 10 Jun 2019 19:35:39 +0000 (20:35 +0100)
commit215f14bec87293f549639e6342b6e671faa1e7d1
tree782cb6b16b9d94241535c0748ffe18dcac4dcf1c
parent159f11fefc194743a0af6e29e134b184bf26650d
target/armv7m: fix register number in armv7m_get_core_reg()

armv7m_get_core_reg() calls arm->read_core_reg()
arm->read_core_reg() expects the register number as an index
to core reglist, not an ARMv7M specific register code.
Use reg->number instead of armv7m_reg->num.

The change solves assert
  src/target/armv7m.c:222: armv7m_read_core_reg: Assertion
  `num < (int)armv7m->arm.core_cache->num_regs' failed.
when gdb 'info reg' is issued on a Cortex-M target and
no cortex_m_debug_entry() has been called since OpenOCD start
(target was halted before OpenOCD start).

Change-Id: I32a2294693ef979b613be93aeceb3b0eb06ee6df
Ticket: https://sourceforge.net/p/openocd/tickets/216/
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5203
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/armv7m.c