1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #include <stdio.h> 30*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 31*7c478bd9Sstevel@tonic-gate #include <unistd.h> 32*7c478bd9Sstevel@tonic-gate #include <ctype.h> 33*7c478bd9Sstevel@tonic-gate #include <fcntl.h> 34*7c478bd9Sstevel@tonic-gate #include <strings.h> 35*7c478bd9Sstevel@tonic-gate #include <dirent.h> 36*7c478bd9Sstevel@tonic-gate #include <errno.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 38*7c478bd9Sstevel@tonic-gate #include <sys/int_fmtio.h> 39*7c478bd9Sstevel@tonic-gate #include <libproc.h> 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate typedef struct look_arg { 42*7c478bd9Sstevel@tonic-gate int pflags; 43*7c478bd9Sstevel@tonic-gate const char *lwps; 44*7c478bd9Sstevel@tonic-gate int count; 45*7c478bd9Sstevel@tonic-gate } look_arg_t; 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate static int look(char *); 48*7c478bd9Sstevel@tonic-gate static int lwplook(look_arg_t *, const lwpstatus_t *, const lwpsinfo_t *); 49*7c478bd9Sstevel@tonic-gate static char *prflags(int); 50*7c478bd9Sstevel@tonic-gate static char *prwhy(int); 51*7c478bd9Sstevel@tonic-gate static char *prwhat(int, int); 52*7c478bd9Sstevel@tonic-gate static void dumpregs(const prgregset_t, int); 53*7c478bd9Sstevel@tonic-gate #if defined(__sparc) && defined(_ILP32) 54*7c478bd9Sstevel@tonic-gate static void dumpregs_v8p(const prgregset_t, const prxregset_t *, int); 55*7c478bd9Sstevel@tonic-gate #endif 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate static char *command; 58*7c478bd9Sstevel@tonic-gate static struct ps_prochandle *Pr; 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate static int is64; /* Is current process 64-bit? */ 61*7c478bd9Sstevel@tonic-gate static int rflag; /* Show registers? */ 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate #define LWPFLAGS \ 64*7c478bd9Sstevel@tonic-gate (PR_STOPPED|PR_ISTOP|PR_DSTOP|PR_ASLEEP|PR_PCINVAL|PR_STEP \ 65*7c478bd9Sstevel@tonic-gate |PR_ASLWP|PR_AGENT|PR_DETACH|PR_DAEMON) 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate #define PROCFLAGS \ 68*7c478bd9Sstevel@tonic-gate (PR_ISSYS|PR_VFORKP|PR_ORPHAN|PR_FORK|PR_RLC|PR_KLC|PR_ASYNC \ 69*7c478bd9Sstevel@tonic-gate |PR_BPTADJ|PR_MSACCT|PR_MSFORK|PR_PTRACE) 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate #define ALLFLAGS (LWPFLAGS|PROCFLAGS) 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate int 74*7c478bd9Sstevel@tonic-gate main(int argc, char **argv) 75*7c478bd9Sstevel@tonic-gate { 76*7c478bd9Sstevel@tonic-gate int rc = 0; 77*7c478bd9Sstevel@tonic-gate int errflg = 0; 78*7c478bd9Sstevel@tonic-gate int opt; 79*7c478bd9Sstevel@tonic-gate struct rlimit rlim; 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate if ((command = strrchr(argv[0], '/')) != NULL) 82*7c478bd9Sstevel@tonic-gate command++; 83*7c478bd9Sstevel@tonic-gate else 84*7c478bd9Sstevel@tonic-gate command = argv[0]; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate /* options */ 87*7c478bd9Sstevel@tonic-gate while ((opt = getopt(argc, argv, "r")) != EOF) { 88*7c478bd9Sstevel@tonic-gate switch (opt) { 89*7c478bd9Sstevel@tonic-gate case 'r': /* show registers */ 90*7c478bd9Sstevel@tonic-gate rflag = 1; 91*7c478bd9Sstevel@tonic-gate break; 92*7c478bd9Sstevel@tonic-gate default: 93*7c478bd9Sstevel@tonic-gate errflg = 1; 94*7c478bd9Sstevel@tonic-gate break; 95*7c478bd9Sstevel@tonic-gate } 96*7c478bd9Sstevel@tonic-gate } 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate argc -= optind; 99*7c478bd9Sstevel@tonic-gate argv += optind; 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate if (errflg || argc <= 0) { 102*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr, 103*7c478bd9Sstevel@tonic-gate "usage:\t%s [-r] { pid | core }[/lwps] ...\n", command); 104*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr, " (report process status flags)\n"); 105*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr, " -r : report registers\n"); 106*7c478bd9Sstevel@tonic-gate return (2); 107*7c478bd9Sstevel@tonic-gate } 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate /* 110*7c478bd9Sstevel@tonic-gate * Make sure we'll have enough file descriptors to handle a target 111*7c478bd9Sstevel@tonic-gate * that has many many mappings. 112*7c478bd9Sstevel@tonic-gate */ 113*7c478bd9Sstevel@tonic-gate if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { 114*7c478bd9Sstevel@tonic-gate rlim.rlim_cur = rlim.rlim_max; 115*7c478bd9Sstevel@tonic-gate (void) setrlimit(RLIMIT_NOFILE, &rlim); 116*7c478bd9Sstevel@tonic-gate } 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate while (argc-- > 0) 119*7c478bd9Sstevel@tonic-gate rc += look(*argv++); 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate return (rc); 122*7c478bd9Sstevel@tonic-gate } 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate static int 125*7c478bd9Sstevel@tonic-gate look(char *arg) 126*7c478bd9Sstevel@tonic-gate { 127*7c478bd9Sstevel@tonic-gate int gcode; 128*7c478bd9Sstevel@tonic-gate int gcode2; 129*7c478bd9Sstevel@tonic-gate pstatus_t pstatus; 130*7c478bd9Sstevel@tonic-gate psinfo_t psinfo; 131*7c478bd9Sstevel@tonic-gate int flags; 132*7c478bd9Sstevel@tonic-gate sigset_t sigmask; 133*7c478bd9Sstevel@tonic-gate fltset_t fltmask; 134*7c478bd9Sstevel@tonic-gate sysset_t entryset; 135*7c478bd9Sstevel@tonic-gate sysset_t exitset; 136*7c478bd9Sstevel@tonic-gate uint32_t sigtrace, sigtrace2, fltbits; 137*7c478bd9Sstevel@tonic-gate uint32_t sigpend, sigpend2; 138*7c478bd9Sstevel@tonic-gate uint32_t *bits; 139*7c478bd9Sstevel@tonic-gate char buf[PRSIGBUFSZ]; 140*7c478bd9Sstevel@tonic-gate look_arg_t lookarg; 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate if ((Pr = proc_arg_xgrab(arg, NULL, PR_ARG_ANY, 143*7c478bd9Sstevel@tonic-gate PGRAB_RETAIN | PGRAB_FORCE | PGRAB_RDONLY | PGRAB_NOSTOP, &gcode, 144*7c478bd9Sstevel@tonic-gate &lookarg.lwps)) == NULL) { 145*7c478bd9Sstevel@tonic-gate if (gcode == G_NOPROC && 146*7c478bd9Sstevel@tonic-gate proc_arg_psinfo(arg, PR_ARG_PIDS, &psinfo, &gcode2) > 0 && 147*7c478bd9Sstevel@tonic-gate psinfo.pr_nlwp == 0) { 148*7c478bd9Sstevel@tonic-gate (void) printf("%d:\t<defunct>\n\n", (int)psinfo.pr_pid); 149*7c478bd9Sstevel@tonic-gate return (0); 150*7c478bd9Sstevel@tonic-gate } 151*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr, "%s: cannot examine %s: %s\n", 152*7c478bd9Sstevel@tonic-gate command, arg, Pgrab_error(gcode)); 153*7c478bd9Sstevel@tonic-gate return (1); 154*7c478bd9Sstevel@tonic-gate } 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate (void) memcpy(&pstatus, Pstatus(Pr), sizeof (pstatus_t)); 157*7c478bd9Sstevel@tonic-gate (void) memcpy(&psinfo, Ppsinfo(Pr), sizeof (psinfo_t)); 158*7c478bd9Sstevel@tonic-gate proc_unctrl_psinfo(&psinfo); 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate if (psinfo.pr_nlwp == 0) { 161*7c478bd9Sstevel@tonic-gate (void) printf("%d:\t<defunct>\n\n", (int)psinfo.pr_pid); 162*7c478bd9Sstevel@tonic-gate Prelease(Pr, PRELEASE_RETAIN); 163*7c478bd9Sstevel@tonic-gate return (0); 164*7c478bd9Sstevel@tonic-gate } 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate is64 = (pstatus.pr_dmodel == PR_MODEL_LP64); 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate sigmask = pstatus.pr_sigtrace; 169*7c478bd9Sstevel@tonic-gate fltmask = pstatus.pr_flttrace; 170*7c478bd9Sstevel@tonic-gate entryset = pstatus.pr_sysentry; 171*7c478bd9Sstevel@tonic-gate exitset = pstatus.pr_sysexit; 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate if (Pstate(Pr) == PS_DEAD) { 174*7c478bd9Sstevel@tonic-gate (void) printf("core '%s' of %d:\t%.70s\n", 175*7c478bd9Sstevel@tonic-gate arg, (int)psinfo.pr_pid, psinfo.pr_psargs); 176*7c478bd9Sstevel@tonic-gate } else { 177*7c478bd9Sstevel@tonic-gate (void) printf("%d:\t%.70s\n", 178*7c478bd9Sstevel@tonic-gate (int)psinfo.pr_pid, psinfo.pr_psargs); 179*7c478bd9Sstevel@tonic-gate } 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate (void) printf("\tdata model = %s", is64? "_LP64" : "_ILP32"); 182*7c478bd9Sstevel@tonic-gate if ((flags = (pstatus.pr_flags & PROCFLAGS)) != 0) 183*7c478bd9Sstevel@tonic-gate (void) printf(" flags = %s", prflags(flags)); 184*7c478bd9Sstevel@tonic-gate (void) printf("\n"); 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate fltbits = *((uint32_t *)&fltmask); 187*7c478bd9Sstevel@tonic-gate if (fltbits) 188*7c478bd9Sstevel@tonic-gate (void) printf("\tflttrace = 0x%.8x\n", fltbits); 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate sigtrace = *((uint32_t *)&sigmask); 191*7c478bd9Sstevel@tonic-gate sigtrace2 = *((uint32_t *)&sigmask + 1); 192*7c478bd9Sstevel@tonic-gate if (sigtrace | sigtrace2) { 193*7c478bd9Sstevel@tonic-gate (void) printf("\tsigtrace = 0x%.8x 0x%.8x\n\t %s\n", 194*7c478bd9Sstevel@tonic-gate sigtrace, sigtrace2, 195*7c478bd9Sstevel@tonic-gate proc_sigset2str(&sigmask, "|", 1, buf, sizeof (buf))); 196*7c478bd9Sstevel@tonic-gate } 197*7c478bd9Sstevel@tonic-gate 198*7c478bd9Sstevel@tonic-gate bits = ((uint32_t *)&entryset); 199*7c478bd9Sstevel@tonic-gate if (bits[0] | bits[1] | bits[2] | bits[3] | 200*7c478bd9Sstevel@tonic-gate bits[4] | bits[5] | bits[6] | bits[7]) 201*7c478bd9Sstevel@tonic-gate (void) printf( 202*7c478bd9Sstevel@tonic-gate "\tentryset = " 203*7c478bd9Sstevel@tonic-gate "0x%.8x 0x%.8x 0x%.8x 0x%.8x\n" 204*7c478bd9Sstevel@tonic-gate "\t " 205*7c478bd9Sstevel@tonic-gate "0x%.8x 0x%.8x 0x%.8x 0x%.8x\n", 206*7c478bd9Sstevel@tonic-gate bits[0], bits[1], bits[2], bits[3], 207*7c478bd9Sstevel@tonic-gate bits[4], bits[5], bits[6], bits[7]); 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate bits = ((uint32_t *)&exitset); 210*7c478bd9Sstevel@tonic-gate if (bits[0] | bits[1] | bits[2] | bits[3] | 211*7c478bd9Sstevel@tonic-gate bits[4] | bits[5] | bits[6] | bits[7]) 212*7c478bd9Sstevel@tonic-gate (void) printf( 213*7c478bd9Sstevel@tonic-gate "\texitset = " 214*7c478bd9Sstevel@tonic-gate "0x%.8x 0x%.8x 0x%.8x 0x%.8x\n" 215*7c478bd9Sstevel@tonic-gate "\t " 216*7c478bd9Sstevel@tonic-gate "0x%.8x 0x%.8x 0x%.8x 0x%.8x\n", 217*7c478bd9Sstevel@tonic-gate bits[0], bits[1], bits[2], bits[3], 218*7c478bd9Sstevel@tonic-gate bits[4], bits[5], bits[6], bits[7]); 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate sigpend = *((uint32_t *)&pstatus.pr_sigpend); 221*7c478bd9Sstevel@tonic-gate sigpend2 = *((uint32_t *)&pstatus.pr_sigpend + 1); 222*7c478bd9Sstevel@tonic-gate if (sigpend | sigpend2) 223*7c478bd9Sstevel@tonic-gate (void) printf("\tsigpend = 0x%.8x,0x%.8x\n", 224*7c478bd9Sstevel@tonic-gate sigpend, sigpend2); 225*7c478bd9Sstevel@tonic-gate 226*7c478bd9Sstevel@tonic-gate lookarg.pflags = pstatus.pr_flags; 227*7c478bd9Sstevel@tonic-gate lookarg.count = 0; 228*7c478bd9Sstevel@tonic-gate (void) Plwp_iter_all(Pr, (proc_lwp_all_f *)lwplook, &lookarg); 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate if (lookarg.count == 0) 231*7c478bd9Sstevel@tonic-gate (void) printf("No matching lwps found"); 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate (void) printf("\n"); 234*7c478bd9Sstevel@tonic-gate Prelease(Pr, PRELEASE_RETAIN); 235*7c478bd9Sstevel@tonic-gate 236*7c478bd9Sstevel@tonic-gate return (0); 237*7c478bd9Sstevel@tonic-gate } 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate static int 240*7c478bd9Sstevel@tonic-gate lwplook_zombie(const lwpsinfo_t *pip) 241*7c478bd9Sstevel@tonic-gate { 242*7c478bd9Sstevel@tonic-gate (void) printf(" /%d:\t<defunct>\n", (int)pip->pr_lwpid); 243*7c478bd9Sstevel@tonic-gate return (0); 244*7c478bd9Sstevel@tonic-gate } 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate static int 247*7c478bd9Sstevel@tonic-gate lwplook(look_arg_t *arg, const lwpstatus_t *psp, const lwpsinfo_t *pip) 248*7c478bd9Sstevel@tonic-gate { 249*7c478bd9Sstevel@tonic-gate int flags; 250*7c478bd9Sstevel@tonic-gate uint32_t sighold, sighold2; 251*7c478bd9Sstevel@tonic-gate uint32_t sigpend, sigpend2; 252*7c478bd9Sstevel@tonic-gate int cursig; 253*7c478bd9Sstevel@tonic-gate char buf[32]; 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate if (!proc_lwp_in_set(arg->lwps, pip->pr_lwpid)) 256*7c478bd9Sstevel@tonic-gate return (0); 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate arg->count++; 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate if (psp == NULL) 261*7c478bd9Sstevel@tonic-gate return (lwplook_zombie(pip)); 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate /* 264*7c478bd9Sstevel@tonic-gate * PR_PCINVAL is just noise if the lwp is not stopped. 265*7c478bd9Sstevel@tonic-gate * Don't bother reporting it unless the lwp is stopped. 266*7c478bd9Sstevel@tonic-gate */ 267*7c478bd9Sstevel@tonic-gate flags = psp->pr_flags & LWPFLAGS; 268*7c478bd9Sstevel@tonic-gate if (!(flags & PR_STOPPED)) 269*7c478bd9Sstevel@tonic-gate flags &= ~PR_PCINVAL; 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate (void) printf(" /%d:\tflags = %s", (int)psp->pr_lwpid, prflags(flags)); 272*7c478bd9Sstevel@tonic-gate if ((flags & PR_ASLEEP) || (psp->pr_syscall && 273*7c478bd9Sstevel@tonic-gate !(arg->pflags & PR_ISSYS))) { 274*7c478bd9Sstevel@tonic-gate if (flags & PR_ASLEEP) { 275*7c478bd9Sstevel@tonic-gate if ((flags & ~PR_ASLEEP) != 0) 276*7c478bd9Sstevel@tonic-gate (void) printf("|"); 277*7c478bd9Sstevel@tonic-gate (void) printf("ASLEEP"); 278*7c478bd9Sstevel@tonic-gate } 279*7c478bd9Sstevel@tonic-gate if (psp->pr_syscall && !(arg->pflags & PR_ISSYS)) { 280*7c478bd9Sstevel@tonic-gate uint_t i; 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate (void) printf(" %s(", 283*7c478bd9Sstevel@tonic-gate proc_sysname(psp->pr_syscall, buf, sizeof (buf))); 284*7c478bd9Sstevel@tonic-gate for (i = 0; i < psp->pr_nsysarg; i++) { 285*7c478bd9Sstevel@tonic-gate if (i != 0) 286*7c478bd9Sstevel@tonic-gate (void) printf(","); 287*7c478bd9Sstevel@tonic-gate (void) printf("0x%lx", psp->pr_sysarg[i]); 288*7c478bd9Sstevel@tonic-gate } 289*7c478bd9Sstevel@tonic-gate (void) printf(")"); 290*7c478bd9Sstevel@tonic-gate } 291*7c478bd9Sstevel@tonic-gate } 292*7c478bd9Sstevel@tonic-gate (void) printf("\n"); 293*7c478bd9Sstevel@tonic-gate 294*7c478bd9Sstevel@tonic-gate if (flags & PR_STOPPED) { 295*7c478bd9Sstevel@tonic-gate (void) printf("\twhy = %s", prwhy(psp->pr_why)); 296*7c478bd9Sstevel@tonic-gate if (psp->pr_why != PR_REQUESTED && 297*7c478bd9Sstevel@tonic-gate psp->pr_why != PR_SUSPENDED) 298*7c478bd9Sstevel@tonic-gate (void) printf(" what = %s", 299*7c478bd9Sstevel@tonic-gate prwhat(psp->pr_why, psp->pr_what)); 300*7c478bd9Sstevel@tonic-gate (void) printf("\n"); 301*7c478bd9Sstevel@tonic-gate } 302*7c478bd9Sstevel@tonic-gate 303*7c478bd9Sstevel@tonic-gate sighold = *((uint32_t *)&psp->pr_lwphold); 304*7c478bd9Sstevel@tonic-gate sighold2 = *((uint32_t *)&psp->pr_lwphold + 1); 305*7c478bd9Sstevel@tonic-gate sigpend = *((uint32_t *)&psp->pr_lwppend); 306*7c478bd9Sstevel@tonic-gate sigpend2 = *((uint32_t *)&psp->pr_lwppend + 1); 307*7c478bd9Sstevel@tonic-gate cursig = psp->pr_cursig; 308*7c478bd9Sstevel@tonic-gate 309*7c478bd9Sstevel@tonic-gate if (sighold | sighold2 | sigpend | sigpend2 | cursig) { 310*7c478bd9Sstevel@tonic-gate (void) printf("\t"); 311*7c478bd9Sstevel@tonic-gate if (sighold | sighold2) { 312*7c478bd9Sstevel@tonic-gate (void) printf("sigmask = 0x%.8x,0x%.8x", 313*7c478bd9Sstevel@tonic-gate sighold, sighold2); 314*7c478bd9Sstevel@tonic-gate if (sigpend | sigpend2 | cursig) 315*7c478bd9Sstevel@tonic-gate (void) printf(" "); 316*7c478bd9Sstevel@tonic-gate } 317*7c478bd9Sstevel@tonic-gate if (sigpend | sigpend2) { 318*7c478bd9Sstevel@tonic-gate (void) printf("lwppend = 0x%.8x,0x%.8x", 319*7c478bd9Sstevel@tonic-gate sigpend, sigpend2); 320*7c478bd9Sstevel@tonic-gate if (cursig) 321*7c478bd9Sstevel@tonic-gate (void) printf(" "); 322*7c478bd9Sstevel@tonic-gate } 323*7c478bd9Sstevel@tonic-gate if (cursig) 324*7c478bd9Sstevel@tonic-gate (void) printf("cursig = %s", 325*7c478bd9Sstevel@tonic-gate proc_signame(cursig, buf, sizeof (buf))); 326*7c478bd9Sstevel@tonic-gate (void) printf("\n"); 327*7c478bd9Sstevel@tonic-gate } 328*7c478bd9Sstevel@tonic-gate 329*7c478bd9Sstevel@tonic-gate if (rflag) { 330*7c478bd9Sstevel@tonic-gate if (Pstate(Pr) == PS_DEAD || (arg->pflags & PR_STOPPED)) { 331*7c478bd9Sstevel@tonic-gate #if defined(__sparc) && defined(_ILP32) 332*7c478bd9Sstevel@tonic-gate /* 333*7c478bd9Sstevel@tonic-gate * If we're SPARC/32-bit, see if we can get extra 334*7c478bd9Sstevel@tonic-gate * register state for this lwp. If it's a v8plus 335*7c478bd9Sstevel@tonic-gate * program, print the 64-bit register values. 336*7c478bd9Sstevel@tonic-gate */ 337*7c478bd9Sstevel@tonic-gate prxregset_t prx; 338*7c478bd9Sstevel@tonic-gate 339*7c478bd9Sstevel@tonic-gate if (Plwp_getxregs(Pr, psp->pr_lwpid, &prx) == 0 && 340*7c478bd9Sstevel@tonic-gate prx.pr_type == XR_TYPE_V8P) 341*7c478bd9Sstevel@tonic-gate dumpregs_v8p(psp->pr_reg, &prx, is64); 342*7c478bd9Sstevel@tonic-gate else 343*7c478bd9Sstevel@tonic-gate #endif /* __sparc && _ILP32 */ 344*7c478bd9Sstevel@tonic-gate dumpregs(psp->pr_reg, is64); 345*7c478bd9Sstevel@tonic-gate } else 346*7c478bd9Sstevel@tonic-gate (void) printf("\tNot stopped, can't show registers\n"); 347*7c478bd9Sstevel@tonic-gate } 348*7c478bd9Sstevel@tonic-gate 349*7c478bd9Sstevel@tonic-gate return (0); 350*7c478bd9Sstevel@tonic-gate } 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate static char * 353*7c478bd9Sstevel@tonic-gate prflags(int arg) 354*7c478bd9Sstevel@tonic-gate { 355*7c478bd9Sstevel@tonic-gate static char code_buf[200]; 356*7c478bd9Sstevel@tonic-gate char *str = code_buf; 357*7c478bd9Sstevel@tonic-gate 358*7c478bd9Sstevel@tonic-gate if (arg == 0) 359*7c478bd9Sstevel@tonic-gate return ("0"); 360*7c478bd9Sstevel@tonic-gate 361*7c478bd9Sstevel@tonic-gate if (arg & ~ALLFLAGS) 362*7c478bd9Sstevel@tonic-gate (void) sprintf(str, "0x%x", arg & ~ALLFLAGS); 363*7c478bd9Sstevel@tonic-gate else 364*7c478bd9Sstevel@tonic-gate *str = '\0'; 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate /* 367*7c478bd9Sstevel@tonic-gate * Display the semi-permanent lwp flags first. 368*7c478bd9Sstevel@tonic-gate */ 369*7c478bd9Sstevel@tonic-gate if (arg & PR_DAEMON) /* daemons are always detached so */ 370*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|DAEMON"); 371*7c478bd9Sstevel@tonic-gate else if (arg & PR_DETACH) /* report detach only if non-daemon */ 372*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|DETACH"); 373*7c478bd9Sstevel@tonic-gate 374*7c478bd9Sstevel@tonic-gate if (arg & PR_STOPPED) 375*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|STOPPED"); 376*7c478bd9Sstevel@tonic-gate if (arg & PR_ISTOP) 377*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|ISTOP"); 378*7c478bd9Sstevel@tonic-gate if (arg & PR_DSTOP) 379*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|DSTOP"); 380*7c478bd9Sstevel@tonic-gate #if 0 /* displayed elsewhere */ 381*7c478bd9Sstevel@tonic-gate if (arg & PR_ASLEEP) 382*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|ASLEEP"); 383*7c478bd9Sstevel@tonic-gate #endif 384*7c478bd9Sstevel@tonic-gate if (arg & PR_PCINVAL) 385*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|PCINVAL"); 386*7c478bd9Sstevel@tonic-gate if (arg & PR_STEP) 387*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|STEP"); 388*7c478bd9Sstevel@tonic-gate if (arg & PR_AGENT) 389*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|AGENT"); 390*7c478bd9Sstevel@tonic-gate if (arg & PR_ISSYS) 391*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|ISSYS"); 392*7c478bd9Sstevel@tonic-gate if (arg & PR_VFORKP) 393*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|VFORKP"); 394*7c478bd9Sstevel@tonic-gate if (arg & PR_ORPHAN) 395*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|ORPHAN"); 396*7c478bd9Sstevel@tonic-gate if (arg & PR_FORK) 397*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|FORK"); 398*7c478bd9Sstevel@tonic-gate if (arg & PR_RLC) 399*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|RLC"); 400*7c478bd9Sstevel@tonic-gate if (arg & PR_KLC) 401*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|KLC"); 402*7c478bd9Sstevel@tonic-gate if (arg & PR_ASYNC) 403*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|ASYNC"); 404*7c478bd9Sstevel@tonic-gate if (arg & PR_BPTADJ) 405*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|BPTADJ"); 406*7c478bd9Sstevel@tonic-gate if (arg & PR_MSACCT) 407*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|MSACCT"); 408*7c478bd9Sstevel@tonic-gate if (arg & PR_MSFORK) 409*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|MSFORK"); 410*7c478bd9Sstevel@tonic-gate if (arg & PR_PTRACE) 411*7c478bd9Sstevel@tonic-gate (void) strcat(str, "|PTRACE"); 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gate if (*str == '|') 414*7c478bd9Sstevel@tonic-gate str++; 415*7c478bd9Sstevel@tonic-gate 416*7c478bd9Sstevel@tonic-gate return (str); 417*7c478bd9Sstevel@tonic-gate } 418*7c478bd9Sstevel@tonic-gate 419*7c478bd9Sstevel@tonic-gate static char * 420*7c478bd9Sstevel@tonic-gate prwhy(int why) 421*7c478bd9Sstevel@tonic-gate { 422*7c478bd9Sstevel@tonic-gate static char buf[20]; 423*7c478bd9Sstevel@tonic-gate char *str; 424*7c478bd9Sstevel@tonic-gate 425*7c478bd9Sstevel@tonic-gate switch (why) { 426*7c478bd9Sstevel@tonic-gate case PR_REQUESTED: 427*7c478bd9Sstevel@tonic-gate str = "PR_REQUESTED"; 428*7c478bd9Sstevel@tonic-gate break; 429*7c478bd9Sstevel@tonic-gate case PR_SIGNALLED: 430*7c478bd9Sstevel@tonic-gate str = "PR_SIGNALLED"; 431*7c478bd9Sstevel@tonic-gate break; 432*7c478bd9Sstevel@tonic-gate case PR_SYSENTRY: 433*7c478bd9Sstevel@tonic-gate str = "PR_SYSENTRY"; 434*7c478bd9Sstevel@tonic-gate break; 435*7c478bd9Sstevel@tonic-gate case PR_SYSEXIT: 436*7c478bd9Sstevel@tonic-gate str = "PR_SYSEXIT"; 437*7c478bd9Sstevel@tonic-gate break; 438*7c478bd9Sstevel@tonic-gate case PR_JOBCONTROL: 439*7c478bd9Sstevel@tonic-gate str = "PR_JOBCONTROL"; 440*7c478bd9Sstevel@tonic-gate break; 441*7c478bd9Sstevel@tonic-gate case PR_FAULTED: 442*7c478bd9Sstevel@tonic-gate str = "PR_FAULTED"; 443*7c478bd9Sstevel@tonic-gate break; 444*7c478bd9Sstevel@tonic-gate case PR_SUSPENDED: 445*7c478bd9Sstevel@tonic-gate str = "PR_SUSPENDED"; 446*7c478bd9Sstevel@tonic-gate break; 447*7c478bd9Sstevel@tonic-gate default: 448*7c478bd9Sstevel@tonic-gate str = buf; 449*7c478bd9Sstevel@tonic-gate (void) sprintf(str, "%d", why); 450*7c478bd9Sstevel@tonic-gate break; 451*7c478bd9Sstevel@tonic-gate } 452*7c478bd9Sstevel@tonic-gate 453*7c478bd9Sstevel@tonic-gate return (str); 454*7c478bd9Sstevel@tonic-gate } 455*7c478bd9Sstevel@tonic-gate 456*7c478bd9Sstevel@tonic-gate static char * 457*7c478bd9Sstevel@tonic-gate prwhat(int why, int what) 458*7c478bd9Sstevel@tonic-gate { 459*7c478bd9Sstevel@tonic-gate static char buf[32]; 460*7c478bd9Sstevel@tonic-gate char *str; 461*7c478bd9Sstevel@tonic-gate 462*7c478bd9Sstevel@tonic-gate switch (why) { 463*7c478bd9Sstevel@tonic-gate case PR_SIGNALLED: 464*7c478bd9Sstevel@tonic-gate case PR_JOBCONTROL: 465*7c478bd9Sstevel@tonic-gate str = proc_signame(what, buf, sizeof (buf)); 466*7c478bd9Sstevel@tonic-gate break; 467*7c478bd9Sstevel@tonic-gate case PR_SYSENTRY: 468*7c478bd9Sstevel@tonic-gate case PR_SYSEXIT: 469*7c478bd9Sstevel@tonic-gate str = proc_sysname(what, buf, sizeof (buf)); 470*7c478bd9Sstevel@tonic-gate break; 471*7c478bd9Sstevel@tonic-gate case PR_FAULTED: 472*7c478bd9Sstevel@tonic-gate str = proc_fltname(what, buf, sizeof (buf)); 473*7c478bd9Sstevel@tonic-gate break; 474*7c478bd9Sstevel@tonic-gate default: 475*7c478bd9Sstevel@tonic-gate (void) sprintf(str = buf, "%d", what); 476*7c478bd9Sstevel@tonic-gate break; 477*7c478bd9Sstevel@tonic-gate } 478*7c478bd9Sstevel@tonic-gate 479*7c478bd9Sstevel@tonic-gate return (str); 480*7c478bd9Sstevel@tonic-gate } 481*7c478bd9Sstevel@tonic-gate 482*7c478bd9Sstevel@tonic-gate #if defined(__sparc) 483*7c478bd9Sstevel@tonic-gate static const char * const regname[NPRGREG] = { 484*7c478bd9Sstevel@tonic-gate " %g0", " %g1", " %g2", " %g3", " %g4", " %g5", " %g6", " %g7", 485*7c478bd9Sstevel@tonic-gate " %o0", " %o1", " %o2", " %o3", " %o4", " %o5", " %sp", " %o7", 486*7c478bd9Sstevel@tonic-gate " %l0", " %l1", " %l2", " %l3", " %l4", " %l5", " %l6", " %l7", 487*7c478bd9Sstevel@tonic-gate " %i0", " %i1", " %i2", " %i3", " %i4", " %i5", " %fp", " %i7", 488*7c478bd9Sstevel@tonic-gate #ifdef __sparcv9 489*7c478bd9Sstevel@tonic-gate "%ccr", " %pc", "%npc", " %y", "%asi", "%fprs" 490*7c478bd9Sstevel@tonic-gate #else 491*7c478bd9Sstevel@tonic-gate "%psr", " %pc", "%npc", " %y", "%wim", "%tbr" 492*7c478bd9Sstevel@tonic-gate #endif 493*7c478bd9Sstevel@tonic-gate }; 494*7c478bd9Sstevel@tonic-gate #endif /* __sparc */ 495*7c478bd9Sstevel@tonic-gate 496*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 497*7c478bd9Sstevel@tonic-gate static const char * const regname[NPRGREG] = { 498*7c478bd9Sstevel@tonic-gate "%r15", "%r14", "%r13", "%r12", "%r11", "%r10", " %r9", " %r8", 499*7c478bd9Sstevel@tonic-gate "%rdi", "%rsi", "%rbp", "%rbx", "%rdx", "%rcx", "%rax", "%trapno", 500*7c478bd9Sstevel@tonic-gate "%err", "%rip", " %cs", "%rfl", "%rsp", " %ss", " %fs", " %gs", 501*7c478bd9Sstevel@tonic-gate " %es", " %ds", "%fsbase", "%gsbase" 502*7c478bd9Sstevel@tonic-gate }; 503*7c478bd9Sstevel@tonic-gate 504*7c478bd9Sstevel@tonic-gate static const char * const regname32[NPRGREG32] = { 505*7c478bd9Sstevel@tonic-gate " %gs", " %fs", " %es", " %ds", "%edi", "%esi", "%ebp", "%esp", 506*7c478bd9Sstevel@tonic-gate "%ebx", "%edx", "%ecx", "%eax", "%trapno", "%err", "%eip", " %cs", 507*7c478bd9Sstevel@tonic-gate "%efl", "%uesp", " %ss" 508*7c478bd9Sstevel@tonic-gate }; 509*7c478bd9Sstevel@tonic-gate 510*7c478bd9Sstevel@tonic-gate /* XX64 Do we want to expose this through libproc */ 511*7c478bd9Sstevel@tonic-gate void 512*7c478bd9Sstevel@tonic-gate prgregset_n_to_32(const prgreg_t *src, prgreg32_t *dst) 513*7c478bd9Sstevel@tonic-gate { 514*7c478bd9Sstevel@tonic-gate bzero(dst, NPRGREG32 * sizeof (prgreg32_t)); 515*7c478bd9Sstevel@tonic-gate dst[GS] = src[REG_GS]; 516*7c478bd9Sstevel@tonic-gate dst[FS] = src[REG_FS]; 517*7c478bd9Sstevel@tonic-gate dst[DS] = src[REG_DS]; 518*7c478bd9Sstevel@tonic-gate dst[ES] = src[REG_ES]; 519*7c478bd9Sstevel@tonic-gate dst[EDI] = src[REG_RDI]; 520*7c478bd9Sstevel@tonic-gate dst[ESI] = src[REG_RSI]; 521*7c478bd9Sstevel@tonic-gate dst[EBP] = src[REG_RBP]; 522*7c478bd9Sstevel@tonic-gate dst[EBX] = src[REG_RBX]; 523*7c478bd9Sstevel@tonic-gate dst[EDX] = src[REG_RDX]; 524*7c478bd9Sstevel@tonic-gate dst[ECX] = src[REG_RCX]; 525*7c478bd9Sstevel@tonic-gate dst[EAX] = src[REG_RAX]; 526*7c478bd9Sstevel@tonic-gate dst[TRAPNO] = src[REG_TRAPNO]; 527*7c478bd9Sstevel@tonic-gate dst[ERR] = src[REG_ERR]; 528*7c478bd9Sstevel@tonic-gate dst[EIP] = src[REG_RIP]; 529*7c478bd9Sstevel@tonic-gate dst[CS] = src[REG_CS]; 530*7c478bd9Sstevel@tonic-gate dst[EFL] = src[REG_RFL]; 531*7c478bd9Sstevel@tonic-gate dst[UESP] = src[REG_RSP]; 532*7c478bd9Sstevel@tonic-gate dst[SS] = src[REG_SS]; 533*7c478bd9Sstevel@tonic-gate } 534*7c478bd9Sstevel@tonic-gate 535*7c478bd9Sstevel@tonic-gate #elif defined(__i386) 536*7c478bd9Sstevel@tonic-gate static const char * const regname[NPRGREG] = { 537*7c478bd9Sstevel@tonic-gate " %gs", " %fs", " %es", " %ds", "%edi", "%esi", "%ebp", "%esp", 538*7c478bd9Sstevel@tonic-gate "%ebx", "%edx", "%ecx", "%eax", "%trapno", "%err", "%eip", " %cs", 539*7c478bd9Sstevel@tonic-gate "%efl", "%uesp", " %ss" 540*7c478bd9Sstevel@tonic-gate }; 541*7c478bd9Sstevel@tonic-gate #endif /* __i386 */ 542*7c478bd9Sstevel@tonic-gate 543*7c478bd9Sstevel@tonic-gate #if defined(__amd64) && defined(_LP64) 544*7c478bd9Sstevel@tonic-gate static void 545*7c478bd9Sstevel@tonic-gate dumpregs32(const prgregset_t reg) 546*7c478bd9Sstevel@tonic-gate { 547*7c478bd9Sstevel@tonic-gate prgregset32_t reg32; 548*7c478bd9Sstevel@tonic-gate int i; 549*7c478bd9Sstevel@tonic-gate 550*7c478bd9Sstevel@tonic-gate prgregset_n_to_32(reg, reg32); 551*7c478bd9Sstevel@tonic-gate 552*7c478bd9Sstevel@tonic-gate for (i = 0; i < NPRGREG32; i++) { 553*7c478bd9Sstevel@tonic-gate (void) printf(" %s = 0x%.8X", 554*7c478bd9Sstevel@tonic-gate regname32[i], reg32[i]); 555*7c478bd9Sstevel@tonic-gate if ((i+1) % 4 == 0) 556*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 557*7c478bd9Sstevel@tonic-gate } 558*7c478bd9Sstevel@tonic-gate if (i % 4 != 0) 559*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 560*7c478bd9Sstevel@tonic-gate } 561*7c478bd9Sstevel@tonic-gate #endif 562*7c478bd9Sstevel@tonic-gate 563*7c478bd9Sstevel@tonic-gate static void 564*7c478bd9Sstevel@tonic-gate dumpregs(const prgregset_t reg, int is64) 565*7c478bd9Sstevel@tonic-gate { 566*7c478bd9Sstevel@tonic-gate int width = is64? 16 : 8; 567*7c478bd9Sstevel@tonic-gate int cols = is64? 2 : 4; 568*7c478bd9Sstevel@tonic-gate int i; 569*7c478bd9Sstevel@tonic-gate 570*7c478bd9Sstevel@tonic-gate #if defined(__amd64) && defined(_LP64) 571*7c478bd9Sstevel@tonic-gate if (!is64) { 572*7c478bd9Sstevel@tonic-gate dumpregs32(reg); 573*7c478bd9Sstevel@tonic-gate return; 574*7c478bd9Sstevel@tonic-gate } 575*7c478bd9Sstevel@tonic-gate #endif 576*7c478bd9Sstevel@tonic-gate 577*7c478bd9Sstevel@tonic-gate for (i = 0; i < NPRGREG; i++) { 578*7c478bd9Sstevel@tonic-gate (void) printf(" %s = 0x%.*lX", 579*7c478bd9Sstevel@tonic-gate regname[i], width, (long)reg[i]); 580*7c478bd9Sstevel@tonic-gate if ((i+1) % cols == 0) 581*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 582*7c478bd9Sstevel@tonic-gate } 583*7c478bd9Sstevel@tonic-gate if (i % cols != 0) 584*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 585*7c478bd9Sstevel@tonic-gate } 586*7c478bd9Sstevel@tonic-gate 587*7c478bd9Sstevel@tonic-gate #if defined(__sparc) && defined(_ILP32) 588*7c478bd9Sstevel@tonic-gate static void 589*7c478bd9Sstevel@tonic-gate dumpregs_v8p(const prgregset_t reg, const prxregset_t *xreg, int is64) 590*7c478bd9Sstevel@tonic-gate { 591*7c478bd9Sstevel@tonic-gate static const uint32_t zero[8] = { 0 }; 592*7c478bd9Sstevel@tonic-gate int gr, xr, cols = 2; 593*7c478bd9Sstevel@tonic-gate uint64_t xval; 594*7c478bd9Sstevel@tonic-gate 595*7c478bd9Sstevel@tonic-gate if (memcmp(xreg->pr_un.pr_v8p.pr_xg, zero, sizeof (zero)) == 0 && 596*7c478bd9Sstevel@tonic-gate memcmp(xreg->pr_un.pr_v8p.pr_xo, zero, sizeof (zero)) == 0) { 597*7c478bd9Sstevel@tonic-gate dumpregs(reg, is64); 598*7c478bd9Sstevel@tonic-gate return; 599*7c478bd9Sstevel@tonic-gate } 600*7c478bd9Sstevel@tonic-gate 601*7c478bd9Sstevel@tonic-gate for (gr = R_G0, xr = XR_G0; gr <= R_G7; gr++, xr++) { 602*7c478bd9Sstevel@tonic-gate xval = (uint64_t)xreg->pr_un.pr_v8p.pr_xg[xr] << 32 | 603*7c478bd9Sstevel@tonic-gate (uint64_t)(uint32_t)reg[gr]; 604*7c478bd9Sstevel@tonic-gate (void) printf(" %s = 0x%.16" PRIX64, regname[gr], xval); 605*7c478bd9Sstevel@tonic-gate if ((gr + 1) % cols == 0) 606*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 607*7c478bd9Sstevel@tonic-gate } 608*7c478bd9Sstevel@tonic-gate 609*7c478bd9Sstevel@tonic-gate for (gr = R_O0, xr = XR_O0; gr <= R_O7; gr++, xr++) { 610*7c478bd9Sstevel@tonic-gate xval = (uint64_t)xreg->pr_un.pr_v8p.pr_xo[xr] << 32 | 611*7c478bd9Sstevel@tonic-gate (uint64_t)(uint32_t)reg[gr]; 612*7c478bd9Sstevel@tonic-gate (void) printf(" %s = 0x%.16" PRIX64, regname[gr], xval); 613*7c478bd9Sstevel@tonic-gate if ((gr + 1) % cols == 0) 614*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 615*7c478bd9Sstevel@tonic-gate } 616*7c478bd9Sstevel@tonic-gate 617*7c478bd9Sstevel@tonic-gate for (gr = R_L0; gr < NPRGREG; gr++) { 618*7c478bd9Sstevel@tonic-gate (void) printf(" %s = 0x%.8lX", 619*7c478bd9Sstevel@tonic-gate regname[gr], (long)reg[gr]); 620*7c478bd9Sstevel@tonic-gate if ((gr + 1) % cols == 0) 621*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 622*7c478bd9Sstevel@tonic-gate } 623*7c478bd9Sstevel@tonic-gate 624*7c478bd9Sstevel@tonic-gate if (gr % cols != 0) 625*7c478bd9Sstevel@tonic-gate (void) putchar('\n'); 626*7c478bd9Sstevel@tonic-gate } 627*7c478bd9Sstevel@tonic-gate #endif /* __sparc && _ILP32 */ 628