diff options
author | Jason Molenda <jmolenda@apple.com> | 2014-03-29 18:54:20 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2014-03-29 18:54:20 +0000 |
commit | a332978b2ab53306acdef10858c7e954e605ab37 (patch) | |
tree | db0802288ce9a50156d440b82ae606eae60cf129 /lldb/source/Expression/ExpressionSourceCode.cpp | |
parent | 61e595be4dcd9e63bc3a2b6787ffb647457969cd (diff) | |
download | llvm-a332978b2ab53306acdef10858c7e954e605ab37.zip llvm-a332978b2ab53306acdef10858c7e954e605ab37.tar.gz llvm-a332978b2ab53306acdef10858c7e954e605ab37.tar.bz2 |
lldb arm64 import.
These changes were written by Greg Clayton, Jim Ingham, Jason Molenda.
It builds cleanly against TOT llvm with xcodebuild. I updated the
cmake files by visual inspection but did not try a build. I haven't
built these sources on any non-Mac platforms - I don't think this
patch adds any code that requires darwin, but please let me know if
I missed something.
In debugserver, MachProcess.cpp and MachTask.cpp were renamed to
MachProcess.mm and MachTask.mm as they picked up some new Objective-C
code needed to launch processes when running on iOS.
llvm-svn: 205113
Diffstat (limited to 'lldb/source/Expression/ExpressionSourceCode.cpp')
-rw-r--r-- | lldb/source/Expression/ExpressionSourceCode.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp index aef3b9e..c79a2d7 100644 --- a/lldb/source/Expression/ExpressionSourceCode.cpp +++ b/lldb/source/Expression/ExpressionSourceCode.cpp @@ -10,6 +10,9 @@ #include "lldb/Expression/ExpressionSourceCode.h" #include "lldb/Core/StreamString.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Platform.h" +#include "lldb/Target/Target.h" using namespace lldb_private; @@ -25,7 +28,6 @@ ExpressionSourceCode::g_expression_prefix = R"( #define nil (__null) #define YES ((BOOL)1) #define NO ((BOOL)0) -typedef signed char BOOL; typedef signed __INT8_TYPE__ int8_t; typedef unsigned __INT8_TYPE__ uint8_t; typedef signed __INT16_TYPE__ int16_t; @@ -42,8 +44,29 @@ typedef unsigned short unichar; )"; -bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method) const +bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method, ExecutionContext &exe_ctx) const { + const char *target_specific_defines = "typedef signed char BOOL;\n"; + static ConstString g_platform_ios_simulator ("PlatformiOSSimulator"); + + if (Target *target = exe_ctx.GetTargetPtr()) + { + if (target->GetArchitecture().GetMachine() == llvm::Triple::arm64) + { + target_specific_defines = "typedef bool BOOL;\n"; + } + if (target->GetArchitecture().GetMachine() == llvm::Triple::x86_64) + { + if (lldb::PlatformSP platform_sp = target->GetPlatform()) + { + if (platform_sp->GetPluginName() == g_platform_ios_simulator) + { + target_specific_defines = "typedef bool BOOL;\n"; + } + } + } + } + if (m_wrap) { switch (wrapping_language) @@ -65,12 +88,14 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi case lldb::eLanguageTypeC: wrap_stream.Printf("%s \n" "%s \n" + "%s \n" "void \n" "%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" "} \n", g_expression_prefix, + target_specific_defines, m_prefix.c_str(), m_name.c_str(), m_body.c_str()); @@ -78,12 +103,14 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi case lldb::eLanguageTypeC_plus_plus: wrap_stream.Printf("%s \n" "%s \n" + "%s \n" "void \n" "$__lldb_class::%s(void *$__lldb_arg) %s\n" "{ \n" " %s; \n" "} \n", g_expression_prefix, + target_specific_defines, m_prefix.c_str(), m_name.c_str(), (const_object ? "const" : ""), @@ -94,6 +121,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi { wrap_stream.Printf("%s \n" "%s \n" + "%s \n" "@interface $__lldb_objc_class ($__lldb_category) \n" "+(void)%s:(void *)$__lldb_arg; \n" "@end \n" @@ -104,6 +132,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi "} \n" "@end \n", g_expression_prefix, + target_specific_defines, m_prefix.c_str(), m_name.c_str(), m_name.c_str(), @@ -113,6 +142,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi { wrap_stream.Printf("%s \n" "%s \n" + "%s \n" "@interface $__lldb_objc_class ($__lldb_category) \n" "-(void)%s:(void *)$__lldb_arg; \n" "@end \n" @@ -123,6 +153,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi "} \n" "@end \n", g_expression_prefix, + target_specific_defines, m_prefix.c_str(), m_name.c_str(), m_name.c_str(), |