简体   繁体   English

如何使用 gdb 命令查看 Cortex-M4 VTOR 寄存器?

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

(I am learning about ARM debugging so this may be a dumb question.) (我正在学习 ARM 调试,所以这可能是一个愚蠢的问题。)

I checked the ARMv7-M Arch Ref Manual.我检查了 ARMv7-M Arch 参考手册。 It says the reset vector offset is stored in the VTOR (Vector Table Offset Register).它说复位向量偏移存储在 VTOR(向量表偏移寄存器)中。

I am using a gdb specific to the Cortex-M.我正在使用特定于 Cortex-M 的 gdb。 So I expected the gdb command info registers should show the VTOR register.所以我希望 gdb 命令info registers应该显示VTOR寄存器。 But it only shows some general registers.但它只显示一些通用寄存器。

So is there a way to check VTOR with gdb command?那么有没有办法用 gdb 命令检查 VTOR?

Thanks!谢谢!

ADD 1 - 7:43 AM 3/2/2022添加 1 - 2022 年 3 月 2 日上午 7:43

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:根据 ARMv7 ARM, VTOR是 memory 映射到0xe000ed08 。但是当我尝试使用 gdb 命令访问它时,它显示以下错误:

>>> 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:根据这个线程,我检查了 gdb 客户端已知的 memory 区域:

>>> 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 . VOTR 偏移量 0xe000ed08 似乎不在这些区域内

Now I am looking into how to workaround this.现在我正在研究如何解决这个问题。

Not sure which decides it:不确定是哪个决定的:

  • Something I can configure?我可以配置什么?
  • Or determined by the reel board manufacturer?还是由 卷板厂家决定?
  • Or the binary I flashed into the board?或者我闪进板子的二进制文件?

ADD 2 - 4:46 PM 5/3/2022添加 2 - 2022 年 5 月 3 日下午 4:46

A similar issue with Cannot access memory at address xxxx error. Cannot access memory at address xxxx错误的类似问题。 It may be related to optimization.可能跟优化有关。 But no definite answer yet.但目前还没有确定的答案。

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

Add the missing region using the gdb mem command.使用 gdb mem命令添加缺失的区域。

mem 0xE0000000 0xE00FFFFF

Then you will be able to access the VTOR at 0xe000ed08.然后您将能够访问位于 0xe000ed08 的 VTOR。

For a more permanent solution add the region to the target memory map configuration ( https://sourceware.org/gdb/onlinedocs/gdb/Memory-Map-Format.html )对于更永久的解决方案,将区域添加到目标 memory map 配置 ( https://sourceware.org/gdb/onlinedocs/gdb/Memory-Map-Format.html )

It is a memory mapped register, so you can inspect it that way.它是一个 memory 映射寄存器,因此您可以那样检查它。

Get the address from the manual you mention:从您提到的手册中获取地址:

0xE000ED08 VTOR RW 0x00000000a Vector Table Offset Register, VTOR on page B3-601.

Try something like (gdb) x/w 0xe000ed08尝试类似(gdb) x/w 0xe000ed08

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM