How to debug random data abort issue on arm based

2019-04-02 06:32发布

As developing on ARM based project, we get data abort randomly, that is when we play with it we get a data abort interrupt. But the data abort is not always on the same point when we check with the register map with r14 or r13, even though check the function callback. Is there anyway that I can get the information about the root cause on data abort precisely? I have try the ref2 but could not get the same point when I trap the data about interrupt.

Related ARM Data Abort error exception debugging ARM: HOW TO ANALYZE A DATA ABORT EXCEPTION

标签: c embedded arm
1条回答
乱世女痞
2楼-- · 2019-04-02 07:17

Checking the link register (r14) as described in your Keil link above will show you the instruction that triggered the data abort. From there you'll have to figure out why it triggered a data abort and how that could have happened, which is the difficult part.

In my experience what most likely happened is that you accessed an invalid pointer. It can be invalid for many reasons. Here are a few candidates:

  1. You used the pointer before it was initialized
  2. You used the pointer after it, or the containing memory, had been freed (and was subsequently modified when another function allocated it)
  3. The pointer was corrupted by a stack overflow
  4. The pointer was corrupted by other, unrelated, misbehaving code that is trampling on memory
  5. The pointer was allocated on the stack as a local variable and then used after the allocating function had exited
  6. The pointer has incorrect alignment for its type (for example, trying to access 0x4001 as a uint32_t)

As you can see, lots of things can be the root cause of an ARM data abort. Finding the root cause is part of what makes ARM software/firmware development so much fun! Good luck figuring out your puzzle.

查看更多
登录 后发表回答