]> git.cworth.org Git - apitrace/blobdiff - cli/cli_dump_images.cpp
cli: Fix MSVC build.
[apitrace] / cli / cli_dump_images.cpp
index 0e2dd8c8b6cfaf6919253a0ffdc8b841fad1dd5e..86cf75c3e5da122a5fc4f7f0920ec13dfb7427a9 100644 (file)
@@ -29,6 +29,8 @@
 #include <string.h>
 #include <limits.h> // for CHAR_MAX
 #include <getopt.h>
+
+#include <string>
 #include <iostream>
 
 #include "os_string.hpp"
@@ -44,17 +46,20 @@ usage(void)
     std::cout << "usage apitrace dump-images [OPTIONS] TRACE_FILE\n"
               << synopsis << "\n"
         "\n"
-        "    -h, --help           show this help message and exit\n"
-        "        --calls=CALLSET  dump images only for specified calls\n"
-        "                         (default value is \"*/frame\" which\n"
-        "                          which dumps an image for each frame)\n"
-        "    -o, --output=PREFIX  prefix to use in naming output files\n"
-        "                         (default is trace filename without extension)\n"
+        "    -h, --help             show this help message and exit\n"
+        "        --calls=CALLSET    dump images only for specified calls\n"
+        "                           (default value is \"*/frame\" which\n"
+        "                            which dumps an image for each frame)\n"
+        "         --call-nos[=BOOL] use call numbers in image filenames,\n"
+        "                           otherwise use sequental numbers (default=yes)\n"
+        "    -o, --output=PREFIX    prefix to use in naming output files\n"
+        "                           (default is trace filename without extension)\n"
         "\n";
 }
 
 enum {
     CALLS_OPT = CHAR_MAX + 1,
+    CALL_NOS_OPT,
 };
 
 const static char *
@@ -64,6 +69,7 @@ const static struct option
 longOptions[] = {
     {"help", no_argument, 0, 'h'},
     {"calls", required_argument, 0, CALLS_OPT},
+    {"call-nos", optional_argument, 0, CALL_NOS_OPT},
     {"output", required_argument, 0, 'o'},
     {0, 0, 0, 0}
 };
@@ -75,6 +81,7 @@ command(int argc, char *argv[])
     const char *calls = NULL;
     const char *traceName = NULL;
     const char *output = NULL;
+    std::string call_nos;
 
     int opt;
     while ((opt = getopt_long(argc, argv, shortOptions, longOptions, NULL)) != -1) {
@@ -85,6 +92,10 @@ command(int argc, char *argv[])
         case CALLS_OPT:
             calls = optarg;
             break;
+        case CALL_NOS_OPT:
+            call_nos = "--call-nos=";
+            call_nos.append(optarg);
+            break;
         case 'o':
             output = optarg;
             break;
@@ -126,6 +137,9 @@ command(int argc, char *argv[])
         opts.push_back(calls);
     else
         opts.push_back("*/frame");
+    if (!call_nos.empty()) {
+        opts.push_back(call_nos.c_str());
+    }
 
     return executeRetrace(opts, traceName);
 }