summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Expression/ClangFunction.h13
-rw-r--r--lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme2
-rw-r--r--lldb/source/Expression/ClangFunction.cpp44
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp2
5 files changed, 35 insertions, 28 deletions
diff --git a/lldb/include/lldb/Expression/ClangFunction.h b/lldb/include/lldb/Expression/ClangFunction.h
index 789ca395110..06222311dc4 100644
--- a/lldb/include/lldb/Expression/ClangFunction.h
+++ b/lldb/include/lldb/Expression/ClangFunction.h
@@ -71,8 +71,8 @@ public:
/// Constructor
///
/// @param[in] exe_scope
- /// An execution context scope that gets us a target and/or
- /// process (possibly neither.).
+ /// An execution context scope that gets us at least a target and
+ /// process.
///
/// @param[in] function_ptr
/// The default function to be called. Can be overridden using
@@ -85,7 +85,7 @@ public:
/// The default values to use when calling this function. Can
/// be overridden using WriteFunctionArguments().
//------------------------------------------------------------------
- ClangFunction (ExecutionContextScope *exe_scope,
+ ClangFunction (ExecutionContextScope &exe_scope,
Function &function_ptr,
ClangASTContext *ast_context,
const ValueList &arg_value_list);
@@ -94,8 +94,8 @@ public:
/// Constructor
///
/// @param[in] exe_scope
- /// An execution context scope that gets us a target and/or
- /// process (possibly neither.).
+ /// An execution context scope that gets us at least a target and
+ /// process.
///
/// @param[in] ast_context
/// The AST context to evaluate argument types in.
@@ -111,7 +111,7 @@ public:
/// The default values to use when calling this function. Can
/// be overridden using WriteFunctionArguments().
//------------------------------------------------------------------
- ClangFunction (ExecutionContextScope *exe_scope,
+ ClangFunction (ExecutionContextScope &exe_scope,
ClangASTContext *ast_context,
void *return_qualtype,
const Address& function_address,
@@ -614,7 +614,6 @@ private:
Address m_function_addr; ///< If we don't have the FunctionSP, we at least need the address & return type.
void *m_function_return_qual_type; ///< The opaque clang qual type for the function return type.
ClangASTContext *m_clang_ast_context; ///< This is the clang_ast_context that we're getting types from the and value, and the function return the function pointer is NULL.
- ArchSpec m_arch; ///< The target triple to compile the wrapper function for.
std::string m_wrapper_function_name; ///< The name of the wrapper function.
std::string m_wrapper_function_text; ///< The contents of the wrapper function.
diff --git a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
index 338a8758f9a..30249c7be2c 100644
--- a/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
+++ b/lldb/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
@@ -76,7 +76,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
- launchStyle = "0"
+ launchStyle = "1"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
<BuildableProductRunnable>
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index 53dbff4b548..c3a365763dd 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -50,13 +50,12 @@ using namespace lldb_private;
//----------------------------------------------------------------------
ClangFunction::ClangFunction
(
- ExecutionContextScope *exe_scope,
+ ExecutionContextScope &exe_scope,
ClangASTContext *ast_context,
void *return_qualtype,
const Address& functionAddress,
const ValueList &arg_value_list
) :
- m_arch (),
m_function_ptr (NULL),
m_function_addr (functionAddress),
m_function_return_qual_type(return_qualtype),
@@ -68,22 +67,20 @@ ClangFunction::ClangFunction
m_compiled (false),
m_JITted (false)
{
- if (exe_scope)
- {
- Target *target = exe_scope->CalculateTarget();
- if (target)
- m_arch = target->GetArchitecture();
- }
+ Process *process = exe_scope.CalculateProcess();
+ // Can't make a ClangFunction without a process.
+ assert (process != NULL);
+
+ m_jit_process_sp = process->GetSP();
}
ClangFunction::ClangFunction
(
- ExecutionContextScope *exe_scope,
+ ExecutionContextScope &exe_scope,
Function &function,
ClangASTContext *ast_context,
const ValueList &arg_value_list
) :
- m_arch (),
m_function_ptr (&function),
m_function_addr (),
m_function_return_qual_type (),
@@ -95,12 +92,11 @@ ClangFunction::ClangFunction
m_compiled (false),
m_JITted (false)
{
- if (exe_scope)
- {
- Target *target = exe_scope->CalculateTarget();
- if (target)
- m_arch = target->GetArchitecture();
- }
+ Process *process = exe_scope.CalculateProcess();
+ // Can't make a ClangFunction without a process.
+ assert (process != NULL);
+
+ m_jit_process_sp = process->GetSP();
m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
m_function_return_qual_type = m_function_ptr->GetReturnClangType();
@@ -225,8 +221,8 @@ ClangFunction::CompileFunction (Stream &errors)
log->Printf ("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
// Okay, now compile this expression
-
- m_parser.reset(new ClangExpressionParser(NULL, *this));
+
+ m_parser.reset(new ClangExpressionParser(m_jit_process_sp.get(), *this));
num_errors = m_parser->Parse (errors);
@@ -245,6 +241,9 @@ ClangFunction::WriteFunctionWrapper (ExecutionContext &exe_ctx, Stream &errors)
if (!process)
return false;
+
+ if (process != m_jit_process_sp.get())
+ return false;
if (!m_compiled)
return false;
@@ -293,6 +292,9 @@ ClangFunction::WriteFunctionArguments (ExecutionContext &exe_ctx,
if (process == NULL)
return return_value;
+
+ if (process != m_jit_process_sp.get())
+ return false;
if (args_addr_ref == LLDB_INVALID_ADDRESS)
{
@@ -419,6 +421,12 @@ ClangFunction::FetchFunctionResults (ExecutionContext &exe_ctx, lldb::addr_t arg
std::vector<uint8_t> data_buffer;
data_buffer.resize(m_return_size);
Process *process = exe_ctx.process;
+
+ if (process == NULL)
+ return false;
+ if (process != m_jit_process_sp.get())
+ return false;
+
Error error;
size_t bytes_read = process->ReadMemory(args_addr + m_return_offset, &data_buffer.front(), m_return_size, error);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 75eb468799c..8966ec0a82a 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -111,7 +111,7 @@ AppleObjCRuntime::GetObjectDescription (Stream &str, Value &value, ExecutionCont
ret.SetContext(Value::eContextTypeClangType, return_qualtype);
// Now we're ready to call the function:
- ClangFunction func (exe_ctx.GetBestExecutionContextScope(),
+ ClangFunction func (*exe_ctx.GetBestExecutionContextScope(),
ast_context,
return_qualtype,
*function_address,
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 93a9b8dc7b4..ba42a5de248 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -819,7 +819,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan (Thread &thread, bool sto
// Next make the runner function for our implementation utility function.
if (!m_impl_function.get())
{
- m_impl_function.reset(new ClangFunction (&thread,
+ m_impl_function.reset(new ClangFunction (thread,
clang_ast_context,
clang_void_ptr_type,
impl_code_address,
OpenPOWER on IntegriCloud