[Lldb-commits] [PATCH] D32866: Fix -DLLVM_BUILD_TESTS=ON lldb build

2017-05-04 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs created this revision.
Herald added a subscriber: mgorny.

There are two issues here. The first:

  liblldbHost.a(Editline.cpp.o):(.debug_addr+0x238): undefined reference to 
`el_get'

when linking InterpreterTests, is caused by -ledit coming after liblldbHost.a 
in the link line.

The second:

  liblldbCore.a(IOHandler.cpp.o):(.debug_addr+0x2564): undefined reference to 
`del_panel'

because libpanel.a and liblldbCore.a are out of order in the link line.


https://reviews.llvm.org/D32866

Files:
  source/Core/CMakeLists.txt
  source/Host/CMakeLists.txt


Index: source/Host/CMakeLists.txt
===
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -48,6 +48,7 @@
   add_host_subdirectory(common
 common/Editline.cpp
 )
+  list(APPEND EXTRA_LIBS edit)
 endif()
 
 add_host_subdirectory(posix
@@ -160,7 +161,7 @@
 endif()
 
 if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- set(EXTRA_LIBS kvm)
+ list(APPEND EXTRA_LIBS kvm)
 endif ()
 
 add_lldb_library(lldbHost
Index: source/Core/CMakeLists.txt
===
--- source/Core/CMakeLists.txt
+++ source/Core/CMakeLists.txt
@@ -69,6 +69,7 @@
   LINK_COMPONENTS
 Support
 Demangle
+${LLDB_SYSTEM_LIBS}
   )
 
 # Needed to properly resolve references in a debug build.


Index: source/Host/CMakeLists.txt
===
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -48,6 +48,7 @@
   add_host_subdirectory(common
 common/Editline.cpp
 )
+  list(APPEND EXTRA_LIBS edit)
 endif()
 
 add_host_subdirectory(posix
@@ -160,7 +161,7 @@
 endif()
 
 if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- set(EXTRA_LIBS kvm)
+ list(APPEND EXTRA_LIBS kvm)
 endif ()
 
 add_lldb_library(lldbHost
Index: source/Core/CMakeLists.txt
===
--- source/Core/CMakeLists.txt
+++ source/Core/CMakeLists.txt
@@ -69,6 +69,7 @@
   LINK_COMPONENTS
 Support
 Demangle
+${LLDB_SYSTEM_LIBS}
   )
 
 # Needed to properly resolve references in a debug build.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D32866: Fix -DLLVM_BUILD_TESTS=ON lldb build

2017-05-04 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs planned changes to this revision.
jroelofs added a comment.

hmm. I'm getting more libpanel link issues in another build.


https://reviews.llvm.org/D32866



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D32866: Fix -DLLVM_BUILD_TESTS=ON lldb build

2017-05-04 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs updated this revision to Diff 97842.

https://reviews.llvm.org/D32866

Files:
  source/Core/CMakeLists.txt
  source/Host/CMakeLists.txt


Index: source/Host/CMakeLists.txt
===
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -48,6 +48,7 @@
   add_host_subdirectory(common
 common/Editline.cpp
 )
+  list(APPEND EXTRA_LIBS edit)
 endif()
 
 add_host_subdirectory(posix
@@ -160,12 +161,12 @@
 endif()
 
 if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- set(EXTRA_LIBS kvm)
+ list(APPEND EXTRA_LIBS kvm)
 endif ()
 
 add_lldb_library(lldbHost
   ${HOST_SOURCES}
-  
+
   LINK_LIBS
 lldbCore
 lldbInterpreter
@@ -174,7 +175,8 @@
 lldbUtility
 ${LLDB_PLUGINS}
 ${EXTRA_LIBS}
-  
+
   LINK_COMPONENTS
 Support
   )
+
Index: source/Core/CMakeLists.txt
===
--- source/Core/CMakeLists.txt
+++ source/Core/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_library(lldbCore
   Address.cpp
   AddressRange.cpp
@@ -65,6 +67,7 @@
 lldbPluginCPlusPlusLanguage
 lldbPluginObjCLanguage
 lldbPluginObjectFileJIT
+${LLDB_SYSTEM_LIBS}
 
   LINK_COMPONENTS
 Support


Index: source/Host/CMakeLists.txt
===
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -48,6 +48,7 @@
   add_host_subdirectory(common
 common/Editline.cpp
 )
+  list(APPEND EXTRA_LIBS edit)
 endif()
 
 add_host_subdirectory(posix
@@ -160,12 +161,12 @@
 endif()
 
 if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- set(EXTRA_LIBS kvm)
+ list(APPEND EXTRA_LIBS kvm)
 endif ()
 
 add_lldb_library(lldbHost
   ${HOST_SOURCES}
-  
+
   LINK_LIBS
 lldbCore
 lldbInterpreter
@@ -174,7 +175,8 @@
 lldbUtility
 ${LLDB_PLUGINS}
 ${EXTRA_LIBS}
-  
+
   LINK_COMPONENTS
 Support
   )
+
Index: source/Core/CMakeLists.txt
===
--- source/Core/CMakeLists.txt
+++ source/Core/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 add_lldb_library(lldbCore
   Address.cpp
   AddressRange.cpp
@@ -65,6 +67,7 @@
 lldbPluginCPlusPlusLanguage
 lldbPluginObjCLanguage
 lldbPluginObjectFileJIT
+${LLDB_SYSTEM_LIBS}
 
   LINK_COMPONENTS
 Support
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs created this revision.
Herald added a subscriber: srhines.

Alternatively, I could teach llvm:set_thread_name() how to take a thread 
parameter, and use that here instead.


https://reviews.llvm.org/D30844

Files:
  source/Host/linux/HostThreadLinux.cpp


Index: source/Host/linux/HostThreadLinux.cpp
===
--- source/Host/linux/HostThreadLinux.cpp
+++ source/Host/linux/HostThreadLinux.cpp
@@ -23,7 +23,8 @@
 : HostThreadPosix(thread) {}
 
 void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
+#if (((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
+ defined(_GNU_SOURCE)) || defined(__ANDROID__)
   ::pthread_setname_np(thread, name.data());
 #else
   (void)thread;


Index: source/Host/linux/HostThreadLinux.cpp
===
--- source/Host/linux/HostThreadLinux.cpp
+++ source/Host/linux/HostThreadLinux.cpp
@@ -23,7 +23,8 @@
 : HostThreadPosix(thread) {}
 
 void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
+#if (((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
+ defined(_GNU_SOURCE)) || defined(__ANDROID__)
   ::pthread_setname_np(thread, name.data());
 #else
   (void)thread;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a comment.

Yeah, I'm on tip of trunk as of a few minutes ago.

`llvm::set_thread_name()` exists, but it doesn't take a thread parameter like 
this one does (no idea if that's (still?) used or not in lldb).


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a comment.

sure


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a comment.

looks like lldb.xcodeproj refers to the files which I'll be deleting... do I 
need to worry about that?


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a comment.

erm, nevermind, I misread.


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs updated this revision to Diff 91419.
jroelofs added a comment.
Herald added a subscriber: emaste.

Built successfully on linux (lots of tests fail, not sure if that's expected or 
not?). I don't have a FreeBSD machine, but it looks "obviously" the same.


https://reviews.llvm.org/D30844

Files:
  include/lldb/Host/freebsd/HostThreadFreeBSD.h
  include/lldb/Host/linux/HostThreadLinux.h
  source/Host/freebsd/HostThreadFreeBSD.cpp
  source/Host/linux/HostThreadLinux.cpp
  source/Plugins/Process/Linux/NativeThreadLinux.cpp

Index: source/Plugins/Process/Linux/NativeThreadLinux.cpp
===
--- source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -97,7 +97,7 @@
   // const NativeProcessLinux *const process =
   // reinterpret_cast (process_sp->get ());
   llvm::SmallString<32> thread_name;
-  HostNativeThread::GetName(GetID(), thread_name);
+  llvm::get_thread_name(thread_name);
   return thread_name.c_str();
 }
 
Index: source/Host/linux/HostThreadLinux.cpp
===
--- source/Host/linux/HostThreadLinux.cpp
+++ source/Host/linux/HostThreadLinux.cpp
@@ -8,13 +8,7 @@
 //===--===//
 
 #include "lldb/Host/linux/HostThreadLinux.h"
-#include "Plugins/Process/Linux/ProcFileReader.h"
-#include "lldb/Utility/DataBuffer.h"
 
-#include "llvm/ADT/SmallVector.h"
-
-#include 
-
 using namespace lldb_private;
 
 HostThreadLinux::HostThreadLinux() : HostThreadPosix() {}
@@ -21,25 +15,3 @@
 
 HostThreadLinux::HostThreadLinux(lldb::thread_t thread)
 : HostThreadPosix(thread) {}
-
-void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
-  ::pthread_setname_np(thread, name.data());
-#else
-  (void)thread;
-  (void)name;
-#endif
-}
-
-void HostThreadLinux::GetName(lldb::thread_t thread,
-  llvm::SmallVectorImpl &name) {
-  // Read /proc/$TID/comm file.
-  lldb::DataBufferSP buf_sp =
-  process_linux::ProcFileReader::ReadIntoDataBuffer(thread, "comm");
-  const char *comm_str = (const char *)buf_sp->GetBytes();
-  const char *cr_str = ::strchr(comm_str, '\n');
-  size_t length = cr_str ? (cr_str - comm_str) : strlen(comm_str);
-
-  name.clear();
-  name.append(comm_str, comm_str + length);
-}
Index: source/Host/freebsd/HostThreadFreeBSD.cpp
===
--- source/Host/freebsd/HostThreadFreeBSD.cpp
+++ source/Host/freebsd/HostThreadFreeBSD.cpp
@@ -11,19 +11,6 @@
 #include "lldb/Host/freebsd/HostThreadFreeBSD.h"
 #include "lldb/Host/Host.h"
 
-// C includes
-#include 
-#include 
-#if defined(__FreeBSD__)
-#include 
-#endif
-#include 
-#include 
-#include 
-
-// C++ includes
-#include 
-
 using namespace lldb_private;
 
 HostThreadFreeBSD::HostThreadFreeBSD() {}
@@ -30,41 +17,3 @@
 
 HostThreadFreeBSD::HostThreadFreeBSD(lldb::thread_t thread)
 : HostThreadPosix(thread) {}
-
-void HostThreadFreeBSD::GetName(lldb::tid_t tid,
-llvm::SmallVectorImpl &name) {
-  name.clear();
-  int pid = Host::GetCurrentProcessID();
-
-  struct kinfo_proc *kp = nullptr, *nkp;
-  size_t len = 0;
-  int error;
-  int ctl[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID | KERN_PROC_INC_THREAD,
-(int)pid};
-
-  while (1) {
-error = sysctl(ctl, 4, kp, &len, nullptr, 0);
-if (kp == nullptr || (error != 0 && errno == ENOMEM)) {
-  // Add extra space in case threads are added before next call.
-  len += sizeof(*kp) + len / 10;
-  nkp = (struct kinfo_proc *)realloc(kp, len);
-  if (nkp == nullptr) {
-free(kp);
-return;
-  }
-  kp = nkp;
-  continue;
-}
-if (error != 0)
-  len = 0;
-break;
-  }
-
-  for (size_t i = 0; i < len / sizeof(*kp); i++) {
-if (kp[i].ki_tid == (lwpid_t)tid) {
-  name.append(kp[i].ki_tdname, kp[i].ki_tdname + strlen(kp[i].ki_tdname));
-  break;
-}
-  }
-  free(kp);
-}
Index: include/lldb/Host/linux/HostThreadLinux.h
===
--- include/lldb/Host/linux/HostThreadLinux.h
+++ include/lldb/Host/linux/HostThreadLinux.h
@@ -21,9 +21,6 @@
 public:
   HostThreadLinux();
   HostThreadLinux(lldb::thread_t thread);
-
-  static void SetName(lldb::thread_t thread, llvm::StringRef name);
-  static void GetName(lldb::thread_t thread, llvm::SmallVectorImpl &name);
 };
 }
 
Index: include/lldb/Host/freebsd/HostThreadFreeBSD.h
===
--- include/lldb/Host/freebsd/HostThreadFreeBSD.h
+++ include/lldb/Host/freebsd/HostThreadFreeBSD.h
@@ -21,8 +21,6 @@
 public:
   HostThreadFreeBSD();
   HostThreadFreeBSD(lldb::thread_t thread);
-
-  static void GetName(lldb::tid_t tid, llvm::SmallVector

[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a subscriber: labath.
jroelofs added a comment.

@labath thoughts?


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-10 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a comment.

In https://reviews.llvm.org/D30844#698294, @zturner wrote:

> The test suite is full of flakiness, but as long as it's the same before and 
> after your change, it doesn't seem like anything is broken.


Results are pretty much the same, with 1 or 2 twinkling tests (couldn't say 
which ones it is though: I'm not at all familiar with lldb's test harness).

Before:

  ===
  Test Result Summary
  ===
  Test Methods:   1897
  Reruns:   14
  Success: 877
  Expected Failure:109
  Failure: 306
  Error:21
  Exceptional Exit:  0
  Unexpected Success:   15
  Skip:568
  Timeout:   1
  Expected Timeout:  0

After:

  ===
  Test Result Summary
  ===
  Test Methods:   1897
  Reruns:   14
  Success: 876
  Expected Failure:108
  Failure: 307
  Error:21
  Exceptional Exit:  0
  Unexpected Success:   16
  Skip:568
  Timeout:   1
  Expected Timeout:  0


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-13 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs added a comment.

> If you want to get your build working, I suggest you just remove the setting 
> code.

@labath I have my local build working, but I don't want to carry local patches 
if possible. How about the original patch, which adds the glibc 2.12 check:

   void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
  -#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
  +#if (((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
  + defined(_GNU_SOURCE)) || defined(__ANDROID__)
 ::pthread_setname_np(thread, name.data());
   #else
 (void)thread;

It's no worse than what was already there, makes forward progress in supporting 
this particular host platform, and avoids a bunch more yak shaving.


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-13 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs updated this revision to Diff 91566.
jroelofs added a comment.

It builds, so the code was dead anyway. Didn't re-run the tests.


https://reviews.llvm.org/D30844

Files:
  include/lldb/Host/linux/HostThreadLinux.h
  source/Host/linux/HostThreadLinux.cpp


Index: source/Host/linux/HostThreadLinux.cpp
===
--- source/Host/linux/HostThreadLinux.cpp
+++ source/Host/linux/HostThreadLinux.cpp
@@ -13,8 +13,6 @@
 
 #include "llvm/ADT/SmallVector.h"
 
-#include 
-
 using namespace lldb_private;
 
 HostThreadLinux::HostThreadLinux() : HostThreadPosix() {}
@@ -22,15 +20,6 @@
 HostThreadLinux::HostThreadLinux(lldb::thread_t thread)
 : HostThreadPosix(thread) {}
 
-void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
-  ::pthread_setname_np(thread, name.data());
-#else
-  (void)thread;
-  (void)name;
-#endif
-}
-
 void HostThreadLinux::GetName(lldb::thread_t thread,
   llvm::SmallVectorImpl &name) {
   // Read /proc/$TID/comm file.
Index: include/lldb/Host/linux/HostThreadLinux.h
===
--- include/lldb/Host/linux/HostThreadLinux.h
+++ include/lldb/Host/linux/HostThreadLinux.h
@@ -22,7 +22,6 @@
   HostThreadLinux();
   HostThreadLinux(lldb::thread_t thread);
 
-  static void SetName(lldb::thread_t thread, llvm::StringRef name);
   static void GetName(lldb::thread_t thread, llvm::SmallVectorImpl 
&name);
 };
 }


Index: source/Host/linux/HostThreadLinux.cpp
===
--- source/Host/linux/HostThreadLinux.cpp
+++ source/Host/linux/HostThreadLinux.cpp
@@ -13,8 +13,6 @@
 
 #include "llvm/ADT/SmallVector.h"
 
-#include 
-
 using namespace lldb_private;
 
 HostThreadLinux::HostThreadLinux() : HostThreadPosix() {}
@@ -22,15 +20,6 @@
 HostThreadLinux::HostThreadLinux(lldb::thread_t thread)
 : HostThreadPosix(thread) {}
 
-void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
-  ::pthread_setname_np(thread, name.data());
-#else
-  (void)thread;
-  (void)name;
-#endif
-}
-
 void HostThreadLinux::GetName(lldb::thread_t thread,
   llvm::SmallVectorImpl &name) {
   // Read /proc/$TID/comm file.
Index: include/lldb/Host/linux/HostThreadLinux.h
===
--- include/lldb/Host/linux/HostThreadLinux.h
+++ include/lldb/Host/linux/HostThreadLinux.h
@@ -22,7 +22,6 @@
   HostThreadLinux();
   HostThreadLinux(lldb::thread_t thread);
 
-  static void SetName(lldb::thread_t thread, llvm::StringRef name);
   static void GetName(lldb::thread_t thread, llvm::SmallVectorImpl &name);
 };
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30844: pthread_setname_np first appeared in glibc 2.12

2017-03-13 Thread Jonathan Roelofs via Phabricator via lldb-commits
jroelofs closed this revision.
jroelofs added a comment.

r297626


https://reviews.llvm.org/D30844



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits