简体   繁体   English

ARM GDB无法仅在Linux上访问内存

[英]ARM GDB cannot access memory only on Linux

Trying to switch development to Linux, but running into a (probably simple newbie) problem. 试图将开发切换到Linux,但遇到(可能是简单的新手)问题。 On my Mac, I can use ARM GDB ( arm-eabi-none-gdb from the GNU ARM Embedded Toolchain) to load my elf to my STM32L432, then at my breakpoints a simple i lo (or examine, or whatever) gives me the local vars. 在我的Mac,我可以使用ARM GDB( arm-eabi-none-gdb从GNU ARM嵌入式工具链)我的加载elf我STM32L432,然后在我的断点简单的i lo (或检查,或者别的什么)给我的当地的变种。 On Linux, however, the exact same code gives me something like the following: 但是,在Linux上,完全相同的代码给出了类似以下内容:

cr1 = <error reading variable cr1 (Cannot access memory at address 0x2000fff4)>

Is there something I should be doing different to map the memory correctly? 有没有什么我应该做的不同正确映射内存?

Edit: Thought I'd start again today with a mem dump of the entire SRAM block (datasheet RM0394 page 63) to see if there's just some offset (maybe some sort of memory aliasing that I was unaware of), but even the dump command is stymied: 编辑:我想今天我将重新启动整个SRAM块的存储转储(数据表RM0394第63页),看看是否只有一些偏移(可能是某种我不知道的内存别名),但即使是dump命令也是如此受到阻碍:

(gdb) dump ihex memory result.bin 0x20000000 0x40000000
Cannot access memory at address 0x2000c000

This isn't happening on my Mac, and I can see the data I'm looking for on my scope (nothing like debugging software with a scope), so the problem isn't with the SRAM, but with gdb . 这在我的Mac上没有发生,我可以在我的示波器上看到我正在寻找的数据(没有像使用示波器的调试软件那样),所以问题不在于SRAM,而在于gdb

And to the person who voted to close, could you specify in what way this is off-topic? 对于投票结束的人,你能指明一下这是什么样的话题吗? I'm stepping through code using gdb and there are tags for pretty much everything I mention, which leads me to believe that this is an appropriate place for the question. 我正在使用gdb逐步执行代码,并且我提到的所有内容都有标记,这使我相信这是一个适合该问题的地方。 I'm not asking for "debugging help" as in "help with debugging specific code", I'm asking for help with a very widely used debugger on somewhat common equipment. 我不是要求“调试帮助”,如“帮助调试特定代码”,我在一些常见的设备上寻求帮助,使用非常广泛的调试器。

For anyone with this problem in the future ( sc. myself), the issue was that gdb was not tracking the memory region that includes my SRAM ( viz. 0x2000c000 to 0x40000000). 对于今后遇到此问题的任何人( sc。我自己),问题是gdb没有跟踪包含我的SRAM( 0x2000c000到0x40000000)的内存区域。 The fix was to set up a memory region manually. 修复是手动设置内存区域。

Before: 之前:

(gdb) info mem
Using memory regions provided by the target.
Num Enb Low Addr   High Addr  Attrs 
0   y   0x00000000 0x00040000 ro nocache 
1   y   0x08000000 0x08040000 flash blocksize 0x800 nocache 
2   y   0x1fff0000 0x1fff7000 ro nocache 
3   y   0x1ffff800 0x1ffff810 ro nocache 
4   y   0x20000000 0x2000c000 rw nocache 
5   y   0x40000000 0x5fffffff rw nocache 
6   y   0xe0000000 0xffffffff rw nocache

After: 后:

(gdb) mem 0x2000c000 0x40000000 32 rw
(gdb) info mem
Using user-defined memory regions.
Num Enb Low Addr   High Addr  Attrs 
0   y   0x00000000 0x00040000 ro nocache 
1   y   0x08000000 0x08040000 flash blocksize 0x800 nocache 
2   y   0x1fff0000 0x1fff7000 ro nocache 
3   y   0x1ffff800 0x1ffff810 ro nocache 
4   y   0x20000000 0x2000c000 rw nocache 
1   y   0x2000c000 0x40000000 rw 32 nocache 
5   y   0x40000000 0x5fffffff rw nocache 
6   y   0xe0000000 0xffffffff rw nocache

(gdb) x/x cr1
0x36c:  0x60f8af00

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

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