]> xenbits.xensource.com Git - xen.git/commitdiff
xenctx: Add command line option -t (--tag-stack-dump)
authorDon Slutz <dslutz@verizon.com>
Thu, 3 Apr 2014 19:06:57 +0000 (15:06 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 4 Apr 2014 08:28:07 +0000 (09:28 +0100)
If specified, add stack address to dump.

This is not the default because the result exceeds 80 characters per line.

Here is an example:

Stack:
ffffffff803ddf90ffffffff80048d19 0000000000200800 ffffffff803e7801 0000000000086800
ffffffff803ddfb00000000000000000 ffffffff80430720 ffffffff803e722f 80008e000010019c
ffffffff803ddfd000000000ffffffff 0000000000000000 0000000000000000 0000000000200000
ffffffff803ddff00000000000000000 0000000000000000

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/xentrace/xenctx.c

index 82cf6b067ec54ed8ad5a91f73438f17cde04a3ef..145c9901db82a396b2c592c4a57910a0b179d932 100644 (file)
@@ -40,6 +40,7 @@ static struct xenctx {
     int bytes_per_line;
     int lines;
     int decode_as_ascii;
+    int tag_stack_dump;
     int all_vcpus;
     int self_paused;
     xc_dominfo_t dominfo;
@@ -689,6 +690,11 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
             int j = 0;
             int k;
 
+            if ( xenctx.tag_stack_dump )
+            {
+                print_stack_word(stack, width);
+                printf(":");
+            }
             while ( stack < stack_limit &&
                     stack < stack_pointer(ctx) + i * xenctx.bytes_per_line )
             {
@@ -901,13 +907,15 @@ static void usage(void)
     printf("                     if stack limit reached.\n");
     printf("  -D, --decode-as-ascii\n");
     printf("                     add a decode of Stack dump as ascii.\n");
+    printf("  -t, --tag-stack-dump\n");
+    printf("                     add address on each line of Stack dump.\n");
 }
 
 int main(int argc, char **argv)
 {
     int ch;
     int ret;
-    static const char *sopts = "fs:hak:SCn:b:l:D";
+    static const char *sopts = "fs:hak:SCn:b:l:Dt";
     static const struct option lopts[] = {
         {"stack-trace", 0, NULL, 'S'},
         {"symbol-table", 1, NULL, 's'},
@@ -915,6 +923,7 @@ int main(int argc, char **argv)
         {"kernel-start", 1, NULL, 'k'},
         {"display-stack-pages", 0, NULL, 'n'},
         {"decode-as-ascii", 0, NULL, 'D'},
+        {"tag-stack-dump", 0, NULL, 't'},
         {"bytes-per-line", 1, NULL, 'b'},
         {"lines", 1, NULL, 'l'},
         {"all", 0, NULL, 'a'},
@@ -957,6 +966,9 @@ int main(int argc, char **argv)
         case 'D':
             xenctx.decode_as_ascii = 1;
             break;
+        case 't':
+            xenctx.tag_stack_dump = 1;
+            break;
         case 'b':
             xenctx.bytes_per_line = strtol(optarg, NULL, 0);
             if ( xenctx.bytes_per_line < 4 ||