系统崩溃时如何从ARM寄存器获取信息

时间:2013-07-15 03:54:05

标签: arm stack-trace trace

前置条件:

我使用ARM11处理器,armcc-4.1编译器,threadx OS,T32用于调试器

我的目标处理器是ARM​​11,有时在系统崩溃后,操作系统会提供一些堆栈信息,对于某些崩溃,它显示如下:

 [20:44:54.6]  Trap Class: 0xAAAA (HW DATAABORT TRAP)
 [20:44:54.6]  System Stack: 
 [20:44:54.6]   0x600DB570
 [20:44:54.6]   0x00000000
 [20:44:54.6]   0x00000000
 [20:44:54.6]   0x00000000
 [20:44:54.6]   0x00000000
 [20:44:54.6]   0x00000000
 [20:44:54.6]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.7]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.8]   0x00000000
 [20:44:54.9]   0x00000000
 [20:44:54.9]   0x00000000
 [20:44:54.9]   0x00000000
 [20:44:54.9]   0x600DB8A0
 [20:44:54.9]   0x600CF2E8
 [20:44:54.9]   0xE5920004
 [20:44:54.9]   0x60013C20
 [20:44:54.9]   0x602FF288
 [20:44:54.9]   0x00100000
 [20:44:54.9]   0xE5920000
 [20:44:54.9]   0x405C2184
 [20:44:54.9]   0x405C2184
 [20:44:55.0]   0x405C2184
 [20:44:55.0]   0x00000000
 [20:44:55.0]   0x00000195
 [20:44:55.0]   0x60013C20
 [20:44:55.0]   0x00000001
 [20:44:55.0]   0x00000000
 [20:44:55.0]   0x405C218C
 [20:44:55.0]   0x00093400
 [20:44:55.0]   0x00093478
 [20:44:55.0]   0x00093400
 [20:44:55.0]   0x00093478
 [20:44:55.0]   0x60000000
 [20:44:55.0]   0x00088DEC
 [20:44:55.0]   0x0632EA00
 [20:44:55.1]   0x00000000
 [20:44:55.1]   0x04300001
 [20:44:55.1]   0x04300001
 [20:44:55.1]   0x32200221
 [20:44:55.1]   0x21111291
 [20:44:55.1]   0x00033F0F
 [20:44:55.1]   0x0000704B
 [20:44:55.1]   0x04300001
 [20:44:55.1]   0x04300000
 [20:44:55.1]   0xFFFFFFFF
 [20:44:55.1]   0x0000F103
 [20:44:55.1]   0x60000000
 [20:44:55.2]   0x00088DEC
 [20:44:55.2]   0x0632EA00
 [20:44:55.2]   0x00000001
 [20:44:55.2]   0x35840C01
 [20:44:55.2]   0x34040001
 [20:44:55.2]   0x11000091
 [20:44:55.2]   0x11001111
 [20:44:55.2]   0x00033F0F
 [20:44:55.2]   0x0000704B
 [20:44:55.2]   0x04300001
 [20:44:55.2]   0x04300000
 [20:44:55.2]   0xFFFFFFFF
 [20:44:55.2]   0x00001903
 [20:44:55.2]   0x40000000
 [20:44:55.3]   0x00084E60
 [20:44:55.3]   0x0632EA00
 [20:44:55.3]   0x00000000
 [20:44:55.3]   0x04300001
 [20:44:55.3]   0x04300001
 [20:44:55.3]   0x22200211
 [20:44:55.3]   0x22101211
 [20:44:55.3]   0x00000909
 [20:44:55.3]   0x04300001
 [20:44:55.3]   0x04300000
 [20:44:55.3]   0xFFFFFFFF
 [20:44:55.3]   0xFFFFFFFF
 [20:44:55.4]   0x00020909
 [20:44:55.4]   0x0000F917
 [20:44:55.4]   0x00000004
 [20:44:55.4]   0x40000000
 [20:44:55.4]   0x00084E60
 [20:44:55.4]   0x0632EA00
 [20:44:55.4]   0x00000001
 [20:44:55.4]   0x16040C01
 [20:44:55.4]   0x04302001
 [20:44:55.4]   0x21301191
 [20:44:55.4]   0x11001291
 [20:44:55.4]   0x000009C9
 [20:44:55.5]   0x04300001
 [20:44:55.5]   0x04300000
 [20:44:55.5]   0xFFFFFFFF
 [20:44:55.5]   0xFFFFFFFF
 [20:44:55.5]   0x00020909
 [20:44:55.5]   0x00005013
 [20:44:55.5]   0x00000004
 [20:44:55.5]   0xEA000049
 [20:44:55.5]   0xE3A00003
 [20:44:55.5]   0xE5C20005
 [20:44:55.5]   0xE5C30005
 [20:44:55.5]   0xE1A00006
 [20:44:55.5]   0xEBFFE638
 [20:44:55.5]   0xEA000043
 [20:44:55.6]   0xE5D20002
 [20:44:55.6]   0xE3100020
 [20:44:55.6]   0x0A000005
 [20:44:55.6]   0xE3A00009
 [20:44:55.6]   0xE5C20005
 [20:44:55.6]   0xE5C30005
 [20:44:55.6]   0xE1A00006
 [20:44:55.6]   0xEBFFE62F
 [20:44:55.6]   0xEA00003A
 [20:44:55.6]   0xE3A04016
 [20:44:55.6]   0xEA000038
 [20:44:55.6]   0xE3A04016
 [20:44:55.7]   0xEA000036
 [20:44:55.7]   0xE3A0400B
 [20:44:55.7]   0xEA000034
 [20:44:55.7]   0xE3550000
 [20:44:55.7]   0x0A000008
 [20:44:55.7]   0xE3550001
 [20:44:55.7]   0x0A000001
 [20:44:55.7]   0xE3550002
 [20:44:55.7]   0x1A00002D
 [20:44:55.7]   0xE5D20002
 [20:44:55.7]   0xE3100020
 [20:44:55.7]   0x1A000001
 [20:44:55.7]   0xE3A04016
 [20:44:55.7]   0xEA000029
 [20:44:55.8]   0xE351000B
 [20:44:55.8]   0x0A000007
 [20:44:55.8]   0xE3510003
 [20:44:55.8]   0x0A000005
 [20:44:55.8]   0xE351000A
 [20:44:55.8]   0x0A000003
 [20:44:55.8]   0xE3510009
 [20:44:55.8]   0x0A000001
 [20:44:55.8]   0xE3510005
 [20:44:55.8]   0x1A00001C
 [20:44:55.8]   0xE1A00006
 [20:44:55.8]   0xEBFFE60C
 [20:44:55.9]   0xE59F10A0
 [20:44:55.9]   0xE1D110BE
 [20:44:55.9]   0xE1500001
 [20:44:55.9]   0x2A000016
 [20:44:55.9]   0xE5D21005
 [20:44:55.9]   0xE3510005
 [20:44:55.9]   0x1A000001
 [20:44:55.9]   0xE3A0400D
 [20:44:55.9]   0xEA000014
 [20:44:55.9]   0xE3550000
 [20:44:55.9]   0x1A000001
 [20:44:55.9]   0xE3510003
 [20:44:56.0]   0x1A000007
 [20:44:56.0]   0xE3550001
 [20:44:56.0]   0x1A000001
 [20:44:56.0]   0xE3510009
 [20:44:56.0]   0x1A000003
 [20:44:56.0]   0xE3550002
 [20:44:56.0]   0x1A000004
 [20:44:56.0]   0xE351000A
 [20:44:56.0]   0x0A000002
 [20:44:56.0]   0xE3A0000B
 [20:44:56.0]   0xE5C20005
 [20:44:56.0]   0xE5C30005
 [20:44:56.1]   0xE1A00006
 [20:44:56.1]   0xEBFFE5F7
 [20:44:56.1]   0xEA000002
 [20:44:56.1]   0xE3A04004
 [20:44:56.1]   0xEA000000
 [20:44:56.1]   0xE3A04004
 [20:44:56.1]   0xE3570000
 [20:44:56.1]   0x0A000001
 [20:44:56.1]   0xE3A00001
 [20:44:56.1]   0xFBFFCC58
 [20:44:56.1]   0xE320F000
 [20:44:56.1]   0xE320F000
 [20:44:56.2]   0xE1A00004
 [20:44:56.2]   0xEAFFFF93
 [20:44:56.2]   0x00002851
 [20:44:56.2]   0x00002859
 [20:44:56.2]   0x0000286A
 [20:44:56.2]   0x0000286F
 [20:44:56.2]   0x6000089C
 [20:44:56.2]  Register:
 [20:44:56.2]  r0:  0xE5920004  r1:  0x60013C20  r2:  0x602FF288
 [20:44:56.2]  r3:  0x00100000  r4:  0xE5920000  r5:  0x405C2184
 [20:44:56.2]  r6:  0x405C2184  r7:  0x405C2184  r8:  0x00000000
 [20:44:56.2]  r9:  0x00000195  r10:  0x60013C20  r11:  0x00000001
 [20:44:56.3]  r12:  0x00000000  r13:  0xFFFE2300  r14:  0x06052402
 [20:44:56.3]  r15:  0x405C218C
 [20:44:56.3]  SPSR: 0xA0000053  DFAR:  0x00000000  DFSR: 0x00000406

如何从中获取一些信息?或者我可以从寄存器中知道R0到R14的内容吗?这究竟是什么意思?

1 个答案:

答案 0 :(得分:0)

首先,您可以看到(第一行)崩溃是由“数据中止”引起的。数据中止的可能原因是:

  • 对齐故障
  • 翻译错误
  • 域名错误
  • 许可错误。

您可以在ARM's official manual上了解更多相关信息。

之后,您将看到系统堆栈的内容(每行是一个内存位置)。

在底部你会找到每个寄存器的内容:

 [20:44:56.2]  Register:
 [20:44:56.2]  r0:  0xE5920004  r1:  0x60013C20  r2:  0x602FF288
 [20:44:56.2]  r3:  0x00100000  r4:  0xE5920000  r5:  0x405C2184
 [20:44:56.2]  r6:  0x405C2184  r7:  0x405C2184  r8:  0x00000000
 [20:44:56.2]  r9:  0x00000195  r10:  0x60013C20  r11:  0x00000001
 [20:44:56.3]  r12:  0x00000000  r13:  0xFFFE2300  r14:  0x06052402
 [20:44:56.3]  r15:  0x405C218C

请注意,这些值是十六进制的(因此每个开头都是0x)。

您还可以使用GDB运行程序,以在每条指令后跟踪每个寄存器的内容。