armgdbembeddedcortex-marmv7

How to check the Cortex-M4 VTOR register with gdb command?


(I am learning about ARM debugging so this may be a dumb question.)

I checked the ARMv7-M Arch Ref Manual. It says the reset vector offset is stored in the VTOR (Vector Table Offset Register).

I am using a gdb specific to the Cortex-M. So I expected the gdb command info registers should show the VTOR register. But it only shows some general registers.

So is there a way to check VTOR with gdb command?

Thanks!

ADD 1 - 7:43 AM 3/2/2022

The VTOR is memory mapped to 0xe000ed08 according to the ARMv7 ARM. But when I try to access it with gdb command, it shows below error:

>>> x /4xb 0xe000ed08
0xe000ed08:     Cannot access memory at address 0xe000ed08

And according to this thread, I checked the memory region known to the gdb client:

>>> info mem
Using memory regions provided by the target.
Num Enb Low Addr   High Addr  Attrs
0   y   0x00000000 0x00100000 flash blocksize 0x1000 nocache
1   y   0x10001000 0x10001400 flash blocksize 0x400 nocache
2   y   0x20000000 0x20040000 rw nocache

It seems the VOTR offset 0xe000ed08 is not within these regions.

Now I am looking into how to workaround this.

Not sure which decides it:

ADD 2 - 4:46 PM 5/3/2022

A similar issue with Cannot access memory at address xxxx error. It may be related to optimization. But no definite answer yet.

https://github.com/adamgreen/gcc4mbed/issues/35


Solution

  • Add the missing region using the gdb mem command.

    mem 0xE0000000 0xE00FFFFF
    

    Then you will be able to access the VTOR at 0xe000ed08.

    For a more permanent solution add the region to the target memory map configuration (https://sourceware.org/gdb/onlinedocs/gdb/Memory-Map-Format.html)