summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
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
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')
-rw-r--r--lldb/source/Commands/CommandObjectArgs.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp5
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp25
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp48
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp58
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp28
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp35
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp8
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp28
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp38
13 files changed, 147 insertions, 136 deletions
diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp
index bfa1006d2f8..c0f9454b4ba 100644
--- a/lldb/source/Commands/CommandObjectArgs.cpp
+++ b/lldb/source/Commands/CommandObjectArgs.cpp
@@ -105,7 +105,7 @@ CommandObjectArgs::Execute
ConstString target_triple;
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (!process)
{
result.AppendError ("Args found no process.");
@@ -131,7 +131,7 @@ CommandObjectArgs::Execute
return false;
}
- Thread *thread = m_interpreter.GetExecutionContext ().thread;
+ Thread *thread = m_interpreter.GetExecutionContext ().GetThreadPtr();
if (!thread)
{
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index cc2051d3184..f528dfd1047 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -293,7 +293,7 @@ CommandObjectBreakpointSet::ChooseFile (Target *target, FileSpec &file, CommandR
// Then use the current stack frame's file.
if (!target->GetSourceManager().GetDefaultFileAndLine(file, default_line))
{
- StackFrame *cur_frame = m_interpreter.GetExecutionContext().frame;
+ StackFrame *cur_frame = m_interpreter.GetExecutionContext().GetFramePtr();
if (cur_frame == NULL)
{
result.AppendError ("Attempting to set breakpoint by line number alone with no selected frame.");
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index c68f54cdf25..5130a2f86be 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -803,10 +803,11 @@ CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
if (commands.GetSize() > 0)
{
- if (context->exe_ctx.target)
+ Target *target = context->exe_ctx.GetTargetPtr();
+ if (target)
{
CommandReturnObject result;
- Debugger &debugger = context->exe_ctx.target->GetDebugger();
+ Debugger &debugger = target->GetDebugger();
// Rig up the results secondary output stream to the debugger's, so the output will come out synchronously
// if the debugger is set up that way.
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 8115a87a13b..5c7b4856429 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -314,15 +314,16 @@ CommandObjectDisassemble::Execute
else
{
AddressRange range;
+ StackFrame *frame = exe_ctx.GetFramePtr();
if (m_options.frame_line)
{
- if (exe_ctx.frame == NULL)
+ if (frame == NULL)
{
result.AppendError ("Cannot disassemble around the current line without a selected frame.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
- LineEntry pc_line_entry (exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
+ LineEntry pc_line_entry (frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
if (pc_line_entry.IsValid())
{
range = pc_line_entry.range;
@@ -335,13 +336,13 @@ CommandObjectDisassemble::Execute
}
else if (m_options.cur_function)
{
- if (exe_ctx.frame == NULL)
+ if (frame == NULL)
{
result.AppendError ("Cannot disassemble around the current function without a selected frame.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
- Symbol *symbol = exe_ctx.frame->GetSymbolContext(eSymbolContextSymbol).symbol;
+ Symbol *symbol = frame->GetSymbolContext(eSymbolContextSymbol).symbol;
if (symbol)
range = symbol->GetAddressRangeRef();
}
@@ -352,13 +353,13 @@ CommandObjectDisassemble::Execute
{
if (m_options.at_pc)
{
- if (exe_ctx.frame == NULL)
+ if (frame == NULL)
{
result.AppendError ("Cannot disassemble around the current PC without a selected frame.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
- range.GetBaseAddress() = exe_ctx.frame->GetFrameCodeAddress();
+ range.GetBaseAddress() = frame->GetFrameCodeAddress();
if (m_options.num_instructions == 0)
{
// Disassembling at the PC always disassembles some number of instructions (not the whole function).
@@ -389,15 +390,15 @@ CommandObjectDisassemble::Execute
if (!range.GetBaseAddress().IsValid())
{
// The default action is to disassemble the current frame function.
- if (exe_ctx.frame)
+ if (frame)
{
- SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
+ SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
if (sc.function)
range.GetBaseAddress() = sc.function->GetAddressRange().GetBaseAddress();
else if (sc.symbol && sc.symbol->GetAddressRangePtr())
range.GetBaseAddress() = sc.symbol->GetAddressRangePtr()->GetBaseAddress();
else
- range.GetBaseAddress() = exe_ctx.frame->GetFrameCodeAddress();
+ range.GetBaseAddress() = frame->GetFrameCodeAddress();
}
if (!range.GetBaseAddress().IsValid())
@@ -431,15 +432,15 @@ CommandObjectDisassemble::Execute
if (!range.GetBaseAddress().IsValid())
{
// The default action is to disassemble the current frame function.
- if (exe_ctx.frame)
+ if (frame)
{
- SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
+ SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
if (sc.function)
range = sc.function->GetAddressRange();
else if (sc.symbol && sc.symbol->GetAddressRangePtr())
range = *sc.symbol->GetAddressRangePtr();
else
- range.GetBaseAddress() = exe_ctx.frame->GetFrameCodeAddress();
+ range.GetBaseAddress() = frame->GetFrameCodeAddress();
}
else
{
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index cd6474c658e..2bacdbbba02 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -271,7 +271,8 @@ CommandObjectExpression::EvaluateExpression
CommandReturnObject *result
)
{
- if (m_exe_ctx.target)
+ Target *target = m_exe_ctx.GetTargetPtr();
+ if (target)
{
lldb::ValueObjectSP result_valobj_sp;
@@ -283,7 +284,7 @@ CommandObjectExpression::EvaluateExpression
switch (m_options.use_dynamic)
{
case eLazyBoolCalculate:
- use_dynamic = m_exe_ctx.target->GetPreferDynamicValue();
+ use_dynamic = target->GetPreferDynamicValue();
break;
case eLazyBoolYes:
use_dynamic = lldb::eDynamicCanRunTarget;
@@ -293,34 +294,39 @@ CommandObjectExpression::EvaluateExpression
break;
}
- exe_results = m_exe_ctx.target->EvaluateExpression(expr,
- m_exe_ctx.frame,
- eExecutionPolicyOnlyWhenNeeded,
- m_options.unwind_on_error,
- keep_in_memory,
- use_dynamic,
- result_valobj_sp);
+ exe_results = target->EvaluateExpression (expr,
+ m_exe_ctx.GetFramePtr(),
+ eExecutionPolicyOnlyWhenNeeded,
+ m_options.unwind_on_error,
+ keep_in_memory,
+ use_dynamic,
+ result_valobj_sp);
if (exe_results == eExecutionInterrupted && !m_options.unwind_on_error)
{
uint32_t start_frame = 0;
uint32_t num_frames = 1;
uint32_t num_frames_with_source = 0;
- if (m_exe_ctx.thread)
+ Thread *thread = m_exe_ctx.GetThreadPtr();
+ if (thread)
{
- m_exe_ctx.thread->GetStatus (result->GetOutputStream(),
- start_frame,
- num_frames,
- num_frames_with_source);
+ thread->GetStatus (result->GetOutputStream(),
+ start_frame,
+ num_frames,
+ num_frames_with_source);
}
- else if (m_exe_ctx.process)
+ else
{
- bool only_threads_with_stop_reason = true;
- m_exe_ctx.process->GetThreadStatus (result->GetOutputStream(),
- only_threads_with_stop_reason,
- start_frame,
- num_frames,
- num_frames_with_source);
+ Process *process = m_exe_ctx.GetProcessPtr();
+ if (process)
+ {
+ bool only_threads_with_stop_reason = true;
+ process->GetThreadStatus (result->GetOutputStream(),
+ only_threads_with_stop_reason,
+ start_frame,
+ num_frames,
+ num_frames_with_source);
+ }
}
}
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 4982bfb55a4..555afc3491e 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -74,9 +74,10 @@ public:
CommandReturnObject &result)
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- if (exe_ctx.frame)
+ StackFrame *frame = exe_ctx.GetFramePtr();
+ if (frame)
{
- exe_ctx.frame->DumpUsingSettingsFormat (&result.GetOutputStream());
+ frame->DumpUsingSettingsFormat (&result.GetOutputStream());
result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
@@ -192,14 +193,15 @@ public:
CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
- if (exe_ctx.thread)
+ Thread *thread = exe_ctx.GetThreadPtr();
+ if (thread)
{
- const uint32_t num_frames = exe_ctx.thread->GetStackFrameCount();
+ const uint32_t num_frames = thread->GetStackFrameCount();
uint32_t frame_idx = UINT32_MAX;
if (m_options.relative_frame_offset != INT32_MIN)
{
// The one and only argument is a signed relative frame index
- frame_idx = exe_ctx.thread->GetSelectedFrameIndex ();
+ frame_idx = thread->GetSelectedFrameIndex ();
if (frame_idx == UINT32_MAX)
frame_idx = 0;
@@ -254,13 +256,13 @@ public:
if (frame_idx < num_frames)
{
- exe_ctx.thread->SetSelectedFrameByIndex (frame_idx);
- exe_ctx.frame = exe_ctx.thread->GetSelectedFrame ().get();
-
- if (exe_ctx.frame)
+ thread->SetSelectedFrameByIndex (frame_idx);
+ exe_ctx.SetFrameSP(thread->GetSelectedFrame ());
+ StackFrame *frame = exe_ctx.GetFramePtr();
+ if (frame)
{
bool already_shown = false;
- SymbolContext frame_sc(exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry));
+ SymbolContext frame_sc(frame->GetSymbolContext(eSymbolContextLineEntry));
if (m_interpreter.GetDebugger().GetUseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
{
already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
@@ -270,11 +272,11 @@ public:
bool show_source = !already_shown;
uint32_t source_lines_before = 3;
uint32_t source_lines_after = 3;
- if (exe_ctx.frame->GetStatus(result.GetOutputStream(),
- show_frame_info,
- show_source,
- source_lines_before,
- source_lines_after))
+ if (frame->GetStatus (result.GetOutputStream(),
+ show_frame_info,
+ show_source,
+ source_lines_before,
+ source_lines_after))
{
result.SetStatus (eReturnStatusSuccessFinishResult);
return result.Succeeded();
@@ -369,7 +371,8 @@ public:
)
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- if (exe_ctx.frame == NULL)
+ StackFrame *frame = exe_ctx.GetFramePtr();
+ if (frame == NULL)
{
result.AppendError ("you must be stopped in a valid stack frame to view frame variables.");
result.SetStatus (eReturnStatusFailed);
@@ -383,9 +386,7 @@ public:
// Be careful about the stack frame, if any summary formatter runs code, it might clear the StackFrameList
// for the thread. So hold onto a shared pointer to the frame so it stays alive.
- StackFrameSP frame_sp = exe_ctx.frame->GetSP();
-
- VariableList *variable_list = frame_sp->GetVariableList (get_file_globals);
+ VariableList *variable_list = frame->GetVariableList (get_file_globals);
VariableSP var_sp;
ValueObjectSP valobj_sp;
@@ -458,7 +459,7 @@ public:
var_sp = regex_var_list.GetVariableAtIndex (regex_idx);
if (var_sp)
{
- valobj_sp = frame_sp->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
+ valobj_sp = frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
if (valobj_sp)
{
if (m_option_variable.format != eFormatDefault)
@@ -499,11 +500,11 @@ public:
Error error;
uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember;
lldb::VariableSP var_sp;
- valobj_sp = frame_sp->GetValueForVariableExpressionPath (name_cstr,
- m_varobj_options.use_dynamic,
- expr_path_options,
- var_sp,
- error);
+ valobj_sp = frame->GetValueForVariableExpressionPath (name_cstr,
+ m_varobj_options.use_dynamic,
+ expr_path_options,
+ var_sp,
+ error);
if (valobj_sp)
{
if (m_option_variable.format != eFormatDefault)
@@ -533,8 +534,7 @@ public:
size = valobj_sp->GetByteSize();
}
uint32_t watch_type = m_option_watchpoint.watch_type;
- WatchpointLocation *wp_loc =
- exe_ctx.target->CreateWatchpointLocation(addr, size, watch_type).get();
+ WatchpointLocation *wp_loc = exe_ctx.GetTargetRef().CreateWatchpointLocation(addr, size, watch_type).get();
if (wp_loc)
{
if (var_sp && var_sp->GetDeclaration().GetFile())
@@ -613,8 +613,8 @@ public:
// Use the variable object code to make sure we are
// using the same APIs as the the public API will be
// using...
- valobj_sp = frame_sp->GetValueObjectForFrameVariable (var_sp,
- m_varobj_options.use_dynamic);
+ valobj_sp = frame->GetValueObjectForFrameVariable (var_sp,
+ m_varobj_options.use_dynamic);
if (valobj_sp)
{
if (m_option_variable.format != eFormatDefault)
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index f6a1846013d..9629c8410b6 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -351,7 +351,8 @@ public:
CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
- if (exe_ctx.target == NULL)
+ Target *target = exe_ctx.GetTargetPtr();
+ if (target == NULL)
{
result.AppendError("need at least a target to read memory");
result.SetStatus(eReturnStatusFailed);
@@ -440,9 +441,10 @@ public:
}
ConstString lookup_type_name(type_str.c_str());
- if (exe_ctx.frame)
+ StackFrame *frame = exe_ctx.GetFramePtr();
+ if (frame)
{
- sc = exe_ctx.frame->GetSymbolContext (eSymbolContextModule);
+ sc = frame->GetSymbolContext (eSymbolContextModule);
if (sc.module_sp)
{
sc.module_sp->FindTypes (sc,
@@ -454,11 +456,11 @@ public:
}
if (type_list.GetSize() == 0)
{
- exe_ctx.target->GetImages().FindTypes (sc,
- lookup_type_name,
- append,
- 1,
- type_list);
+ target->GetImages().FindTypes (sc,
+ lookup_type_name,
+ append,
+ 1,
+ type_list);
}
if (type_list.GetSize() == 0)
@@ -502,7 +504,7 @@ public:
}
else
{
- error = m_memory_options.FinalizeSettings (exe_ctx.target, m_format_options);
+ error = m_memory_options.FinalizeSettings (target, m_format_options);
}
// Look for invalid combinations of settings
@@ -562,7 +564,7 @@ public:
{
data_sp.reset (new DataBufferHeap (total_byte_size, '\0'));
Address address(NULL, addr);
- bytes_read = exe_ctx.target->ReadMemory(address, false, data_sp->GetBytes (), data_sp->GetByteSize(), error);
+ bytes_read = target->ReadMemory(address, false, data_sp->GetBytes (), data_sp->GetByteSize(), error);
if (bytes_read == 0)
{
result.AppendWarningWithFormat("Read from 0x%llx failed.\n", addr);
@@ -677,8 +679,8 @@ public:
result.SetStatus(eReturnStatusSuccessFinishResult);
DataExtractor data (data_sp,
- exe_ctx.target->GetArchitecture().GetByteOrder(),
- exe_ctx.target->GetArchitecture().GetAddressByteSize());
+ target->GetArchitecture().GetByteOrder(),
+ target->GetArchitecture().GetAddressByteSize());
assert (output_stream);
@@ -870,7 +872,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError("need a process to read memory");
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index ed6c7f9a10e..e868f27c32d 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -373,7 +373,7 @@ public:
{
Error error;
const uint32_t argc = args.GetArgumentCount();
- Target *target = m_interpreter.GetExecutionContext().target;
+ Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
if (target)
{
Module *exe_module = target->GetExecutableModulePointer();
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 314598471c1..980f9d21e94 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -174,7 +174,7 @@ public:
exe_module->GetFileSpec().GetPath(filename, sizeof(filename));
StateType state = eStateInvalid;
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process)
{
state = process->GetState();
@@ -566,7 +566,7 @@ public:
// and the target actually stopping. So even if the interpreter is set to be asynchronous, we wait for the stop
// ourselves here.
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
StateType state = eStateInvalid;
if (process)
{
@@ -828,7 +828,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
bool synchronous_execution = m_interpreter.GetSynchronous ();
if (process == NULL)
@@ -915,7 +915,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("must have a valid process in order to detach");
@@ -1025,7 +1025,7 @@ public:
TargetSP target_sp (m_interpreter.GetDebugger().GetSelectedTarget());
Error error;
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process)
{
if (process->IsAlive())
@@ -1139,7 +1139,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("must have a valid process in order to load a shared library");
@@ -1198,7 +1198,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("must have a valid process in order to load a shared library");
@@ -1275,7 +1275,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("no process to signal");
@@ -1350,7 +1350,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("no process to halt");
@@ -1412,7 +1412,7 @@ public:
Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().process;
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
{
result.AppendError ("no process to kill");
@@ -1476,18 +1476,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 = true;
const uint32_t start_frame = 0;
const uint32_t num_frames = 1;
const uint32_t num_frames_with_source = 1;
- 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
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index 730c74eed4d..73c9c8b8b9b 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -99,7 +99,7 @@ public:
if (reg_addr != LLDB_INVALID_ADDRESS)
{
Address so_reg_addr;
- if (exe_ctx.target->GetSectionLoadList().ResolveLoadAddress(reg_addr, so_reg_addr))
+ if (exe_ctx.GetTargetRef().GetSectionLoadList().ResolveLoadAddress(reg_addr, so_reg_addr))
{
strm.PutCString (" ");
so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(), Address::DumpStyleResolvedDescription);
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index aba27c14437..dae2e7b37c0 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -280,11 +280,9 @@ public:
}
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- Target *target = NULL;
+ Target *target = exe_ctx.GetTargetPtr();
- if (exe_ctx.target)
- target = exe_ctx.target;
- else
+ if (target == NULL)
target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target == NULL)
@@ -427,7 +425,7 @@ public:
{
const bool show_inlines = true;
m_breakpoint_locations.Reset (start_file, 0, show_inlines);
- SearchFilter target_search_filter (exe_ctx.target->GetSP());
+ SearchFilter target_search_filter (exe_ctx.GetTargetSP());
target_search_filter.Search (m_breakpoint_locations);
}
else
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 8347d00aa6c..995495433be 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -649,8 +649,8 @@ public:
Execute (Args& args, CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
-
- if (exe_ctx.target)
+ Target *target = exe_ctx.GetTargetPtr();
+ if (target)
{
const size_t argc = args.GetArgumentCount();
if (argc > 0)
@@ -675,21 +675,21 @@ public:
return false;
}
use_var_name = true;
- matches = exe_ctx.target->GetImages().FindGlobalVariables (regex,
- true,
- UINT32_MAX,
- variable_list);
+ matches = target->GetImages().FindGlobalVariables (regex,
+ true,
+ UINT32_MAX,
+ variable_list);
}
else
{
Error error (Variable::GetValuesForVariableExpressionPath (arg,
exe_ctx.GetBestExecutionContextScope(),
GetVariableCallback,
- exe_ctx.target,
+ target,
variable_list,
valobj_list));
-// matches = exe_ctx.target->GetImages().FindGlobalVariables (ConstString(arg),
+// matches = target->GetImages().FindGlobalVariables (ConstString(arg),
// true,
// UINT32_MAX,
// variable_list);
@@ -1170,7 +1170,7 @@ DumpCompileUnitLineTable
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table)
line_table->GetDescription (&strm,
- interpreter.GetExecutionContext().target,
+ interpreter.GetExecutionContext().GetTargetPtr(),
lldb::eDescriptionLevelBrief);
else
strm << "No line table";
@@ -1248,7 +1248,7 @@ DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module,
{
Symtab *symtab = objfile->GetSymtab();
if (symtab)
- symtab->Dump(&strm, interpreter.GetExecutionContext().target, sort_order);
+ symtab->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), sort_order);
}
}
}
@@ -1270,7 +1270,7 @@ DumpModuleSections (CommandInterpreter &interpreter, Stream &strm, Module *modul
strm << '(' << module->GetObjectName() << ')';
strm.Printf ("' (%s):\n", module->GetArchitecture().GetArchitectureName());
strm.IndentMore();
- section_list->Dump(&strm, interpreter.GetExecutionContext().target, true, UINT32_MAX);
+ section_list->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), true, UINT32_MAX);
strm.IndentLess();
}
}
@@ -1309,7 +1309,7 @@ LookupAddressInModule
lldb::addr_t addr = raw_addr - offset;
Address so_addr;
SymbolContext sc;
- Target *target = interpreter.GetExecutionContext().target;
+ Target *target = interpreter.GetExecutionContext().GetTargetPtr();
if (target && !target->GetSectionLoadList().IsEmpty())
{
if (!target->GetSectionLoadList().ResolveLoadAddress (addr, so_addr))
@@ -1394,7 +1394,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod
{
Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
strm.Indent ();
- symbol->Dump (&strm, interpreter.GetExecutionContext().target, i);
+ symbol->Dump (&strm, interpreter.GetExecutionContext().GetTargetPtr(), i);
}
strm.IndentLess ();
return num_matches;
@@ -2208,7 +2208,7 @@ public:
result.GetOutputStream(),
target->GetImages().GetModulePointerAtIndex(i),
file_spec,
- exe_ctx.process != NULL && exe_ctx.process->IsAlive()))
+ exe_ctx.GetProcessPtr() && exe_ctx.GetProcessRef().IsAlive()))
num_dumped++;
}
if (num_dumped == 0)
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