Skip to contentSkip to conversation

xenctx: Always show code context

PATCH New George Dunlap 1 participant 1 message Mar 25, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenctx: Always show code context

Show code context even when not in kernel mode.

tools/xentrace/xenctx.c +20 -14
diff -r 0e1449d6f231 tools/xentrace/xenctx.c
@@ -683,12 +683,30 @@
         printf(FMT_64B_WORD, word);
 }
 
+static void print_code(vcpu_guest_context_any_t *ctx, int vcpu)
+{
+    guest_word_t instr;
+    int i;
+
+    printf("Code:\n");
+    instr = instr_pointer(ctx) - 21;
+    for(i=0; i<32; i++) {
+        unsigned char *c = map_page(ctx, vcpu, instr+i);
+        if (instr+i == instr_pointer(ctx))
+            printf("<%02x> ", *c);
+        else
+            printf("%02x ", *c);
+    }
+    printf("\n");
+
+    printf("\n");
+}
+
 static void print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
 {
     guest_word_t stack = stack_pointer(ctx);
     guest_word_t stack_limit;
     guest_word_t frame;
-    guest_word_t instr;
     guest_word_t word;
     guest_word_t *p;
     int i;
@@ -707,19 +725,6 @@
         }
         printf("\n");
     }
-    printf("\n");
-
-    printf("Code:\n");
-    instr = instr_pointer(ctx) - 21;
-    for(i=0; i<32; i++) {
-        unsigned char *c = map_page(ctx, vcpu, instr+i);
-        if (instr+i == instr_pointer(ctx))
-            printf("<%02x> ", *c);
-        else
-            printf("%02x ", *c);
-    }
-    printf("\n");
-
     printf("\n");
 
     if(stack_trace)
@@ -848,6 +853,7 @@
 #endif
 
     print_ctx(&ctx);
+    print_code(&ctx, vcpu);
 #ifndef NO_TRANSLATION
     if (is_kernel_text(instr_pointer(&ctx)))
         print_stack(&ctx, vcpu, guest_word_size);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel