[Lldb-commits] [lldb] r303823 - Correct compiler warnings and Debug build of the NetBSD target

Kamil Rytarowski via lldb-commits lldb-commits at lists.llvm.org
Wed May 24 16:59:50 PDT 2017


Author: kamil
Date: Wed May 24 18:59:50 2017
New Revision: 303823

URL: http://llvm.org/viewvc/llvm-project?rev=303823&view=rev
Log:
Correct compiler warnings and Debug build of the NetBSD target

Correct files present only in the NetBSD build.

Modified:
    lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
    lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp?rev=303823&r1=303822&r2=303823&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp Wed May 24 18:59:50 2017
@@ -167,8 +167,6 @@ NativeProcessNetBSD::NativeProcessNetBSD
 
 // Handles all waitpid events from the inferior process.
 void NativeProcessNetBSD::MonitorCallback(lldb::pid_t pid, int signal) {
-  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-
   switch (signal) {
   case SIGTRAP:
     return MonitorSIGTRAP(pid);
@@ -196,7 +194,6 @@ void NativeProcessNetBSD::MonitorExited(
 }
 
 void NativeProcessNetBSD::MonitorSIGSTOP(lldb::pid_t pid) {
-  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
   ptrace_siginfo_t info;
 
   const auto siginfo_err =
@@ -305,8 +302,6 @@ void NativeProcessNetBSD::MonitorSIGTRAP
 }
 
 void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) {
-  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-
   ptrace_siginfo_t info;
   const auto siginfo_err =
       PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
@@ -898,6 +893,19 @@ void NativeProcessNetBSD::SigchldHandler
     MonitorCallback(wait_pid, signal);
 }
 
+bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) {
+  for (auto thread_sp : m_threads) {
+    assert(thread_sp && "thread list should not contain NULL threads");
+    if (thread_sp->GetID() == thread_id) {
+      // We have this thread.
+      return true;
+    }
+  }
+
+  // We don't have this thread.
+  return false;
+}
+
 NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
 
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
@@ -916,8 +924,6 @@ NativeThreadNetBSDSP NativeProcessNetBSD
 }
 
 ::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Status &error) {
-  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-
   if (pid <= 1) {
     error.SetErrorToGenericError();
     error.SetErrorString("Attaching to process 1 is not allowed.");
@@ -1006,7 +1012,7 @@ Status NativeProcessNetBSD::WriteMemory(
   io.piod_len = size;
 
   do {
-    io.piod_addr = (void *)(src + bytes_written);
+    io.piod_addr = const_cast<void *>(static_cast<const void *>(src + bytes_written));
     io.piod_offs = (void *)(addr + bytes_written);
 
     Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
@@ -1034,10 +1040,11 @@ NativeProcessNetBSD::GetAuxvData() const
   ErrorOr<std::unique_ptr<MemoryBuffer>> buf =
       llvm::MemoryBuffer::getNewMemBuffer(auxv_size);
 
-  struct ptrace_io_desc io = {.piod_op = PIOD_READ_AUXV,
-                              .piod_offs = 0,
-                              .piod_addr = (void *)buf.get()->getBufferStart(),
-                              .piod_len = auxv_size};
+  struct ptrace_io_desc io;
+  io.piod_op = PIOD_READ_AUXV;
+  io.piod_offs = 0;
+  io.piod_addr = const_cast<void *>(static_cast<const void *>(buf.get()->getBufferStart()));
+  io.piod_len = auxv_size;
 
   Status error = NativeProcessNetBSD::PtraceWrapper(PT_IO, GetID(), &io);
 

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h?rev=303823&r1=303822&r2=303823&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h Wed May 24 18:59:50 2017
@@ -115,6 +115,8 @@ private:
   // ---------------------------------------------------------------------
   NativeProcessNetBSD();
 
+  bool HasThreadNoLock(lldb::tid_t thread_id);
+
   NativeThreadNetBSDSP AddThread(lldb::tid_t thread_id);
 
   Status LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info);




More information about the lldb-commits mailing list