[Lldb-commits] [PATCH] D31279: Fix warnings from clang build on macOS.
brucem created this revision. https://reviews.llvm.org/D31279 Files: source/Expression/LLVMUserExpression.cpp source/Host/common/Symbols.cpp source/Host/macosx/Symbols.cpp source/Plugins/Process/Utility/DynamicRegisterInfo.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -771,7 +771,6 @@ std::string path; packet.GetHexByteString(path); if (!path.empty()) { -uint64_t a, b; StreamGDBRemote response; auto Result = llvm::sys::fs::md5_contents(path); if (!Result) { Index: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp === --- source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -281,6 +281,7 @@ // Swap "dwarf_opcode_string" over into "opcode_extractor" opcode_extractor.GetStringRef().swap(dwarf_opcode_string); uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes); + UNUSED_IF_ASSERT_DISABLED(ret_val); assert(ret_val == reg_info.dynamic_size_dwarf_len); for (j = 0; j < reg_info.dynamic_size_dwarf_len; ++j) Index: source/Host/macosx/Symbols.cpp === --- source/Host/macosx/Symbols.cpp +++ source/Host/macosx/Symbols.cpp @@ -270,6 +270,7 @@ ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && Index: source/Host/common/Symbols.cpp === --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -55,6 +55,7 @@ ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && (arch == NULL || (spec.GetArchitecturePtr() && Index: source/Expression/LLVMUserExpression.cpp === --- source/Expression/LLVMUserExpression.cpp +++ source/Expression/LLVMUserExpression.cpp @@ -49,9 +49,10 @@ const EvaluateExpressionOptions &options) : UserExpression(exe_scope, expr, prefix, language, desired_type, options), m_stack_frame_bottom(LLDB_INVALID_ADDRESS), + m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false), m_allow_objc(false), - m_stack_frame_top(LLDB_INVALID_ADDRESS), m_transformed_text(), + m_transformed_text(), m_execution_unit_sp(), m_materializer_ap(), m_jit_module_wp(), m_enforce_valid_object(true), m_in_cplusplus_method(false), m_in_objectivec_method(false), m_in_static_method(false), Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -771,7 +771,6 @@ std::string path; packet.GetHexByteString(path); if (!path.empty()) { -uint64_t a, b; StreamGDBRemote response; auto Result = llvm::sys::fs::md5_contents(path); if (!Result) { Index: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp === --- source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -281,6 +281,7 @@ // Swap "dwarf_opcode_string" over into "opcode_extractor" opcode_extractor.GetStringRef().swap(dwarf_opcode_string); uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes); + UNUSED_IF_ASSERT_DISABLED(ret_val); assert(ret_val == reg_info.dynamic_size_dwarf_len); for (j = 0; j < reg_info.dynamic_size_dwarf_len; ++j) Index: source/Host/macosx/Symbols.cpp === --- source/Host/macosx/Symbols.cpp +++ source/Host/macosx/Symbols.cpp @@ -270,6 +270,7 @@ ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUS
[Lldb-commits] [PATCH] D30457: [LLDB][MIPS] Core Dump Support
nitesh.jain updated this revision to Diff 92768. nitesh.jain added a comment. In case of MIPS, The ELFLinuxPrPsInfo.pr_uid and ELFLinuxPrPsInfo.pr_gid is always 32 bit irrespective of platforms https://reviews.llvm.org/D30457 Files: source/Core/ArchSpec.cpp source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.h source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp source/Plugins/Process/Utility/RegisterContextLinux_mips.h source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp source/Plugins/Process/Utility/RegisterContextLinux_mips64.h source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h source/Plugins/Process/elf-core/ThreadElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.h Index: source/Plugins/Process/elf-core/ThreadElfCore.h === --- source/Plugins/Process/elf-core/ThreadElfCore.h +++ source/Plugins/Process/elf-core/ThreadElfCore.h @@ -65,18 +65,7 @@ // 32 bit - hardcoded because we are reusing the struct, but some of the // members are smaller - // so the layout is not the same - static size_t GetSize(lldb_private::ArchSpec &arch) { -switch (arch.GetCore()) { -case lldb_private::ArchSpec::eCore_s390x_generic: -case lldb_private::ArchSpec::eCore_x86_64_x86_64: - return sizeof(ELFLinuxPrStatus); -case lldb_private::ArchSpec::eCore_x86_32_i386: -case lldb_private::ArchSpec::eCore_x86_32_i486: - return 72; -default: - return 0; -} - } + static size_t GetSize(lldb_private::ArchSpec &arch); }; static_assert(sizeof(ELFLinuxPrStatus) == 112, @@ -97,18 +86,7 @@ // 32 bit - hardcoded because we are reusing the struct, but some of the // members are smaller - // so the layout is not the same - static size_t GetSize(const lldb_private::ArchSpec &arch) { -switch (arch.GetCore()) { -case lldb_private::ArchSpec::eCore_x86_64_x86_64: - return sizeof(ELFLinuxSigInfo); -case lldb_private::ArchSpec::eCore_s390x_generic: -case lldb_private::ArchSpec::eCore_x86_32_i386: -case lldb_private::ArchSpec::eCore_x86_32_i486: - return 12; -default: - return 0; -} - } + static size_t GetSize(const lldb_private::ArchSpec &arch); }; static_assert(sizeof(ELFLinuxSigInfo) == 12, @@ -143,18 +121,7 @@ // 32 bit - hardcoded because we are reusing the struct, but some of the // members are smaller - // so the layout is not the same - static size_t GetSize(lldb_private::ArchSpec &arch) { -switch (arch.GetCore()) { -case lldb_private::ArchSpec::eCore_s390x_generic: -case lldb_private::ArchSpec::eCore_x86_64_x86_64: - return sizeof(ELFLinuxPrPsInfo); -case lldb_private::ArchSpec::eCore_x86_32_i386: -case lldb_private::ArchSpec::eCore_x86_32_i486: - return 124; -default: - return 0; -} - } + static size_t GetSize(lldb_private::ArchSpec &arch); }; static_assert(sizeof(ELFLinuxPrPsInfo) == 136, Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -18,6 +18,8 @@ #include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h" #include "Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h" #include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h" +#include "Plugins/Process/Utility/RegisterContextLinux_mips64.h" +#include "Plugins/Process/Utility/RegisterContextLinux_mips.h" #include "Plugins/Process/Utility/RegisterContextLinux_i386.h" #include "Plugins/Process/Utility/RegisterContextLinux_s390x.h" #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" @@ -118,6 +120,14 @@ case llvm::Triple::aarch64: reg_interface = new RegisterInfoPOSIX_arm64(arch); break; + case llvm::Triple::mipsel: + case llvm::Triple::mips: +reg_interface = new RegisterContextLinux_mips(arch); +break; + case llvm::Triple::mips64el: + case llvm::Triple::mips64: +reg_interface = new RegisterContextLinux_mips64(arch); +break; case llvm::Triple::systemz: reg_interface = new RegisterContextLinux_s390x(arch); break; @@ -153,7 +163,13 @@ m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_arm( *this, reg_interface, m_gpregset_data, m_fpregset_data)); break; +case llvm::Triple::mipsel: +case llvm::Triple::mips: + m_thread_reg_
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain created this revision. Herald added a subscriber: sdardis. The MIPS core file doesn't contain any Architecture revision, OS and ABI information. Hence we need to relied on executable to get that information. This patch also add core file test cases for MIPS. Patch By:- Bhushan Repository: rL LLVM https://reviews.llvm.org/D31280 Files: packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/Process/elf-core/ProcessElfCore.cpp Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp === --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -214,9 +214,12 @@ // Even if the architecture is set in the target, we need to override // it to match the core file which is always single arch. ArchSpec arch(m_core_module_sp->GetArchitecture()); - if (arch.IsValid()) -GetTarget().SetArchitecture(arch); + // In case of MIPS, Core file doesn't have architecture revision and ABI + // information. Hence we need to relied on target architecture for that. + if (arch.IsValid() && !arch.IsMIPS()) +GetTarget().SetArchitecture(arch); + SetUnixSignals(UnixSignals::Create(GetArchitecture())); // Ensure we found at least one thread that was stopped on a signal. @@ -370,6 +373,10 @@ lldb::addr_t bytes_left = 0; // Number of bytes available in the core file from the given address + // Don't proceed if core file doesn't contain the actual data for this address range. + if (file_start == file_end) +return 0; + // Figure out how many on-disk bytes remain in this segment // starting at the given offset if (file_end > file_start + offset) @@ -588,6 +595,8 @@ // The result from FXSAVE is in NT_PRXFPREG for i386 core files if (arch.GetCore() == ArchSpec::eCore_x86_64_x86_64) thread_data->fpregset = note_data; +else if(arch.IsMIPS()) + thread_data->fpregset = note_data; break; case NT_PRPSINFO: have_prpsinfo = true; @@ -655,6 +664,18 @@ (ObjectFileELF *)(m_core_module_sp->GetObjectFile()); ArchSpec arch; core_file->GetArchitecture(arch); + + ArchSpec target_arch = GetTarget().GetArchitecture(); + + if (target_arch.IsMIPS()) { +// This is the case when executable doesn't contain any OS information. +// Hence fall back to host triple OS. +if (target_arch.GetTriple().getOS() == llvm::Triple::UnknownOS) { + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); + target_arch.GetTriple().setOS(host_triple.getOS()); +} +return target_arch; + } return arch; } Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -287,10 +287,26 @@ return kal_arch_variant; } -static uint32_t mipsVariantFromElfFlags(const elf::elf_word e_flags, -uint32_t endian) { - const uint32_t mips_arch = e_flags & llvm::ELF::EF_MIPS_ARCH; +static uint32_t mipsVariantFromElfFlags (const elf::ELFHeader &header) { + const uint32_t mips_arch = header.e_flags & llvm::ELF::EF_MIPS_ARCH; + uint32_t endian = header.e_ident[EI_DATA]; uint32_t arch_variant = ArchSpec::eMIPSSubType_unknown; + uint32_t fileclass = header.e_ident[EI_CLASS]; + + // If there aren't any elf flags available (e.g core elf file) then return default + // 32 or 64 bit arch (without any architecture revision) based on object file's class. + if (header.e_type == ET_CORE) { +switch (fileclass) { +case llvm::ELF::ELFCLASS32: + return (endian == ELFDATA2LSB) ? ArchSpec::eMIPSSubType_mips32el + : ArchSpec::eMIPSSubType_mips32; +case llvm::ELF::ELFCLASS64: + return (endian == ELFDATA2LSB) ? ArchSpec::eMIPSSubType_mips64el + : ArchSpec::eMIPSSubType_mips64; +default: + return arch_variant; +} + } switch (mips_arch) { case llvm::ELF::EF_MIPS_ARCH_1: @@ -325,7 +341,7 @@ static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) { if (header.e_machine == llvm::ELF
[Lldb-commits] [PATCH] D30457: [LLDB][MIPS] Core Dump Support
nitesh.jain added a comment. Added test case for MIPS in https://reviews.llvm.org/D31280 https://reviews.llvm.org/D30457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r298585 - Fix warnings from clang build on macOS.
Author: brucem Date: Thu Mar 23 04:52:26 2017 New Revision: 298585 URL: http://llvm.org/viewvc/llvm-project?rev=298585&view=rev Log: Fix warnings from clang build on macOS. Reviewers: lldb-commits Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D31279 Modified: lldb/trunk/source/Expression/LLVMUserExpression.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Modified: lldb/trunk/source/Expression/LLVMUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/LLVMUserExpression.cpp?rev=298585&r1=298584&r2=298585&view=diff == --- lldb/trunk/source/Expression/LLVMUserExpression.cpp (original) +++ lldb/trunk/source/Expression/LLVMUserExpression.cpp Thu Mar 23 04:52:26 2017 @@ -49,9 +49,10 @@ LLVMUserExpression::LLVMUserExpression(E const EvaluateExpressionOptions &options) : UserExpression(exe_scope, expr, prefix, language, desired_type, options), m_stack_frame_bottom(LLDB_INVALID_ADDRESS), + m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false), m_allow_objc(false), - m_stack_frame_top(LLDB_INVALID_ADDRESS), m_transformed_text(), + m_transformed_text(), m_execution_unit_sp(), m_materializer_ap(), m_jit_module_wp(), m_enforce_valid_object(true), m_in_cplusplus_method(false), m_in_objectivec_method(false), m_in_static_method(false), Modified: lldb/trunk/source/Host/common/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=298585&r1=298584&r2=298585&view=diff == --- lldb/trunk/source/Host/common/Symbols.cpp (original) +++ lldb/trunk/source/Host/common/Symbols.cpp Thu Mar 23 04:52:26 2017 @@ -55,6 +55,7 @@ static bool FileAtPathContainsArchAndUUI ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && (arch == NULL || (spec.GetArchitecturePtr() && Modified: lldb/trunk/source/Host/macosx/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=298585&r1=298584&r2=298585&view=diff == --- lldb/trunk/source/Host/macosx/Symbols.cpp (original) +++ lldb/trunk/source/Host/macosx/Symbols.cpp Thu Mar 23 04:52:26 2017 @@ -270,6 +270,7 @@ FileSpec Symbols::FindSymbolFileInBundle ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=298585&r1=298584&r2=298585&view=diff == --- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Thu Mar 23 04:52:26 2017 @@ -281,6 +281,7 @@ DynamicRegisterInfo::SetRegisterInfo(con // Swap "dwarf_opcode_string" over into "opcode_extractor" opcode_extractor.GetStringRef().swap(dwarf_opcode_string); uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes); + UNUSED_IF_ASSERT_DISABLED(ret_val); assert(ret_val == reg_info.dynamic_size_dwarf_len); for (j = 0; j < reg_info.dynamic_size_dwarf_len; ++j) Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=298585&r1=298584&r2=298585&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Thu Mar 23 04:52:26 2017 @@ -771,7 +771,6 @@ GDBRemoteCommunicationServerCommon::Hand std::string path; packet.GetHexByteString(path); if (!path.empty()) { -uint64_t a, b; StreamGDBRemote response; auto Result
[Lldb-commits] [PATCH] D31279: Fix warnings from clang build on macOS.
This revision was automatically updated to reflect the committed changes. Closed by commit rL298585: Fix warnings from clang build on macOS. (authored by brucem). Changed prior to commit: https://reviews.llvm.org/D31279?vs=92764&id=92776#toc Repository: rL LLVM https://reviews.llvm.org/D31279 Files: lldb/trunk/source/Expression/LLVMUserExpression.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -771,7 +771,6 @@ std::string path; packet.GetHexByteString(path); if (!path.empty()) { -uint64_t a, b; StreamGDBRemote response; auto Result = llvm::sys::fs::md5_contents(path); if (!Result) { Index: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp === --- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -281,6 +281,7 @@ // Swap "dwarf_opcode_string" over into "opcode_extractor" opcode_extractor.GetStringRef().swap(dwarf_opcode_string); uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes); + UNUSED_IF_ASSERT_DISABLED(ret_val); assert(ret_val == reg_info.dynamic_size_dwarf_len); for (j = 0; j < reg_info.dynamic_size_dwarf_len; ++j) Index: lldb/trunk/source/Expression/LLVMUserExpression.cpp === --- lldb/trunk/source/Expression/LLVMUserExpression.cpp +++ lldb/trunk/source/Expression/LLVMUserExpression.cpp @@ -49,9 +49,10 @@ const EvaluateExpressionOptions &options) : UserExpression(exe_scope, expr, prefix, language, desired_type, options), m_stack_frame_bottom(LLDB_INVALID_ADDRESS), + m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false), m_allow_objc(false), - m_stack_frame_top(LLDB_INVALID_ADDRESS), m_transformed_text(), + m_transformed_text(), m_execution_unit_sp(), m_materializer_ap(), m_jit_module_wp(), m_enforce_valid_object(true), m_in_cplusplus_method(false), m_in_objectivec_method(false), m_in_static_method(false), Index: lldb/trunk/source/Host/macosx/Symbols.cpp === --- lldb/trunk/source/Host/macosx/Symbols.cpp +++ lldb/trunk/source/Host/macosx/Symbols.cpp @@ -270,6 +270,7 @@ ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && Index: lldb/trunk/source/Host/common/Symbols.cpp === --- lldb/trunk/source/Host/common/Symbols.cpp +++ lldb/trunk/source/Host/common/Symbols.cpp @@ -55,6 +55,7 @@ ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && (arch == NULL || (spec.GetArchitecturePtr() && Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -771,7 +771,6 @@ std::string path; packet.GetHexByteString(path); if (!path.empty()) { -uint64_t a, b; StreamGDBRemote response; auto Result = llvm::sys::fs::md5_contents(path); if (!Result) { Index: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp === --- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -281,6 +281,7 @@ // Swap "dwarf_opcode_string" over into "opcode_extractor" opcode_extractor.GetStringRef().swap(dwarf_opcode_string); uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes); + UNUSED_IF_ASSERT
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
labath added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:675 + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); + target_arch.GetTriple().setOS(host_triple.getOS()); +} I'm not terribly happy with the default-to-host mode here, particularly as we already have some code which detects linux in ObjectFileELF::RefineModuleDetailsFromNote. I'm not terribly happy about that either, but I hope we could at least have just one dodgy detection code. Did you check whether it's possible to extend that function to cover mips as well (probably the NT_FILE part, which searches for some `i386-linux-gnu` paths in the binary) ? Repository: rL LLVM https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
labath added a comment. BTW, thank you for adding the test. It's not obvious from the patch: how big are the core files? Repository: rL LLVM https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain added a comment. They are around ~28KB Repository: rL LLVM https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:675 + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); + target_arch.GetTriple().setOS(host_triple.getOS()); +} labath wrote: > I'm not terribly happy with the default-to-host mode here, particularly as we > already have some code which detects linux in > ObjectFileELF::RefineModuleDetailsFromNote. I'm not terribly happy about that > either, but I hope we could at least have just one dodgy detection code. > > Did you check whether it's possible to extend that function to cover mips as > well (probably the NT_FILE part, which searches for some `i386-linux-gnu` > paths in the binary) ? In our case , files path doesn't contain any Linux string. nin@debian-co3-1:~/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core$ readelf -a linux-mips64el-gnuabi64.core ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI:UNIX - System V ABI Version: 0 Type: CORE (Core file) Machine: MIPS R3000 Version: 0x1 Entry point address: 0x0 Start of program headers: 64 (bytes into file) Start of section headers: 0 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 6 Size of section headers: 0 (bytes) Number of section headers: 0 Section header string table index: 0 There are no sections in this file. There are no sections to group in this file. Program Headers: Type Offset VirtAddr PhysAddr FileSizMemSiz Flags Align NOTE 0x0190 0x 0x 0x0644 0x 0x0 LOAD 0x1000 0x00012000 0x 0x1000 0x1000 R E0x1000 LOAD 0x2000 0x00fff2a6 0x 0x1000 0x1000 R 0x1000 LOAD 0x3000 0x00fff2a61000 0x 0x1000 0x1000 R E0x1000 LOAD 0x4000 0x00c01000 0x 0x2000 0x2000 RWE0x1000 LOAD 0x6000 0x00fff000 0x 0x 0x1000 RWE0x1000 There is no dynamic section in this file. There are no relocations in this file. The decoding of unwind sections for machine type MIPS R3000 is not currently supported. Dynamic symbol information is not available for displaying symbols. No version information found in this file. Displaying notes found at file offset 0x0190 with length 0x0644: Owner Data size Description CORE 0x01e0 NT_PRSTATUS (prstatus structure) CORE 0x0088 NT_PRPSINFO (prpsinfo structure) CORE 0x0080 NT_SIGINFO (siginfo_t data) CORE 0x0130 NT_AUXV (auxiliary vector) CORE 0x00aa NT_FILE (mapped files) Page size: 4096 Start End Page Offset 0x00012000 0x000120001000 0x /home/nin/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out Repository: rL LLVM https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
labath added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:675 + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); + target_arch.GetTriple().setOS(host_triple.getOS()); +} nitesh.jain wrote: > labath wrote: > > I'm not terribly happy with the default-to-host mode here, particularly as > > we already have some code which detects linux in > > ObjectFileELF::RefineModuleDetailsFromNote. I'm not terribly happy about > > that either, but I hope we could at least have just one dodgy detection > > code. > > > > Did you check whether it's possible to extend that function to cover mips > > as well (probably the NT_FILE part, which searches for some > > `i386-linux-gnu` paths in the binary) ? > In our case , files path doesn't contain any Linux string. > > nin@debian-co3-1:~/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core$ > readelf -a linux-mips64el-gnuabi64.core > ELF Header: > Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 > Class: ELF64 > Data: 2's complement, little endian > Version: 1 (current) > OS/ABI:UNIX - System V > ABI Version: 0 > Type: CORE (Core file) > Machine: MIPS R3000 > Version: 0x1 > Entry point address: 0x0 > Start of program headers: 64 (bytes into file) > Start of section headers: 0 (bytes into file) > Flags: 0x0 > Size of this header: 64 (bytes) > Size of program headers: 56 (bytes) > Number of program headers: 6 > Size of section headers: 0 (bytes) > Number of section headers: 0 > Section header string table index: 0 > > There are no sections in this file. > > There are no sections to group in this file. > > Program Headers: > Type Offset VirtAddr PhysAddr > FileSizMemSiz Flags Align > NOTE 0x0190 0x 0x > 0x0644 0x 0x0 > LOAD 0x1000 0x00012000 0x > 0x1000 0x1000 R E0x1000 > LOAD 0x2000 0x00fff2a6 0x > 0x1000 0x1000 R 0x1000 > LOAD 0x3000 0x00fff2a61000 0x > 0x1000 0x1000 R E0x1000 > LOAD 0x4000 0x00c01000 0x > 0x2000 0x2000 RWE0x1000 > LOAD 0x6000 0x00fff000 0x > 0x 0x1000 RWE0x1000 > > There is no dynamic section in this file. > > There are no relocations in this file. > > The decoding of unwind sections for machine type MIPS R3000 is not currently > supported. > > Dynamic symbol information is not available for displaying symbols. > > No version information found in this file. > > Displaying notes found at file offset 0x0190 with length 0x0644: > Owner Data size Description > CORE 0x01e0 NT_PRSTATUS (prstatus structure) > CORE 0x0088 NT_PRPSINFO (prpsinfo structure) > CORE 0x0080 NT_SIGINFO (siginfo_t data) > CORE 0x0130 NT_AUXV (auxiliary vector) > CORE 0x00aa NT_FILE (mapped files) > Page size: 4096 > Start End Page Offset > 0x00012000 0x000120001000 0x > > /home/nin/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out > That's a good point. In fact that is the case on the x86 core files as well we have checked in as well, as their executables were linked statically. Only, I guess in the x86 case we don't rely on the os that much. Will this affect the ability of the tests to run reproducibly (on windows for example), or will the os be picked up from the executable if it is present? If it won't then we'll need to think hard about how to make the tests deterministic. Repository: rL LLVM https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31282: Fix typos in documentation.
brucem created this revision. https://reviews.llvm.org/D31282 Files: scripts/interface/SBBreakpoint.i scripts/interface/SBModule.i scripts/interface/SBSymbol.i Index: scripts/interface/SBSymbol.i === --- scripts/interface/SBSymbol.i +++ scripts/interface/SBSymbol.i @@ -11,7 +11,7 @@ %feature("docstring", "Represents the symbol possibly associated with a stack frame. -SBModule contains SBSymbol(s). SBSymbol can also be retrived from SBFrame. +SBModule contains SBSymbol(s). SBSymbol can also be retrieved from SBFrame. See also SBModule and SBFrame." ) SBSymbol; Index: scripts/interface/SBModule.i === --- scripts/interface/SBModule.i +++ scripts/interface/SBModule.i @@ -26,7 +26,7 @@ saddr = symbol.GetStartAddress() eaddr = symbol.GetEndAddress() -and rich comparion methods which allow the API program to use, +and rich comparison methods which allow the API program to use, if thisModule == thatModule: print('This module is the same as that module') Index: scripts/interface/SBBreakpoint.i === --- scripts/interface/SBBreakpoint.i +++ scripts/interface/SBBreakpoint.i @@ -70,7 +70,7 @@ print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress())) print('breakpoint location condition: %s' % hex(bl.GetCondition())) -and rich comparion methods which allow the API program to use, +and rich comparison methods which allow the API program to use, if aBreakpoint == bBreakpoint: ... Index: scripts/interface/SBSymbol.i === --- scripts/interface/SBSymbol.i +++ scripts/interface/SBSymbol.i @@ -11,7 +11,7 @@ %feature("docstring", "Represents the symbol possibly associated with a stack frame. -SBModule contains SBSymbol(s). SBSymbol can also be retrived from SBFrame. +SBModule contains SBSymbol(s). SBSymbol can also be retrieved from SBFrame. See also SBModule and SBFrame." ) SBSymbol; Index: scripts/interface/SBModule.i === --- scripts/interface/SBModule.i +++ scripts/interface/SBModule.i @@ -26,7 +26,7 @@ saddr = symbol.GetStartAddress() eaddr = symbol.GetEndAddress() -and rich comparion methods which allow the API program to use, +and rich comparison methods which allow the API program to use, if thisModule == thatModule: print('This module is the same as that module') Index: scripts/interface/SBBreakpoint.i === --- scripts/interface/SBBreakpoint.i +++ scripts/interface/SBBreakpoint.i @@ -70,7 +70,7 @@ print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress())) print('breakpoint location condition: %s' % hex(bl.GetCondition())) -and rich comparion methods which allow the API program to use, +and rich comparison methods which allow the API program to use, if aBreakpoint == bBreakpoint: ... ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31283: Expose hit count via SBBreakpointLocation.
brucem created this revision. SBBreakpointLocation exposed the ignore count, but didn't expose the hit count. Both values were exposed by SBBreakpoint and SBWatchpoint, so this makes things a bit more consistent. https://reviews.llvm.org/D31283 Files: include/lldb/API/SBBreakpointLocation.h scripts/interface/SBBreakpointLocation.i source/API/SBBreakpointLocation.cpp Index: source/API/SBBreakpointLocation.cpp === --- source/API/SBBreakpointLocation.cpp +++ source/API/SBBreakpointLocation.cpp @@ -100,6 +100,16 @@ return false; } +uint32_t SBBreakpointLocation::GetHitCount() { + BreakpointLocationSP loc_sp = GetSP(); + if (loc_sp) { +std::lock_guard guard( +loc_sp->GetTarget().GetAPIMutex()); +return loc_sp->GetHitCount(); + } else +return 0; +} + uint32_t SBBreakpointLocation::GetIgnoreCount() { BreakpointLocationSP loc_sp = GetSP(); if (loc_sp) { Index: scripts/interface/SBBreakpointLocation.i === --- scripts/interface/SBBreakpointLocation.i +++ scripts/interface/SBBreakpointLocation.i @@ -48,6 +48,9 @@ IsEnabled (); uint32_t +GetHitCount (); + +uint32_t GetIgnoreCount (); void Index: include/lldb/API/SBBreakpointLocation.h === --- include/lldb/API/SBBreakpointLocation.h +++ include/lldb/API/SBBreakpointLocation.h @@ -38,6 +38,8 @@ bool IsEnabled(); + uint32_t GetHitCount(); + uint32_t GetIgnoreCount(); void SetIgnoreCount(uint32_t n); Index: source/API/SBBreakpointLocation.cpp === --- source/API/SBBreakpointLocation.cpp +++ source/API/SBBreakpointLocation.cpp @@ -100,6 +100,16 @@ return false; } +uint32_t SBBreakpointLocation::GetHitCount() { + BreakpointLocationSP loc_sp = GetSP(); + if (loc_sp) { +std::lock_guard guard( +loc_sp->GetTarget().GetAPIMutex()); +return loc_sp->GetHitCount(); + } else +return 0; +} + uint32_t SBBreakpointLocation::GetIgnoreCount() { BreakpointLocationSP loc_sp = GetSP(); if (loc_sp) { Index: scripts/interface/SBBreakpointLocation.i === --- scripts/interface/SBBreakpointLocation.i +++ scripts/interface/SBBreakpointLocation.i @@ -48,6 +48,9 @@ IsEnabled (); uint32_t +GetHitCount (); + +uint32_t GetIgnoreCount (); void Index: include/lldb/API/SBBreakpointLocation.h === --- include/lldb/API/SBBreakpointLocation.h +++ include/lldb/API/SBBreakpointLocation.h @@ -38,6 +38,8 @@ bool IsEnabled(); + uint32_t GetHitCount(); + uint32_t GetIgnoreCount(); void SetIgnoreCount(uint32_t n); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:675 + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); + target_arch.GetTriple().setOS(host_triple.getOS()); +} labath wrote: > nitesh.jain wrote: > > labath wrote: > > > I'm not terribly happy with the default-to-host mode here, particularly > > > as we already have some code which detects linux in > > > ObjectFileELF::RefineModuleDetailsFromNote. I'm not terribly happy about > > > that either, but I hope we could at least have just one dodgy detection > > > code. > > > > > > Did you check whether it's possible to extend that function to cover mips > > > as well (probably the NT_FILE part, which searches for some > > > `i386-linux-gnu` paths in the binary) ? > > In our case , files path doesn't contain any Linux string. > > > > nin@debian-co3-1:~/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core$ > > readelf -a linux-mips64el-gnuabi64.core > > ELF Header: > > Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 > > Class: ELF64 > > Data: 2's complement, little endian > > Version: 1 (current) > > OS/ABI:UNIX - System V > > ABI Version: 0 > > Type: CORE (Core file) > > Machine: MIPS R3000 > > Version: 0x1 > > Entry point address: 0x0 > > Start of program headers: 64 (bytes into file) > > Start of section headers: 0 (bytes into file) > > Flags: 0x0 > > Size of this header: 64 (bytes) > > Size of program headers: 56 (bytes) > > Number of program headers: 6 > > Size of section headers: 0 (bytes) > > Number of section headers: 0 > > Section header string table index: 0 > > > > There are no sections in this file. > > > > There are no sections to group in this file. > > > > Program Headers: > > Type Offset VirtAddr PhysAddr > > FileSizMemSiz Flags Align > > NOTE 0x0190 0x 0x > > 0x0644 0x 0x0 > > LOAD 0x1000 0x00012000 0x > > 0x1000 0x1000 R E0x1000 > > LOAD 0x2000 0x00fff2a6 0x > > 0x1000 0x1000 R 0x1000 > > LOAD 0x3000 0x00fff2a61000 0x > > 0x1000 0x1000 R E0x1000 > > LOAD 0x4000 0x00c01000 0x > > 0x2000 0x2000 RWE0x1000 > > LOAD 0x6000 0x00fff000 0x > > 0x 0x1000 RWE0x1000 > > > > There is no dynamic section in this file. > > > > There are no relocations in this file. > > > > The decoding of unwind sections for machine type MIPS R3000 is not > > currently supported. > > > > Dynamic symbol information is not available for displaying symbols. > > > > No version information found in this file. > > > > Displaying notes found at file offset 0x0190 with length 0x0644: > > Owner Data size Description > > CORE 0x01e0 NT_PRSTATUS (prstatus structure) > > CORE 0x0088 NT_PRPSINFO (prpsinfo structure) > > CORE 0x0080 NT_SIGINFO (siginfo_t data) > > CORE 0x0130 NT_AUXV (auxiliary vector) > > CORE 0x00aa NT_FILE (mapped files) > > Page size: 4096 > > Start End Page Offset > > 0x00012000 0x000120001000 0x > > > > /home/nin/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out > > > That's a good point. In fact that is the case on the x86 core files as well > we have checked in as well, as their executables were linked statically. > Only, I guess in the x86 case we don't rely on the os that much. > > Will this affect the ability of the tests to run reproducibly (on windows for > example), or will the os be picked up from the executable if it is present? > If it won't then we'll need to think hard about how to make the tests > deterministic. If Host OS is windows then this test case will fail. The MIPS support freeBSD, Linux and Android. The note.n_name == LLDB_NT_OWNER_GNU i
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
labath added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:675 + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); + target_arch.GetTriple().setOS(host_triple.getOS()); +} nitesh.jain wrote: > labath wrote: > > nitesh.jain wrote: > > > labath wrote: > > > > I'm not terribly happy with the default-to-host mode here, particularly > > > > as we already have some code which detects linux in > > > > ObjectFileELF::RefineModuleDetailsFromNote. I'm not terribly happy > > > > about that either, but I hope we could at least have just one dodgy > > > > detection code. > > > > > > > > Did you check whether it's possible to extend that function to cover > > > > mips as well (probably the NT_FILE part, which searches for some > > > > `i386-linux-gnu` paths in the binary) ? > > > In our case , files path doesn't contain any Linux string. > > > > > > nin@debian-co3-1:~/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core$ > > > readelf -a linux-mips64el-gnuabi64.core > > > ELF Header: > > > Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 > > > Class: ELF64 > > > Data: 2's complement, little endian > > > Version: 1 (current) > > > OS/ABI:UNIX - System V > > > ABI Version: 0 > > > Type: CORE (Core file) > > > Machine: MIPS R3000 > > > Version: 0x1 > > > Entry point address: 0x0 > > > Start of program headers: 64 (bytes into file) > > > Start of section headers: 0 (bytes into file) > > > Flags: 0x0 > > > Size of this header: 64 (bytes) > > > Size of program headers: 56 (bytes) > > > Number of program headers: 6 > > > Size of section headers: 0 (bytes) > > > Number of section headers: 0 > > > Section header string table index: 0 > > > > > > There are no sections in this file. > > > > > > There are no sections to group in this file. > > > > > > Program Headers: > > > Type Offset VirtAddr PhysAddr > > > FileSizMemSiz Flags Align > > > NOTE 0x0190 0x 0x > > > 0x0644 0x 0x0 > > > LOAD 0x1000 0x00012000 0x > > > 0x1000 0x1000 R E0x1000 > > > LOAD 0x2000 0x00fff2a6 0x > > > 0x1000 0x1000 R 0x1000 > > > LOAD 0x3000 0x00fff2a61000 0x > > > 0x1000 0x1000 R E0x1000 > > > LOAD 0x4000 0x00c01000 0x > > > 0x2000 0x2000 RWE0x1000 > > > LOAD 0x6000 0x00fff000 0x > > > 0x 0x1000 RWE0x1000 > > > > > > There is no dynamic section in this file. > > > > > > There are no relocations in this file. > > > > > > The decoding of unwind sections for machine type MIPS R3000 is not > > > currently supported. > > > > > > Dynamic symbol information is not available for displaying symbols. > > > > > > No version information found in this file. > > > > > > Displaying notes found at file offset 0x0190 with length 0x0644: > > > Owner Data size Description > > > CORE 0x01e0 NT_PRSTATUS (prstatus structure) > > > CORE 0x0088 NT_PRPSINFO (prpsinfo structure) > > > CORE 0x0080 NT_SIGINFO (siginfo_t data) > > > CORE 0x0130 NT_AUXV (auxiliary vector) > > > CORE 0x00aa NT_FILE (mapped files) > > > Page size: 4096 > > > Start End Page Offset > > > 0x00012000 0x000120001000 0x > > > > > > /home/nin/LLVM-new/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out > > > > > That's a good point. In fact that is the case on the x86 core files as well > > we have checked in as well, as their executables were linked statically. > > Only, I guess in the x86 case we don't rely on the os that much. > > > > Will this affect the ability of the tests to run reproducibly (on windows > > for example), or will the os be picked up from the executable if it is > > present? If it won't then we'll need to think
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain updated this revision to Diff 92808. nitesh.jain added a comment. updated diff as per suggestion https://reviews.llvm.org/D31280 Files: packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabi64.out packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mips64el-gnuabin32.out packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.core packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-mipsel-gnuabio32.out source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/Process/elf-core/ProcessElfCore.cpp Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp === --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -214,9 +214,12 @@ // Even if the architecture is set in the target, we need to override // it to match the core file which is always single arch. ArchSpec arch(m_core_module_sp->GetArchitecture()); - if (arch.IsValid()) -GetTarget().SetArchitecture(arch); + // In case of MIPS, Core file doesn't have architecture revision and ABI + // information. Hence we need to relied on target architecture for that. + if (arch.IsValid() && !arch.IsMIPS()) +GetTarget().SetArchitecture(arch); + SetUnixSignals(UnixSignals::Create(GetArchitecture())); // Ensure we found at least one thread that was stopped on a signal. @@ -370,6 +373,10 @@ lldb::addr_t bytes_left = 0; // Number of bytes available in the core file from the given address + // Don't proceed if core file doesn't contain the actual data for this address range. + if (file_start == file_end) +return 0; + // Figure out how many on-disk bytes remain in this segment // starting at the given offset if (file_end > file_start + offset) @@ -588,6 +595,8 @@ // The result from FXSAVE is in NT_PRXFPREG for i386 core files if (arch.GetCore() == ArchSpec::eCore_x86_64_x86_64) thread_data->fpregset = note_data; +else if(arch.IsMIPS()) + thread_data->fpregset = note_data; break; case NT_PRPSINFO: have_prpsinfo = true; @@ -655,6 +664,12 @@ (ObjectFileELF *)(m_core_module_sp->GetObjectFile()); ArchSpec arch; core_file->GetArchitecture(arch); + + ArchSpec target_arch = GetTarget().GetArchitecture(); + + if (target_arch.IsMIPS()) +return target_arch; + return arch; } Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -287,10 +287,26 @@ return kal_arch_variant; } -static uint32_t mipsVariantFromElfFlags(const elf::elf_word e_flags, -uint32_t endian) { - const uint32_t mips_arch = e_flags & llvm::ELF::EF_MIPS_ARCH; +static uint32_t mipsVariantFromElfFlags (const elf::ELFHeader &header) { + const uint32_t mips_arch = header.e_flags & llvm::ELF::EF_MIPS_ARCH; + uint32_t endian = header.e_ident[EI_DATA]; uint32_t arch_variant = ArchSpec::eMIPSSubType_unknown; + uint32_t fileclass = header.e_ident[EI_CLASS]; + + // If there aren't any elf flags available (e.g core elf file) then return default + // 32 or 64 bit arch (without any architecture revision) based on object file's class. + if (header.e_type == ET_CORE) { +switch (fileclass) { +case llvm::ELF::ELFCLASS32: + return (endian == ELFDATA2LSB) ? ArchSpec::eMIPSSubType_mips32el + : ArchSpec::eMIPSSubType_mips32; +case llvm::ELF::ELFCLASS64: + return (endian == ELFDATA2LSB) ? ArchSpec::eMIPSSubType_mips64el + : ArchSpec::eMIPSSubType_mips64; +default: + return arch_variant; +} + } switch (mips_arch) { case llvm::ELF::EF_MIPS_ARCH_1: @@ -325,7 +341,7 @@ static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) { if (header.e_machine == llvm::ELF::EM_MIPS) -return mipsVariantFromElfFlags(header.e_flags, header.e_ident[EI_DATA]); +return mipsVariantFromElfFlags(header); return llvm::ELF::EM_CSR_KALIMBA == header.e_machine ? kalimbaVariantFromElfFlags(header.e_flags) @@ -1348,6 +1364,10 @@ } break; } + if (arch_spec.IsMIPS() && + arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS) +// The note.n_name == LLDB_NT_OWNER_GNU is valid for Linux platform +arch_spec.GetTriple().setOS(llvm:
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
labath added a comment. Thank you for that. I just have one more concern. I see two places where you are copying the archspec from core file to the target and then back again. I must be missing something, because that looks completely unnecessary at first sight. What is the reason behind that? Why can't we leave `ProcessElfCore::GetArchitecture` as is ? Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:220 + // information. Hence we need to relied on target architecture for that. + if (arch.IsValid() && !arch.IsMIPS()) +GetTarget().SetArchitecture(arch); Here you copy the architecture from core to target. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:668 + + ArchSpec target_arch = GetTarget().GetArchitecture(); + And here you fetch the target instead of the core architecture. https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:220 + // information. Hence we need to relied on target architecture for that. + if (arch.IsValid() && !arch.IsMIPS()) +GetTarget().SetArchitecture(arch); labath wrote: > Here you copy the architecture from core to target. Actually we are skipping it , if the arch is MIPS ( ! arch.IsMIPS()). https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
nitesh.jain added a comment. The core architecture doesn't have any revision, os and ABI information. Hence we need to relied on target architecture. https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Ah, that explains it, thanks. Let's give Greg a chance to comment, but otherwise I am fine with this. https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30457: [LLDB][MIPS] Core Dump Support
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Thank you. https://reviews.llvm.org/D30457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30984: Centralize libc++ test skipping logic
labath added a comment. Does anyone object to me landing this? I am going to be careful and wait for the change to trickle through CI before submitting any followup changes. https://reviews.llvm.org/D30984 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31283: Expose hit count via SBBreakpointLocation.
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. If you are exposing this, could you write a test to make sure it stays correct? I added a sample test that you can easily copy and modify in: packages/Python/lldbsuite/test/sample_test The TestSampleTest.py test makes the binary, loads it into lldb and runs to a breakpoint. So it should be trivial to just check the location and make sure it is correct. Maybe drive around a little more and make sure it updates... The breakpoint tests go in functionalities/breakpoints. Don't forget to reset the "LEVEL" variable in the Makefile to track the test location. https://reviews.llvm.org/D31283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31172: Move stop info override callback code from ArchSpec into Process
clayborg added a comment. It almost seems like we need some sort of an architecture plug-in here. Maybe something like Architecture plugins. The Architecture::FindPlugin() would take an ArchSpec and return a lldb_private::Architecture class instance that can be cached in the target or process. Currently the class would look like: class Architecture : public PluginInterface { Error StopInfoOverride(...); }; Then using the target's arch, it can lookup the right one and cache it in the target or process? https://reviews.llvm.org/D31172 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31283: Expose hit count via SBBreakpointLocation.
jingham added a comment. BTW, other than the lack of a test, this is fine. https://reviews.llvm.org/D31283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31172: Move stop info override callback code from ArchSpec into Process
jingham added a comment. Yes, that seems like the cleanest solution. https://reviews.llvm.org/D31172 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31280: [LLDB][MIPS] Fix Core file Architecture and OS information
clayborg added a comment. Let me know what you think about the MergeFrom comment. I am generally ok with this, but just wanted to check in case the merge made any sense in this patch somewhere. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:220 + // information. Hence we need to relied on target architecture for that. + if (arch.IsValid() && !arch.IsMIPS()) +GetTarget().SetArchitecture(arch); nitesh.jain wrote: > labath wrote: > > Here you copy the architecture from core to target. > Actually we are skipping it , if the arch is MIPS ( ! arch.IsMIPS()). So the target has an incomplete architecture here? If that is true, you should probably get the architecture and merge it. You can merge any missing info with: ``` ArchSpec target_arch = GetTarget().GetArchitecture(); ArchSpec core_arch(m_core_module_sp->GetArchitecture()); target_arch.MergeFrom(core_arch); GetTarget().SetArchitecture(target_arch); ``` Not sure how that would work here, but we should be using this. If we have a target whose arch is "x86_64-apple-macosx" and you have a core file that is "mips-..." an error should be produced. https://reviews.llvm.org/D31280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31131: [LLDB] OpenBSD support
kettenis updated this revision to Diff 92857. kettenis marked an inline comment as done. kettenis edited the summary of this revision. kettenis added a comment. Herald added subscribers: srhines, rengolin, emaste, aemerson. New diff. This one adds support for OpenBSD/amd64, OpenBSD/arm, OpenBSD/arm64 and OpenBSD/i386. I'm holding off on resorting existing code. I'm willing to do that in a separate diff. https://reviews.llvm.org/D31131 Files: include/lldb/Host/Config.h include/lldb/Host/Editline.h include/lldb/Host/Host.h include/lldb/Host/HostInfo.h include/lldb/Host/openbsd/Config.h include/lldb/Host/openbsd/HostInfoOpenBSD.h source/API/SystemInitializerFull.cpp source/CMakeLists.txt source/Host/CMakeLists.txt source/Host/common/Host.cpp source/Host/openbsd/Host.cpp source/Host/openbsd/HostInfoOpenBSD.cpp source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/Platform/CMakeLists.txt source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp source/Plugins/Platform/OpenBSD/CMakeLists.txt source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h source/Plugins/Process/Utility/CMakeLists.txt source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.h source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.cpp Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -21,6 +21,8 @@ #include "Plugins/Process/Utility/RegisterContextLinux_i386.h" #include "Plugins/Process/Utility/RegisterContextLinux_s390x.h" #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" +#include "Plugins/Process/Utility/RegisterContextOpenBSD_i386.h" +#include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h" #include "ProcessElfCore.h" @@ -126,6 +128,26 @@ break; case llvm::Triple::x86_64: reg_interface = new RegisterContextLinux_x86_64(arch); +break; + default: +break; + } + break; +} + +case llvm::Triple::OpenBSD: { + switch (arch.GetMachine()) { + case llvm::Triple::aarch64: +reg_interface = new RegisterInfoPOSIX_arm64(arch); +break; + case llvm::Triple::arm: +reg_interface = new RegisterInfoPOSIX_arm(arch); +break; + case llvm::Triple::x86: + reg_interface = new RegisterContextOpenBSD_i386(arch); + break; + case llvm::Triple::x86_64: +reg_interface = new RegisterContextOpenBSD_x86_64(arch); break; default: break; Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp === --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -431,6 +431,10 @@ NT_FILE = 0x46494c45, NT_PRXFPREG = 0x46e62b7f, NT_SIGINFO = 0x53494749, + NT_OPENBSD_PROCINFO = 10, + NT_OPENBSD_AUXV = 11, + NT_OPENBSD_REGS = 20, + NT_OPENBSD_FPREGS = 21, }; namespace FREEBSD { @@ -481,6 +485,18 @@ thread_data.name = data.GetCStr(&offset, 20); } +static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) +{ + lldb::offset_t offset = 0; + + int version = data.GetU32(&offset); + if (version != 1) + return; + + offset += 4; + thread_data.signo = data.GetU32(&offset); +} + /// Parse Thread context from PT_NOTE segment and store it in the thread list /// Notes: /// 1) A PT_NOTE segment is composed of one or more NOTE entries. @@ -568,6 +584,24 @@ break; default: break; + } +} else if (note.n_name.substr(0, 7) == "OpenBSD") { + // OpenBSD per-thread information is stored in notes named + // "OpenBSD@nnn" so match on the initial part of the string. + m_os = llvm::Triple::OpenBSD; + switch (note.n_type) { + case NT_OPENBSD_PROCINFO: + ParseOpenBSDProcInfo(*thread_data, note_data); + break; + case NT_OPENBSD_AUXV: + m_auxv = DataExtractor(note_data); + break; + case NT_OPENBSD_REGS: + thread_data->gpregset = note_data; + break; + case NT_OPENBSD_FPREGS: + thread_data->fpregset = note_data; + break; } } else if (note.n_name == "CORE") { switch (note.n_type) { Index: source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h === --- source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_6
[Lldb-commits] [PATCH] D31131: [LLDB] OpenBSD support
kettenis updated this revision to Diff 92861. kettenis added a comment. Apologies. Previous diff contained a bogus change to DYLDRendezvous.cpp and a formatting botch. Please review this updated version instead, https://reviews.llvm.org/D31131 Files: include/lldb/Host/Config.h include/lldb/Host/Editline.h include/lldb/Host/Host.h include/lldb/Host/HostInfo.h include/lldb/Host/openbsd/Config.h include/lldb/Host/openbsd/HostInfoOpenBSD.h source/API/SystemInitializerFull.cpp source/CMakeLists.txt source/Host/CMakeLists.txt source/Host/common/Host.cpp source/Host/openbsd/Host.cpp source/Host/openbsd/HostInfoOpenBSD.cpp source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/Platform/CMakeLists.txt source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp source/Plugins/Platform/OpenBSD/CMakeLists.txt source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h source/Plugins/Process/Utility/CMakeLists.txt source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.h source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.cpp Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -21,6 +21,8 @@ #include "Plugins/Process/Utility/RegisterContextLinux_i386.h" #include "Plugins/Process/Utility/RegisterContextLinux_s390x.h" #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" +#include "Plugins/Process/Utility/RegisterContextOpenBSD_i386.h" +#include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h" #include "ProcessElfCore.h" @@ -126,6 +128,26 @@ break; case llvm::Triple::x86_64: reg_interface = new RegisterContextLinux_x86_64(arch); +break; + default: +break; + } + break; +} + +case llvm::Triple::OpenBSD: { + switch (arch.GetMachine()) { + case llvm::Triple::aarch64: +reg_interface = new RegisterInfoPOSIX_arm64(arch); +break; + case llvm::Triple::arm: +reg_interface = new RegisterInfoPOSIX_arm(arch); +break; + case llvm::Triple::x86: + reg_interface = new RegisterContextOpenBSD_i386(arch); + break; + case llvm::Triple::x86_64: +reg_interface = new RegisterContextOpenBSD_x86_64(arch); break; default: break; Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp === --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -431,6 +431,10 @@ NT_FILE = 0x46494c45, NT_PRXFPREG = 0x46e62b7f, NT_SIGINFO = 0x53494749, + NT_OPENBSD_PROCINFO = 10, + NT_OPENBSD_AUXV = 11, + NT_OPENBSD_REGS = 20, + NT_OPENBSD_FPREGS = 21, }; namespace FREEBSD { @@ -481,6 +485,18 @@ thread_data.name = data.GetCStr(&offset, 20); } +static void ParseOpenBSDProcInfo(ThreadData &thread_data, DataExtractor &data) +{ + lldb::offset_t offset = 0; + + int version = data.GetU32(&offset); + if (version != 1) + return; + + offset += 4; + thread_data.signo = data.GetU32(&offset); +} + /// Parse Thread context from PT_NOTE segment and store it in the thread list /// Notes: /// 1) A PT_NOTE segment is composed of one or more NOTE entries. @@ -568,6 +584,24 @@ break; default: break; + } +} else if (note.n_name.substr(0, 7) == "OpenBSD") { + // OpenBSD per-thread information is stored in notes named + // "OpenBSD@nnn" so match on the initial part of the string. + m_os = llvm::Triple::OpenBSD; + switch (note.n_type) { + case NT_OPENBSD_PROCINFO: + ParseOpenBSDProcInfo(*thread_data, note_data); + break; + case NT_OPENBSD_AUXV: + m_auxv = DataExtractor(note_data); + break; + case NT_OPENBSD_REGS: + thread_data->gpregset = note_data; + break; + case NT_OPENBSD_FPREGS: + thread_data->fpregset = note_data; + break; } } else if (note.n_name == "CORE") { switch (note.n_type) { Index: source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h === --- source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h +++ source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h @@ -0,0 +1,31 @@ +//===-- RegisterContextOpenBSD_x86_64.h -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dist