]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
Use register_t instead of uintptr_t for register values in backtraces.
authorjhb <jhb@FreeBSD.org>
Tue, 13 Dec 2016 19:36:05 +0000 (19:36 +0000)
committerjhb <jhb@FreeBSD.org>
Tue, 13 Dec 2016 19:36:05 +0000 (19:36 +0000)
This fixes backtraces from DDB in n32 kernels as uintptr_t is only a
uint32_t.  In particular, the upper 32-bits of each register value were
treated as the register's value breaking both the output of register
values, but also the values of 'ra' and 'sp' required to walk up to the
previous frame.

Sponsored by: DARPA / AFRL

sys/mips/mips/db_trace.c

index 215ec0fc1529f56642da77fc25d74b211d358cc4..74d05b92617af4fa578c15d5d3c3a8eee9443f15 100644 (file)
@@ -139,8 +139,8 @@ stacktrace_subr(register_t pc, register_t sp, register_t ra,
         * of these registers is valid, e.g. obtained from the stack
         */
        int valid_args[4];
-       uintptr_t args[4];
-       uintptr_t va, subr;
+       register_t args[4];
+       register_t va, subr;
        unsigned instr, mask;
        unsigned int frames = 0;
        int more, stksize, j;
@@ -379,7 +379,7 @@ done:
                if (j > 0)
                        (*printfn)(",");
                if (valid_args[j])
-                       (*printfn)("%x", args[j]);
+                       (*printfn)("%jx", (uintmax_t)(u_register_t)args[j]);
                else
                        (*printfn)("?");
        }