Index: include/lldb/Core/ArchSpec.h =================================================================== --- include/lldb/Core/ArchSpec.h +++ include/lldb/Core/ArchSpec.h @@ -298,6 +298,15 @@ GetClangTargetCPU (); //------------------------------------------------------------------ + /// Returns a string representing current ABI + /// + /// @return A string representing target ABI for the current + /// architecture + //----------------------------------------------------------------- + std::string + GetClangTargetABI (); + + //------------------------------------------------------------------ /// Clears the object state. /// /// Clears the object state back to a default invalid state. Index: source/Core/ArchSpec.cpp =================================================================== --- source/Core/ArchSpec.cpp +++ source/Core/ArchSpec.cpp @@ -505,6 +505,31 @@ } std::string +ArchSpec::GetClangTargetABI () +{ std::string abi; + const llvm::Triple::ArchType machine = GetMachine(); + + if (machine == llvm::Triple::mips || + machine == llvm::Triple::mipsel || + machine == llvm::Triple::mips64 || + machine == llvm::Triple::mips64el) + { + switch (GetFlags () & eMIPSABI_mask) + { + case eMIPSABI_N64: + abi = "n64"; break; + case eMIPSABI_N32: + abi = "n32"; break; + case eMIPSABI_O32: + abi = "o32"; break; + default: + break; + } + } + return abi; +} + +std::string ArchSpec::GetClangTargetCPU () { std::string cpu; Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -268,6 +268,7 @@ bool overridden_target_opts = false; lldb_private::LanguageRuntime *lang_rt = nullptr; lldb::TargetSP target_sp; + std::string abi; if (exe_scope) target_sp = exe_scope->CalculateTarget(); @@ -333,6 +334,11 @@ // This will be empty for any CPU that doesn't really need to make a special CPU string. m_compiler->getTargetOpts().CPU = target_arch.GetClangTargetCPU(); + // Set the target ABI + abi = target_arch.GetClangTargetABI(); + if (!abi.empty()) + m_compiler->getTargetOpts().ABI=abi; + // 3. Now allow the runtime to provide custom configuration options for the target. // In this case, a specialized language runtime is available and we can query it for extra options. // For 99% of use cases, this will not be needed and should be provided when basic platform detection is not enough.