Add 'bt -l' command support, get a line number associated with a
current pc address.
E.g. With this patch:
crash> bt -l
PID: 4768 TASK: 9800000243bcf200 CPU: 3 COMMAND: "bash"
#0 [980000024291f930] __crash_kexec at ffffffff802fff84
/home/tang/loongson-419/linux-4.19.152kexec/./arch/mips/include/asm/stacktrace.h: 43
#1 [980000024291faa0] panic at ffffffff80248cac
/home/tang/loongson-419/linux-4.19.152kexec/kernel/panic.c: 206
...
Signed-off-by: Huacai Chen <chenhuacai(a)loongson.cn>
Signed-off-by: Youling Tang <tangyouling(a)loongson.cn>
---
mips64.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mips64.c b/mips64.c
index 2708f5d..6e8e922 100644
--- a/mips64.c
+++ b/mips64.c
@@ -647,6 +647,15 @@ mips64_dump_backtrace_entry(struct bt_info *bt, struct syment *sym,
fprintf(fp, "\n");
+ /*
+ * 'bt -l', get a line number associated with a current pc address.
+ */
+ if (bt->flags & BT_LINE_NUMBERS) {
+ get_line_number(current->pc, buf, FALSE);
+ if (strlen(buf))
+ fprintf(fp, " %s\n", buf);
+ }
+
if (sym && mips64_is_exception_entry(sym)) {
GET_STACK_DATA(current->sp, &pt_regs, SIZE(pt_regs));
mips64_dump_exception_stack(bt, pt_regs);
--
2.1.0