[opaque pointers] Avoid the use of pointee types when parsing inline asm in IR
[oota-llvm.git] / lib / ExecutionEngine / OProfileJIT / OProfileWrapper.cpp
index d67f5370b8629744a2ddfbf8b8672698ffcb041f..04edbd2a300e72c8893542fcd19790c491f44762 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ExecutionEngine/OProfileWrapper.h"
-
-#define DEBUG_TYPE "oprofile-wrapper"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/MutexGuard.h"
-#include "llvm/ADT/SmallString.h"
-
-#include <sstream>
+#include "llvm/Support/raw_ostream.h"
 #include <cstring>
-#include <stddef.h>
 #include <dirent.h>
-#include <sys/stat.h>
 #include <fcntl.h>
+#include <sstream>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#define DEBUG_TYPE "oprofile-wrapper"
 
 namespace {
 
@@ -142,6 +142,10 @@ bool OProfileWrapper::checkForOProfileProcEntry() {
         close(CmdLineFD);
         ssize_t Idx = 0;
 
+        if (ExeName[0] != '/') {
+          BaseName = ExeName;
+        }
+
         // Find the terminator for the first string
         while (Idx < NumRead-1 && ExeName[Idx] != 0) {
           Idx++;
@@ -160,7 +164,8 @@ bool OProfileWrapper::checkForOProfileProcEntry() {
         }
 
         // Test this to see if it is the oprofile daemon
-        if (BaseName != 0 && !strcmp("oprofiled", BaseName)) {
+        if (BaseName != 0 && (!strcmp("oprofiled", BaseName) ||
+                              !strcmp("operf", BaseName))) {
           // If it is, we're done
           closedir(ProcDir);
           return true;