简体   繁体   English

如何理解 Gdb 中显示的一个奇怪的 memory 地址?

[英]How to understand a strange memory address shown in Gdb?

I am debugging a memory issue with gdb.我正在调试 gdb 的 memory 问题。 Gdb gives this error info: Gdb 给出了这个错误信息:

runtime error: member access within misaligned address 0x0000006d20f4 for type 'struct deque', which requires 8 byte alignment
0x0000006d20f4: note: pointer points here
  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
              ^ 

Question: How does the displayed address问题:如何显示地址

 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00

corresponds to "0x0000006d20f4"?对应于“0x0000006d20f4”?

As you can read in the message itself, the memory address is 0x0000006d20f4 and the value you have highlighted are the contents of that memory location.正如您在消息本身中看到的那样,memory 地址是0x0000006d20f4 ,而您突出显示的值是该 memory 位置的内容。

Hmm.... the pointer points to an address that is multiple of four, but not multiple of eight, so in my opinion, the pointer is pointing to the beginning of the shown block:嗯....指针指向的地址是四的倍数,但不是八的倍数,所以在我看来,指针指向所示块的开头:

runtime error: member access within misaligned address 0x0000006d20f4 for type 'struct deque', which requires 8 byte alignment
0x0000006d20f4: note: pointer points here
  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
  ^  this is actually where the pointer is pointing.
              ^ this is actually address 0x0000006d20f8, which should be correctly  8byte aligned.  Probably where the pointer should be pointing.

Should it be possible to check struct deque definition, and determine that you are not wrong and it doesn't require to be eight byte aligned?是否可以检查struct deque定义,并确定您没有错并且不需要八字节对齐? Have you mangled 32bit architecture definitions with 64bit architecture systems?您是否使用 64 位架构系统破坏了 32 位架构定义? Please, post the code, not your idea of what can be happening.请发布代码,而不是您对可能发生的事情的想法。 You think you are correct, so it is very difficult, from your ideas, to see where is your mistake.你认为你是对的,所以很难从你的想法中看出你的错误在哪里。 Where did you get the memory to store the struct deque object?你从哪里得到 memory 来存储struct deque object?

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

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