From: Ian Campbell Subject: Re: [PATCH v2 07/12] xenctx: Add stack addr to call trace. Date: Thu, 7 Nov 2013 12:50:10 +0000 Message-ID: <1383828610.32399.32.camel@kazak.uk.xensource.com> References: <1383768500-4245-1-git-send-email-dslutz@terremark.com> <1383768500-4245-8-git-send-email-dslutz@terremark.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383768500-4245-8-git-send-email-dslutz@terremark.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Don Slutz Cc: Stefano Stabellini , George Dunlap , Don Slutz , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich List-Id: xen-devel@lists.xenproject.org On Wed, 2013-11-06 at 15:08 -0500, Don Slutz wrote: > From: Don Slutz Can you give an example of the output please. What is "stack address" is it the base of the function's stack frame perhaps? Or maybe the top? Or maybe the framepointer? > > Signed-off-by: Don Slutz > --- > 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. > 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"); > }