When gdb stack unwinding is enabled, gdb will output the stack trace
along with a unwinding stop reason. This is often seen at the end of
kernel stack unwinding where a userspace stack/context-switch is reached,
gdb fails to recongnize it and output the stop reason indicating the
error.
Though the stack unwinding is correct, but the error message might
confuse users. So we will output the message conditionally instead of
filter it out, since the message might be useful to experienced users.
To view the unwind stopping info:
crash> gdb bt
#0 0xc0000000002bde04 in crash_setup_regs ...
...
#12 0xc00000000000d05c in system_call_vectored_common () ...
crash> set debug 1
debug: 1
crash> gdb bt
#0 0xc0000000002bde04 in crash_setup_regs ...
...
#12 0xc00000000000d05c in system_call_vectored_common () ...
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Cc: Sourabh Jain <sourabhjain(a)linux.ibm.com>
Cc: Hari Bathini <hbathini(a)linux.ibm.com>
Cc: Mahesh J Salgaonkar <mahesh(a)linux.ibm.com>
Cc: Naveen N. Rao <naveen.n.rao(a)linux.vnet.ibm.com>
Cc: Lianbo Jiang <lijiang(a)redhat.com>
Cc: HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab(a)nec.com>
Cc: Tao Liu <ltao(a)redhat.com>
Cc: Alexey Makhalov <alexey.makhalov(a)broadcom.com>
Cc: Aditya Gupta <adityag(a)linux.ibm.com>
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
gdb-10.2.patch | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index 7f66e5c..54716dc 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -16203,3 +16203,14 @@ exit 0
print_frame_info (fp_opts, fi, 1, LOCATION, 1, 0);
if ((flags & PRINT_LOCALS) != 0)
{
+--- gdb-10.2/gdb/stack.c.orig
++++ gdb-10.2/gdb/stack.c
+@@ -2127,7 +2127,7 @@
+ enum unwind_stop_reason reason;
+
+ reason = get_frame_unwind_stop_reason (trailing);
+- if (reason >= UNWIND_FIRST_ERROR)
++ if (reason >= UNWIND_FIRST_ERROR && gdb_CRASHDEBUG(1))
+ printf_filtered (_("Backtrace stopped: %s\n"),
+ frame_stop_reason_string (trailing));
+ }
--
2.40.1