If specified, output ascii version of stack also.
Here is an example:
Stack:
ffffffff80048d19 0000000000200800 ffffffff803e7801 0000000000086800 ..........
......x>......h......
0000000000000000 ffffffff80430720 ffffffff803e722f 80008e000010019c ........
.C...../r>.............
00000000ffffffff 0000000000000000 0000000000000000 0000000000200000
.......................... .....
0000000000000000 0000000000000000
................
Signed-off-by: Don Slutz <Don@xxxxxxxxxxxxxxx>
---
tools/xentrace/xenctx.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 62a8519..850e091 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -38,6 +38,7 @@ static struct xenctx {
int multiple_pages;
int bytes_per_line;
int lines;
+ int decode_as_ascii;
int all_vcpus;
int self_paused;
xc_dominfo_t dominfo;
@@ -665,6 +666,7 @@ 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[MAX_BYTES_PER_LINE/4];
int i;
if ( width )
@@ -679,6 +681,9 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int
vcpu, int width)
printf("Stack:\n");
for (i = 1; i < xenctx.lines + 1 && stack < stack_limit; i++)
{
+ int j = 0;
+ int k;
+
while ( stack < stack_limit &&
stack < stack_pointer(ctx) + i * xenctx.bytes_per_line )
{
@@ -686,10 +691,32 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int
vcpu, int width)
if ( !p )
return -1;
word = read_stack_word(p, width);
+ if ( xenctx.decode_as_ascii )
+ ascii[j++] = word;
printf(" ");
print_stack_word(word, width);
stack += width;
}
+ printf(" ");
+ if ( xenctx.decode_as_ascii )
+ {
+ for (k = j; k < xenctx.bytes_per_line / width; k++)
+ printf(" %*s", width*2, "");