[Lldb-commits] [lldb] r127825 - in /lldb/trunk: include/lldb/Expression/ClangFunction.h lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme source/Expression/ClangFunction.cpp source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
Jim Ingham
jingham at apple.com
Thu Mar 17 13:02:56 PDT 2011
Author: jingham
Date: Thu Mar 17 15:02:56 2011
New Revision: 127825
URL: http://llvm.org/viewvc/llvm-project?rev=127825&view=rev
Log:
Get ObjC stepping working again when the process is not the default host architecture.
Modified:
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=127825&r1=127824&r2=127825&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Thu Mar 17 15:02:56 2011
@@ -71,8 +71,8 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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 @@
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.
Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=127825&r1=127824&r2=127825&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Thu Mar 17 15:02:56 2011
@@ -76,7 +76,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
- launchStyle = "0"
+ launchStyle = "1"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
<BuildableProductRunnable>
Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=127825&r1=127824&r2=127825&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Thu Mar 17 15:02:56 2011
@@ -50,13 +50,12 @@
//----------------------------------------------------------------------
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 @@
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 @@
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 @@
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 @@
if (!process)
return false;
+
+ if (process != m_jit_process_sp.get())
+ return false;
if (!m_compiled)
return false;
@@ -293,6 +292,9 @@
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 @@
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);
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=127825&r1=127824&r2=127825&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Thu Mar 17 15:02:56 2011
@@ -111,7 +111,7 @@
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,
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=127825&r1=127824&r2=127825&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Thu Mar 17 15:02:56 2011
@@ -819,7 +819,7 @@
// 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,
More information about the lldb-commits
mailing list