From 6f048a072ed271c52d6dc4f7c7873f67acc8fa83 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Wed, 13 Jan 2021 11:24:17 +0800 Subject: [PATCH] fiq_debugger_arm: Print real address instead of hashed address This patch replaces %p with %px to print real address for debugging. Refer to: Documentation/core-api/printk-formats.rst: Unmodified Addresses Before: debug> bt pid: 0 comm: swapper/0 r0 00000000 r1 b0d08cb0 r2 00000008 r3 00000001 r4 b0c50008 r5 00000000 r6 00000000 r7 b0d01ef0 r8 f0803000 r9 b0d00000 r10 00000000 r11 b0d01f68 mode SVC ip 00000000 sp b0d01ec0 lr b010e308 pc b010e314 cpsr 600001d3 pc: 319691eb (handle_IPI+0x11c/0x18c), lr 3029134f (handle_IPI+0x110/0x18c) pc: d0f03ab2 (gic_handle_irq+0x74/0x78), lr d0f03ab2 (gic_handle_irq+0x74/0x78) pc: 86ca801d (__irq_svc+0x58/0x8c), lr 86ca801d (__irq_svc+0x58/0x8c) After this patch: debug> bt pid: 0 comm: swapper/0 r0 00000000 r1 b0d08cb0 r2 0000000c r3 00000001 r4 b0c50008 r5 00000000 r6 00000000 r7 b0d01ef0 r8 f0803000 r9 b0d00000 r10 00000000 r11 b0d01f68 mode SVC ip 00000000 sp b0d01ec0 lr b010e308 pc b010e314 cpsr 600d01d3 pc: b010e314 (handle_IPI+0x11c/0x18c), lr b010e308 (handle_IPI+0x110/0x18c) pc: b03b347c (gic_handle_irq+0x74/0x78), lr b03b347c (gic_handle_irq+0x74/0x78) pc: b0101a78 (__irq_svc+0x58/0x8c), lr b0101a78 (__irq_svc+0x58/0x8c) Change-Id: I9ef798f30531c654ef18ff59d56bb85facccb79d Signed-off-by: Sugar Zhang --- .../staging/android/fiq_debugger/fiq_debugger_arm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/android/fiq_debugger/fiq_debugger_arm.c b/drivers/staging/android/fiq_debugger/fiq_debugger_arm.c index aaf6e9ba6992..4010ed5e3de3 100644 --- a/drivers/staging/android/fiq_debugger/fiq_debugger_arm.c +++ b/drivers/staging/android/fiq_debugger/fiq_debugger_arm.c @@ -189,7 +189,7 @@ static int report_trace(struct stackframe *frame, void *d) if (sts->depth) { sts->output->printf(sts->output, - " pc: %p (%pF), lr %p (%pF), sp %p, fp %p\n", + " pc: %px (%pF), lr %px (%pF), sp %px, fp %px\n", frame->pc, frame->pc, frame->lr, frame->lr, frame->sp, frame->fp); sts->depth--; @@ -213,17 +213,17 @@ static struct frame_tail *user_backtrace(struct fiq_debugger_output *output, /* Also check accessibility of one struct frame_tail beyond */ if (!access_ok(VERIFY_READ, tail, sizeof(buftail))) { - output->printf(output, " invalid frame pointer %p\n", + output->printf(output, " invalid frame pointer %px\n", tail); return NULL; } if (__copy_from_user_inatomic(buftail, tail, sizeof(buftail))) { output->printf(output, - " failed to copy frame pointer %p\n", tail); + " failed to copy frame pointer %px\n", tail); return NULL; } - output->printf(output, " %p\n", buftail[0].lr); + output->printf(output, " %px\n", buftail[0].lr); /* frame pointers should strictly progress back up the stack * (towards higher addresses) */ @@ -258,7 +258,7 @@ void fiq_debugger_dump_stacktrace(struct fiq_debugger_output *output, frame.lr = regs->ARM_lr; frame.pc = regs->ARM_pc; output->printf(output, - " pc: %p (%pF), lr %p (%pF), sp %p, fp %p\n", + " pc: %px (%pF), lr %px (%pF), sp %px, fp %px\n", regs->ARM_pc, regs->ARM_pc, regs->ARM_lr, regs->ARM_lr, regs->ARM_sp, regs->ARM_fp); walk_stackframe(&frame, report_trace, &sts);