diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
commit | e81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch) | |
tree | 9ed5e1a91f242e2cb5911577356e487a55c01b78 /source/Plugins/Process/elf-core | |
parent | 85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff) |
Notes
Diffstat (limited to 'source/Plugins/Process/elf-core')
14 files changed, 221 insertions, 141 deletions
diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/source/Plugins/Process/elf-core/ProcessElfCore.cpp index bf5cad8e39c5..5b5d98a86d5e 100644 --- a/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -57,7 +57,7 @@ ProcessElfCore::Terminate() lldb::ProcessSP -ProcessElfCore::CreateInstance (Target &target, Listener &listener, const FileSpec *crash_file) +ProcessElfCore::CreateInstance (lldb::TargetSP target_sp, Listener &listener, const FileSpec *crash_file) { lldb::ProcessSP process_sp; if (crash_file) @@ -75,7 +75,7 @@ ProcessElfCore::CreateInstance (Target &target, Listener &listener, const FileSp if (elf_header.Parse(data, &data_offset)) { if (elf_header.e_type == llvm::ELF::ET_CORE) - process_sp.reset(new ProcessElfCore (target, listener, *crash_file)); + process_sp.reset(new ProcessElfCore (target_sp, listener, *crash_file)); } } } @@ -83,12 +83,12 @@ ProcessElfCore::CreateInstance (Target &target, Listener &listener, const FileSp } bool -ProcessElfCore::CanDebug(Target &target, bool plugin_specified_by_name) +ProcessElfCore::CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) { // For now we are just making sure the file exists for a given module if (!m_core_module_sp && m_core_file.Exists()) { - ModuleSpec core_module_spec(m_core_file, target.GetArchitecture()); + ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture()); Error error (ModuleList::GetSharedModule (core_module_spec, m_core_module_sp, NULL, NULL, NULL)); if (m_core_module_sp) @@ -104,9 +104,9 @@ ProcessElfCore::CanDebug(Target &target, bool plugin_specified_by_name) //---------------------------------------------------------------------- // ProcessElfCore constructor //---------------------------------------------------------------------- -ProcessElfCore::ProcessElfCore(Target& target, Listener &listener, +ProcessElfCore::ProcessElfCore(lldb::TargetSP target_sp, Listener &listener, const FileSpec &core_file) : - Process (target, listener), + Process (target_sp, listener), m_core_module_sp (), m_core_file (core_file), m_dyld_plugin_name (), @@ -233,10 +233,29 @@ ProcessElfCore::DoLoadCore () // it to match the core file which is always single arch. ArchSpec arch (m_core_module_sp->GetArchitecture()); if (arch.IsValid()) - m_target.SetArchitecture(arch); + GetTarget().SetArchitecture(arch); SetUnixSignals(UnixSignals::Create(GetArchitecture())); + // Core files are useless without the main executable. See if we can locate the main + // executable using data we found in the core file notes. + lldb::ModuleSP exe_module_sp = GetTarget().GetExecutableModule(); + if (!exe_module_sp) + { + // The first entry in the NT_FILE might be our executable + if (!m_nt_file_entries.empty()) + { + ModuleSpec exe_module_spec; + exe_module_spec.GetArchitecture() = arch; + exe_module_spec.GetFileSpec().SetFile(m_nt_file_entries[0].path.GetCString(), false); + if (exe_module_spec.GetFileSpec()) + { + exe_module_sp = GetTarget().GetSharedModule(exe_module_spec); + if (exe_module_sp) + GetTarget().SetExecutableModule(exe_module_sp, false); + } + } + } return error; } @@ -258,7 +277,7 @@ ProcessElfCore::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_t for (lldb::tid_t tid = 0; tid < num_threads; ++tid) { const ThreadData &td = m_thread_data[tid]; - lldb::ThreadSP thread_sp(new ThreadElfCore (*this, tid, td)); + lldb::ThreadSP thread_sp(new ThreadElfCore (*this, td)); new_thread_list.AddThread (thread_sp); } return new_thread_list.GetSize(false) > 0; @@ -352,8 +371,7 @@ ProcessElfCore::Clear() m_thread_list.Clear(); m_os = llvm::Triple::UnknownOS; - static const auto s_default_unix_signals_sp = std::make_shared<UnixSignals>(); - SetUnixSignals(s_default_unix_signals_sp); + SetUnixSignals(std::make_shared<UnixSignals>()); } void @@ -371,12 +389,11 @@ ProcessElfCore::Initialize() lldb::addr_t ProcessElfCore::GetImageInfoAddress() { - Target *target = &GetTarget(); - ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile(); - Address addr = obj_file->GetImageInfoAddress(target); + ObjectFile *obj_file = GetTarget().GetExecutableModule()->GetObjectFile(); + Address addr = obj_file->GetImageInfoAddress(&GetTarget()); if (addr.IsValid()) - return addr.GetLoadAddress(target); + return addr.GetLoadAddress(&GetTarget()); return LLDB_INVALID_ADDRESS; } @@ -387,7 +404,8 @@ enum { NT_PRPSINFO, NT_TASKSTRUCT, NT_PLATFORM, - NT_AUXV + NT_AUXV, + NT_FILE = 0x46494c45 }; namespace FREEBSD { @@ -429,7 +447,7 @@ ParseFreeBSDPrStatus(ThreadData &thread_data, DataExtractor &data, offset += 16; thread_data.signo = data.GetU32(&offset); // pr_cursig - offset += 4; // pr_pid + thread_data.tid = data.GetU32(&offset); // pr_pid if (lp64) offset += 4; @@ -503,6 +521,7 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader * // Store the NOTE information in the current thread DataExtractor note_data (segment_data, note_start, note_size); + note_data.SetAddressByteSize(m_core_module_sp->GetArchitecture().GetAddressByteSize()); if (note.n_name == "FreeBSD") { m_os = llvm::Triple::FreeBSD; @@ -532,7 +551,7 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader * break; } } - else + else if (note.n_name == "CORE") { switch (note.n_type) { @@ -543,6 +562,8 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader * header_size = ELFLinuxPrStatus::GetSize(arch); len = note_data.GetByteSize() - header_size; thread_data->gpregset = DataExtractor(note_data, header_size, len); + // FIXME: Obtain actual tid on Linux + thread_data->tid = m_thread_data.size(); break; case NT_FPREGSET: thread_data->fpregset = note_data; @@ -555,6 +576,28 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader * case NT_AUXV: m_auxv = DataExtractor(note_data); break; + case NT_FILE: + { + m_nt_file_entries.clear(); + lldb::offset_t offset = 0; + const uint64_t count = note_data.GetAddress(&offset); + note_data.GetAddress(&offset); // Skip page size + for (uint64_t i = 0; i<count; ++i) + { + NT_FILE_Entry entry; + entry.start = note_data.GetAddress(&offset); + entry.end = note_data.GetAddress(&offset); + entry.file_ofs = note_data.GetAddress(&offset); + m_nt_file_entries.push_back(entry); + } + for (uint64_t i = 0; i<count; ++i) + { + const char *path = note_data.GetCStr(&offset); + if (path && path[0]) + m_nt_file_entries[i].path.SetCString(path); + } + } + break; default: break; } diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.h b/source/Plugins/Process/elf-core/ProcessElfCore.h index 775d9e94dd8e..12ce04c5ce38 100644 --- a/source/Plugins/Process/elf-core/ProcessElfCore.h +++ b/source/Plugins/Process/elf-core/ProcessElfCore.h @@ -1,4 +1,4 @@ -//===-- ProcessElfCore.h ---------------------------------------*- C++ -*-===// +//===-- ProcessElfCore.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -10,18 +10,20 @@ // 2) The ELF file's PT_NOTE and PT_LOAD segments describes the program's // address space and thread contexts. // 3) PT_NOTE segment contains note entries which describes a thread context. -// 4) PT_LOAD segment describes a valid contigous range of process address +// 4) PT_LOAD segment describes a valid contiguous range of process address // space. //===----------------------------------------------------------------------===// #ifndef liblldb_ProcessElfCore_h_ #define liblldb_ProcessElfCore_h_ +// C Includes // C++ Includes #include <list> #include <vector> // Other libraries and framework includes +// Project includes #include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" #include "lldb/Target/Process.h" @@ -37,7 +39,7 @@ public: // Constructors and Destructors //------------------------------------------------------------------ static lldb::ProcessSP - CreateInstance (lldb_private::Target& target, + CreateInstance (lldb::TargetSP target_sp, lldb_private::Listener &listener, const lldb_private::FileSpec *crash_file_path); @@ -56,17 +58,16 @@ public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - ProcessElfCore(lldb_private::Target& target, - lldb_private::Listener &listener, - const lldb_private::FileSpec &core_file); + ProcessElfCore(lldb::TargetSP target_sp, + lldb_private::Listener &listener, + const lldb_private::FileSpec &core_file); - virtual - ~ProcessElfCore(); + ~ProcessElfCore() override; //------------------------------------------------------------------ // Check if a given Process //------------------------------------------------------------------ - bool CanDebug(lldb_private::Target &target, bool plugin_specified_by_name) override; + bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override; //------------------------------------------------------------------ // Creating a new process, or attaching to an existing one @@ -118,6 +119,14 @@ protected: lldb_private::ThreadList &new_thread_list) override; private: + struct NT_FILE_Entry + { + lldb::addr_t start; + lldb::addr_t end; + lldb::addr_t file_ofs; + lldb_private::ConstString path; + }; + //------------------------------------------------------------------ // For ProcessElfCore only //------------------------------------------------------------------ @@ -143,6 +152,9 @@ private: // Address ranges found in the core VMRangeToFileOffset m_core_aranges; + // NT_FILE entries found from the NOTE segment + std::vector<NT_FILE_Entry> m_nt_file_entries; + // Parse thread(s) data structures(prstatus, prpsinfo) from given NOTE segment void ParseThreadContextsFromNoteSegment (const elf::ELFProgramHeader *segment_header, @@ -157,4 +169,4 @@ private: AddAddressRangeFromLoadSegment(const elf::ELFProgramHeader *header); }; -#endif // liblldb_ProcessElffCore_h_ +#endif // liblldb_ProcessElfCore_h_ diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp index f046c112d8b6..6778aeaaac00 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Target/Thread.h" -#include "Plugins/Process/Utility/RegisterContextPOSIX.h" #include "RegisterContextPOSIXCore_arm.h" using namespace lldb_private; diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h index 73e2ef7c3a93..0e74897b5b5c 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h @@ -1,15 +1,19 @@ -//===-- RegisterContextCorePOSIX_arm.h -----------------------*- C++ -*-===// +//===-- RegisterContextCorePOSIX_arm.h --------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterContextCorePOSIX_arm_H_ -#define liblldb_RegisterContextCorePOSIX_arm_H_ +#ifndef liblldb_RegisterContextCorePOSIX_arm_h_ +#define liblldb_RegisterContextCorePOSIX_arm_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Core/DataBufferHeap.h" #include "Plugins/Process/Utility/RegisterContextPOSIX_arm.h" @@ -22,39 +26,41 @@ public: const lldb_private::DataExtractor &gpregset, const lldb_private::DataExtractor &fpregset); - ~RegisterContextCorePOSIX_arm(); + ~RegisterContextCorePOSIX_arm() override; - virtual bool - ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value); + bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value) override; - virtual bool - WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); + bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; bool - ReadAllRegisterValues(lldb::DataBufferSP &data_sp); + ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; bool - WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); + WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; bool - HardwareSingleStep(bool enable); + HardwareSingleStep(bool enable) override; protected: bool - ReadGPR(); + ReadGPR() override; bool - ReadFPR(); + ReadFPR() override; bool - WriteGPR(); + WriteGPR() override; bool - WriteFPR(); + WriteFPR() override; private: lldb::DataBufferSP m_gpr_buffer; lldb_private::DataExtractor m_gpr; }; -#endif // #ifndef liblldb_RegisterContextCorePOSIX_arm_H_ +#endif // liblldb_RegisterContextCorePOSIX_arm_h_ diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp index 53c0c83c264a..7cfdd415ad5b 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Target/Thread.h" -#include "Plugins/Process/Utility/RegisterContextPOSIX.h" #include "RegisterContextPOSIXCore_arm64.h" using namespace lldb_private; diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h index 2e1d6b4f9ca8..9b05edb1935f 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h @@ -1,15 +1,19 @@ -//===-- RegisterContextCorePOSIX_arm64.h -----------------------*- C++ -*-===// +//===-- RegisterContextCorePOSIX_arm64.h ------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterContextCorePOSIX_arm64_H_ -#define liblldb_RegisterContextCorePOSIX_arm64_H_ +#ifndef liblldb_RegisterContextCorePOSIX_arm64_h_ +#define liblldb_RegisterContextCorePOSIX_arm64_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Core/DataBufferHeap.h" #include "Plugins/Process/Utility/RegisterContextPOSIX_arm64.h" @@ -22,39 +26,41 @@ public: const lldb_private::DataExtractor &gpregset, const lldb_private::DataExtractor &fpregset); - ~RegisterContextCorePOSIX_arm64(); + ~RegisterContextCorePOSIX_arm64() override; - virtual bool - ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value); + bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value) override; - virtual bool - WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); + bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; bool - ReadAllRegisterValues(lldb::DataBufferSP &data_sp); + ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; bool - WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); + WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; bool - HardwareSingleStep(bool enable); + HardwareSingleStep(bool enable) override; protected: bool - ReadGPR(); + ReadGPR() override; bool - ReadFPR(); + ReadFPR() override; bool - WriteGPR(); + WriteGPR() override; bool - WriteFPR(); + WriteFPR() override; private: lldb::DataBufferSP m_gpr_buffer; lldb_private::DataExtractor m_gpr; }; -#endif // #ifndef liblldb_RegisterContextCorePOSIX_arm64_H_ +#endif // liblldb_RegisterContextCorePOSIX_arm64_h_ diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp index f0750a0cee18..9d908e371a32 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Target/Thread.h" -#include "Plugins/Process/Utility/RegisterContextPOSIX.h" #include "RegisterContextPOSIXCore_mips64.h" using namespace lldb_private; diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h index ca29d4f0febd..6cbfd504b7db 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h @@ -1,15 +1,19 @@ -//===-- RegisterContextCorePOSIX_mips64.h ----------------------*- C++ -*-===// +//===-- RegisterContextCorePOSIX_mips64.h -----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterContextCorePOSIX_mips64_H_ -#define liblldb_RegisterContextCorePOSIX_mips64_H_ +#ifndef liblldb_RegisterContextCorePOSIX_mips64_h_ +#define liblldb_RegisterContextCorePOSIX_mips64_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Core/DataBufferHeap.h" #include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h" @@ -22,39 +26,41 @@ public: const lldb_private::DataExtractor &gpregset, const lldb_private::DataExtractor &fpregset); - ~RegisterContextCorePOSIX_mips64(); + ~RegisterContextCorePOSIX_mips64() override; - virtual bool - ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value); + bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value) override; - virtual bool - WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); + bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; bool - ReadAllRegisterValues(lldb::DataBufferSP &data_sp); + ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; bool - WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); + WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; bool - HardwareSingleStep(bool enable); + HardwareSingleStep(bool enable) override; protected: bool - ReadGPR(); + ReadGPR() override; bool - ReadFPR(); + ReadFPR() override; bool - WriteGPR(); + WriteGPR() override; bool - WriteFPR(); + WriteFPR() override; private: lldb::DataBufferSP m_gpr_buffer; lldb_private::DataExtractor m_gpr; }; -#endif // #ifndef liblldb_RegisterContextCorePOSIX_mips64_H_ +#endif // liblldb_RegisterContextCorePOSIX_mips64_h_ diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp index d12df21a8664..9d8c97849ff8 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Target/Thread.h" -#include "RegisterContextPOSIX.h" #include "RegisterContextPOSIXCore_powerpc.h" using namespace lldb_private; diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h index a3590601fa7e..0f587fd1459c 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h @@ -5,11 +5,15 @@ // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterContextCorePOSIX_powerpc_H_ -#define liblldb_RegisterContextCorePOSIX_powerpc_H_ +#ifndef liblldb_RegisterContextCorePOSIX_powerpc_h_ +#define liblldb_RegisterContextCorePOSIX_powerpc_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Core/DataBufferHeap.h" #include "Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h" @@ -23,41 +27,43 @@ public: const lldb_private::DataExtractor &fpregset, const lldb_private::DataExtractor &vregset); - ~RegisterContextCorePOSIX_powerpc(); + ~RegisterContextCorePOSIX_powerpc() override; - virtual bool - ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value); + bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value) override; - virtual bool - WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); + bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; bool - ReadAllRegisterValues(lldb::DataBufferSP &data_sp); + ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; bool - WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); + WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; bool - HardwareSingleStep(bool enable); + HardwareSingleStep(bool enable) override; protected: bool - ReadGPR(); + ReadGPR() override; bool - ReadFPR(); + ReadFPR() override; bool - ReadVMX(); + ReadVMX() override; bool - WriteGPR(); + WriteGPR() override; bool - WriteFPR(); + WriteFPR() override; bool - WriteVMX(); + WriteVMX() override; private: lldb::DataBufferSP m_gpr_buffer; @@ -68,4 +74,4 @@ private: lldb_private::DataExtractor m_vec; }; -#endif // #ifndef liblldb_RegisterContextCorePOSIX_powerpc_H_ +#endif // liblldb_RegisterContextCorePOSIX_powerpc_h_ diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp index 412c7ade8295..926c7aff3603 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Target/Thread.h" -#include "Plugins/Process/Utility/RegisterContextPOSIX.h" #include "RegisterContextPOSIXCore_x86_64.h" using namespace lldb_private; diff --git a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h index ac0f49c3db52..60f2ad33b4a5 100644 --- a/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h +++ b/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h @@ -1,15 +1,19 @@ -//===-- RegisterContextCorePOSIX_x86_64.h ----------------------*- C++ -*-===// +//===-- RegisterContextCorePOSIX_x86_64.h -----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterContextCorePOSIX_x86_64_H_ -#define liblldb_RegisterContextCorePOSIX_x86_64_H_ +#ifndef liblldb_RegisterContextCorePOSIX_x86_64_h_ +#define liblldb_RegisterContextCorePOSIX_x86_64_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h" class RegisterContextCorePOSIX_x86_64 : @@ -21,38 +25,40 @@ public: const lldb_private::DataExtractor &gpregset, const lldb_private::DataExtractor &fpregset); - ~RegisterContextCorePOSIX_x86_64(); + ~RegisterContextCorePOSIX_x86_64() override; - virtual bool - ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value); + bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value) override; - virtual bool - WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); + bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; bool - ReadAllRegisterValues(lldb::DataBufferSP &data_sp); + ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; bool - WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); + WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; bool - HardwareSingleStep(bool enable); + HardwareSingleStep(bool enable) override; protected: bool - ReadGPR(); + ReadGPR() override; bool - ReadFPR(); + ReadFPR() override; bool - WriteGPR(); + WriteGPR() override; bool - WriteFPR(); + WriteFPR() override; private: uint8_t *m_gpregset; }; -#endif // #ifndef liblldb_RegisterContextCorePOSIX_x86_64_H_ +#endif // liblldb_RegisterContextCorePOSIX_x86_64_h_ diff --git a/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/source/Plugins/Process/elf-core/ThreadElfCore.cpp index 2abb6ba5decd..9cc7829fc391 100644 --- a/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ b/source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -37,9 +37,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- // Construct a Thread object with given data //---------------------------------------------------------------------- -ThreadElfCore::ThreadElfCore (Process &process, tid_t tid, - const ThreadData &td) : - Thread(process, tid), +ThreadElfCore::ThreadElfCore (Process &process, const ThreadData &td) : + Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp (), m_signo(td.signo), diff --git a/source/Plugins/Process/elf-core/ThreadElfCore.h b/source/Plugins/Process/elf-core/ThreadElfCore.h index 50502c101daf..d3a42e0eb54d 100644 --- a/source/Plugins/Process/elf-core/ThreadElfCore.h +++ b/source/Plugins/Process/elf-core/ThreadElfCore.h @@ -1,4 +1,4 @@ -//===-- ThreadElfCore.h ----------------------------------------*- C++ -*-===// +//===-- ThreadElfCore.h -----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -10,8 +10,12 @@ #ifndef liblldb_ThreadElfCore_h_ #define liblldb_ThreadElfCore_h_ +// C Includes +// C++ Includes #include <string> +// Other libraries and framework includes +// Project includes #include "lldb/Target/Thread.h" #include "lldb/Core/DataExtractor.h" @@ -104,7 +108,6 @@ struct ELFLinuxPrPsInfo return 0; } } - }; struct ThreadData @@ -112,6 +115,7 @@ struct ThreadData lldb_private::DataExtractor gpregset; lldb_private::DataExtractor fpregset; lldb_private::DataExtractor vregset; + lldb::tid_t tid; int signo; std::string name; }; @@ -119,23 +123,21 @@ struct ThreadData class ThreadElfCore : public lldb_private::Thread { public: - ThreadElfCore (lldb_private::Process &process, lldb::tid_t tid, - const ThreadData &td); + ThreadElfCore (lldb_private::Process &process, const ThreadData &td); - virtual - ~ThreadElfCore (); + ~ThreadElfCore() override; - virtual void - RefreshStateAfterStop(); + void + RefreshStateAfterStop() override; - virtual lldb::RegisterContextSP - GetRegisterContext (); + lldb::RegisterContextSP + GetRegisterContext() override; - virtual lldb::RegisterContextSP - CreateRegisterContextForFrame (lldb_private::StackFrame *frame); + lldb::RegisterContextSP + CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override; - virtual void - ClearStackFrames (); + void + ClearStackFrames() override; static bool ThreadIDIsValid (lldb::tid_t thread) @@ -143,8 +145,8 @@ public: return thread != 0; } - virtual const char * - GetName () + const char * + GetName() override { if (m_thread_name.empty()) return NULL; @@ -152,7 +154,7 @@ public: } void - SetName (const char *name) + SetName(const char *name) override { if (name && name[0]) m_thread_name.assign (name); @@ -173,8 +175,7 @@ protected: lldb_private::DataExtractor m_fpregset_data; lldb_private::DataExtractor m_vregset_data; - virtual bool CalculateStopInfo(); - + bool CalculateStopInfo() override; }; -#endif // liblldb_ThreadElfCore_h_ +#endif // liblldb_ThreadElfCore_h_ |