summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-02-16 18:12:04 +0000
committerPavel Labath <labath@google.com>2017-02-16 18:12:04 +0000
commit7278496ccf9390e10ce962636ef7270fb4007709 (patch)
treeefbea67a9df008ebceb6820d587b02a14c3c3977 /lldb/source/Plugins/Process/Linux
parent72ba21091659db390550ec1597dccccfd4955941 (diff)
downloadbcm5719-llvm-7278496ccf9390e10ce962636ef7270fb4007709.tar.gz
bcm5719-llvm-7278496ccf9390e10ce962636ef7270fb4007709.zip
NPL: Fix single step workaround
While refactoring the code in r293046 I made a very basic error - relying on destructor side-effects of a copyable object. Fix that and make the object non-copyable. This fixes the tests on the platforms that need this workaround, but unfortunately we don't have a way to make a more platform-agnostic test right now. llvm-svn: 295345
Diffstat (limited to 'lldb/source/Plugins/Process/Linux')
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeThreadLinux.h2
-rw-r--r--lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp8
-rw-r--r--lldb/source/Plugins/Process/Linux/SingleStepCheck.h13
3 files changed, 13 insertions, 10 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
index 5c4bbc46400..cc03a1fbb62 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -102,7 +102,7 @@ private:
std::string m_stop_description;
using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
WatchpointIndexMap m_watchpoint_index_map;
- llvm::Optional<SingleStepWorkaround> m_step_workaround;
+ std::unique_ptr<SingleStepWorkaround> m_step_workaround;
};
typedef std::shared_ptr<NativeThreadLinux> NativeThreadLinuxSP;
diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp
index de95ca0ceb4..48943d6ac93 100644
--- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp
+++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp
@@ -139,13 +139,13 @@ bool WorkaroundNeeded() {
} // end anonymous namespace
-llvm::Optional<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) {
+std::unique_ptr<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) {
Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD);
static bool workaround_needed = WorkaroundNeeded();
if (!workaround_needed) {
LLDB_LOG(log, "workaround for thread {0} not needed", tid);
- return llvm::None;
+ return nullptr;
}
cpu_set_t original_set;
@@ -153,7 +153,7 @@ llvm::Optional<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) {
// This should really not fail. But, just in case...
LLDB_LOG(log, "Unable to get cpu affinity for thread {0}: {1}", tid,
Error(errno, eErrorTypePOSIX));
- return llvm::None;
+ return nullptr;
}
cpu_set_t set;
@@ -168,7 +168,7 @@ llvm::Optional<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) {
}
LLDB_LOG(log, "workaround for thread {0} prepared", tid);
- return SingleStepWorkaround(tid, original_set);
+ return llvm::make_unique<SingleStepWorkaround>(tid, original_set);
}
SingleStepWorkaround::~SingleStepWorkaround() {
diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.h b/lldb/source/Plugins/Process/Linux/SingleStepCheck.h
index b8d4fab92cf..afeda731034 100644
--- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.h
+++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.h
@@ -10,8 +10,8 @@
#ifndef liblldb_SingleStepCheck_H_
#define liblldb_SingleStepCheck_H_
-#include "sched.h"
-#include "llvm/ADT/Optional.h"
+#include <memory>
+#include <sched.h>
#include <sys/types.h>
namespace lldb_private {
@@ -32,18 +32,21 @@ class SingleStepWorkaround {
::pid_t m_tid;
cpu_set_t m_original_set;
+ SingleStepWorkaround(const SingleStepWorkaround &) = delete;
+ void operator=(const SingleStepWorkaround &) = delete;
+
public:
SingleStepWorkaround(::pid_t tid, cpu_set_t original_set)
: m_tid(tid), m_original_set(original_set) {}
~SingleStepWorkaround();
- static llvm::Optional<SingleStepWorkaround> Get(::pid_t tid);
+ static std::unique_ptr<SingleStepWorkaround> Get(::pid_t tid);
};
#else
class SingleStepWorkaround {
public:
- static llvm::Optional<SingleStepWorkaround> Get(::pid_t tid) {
- return llvm::None;
+ static std::unique_ptr<SingleStepWorkaround> Get(::pid_t tid) {
+ return nullptr;
}
};
#endif
OpenPOWER on IntegriCloud