From 2fc5d2d1dfaf623ce4e24cd8590565902f8c557c Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 13 Feb 2016 15:01:33 +0000 Subject: Vendor import of lldb release_38 branch r260756: https://llvm.org/svn/llvm-project/lldb/branches/release_38@260756 --- source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp | 15 +++++++++++++-- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp | 15 +++++++++++++-- .../Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 21 +++++++++++++++++---- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h | 7 +++++-- source/Plugins/Platform/MacOSX/Makefile | 19 +++++++++++++++++++ 5 files changed, 67 insertions(+), 10 deletions(-) (limited to 'source/Plugins') diff --git a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp index 3c7e9495d6ce..1b77946c1d1f 100644 --- a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp +++ b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp @@ -242,16 +242,27 @@ ABISysV_mips::PrepareTrivialCall (Thread &thread, const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA); const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0); + const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0); if (log) - log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp); + log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0); + + /* Write r0 with 0, in case we are stopped in syscall, + * such setting prevents automatic decrement of the PC. + * This clears the bug 23659 for MIPS. + */ + if (!reg_ctx->WriteRegisterFromUnsigned (r0_info, (uint64_t)0)) + return false; + + if (log) + log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp); // Set "sp" to the requested value if (!reg_ctx->WriteRegisterFromUnsigned (sp_reg_info, sp)) return false; if (log) - log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr); + log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr); // Set "ra" to the return address if (!reg_ctx->WriteRegisterFromUnsigned (ra_reg_info, return_addr)) diff --git a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp index e3da3631723e..8226ef15f494 100644 --- a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp +++ b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp @@ -207,16 +207,27 @@ ABISysV_mips64::PrepareTrivialCall (Thread &thread, const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA); const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0); + const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0); if (log) - log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp); + log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0); + + /* Write r0 with 0, in case we are stopped in syscall, + * such setting prevents automatic decrement of the PC. + * This clears the bug 23659 for MIPS. + */ + if (!reg_ctx->WriteRegisterFromUnsigned (r0_info, (uint64_t)0)) + return false; + + if (log) + log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp); // Set "sp" to the requested value if (!reg_ctx->WriteRegisterFromUnsigned (sp_reg_info, sp)) return false; if (log) - log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr); + log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr); // Set "ra" to the return address if (!reg_ctx->WriteRegisterFromUnsigned (ra_reg_info, return_addr)) diff --git a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index b66244813240..ccd4400995c7 100644 --- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -169,6 +169,18 @@ ObjectFilePECOFF::MagicBytesMatch (DataBufferSP& data_sp) return magic == IMAGE_DOS_SIGNATURE; } +lldb::SymbolType +ObjectFilePECOFF::MapSymbolType(uint16_t coff_symbol_type) +{ + // TODO: We need to complete this mapping of COFF symbol types to LLDB ones. + // For now, here's a hack to make sure our function have types. + const auto complex_type = coff_symbol_type >> llvm::COFF::SCT_COMPLEX_TYPE_SHIFT; + if (complex_type == llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION) + { + return lldb::eSymbolTypeCode; + } + return lldb::eSymbolTypeInvalid; +} ObjectFilePECOFF::ObjectFilePECOFF (const lldb::ModuleSP &module_sp, DataBufferSP& data_sp, @@ -534,8 +546,8 @@ ObjectFilePECOFF::GetSymtab() { const uint32_t symbol_size = 18; const uint32_t addr_byte_size = GetAddressByteSize (); - const size_t symbol_data_size = num_syms * symbol_size; - // Include the 4 bytes string table size at the end of the symbols + const size_t symbol_data_size = num_syms * symbol_size; + // Include the 4-byte string table size at the end of the symbols DataBufferSP symtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff, symbol_data_size + 4)); DataExtractor symtab_data (symtab_data_sp, GetByteOrder(), addr_byte_size); lldb::offset_t offset = symbol_data_size; @@ -556,8 +568,8 @@ ObjectFilePECOFF::GetSymtab() coff_symbol_t symbol; const uint32_t symbol_offset = offset; const char *symbol_name_cstr = NULL; - // If the first 4 bytes of the symbol string are zero, then we - // it is followed by a 4 byte string table offset. Else these + // If the first 4 bytes of the symbol string are zero, then they + // are followed by a 4-byte string table offset. Else these // 8 bytes contain the symbol name if (symtab_data.GetU32 (&offset) == 0) { @@ -586,6 +598,7 @@ ObjectFilePECOFF::GetSymtab() { Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value); symbols[i].GetAddressRef() = symbol_addr; + symbols[i].SetType(MapSymbolType(symbol.type)); } if (symbol.naux > 0) diff --git a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index fd33cd3d32f8..44e5ee1b044b 100644 --- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -101,7 +101,10 @@ public: static bool MagicBytesMatch (lldb::DataBufferSP& data_sp); - + + static lldb::SymbolType + MapSymbolType(uint16_t coff_symbol_type); + bool ParseHeader() override; @@ -116,7 +119,7 @@ public: uint32_t GetAddressByteSize() const override; - + // virtual lldb_private::AddressClass // GetAddressClass (lldb::addr_t file_addr); diff --git a/source/Plugins/Platform/MacOSX/Makefile b/source/Plugins/Platform/MacOSX/Makefile index 3e61dc982bd6..4377d369bc19 100644 --- a/source/Plugins/Platform/MacOSX/Makefile +++ b/source/Plugins/Platform/MacOSX/Makefile @@ -8,6 +8,25 @@ ##===----------------------------------------------------------------------===## LLDB_LEVEL := ../../../.. +LEVEL := $(LLDB_LEVEL)/../.. + +include $(LEVEL)/Makefile.config + +SOURCES += PlatformDarwin.cpp \ + PlatformDarwinKernel.cpp \ + PlatformMacOSX.cpp \ + PlatformRemoteiOS.cpp \ + PlatformRemoteAppleTV.cpp \ + PlatformRemoteAppleWatch.cpp + +ifeq ($(HOST_OS),Darwin) +SOURCES += PlatformAppleSimulator.cpp \ + PlatformiOSSimulator.cpp \ + PlatformiOSSimulatorCoreSimulatorSupport.mm \ + PlatformAppleTVSimulator.cpp \ + PlatformAppleWatchSimulator.cpp +endif + LIBRARYNAME := lldbPluginPlatformMacOSX BUILD_ARCHIVE = 1 -- cgit v1.2.3