From 0cac4ca3916ac24ab6139d03cbfd18db9e715bfe Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 25 Nov 2014 21:00:58 +0000 Subject: Import LLDB as of upstream SVN r216948 (git 50f7fe44) This corresponds with the branchpoint for the 3.5 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL --- source/Expression/ExpressionSourceCode.cpp | 55 +++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'source/Expression/ExpressionSourceCode.cpp') diff --git a/source/Expression/ExpressionSourceCode.cpp b/source/Expression/ExpressionSourceCode.cpp index aef3b9e301e5b..080562e51e91a 100644 --- a/source/Expression/ExpressionSourceCode.cpp +++ b/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,25 +28,45 @@ 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; -typedef unsigned __INT16_TYPE__ uint16_t; -typedef signed __INT32_TYPE__ int32_t; -typedef unsigned __INT32_TYPE__ uint32_t; -typedef signed __INT64_TYPE__ int64_t; -typedef unsigned __INT64_TYPE__ uint64_t; -typedef signed __INTPTR_TYPE__ intptr_t; -typedef unsigned __INTPTR_TYPE__ uintptr_t; +typedef __INT8_TYPE__ int8_t; +typedef __UINT8_TYPE__ uint8_t; +typedef __INT16_TYPE__ int16_t; +typedef __UINT16_TYPE__ uint16_t; +typedef __INT32_TYPE__ int32_t; +typedef __UINT32_TYPE__ uint32_t; +typedef __INT64_TYPE__ int64_t; +typedef __UINT64_TYPE__ uint64_t; +typedef __INTPTR_TYPE__ intptr_t; +typedef __UINTPTR_TYPE__ uintptr_t; typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; 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::aarch64) + { + 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) @@ -64,6 +87,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi break; case lldb::eLanguageTypeC: wrap_stream.Printf("%s \n" + "%s \n" "%s \n" "void \n" "%s(void *$__lldb_arg) \n" @@ -71,12 +95,14 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi " %s; \n" "} \n", g_expression_prefix, + target_specific_defines, m_prefix.c_str(), m_name.c_str(), m_body.c_str()); break; case lldb::eLanguageTypeC_plus_plus: wrap_stream.Printf("%s \n" + "%s \n" "%s \n" "void \n" "$__lldb_class::%s(void *$__lldb_arg) %s\n" @@ -84,6 +110,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi " %s; \n" "} \n", g_expression_prefix, + target_specific_defines, m_prefix.c_str(), m_name.c_str(), (const_object ? "const" : ""), @@ -93,6 +120,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi if (static_method) { wrap_stream.Printf("%s \n" + "%s \n" "%s \n" "@interface $__lldb_objc_class ($__lldb_category) \n" "+(void)%s:(void *)$__lldb_arg; \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(), @@ -112,6 +141,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi else { wrap_stream.Printf("%s \n" + "%s \n" "%s \n" "@interface $__lldb_objc_class ($__lldb_category) \n" "-(void)%s:(void *)$__lldb_arg; \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(), -- cgit v1.2.3