简体   繁体   English

“对齐陷阱”错误消息中的项目有什么含义?

[英]What are the meaning of the items in the “alignment trap” error message?

During my debugging, I got the following error message. 在我的调试过程中,我收到以下错误消息。

Alignment trap: my_main (29858) PC=0x00170ad8 Instr=0xe5960008 Address=0x00f28daa FSR 0x0f3

I've looked around a bit and found a lot of information on this real-time embedded website . 我看了一下,在这个实时嵌入式网站上发现了很多信息。 So now I know what PC and Instr refers to, but I still haven't found anything about the Address and FSR part. 所以现在我知道PCInstr所指的是什么,但我还没有找到关于AddressFSR部分的任何信息。

What is FSR ? 什么是FSR What address does Address refer to? Address所指的Address是什么? According to proc/xxxx/maps that address is even outside the scope of my program. 根据proc/xxxx/maps ,该地址甚至超出了我的程序范围。 Does anybody know what the last two items mean? 有人知道最后两项是什么意思吗? I need information on these to solve this alignment problem. 我需要有关这些的信息来解决这种对齐问题。

MAP output MAP输出

00008000-001fe000 r-xp 00000000 03:02 16204      /home/myuser/my_main
00205000-00248000 rw-p 001f5000 03:02 16204      /home/myuser/my_main
00248000-00299000 rwxp 00248000 00:00 0
40000000-40018000 r-xp 00000000 03:01 2095       /lib/ld-2.3.3.so
40018000-4001b000 rw-p 40018000 00:00 0
4001f000-40020000 r--p 00017000 03:01 2095       /lib/ld-2.3.3.so
40020000-40021000 rw-p 00018000 03:01 2095       /lib/ld-2.3.3.so
40021000-40023000 r-xp 00000000 03:01 15724      /usr/lib/libem7.so.1.0.1
40023000-40029000 ---p 00002000 03:01 15724      /usr/lib/libem7.so.1.0.1
40029000-4002b000 rw-p 00000000 03:01 15724      /usr/lib/libem7.so.1.0.1
4002b000-40031000 r-xp 00000000 03:01 2057       /lib/tls/librt-2.3.3.so
40031000-40033000 ---p 00006000 03:01 2057       /lib/tls/librt-2.3.3.so
40033000-40038000 rw-p 00000000 03:01 2057       /lib/tls/librt-2.3.3.so
40038000-40039000 r--p 00005000 03:01 2057       /lib/tls/librt-2.3.3.so
40039000-4003a000 rw-p 00006000 03:01 2057       /lib/tls/librt-2.3.3.so
4003a000-4004a000 r-xp 00000000 03:01 2060       /lib/tls/libpthread-2.3.3.so
4004a000-40051000 rw-p 00008000 03:01 2060       /lib/tls/libpthread-2.3.3.so
40051000-40052000 r--p 0000f000 03:01 2060       /lib/tls/libpthread-2.3.3.so
40052000-40053000 rw-p 00010000 03:01 2060       /lib/tls/libpthread-2.3.3.so
40053000-40055000 rw-p 40053000 00:00 0
40055000-4010e000 r-xp 00000000 03:01 15703      /usr/lib/libstdc++.so.6.0.3
4010e000-40115000 ---p 000b9000 03:01 15703      /usr/lib/libstdc++.so.6.0.3
40115000-40119000 rw-p 000b8000 03:01 15703      /usr/lib/libstdc++.so.6.0.3
40119000-4011f000 rw-p 40119000 00:00 0
4011f000-401b7000 r-xp 00000000 03:01 2076       /lib/tls/libm-2.3.3.so
401b7000-401be000 rw-p 00090000 03:01 2076       /lib/tls/libm-2.3.3.so
401be000-401bf000 r--p 00097000 03:01 2076       /lib/tls/libm-2.3.3.so
401bf000-401c0000 rw-p 00098000 03:01 2076       /lib/tls/libm-2.3.3.so
401c0000-401c8000 r-xp 00000000 03:01 2005       /lib/libgcc_s.so.1
401c8000-401c9000 rw-p 00008000 03:01 2005       /lib/libgcc_s.so.1
401c9000-402cb000 r-xp 00000000 03:01 2078       /lib/tls/libc-2.3.3.so
402cb000-402d1000 ---p 00102000 03:01 2078       /lib/tls/libc-2.3.3.so
402d1000-402d2000 rw-p 00100000 03:01 2078       /lib/tls/libc-2.3.3.so
402d2000-402d4000 r--p 00101000 03:01 2078       /lib/tls/libc-2.3.3.so
402d4000-402d6000 rw-p 00103000 03:01 2078       /lib/tls/libc-2.3.3.so
402d6000-402d8000 rw-p 402d6000 00:00 0
402d8000-402e5000 rw-s 00000000 00:07 0          /SYSV12345678 (deleted)
402e5000-402e6000 ---p 402e5000 00:00 0
402e6000-402f5000 rwxp 402e6000 00:00 0
403c1000-4049d000 rw-p 403c1000 00:00 0
7efeb000-7f000000 rwxp 7efeb000 00:00 0
PC=0x00170ad8

This is telling you the current value of the program counter , it can be used to determine which instruction in your program is causing the trap. 这告诉您程序计数器的当前值,它可用于确定程序中的条指令导致陷阱。 If you're on ARM as I think you are, this is actually the current instruction plus 8, so the instruction causing the trap is located at 0x00170ad0 . 如果您认为自己是ARM,那么这实际上是当前指令加上8,因此导致陷阱的指令位于0x00170ad0

Instr=0xe5960008

This is the encoding of the faulting instruction. 这是错误指令的编码。 If this is on ARM, that instruction is ldr r0, [r6, #8] 如果这是在ARM上,则该指令是ldr r0, [r6, #8]

Address=0x00f28daa

This is telling you the address from which your program attempted to load, causing the fault. 这告诉您程序尝试加载的地址,从而导致错误。 Assuming everything else so far is correct, this is r6 + 8 , so r6 held 0x00f28da2 at the time of the fault. 假设到目前为止的其他所有内容都是正确的,这是r6 + 8 ,所以r6在发生故障时保持0x00f28da2

FSR 0xf3

This is the value held in the fault status register . 这是故障状态寄存器中保存的值。 It tells you what fault occurred. 它告诉你发生了什么错误。 This particular value is an older encoding (pre-ARMv7) for an Alignment fault. 此特定值是Alignment故障的旧编码(ARMv7之前的版本)。

Most likely your CPU does not support reads/writes from/to memory of values at misaligned addresses. 很可能您的CPU不支持在未对齐的地址处从/向内存读取/写入。 If you're accessing a 4-byte variable, then clearly Address=0x00f28daa isn't a multiple of 4. Only single bytes can be read/written at arbitrarily aligned addresses. 如果您正在访问一个4字节的变量,那么显然Address = 0x00f28daa不是4的倍数。只能在任意对齐的地址读/写单个字节。

That article explains it well. 那篇文章解释得很好。

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

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