Author: Pavel Labath Date: 2022-01-26T13:10:10+01:00 New Revision: 4fa1ad05215d6242c4f195139fd4af7450cfd18e
URL: https://github.com/llvm/llvm-project/commit/4fa1ad05215d6242c4f195139fd4af7450cfd18e DIFF: https://github.com/llvm/llvm-project/commit/4fa1ad05215d6242c4f195139fd4af7450cfd18e.diff LOG: [lldb] Convert POSIXLog to use the new API Added: Modified: lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp lldb/source/Plugins/Process/Linux/IntelPTManager.cpp lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp index 25fc7028216e3..21c9ead0eca41 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp @@ -54,7 +54,7 @@ llvm::Expected<std::unique_ptr<NativeProcessProtocol>> NativeProcessFreeBSD::Factory::Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop) const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); Status status; ::pid_t pid = ProcessLauncherPosixFork() @@ -108,7 +108,7 @@ llvm::Expected<std::unique_ptr<NativeProcessProtocol>> NativeProcessFreeBSD::Factory::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop) const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid = {0:x}", pid); // Retrieve the architecture for the running process. @@ -171,7 +171,7 @@ void NativeProcessFreeBSD::MonitorCallback(lldb::pid_t pid, int signal) { } void NativeProcessFreeBSD::MonitorExited(lldb::pid_t pid, WaitStatus status) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "got exit signal({0}) , pid = {1}", status, pid); @@ -194,7 +194,7 @@ void NativeProcessFreeBSD::MonitorSIGSTOP(lldb::pid_t pid) { } void NativeProcessFreeBSD::MonitorSIGTRAP(lldb::pid_t pid) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); struct ptrace_lwpinfo info; const auto siginfo_err = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info)); @@ -357,7 +357,7 @@ void NativeProcessFreeBSD::MonitorSIGTRAP(lldb::pid_t pid) { } void NativeProcessFreeBSD::MonitorSignal(lldb::pid_t pid, int signal) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); struct ptrace_lwpinfo info; const auto siginfo_err = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info)); @@ -386,7 +386,7 @@ void NativeProcessFreeBSD::MonitorSignal(lldb::pid_t pid, int signal) { Status NativeProcessFreeBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, int *result) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); Status error; int ret; @@ -430,7 +430,7 @@ NativeProcessFreeBSD::GetSoftwareBreakpointTrapOpcode(size_t size_hint) { } Status NativeProcessFreeBSD::Resume(const ResumeActionList &resume_actions) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); Status ret; @@ -527,7 +527,7 @@ Status NativeProcessFreeBSD::Signal(int signo) { Status NativeProcessFreeBSD::Interrupt() { return Halt(); } Status NativeProcessFreeBSD::Kill() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); Status error; @@ -614,7 +614,7 @@ Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr, } Status NativeProcessFreeBSD::PopulateMemoryRegionCache() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); // If our cache is empty, pull the latest. There should always be at least // one memory region if memory region handling is supported. if (!m_mem_region_cache.empty()) { @@ -741,7 +741,7 @@ NativeProcessFreeBSD::GetFileLoadAddress(const llvm::StringRef &file_name, } void NativeProcessFreeBSD::SigchldHandler() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); int status; ::pid_t wait_pid = llvm::sys::RetryAfterSignal(-1, waitpid, GetID(), &status, WNOHANG); @@ -786,7 +786,7 @@ bool NativeProcessFreeBSD::HasThreadNoLock(lldb::tid_t thread_id) { } NativeThreadFreeBSD &NativeProcessFreeBSD::AddThread(lldb::tid_t thread_id) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id); assert(thread_id > 0); @@ -802,7 +802,7 @@ NativeThreadFreeBSD &NativeProcessFreeBSD::AddThread(lldb::tid_t thread_id) { } void NativeProcessFreeBSD::RemoveThread(lldb::tid_t thread_id) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "pid {0} removing thread with tid {1}", GetID(), thread_id); assert(thread_id > 0); @@ -854,7 +854,7 @@ Status NativeProcessFreeBSD::ReadMemory(lldb::addr_t addr, void *buf, unsigned char *dst = static_cast<unsigned char *>(buf); struct ptrace_io_desc io; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); + Log *log = GetLog(POSIXLog::Memory); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); bytes_read = 0; @@ -882,7 +882,7 @@ Status NativeProcessFreeBSD::WriteMemory(lldb::addr_t addr, const void *buf, Status error; struct ptrace_io_desc io; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); + Log *log = GetLog(POSIXLog::Memory); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); bytes_written = 0; @@ -962,7 +962,7 @@ bool NativeProcessFreeBSD::SupportHardwareSingleStepping() const { void NativeProcessFreeBSD::MonitorClone(::pid_t child_pid, bool is_vfork, NativeThreadFreeBSD &parent_thread) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "fork, child_pid={0}", child_pid); int status; diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp index 4578138a89b39..143d94069bc61 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp @@ -227,7 +227,7 @@ llvm::Error NativeRegisterContextFreeBSD_arm64::CopyHardwareWatchpointsFrom( llvm::Error NativeRegisterContextFreeBSD_arm64::ReadHardwareDebugInfo() { #ifdef LLDB_HAS_FREEBSD_WATCHPOINT - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS)); + Log *log = GetLog(POSIXLog::Registers); // we're fully stateful, so no need to reread control registers ever if (m_read_dbreg) diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp index 20e9d6cfcd7f4..a75668f3b5c7f 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeThreadFreeBSD.cpp @@ -75,7 +75,7 @@ Status NativeThreadFreeBSD::Suspend() { void NativeThreadFreeBSD::SetStoppedBySignal(uint32_t signo, const siginfo_t *info) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "tid = {0} in called with signal {1}", GetID(), signo); SetStopped(); @@ -178,7 +178,7 @@ void NativeThreadFreeBSD::SetStepping() { } std::string NativeThreadFreeBSD::GetName() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); std::vector<struct kinfo_proc> kp; int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID | KERN_PROC_INC_THREAD, @@ -213,7 +213,7 @@ lldb::StateType NativeThreadFreeBSD::GetState() { return m_state; } bool NativeThreadFreeBSD::GetStopReason(ThreadStopInfo &stop_info, std::string &description) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); description.clear(); switch (m_state) { @@ -316,7 +316,7 @@ NativeThreadFreeBSD::CopyWatchpointsFrom(NativeThreadFreeBSD &source) { llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> NativeThreadFreeBSD::GetSiginfo() const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); struct ptrace_lwpinfo info; const auto siginfo_err = NativeProcessFreeBSD::PtraceWrapper( diff --git a/lldb/source/Plugins/Process/Linux/IntelPTManager.cpp b/lldb/source/Plugins/Process/Linux/IntelPTManager.cpp index c5575fb30c98a..794689b1d3791 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTManager.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTManager.cpp @@ -182,7 +182,7 @@ Error IntelPTThreadTrace::StartTrace(lldb::pid_t pid, lldb::tid_t tid, #ifndef PERF_ATTR_SIZE_VER5 llvm_unreachable("Intel PT Linux perf event not supported"); #else - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); m_tid = tid; LLDB_LOG(log, "called thread id {0}", tid); @@ -348,7 +348,7 @@ IntelPTThreadTrace::ReadPerfTraceAux(llvm::MutableArrayRef<uint8_t> &buffer, // in the man page of perf_event_open. ioctl(*m_fd, PERF_EVENT_IOC_DISABLE); - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); Status error; uint64_t head = m_mmap_meta->aux_head; @@ -381,7 +381,7 @@ IntelPTThreadTrace::ReadPerfTraceData(llvm::MutableArrayRef<uint8_t> &buffer, #ifndef PERF_ATTR_SIZE_VER5 llvm_unreachable("perf event not supported"); #else - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); uint64_t bytes_remaining = buffer.size(); Status error; @@ -427,7 +427,7 @@ void IntelPTThreadTrace::ReadCyclicBuffer(llvm::MutableArrayRef<uint8_t> &dst, llvm::MutableArrayRef<uint8_t> src, size_t src_cyc_index, size_t offset) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); if (dst.empty() || src.empty()) { dst = dst.drop_back(dst.size()); diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index b1ac247346a79..e4dec0e00ebe4 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -79,7 +79,7 @@ static bool ProcessVmReadvSupported() { static llvm::once_flag flag; llvm::call_once(flag, [] { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); uint32_t source = 0x47424742; uint32_t dest = 0; @@ -108,7 +108,7 @@ static bool ProcessVmReadvSupported() { } static void MaybeLogLaunchInfo(const ProcessLaunchInfo &info) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); if (!log) return; @@ -143,7 +143,7 @@ static void DisplayBytes(StreamString &s, void *bytes, uint32_t count) { } static void PtraceDisplayBytes(int &req, void *data, size_t data_size) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); if (!log) return; StreamString buf; @@ -218,7 +218,7 @@ llvm::Expected<std::unique_ptr<NativeProcessProtocol>> NativeProcessLinux::Factory::Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop) const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); MaybeLogLaunchInfo(launch_info); @@ -270,7 +270,7 @@ llvm::Expected<std::unique_ptr<NativeProcessProtocol>> NativeProcessLinux::Factory::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop) const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid = {0:x}", pid); // Retrieve the architecture for the running process. @@ -336,7 +336,7 @@ NativeProcessLinux::NativeProcessLinux(::pid_t pid, int terminal_fd, } llvm::Expected<std::vector<::pid_t>> NativeProcessLinux::Attach(::pid_t pid) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); Status status; // Use a map to keep track of the threads which we have attached/need to @@ -501,7 +501,7 @@ void NativeProcessLinux::MonitorCallback(NativeThreadLinux &thread, } void NativeProcessLinux::WaitForCloneNotification(::pid_t pid) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); // The PID is not tracked yet, let's wait for it to appear. int status = -1; @@ -523,7 +523,7 @@ void NativeProcessLinux::WaitForCloneNotification(::pid_t pid) { void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thread) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); const bool is_main_thread = (thread.GetID() == GetID()); assert(info.si_signo == SIGTRAP && "Unexpected child signal!"); @@ -704,7 +704,7 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info, } void NativeProcessLinux::MonitorTrace(NativeThreadLinux &thread) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "received trace event, pid = {0}", thread.GetID()); // This thread is currently stopped. @@ -750,7 +750,7 @@ void NativeProcessLinux::MonitorSignal(const siginfo_t &info, const int signo = info.si_signo; const bool is_from_llgs = info.si_pid == getpid(); - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); // POSIX says that process behaviour is undefined after it ignores a SIGFPE, // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a kill(2) @@ -834,7 +834,7 @@ void NativeProcessLinux::MonitorSignal(const siginfo_t &info, bool NativeProcessLinux::MonitorClone(NativeThreadLinux &parent, lldb::pid_t child_pid, int event) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "parent_tid={0}, child_pid={1}, event={2}", parent.GetID(), child_pid, event); @@ -895,7 +895,7 @@ bool NativeProcessLinux::SupportHardwareSingleStepping() const { } Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); bool software_single_step = !SupportHardwareSingleStepping(); @@ -992,7 +992,7 @@ Status NativeProcessLinux::Detach() { Status NativeProcessLinux::Signal(int signo) { Status error; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "sending signal {0} ({1}) to pid {1}", signo, Host::GetSignalAsCString(signo), GetID()); @@ -1005,7 +1005,7 @@ Status NativeProcessLinux::Signal(int signo) { Status NativeProcessLinux::Interrupt() { // Pick a running thread (or if none, a not-dead stopped thread) as the // chosen thread that will be the stop-reason thread. - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); NativeThreadProtocol *running_thread = nullptr; NativeThreadProtocol *stopped_thread = nullptr; @@ -1046,7 +1046,7 @@ Status NativeProcessLinux::Interrupt() { } Status NativeProcessLinux::Kill() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); Status error; @@ -1151,7 +1151,7 @@ Status NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr, } Status NativeProcessLinux::PopulateMemoryRegionCache() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); // If our cache is empty, pull the latest. There should always be at least // one memory region if memory region handling is supported. @@ -1214,7 +1214,7 @@ Status NativeProcessLinux::PopulateMemoryRegionCache() { } void NativeProcessLinux::DoStopIDBumped(uint32_t newBumpId) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "newBumpId={0}", newBumpId); LLDB_LOG(log, "clearing {0} entries from memory region cache", m_mem_region_cache.size()); @@ -1537,7 +1537,7 @@ Status NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, bytes_read = process_vm_readv(pid, &local_iov, 1, &remote_iov, 1, 0); const bool success = bytes_read == size; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "using process_vm_readv to read {0} bytes from inferior " "address {1:x}: {2}", @@ -1553,7 +1553,7 @@ Status NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t remainder; long data; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); + Log *log = GetLog(POSIXLog::Memory); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); for (bytes_read = 0; bytes_read < size; bytes_read += remainder) { @@ -1581,7 +1581,7 @@ Status NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf, size_t remainder; Status error; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); + Log *log = GetLog(POSIXLog::Memory); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); for (bytes_written = 0; bytes_written < size; bytes_written += remainder) { @@ -1651,7 +1651,7 @@ bool NativeProcessLinux::HasThreadNoLock(lldb::tid_t thread_id) { } void NativeProcessLinux::StopTrackingThread(NativeThreadLinux &thread) { - Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *const log = GetLog(POSIXLog::Thread); lldb::tid_t thread_id = thread.GetID(); LLDB_LOG(log, "tid: {0}", thread_id); @@ -1666,7 +1666,7 @@ void NativeProcessLinux::StopTrackingThread(NativeThreadLinux &thread) { } Status NativeProcessLinux::NotifyTracersOfNewThread(lldb::tid_t tid) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); Status error(m_intel_pt_manager.OnThreadCreated(tid)); if (error.Fail()) LLDB_LOG(log, "Failed to trace a new thread with intel-pt, tid = {0}. {1}", @@ -1675,7 +1675,7 @@ Status NativeProcessLinux::NotifyTracersOfNewThread(lldb::tid_t tid) { } Status NativeProcessLinux::NotifyTracersOfThreadDestroyed(lldb::tid_t tid) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); Status error(m_intel_pt_manager.OnThreadDestroyed(tid)); if (error.Fail()) LLDB_LOG(log, @@ -1686,7 +1686,7 @@ Status NativeProcessLinux::NotifyTracersOfThreadDestroyed(lldb::tid_t tid) { NativeThreadLinux &NativeProcessLinux::AddThread(lldb::tid_t thread_id, bool resume) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id); assert(!HasThreadNoLock(thread_id) && @@ -1761,7 +1761,7 @@ NativeThreadLinux *NativeProcessLinux::GetCurrentThread() { Status NativeProcessLinux::ResumeThread(NativeThreadLinux &thread, lldb::StateType state, int signo) { - Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *const log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "tid: {0}", thread.GetID()); // Before we do the resume below, first check if we have a pending stop @@ -1801,7 +1801,7 @@ Status NativeProcessLinux::ResumeThread(NativeThreadLinux &thread, //===----------------------------------------------------------------------===// void NativeProcessLinux::StopRunningThreads(const lldb::tid_t triggering_tid) { - Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *const log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "about to process event: (triggering_tid: {0})", triggering_tid); @@ -1848,7 +1848,7 @@ void NativeProcessLinux::SignalIfAllThreadsStopped() { } void NativeProcessLinux::ThreadWasCreated(NativeThreadLinux &thread) { - Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *const log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "tid: {0}", thread.GetID()); if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID && @@ -1860,7 +1860,7 @@ void NativeProcessLinux::ThreadWasCreated(NativeThreadLinux &thread) { } void NativeProcessLinux::SigchldHandler() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); // Threads can appear or disappear as a result of event processing, so gather // the events upfront. @@ -1910,7 +1910,7 @@ Status NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr, Status error; long int ret; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); PtraceDisplayBytes(req, data, data_size); diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp index 90a6d8dcba042..920de58e07d61 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp @@ -130,7 +130,7 @@ Status NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS)); + Log *log = GetLog(POSIXLog::Registers); long data; Status error = NativeProcessLinux::PtraceWrapper( @@ -147,7 +147,7 @@ Status NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset, Status NativeRegisterContextLinux::DoWriteRegisterValue( uint32_t offset, const char *reg_name, const RegisterValue &value) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS)); + Log *log = GetLog(POSIXLog::Registers); void *buf = reinterpret_cast<void *>(value.GetAsUInt64()); LLDB_LOG(log, "{0}: {1}", reg_name, buf); diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp index 7e798ac3cb56a..399cd699a040f 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp @@ -270,7 +270,7 @@ bool NativeRegisterContextLinux_arm::IsFPR(unsigned reg) const { } uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareBreakpoints() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); + Log *log = GetLog(POSIXLog::Breakpoints); LLDB_LOGF(log, "NativeRegisterContextLinux_arm::%s()", __FUNCTION__); @@ -289,7 +289,7 @@ uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareBreakpoints() { uint32_t NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); + Log *log = GetLog(POSIXLog::Breakpoints); LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size); // Read hardware breakpoint and watchpoint information. @@ -347,7 +347,7 @@ NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr, } bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); + Log *log = GetLog(POSIXLog::Breakpoints); LLDB_LOG(log, "hw_idx: {0}", hw_idx); // Read hardware breakpoint and watchpoint information. @@ -381,7 +381,7 @@ bool NativeRegisterContextLinux_arm::ClearHardwareBreakpoint(uint32_t hw_idx) { Status NativeRegisterContextLinux_arm::GetHardwareBreakHitIndex( uint32_t &bp_index, lldb::addr_t trap_addr) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); + Log *log = GetLog(POSIXLog::Breakpoints); LLDB_LOGF(log, "NativeRegisterContextLinux_arm::%s()", __FUNCTION__); @@ -401,7 +401,7 @@ Status NativeRegisterContextLinux_arm::GetHardwareBreakHitIndex( } Status NativeRegisterContextLinux_arm::ClearAllHardwareBreakpoints() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); + Log *log = GetLog(POSIXLog::Breakpoints); LLDB_LOGF(log, "NativeRegisterContextLinux_arm::%s()", __FUNCTION__); @@ -442,7 +442,7 @@ Status NativeRegisterContextLinux_arm::ClearAllHardwareBreakpoints() { } uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareWatchpoints() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); // Read hardware breakpoint and watchpoint information. Status error = ReadHardwareDebugInfo(); @@ -456,7 +456,7 @@ uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareWatchpoints() { uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint( lldb::addr_t addr, size_t size, uint32_t watch_flags) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size, watch_flags); @@ -561,7 +561,7 @@ uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint( bool NativeRegisterContextLinux_arm::ClearHardwareWatchpoint( uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); // Read hardware breakpoint and watchpoint information. @@ -630,7 +630,7 @@ Status NativeRegisterContextLinux_arm::ClearAllHardwareWatchpoints() { } uint32_t NativeRegisterContextLinux_arm::GetWatchpointSize(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); switch ((m_hwp_regs[wp_index].control >> 5) & 0x0f) { @@ -647,7 +647,7 @@ uint32_t NativeRegisterContextLinux_arm::GetWatchpointSize(uint32_t wp_index) { } } bool NativeRegisterContextLinux_arm::WatchpointIsEnabled(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if ((m_hwp_regs[wp_index].control & 0x1) == 0x1) @@ -659,7 +659,7 @@ bool NativeRegisterContextLinux_arm::WatchpointIsEnabled(uint32_t wp_index) { Status NativeRegisterContextLinux_arm::GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr); uint32_t watch_size; @@ -682,7 +682,7 @@ NativeRegisterContextLinux_arm::GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t NativeRegisterContextLinux_arm::GetWatchpointAddress(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) @@ -696,7 +696,7 @@ NativeRegisterContextLinux_arm::GetWatchpointAddress(uint32_t wp_index) { lldb::addr_t NativeRegisterContextLinux_arm::GetWatchpointHitAddress(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp index 5af5aa548f2eb..1c447175033e9 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp @@ -499,7 +499,7 @@ bool NativeRegisterContextLinux_ppc64le::IsVSX(unsigned reg) { } uint32_t NativeRegisterContextLinux_ppc64le::NumSupportedHardwareWatchpoints() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); // Read hardware breakpoint and watchpoint information. Status error = ReadHardwareDebugInfo(); @@ -513,7 +513,7 @@ uint32_t NativeRegisterContextLinux_ppc64le::NumSupportedHardwareWatchpoints() { uint32_t NativeRegisterContextLinux_ppc64le::SetHardwareWatchpoint( lldb::addr_t addr, size_t size, uint32_t watch_flags) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size, watch_flags); @@ -600,7 +600,7 @@ uint32_t NativeRegisterContextLinux_ppc64le::SetHardwareWatchpoint( bool NativeRegisterContextLinux_ppc64le::ClearHardwareWatchpoint( uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); // Read hardware breakpoint and watchpoint information. @@ -640,7 +640,7 @@ bool NativeRegisterContextLinux_ppc64le::ClearHardwareWatchpoint( uint32_t NativeRegisterContextLinux_ppc64le::GetWatchpointSize(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); unsigned control = (m_hwp_regs[wp_index].control >> 5) & 0xff; @@ -653,7 +653,7 @@ NativeRegisterContextLinux_ppc64le::GetWatchpointSize(uint32_t wp_index) { bool NativeRegisterContextLinux_ppc64le::WatchpointIsEnabled( uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); return !!((m_hwp_regs[wp_index].control & 0x1) == 0x1); @@ -661,7 +661,7 @@ bool NativeRegisterContextLinux_ppc64le::WatchpointIsEnabled( Status NativeRegisterContextLinux_ppc64le::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr); uint32_t watch_size; @@ -684,7 +684,7 @@ Status NativeRegisterContextLinux_ppc64le::GetWatchpointHitIndex( lldb::addr_t NativeRegisterContextLinux_ppc64le::GetWatchpointAddress(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) @@ -698,7 +698,7 @@ NativeRegisterContextLinux_ppc64le::GetWatchpointAddress(uint32_t wp_index) { lldb::addr_t NativeRegisterContextLinux_ppc64le::GetWatchpointHitAddress(uint32_t wp_index) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS)); + Log *log = GetLog(POSIXLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp index 5f8057d2fef63..e7124ef8e5498 100644 --- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp @@ -65,7 +65,7 @@ bool WorkaroundNeeded() { // turn, and verify that single-stepping works on that cpu. A workaround is // needed if we find at least one broken cpu. - Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *log = GetLog(POSIXLog::Thread); ::pid_t child_pid = fork(); if (child_pid == -1) { LLDB_LOG(log, "failed to fork(): {0}", Status(errno, eErrorTypePOSIX)); @@ -144,7 +144,7 @@ bool WorkaroundNeeded() { } // end anonymous namespace std::unique_ptr<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) { - Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *log = GetLog(POSIXLog::Thread); static bool workaround_needed = WorkaroundNeeded(); if (!workaround_needed) { @@ -176,7 +176,7 @@ std::unique_ptr<SingleStepWorkaround> SingleStepWorkaround::Get(::pid_t tid) { } SingleStepWorkaround::~SingleStepWorkaround() { - Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "Removing workaround"); if (sched_setaffinity(m_tid, sizeof m_original_set, &m_original_set) != 0) { LLDB_LOG(log, "Unable to reset cpu affinity for thread {0}: {1}", m_tid, diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp index 0420d00e39d61..182eefb7bee7f 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -59,7 +59,7 @@ llvm::Expected<std::unique_ptr<NativeProcessProtocol>> NativeProcessNetBSD::Factory::Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop) const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); Status status; ::pid_t pid = ProcessLauncherPosixFork() @@ -113,7 +113,7 @@ llvm::Expected<std::unique_ptr<NativeProcessProtocol>> NativeProcessNetBSD::Factory::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop) const { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid = {0:x}", pid); // Retrieve the architecture for the running process. @@ -172,7 +172,7 @@ void NativeProcessNetBSD::MonitorCallback(lldb::pid_t pid, int signal) { } void NativeProcessNetBSD::MonitorExited(lldb::pid_t pid, WaitStatus status) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "got exit signal({0}) , pid = {1}", status, pid); @@ -207,7 +207,7 @@ void NativeProcessNetBSD::MonitorSIGSTOP(lldb::pid_t pid) { } void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); ptrace_siginfo_t info; const auto siginfo_err = @@ -359,7 +359,7 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { } void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); ptrace_siginfo_t info; const auto siginfo_err = @@ -383,7 +383,7 @@ void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) { Status NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, int *result) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE)); + Log *log = GetLog(POSIXLog::Ptrace); Status error; int ret; @@ -459,7 +459,7 @@ static llvm::Expected<ptrace_siginfo_t> ComputeSignalInfo( } Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); Status ret; @@ -562,7 +562,7 @@ Status NativeProcessNetBSD::Interrupt() { } Status NativeProcessNetBSD::Kill() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); Status error; @@ -654,7 +654,7 @@ Status NativeProcessNetBSD::GetMemoryRegionInfo(lldb::addr_t load_addr, } Status NativeProcessNetBSD::PopulateMemoryRegionCache() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); // If our cache is empty, pull the latest. There should always be at least // one memory region if memory region handling is supported. if (!m_mem_region_cache.empty()) { @@ -772,7 +772,7 @@ Status NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name, } void NativeProcessNetBSD::SigchldHandler() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); int status; ::pid_t wait_pid = llvm::sys::RetryAfterSignal(-1, waitpid, GetID(), &status, WALLSIG | WNOHANG); @@ -817,7 +817,7 @@ bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) { } NativeThreadNetBSD &NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id); assert(thread_id > 0); @@ -833,7 +833,7 @@ NativeThreadNetBSD &NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) { } void NativeProcessNetBSD::RemoveThread(lldb::tid_t thread_id) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "pid {0} removing thread with tid {1}", GetID(), thread_id); assert(thread_id > 0); @@ -882,7 +882,7 @@ Status NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, unsigned char *dst = static_cast<unsigned char *>(buf); struct ptrace_io_desc io; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); + Log *log = GetLog(POSIXLog::Memory); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); bytes_read = 0; @@ -910,7 +910,7 @@ Status NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf, Status error; struct ptrace_io_desc io; - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY)); + Log *log = GetLog(POSIXLog::Memory); LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size); bytes_written = 0; @@ -1013,7 +1013,7 @@ Status NativeProcessNetBSD::ReinitializeThreads() { void NativeProcessNetBSD::MonitorClone(::pid_t child_pid, bool is_vfork, NativeThreadNetBSD &parent_thread) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); + Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "clone, child_pid={0}", child_pid); int status; diff --git a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp index 400b89a5fddf0..3e8cf9fd9f23e 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp @@ -75,7 +75,7 @@ Status NativeThreadNetBSD::Suspend() { void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo, const siginfo_t *info) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); LLDB_LOG(log, "tid = {0} in called with signal {1}", GetID(), signo); SetStopped(); @@ -178,7 +178,7 @@ void NativeThreadNetBSD::SetStepping() { } std::string NativeThreadNetBSD::GetName() { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); #ifdef PT_LWPSTATUS struct ptrace_lwpstatus info = {}; @@ -225,7 +225,7 @@ lldb::StateType NativeThreadNetBSD::GetState() { return m_state; } bool NativeThreadNetBSD::GetStopReason(ThreadStopInfo &stop_info, std::string &description) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); + Log *log = GetLog(POSIXLog::Thread); description.clear(); switch (m_state) { diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h index f0807e1d4480d..7b8b6cdbf2557 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h @@ -26,19 +26,9 @@ enum class POSIXLog : Log::MaskType { LLVM_MARK_AS_BITMASK_ENUM(Watchpoints) }; -#define POSIX_LOG_PROCESS ::lldb_private::POSIXLog::Process -#define POSIX_LOG_THREAD ::lldb_private::POSIXLog::Thread -#define POSIX_LOG_MEMORY ::lldb_private::POSIXLog::Memory -#define POSIX_LOG_PTRACE ::lldb_private::POSIXLog::Ptrace -#define POSIX_LOG_REGISTERS ::lldb_private::POSIXLog::Registers -#define POSIX_LOG_BREAKPOINTS ::lldb_private::POSIXLog::Breakpoints -#define POSIX_LOG_WATCHPOINTS ::lldb_private::POSIXLog::Watchpoints - class ProcessPOSIXLog { public: static void Initialize(); - - static Log *GetLogIfAllCategoriesSet(POSIXLog mask) { return GetLog(mask); } }; template <> Log::Channel &LogChannelFor<POSIXLog>(); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits