summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectThread.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-09-22 04:58:26 +0000
committerGreg Clayton <gclayton@apple.com>2011-09-22 04:58:26 +0000
commitc14ee32db561671a16759c8307d5391646cb87c4 (patch)
tree33eea53e3b30461a2452c79eca2e668aa9537500 /lldb/source/Commands/CommandObjectThread.cpp
parent3d10b95bf7f72dd7abbb1bb6a8412708a579d315 (diff)
downloadbcm5719-llvm-c14ee32db561671a16759c8307d5391646cb87c4.tar.gz
bcm5719-llvm-c14ee32db561671a16759c8307d5391646cb87c4.zip
Converted the lldb_private::Process over to use the intrusive
shared pointers. Changed the ExecutionContext over to use shared pointers for the target, process, thread and frame since these objects can easily go away at any time and any object that was holding onto an ExecutionContext was running the risk of using a bad object. Now that the shared pointers for target, process, thread and frame are just a single pointer (they all use the instrusive shared pointers) the execution context is much safer and still the same size. Made the shared pointers in the the ExecutionContext class protected and made accessors for all of the various ways to get at the pointers, references, and shared pointers. llvm-svn: 140298
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 292b963ab2a..68de8724eb6 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -163,13 +163,14 @@ public:
if (command.GetArgumentCount() == 0)
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- if (exe_ctx.thread)
+ Thread *thread = exe_ctx.GetThreadPtr();
+ if (thread)
{
// Thread::GetStatus() returns the number of frames shown.
- if (exe_ctx.thread->GetStatus (strm,
- m_options.m_start,
- m_options.m_count,
- num_frames_with_source))
+ if (thread->GetStatus (strm,
+ m_options.m_start,
+ m_options.m_count,
+ num_frames_with_source))
{
result.SetStatus (eReturnStatusSuccessFinishResult);
}
@@ -182,7 +183,7 @@ public:
}
else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
uint32_t num_threads = process->GetThreadList().GetSize();
for (uint32_t i = 0; i < num_threads; i++)
{
@@ -205,7 +206,7 @@ public:
else
{
uint32_t num_args = command.GetArgumentCount();
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
std::vector<ThreadSP> thread_sps;
for (uint32_t i = 0; i < num_args; i++)
@@ -398,7 +399,7 @@ public:
CommandReturnObject &result
)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
bool synchronous_execution = m_interpreter.GetSynchronous();
if (process == NULL)
@@ -639,7 +640,7 @@ public:
return false;
}
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("no process exists. Cannot continue");
@@ -903,7 +904,7 @@ public:
return false;
}
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("need a valid process to step");
@@ -1125,7 +1126,7 @@ public:
CommandReturnObject &result
)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("no process");
@@ -1198,18 +1199,19 @@ public:
Stream &strm = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- if (exe_ctx.process)
+ Process *process = exe_ctx.GetProcessPtr();
+ if (process)
{
const bool only_threads_with_stop_reason = false;
const uint32_t start_frame = 0;
const uint32_t num_frames = 0;
const uint32_t num_frames_with_source = 0;
- exe_ctx.process->GetStatus(strm);
- exe_ctx.process->GetThreadStatus (strm,
- only_threads_with_stop_reason,
- start_frame,
- num_frames,
- num_frames_with_source);
+ process->GetStatus(strm);
+ process->GetThreadStatus (strm,
+ only_threads_with_stop_reason,
+ start_frame,
+ num_frames,
+ num_frames_with_source);
}
else
{
OpenPOWER on IntegriCloud