56ae9b
From 1c918c621e48f53ea69a143aabc59c8366102236 Mon Sep 17 00:00:00 2001
56ae9b
From: Hari Bathini <hbathini@linux.ibm.com>
56ae9b
Date: Mon, 4 Jul 2022 10:55:41 +0530
56ae9b
Subject: [PATCH 03/28] ppc64: fix bt for '-S' case
56ae9b
56ae9b
Passing '-S' option to 'bt' command was intended to specify the stack
56ae9b
pointer manually. But get_stack_frame() handling on ppc64 is ignoring
56ae9b
this option altogether. Fix it.
56ae9b
56ae9b
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
56ae9b
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
56ae9b
---
56ae9b
 ppc64.c | 16 ++++++++++++++++
56ae9b
 1 file changed, 16 insertions(+)
56ae9b
56ae9b
diff --git a/ppc64.c b/ppc64.c
56ae9b
index 975caa53b812..0e1d8678eef5 100644
56ae9b
--- a/ppc64.c
56ae9b
+++ b/ppc64.c
56ae9b
@@ -2330,6 +2330,22 @@ ppc64_vmcore_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
56ae9b
 
56ae9b
 	pt_regs = (struct ppc64_pt_regs *)bt_in->machdep;
56ae9b
 	if (!pt_regs || !pt_regs->gpr[1]) {
56ae9b
+		if (bt_in->hp) {
56ae9b
+			if (bt_in->hp->esp) {
56ae9b
+				*ksp = bt_in->hp->esp;
56ae9b
+				if (!bt_in->hp->eip) {
56ae9b
+					if (IS_KVADDR(*ksp)) {
56ae9b
+						readmem(*ksp+16, KVADDR, &unip, sizeof(ulong),
56ae9b
+							"Regs NIP value", FAULT_ON_ERROR);
56ae9b
+						*nip = unip;
56ae9b
+					}
56ae9b
+				} else
56ae9b
+					*nip = bt_in->hp->eip;
56ae9b
+
56ae9b
+			}
56ae9b
+			return TRUE;
56ae9b
+		}
56ae9b
+
56ae9b
 		/*
56ae9b
 		 * Not collected regs. May be the corresponding CPU not
56ae9b
 		 * responded to an IPI in case of KDump OR f/w has not
56ae9b
-- 
56ae9b
2.37.1
56ae9b