ia64/xen-unstable

changeset 15407:593fe08cfca2

[IA64] Many more registers displayed (through a command-line option).

Signed-off-by: Tristan Gingold <tgingold@free.fr>
Acked-by: Keir Fraser <keir@xensource.com>
author Alex Williamson <alex.williamson@hp.com>
date Thu Jun 21 16:45:41 2007 -0600 (2007-06-21)
parents 810885428743
children 6b1b119191f1
files tools/xentrace/xenctx.c
line diff
     1.1 --- a/tools/xentrace/xenctx.c	Wed Jun 20 12:49:27 2007 -0600
     1.2 +++ b/tools/xentrace/xenctx.c	Thu Jun 21 16:45:41 2007 -0600
     1.3 @@ -47,6 +47,13 @@ int stack_trace = 0;
     1.4  #elif defined (__ia64__)
     1.5  /* On ia64, we can't translate virtual address to physical address.  */
     1.6  #define NO_TRANSLATION
     1.7 +
     1.8 +/* Which registers should be displayed.  */
     1.9 +int disp_cr_regs;
    1.10 +int disp_ar_regs;
    1.11 +int disp_br_regs;
    1.12 +int disp_bank_regs;
    1.13 +int disp_tlb;
    1.14  #endif
    1.15  
    1.16  struct symbol {
    1.17 @@ -287,12 +294,12 @@ void print_ctx(vcpu_guest_context_t *ctx
    1.18  #define ITIR_PS_MAX               28
    1.19  #define RR_RID_SHIFT               8
    1.20  #define RR_RID_MASK         0xffffff
    1.21 +#define PSR_BN           (1UL << 44)
    1.22 +#define CFM_SOF_MASK            0x3f
    1.23  
    1.24 -void print_ctx(vcpu_guest_context_t *ctx1)
    1.25 +static void print_tr(int i, const struct ia64_tr_entry *tr)
    1.26  {
    1.27 -    struct vcpu_guest_context_regs *regs = &ctx1->regs;
    1.28 -    struct vcpu_tr_regs *tr = &ctx1->regs.tr;
    1.29 -    int i, ps_val, ma_val;
    1.30 +    int ps_val, ma_val;
    1.31      unsigned long pa;
    1.32  
    1.33      static const char ps[][5] = {"  4K", "  8K", " 16K", "    ",
    1.34 @@ -303,104 +310,201 @@ void print_ctx(vcpu_guest_context_t *ctx
    1.35      static const char ma[][4] = {"WB ", "   ", "   ", "   ",
    1.36                                   "UC ", "UCE", "WC ", "Nat"};
    1.37  
    1.38 -    printf(" ip:                %016lx  ", regs->ip);
    1.39 +    ps_val =  tr->itir >> ITIR_PS_SHIFT & ITIR_PS_MASK;
    1.40 +    ma_val =  tr->pte  >> PTE_MA_SHIFT  & PTE_MA_MASK;
    1.41 +    pa     = (tr->pte  >> PTE_PPN_SHIFT & PTE_PPN_MASK) << PTE_PPN_SHIFT;
    1.42 +    pa     = (pa >> ps_val) << ps_val;
    1.43 +    printf(" [%d]  %ld %06lx %016lx %013lx %02x %s %ld  %ld  %ld  %ld "
    1.44 +           "%ld %d %s %06lx\n", i,
    1.45 +           tr->pte  >> PTE_P_SHIFT    & PTE_P_MASK,
    1.46 +           tr->rid  >> RR_RID_SHIFT   & RR_RID_MASK,
    1.47 +           tr->vadr, pa, ps_val,
    1.48 +           ((ps_val >= ITIR_PS_MIN && ps_val <= ITIR_PS_MAX) ?
    1.49 +            ps[ps_val - ITIR_PS_MIN] : "    "),
    1.50 +           tr->pte  >> PTE_ED_SHIFT   & PTE_ED_MASK,
    1.51 +           tr->pte  >> PTE_PL_SHIFT   & PTE_PL_MASK,
    1.52 +           tr->pte  >> PTE_AR_SHIFT   & PTE_AR_MASK,
    1.53 +           tr->pte  >> PTE_A_SHIFT    & PTE_A_MASK,
    1.54 +           tr->pte  >> PTE_D_SHIFT    & PTE_D_MASK,
    1.55 +           ma_val, ma[ma_val],
    1.56 +           tr->itir >> ITIR_KEY_SHIFT & ITIR_KEY_MASK);
    1.57 +}
    1.58 +
    1.59 +void print_ctx(vcpu_guest_context_t *ctx)
    1.60 +{
    1.61 +    struct vcpu_guest_context_regs *regs = &ctx->regs;
    1.62 +    struct vcpu_tr_regs *tr = &ctx->regs.tr;
    1.63 +    int i;
    1.64 +    unsigned int rbs_size;
    1.65 +
    1.66 +    printf(" ip:  %016lx  ", regs->ip);
    1.67      print_symbol(regs->ip);
    1.68      printf("\n");
    1.69 -    printf(" psr:               %016lx  ", regs->psr);
    1.70 -    printf(" b0:                %016lx\n", regs->b[0]);
    1.71 -    printf(" b6:                %016lx  ", regs->b[6]);
    1.72 -    printf(" b7:                %016lx\n", regs->b[7]);
    1.73 -    printf(" cfm:               %016lx  ", regs->cfm);
    1.74 -    printf(" ar.unat:           %016lx\n", regs->ar.unat);
    1.75 -    printf(" ar.pfs:            %016lx  ", regs->ar.pfs);
    1.76 -    printf(" ar.rsc:            %016lx\n", regs->ar.rsc);
    1.77 -    printf(" ar.rnat:           %016lx  ", regs->ar.rnat);
    1.78 -    printf(" ar.bspstore:       %016lx\n", regs->ar.bspstore);
    1.79 -    printf(" ar.fpsr:           %016lx  ", regs->ar.fpsr);
    1.80 -    printf(" event_callback_ip: %016lx\n", ctx1->event_callback_ip);
    1.81 -    printf(" pr:                %016lx  ", regs->pr);
    1.82 -    /*    printf(" loadrs:            %016lx\n", regs->loadrs); */
    1.83 -    printf(" iva:               %016lx\n", regs->cr.iva);
    1.84 -    printf(" dcr:               %016lx\n", regs->cr.dcr);
    1.85 +    printf(" psr:  %016lx  ", regs->psr);
    1.86 +    printf(" cfm:  %016lx  ", regs->cfm);
    1.87 +    printf(" pr:   %016lx\n", regs->pr);
    1.88  
    1.89 +    if (disp_br_regs) {
    1.90 +        printf(" b0:   %016lx  ", regs->b[0]);
    1.91 +        printf(" b1:   %016lx  ", regs->b[1]);
    1.92 +        printf(" b2:   %016lx\n", regs->b[2]);
    1.93 +        printf(" b3:   %016lx  ", regs->b[3]);
    1.94 +        printf(" b4:   %016lx  ", regs->b[4]);
    1.95 +        printf(" b5:   %016lx\n", regs->b[5]);
    1.96 +        printf(" b6:   %016lx  ", regs->b[6]);
    1.97 +        printf(" b7:   %016lx\n", regs->b[7]);
    1.98 +    } else {
    1.99 +        printf(" b0:   %016lx\n", regs->b[0]);
   1.100 +    }
   1.101 +
   1.102 +    if (disp_cr_regs) {
   1.103 +        printf ("\n"
   1.104 +                "                                CR:\n");
   1.105 +        printf(" dcr:  %016lx  ", regs->cr.dcr);
   1.106 +        printf(" itm:  %016lx  ", regs->cr.itm);
   1.107 +        printf(" iva:  %016lx\n", regs->cr.iva);
   1.108 +        printf(" pta:  %016lx  ", regs->cr.pta);
   1.109 +        printf(" ipsr: %016lx  ", regs->cr.ipsr);
   1.110 +        printf(" isr:  %016lx\n", regs->cr.isr);
   1.111 +        printf(" iip:  %016lx  ", regs->cr.iip);
   1.112 +        printf(" ifa:  %016lx  ", regs->cr.ifa);
   1.113 +        printf(" itir: %016lx\n", regs->cr.itir);
   1.114 +        printf(" iipa: %016lx  ", regs->cr.iipa);
   1.115 +        printf(" ifs:  %016lx  ", regs->cr.ifs);
   1.116 +        printf(" iim:  %016lx\n", regs->cr.iim);
   1.117 +        printf(" iha:  %016lx  ", regs->cr.iha);
   1.118 +        printf(" lid:  %016lx  ", regs->cr.lid);
   1.119 +        printf(" ivr:  %016lx\n", regs->cr.ivr);
   1.120 +        printf(" tpr:  %016lx  ", regs->cr.tpr);
   1.121 +        printf(" eoi:  %016lx  ", regs->cr.eoi);
   1.122 +        printf(" irr0: %016lx\n", regs->cr.irr[0]);
   1.123 +        printf(" irr1: %016lx  ", regs->cr.irr[1]);
   1.124 +        printf(" irr2: %016lx  ", regs->cr.irr[2]);
   1.125 +        printf(" irr3: %016lx\n", regs->cr.irr[3]);
   1.126 +        printf(" itv:  %016lx  ", regs->cr.itv);
   1.127 +        printf(" pmv:  %016lx  ", regs->cr.pmv);
   1.128 +        printf(" cmcv: %016lx\n", regs->cr.cmcv);
   1.129 +        printf(" lrr0: %016lx  ", regs->cr.lrr0);
   1.130 +        printf(" lrr1: %016lx  ", regs->cr.lrr1);
   1.131 +        printf(" ev_cb:%016lx\n", ctx->event_callback_ip);
   1.132 +
   1.133 +    }
   1.134 +    if (disp_ar_regs) {
   1.135 +        printf ("\n"
   1.136 +                "                                AR:\n");
   1.137 +        printf(" kr0:  %016lx  ", regs->ar.kr[0]);
   1.138 +        printf(" kr1:  %016lx  ", regs->ar.kr[1]);
   1.139 +        printf(" kr2:  %016lx\n", regs->ar.kr[2]);
   1.140 +        printf(" kr3:  %016lx  ", regs->ar.kr[3]);
   1.141 +        printf(" kr4:  %016lx  ", regs->ar.kr[4]);
   1.142 +        printf(" kr5:  %016lx\n", regs->ar.kr[5]);
   1.143 +        printf(" kr6:  %016lx  ", regs->ar.kr[6]);
   1.144 +        printf(" kr7:  %016lx  ", regs->ar.kr[7]);
   1.145 +        printf(" rsc:  %016lx\n", regs->ar.rsc);
   1.146 +        printf(" bsp:  %016lx  ", regs->ar.bsp);
   1.147 +        printf(" bsps: %016lx  ", regs->ar.bspstore);
   1.148 +        printf(" rnat: %016lx\n", regs->ar.rnat);
   1.149 +        printf(" csd:  %016lx  ", regs->ar.csd);
   1.150 +        printf(" ccv:  %016lx  ", regs->ar.ccv);
   1.151 +        printf(" unat: %016lx\n", regs->ar.unat);
   1.152 +        printf(" fpsr: %016lx  ", regs->ar.fpsr);
   1.153 +        printf(" itc:  %016lx\n", regs->ar.itc);
   1.154 +        printf(" pfs:  %016lx  ", regs->ar.pfs);
   1.155 +        printf(" lc:   %016lx  ", regs->ar.lc);
   1.156 +        printf(" ec:   %016lx\n", regs->ar.ec);
   1.157 +    }
   1.158      printf("\n");
   1.159 -    printf(" r1:  %016lx\n", regs->r[1]);
   1.160 +    printf(" r1:  %016lx  ", regs->r[1]);
   1.161      printf(" r2:  %016lx  ", regs->r[2]);
   1.162      printf(" r3:  %016lx\n", regs->r[3]);
   1.163      printf(" r4:  %016lx  ", regs->r[4]);
   1.164 -    printf(" r5:  %016lx\n", regs->r[5]);
   1.165 -    printf(" r6:  %016lx  ", regs->r[6]);
   1.166 -    printf(" r7:  %016lx\n", regs->r[7]);
   1.167 +    printf(" r5:  %016lx  ", regs->r[5]);
   1.168 +    printf(" r6:  %016lx\n", regs->r[6]);
   1.169 +    printf(" r7:  %016lx  ", regs->r[7]);
   1.170      printf(" r8:  %016lx  ", regs->r[8]);
   1.171      printf(" r9:  %016lx\n", regs->r[9]);
   1.172      printf(" r10: %016lx  ", regs->r[10]);
   1.173 -    printf(" r11: %016lx\n", regs->r[11]);
   1.174 -    printf(" sp:  %016lx  ", regs->r[12]);
   1.175 -    printf(" tp:  %016lx\n", regs->r[13]);
   1.176 +    printf(" r11: %016lx  ", regs->r[11]);
   1.177 +    printf(" sp:  %016lx\n", regs->r[12]);
   1.178 +    printf(" tp:  %016lx  ", regs->r[13]);
   1.179      printf(" r14: %016lx  ", regs->r[14]);
   1.180      printf(" r15: %016lx\n", regs->r[15]);
   1.181 -    printf(" r16: %016lx  ", regs->r[16]);
   1.182 -    printf(" r17: %016lx\n", regs->r[17]);
   1.183 -    printf(" r18: %016lx  ", regs->r[18]);
   1.184 -    printf(" r19: %016lx\n", regs->r[19]);
   1.185 -    printf(" r20: %016lx  ", regs->r[20]);
   1.186 -    printf(" r21: %016lx\n", regs->r[21]);
   1.187 -    printf(" r22: %016lx  ", regs->r[22]);
   1.188 -    printf(" r23: %016lx\n", regs->r[23]);
   1.189 -    printf(" r24: %016lx  ", regs->r[24]);
   1.190 -    printf(" r25: %016lx\n", regs->r[25]);
   1.191 -    printf(" r26: %016lx  ", regs->r[26]);
   1.192 -    printf(" r27: %016lx\n", regs->r[27]);
   1.193 -    printf(" r28: %016lx  ", regs->r[28]);
   1.194 -    printf(" r29: %016lx\n", regs->r[29]);
   1.195 -    printf(" r30: %016lx  ", regs->r[30]);
   1.196 -    printf(" r31: %016lx\n", regs->r[31]);
   1.197 -    
   1.198 -    printf("\n itr: P rid    va               pa            ps      ed pl "
   1.199 -           "ar a d ma    key\n");
   1.200 -    for (i = 0; i < 8; i++) {
   1.201 -        ps_val =  tr->itrs[i].itir >> ITIR_PS_SHIFT & ITIR_PS_MASK;
   1.202 -        ma_val =  tr->itrs[i].pte  >> PTE_MA_SHIFT  & PTE_MA_MASK;
   1.203 -        pa     = (tr->itrs[i].pte  >> PTE_PPN_SHIFT & PTE_PPN_MASK) <<
   1.204 -                 PTE_PPN_SHIFT;
   1.205 -        pa     = (pa >> ps_val) << ps_val;
   1.206 -        printf(" [%d]  %ld %06lx %016lx %013lx %02x %s %ld  %ld  %ld  %ld "
   1.207 -               "%ld %d %s %06lx\n", i,
   1.208 -               tr->itrs[i].pte  >> PTE_P_SHIFT    & PTE_P_MASK,
   1.209 -               tr->itrs[i].rid  >> RR_RID_SHIFT   & RR_RID_MASK,
   1.210 -               tr->itrs[i].vadr, pa, ps_val,
   1.211 -               ((ps_val >= ITIR_PS_MIN && ps_val <= ITIR_PS_MAX) ?
   1.212 -                ps[ps_val - ITIR_PS_MIN] : "    "),
   1.213 -               tr->itrs[i].pte  >> PTE_ED_SHIFT   & PTE_ED_MASK,
   1.214 -               tr->itrs[i].pte  >> PTE_PL_SHIFT   & PTE_PL_MASK,
   1.215 -               tr->itrs[i].pte  >> PTE_AR_SHIFT   & PTE_AR_MASK,
   1.216 -               tr->itrs[i].pte  >> PTE_A_SHIFT    & PTE_A_MASK,
   1.217 -               tr->itrs[i].pte  >> PTE_D_SHIFT    & PTE_D_MASK,
   1.218 -               ma_val, ma[ma_val],
   1.219 -               tr->itrs[i].itir >> ITIR_KEY_SHIFT & ITIR_KEY_MASK);
   1.220 +    if (disp_bank_regs) {
   1.221 +        printf("      Bank %d (current)                         Bank %d\n",
   1.222 +               (regs->psr & PSR_BN) ? 1 : 0, (regs->psr & PSR_BN) ? 0 : 1);
   1.223 +        printf ("16:%016lx ", regs->r[16]);
   1.224 +        printf ("17:%016lx ", regs->r[17]);
   1.225 +        printf ("16:%016lx ", regs->bank[0]);
   1.226 +        printf ("17:%016lx\n", regs->bank[1]);
   1.227 +        printf ("18:%016lx ", regs->r[18]);
   1.228 +        printf ("19:%016lx ", regs->r[19]);
   1.229 +        printf ("18:%016lx ", regs->bank[2]);
   1.230 +        printf ("19:%016lx\n", regs->bank[3]);
   1.231 +        printf ("20:%016lx ", regs->r[20]);
   1.232 +        printf ("21:%016lx ", regs->r[21]);
   1.233 +        printf ("20:%016lx ", regs->bank[4]);
   1.234 +        printf ("21:%016lx\n", regs->bank[5]);
   1.235 +        printf ("22:%016lx ", regs->r[22]);
   1.236 +        printf ("23:%016lx ", regs->r[23]);
   1.237 +        printf ("22:%016lx ", regs->bank[6]);
   1.238 +        printf ("23:%016lx\n", regs->bank[7]);
   1.239 +        printf ("24:%016lx ", regs->r[24]);
   1.240 +        printf ("25:%016lx ", regs->r[25]);
   1.241 +        printf ("24:%016lx ", regs->bank[8]);
   1.242 +        printf ("25:%016lx\n", regs->bank[9]);
   1.243 +        printf ("26:%016lx ", regs->r[26]);
   1.244 +        printf ("27:%016lx ", regs->r[27]);
   1.245 +        printf ("26:%016lx ", regs->bank[10]);
   1.246 +        printf ("27:%016lx\n", regs->bank[11]);
   1.247 +        printf ("28:%016lx ", regs->r[28]);
   1.248 +        printf ("29:%016lx ", regs->r[29]);
   1.249 +        printf ("28:%016lx ", regs->bank[12]);
   1.250 +        printf ("29:%016lx\n", regs->bank[13]);
   1.251 +        printf ("30:%016lx ", regs->r[30]);
   1.252 +        printf ("31:%016lx ", regs->r[31]);
   1.253 +        printf ("30:%016lx ", regs->bank[14]);
   1.254 +        printf ("31:%016lx\n", regs->bank[15]);
   1.255 +    } else {
   1.256 +        printf(" r16: %016lx  ", regs->r[16]);
   1.257 +        printf(" r17: %016lx  ", regs->r[17]);
   1.258 +        printf(" r18: %016lx\n", regs->r[18]);
   1.259 +        printf(" r19: %016lx  ", regs->r[19]);
   1.260 +        printf(" r20: %016lx  ", regs->r[20]);
   1.261 +        printf(" r21: %016lx\n", regs->r[21]);
   1.262 +        printf(" r22: %016lx  ", regs->r[22]);
   1.263 +        printf(" r23: %016lx  ", regs->r[23]);
   1.264 +        printf(" r24: %016lx\n", regs->r[24]);
   1.265 +        printf(" r25: %016lx  ", regs->r[25]);
   1.266 +        printf(" r26: %016lx  ", regs->r[26]);
   1.267 +        printf(" r27: %016lx\n", regs->r[27]);
   1.268 +        printf(" r28: %016lx  ", regs->r[28]);
   1.269 +        printf(" r29: %016lx  ", regs->r[29]);
   1.270 +        printf(" r30: %016lx\n", regs->r[30]);
   1.271 +        printf(" r31: %016lx\n", regs->r[31]);
   1.272      }
   1.273 -    printf("\n dtr: P rid    va               pa            ps      ed pl "
   1.274 -           "ar a d ma    key\n");
   1.275 -    for (i = 0; i < 8; i++) {
   1.276 -        ps_val =  tr->dtrs[i].itir >> ITIR_PS_SHIFT & ITIR_PS_MASK;
   1.277 -        ma_val =  tr->dtrs[i].pte  >> PTE_MA_SHIFT  & PTE_MA_MASK;
   1.278 -        pa     = (tr->dtrs[i].pte  >> PTE_PPN_SHIFT & PTE_PPN_MASK) <<
   1.279 -                 PTE_PPN_SHIFT;
   1.280 -        pa     = (pa >> ps_val) << ps_val;
   1.281 -        printf(" [%d]  %ld %06lx %016lx %013lx %02x %s %ld  %ld  %ld  %ld "
   1.282 -               "%ld %d %s %06lx\n", i,
   1.283 -               tr->dtrs[i].pte  >> PTE_P_SHIFT    & PTE_P_MASK,
   1.284 -               tr->dtrs[i].rid  >> RR_RID_SHIFT   & RR_RID_MASK,
   1.285 -               tr->dtrs[i].vadr, pa, ps_val,
   1.286 -               ((ps_val >= ITIR_PS_MIN && ps_val <= ITIR_PS_MAX) ?
   1.287 -                ps[ps_val - ITIR_PS_MIN] : "    "),
   1.288 -               tr->dtrs[i].pte  >> PTE_ED_SHIFT   & PTE_ED_MASK,
   1.289 -               tr->dtrs[i].pte  >> PTE_PL_SHIFT   & PTE_PL_MASK,
   1.290 -               tr->dtrs[i].pte  >> PTE_AR_SHIFT   & PTE_AR_MASK,
   1.291 -               tr->dtrs[i].pte  >> PTE_A_SHIFT    & PTE_A_MASK,
   1.292 -               tr->dtrs[i].pte  >> PTE_D_SHIFT    & PTE_D_MASK,
   1.293 -               ma_val, ma[ma_val],
   1.294 -               tr->dtrs[i].itir >> ITIR_KEY_SHIFT & ITIR_KEY_MASK);
   1.295 +
   1.296 +    printf("\n");
   1.297 +    rbs_size = (regs->ar.bsp - regs->ar.bspstore) / 8;
   1.298 +    for (i = 0; i < (regs->cfm & CFM_SOF_MASK); i++) {
   1.299 +        unsigned int rbs_off = (((64 - (rbs_size % 64) - i)) / 64) + i;
   1.300 +        if (rbs_off > rbs_size)
   1.301 +            break;
   1.302 +        printf(" r%02d: %016lx%s", 32 + i,
   1.303 +               regs->rbs[rbs_size - rbs_off],
   1.304 +               (i % 3) != 2 ? "  " : "\n");
   1.305 +    }
   1.306 +    if (i && (i % 3) != 2)
   1.307 +        printf ("\n");
   1.308 +
   1.309 +    if (disp_tlb) {
   1.310 +        printf("\n itr: P rid    va               pa            ps      ed pl "
   1.311 +               "ar a d ma    key\n");
   1.312 +        for (i = 0; i < 8; i++)
   1.313 +            print_tr(i, &tr->itrs[i]);
   1.314 +        printf("\n dtr: P rid    va               pa            ps      ed pl "
   1.315 +               "ar a d ma    key\n");
   1.316 +        for (i = 0; i < 8; i++)
   1.317 +            print_tr(i, &tr->dtrs[i]);
   1.318      }
   1.319  }
   1.320  #endif
   1.321 @@ -526,9 +630,16 @@ void dump_ctx(int vcpu)
   1.322  {
   1.323      int ret;
   1.324      vcpu_guest_context_t ctx;
   1.325 +    xc_dominfo_t dominfo;
   1.326  
   1.327      xc_handle = xc_interface_open(); /* for accessing control interface */
   1.328  
   1.329 +    ret = xc_domain_getinfo(xc_handle, domid, 1, &dominfo);
   1.330 +    if (ret < 0) {
   1.331 +        perror("xc_domain_getinfo");
   1.332 +        exit(-1);
   1.333 +    }
   1.334 +    
   1.335      ret = xc_domain_pause(xc_handle, domid);
   1.336      if (ret < 0) {
   1.337          perror("xc_domain_pause");
   1.338 @@ -537,7 +648,8 @@ void dump_ctx(int vcpu)
   1.339  
   1.340      ret = xc_vcpu_getcontext(xc_handle, domid, vcpu, &ctx);
   1.341      if (ret < 0) {
   1.342 -        xc_domain_unpause(xc_handle, domid);
   1.343 +        if (!dominfo.paused)
   1.344 +            xc_domain_unpause(xc_handle, domid);
   1.345          perror("xc_vcpu_getcontext");
   1.346          exit(-1);
   1.347      }
   1.348 @@ -548,10 +660,12 @@ void dump_ctx(int vcpu)
   1.349          print_stack(&ctx, vcpu);
   1.350  #endif
   1.351  
   1.352 -    ret = xc_domain_unpause(xc_handle, domid);
   1.353 -    if (ret < 0) {
   1.354 -        perror("xc_domain_unpause");
   1.355 -        exit(-1);
   1.356 +    if (!dominfo.paused) {
   1.357 +        ret = xc_domain_unpause(xc_handle, domid);
   1.358 +        if (ret < 0) {
   1.359 +            perror("xc_domain_unpause");
   1.360 +            exit(-1);
   1.361 +        }
   1.362      }
   1.363  
   1.364      xc_interface_close(xc_handle);
   1.365 @@ -574,16 +688,28 @@ void usage(void)
   1.366      printf("  -s SYMTAB, --symbol-table=SYMTAB\n");
   1.367      printf("                    read symbol table from SYMTAB.\n");
   1.368      printf("  --stack-trace     print a complete stack trace.\n");
   1.369 +#ifdef __ia64__
   1.370 +    printf("  -r LIST, --regs=LIST  display more registers.\n");
   1.371 +    printf("  -a --all          same as --regs=tlb,cr,ar,br,bk\n");
   1.372 +#endif
   1.373  }
   1.374  
   1.375  int main(int argc, char **argv)
   1.376  {
   1.377      int ch;
   1.378 -    const char *sopts = "fs:h";
   1.379 -    const struct option lopts[] = {
   1.380 +    static const char *sopts = "fs:h"
   1.381 +#ifdef __ia64__
   1.382 +        "ar:"
   1.383 +#endif
   1.384 +        ;
   1.385 +    static const struct option lopts[] = {
   1.386          {"stack-trace", 0, NULL, 'S'},
   1.387          {"symbol-table", 1, NULL, 's'},
   1.388          {"frame-pointers", 0, NULL, 'f'},
   1.389 +#ifdef __ia64__
   1.390 +        {"regs", 1, NULL, 'r'},
   1.391 +        {"all", 0, NULL, 'a'},
   1.392 +#endif
   1.393          {"help", 0, NULL, 'h'},
   1.394          {0, 0, 0, 0}
   1.395      };
   1.396 @@ -602,6 +728,39 @@ int main(int argc, char **argv)
   1.397          case 'S':
   1.398              stack_trace = 1;
   1.399              break;
   1.400 +#ifdef __ia64__
   1.401 +        case 'r':
   1.402 +            {
   1.403 +                char *r;
   1.404 +
   1.405 +                r = strtok(optarg, ",");
   1.406 +                while (r) {
   1.407 +                    if (strcmp (r, "cr") == 0)
   1.408 +                        disp_cr_regs = 1;
   1.409 +                    else if (strcmp (r, "ar") == 0)
   1.410 +                        disp_ar_regs = 1;
   1.411 +                    else if (strcmp (r, "br") == 0)
   1.412 +                        disp_br_regs = 1;
   1.413 +                    else if (strcmp (r, "bk") == 0)
   1.414 +                        disp_bank_regs = 1;
   1.415 +                    else if (strcmp (r, "tlb") == 0)
   1.416 +                        disp_tlb = 1;
   1.417 +                    else {
   1.418 +                        fprintf(stderr,"unknown register set %s\n", r);
   1.419 +                        exit(-1);
   1.420 +                    }
   1.421 +                    r = strtok(NULL, "'");
   1.422 +                }
   1.423 +            }
   1.424 +            break;
   1.425 +        case 'a':
   1.426 +            disp_cr_regs = 1;
   1.427 +            disp_ar_regs = 1;
   1.428 +            disp_br_regs = 1;
   1.429 +            disp_bank_regs = 1;
   1.430 +            disp_tlb = 1;
   1.431 +            break;
   1.432 +#endif
   1.433          case 'h':
   1.434              usage();
   1.435              exit(-1);