Author: labath Date: Wed Aug 7 06:12:59 2019 New Revision: 368168 URL: http://llvm.org/viewvc/llvm-project?rev=368168&view=rev Log: ProcessElfCore: Remove linux and freebsd NT_*** constants
These are already defined in llvm/BinaryFormat/ELF.h. Leaving the NetBSD and OpenBSD constants as-is, as they have no llvm counterparts. Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=368168&r1=368167&r2=368168&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original) +++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Wed Aug 7 06:12:59 2019 @@ -33,6 +33,7 @@ #include "ThreadElfCore.h" using namespace lldb_private; +namespace ELF = llvm::ELF; ConstString ProcessElfCore::GetPluginNameStatic() { static ConstString g_name("elf-core"); @@ -521,8 +522,8 @@ llvm::Error ProcessElfCore::parseFreeBSD if (note.info.n_name != "FreeBSD") continue; - if ((note.info.n_type == FREEBSD::NT_PRSTATUS && have_prstatus) || - (note.info.n_type == FREEBSD::NT_PRPSINFO && have_prpsinfo)) { + if ((note.info.n_type == ELF::NT_PRSTATUS && have_prstatus) || + (note.info.n_type == ELF::NT_PRPSINFO && have_prpsinfo)) { assert(thread_data.gpregset.GetByteSize() > 0); // Add the new thread to thread list m_thread_data.push_back(thread_data); @@ -532,19 +533,19 @@ llvm::Error ProcessElfCore::parseFreeBSD } switch (note.info.n_type) { - case FREEBSD::NT_PRSTATUS: + case ELF::NT_PRSTATUS: have_prstatus = true; ParseFreeBSDPrStatus(thread_data, note.data, GetArchitecture()); break; - case FREEBSD::NT_PRPSINFO: + case ELF::NT_PRPSINFO: have_prpsinfo = true; break; - case FREEBSD::NT_THRMISC: { + case ELF::NT_FREEBSD_THRMISC: { lldb::offset_t offset = 0; thread_data.name = note.data.GetCStr(&offset, 20); break; } - case FREEBSD::NT_PROCSTAT_AUXV: + case ELF::NT_FREEBSD_PROCSTAT_AUXV: // FIXME: FreeBSD sticks an int at the beginning of the note m_auxv = DataExtractor(note.data, 4, note.data.GetByteSize() - 4); break; @@ -771,8 +772,8 @@ llvm::Error ProcessElfCore::parseLinuxNo if (note.info.n_name != "CORE" && note.info.n_name != "LINUX") continue; - if ((note.info.n_type == LINUX::NT_PRSTATUS && have_prstatus) || - (note.info.n_type == LINUX::NT_PRPSINFO && have_prpsinfo)) { + if ((note.info.n_type == ELF::NT_PRSTATUS && have_prstatus) || + (note.info.n_type == ELF::NT_PRPSINFO && have_prpsinfo)) { assert(thread_data.gpregset.GetByteSize() > 0); // Add the new thread to thread list m_thread_data.push_back(thread_data); @@ -782,7 +783,7 @@ llvm::Error ProcessElfCore::parseLinuxNo } switch (note.info.n_type) { - case LINUX::NT_PRSTATUS: { + case ELF::NT_PRSTATUS: { have_prstatus = true; ELFLinuxPrStatus prstatus; Status status = prstatus.Parse(note.data, arch); @@ -795,7 +796,7 @@ llvm::Error ProcessElfCore::parseLinuxNo thread_data.gpregset = DataExtractor(note.data, header_size, len); break; } - case LINUX::NT_PRPSINFO: { + case ELF::NT_PRPSINFO: { have_prpsinfo = true; ELFLinuxPrPsInfo prpsinfo; Status status = prpsinfo.Parse(note.data, arch); @@ -805,7 +806,7 @@ llvm::Error ProcessElfCore::parseLinuxNo SetID(prpsinfo.pr_pid); break; } - case LINUX::NT_SIGINFO: { + case ELF::NT_SIGINFO: { ELFLinuxSigInfo siginfo; Status status = siginfo.Parse(note.data, arch); if (status.Fail()) @@ -813,7 +814,7 @@ llvm::Error ProcessElfCore::parseLinuxNo thread_data.signo = siginfo.si_signo; break; } - case LINUX::NT_FILE: { + case ELF::NT_FILE: { m_nt_file_entries.clear(); lldb::offset_t offset = 0; const uint64_t count = note.data.GetAddress(&offset); @@ -832,7 +833,7 @@ llvm::Error ProcessElfCore::parseLinuxNo } break; } - case LINUX::NT_AUXV: + case ELF::NT_AUXV: m_auxv = note.data; break; default: Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h?rev=368168&r1=368167&r2=368168&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h (original) +++ lldb/trunk/source/Plugins/Process/elf-core/RegisterUtilities.h Wed Aug 7 06:12:59 2019 @@ -11,21 +11,11 @@ #include "Plugins/ObjectFile/ELF/ObjectFileELF.h" #include "lldb/Utility/DataExtractor.h" +#include "llvm/BinaryFormat/ELF.h" namespace lldb_private { /// Core files PT_NOTE segment descriptor types -namespace FREEBSD { -enum { - NT_PRSTATUS = 1, - NT_FPREGSET, - NT_PRPSINFO, - NT_THRMISC = 7, - NT_PROCSTAT_AUXV = 16, - NT_PPC_VMX = 0x100 -}; -} - namespace NETBSD { enum { NT_PROCINFO = 1, NT_AUXV = 2 }; @@ -76,22 +66,6 @@ enum { }; } -namespace LINUX { -enum { - NT_PRSTATUS = 1, - NT_FPREGSET, - NT_PRPSINFO, - NT_TASKSTRUCT, - NT_PLATFORM, - NT_AUXV, - NT_FILE = 0x46494c45, - NT_SIGINFO = 0x53494749, - NT_PPC_VMX = 0x100, - NT_PPC_VSX = 0x102, - NT_PRXFPREG = 0x46e62b7f, -}; -} - struct CoreNote { ELFNote info; DataExtractor data; @@ -122,24 +96,24 @@ DataExtractor getRegset(llvm::ArrayRef<C llvm::ArrayRef<RegsetDesc> RegsetDescs); constexpr RegsetDesc FPR_Desc[] = { - {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, FREEBSD::NT_FPREGSET}, + {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_FPREGSET}, // In a i386 core file NT_FPREGSET is present, but it's not the result // of the FXSAVE instruction like in 64 bit files. // The result from FXSAVE is in NT_PRXFPREG for i386 core files - {llvm::Triple::Linux, llvm::Triple::x86, LINUX::NT_PRXFPREG}, - {llvm::Triple::Linux, llvm::Triple::UnknownArch, LINUX::NT_FPREGSET}, + {llvm::Triple::Linux, llvm::Triple::x86, llvm::ELF::NT_PRXFPREG}, + {llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_FPREGSET}, {llvm::Triple::NetBSD, llvm::Triple::aarch64, NETBSD::AARCH64::NT_FPREGS}, {llvm::Triple::NetBSD, llvm::Triple::x86_64, NETBSD::AMD64::NT_FPREGS}, {llvm::Triple::OpenBSD, llvm::Triple::UnknownArch, OPENBSD::NT_FPREGS}, }; constexpr RegsetDesc PPC_VMX_Desc[] = { - {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, FREEBSD::NT_PPC_VMX}, - {llvm::Triple::Linux, llvm::Triple::UnknownArch, LINUX::NT_PPC_VMX}, + {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VMX}, + {llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VMX}, }; constexpr RegsetDesc PPC_VSX_Desc[] = { - {llvm::Triple::Linux, llvm::Triple::UnknownArch, LINUX::NT_PPC_VSX}, + {llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VSX}, }; } // namespace lldb_private _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits