After analyzing dump of ppc program, whose crash occurred after
watchdog_force_here () function, GDB couldn't print full back trace
because GDB couldn't unwind PC from the watchdog fucntion.
The problem is introduced with the following patch:
https://sourceware.org/ml/gdb-patches/2008-08/msg00245.html
In function skip_prologue(), shifted lr_reg makes below condition always
false because non-shifted lr_reg value is expected to be checked.
else if (lr_reg >= 0 &&
/* std Rx, NUM(r1) || stdu Rx, NUM(r1) */
(((op & 0xffff0000) == (lr_reg | 0xf8010000)) ||
/* stw Rx, NUM(r1) */
((op & 0xffff0000) == (lr_reg | 0x90010000)) ||
/* stwu Rx, NUM(r1) */
((op & 0xffff0000) == (lr_reg | 0x94010000))))
Before this fix unwinding was able to work because it relied on unwind
directives or on some of the next frames to find PC. Problem came with
watchdog_force_here() function which didn't contain unwind directives.
I wasn't able to produce test case that would show improvements for end
user. I suppose that changes would be visible if watchdog event was
called, but I don't have valid ppc board to try this. I have tried this
code on simple test case with few functions in back trace. The back
trace is printed correctly with and without this fix, but the difference
between those two runs is that the body of the upper condition was
visited with this patch. After visiting the body there was no need to
look for PC counter in next frames nor to use unwind directives.