[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 11/17] xenctx: Add -d (--dump-as-stack) <daddr> option to dump memory at daddr as a stack.



On Thu, 2014-03-20 at 15:06 -0400, Don Slutz wrote:
> @@ -797,14 +796,17 @@ static int print_stack(vcpu_guest_context_any_t *ctx, 
> int vcpu, int width)
>          printf("Stack Trace:\n");
>      else
>          printf("Call Trace:\n");
> -    if ( xenctx.tag_call_trace )
> -        printf(" %*s", width*2, "");
> -    printf("%c [<", xenctx.stack_trace ? '*' : ' ');
> -    print_stack_word(instr_pointer(ctx), width);
> -    printf(">]");
> -
> -    print_symbol(instr_pointer(ctx));
> -    printf(" <--\n");
> +    if ( !xenctx.do_stack )

Why not?

> +    {
> +        if ( xenctx.tag_call_trace )
> +            printf(" %*s", width*2, "");
> +        printf("%c [<", xenctx.stack_trace ? '*' : ' ');
> +        print_stack_word(instr_pointer(ctx), width);
> +        printf(">]");
> +
> +        print_symbol(instr_pointer(ctx));
> +        printf(" <--\n");
> +    }
>      if (xenctx.frame_ptrs) {
>          stack = stack_pointer(ctx);
>          frame = frame_pointer(ctx);
> @@ -944,13 +946,19 @@ static void dump_ctx(int vcpu)
>          print_mem(&ctx, vcpu, guest_word_size, xenctx.mem_addr);
>          return;
>      }
> +    if ( xenctx.do_stack )
> +    {
> +        print_stack(&ctx, vcpu, guest_word_size, xenctx.stk_addr);
> +        return;
> +    }

It's starting to seem like print_mem and print_stack should be called
from main instead of here. In other words actually have multiple modes
instead of stuffing things in as special cases here.
> ,
> @@ -1110,6 +1121,11 @@ int main(int argc, char **argv)
>              xenctx.do_memory = 1;
>              do_default = 0;
>              break;
> +        case 'd':
> +            xenctx.stk_addr = strtoull(optarg, NULL, 0);

You can reuse mem_addr here, can't you?




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.