add a new code
[oota-llvm.git] / runtime / libprofile / CommonProfiling.c
index 7e9e12e42325521bba47b3c4e37b942d2f24d3ff..f37b018d9ff270d308715d7c4a313d41fd9aa570 100644 (file)
@@ -41,7 +41,7 @@ int save_arguments(int argc, const char **argv) {
      * what to do with it.
      */
     const char *Arg = argv[1];
-    memmove(&argv[1], &argv[2], (argc-2)*sizeof(char*));
+    memmove(&argv[1], &argv[2], (argc-1)*sizeof(char*));
     --argc;
 
     if (!strcmp(Arg, "-llvmprof-output")) {
@@ -49,7 +49,7 @@ int save_arguments(int argc, const char **argv) {
         puts("-llvmprof-output requires a filename argument!");
       else {
         OutputFilename = strdup(argv[1]);
-        memmove(&argv[1], &argv[2], (argc-2)*sizeof(char*));
+        memmove(&argv[1], &argv[2], (argc-1)*sizeof(char*));
         --argc;
       }
     } else {
@@ -88,7 +88,6 @@ void write_profiling_data(enum ProfilingType PT, unsigned *Start,
    * appending, creating it if it does not already exist.
    */
   if (OutFile == -1) {
-    off_t Offset;
     OutFile = open(OutputFilename, O_CREAT | O_WRONLY | O_APPEND, 0666);
     if (OutFile == -1) {
       fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",
@@ -99,7 +98,7 @@ void write_profiling_data(enum ProfilingType PT, unsigned *Start,
 
     /* Output the command line arguments to the file. */
     {
-      int PTy = Arguments;
+      int PTy = ArgumentInfo;
       int Zeros = 0;
       write(OutFile, &PTy, sizeof(int));
       write(OutFile, &SavedArgsLength, sizeof(unsigned));