On 11/07/13 07:50, Ian Campbell wrote:
On Wed, 2013-11-06 at 15:08 -0500, Don Slutz wrote:
From: Don Slutz <Don@CloudSwitch.com>
Can you give an example of the output please.
Here it is (With all patches active):
dcs-xen-54:~/xen>sudo /home/don/xen/dist/install/usr/lib/xen/bin/xenctx -s /boot/System.map-2.6.18-128.el5 2
rip: ffffffff8006b2b0 default_idle+0x29
flags: 00000246 i z p
rsp: ffffffff803ddf90
rax: 0000000000000000   rcx: 0000000000000000   rdx: 0000000000000000
rbx: ffffffff8006b287   rsi: 0000000000000001   rdi: ffffffff802f0658
rbp: 0000000000086800    r8: ffffffff803dc000    r9: 000000000000003f
r10: ffff81017d2437c0   r11: 0000000000000282   r12: 0000000000000000
r13: 0000000000000000   r14: 0000000000000000   r15: 0000000000000000
  cs: 0010 @ 0000000000000000
           /ffffffff(a9b)
  ss: 0018 @ 0000000000000000
           /ffffffff(c93)
  ds: 0018 @ 0000000000000000
           /ffffffff(c93)
  es: 0018 @ 0000000000000000
           /ffffffff(c93)
  fs: 0000 @ 0000000000000000
           /ffffffff(c00)
  gs: 0000 @ ffffffff803ac000\0000000000000000 boot_cpu_pda\
           /ffffffff(c00)
Code (instr addr ffffffff8006b2b0)
65 48 8b 04 25 10 00 00 00 8b 80 38 e0 ff ff a8 08 75 04 fb f4 <eb> 01 fb 65 48 8b 04 25 10 00 00


Stack:
ffffffff803ddf90: ffffffff80048d19 0000000000200800  .......... .....
ffffffff803ddfa0: ffffffff803e7801 0000000000086800  .x>......h......
ffffffff803ddfb0: 0000000000000000 ffffffff80430720  ........ .C.....
ffffffff803ddfc0: ffffffff803e722f 80008e000010019c  /r>.............
ffffffff803ddfd0: 00000000ffffffff 0000000000000000  ................
ffffffff803ddfe0: 0000000000000000 0000000000200000  .......... .....
ffffffff803ddff0: 0000000000000000 0000000000000000  ................

Call Trace:
                   [<ffffffff8006b2b0>] default_idle+0x29 <--
ffffffff803ddf90:  [<ffffffff80048d19>] cpu_idle+0x95
ffffffff803ddfa0:  [<ffffffff803e7801>] start_kernel+0x220
ffffffff803ddfc0:  [<ffffffff803e722f>] x86_64_start_kernel+0x22f


What is "stack address" is it the base of the function's stack frame
perhaps? Or maybe the top? Or maybe the framepointer?
It is the address of the stack "word".

      
Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 tools/xentrace/xenctx.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index dcf431c..4dc6574 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -700,6 +700,9 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
         printf("Stack Trace:\n");
     else
         printf("Call Trace:\n");
+    printf("%s ", width == 8
+           ? "                "
+           : "        ");
I think this can be done as ("%*s", width*2, "") or something roughly
like that.
Will look into it.
   -Don Slutz

      
     printf("%c [<", xenctx.stack_trace ? '*' : ' ');
     print_stack_word(instr_pointer(ctx), width);
     printf(">]");
@@ -715,9 +718,10 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
                     p = map_page(ctx, vcpu, stack);
                     if (!p)
                         return -1;
-                    printf("|   ");
+                    print_stack_word(stack, width);
+                    printf(": |   ");
                     print_stack_word(read_stack_word(p, width), width);
-                    printf("   \n");
+                    printf("\n");
                     stack += width;
                 }
             } else {
@@ -729,7 +733,8 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
                 return -1;
             frame = read_stack_word(p, width);
             if (xenctx.stack_trace) {
-                printf("|-- ");
+                print_stack_word(stack, width);
+                printf(": |-- ");
                 print_stack_word(read_stack_word(p, width), width);
                 printf("\n");
             }
@@ -740,7 +745,8 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
                 if (!p)
                     return -1;
                 word = read_stack_word(p, width);
-                printf("%c [<", xenctx.stack_trace ? '|' : ' ');
+                print_stack_word(stack, width);
+                printf(": %c [<", xenctx.stack_trace ? '|' : ' ');
                 print_stack_word(word, width);
                 printf(">]");
                 print_symbol(word);
@@ -756,13 +762,15 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
                 return -1;
             word = read_stack_word(p, width);
             if (is_kernel_text(word)) {
-                printf("  [<");
+                print_stack_word(stack, width);
+                printf(":  [<");
                 print_stack_word(word, width);
                 printf(">]");
                 print_symbol(word);
                 printf("\n");
             } else if (xenctx.stack_trace) {
-                printf("    ");
+                print_stack_word(stack, width);
+                printf(":    ");
                 print_stack_word(word, width);
                 printf("\n");
             }