ARM 平台 assert 退出后堆栈打不出来的原因是：调用了abort()函数，abort是一个没有返回的函数，只会被调用一次，运行时不会去保存相关的寄存器值。
- 改 assert 函数，让它以其他 signal 退出，比如通过改写 0 地址内容产生 signal 11 退出。
Your implementation of abort does not save a return address, so GDB
can’t display it. I believe tehis is a known limitation of the ARM
GCC should really not do this. People are almost guaranteed to want
to be able to see a backtrace from abort(3).
I suppose it optimizes away the instructions to save the return
address, because abort() is marked with
that means there is very little point in actually doing that
__attribute__(noreturn) implies that the function
will only be called once! I suppose there are some space savings but
are they really significant?
Joe> There are several effects from “noreturn”. We would want some
Joe> of these effects for “abort”, but not others, to get debuggable
Joe> code without degrading compile-time warnings.
So the issue is that two unrelated features are currently combined in
a single attribute:
This function doesn’t return, do the right thing with warnings in
the caller of this function.
Don’t bother saving registers when calling this function because it
won’t return so the registers aren’t needed afterwards.
The issue is that #2 doesn’t apply to “abort” because the registers
ARE needed afterwards – at debug time.