Test that frame info/IDs are stable/consistent
This adds a testcase that tests that the unwinder produces consistent
frame info and frame IDs by making sure that "info frame" shows the
same result when stopped at a function (level == 0), compared to when
we find the same frame in the stack at a level > 0.
E.g., on x86-64, right after running to main, we see:
(gdb) info frame
Stack level 0, frame at 0x7fffffffd340:
rip = 0x555555555168 in main (gdb.base/backtrace.c:41); saved rip = 0x7ffff7dd90b3
source language c.
Arglist at 0x7fffffffd330, args:
Locals at 0x7fffffffd330, Previous frame's sp is 0x7fffffffd340
Saved registers:
rbp at 0x7fffffffd330, rip at 0x7fffffffd338
(gdb)
and then after continuing to a function called by main, and selecting
the "main" frame again, we see:
(gdb) info frame
Stack level 3, frame at 0x7fffffffd340:
rip = 0x555555555172 in main (gdb.base/backtrace.c:41); saved rip = 0x7ffff7dd90b3
caller of frame at 0x7fffffffd330
source language c.
Arglist at 0x7fffffffd330, args:
Locals at 0x7fffffffd330, Previous frame's sp is 0x7fffffffd340
Saved registers:
rbp at 0x7fffffffd330, rip at 0x7fffffffd338
(gdb)
The only differences should be in the stack level, the 'rip = '
address, and the presence of the "caller of frame at" info. All the
rest should be the same. If it isn't, it probably means that the
frame base, the frame ID, etc. aren't stable & consistent.
The testcase exercises both the DWARF and the heuristic unwinders,
using "maint set dwarf unwinder on/off".
Tested on {x86-64 -m64, x86-64 -m32, Aarch64, Power8} GNU/Linux.
Change-Id: I795001c82cc70d543d197415e3f80ce5dc7f3452