[Lldb-commits] [lldb] r297609 - Fix Linux build for the FileSpec changes

2017-03-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar 13 04:46:15 2017
New Revision: 297609

URL: http://llvm.org/viewvc/llvm-project?rev=297609&view=rev
Log:
Fix Linux build for the FileSpec changes

Propagate changes that were made during review, and fix a couple of
warnings while I'm in there.

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Utility/TildeExpressionResolver.cpp
lldb/trunk/unittests/Interpreter/TestCompletion.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297609&r1=297608&r2=297609&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar 13 04:46:15 2017
@@ -651,11 +651,8 @@ bool FileSpec::ResolvePath() {
   if (m_is_resolved)
 return true; // We have already resolved this path
 
-  char path_buf[PATH_MAX];
-  if (!GetPath(path_buf, PATH_MAX, false))
-return false;
   // SetFile(...) will set m_is_resolved correctly if it can resolve the path
-  SetFile(path_buf, true);
+  SetFile(GetPath(false), true);
   return m_is_resolved;
 }
 
@@ -779,7 +776,7 @@ void FileSpec::EnumerateDirectory(llvm::
   for (; Iter != End && !EC; Iter.increment(EC)) {
 const auto &Item = *Iter;
 fs::file_status Status;
-if (EC = Item.status(Status))
+if ((EC = Item.status(Status)))
   break;
 if (!find_files && fs::is_regular_file(Status))
   continue;

Modified: lldb/trunk/source/Utility/TildeExpressionResolver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TildeExpressionResolver.cpp?rev=297609&r1=297608&r2=297609&view=diff
==
--- lldb/trunk/source/Utility/TildeExpressionResolver.cpp (original)
+++ lldb/trunk/source/Utility/TildeExpressionResolver.cpp Mon Mar 13 04:46:15 
2017
@@ -62,7 +62,8 @@ bool StandardTildeExpressionResolver::Re
 
 Buffer.resize(1);
 Buffer.append(ThisName);
-Buffer.append(path::get_separator()) Output.insert(Buffer);
+Buffer.append(path::get_separator());
+Output.insert(Buffer);
   }
 
   return true;

Modified: lldb/trunk/unittests/Interpreter/TestCompletion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Interpreter/TestCompletion.cpp?rev=297609&r1=297608&r2=297609&view=diff
==
--- lldb/trunk/unittests/Interpreter/TestCompletion.cpp (original)
+++ lldb/trunk/unittests/Interpreter/TestCompletion.cpp Mon Mar 13 04:46:15 2017
@@ -89,7 +89,7 @@ public:
 assert(Expr.empty() || Expr[0] == '~');
 Expr = Expr.drop_front();
 
-SmallString<16> QualifiedName = "~";
+SmallString<16> QualifiedName("~");
 for (const auto &User : UserDirectories) {
   if (!User.getKey().startswith(Expr))
 continue;
@@ -155,7 +155,7 @@ protected:
   }
 
   static bool HasEquivalentFile(const Twine &Path, const StringList &Paths) {
-for (int I = 0; I < Paths.GetSize(); ++I) {
+for (size_t I = 0; I < Paths.GetSize(); ++I) {
   if (fs::equivalent(Path, Paths[I]))
 return true;
 }
@@ -165,7 +165,7 @@ protected:
   static bool ContainsExactString(const Twine &Str, const StringList &Paths) {
 SmallString<16> Storage;
 StringRef Rendered = Str.toStringRef(Storage);
-for (int I = 0; I < Paths.GetSize(); ++I) {
+for (size_t I = 0; I < Paths.GetSize(); ++I) {
   if (Paths[I] == Rendered)
 return true;
 }
@@ -197,17 +197,20 @@ TEST_F(CompletionTest, DirCompletionAbso
   // by asserting an exact result count, and verifying against known
   // folders.
 
+  StandardTildeExpressionResolver Resolver;
   StringList Results;
   // When a directory is specified that doesn't end in a slash, it searches
   // for that directory, not items under it.
-  int Count = CommandCompletions::DiskDirectories2(BaseDir, Results);
-  ASSERT_EQ(1, Count);
+  size_t Count =
+  CommandCompletions::DiskDirectories(BaseDir, Results, Resolver);
+  ASSERT_EQ(1u, Count);
   ASSERT_EQ(Count, Results.GetSize());
   EXPECT_TRUE(HasEquivalentFile(BaseDir, Results));
 
   // When the same directory ends with a slash, it finds all children.
-  Count = CommandCompletions::DiskDirectories2(Twine(BaseDir) + "/", Results);
-  ASSERT_EQ(7, Count);
+  Count = CommandCompletions::DiskDirectories(Twine(BaseDir) + "/", Results,
+  Resolver);
+  ASSERT_EQ(7u, Count);
   ASSERT_EQ(Count, Results.GetSize());
   EXPECT_TRUE(HasEquivalentFile(DirFoo, Results));
   EXPECT_TRUE(HasEquivalentFile(DirFooA, Results));
@@ -219,9 +222,9 @@ TEST_F(CompletionTest, DirCompletionAbso
 
   // When a partial name matches, it returns all matches.  If it matches both
   // a full name AND some partial names, it returns all of them.
-  Count =
-  CommandCompl

[Lldb-commits] [lldb] r297612 - Fix android build

2017-03-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar 13 05:59:23 2017
New Revision: 297612

URL: http://llvm.org/viewvc/llvm-project?rev=297612&view=rev
Log:
Fix android build

getpwent is not available on android until API level 21, and even then
it is only available when doing a non-static link. Since android's
concept of users is very different from linux, it's doubtful the home
directory resolution would be useful, so I approximate this state by
just not using getpwent on android.

We've had another getpwent occurance in FileSpec for a while -- it
wasn't causing problems because it was stripped out by the linker, but I
disable that also, for consistency's sake.

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Utility/TildeExpressionResolver.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297612&r1=297611&r2=297612&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar 13 05:59:23 2017
@@ -218,7 +218,7 @@ void FileSpec::ResolveUsername(llvm::Sma
 
 size_t FileSpec::ResolvePartialUsername(llvm::StringRef partial_name,
 StringList &matches) {
-#ifndef LLVM_ON_WIN32
+#if !defined(LLVM_ON_WIN32) || !defined(__ANDROID__)
   size_t extant_entries = matches.GetSize();
 
   setpwent();

Modified: lldb/trunk/source/Utility/TildeExpressionResolver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TildeExpressionResolver.cpp?rev=297612&r1=297611&r2=297612&view=diff
==
--- lldb/trunk/source/Utility/TildeExpressionResolver.cpp (original)
+++ lldb/trunk/source/Utility/TildeExpressionResolver.cpp Mon Mar 13 05:59:23 
2017
@@ -44,7 +44,7 @@ bool StandardTildeExpressionResolver::Re
   assert(Expr.empty() || Expr[0] == '~');
 
   Output.clear();
-#if defined(LLVM_ON_WIN32)
+#if defined(LLVM_ON_WIN32) || defined(__ANDROID__)
   return false;
 #else
   if (Expr.empty())


___
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 Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

We need the getter code to get the name of the threads of the process we are 
debugging, so this cannot go away. It also probably does not make sense to move 
this code into llvm, as it is quite debugger-specific and very unportable.

We probably don't have a test that we read the thread name correctly, so the 
test suite would not have caught this. I've added a todo for myself to add one.

If you want to get your build working, I suggest you just remove the setting 
code. It's conceivable that we may want to change the inferior thread name from 
a debugger, but we don't have that functionality now, and the code is wrong 
anyway, so there's no harm in removing it.




Comment at: source/Plugins/Process/Linux/NativeThreadLinux.cpp:100
   llvm::SmallString<32> thread_name;
-  HostNativeThread::GetName(GetID(), thread_name);
+  llvm::get_thread_name(thread_name);
   return thread_name.c_str();

This modification is incorrect. The code is supposed to read the name of the 
thread we are debugging, not our own thread name.


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] [lldb] r297615 - Fix windows build broken by r297612

2017-03-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar 13 06:23:59 2017
New Revision: 297615

URL: http://llvm.org/viewvc/llvm-project?rev=297615&view=rev
Log:
Fix windows build broken by r297612

I have got my boolean logic incorrect. Sorry about the spam.

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297615&r1=297614&r2=297615&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar 13 06:23:59 2017
@@ -218,7 +218,7 @@ void FileSpec::ResolveUsername(llvm::Sma
 
 size_t FileSpec::ResolvePartialUsername(llvm::StringRef partial_name,
 StringList &matches) {
-#if !defined(LLVM_ON_WIN32) || !defined(__ANDROID__)
+#if !defined(LLVM_ON_WIN32) && !defined(__ANDROID__)
   size_t extant_entries = matches.GetSize();
 
   setpwent();


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


[Lldb-commits] [PATCH] D30817: BreakpointResolverFileLine: Correct treatment of move-to-nearest-code for multiple modules

2017-03-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I like the idea of using the function declaration line, as it will solve a 
couple of other corner cases also (we've had one user try to set a breakpoint 
on a macro definition and expect that to work). I'll try to implement that 
instead.


https://reviews.llvm.org/D30817



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


[Lldb-commits] [PATCH] D30779: dotest.py: remove the ability to specify different architectures/compilers in a single invocation

2017-03-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: packages/Python/lldbsuite/test/dotest.py:1204
+os.environ["ARCH"] = configuration.arch
+os.environ["CC"] = configuration.compiler
+configString = "arch=%s compiler=%s" % (configuration.arch,

zturner wrote:
> Should you be setting `CXX` here?
We don't have the CXX name here. It gets derived from the c compiler name in a 
pretty funny way later on.


https://reviews.llvm.org/D30779



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


[Lldb-commits] [lldb] r297616 - Android.rules: Add libc++ support

2017-03-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Mar 13 07:07:48 2017
New Revision: 297616

URL: http://llvm.org/viewvc/llvm-project?rev=297616&view=rev
Log:
Android.rules: Add libc++ support

Summary:
This adds support for building libc++ tests when targetting android. The
tests are still not passing due to several other problems, but this way
we can at least build them.

Reviewers: eugene, EricWF, danalbert

Subscribers: srhines, lldb-commits

Differential Revision: https://reviews.llvm.org/D30737

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=297616&r1=297615&r2=297616&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Mon Mar 13 
07:07:48 2017
@@ -61,11 +61,23 @@ ifeq "$(findstring clang,$(CC))" "clang"
-gcc-toolchain 
$(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
-ARCH_CFLAGS += \
-   
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-ARCH_LDFLAGS += -lm \
-   
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
 \
-   
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_CFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+
+ifeq (1,$(USE_LIBCPP))
+   ARCH_CFLAGS += \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+   -isystem $(NDK_ROOT)/sources/android/support/include \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
+
+   ARCH_LDFLAGS += \
+   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
+   
-l$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+else
+   ARCH_CFLAGS += \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
+   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
+   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+
+   ARCH_LDFLAGS += 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
+endif

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=297616&r1=297615&r2=297616&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Mon Mar 13 
07:07:48 2017
@@ -326,15 +326,19 @@ endif
 ifeq (1,$(USE_LIBCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
+   CXXFLAGS += -DLLDB_USING_LIBCPP
ifeq "$(OS)" "Linux"
# This is the default install location on Ubuntu 14.04
ifneq ($(wildcard /usr/include/c++/v1/.),)
-   CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+   CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
CXXFLAGS += -I/usr/include/c++/v1
endif
+   else ifeq "$(OS)" "Android"
+   # Nothing to do, this is already handled in
+   # Android.rules.
else
-   CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+   CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
endif


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


[Lldb-commits] [PATCH] D30737: Android.rules: Add libc++ support

2017-03-13 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297616: Android.rules: Add libc++ support (authored by 
labath).

Changed prior to commit:
  https://reviews.llvm.org/D30737?vs=91018&id=91540#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30737

Files:
  lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
  lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -61,11 +61,23 @@
-gcc-toolchain 
$(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
-ARCH_CFLAGS += \
-   
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-ARCH_LDFLAGS += -lm \
-   
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
 \
-   
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_CFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+
+ifeq (1,$(USE_LIBCPP))
+   ARCH_CFLAGS += \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+   -isystem $(NDK_ROOT)/sources/android/support/include \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
+
+   ARCH_LDFLAGS += \
+   -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
+   
-l$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+else
+   ARCH_CFLAGS += \
+   -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
+   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
+   -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+
+   ARCH_LDFLAGS += 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
+endif
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -326,15 +326,19 @@
 ifeq (1,$(USE_LIBCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
+   CXXFLAGS += -DLLDB_USING_LIBCPP
ifeq "$(OS)" "Linux"
# This is the default install location on Ubuntu 14.04
ifneq ($(wildcard /usr/include/c++/v1/.),)
-   CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+   CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
CXXFLAGS += -I/usr/include/c++/v1
endif
+   else ifeq "$(OS)" "Android"
+   # Nothing to do, this is already handled in
+   # Android.rules.
else
-   CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+   CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
endif


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -61,11 +61,23 @@
 		-gcc-toolchain $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
-ARCH_CFLAGS += \
-	--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) \
-	-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-	-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-	-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-ARCH_LDFLAGS += -lm \
-	$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a \
-	--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+
+ifeq (1,$(USE_LIBCPP))
+	ARCH_CFLAGS += \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+		-isystem $(NDK_ROOT)/sources/android/support/include \
+		-isystem 

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

2017-03-13 Thread Zachary Turner via lldb-commits
Can we just copy the non portable system call to this location and inline
it here with appropriate glibc check so that we can still delete all that
other obsolete code?
On Mon, Mar 13, 2017 at 4:28 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath requested changes to this revision.
> labath added a comment.
> This revision now requires changes to proceed.
>
> We need the getter code to get the name of the threads of the process we
> are debugging, so this cannot go away. It also probably does not make sense
> to move this code into llvm, as it is quite debugger-specific and very
> unportable.
>
> We probably don't have a test that we read the thread name correctly, so
> the test suite would not have caught this. I've added a todo for myself to
> add one.
>
> If you want to get your build working, I suggest you just remove the
> setting code. It's conceivable that we may want to change the inferior
> thread name from a debugger, but we don't have that functionality now, and
> the code is wrong anyway, so there's no harm in removing it.
>
>
>
> 
> Comment at: source/Plugins/Process/Linux/NativeThreadLinux.cpp:100
>llvm::SmallString<32> thread_name;
> -  HostNativeThread::GetName(GetID(), thread_name);
> +  llvm::get_thread_name(thread_name);
>return thread_name.c_str();
> 
> This modification is incorrect. The code is supposed to read the name of
> the thread we are debugging, not our own thread name.
>
>
> https://reviews.llvm.org/D30844
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2017-03-13 Thread Pavel Labath via lldb-commits
On 13 March 2017 at 12:35, Zachary Turner  wrote:
> Can we just copy the non portable system call to this location and inline it
> here with appropriate glibc check so that we can still delete all that other
> obsolete code?
>

That makes sense. I think that code belongs in NativeThreadLinux
anyway.. HostNativeThread should die.
___
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] D30894: Remove lldb streams from the Log class completely

2017-03-13 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added a subscriber: emaste.

previously we switched to llvm streams for log output, this completes
the switch for the error streams.

I also clean up the includes and remove the unused argument from
DisableAllLogChannels().

This required adding a bit of boiler plate to convert the output in the
command interpreter, but that should go away when we switch command
results to use llvm streams as well.


https://reviews.llvm.org/D30894

Files:
  include/lldb/Core/Debugger.h
  include/lldb/Utility/Log.h
  include/lldb/Utility/Logging.h
  source/API/SBDebugger.cpp
  source/Commands/CommandObjectLog.cpp
  source/Core/Debugger.cpp
  source/Host/posix/ProcessLauncherPosixFork.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
  source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
  source/Utility/Log.cpp
  source/Utility/Logging.cpp
  tools/lldb-server/LLDBServerUtilities.cpp
  unittests/Utility/LogTest.cpp

Index: unittests/Utility/LogTest.cpp
===
--- unittests/Utility/LogTest.cpp
+++ unittests/Utility/LogTest.cpp
@@ -27,7 +27,7 @@
 static Log::Channel test_channel(test_categories, default_flags);
 
 struct LogChannelTest : public ::testing::Test {
-  void TearDown() override { Log::DisableAllLogChannels(nullptr); }
+  void TearDown() override { Log::DisableAllLogChannels(); }
 
   static void SetUpTestCase() {
 Log::Register("chan", test_channel);
@@ -39,6 +39,31 @@
   }
 };
 
+// Wrap enable, disable and list functions to make them easier to test.
+static bool EnableChannel(std::shared_ptr stream_sp,
+  uint32_t log_options, llvm::StringRef channel,
+  llvm::ArrayRef categories,
+  std::string &error) {
+  error.clear();
+  llvm::raw_string_ostream error_stream(error);
+  return Log::EnableLogChannel(stream_sp, log_options, channel, categories,
+   error_stream);
+}
+
+static bool DisableChannel(llvm::StringRef channel,
+   llvm::ArrayRef categories,
+   std::string &error) {
+  error.clear();
+  llvm::raw_string_ostream error_stream(error);
+  return Log::DisableLogChannel(channel, categories, error_stream);
+}
+
+static bool ListCategories(llvm::StringRef channel, std::string &result) {
+  result.clear();
+  llvm::raw_string_ostream result_stream(result);
+  return Log::ListChannelCategories(channel, result_stream);
+}
+
 TEST(LogTest, LLDB_LOG_nullptr) {
   Log *log = nullptr;
   LLDB_LOG(log, "{0}", 0); // Shouldn't crash
@@ -56,12 +81,10 @@
   llvm::llvm_shutdown_obj obj;
   Log::Register("chan", test_channel);
   EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
-  const char *cat1[] = {"foo"};
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
-  StreamString err;
-  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", cat1, err));
+  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {"foo"}, llvm::nulls()));
   EXPECT_NE(nullptr, test_channel.GetLogIfAny(FOO));
   Log::Unregister("chan");
   EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
@@ -72,98 +95,91 @@
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
-  StreamString err;
-  EXPECT_FALSE(Log::EnableLogChannel(stream_sp, 0, "chanchan", {}, err));
-  EXPECT_EQ("Invalid log channel 'chanchan'.\n", err.GetString());
-  err.Clear();
+  std::string error;
+  ASSERT_FALSE(EnableChannel(stream_sp, 0, "chanchan", {}, error));
+  EXPECT_EQ("Invalid log channel 'chanchan'.\n", error);
 
-  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {}, err));
-  EXPECT_EQ("", err.GetString()) << "err: " << err.GetString().str();
+  EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {}, error));
   EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO));
   EXPECT_EQ(nullptr, test_channel.GetLogIfAll(BAR));
 
-  const char *cat2[] = {"bar"};
-  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", cat2, err));
+  EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"bar"}, error));
   EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
 
-  const char *cat3[] = {"baz"};
-  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", cat3, err));
-  EXPECT_TRUE(err.GetString().contains("unrecognized log category 'baz'"))
-  << "err: " << err.GetString().str();
+  EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"baz"}, error));
+  EXPECT_NE(std::string::npos, error.find("unrecognized log category 'baz'"))
+  << "error: " << error;
   EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
 }
 
 TEST_F(LogChannelTest, EnableOptions) {
   EXPECT_EQ(nullptr, test_channel.GetLogIfAll(FOO));
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
-  StreamString err;
-  EXPECT_TRUE(Log::EnableLogChannel(stream_sp,

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

2017-03-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D30844#699265, @jroelofs wrote:

> > 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.


Yes, that's what I meant. :)

> 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;

Just delete that function altogether and keep the `GetName` as-is. If you don't 
want to do the inlining zachary suggested, that's fine by me. I was planning to 
kill the `ProcFileReader` class soon, so I can do that then.


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 Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

thank you.


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] [lldb] r297626 - Delete dead code. NFC

2017-03-13 Thread Jonathan Roelofs via lldb-commits
Author: jroelofs
Date: Mon Mar 13 10:25:01 2017
New Revision: 297626

URL: http://llvm.org/viewvc/llvm-project?rev=297626&view=rev
Log:
Delete dead code. NFC

Also has the side-effect of fixing the build on systems with glibc < 2.12

https://reviews.llvm.org/D30844

Modified:
lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h
lldb/trunk/source/Host/linux/HostThreadLinux.cpp

Modified: lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h?rev=297626&r1=297625&r2=297626&view=diff
==
--- lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h (original)
+++ lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h Mon Mar 13 10:25:01 
2017
@@ -22,7 +22,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);
 };
 }

Modified: lldb/trunk/source/Host/linux/HostThreadLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostThreadLinux.cpp?rev=297626&r1=297625&r2=297626&view=diff
==
--- lldb/trunk/source/Host/linux/HostThreadLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/HostThreadLinux.cpp Mon Mar 13 10:25:01 2017
@@ -13,8 +13,6 @@
 
 #include "llvm/ADT/SmallVector.h"
 
-#include 
-
 using namespace lldb_private;
 
 HostThreadLinux::HostThreadLinux() : HostThreadPosix() {}
@@ -22,15 +20,6 @@ HostThreadLinux::HostThreadLinux() : Hos
 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-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


[Lldb-commits] [lldb] r297637 - Fix another occurrence of needing to use member accessors.

2017-03-13 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar 13 11:39:00 2017
New Revision: 297637

URL: http://llvm.org/viewvc/llvm-project?rev=297637&view=rev
Log:
Fix another occurrence of needing to use member accessors.

Modified:

lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp

Modified: 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=297637&r1=297636&r2=297637&view=diff
==
--- 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp 
Mon Mar 13 11:39:00 2017
@@ -746,8 +746,8 @@ private:
 
   int MatchAttributeIndex(llvm::StringRef attribute_name) const {
 for (const auto &Item : llvm::enumerate(s_filter_attributes)) {
-  if (attribute_name == Item.Value)
-return Item.Index;
+  if (attribute_name == Item.value())
+return Item.index();
 }
 
 // We didn't match anything.


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


[Lldb-commits] [lldb] r297640 - Fix up some enumerate() callsites in LLDB.

2017-03-13 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Mar 13 12:12:12 2017
New Revision: 297640

URL: http://llvm.org/viewvc/llvm-project?rev=297640&view=rev
Log:
Fix up some enumerate() callsites in LLDB.

Modified:
lldb/trunk/source/Commands/CommandObjectArgs.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp

Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=297640&r1=297639&r2=297640&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Mon Mar 13 12:12:12 2017
@@ -223,9 +223,9 @@ bool CommandObjectArgs::DoExecute(Args &
   result.GetOutputStream().Printf("Arguments : \n");
 
   for (auto entry : llvm::enumerate(args.entries())) {
-result.GetOutputStream().Printf("%" PRIu64 " (%s): ", 
(uint64_t)entry.Index,
-entry.Value.c_str());
-value_list.GetValueAtIndex(entry.Index)->Dump(&result.GetOutputStream());
+result.GetOutputStream().Printf(
+"%" PRIu64 " (%s): ", (uint64_t)entry.index(), entry.value().c_str());
+value_list.GetValueAtIndex(entry.index())->Dump(&result.GetOutputStream());
 result.GetOutputStream().Printf("\n");
   }
 

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=297640&r1=297639&r2=297640&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Mar 13 12:12:12 2017
@@ -82,9 +82,9 @@ static bool WarnOnPotentialUnquotedUnsig
 return false;
 
   for (auto entry : llvm::enumerate(command.entries().drop_back())) {
-if (entry.Value.ref != "unsigned")
+if (entry.value().ref != "unsigned")
   continue;
-auto next = command.entries()[entry.Index + 1].ref;
+auto next = command.entries()[entry.index() + 1].ref;
 if (next == "int" || next == "short" || next == "char" || next == "long") {
   result.AppendWarningWithFormat(
   "unsigned %s being treated as two types. if you meant the combined "

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=297640&r1=297639&r2=297640&view=diff
==
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Mon Mar 13 12:12:12 2017
@@ -931,12 +931,12 @@ bool Args::ContainsEnvironmentVariable(l
   // Check each arg to see if it matches the env var name.
   for (auto arg : llvm::enumerate(m_entries)) {
 llvm::StringRef name, value;
-std::tie(name, value) = arg.Value.ref.split('=');
+std::tie(name, value) = arg.value().ref.split('=');
 if (name != env_var_name)
   continue;
 
 if (argument_index)
-  *argument_index = arg.Index;
+  *argument_index = arg.index();
 return true;
   }
 
@@ -954,9 +954,9 @@ size_t Args::FindArgumentIndexForOption(
  long_options[long_options_index].definition->long_option);
 
   for (auto entry : llvm::enumerate(m_entries)) {
-if (entry.Value.ref.startswith(short_buffer) ||
-entry.Value.ref.startswith(long_buffer))
-  return entry.Index;
+if (entry.value().ref.startswith(short_buffer) ||
+entry.value().ref.startswith(long_buffer))
+  return entry.index();
   }
 
   return size_t(-1);

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=297640&r1=297639&r2=297640&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Mar 13 12:12:12 
2017
@@ -2018,8 +2018,8 @@ void CommandInterpreter::BuildAliasComma
 }
 
 for (auto entry : llvm::enumerate(cmd_args.entries())) {
-  if (!used[entry.Index] && !wants_raw_input)
-new_args.AppendArgument(entry.Value.ref);
+  if (!used[entry.index()] && !wants_raw_input)
+new_args.AppendArgument(entry.value().ref);
 }
 
 cmd_args.Clear();

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=297640&r1=297639&r2=297640&view=diff
==
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter

[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Chris Bieneman via Phabricator via lldb-commits
beanz created this revision.
Herald added a subscriber: mgorny.

The first Sandybridge iMacs with AVX support shipped in Spring 2011 with Snow 
Leopard as their OS. Unfortunately due to a kernel bug debugging AVX code was 
not really possible until 10.7.4.

The old code here checked the kernel build number to determine when to support 
AVX, but that code was incorrect. It verified that the kernel build number was 
greater than xnu-2020, which is the build of the kernel that had the fix for 
10.8. The fix was also back ported to 10.7.4. Which means all publicly 
available OS builds 10.7.4 and later have working AVX support.

This new patch verifies that the host OS is greater than or equal to 10.7.4 by 
checking that the build number is greater than or equal to 11Exx.

The patch also removes the HasAVX assembly blob in favor of querying the kernel 
via sysctl for the hardware features.

Using sysctl is slower, however since the code is executed once and the result 
cached it is a better approach because it is possible for the kernel to disable 
AVX support on hardware that supports it, so listening to the kernel is a 
better approach for the debugger to take.


https://reviews.llvm.org/D30918

Files:
  cmake/caches/LLDBFramework.cmake
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/dotest_args.py
  test/CMakeLists.txt
  tools/debugserver/debugserver.xcodeproj/project.pbxproj
  tools/debugserver/source/MacOSX/CMakeLists.txt
  tools/debugserver/source/MacOSX/HasAVX.h
  tools/debugserver/source/MacOSX/HasAVX.s
  tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
  tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Index: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
===
--- tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -17,7 +17,6 @@
 #include 
 #include 
 
-#include "../HasAVX.h"
 #include "DNBLog.h"
 #include "MacOSX/x86_64/DNBArchImplX86_64.h"
 #include "MachProcess.h"
@@ -60,42 +59,56 @@
 #define FORCE_AVX_REGS (0)
 #endif
 
-extern "C" bool CPUHasAVX() {
-  enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
+bool DetectHardwareFeature(const char *feature) {
+  int answer = 0;
+  size_t answer_size = sizeof(answer);
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return !error & answer;
+}
+
+enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
 
+bool LogAVXAndReturn(AVXPresence has_avx, int err, const char * os_ver) {
+  DNBLogThreadedIf(LOG_THREAD,
+   "CPUHasAVX(): g_has_avx = %i (err = %i, os_ver = %s)",
+   has_avx, err, os_ver);
+  return (has_avx == eAVXPresent);
+}
+
+extern "C" bool CPUHasAVX() {
   static AVXPresence g_has_avx = eAVXUnknown;
-  if (g_has_avx == eAVXUnknown) {
-g_has_avx = eAVXNotPresent;
-
-// Only xnu-2020 or later has AVX support, any versions before
-// this have a busted thread_get_state RPC where it would truncate
-// the thread state buffer (). So we need to
-// verify the kernel version number manually or disable AVX support.
-int mib[2];
-char buffer[1024];
-size_t length = sizeof(buffer);
-uint64_t xnu_version = 0;
-mib[0] = CTL_KERN;
-mib[1] = KERN_VERSION;
-int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
-if (err == 0) {
-  const char *xnu = strstr(buffer, "xnu-");
-  if (xnu) {
-const char *xnu_version_cstr = xnu + 4;
-xnu_version = strtoull(xnu_version_cstr, NULL, 0);
-if (xnu_version >= 2020 && xnu_version != ULLONG_MAX) {
-  if (::HasAVX()) {
-g_has_avx = eAVXPresent;
-  }
-}
-  }
-}
-DNBLogThreadedIf(LOG_THREAD, "CPUHasAVX(): g_has_avx = %i (err = %i, errno "
- "= %i, xnu_version = %llu)",
- g_has_avx, err, errno, xnu_version);
+  if (g_has_avx != eAVXUnknown)
+return LogAVXAndReturn(g_has_avx, 0, "");
+
+  g_has_avx = eAVXNotPresent;
+
+  // OS X 10.7.3 and earlier have a bug in thread_get_state that truncated the
+  // size of the return. To work around this we have to disable AVX debugging
+  // on hosts prior to 10.7.3 ().
+  int mib[2];
+  char buffer[1024];
+  size_t length = sizeof(buffer);
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_OSVERSION;
+  int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
+  if (err != 0)
+return LogAVXAndReturn(g_has_avx, err, "");
+
+  size_t first_letter = 0;
+  for (; first_letter < length; ++first_letter) {
+if (buffer[first_letter] & 0x40)
+  break;
   }
-
-  return (g_has_avx == eAVXPresent);
+  char letter = buffer[first_letter];
+  buffer[first_letter] = 0;
+  auto major_ver = strtoull(buffer, NULL, 0);
+  buffer[first_letter] = letter;
+  if (major_ver < 11 || (major_ver == 11 && letter < 'E'))
+return LogAVX

[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Chris Bieneman via Phabricator via lldb-commits
beanz updated this revision to Diff 91640.
beanz added a comment.

Removing some extra changes that accidentally came along for the ride in my 
initial upload.


https://reviews.llvm.org/D30918

Files:
  tools/debugserver/debugserver.xcodeproj/project.pbxproj
  tools/debugserver/source/MacOSX/CMakeLists.txt
  tools/debugserver/source/MacOSX/HasAVX.h
  tools/debugserver/source/MacOSX/HasAVX.s
  tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
  tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Index: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
===
--- tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -17,7 +17,6 @@
 #include 
 #include 
 
-#include "../HasAVX.h"
 #include "DNBLog.h"
 #include "MacOSX/x86_64/DNBArchImplX86_64.h"
 #include "MachProcess.h"
@@ -60,42 +59,56 @@
 #define FORCE_AVX_REGS (0)
 #endif
 
-extern "C" bool CPUHasAVX() {
-  enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
+bool DetectHardwareFeature(const char *feature) {
+  int answer = 0;
+  size_t answer_size = sizeof(answer);
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return !error & answer;
+}
+
+enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
 
+bool LogAVXAndReturn(AVXPresence has_avx, int err, const char * os_ver) {
+  DNBLogThreadedIf(LOG_THREAD,
+   "CPUHasAVX(): g_has_avx = %i (err = %i, os_ver = %s)",
+   has_avx, err, os_ver);
+  return (has_avx == eAVXPresent);
+}
+
+extern "C" bool CPUHasAVX() {
   static AVXPresence g_has_avx = eAVXUnknown;
-  if (g_has_avx == eAVXUnknown) {
-g_has_avx = eAVXNotPresent;
-
-// Only xnu-2020 or later has AVX support, any versions before
-// this have a busted thread_get_state RPC where it would truncate
-// the thread state buffer (). So we need to
-// verify the kernel version number manually or disable AVX support.
-int mib[2];
-char buffer[1024];
-size_t length = sizeof(buffer);
-uint64_t xnu_version = 0;
-mib[0] = CTL_KERN;
-mib[1] = KERN_VERSION;
-int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
-if (err == 0) {
-  const char *xnu = strstr(buffer, "xnu-");
-  if (xnu) {
-const char *xnu_version_cstr = xnu + 4;
-xnu_version = strtoull(xnu_version_cstr, NULL, 0);
-if (xnu_version >= 2020 && xnu_version != ULLONG_MAX) {
-  if (::HasAVX()) {
-g_has_avx = eAVXPresent;
-  }
-}
-  }
-}
-DNBLogThreadedIf(LOG_THREAD, "CPUHasAVX(): g_has_avx = %i (err = %i, errno "
- "= %i, xnu_version = %llu)",
- g_has_avx, err, errno, xnu_version);
+  if (g_has_avx != eAVXUnknown)
+return LogAVXAndReturn(g_has_avx, 0, "");
+
+  g_has_avx = eAVXNotPresent;
+
+  // OS X 10.7.3 and earlier have a bug in thread_get_state that truncated the
+  // size of the return. To work around this we have to disable AVX debugging
+  // on hosts prior to 10.7.3 ().
+  int mib[2];
+  char buffer[1024];
+  size_t length = sizeof(buffer);
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_OSVERSION;
+  int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
+  if (err != 0)
+return LogAVXAndReturn(g_has_avx, err, "");
+
+  size_t first_letter = 0;
+  for (; first_letter < length; ++first_letter) {
+if (buffer[first_letter] & 0x40)
+  break;
   }
-
-  return (g_has_avx == eAVXPresent);
+  char letter = buffer[first_letter];
+  buffer[first_letter] = 0;
+  auto major_ver = strtoull(buffer, NULL, 0);
+  buffer[first_letter] = letter;
+  if (major_ver < 11 || (major_ver == 11 && letter < 'E'))
+return LogAVXAndReturn(g_has_avx, err, buffer);
+  if (DetectHardwareFeature("hw.optional.avx1_0"))
+g_has_avx = eAVXPresent;
+
+  return LogAVXAndReturn(g_has_avx, err, buffer);
 }
 
 uint64_t DNBArchImplX86_64::GetPC(uint64_t failValue) {
Index: tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
===
--- tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
+++ tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
@@ -16,7 +16,6 @@
 
 #if defined(__i386__) || defined(__x86_64__)
 
-#include "../HasAVX.h"
 #include "DNBArch.h"
 #include "MachRegisterStatesI386.h"
 
Index: tools/debugserver/source/MacOSX/HasAVX.s
===
--- tools/debugserver/source/MacOSX/HasAVX.s
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- HasAVX.s ---*- x86 Assembly -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===---

[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda requested changes to this revision.
jasonmolenda added a comment.
This revision now requires changes to proceed.

Looks good, a few small suggestions from reading the code afresh.  I'm not sure 
how many open source contributors we may have running macOS 10.6 or earlier (or 
macOS 10.7.[1-3]) but keeping this code is probably still a good idea at this 
point.




Comment at: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp:66
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return !error & answer;
+}

I see what you're doing -- this can either return "false, meaning the 
sysctlbyname failed or I got a zero value, or true meaning it succeeded and I 
got a nonzero value" but the use of a bitwise AND is going to look like a bug 
to any casual reader and make them re-read the code a few times before they've 
realized it is intended (at least it did me).  It might be easier for future 
maintainers if it's written more like like

if (error != 0 && answer != 0)
  return true;
else
  return false;

and let the compiler come up with the shorter form when generating the 
instructions.



Comment at: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp:99
+  for (; first_letter < length; ++first_letter) {
+if (buffer[first_letter] & 0x40)
+  break;

Would '@' be clearer here than 0x40?  I had to run man ascii to figure out what 
this was.  Maybe a comment saying that we expect the string from KERN_OSVERSION 
to be something like '11B156' & we're interested in the '11' bit would make it 
a little easier to read. (I had to run sysctl to look at the string you're 
parsing to follow along with the logic)



Comment at: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp:103
+  char letter = buffer[first_letter];
+  buffer[first_letter] = 0;
+  auto major_ver = strtoull(buffer, NULL, 0);

Not a big deal but '\0'.


https://reviews.llvm.org/D30918



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


[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Hah, I misread what the 'buffer[first_letter] & 0x40' line was doing still.  
Maybe use isupper() here instead of the bitmask?


https://reviews.llvm.org/D30918



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


[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp:66
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return !error & answer;
+}

jasonmolenda wrote:
> I see what you're doing -- this can either return "false, meaning the 
> sysctlbyname failed or I got a zero value, or true meaning it succeeded and I 
> got a nonzero value" but the use of a bitwise AND is going to look like a bug 
> to any casual reader and make them re-read the code a few times before 
> they've realized it is intended (at least it did me).  It might be easier for 
> future maintainers if it's written more like like
> 
> if (error != 0 && answer != 0)
>   return true;
> else
>   return false;
> 
> and let the compiler come up with the shorter form when generating the 
> instructions.
Maybe I'm missing something, but why not just `return !error && answer`?


https://reviews.llvm.org/D30918



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


[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Chris Bieneman via Phabricator via lldb-commits
beanz updated this revision to Diff 91643.
beanz added a comment.

Updates based on feedback from Jason and Zachary.


https://reviews.llvm.org/D30918

Files:
  tools/debugserver/debugserver.xcodeproj/project.pbxproj
  tools/debugserver/source/MacOSX/CMakeLists.txt
  tools/debugserver/source/MacOSX/HasAVX.h
  tools/debugserver/source/MacOSX/HasAVX.s
  tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
  tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Index: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
===
--- tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -17,7 +17,6 @@
 #include 
 #include 
 
-#include "../HasAVX.h"
 #include "DNBLog.h"
 #include "MacOSX/x86_64/DNBArchImplX86_64.h"
 #include "MachProcess.h"
@@ -60,42 +59,64 @@
 #define FORCE_AVX_REGS (0)
 #endif
 
-extern "C" bool CPUHasAVX() {
-  enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
+bool DetectHardwareFeature(const char *feature) {
+  int answer = 0;
+  size_t answer_size = sizeof(answer);
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return error != 0 && answer != 0
+}
+
+enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
 
+bool LogAVXAndReturn(AVXPresence has_avx, int err, const char * os_ver) {
+  DNBLogThreadedIf(LOG_THREAD,
+   "CPUHasAVX(): g_has_avx = %i (err = %i, os_ver = %s)",
+   has_avx, err, os_ver);
+  return (has_avx == eAVXPresent);
+}
+
+extern "C" bool CPUHasAVX() {
   static AVXPresence g_has_avx = eAVXUnknown;
-  if (g_has_avx == eAVXUnknown) {
-g_has_avx = eAVXNotPresent;
-
-// Only xnu-2020 or later has AVX support, any versions before
-// this have a busted thread_get_state RPC where it would truncate
-// the thread state buffer (). So we need to
-// verify the kernel version number manually or disable AVX support.
-int mib[2];
-char buffer[1024];
-size_t length = sizeof(buffer);
-uint64_t xnu_version = 0;
-mib[0] = CTL_KERN;
-mib[1] = KERN_VERSION;
-int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
-if (err == 0) {
-  const char *xnu = strstr(buffer, "xnu-");
-  if (xnu) {
-const char *xnu_version_cstr = xnu + 4;
-xnu_version = strtoull(xnu_version_cstr, NULL, 0);
-if (xnu_version >= 2020 && xnu_version != ULLONG_MAX) {
-  if (::HasAVX()) {
-g_has_avx = eAVXPresent;
-  }
-}
-  }
-}
-DNBLogThreadedIf(LOG_THREAD, "CPUHasAVX(): g_has_avx = %i (err = %i, errno "
- "= %i, xnu_version = %llu)",
- g_has_avx, err, errno, xnu_version);
+  if (g_has_avx != eAVXUnknown)
+return LogAVXAndReturn(g_has_avx, 0, "");
+
+  g_has_avx = eAVXNotPresent;
+
+  // OS X 10.7.3 and earlier have a bug in thread_get_state that truncated the
+  // size of the return. To work around this we have to disable AVX debugging
+  // on hosts prior to 10.7.3 ().
+  int mib[2];
+  char buffer[1024];
+  size_t length = sizeof(buffer);
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_OSVERSION;
+
+  // KERN_OSVERSION returns the build number which is a number signifying the
+  // major version, a capitol letter signifying the minor version, and numbers
+  // signifying the build (ex: on 10.12.3, the returned value is 16D32).
+  int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
+  if (err != 0)
+return LogAVXAndReturn(g_has_avx, err, "");
+
+  size_t first_letter = 0;
+  for (; first_letter < length; ++first_letter) {
+// This is looking for the first uppercase letter
+if (buffer[first_letter] >= 'A')
+  break;
   }
-
-  return (g_has_avx == eAVXPresent);
+  char letter = buffer[first_letter];
+  buffer[first_letter] = '\0';
+  auto major_ver = strtoull(buffer, NULL, 0);
+  buffer[first_letter] = letter;
+
+  // In this check we're looking to see that our major and minor version numer
+  // was >= 11E, which is the 10.7.4 release.
+  if (major_ver < 11 || (major_ver == 11 && letter < 'E'))
+return LogAVXAndReturn(g_has_avx, err, buffer);
+  if (DetectHardwareFeature("hw.optional.avx1_0"))
+g_has_avx = eAVXPresent;
+
+  return LogAVXAndReturn(g_has_avx, err, buffer);
 }
 
 uint64_t DNBArchImplX86_64::GetPC(uint64_t failValue) {
Index: tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
===
--- tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
+++ tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
@@ -16,7 +16,6 @@
 
 #if defined(__i386__) || defined(__x86_64__)
 
-#include "../HasAVX.h"
 #include "DNBArch.h"
 #include "MachRegisterStatesI386.h"
 
Index: tools/debugserver/source/MacOSX/HasAVX.s
===
--- tools/debugserver/source

[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

looks good to me.




Comment at: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp:66
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return !error & answer;
+}

zturner wrote:
> jasonmolenda wrote:
> > I see what you're doing -- this can either return "false, meaning the 
> > sysctlbyname failed or I got a zero value, or true meaning it succeeded and 
> > I got a nonzero value" but the use of a bitwise AND is going to look like a 
> > bug to any casual reader and make them re-read the code a few times before 
> > they've realized it is intended (at least it did me).  It might be easier 
> > for future maintainers if it's written more like like
> > 
> > if (error != 0 && answer != 0)
> >   return true;
> > else
> >   return false;
> > 
> > and let the compiler come up with the shorter form when generating the 
> > instructions.
> Maybe I'm missing something, but why not just `return !error && answer`?
That would be fine too.  The bitwise in the original is correct, but needlessly 
confusing IMO.



Comment at: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp:99
+  for (; first_letter < length; ++first_letter) {
+if (buffer[first_letter] & 0x40)
+  break;

jasonmolenda wrote:
> Would '@' be clearer here than 0x40?  I had to run man ascii to figure out 
> what this was.  Maybe a comment saying that we expect the string from 
> KERN_OSVERSION to be something like '11B156' & we're interested in the '11' 
> bit would make it a little easier to read. (I had to run sysctl to look at 
> the string you're parsing to follow along with the logic)
I misread this myself when writing the above.  isupper() is what you're doing - 
I'd recommend using that instead of the bit mask.


https://reviews.llvm.org/D30918



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


[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Chris Bieneman via Phabricator via lldb-commits
beanz updated this revision to Diff 91644.
beanz added a comment.

Forgot a semi-colon...


https://reviews.llvm.org/D30918

Files:
  tools/debugserver/debugserver.xcodeproj/project.pbxproj
  tools/debugserver/source/MacOSX/CMakeLists.txt
  tools/debugserver/source/MacOSX/HasAVX.h
  tools/debugserver/source/MacOSX/HasAVX.s
  tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
  tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Index: tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
===
--- tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -17,7 +17,6 @@
 #include 
 #include 
 
-#include "../HasAVX.h"
 #include "DNBLog.h"
 #include "MacOSX/x86_64/DNBArchImplX86_64.h"
 #include "MachProcess.h"
@@ -60,42 +59,64 @@
 #define FORCE_AVX_REGS (0)
 #endif
 
-extern "C" bool CPUHasAVX() {
-  enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
+bool DetectHardwareFeature(const char *feature) {
+  int answer = 0;
+  size_t answer_size = sizeof(answer);
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return error != 0 && answer != 0;
+}
+
+enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
 
+bool LogAVXAndReturn(AVXPresence has_avx, int err, const char * os_ver) {
+  DNBLogThreadedIf(LOG_THREAD,
+   "CPUHasAVX(): g_has_avx = %i (err = %i, os_ver = %s)",
+   has_avx, err, os_ver);
+  return (has_avx == eAVXPresent);
+}
+
+extern "C" bool CPUHasAVX() {
   static AVXPresence g_has_avx = eAVXUnknown;
-  if (g_has_avx == eAVXUnknown) {
-g_has_avx = eAVXNotPresent;
-
-// Only xnu-2020 or later has AVX support, any versions before
-// this have a busted thread_get_state RPC where it would truncate
-// the thread state buffer (). So we need to
-// verify the kernel version number manually or disable AVX support.
-int mib[2];
-char buffer[1024];
-size_t length = sizeof(buffer);
-uint64_t xnu_version = 0;
-mib[0] = CTL_KERN;
-mib[1] = KERN_VERSION;
-int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
-if (err == 0) {
-  const char *xnu = strstr(buffer, "xnu-");
-  if (xnu) {
-const char *xnu_version_cstr = xnu + 4;
-xnu_version = strtoull(xnu_version_cstr, NULL, 0);
-if (xnu_version >= 2020 && xnu_version != ULLONG_MAX) {
-  if (::HasAVX()) {
-g_has_avx = eAVXPresent;
-  }
-}
-  }
-}
-DNBLogThreadedIf(LOG_THREAD, "CPUHasAVX(): g_has_avx = %i (err = %i, errno "
- "= %i, xnu_version = %llu)",
- g_has_avx, err, errno, xnu_version);
+  if (g_has_avx != eAVXUnknown)
+return LogAVXAndReturn(g_has_avx, 0, "");
+
+  g_has_avx = eAVXNotPresent;
+
+  // OS X 10.7.3 and earlier have a bug in thread_get_state that truncated the
+  // size of the return. To work around this we have to disable AVX debugging
+  // on hosts prior to 10.7.3 ().
+  int mib[2];
+  char buffer[1024];
+  size_t length = sizeof(buffer);
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_OSVERSION;
+
+  // KERN_OSVERSION returns the build number which is a number signifying the
+  // major version, a capitol letter signifying the minor version, and numbers
+  // signifying the build (ex: on 10.12.3, the returned value is 16D32).
+  int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
+  if (err != 0)
+return LogAVXAndReturn(g_has_avx, err, "");
+
+  size_t first_letter = 0;
+  for (; first_letter < length; ++first_letter) {
+// This is looking for the first uppercase letter
+if (buffer[first_letter] >= 'A')
+  break;
   }
-
-  return (g_has_avx == eAVXPresent);
+  char letter = buffer[first_letter];
+  buffer[first_letter] = '\0';
+  auto major_ver = strtoull(buffer, NULL, 0);
+  buffer[first_letter] = letter;
+
+  // In this check we're looking to see that our major and minor version numer
+  // was >= 11E, which is the 10.7.4 release.
+  if (major_ver < 11 || (major_ver == 11 && letter < 'E'))
+return LogAVXAndReturn(g_has_avx, err, buffer);
+  if (DetectHardwareFeature("hw.optional.avx1_0"))
+g_has_avx = eAVXPresent;
+
+  return LogAVXAndReturn(g_has_avx, err, buffer);
 }
 
 uint64_t DNBArchImplX86_64::GetPC(uint64_t failValue) {
Index: tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
===
--- tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
+++ tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
@@ -16,7 +16,6 @@
 
 #if defined(__i386__) || defined(__x86_64__)
 
-#include "../HasAVX.h"
 #include "DNBArch.h"
 #include "MachRegisterStatesI386.h"
 
Index: tools/debugserver/source/MacOSX/HasAVX.s
===
--- tools/debugserver/source/MacOSX/HasAVX.s
+++ /dev/

[Lldb-commits] [PATCH] D30918: [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297685: [debugserver] This is a small cleanup patch to AVX 
support detection (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D30918?vs=91644&id=91645#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30918

Files:
  lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
  lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.h
  lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s
  lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
  lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Index: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -29,7 +29,6 @@
   )
 
 add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
-  HasAVX.s
   CFBundle.cpp
   CFString.cpp
   Genealogy.cpp
Index: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
===
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -17,7 +17,6 @@
 #include 
 #include 
 
-#include "../HasAVX.h"
 #include "DNBLog.h"
 #include "MacOSX/x86_64/DNBArchImplX86_64.h"
 #include "MachProcess.h"
@@ -60,42 +59,64 @@
 #define FORCE_AVX_REGS (0)
 #endif
 
-extern "C" bool CPUHasAVX() {
-  enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
+bool DetectHardwareFeature(const char *feature) {
+  int answer = 0;
+  size_t answer_size = sizeof(answer);
+  int error = ::sysctlbyname(feature, &answer, &answer_size, NULL, 0);
+  return error != 0 && answer != 0;
+}
+
+enum AVXPresence { eAVXUnknown = -1, eAVXNotPresent = 0, eAVXPresent = 1 };
+
+bool LogAVXAndReturn(AVXPresence has_avx, int err, const char * os_ver) {
+  DNBLogThreadedIf(LOG_THREAD,
+   "CPUHasAVX(): g_has_avx = %i (err = %i, os_ver = %s)",
+   has_avx, err, os_ver);
+  return (has_avx == eAVXPresent);
+}
 
+extern "C" bool CPUHasAVX() {
   static AVXPresence g_has_avx = eAVXUnknown;
-  if (g_has_avx == eAVXUnknown) {
-g_has_avx = eAVXNotPresent;
+  if (g_has_avx != eAVXUnknown)
+return LogAVXAndReturn(g_has_avx, 0, "");
 
-// Only xnu-2020 or later has AVX support, any versions before
-// this have a busted thread_get_state RPC where it would truncate
-// the thread state buffer (). So we need to
-// verify the kernel version number manually or disable AVX support.
-int mib[2];
-char buffer[1024];
-size_t length = sizeof(buffer);
-uint64_t xnu_version = 0;
-mib[0] = CTL_KERN;
-mib[1] = KERN_VERSION;
-int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
-if (err == 0) {
-  const char *xnu = strstr(buffer, "xnu-");
-  if (xnu) {
-const char *xnu_version_cstr = xnu + 4;
-xnu_version = strtoull(xnu_version_cstr, NULL, 0);
-if (xnu_version >= 2020 && xnu_version != ULLONG_MAX) {
-  if (::HasAVX()) {
-g_has_avx = eAVXPresent;
-  }
-}
-  }
-}
-DNBLogThreadedIf(LOG_THREAD, "CPUHasAVX(): g_has_avx = %i (err = %i, errno "
- "= %i, xnu_version = %llu)",
- g_has_avx, err, errno, xnu_version);
+  g_has_avx = eAVXNotPresent;
+
+  // OS X 10.7.3 and earlier have a bug in thread_get_state that truncated the
+  // size of the return. To work around this we have to disable AVX debugging
+  // on hosts prior to 10.7.3 ().
+  int mib[2];
+  char buffer[1024];
+  size_t length = sizeof(buffer);
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_OSVERSION;
+
+  // KERN_OSVERSION returns the build number which is a number signifying the
+  // major version, a capitol letter signifying the minor version, and numbers
+  // signifying the build (ex: on 10.12.3, the returned value is 16D32).
+  int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
+  if (err != 0)
+return LogAVXAndReturn(g_has_avx, err, "");
+
+  size_t first_letter = 0;
+  for (; first_letter < length; ++first_letter) {
+// This is looking for the first uppercase letter
+if (isupper(buffer[first_letter]))
+  break;
   }
+  char letter = buffer[first_letter];
+  buffer[first_letter] = '\0';
+  auto major_ver = strtoull(buffer, NULL, 0);
+  buffer[first_letter] = letter;
+
+  // In this check we're looking to see that our major and minor version numer
+  // was >= 11E, which is the 10.7.4 release.
+  if (major_ver < 11 || (major_ver == 11 && letter < 'E'))
+return LogAVXAndReturn(g_has_avx, err, buffer);
+  if (DetectHardwareFeature("hw.optional.avx1_0"))
+g_has_avx = eAVXPresent;
 
-  return (g_has_avx == 

[Lldb-commits] [lldb] r297685 - [debugserver] This is a small cleanup patch to AVX support detection

2017-03-13 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Mon Mar 13 18:19:04 2017
New Revision: 297685

URL: http://llvm.org/viewvc/llvm-project?rev=297685&view=rev
Log:
[debugserver] This is a small cleanup patch to AVX support detection

Summary:
The first Sandybridge iMacs with AVX support shipped in Spring 2011 with Snow 
Leopard as their OS. Unfortunately due to a kernel bug debugging AVX code was 
not really possible until 10.7.4.

The old code here checked the kernel build number to determine when to support 
AVX, but that code was incorrect. It verified that the kernel build number was 
greater than xnu-2020, which is the build of the kernel that had the fix for 
10.8. The fix was also back ported to 10.7.4. Which means all publicly 
available OS builds 10.7.4 and later have working AVX support.

This new patch verifies that the host OS is greater than or equal to 10.7.4 by 
checking that the build number is greater than or equal to 11Exx.

The patch also removes the HasAVX assembly blob in favor of querying the kernel 
via sysctl for the hardware features.

Using sysctl is slower, however since the code is executed once and the result 
cached it is a better approach because it is possible for the kernel to disable 
AVX support on hardware that supports it, so listening to the kernel is a 
better approach for the debugger to take.

Reviewers: jasonmolenda, spyffe

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30918

Removed:
lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.h
lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s
Modified:
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=297685&r1=297684&r2=297685&view=diff
==
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj 
(original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Mar 
13 18:19:04 2017
@@ -94,10 +94,8 @@
456F67641AD46CE9002850C2 /* CFBundle.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 2695DD910D3EBFF6007E4CA2 /* CFBundle.cpp */; };
456F67651AD46CE9002850C2 /* PseudoTerminal.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF67ABFF0D34604D0022D128 /* PseudoTerminal.cpp 
*/; };
456F67671AD46CE9002850C2 /* DNBArch.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 264D5D571293835600ED4C01 /* DNBArch.cpp */; };
-   456F67681AD46CE9002850C2 /* HasAVX.s in Sources */ = {isa = 
PBXBuildFile; fileRef = 4971AE7113D10F4F00649E37 /* HasAVX.s */; };
456F67691AD46CE9002850C2 /* DNBArchImplARM64.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 266B5ECF1460A68200E43F0A /* 
DNBArchImplARM64.cpp */; };
456F676B1AD46CE9002850C2 /* CoreFoundation.framework in 
Frameworks */ = {isa = PBXBuildFile; fileRef = 26ACA3340D3E956300A2120B /* 
CoreFoundation.framework */; settings = {ATTRIBUTES = (Required, ); }; };
-   4971AE7213D10F4F00649E37 /* HasAVX.s in Sources */ = {isa = 
PBXBuildFile; fileRef = 4971AE7113D10F4F00649E37 /* HasAVX.s */; };
49D404621E39260F00570CDC /* Foundation.framework in Frameworks 
*/ = {isa = PBXBuildFile; fileRef = 49D404611E39260F00570CDC /* 
Foundation.framework */; };
AF48558C1D75126800D19C07 /* StdStringExtractor.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = AF48558B1D75126800D19C07 /* 
StdStringExtractor.cpp */; };
AF48558D1D75127500D19C07 /* StdStringExtractor.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = AF48558B1D75126800D19C07 /* 
StdStringExtractor.cpp */; };
@@ -210,8 +208,6 @@
26CF99A31142EB7400011AAB /* DNBArchImplX86_64.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DNBArchImplX86_64.h; sourceTree = ""; };
26E6B9DA0D1329010037ECDD /* RNBDefs.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
RNBDefs.h; sourceTree = ""; };
456F67721AD46CE9002850C2 /* debugserver-nonui */ = {isa = 
PBXFileReference; explicitFileType = "compiled.mach-o.executable"; 
includeInIndex = 0; path = "debugserver-nonui"; sourceTree = 
BUILT_PRODUCTS_DIR; };
-   4971AE7013D10F4F00649E37 /* HasAVX.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
HasAVX.h; sourceTree = ""; };
-   4971AE7113D10F4F00649E37 /* HasAVX.s */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = 
HasAVX.s; 

[Lldb-commits] [lldb] r297688 - [debugserver] NFC. Cleanup DNBArchImpl*::GetFPUState()

2017-03-13 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Mon Mar 13 18:27:58 2017
New Revision: 297688

URL: http://llvm.org/viewvc/llvm-project?rev=297688&view=rev
Log:
[debugserver] NFC. Cleanup DNBArchImpl*::GetFPUState()

This patch consolidates the DEBUG_FPU_REGS code for i386 and x86_64 to take 
advantage of the fact that the non-AVX members of the avx register state 
structure overlap with the standard fpu register state structure.

This reduces the amount of code required to set debug values into the register 
state structures because the register state structures are stored in a union.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/MachRegisterStatesX86_64.h

Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=297688&r1=297687&r2=297688&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp 
(original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Mon Mar 
13 18:27:58 2017
@@ -339,60 +339,61 @@ kern_return_t DNBArchImplI386::GetGPRSta
 kern_return_t DNBArchImplI386::GetFPUState(bool force) {
   if (force || m_state.GetError(e_regSetFPU, Read)) {
 if (DEBUG_FPU_REGS) {
-  if (CPUHasAVX() || FORCE_AVX_REGS) {
-m_state.context.fpu.avx.__fpu_reserved[0] = -1;
-m_state.context.fpu.avx.__fpu_reserved[1] = -1;
-*(uint16_t *)&(m_state.context.fpu.avx.__fpu_fcw) = 0x1234;
-*(uint16_t *)&(m_state.context.fpu.avx.__fpu_fsw) = 0x5678;
-m_state.context.fpu.avx.__fpu_ftw = 1;
-m_state.context.fpu.avx.__fpu_rsrv1 = UINT8_MAX;
-m_state.context.fpu.avx.__fpu_fop = 2;
-m_state.context.fpu.avx.__fpu_ip = 3;
-m_state.context.fpu.avx.__fpu_cs = 4;
-m_state.context.fpu.avx.__fpu_rsrv2 = 5;
-m_state.context.fpu.avx.__fpu_dp = 6;
-m_state.context.fpu.avx.__fpu_ds = 7;
-m_state.context.fpu.avx.__fpu_rsrv3 = UINT16_MAX;
-m_state.context.fpu.avx.__fpu_mxcsr = 8;
-m_state.context.fpu.avx.__fpu_mxcsrmask = 9;
-int i;
-for (i = 0; i < 16; ++i) {
-  if (i < 10) {
-m_state.context.fpu.avx.__fpu_stmm0.__mmst_reg[i] = 'a';
-m_state.context.fpu.avx.__fpu_stmm1.__mmst_reg[i] = 'b';
-m_state.context.fpu.avx.__fpu_stmm2.__mmst_reg[i] = 'c';
-m_state.context.fpu.avx.__fpu_stmm3.__mmst_reg[i] = 'd';
-m_state.context.fpu.avx.__fpu_stmm4.__mmst_reg[i] = 'e';
-m_state.context.fpu.avx.__fpu_stmm5.__mmst_reg[i] = 'f';
-m_state.context.fpu.avx.__fpu_stmm6.__mmst_reg[i] = 'g';
-m_state.context.fpu.avx.__fpu_stmm7.__mmst_reg[i] = 'h';
-  } else {
-m_state.context.fpu.avx.__fpu_stmm0.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm1.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm2.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm3.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm4.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm5.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm6.__mmst_reg[i] = INT8_MIN;
-m_state.context.fpu.avx.__fpu_stmm7.__mmst_reg[i] = INT8_MIN;
-  }
 
-  m_state.context.fpu.avx.__fpu_xmm0.__xmm_reg[i] = '0';
-  m_state.context.fpu.avx.__fpu_xmm1.__xmm_reg[i] = '1';
-  m_state.context.fpu.avx.__fpu_xmm2.__xmm_reg[i] = '2';
-  m_state.context.fpu.avx.__fpu_xmm3.__xmm_reg[i] = '3';
-  m_state.context.fpu.avx.__fpu_xmm4.__xmm_reg[i] = '4';
-  m_state.context.fpu.avx.__fpu_xmm5.__xmm_reg[i] = '5';
-  m_state.context.fpu.avx.__fpu_xmm6.__xmm_reg[i] = '6';
-  m_state.context.fpu.avx.__fpu_xmm7.__xmm_reg[i] = '7';
+  m_state.context.fpu.no_avx.__fpu_reserved[0] = -1;
+  m_state.context.fpu.no_avx.__fpu_reserved[1] = -1;
+  *(uint16_t *)&(m_state.context.fpu.no_avx.__fpu_fcw) = 0x1234;
+  *(uint16_t *)&(m_state.context.fpu.no_avx.__fpu_fsw) = 0x5678;
+  m_state.context.fpu.no_avx.__fpu_ftw = 1;
+  m_state.context.fpu.no_avx.__fpu_rsrv1 = UINT8_MAX;
+  m_state.context.fpu.no_avx.__fpu_fop = 2;
+  m_state.context.fpu.no_avx.__fpu_ip = 3;
+  m_state.context.fpu.no_avx.__fpu_cs = 4;
+  m_state.context.fpu.no_avx.__fpu_rsrv2 = 5;
+  m_state.context.fpu.no_avx.__fpu_dp = 6;
+  m_state.context.fpu.no_avx.__fpu_ds = 7;
+  m_state.context.fpu.no_avx.__fpu_rsrv3 = UINT16_MAX;
+  m_state.context.fpu.no_avx.__fpu_mxcsr = 8;
+  m_state.context.fpu.no_avx.__fpu_mxcsrmask = 9;
+  for (int i = 0; 

[Lldb-commits] [lldb] r297691 - [debugserver] NFC. Missed one bit of cleanup in r297688

2017-03-13 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Mon Mar 13 18:46:50 2017
New Revision: 297691

URL: http://llvm.org/viewvc/llvm-project?rev=297691&view=rev
Log:
[debugserver] NFC. Missed one bit of cleanup in r297688

I did this cleanup in the x86_64, but missed it in the i386 code. This just 
simplifies the calls to thread_get_state.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=297691&r1=297690&r2=297691&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp 
(original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Mon Mar 
13 18:46:50 2017
@@ -406,30 +406,21 @@ kern_return_t DNBArchImplI386::GetFPUSta
   }
   m_state.SetError(e_regSetFPU, Read, 0);
 } else {
+  mach_msg_type_number_t count = e_regSetWordSizeFPU;
+  int flavor = __i386_FLOAT_STATE;
+
   if (CPUHasAVX() || FORCE_AVX_REGS) {
-mach_msg_type_number_t count = e_regSetWordSizeAVX;
-m_state.SetError(e_regSetFPU, Read,
- ::thread_get_state(
- m_thread->MachPortNumber(), __i386_AVX_STATE,
- (thread_state_t)&m_state.context.fpu.avx, 
&count));
-DNBLogThreadedIf(LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &avx, "
- "%u (%u passed in)) => 0x%8.8x",
- m_thread->MachPortNumber(), __i386_AVX_STATE, count,
- e_regSetWordSizeAVX,
- m_state.GetError(e_regSetFPU, Read));
-  } else {
-mach_msg_type_number_t count = e_regSetWordSizeFPU;
-m_state.SetError(
-e_regSetFPU, Read,
-::thread_get_state(m_thread->MachPortNumber(), __i386_FLOAT_STATE,
-   (thread_state_t)&m_state.context.fpu.no_avx,
-   &count));
-DNBLogThreadedIf(LOG_THREAD, "::thread_get_state (0x%4.4x, %u, &fpu, "
- "%u (%u passed in) => 0x%8.8x",
- m_thread->MachPortNumber(), __i386_FLOAT_STATE, count,
- e_regSetWordSizeFPU,
- m_state.GetError(e_regSetFPU, Read));
+count = e_regSetWordSizeAVX;
+flavor = __i386_AVX_STATE;
   }
+  m_state.SetError(e_regSetFPU, Read,
+   ::thread_get_state(m_thread->MachPortNumber(), flavor,
+  (thread_state_t)&m_state.context.fpu,
+  &count));
+  DNBLogThreadedIf(LOG_THREAD,
+   "::thread_get_state (0x%4.4x, %u, &fpu, %u => 0x%8.8x",
+   m_thread->MachPortNumber(), flavor, (uint32_t)count,
+   m_state.GetError(e_regSetFPU, Read));
 }
   }
   return m_state.GetError(e_regSetFPU, Read);


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


[Lldb-commits] [lldb] r297701 - update.

2017-03-13 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Mar 13 22:28:27 2017
New Revision: 297701

URL: http://llvm.org/viewvc/llvm-project?rev=297701&view=rev
Log:
update.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=297701&r1=297700&r2=297701&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Mar 13 22:28:27 2017
@@ -960,6 +960,7 @@
AFEC5FD81D94F9380076A480 /* Testx86AssemblyInspectionEngine.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = AFEC5FD51D94F9380076A480 /* 
Testx86AssemblyInspectionEngine.cpp */; };
AFF87C87150FF669000E1742 /* com.apple.debugserver.plist in 
CopyFiles */ = {isa = PBXBuildFile; fileRef = AFF87C86150FF669000E1742 /* 
com.apple.debugserver.plist */; };
AFF87C8F150FF688000E1742 /* com.apple.debugserver.applist.plist 
in CopyFiles */ = {isa = PBXBuildFile; fileRef = AFF87C8E150FF688000E1742 /* 
com.apple.debugserver.applist.plist */; };
+   AFF8FF0C1E779D4B003830EF /* TildeExpressionResolver.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = AFF8FF0B1E779D4B003830EF /* 
TildeExpressionResolver.cpp */; };
B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = B207C4921429607D00F36E4E /* 
CommandObjectWatchpoint.cpp */; };
B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* 
OptionGroupWatchpoint.cpp */; };
B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointList.cpp 
*/; };
@@ -2999,6 +3000,8 @@
AFF87C8A150FF677000E1742 /* com.apple.debugserver.applist.plist 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
text.plist.xml; name = com.apple.debugserver.applist.plist; path = 
tools/debugserver/source/com.apple.debugserver.applist.plist; sourceTree = 
""; };
AFF87C8C150FF68E1742 /* com.apple.debugserver.applist.plist 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
text.plist.xml; name = com.apple.debugserver.applist.plist; path = 
tools/debugserver/source/com.apple.debugserver.applist.plist; sourceTree = 
""; };
AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
text.plist.xml; name = com.apple.debugserver.applist.plist; path = 
tools/debugserver/source/com.apple.debugserver.applist.plist; sourceTree = 
""; };
+   AFF8FF0B1E779D4B003830EF /* TildeExpressionResolver.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = TildeExpressionResolver.cpp; path = 
source/Utility/TildeExpressionResolver.cpp; sourceTree = ""; };
+   AFF8FF0D1E779D51003830EF /* TildeExpressionResolver.h */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
TildeExpressionResolver.h; path = 
include/lldb/Utility/TildeExpressionResolver.h; sourceTree = ""; };
B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = CommandObjectWatchpoint.cpp; path = 
source/Commands/CommandObjectWatchpoint.cpp; sourceTree = ""; };
B207C4941429609C00F36E4E /* CommandObjectWatchpoint.h */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
CommandObjectWatchpoint.h; path = source/Commands/CommandObjectWatchpoint.h; 
sourceTree = ""; };
B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = ""; };
@@ -4236,6 +4239,8 @@
94BA8B6C176F8C9B005A91B5 /* Range.cpp */,
6DEC6F3A1BD66D950091ABA6 /* TaskPool.h */,
6DEC6F381BD66D750091ABA6 /* TaskPool.cpp */,
+   AFF8FF0B1E779D4B003830EF /* 
TildeExpressionResolver.cpp */,
+   AFF8FF0D1E779D51003830EF /* 
TildeExpressionResolver.h */,
2654A6911E552F3C00DA1013 /* UriParser.h */,
33064C991A5C7A330033D415 /* UriParser.cpp */,
AFC2DCEA1E6E2F7D00283714 /* UserID.cpp */,
@@ -7354,6 +7359,7 @@
268900E313353E6F00698AC0 /* TypeList.cpp in 
Sources */,
268900E413353E6F00698AC0 /* UnwindPlan.cpp in 
Sources */,
268900E513353E6F00698AC0 /* Unwi

[Lldb-commits] [PATCH] D30926: Fix MSVC signed/unsigned conversion and size_t conversion warnings in LLDB

2017-03-13 Thread Hugh Bellamy via Phabricator via lldb-commits
hughbe created this revision.

I've been porting swift-lldb to Windows/MSVC, and encountered some 
size_t/unsigned implicit conversion warnings. I sent a PR 
(https://github.com/apple/swift-lldb/pull/161) and @jimingham suggested I push 
some of them here.


Repository:
  rL LLVM

https://reviews.llvm.org/D30926

Files:
  Core/FormatEntity.cpp


Index: Core/FormatEntity.cpp
===
--- Core/FormatEntity.cpp
+++ Core/FormatEntity.cpp
@@ -64,14 +64,14 @@
 #define ENTRY_CHILDREN(n, t, f, c) 
\
   {
\
 n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, 
\
-false  
\
+FormatEntity::Entry::FormatType::f, 0, 
\
+static_cast(llvm::array_lengthof(c)), c, false   
\
   }
 #define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c)
\
   {
\
 n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, 
\
-true   
\
+FormatEntity::Entry::FormatType::f, 0, 
\
+static_cast(llvm::array_lengthof(c)), c, true
\
   }
 #define ENTRY_STRING(n, s) 
\
   {
\


Index: Core/FormatEntity.cpp
===
--- Core/FormatEntity.cpp
+++ Core/FormatEntity.cpp
@@ -64,14 +64,14 @@
 #define ENTRY_CHILDREN(n, t, f, c) \
   {\
 n, nullptr, FormatEntity::Entry::Type::t,  \
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, \
-false  \
+FormatEntity::Entry::FormatType::f, 0, \
+static_cast(llvm::array_lengthof(c)), c, false   \
   }
 #define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c)\
   {\
 n, nullptr, FormatEntity::Entry::Type::t,  \
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, \
-true   \
+FormatEntity::Entry::FormatType::f, 0, \
+static_cast(llvm::array_lengthof(c)), c, true\
   }
 #define ENTRY_STRING(n, s) \
   {\
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30927: Normalize the LLVM cmake path before appending it to the module path

2017-03-13 Thread Hugh Bellamy via Phabricator via lldb-commits
hughbe updated this revision to Diff 91668.
hughbe added a comment.

Fix preview


https://reviews.llvm.org/D30927

Files:
  cmake/modules/LLDBStandalone.cmake


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -69,6 +69,7 @@
 
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
+get_filename_component(LLVM_CMAKE_PATH ${LLVM_CMAKE_PATH} ABSOLUTE)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include(${LLVMCONFIG_FILE})
   else()


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -69,6 +69,7 @@
 
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
+get_filename_component(LLVM_CMAKE_PATH ${LLVM_CMAKE_PATH} ABSOLUTE)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include(${LLVMCONFIG_FILE})
   else()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30927: Normalize the LLVM cmake path before appending it to the module path

2017-03-13 Thread Hugh Bellamy via Phabricator via lldb-commits
hughbe created this revision.
hughbe added a project: LLDB.
Herald added a subscriber: mgorny.

LLVM_CMAKE_PATH has backlashes in it. CMake then tries to append this to 
CMAKE_MODULE_PATH but gets confused and errors out as it thinks we're providing 
an escape sequence (that's unknown, causing generation to fail)

E.g "C:\Users\hugh..."

I've been porting swift to Windows/MSVC. This was causing the Windows build to 
fail and I submitted a PR (https://github.com/apple/swift-lldb/pull/156). Maybe 
it belongs upstream, however


Repository:
  rL LLVM

https://reviews.llvm.org/D30927

Files:
  modules/LLDBStandalone.cmake


Index: modules/LLDBStandalone.cmake
===
--- modules/LLDBStandalone.cmake
+++ modules/LLDBStandalone.cmake
@@ -69,6 +69,7 @@
 
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
+get_filename_component(LLVM_CMAKE_PATH ${LLVM_CMAKE_PATH} ABSOLUTE)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include(${LLVMCONFIG_FILE})
   else()


Index: modules/LLDBStandalone.cmake
===
--- modules/LLDBStandalone.cmake
+++ modules/LLDBStandalone.cmake
@@ -69,6 +69,7 @@
 
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
+get_filename_component(LLVM_CMAKE_PATH ${LLVM_CMAKE_PATH} ABSOLUTE)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include(${LLVMCONFIG_FILE})
   else()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30926: Fix MSVC signed/unsigned conversion and size_t conversion warnings in LLDB

2017-03-13 Thread Hugh Bellamy via Phabricator via lldb-commits
hughbe updated this revision to Diff 91670.
hughbe added a comment.

Fix file names


https://reviews.llvm.org/D30926

Files:
  source/Core/FormatEntity.cpp


Index: source/Core/FormatEntity.cpp
===
--- source/Core/FormatEntity.cpp
+++ source/Core/FormatEntity.cpp
@@ -64,14 +64,14 @@
 #define ENTRY_CHILDREN(n, t, f, c) 
\
   {
\
 n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, 
\
-false  
\
+FormatEntity::Entry::FormatType::f, 0, 
\
+static_cast(llvm::array_lengthof(c)), c, false   
\
   }
 #define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c)
\
   {
\
 n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, 
\
-true   
\
+FormatEntity::Entry::FormatType::f, 0, 
\
+static_cast(llvm::array_lengthof(c)), c, true
\
   }
 #define ENTRY_STRING(n, s) 
\
   {
\


Index: source/Core/FormatEntity.cpp
===
--- source/Core/FormatEntity.cpp
+++ source/Core/FormatEntity.cpp
@@ -64,14 +64,14 @@
 #define ENTRY_CHILDREN(n, t, f, c) \
   {\
 n, nullptr, FormatEntity::Entry::Type::t,  \
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, \
-false  \
+FormatEntity::Entry::FormatType::f, 0, \
+static_cast(llvm::array_lengthof(c)), c, false   \
   }
 #define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c)\
   {\
 n, nullptr, FormatEntity::Entry::Type::t,  \
-FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c), c, \
-true   \
+FormatEntity::Entry::FormatType::f, 0, \
+static_cast(llvm::array_lengthof(c)), c, true\
   }
 #define ENTRY_STRING(n, s) \
   {\
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D30926: Fix MSVC signed/unsigned conversion and size_t conversion warnings in LLDB

2017-03-13 Thread Zachary Turner via lldb-commits
Lgtm, no need to request a review for these kind of trivial warning fixes
On Mon, Mar 13, 2017 at 9:11 PM Hugh Bellamy via Phabricator via
lldb-commits  wrote:

> hughbe updated this revision to Diff 91670.
> hughbe added a comment.
>
> Fix file names
>
>
> https://reviews.llvm.org/D30926
>
> Files:
>   source/Core/FormatEntity.cpp
>
>
> Index: source/Core/FormatEntity.cpp
> ===
> --- source/Core/FormatEntity.cpp
> +++ source/Core/FormatEntity.cpp
> @@ -64,14 +64,14 @@
>  #define ENTRY_CHILDREN(n, t, f, c)
>  \
>{
>   \
>  n, nullptr, FormatEntity::Entry::Type::t,
>   \
> -FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c),
> c, \
> -false
>   \
> +FormatEntity::Entry::FormatType::f, 0,
>  \
> +static_cast(llvm::array_lengthof(c)), c, false
>  \
>}
>  #define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c)
>   \
>{
>   \
>  n, nullptr, FormatEntity::Entry::Type::t,
>   \
> -FormatEntity::Entry::FormatType::f, 0, llvm::array_lengthof(c),
> c, \
> -true
>  \
> +FormatEntity::Entry::FormatType::f, 0,
>  \
> +static_cast(llvm::array_lengthof(c)), c, true
>   \
>}
>  #define ENTRY_STRING(n, s)
>  \
>{
>   \
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D30927: Normalize the LLVM cmake path before appending it to the module path

2017-03-13 Thread Zachary Turner via lldb-commits
Shouldn't this be file(TO_CMAKE_PATH...)?
On Mon, Mar 13, 2017 at 9:09 PM Hugh Bellamy via Phabricator via
lldb-commits  wrote:

> hughbe updated this revision to Diff 91668.
> hughbe added a comment.
>
> Fix preview
>
>
> https://reviews.llvm.org/D30927
>
> Files:
>   cmake/modules/LLDBStandalone.cmake
>
>
> Index: cmake/modules/LLDBStandalone.cmake
> ===
> --- cmake/modules/LLDBStandalone.cmake
> +++ cmake/modules/LLDBStandalone.cmake
> @@ -69,6 +69,7 @@
>
>set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
>if(EXISTS ${LLVMCONFIG_FILE})
> +get_filename_component(LLVM_CMAKE_PATH ${LLVM_CMAKE_PATH} ABSOLUTE)
>  list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
>  include(${LLVMCONFIG_FILE})
>else()
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30927: Normalize the LLVM cmake path before appending it to the module path

2017-03-13 Thread Hugh Bellamy via Phabricator via lldb-commits
hughbe updated this revision to Diff 91676.
hughbe added a comment.

Address feedback from Zachary Turner


https://reviews.llvm.org/D30927

Files:
  cmake/modules/LLDBStandalone.cmake


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -69,6 +69,7 @@
 
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
+file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH}" LLVM_CMAKE_PATH)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include(${LLVMCONFIG_FILE})
   else()


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -69,6 +69,7 @@
 
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
+file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH}" LLVM_CMAKE_PATH)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include(${LLVMCONFIG_FILE})
   else()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits