|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 03/12] xenctx: Output ascii version of stack also.
>>> On 06.11.13 at 21:08, Don Slutz <dslutz@xxxxxxxxxxx> wrote:
Why? I personally don't see a need - there's rarely much useful
ASCII data on the stack. So afaic: If at all, then only via command
line option defaulting to off.
Jan
> From: Don Slutz <Don@xxxxxxxxxxxxxxx>
>
> Signed-off-by: Don Slutz <Don@xxxxxxxxxxxxxxx>
> ---
> tools/xentrace/xenctx.c | 27 ++++++++++++++++++++++++++-
> 1 files changed, 26 insertions(+), 1 deletions(-)
>
> diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
> index 06a8850..dabce16 100644
> --- a/tools/xentrace/xenctx.c
> +++ b/tools/xentrace/xenctx.c
> @@ -640,6 +640,8 @@ static int print_code(vcpu_guest_context_any_t *ctx, int
> vcpu)
> return 0;
> }
>
> +#define BYTES_PER_LINE 32
> +
> static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
> {
> guest_word_t stack = stack_pointer(ctx);
> @@ -647,6 +649,8 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int
> vcpu, int width)
> guest_word_t frame;
> guest_word_t word;
> guest_word_t *p;
> + guest_word_t ascii[BYTES_PER_LINE/4];
> + unsigned char *bytep;
> int i;
>
> stack_limit = ((stack_pointer(ctx) + XC_PAGE_SIZE)
> @@ -656,15 +660,36 @@ static int print_stack(vcpu_guest_context_any_t *ctx,
> int vcpu, int width)
> printf("\n");
> printf("Stack:\n");
> for (i=1; i<10 && stack < stack_limit; i++) {
> - while(stack < stack_limit && stack < stack_pointer(ctx) + i*32) {
> + int j = 0;
> + int k;
> +
> + while(stack < stack_limit && stack < stack_pointer(ctx) +
> i*BYTES_PER_LINE) {
> p = map_page(ctx, vcpu, stack);
> if (!p)
> return -1;
> word = read_stack_word(p, width);
> + ascii[j++] = word;
> printf(" ");
> print_stack_word(word, width);
> stack += width;
> }
> + printf(" ");
> + for (k = j; k < BYTES_PER_LINE/width; k++)
> + printf("%s ", width == 8
> + ? " "
> + : " ");
> + for (k = 0; k < j; k++) {
> + int l;
> +
> + bytep = (unsigned char*)&ascii[k];
> + for (l = 0; l < width; l++) {
> + if ((*bytep < 127) && (*bytep >= 32))
> + printf("%c", *bytep);
> + else
> + printf(".");
> + bytep++;
> + }
> + }
> printf("\n");
> }
> printf("\n");
> --
> 1.7.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |