[Lldb-commits] [lldb] r324795 - Looks like this fails when built i386 on linux bots, possible target

2018-02-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Feb  9 17:57:33 2018
New Revision: 324795

URL: http://llvm.org/viewvc/llvm-project?rev=324795=rev
Log:
Looks like this fails when built i386 on linux bots, possible target
arch incompat with spec in file so it's rejected and the test fails.
will look into this later, will be a test case issue not a test issue;
test case may only be valid when lldb is built for/running on an x86_64
system.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py?rev=324795=324794=324795=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 Fri Feb  9 17:57:33 2018
@@ -6,6 +6,7 @@ from gdbclientutils import *
 
 class TestTargetXMLArch(GDBRemoteTestBase):
 
+@expectedFailureAll(archs=["i386"])
 def test(self):
 """
 Test lldb's parsing of the  tag in the target.xml 
register


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


[Lldb-commits] [lldb] r324792 - Add test case for x86_64 architecture recognition in the

2018-02-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Feb  9 17:13:34 2018
New Revision: 324792

URL: http://llvm.org/viewvc/llvm-project?rev=324792=rev
Log:
Add test case for x86_64 architecture recognition in the
target.xml packet if it is included.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py?rev=324792=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
 Fri Feb  9 17:13:34 2018
@@ -0,0 +1,121 @@
+from __future__ import print_function
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+class TestTargetXMLArch(GDBRemoteTestBase):
+
+def test(self):
+"""
+Test lldb's parsing of the  tag in the target.xml 
register
+description packet.
+"""
+class MyResponder(MockGDBServerResponder):
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+  i386:x86-64
+  
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+""", False
+else:
+return None, False
+
+def qC(self):
+return "QC1"
+
+def haltReason(self):
+return 
"T05thread:0001;06:9038d60f0070;07:98b4062680ff;10:c0d7bf1b80ff;"
+
+def readRegister(self, register):
+regs = {0x0: "00b00661", 
+0xa: "68fe471c80ff", 
+0xc: "60574a1c80ff", 
+0xd: "18f3042680ff", 
+0xe: "be8a4d714200", 
+0xf: "50df471c80ff", 
+0x10: "c0d7bf1b80ff" }
+if register in regs:
+return regs[register]
+else:
+return ""
+
+self.server.responder = MyResponder()
+interp = self.dbg.GetCommandInterpreter()
+result = lldb.SBCommandReturnObject()
+if self.TraceOn():
+interp.HandleCommand("log enable gdb-remote packets", result)
+target = self.dbg.CreateTarget('')
+self.assertEqual('', target.GetTriple())
+process = self.connect(target)
+if self.TraceOn():
+interp.HandleCommand("target list", result)
+print(result.GetOutput())
+self.assertEqual('x86_64--', target.GetTriple())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
URL: 

Re: [Lldb-commits] [lldb] r324743 - [Testsuite] Remove leak tests, it's not useful anymore.

2018-02-09 Thread Vedant Kumar via lldb-commits
Nice!

vedant

> On Feb 9, 2018, at 8:06 AM, Davide Italiano via lldb-commits 
>  wrote:
> 
> Author: davide
> Date: Fri Feb  9 08:06:39 2018
> New Revision: 324743
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=324743=rev
> Log:
> [Testsuite] Remove leak tests, it's not useful anymore.
> 
> This only worked on MacOS, which now ships a newer version of
> python without this bug. As such, we don't leak the fd, and
> this test is not needed anymore (as it also hardcoded the python
> version in the check).
> 
> Removed:
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/main.c
> 
> Removed: 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile?rev=324742=auto
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
>  (original)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
>  (removed)
> @@ -1,5 +0,0 @@
> -LEVEL = ../../make
> -
> -C_SOURCES := main.c
> -
> -include $(LEVEL)/Makefile.rules
> 
> Removed: 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py?rev=324742=auto
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
>  (original)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
>  (removed)
> @@ -1,108 +0,0 @@
> -"""
> -Test whether a process started by lldb has no extra file descriptors open.
> -"""
> -
> -from __future__ import print_function
> -
> -
> -import os
> -import lldb
> -from lldbsuite.test import lldbutil
> -from lldbsuite.test.lldbtest import *
> -from lldbsuite.test.decorators import *
> -
> -
> -def python_leaky_fd_version(test):
> -import sys
> -# Python random module leaks file descriptors on some versions.
> -if sys.version_info >= (2, 7, 8) and sys.version_info < (2, 7, 10):
> -return "Python random module leaks file descriptors in this python 
> version"
> -return None
> -
> -
> -class AvoidsFdLeakTestCase(TestBase):
> -
> -NO_DEBUG_INFO_TESTCASE = True
> -
> -mydir = TestBase.compute_mydir(__file__)
> -
> -@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
> -@expectedFailureAll(
> -oslist=['freebsd'],
> -bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
> -# The check for descriptor leakage needs to be implemented differently
> -# here.
> -@skipIfWindows
> -@skipIfTargetAndroid()  # Android have some other file descriptors open 
> by the shell
> -@skipIfDarwinEmbedded #   # debugserver on ios 
> has an extra fd open on launch
> -def test_fd_leak_basic(self):
> -self.do_test([])
> -
> -@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
> -@expectedFailureAll(
> -oslist=['freebsd'],
> -bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
> -# The check for descriptor leakage needs to be implemented differently
> -# here.
> -@skipIfWindows
> -@skipIfTargetAndroid()  # Android have some other file descriptors open 
> by the shell
> -@skipIfDarwinEmbedded #   # debugserver on ios 
> has an extra fd open on launch
> -def test_fd_leak_log(self):
> -self.do_test(["log enable -f '/dev/null' lldb commands"])
> -
> -def do_test(self, commands):
> -self.build()
> -exe = self.getBuildArtifact("a.out")
> -
> -for c in commands:
> -self.runCmd(c)
> -
> -target = self.dbg.CreateTarget(exe)
> -
> -process = target.LaunchSimple(
> -None, None, self.get_process_working_directory())
> -self.assertTrue(process, PROCESS_IS_VALID)
> -
> -self.assertTrue(
> -process.GetState() == lldb.eStateExited,
> -"Process should have exited.")
> -self.assertTrue(
> -process.GetExitStatus() == 0,
> -"Process returned non-zero status. Were incorrect file 
> descriptors passed?")
> -
> -@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
> -@expectedFailureAll(
> -oslist=['freebsd'],
> -bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
> -# The check for descriptor leakage needs to be implemented differently
> -# here.
> -

[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324775: Make LLDBs clang module cache path 
customizable (authored by adrian, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D43099?vs=133636=133684#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43099

Files:
  lldb/trunk/include/lldb/Target/Target.h
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
  
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
  lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/trunk/source/Target/Target.cpp

Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -23,6 +23,7 @@
   LINK_LIBS
 clangAST
 clangCodeGen
+clangDriver
 clangEdit
 clangFrontend
 clangLex
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -13,6 +13,7 @@
 
 // Other libraries and framework includes
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Driver/Driver.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Lex/Preprocessor.h"
@@ -590,14 +591,12 @@
   // Add additional search paths with { "-I", path } or { "-F", path } here.
 
   {
-llvm::SmallString<128> DefaultModuleCache;
-const bool erased_on_reboot = false;
-llvm::sys::path::system_temp_directory(erased_on_reboot,
-   DefaultModuleCache);
-llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
-llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
+llvm::SmallString<128> Path;
+target.GetClangModulesCachePath().GetPath(Path);
+if (Path.empty())
+  clang::driver::Driver::getDefaultModuleCachePath(Path);
 std::string module_cache_argument("-fmodules-cache-path=");
-module_cache_argument.append(DefaultModuleCache.str().str());
+module_cache_argument.append(Path.str());
 compiler_invocation_arguments.push_back(module_cache_argument);
   }
 
Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -3509,6 +3509,9 @@
  OptionValue::eTypeString, nullptr, nullptr,
  "A list of trap handler function names, e.g. a common Unix user process "
  "one is _sigtramp."},
+{"clang-modules-cache-path",
+ OptionValue::eTypeFileSpec, false, 0, nullptr, nullptr,
+ "The path to the clang modules cache directory (-fmodules-cache-path)."},
 {"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
  nullptr, nullptr, "If true, LLDB will show variables that are meant to "
"support the operation of a language's runtime "
@@ -3558,6 +3561,7 @@
   ePropertyMemoryModuleLoadLevel,
   ePropertyDisplayExpressionsInCrashlogs,
   ePropertyTrapHandlerNames,
+  ePropertyClangModulesCachePath,
   ePropertyDisplayRuntimeSupportValues,
   ePropertyNonStopModeEnabled,
   ePropertyExperimental
@@ -3937,6 +3941,15 @@
   return option_value->GetCurrentValue();
 }
 
+FileSpec ::GetClangModulesCachePath() {
+  const uint32_t idx = ePropertyClangModulesCachePath;
+  OptionValueFileSpec *option_value =
+  m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
+   idx);
+  assert(option_value);
+  return option_value->GetCurrentValue();
+}
+
 FileSpecList ::GetClangModuleSearchPaths() {
   const uint32_t idx = ePropertyClangModuleSearchPaths;
   OptionValueFileSpecList *option_value =
Index: lldb/trunk/include/lldb/Target/Target.h
===
--- lldb/trunk/include/lldb/Target/Target.h
+++ lldb/trunk/include/lldb/Target/Target.h
@@ -126,6 +126,8 @@
 
   FileSpecList ();
 
+  FileSpec ();
+
   FileSpecList ();
 
   bool GetEnableAutoImportClangModules() const;
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -1914,6 +1914,14 @@
 # decorators.
 Base.setUp(self)
 
+# Set the clang modules cache path.
+if self.child:
+assert(self.getDebugInfo() == 'default')
+  

[Lldb-commits] [lldb] r324775 - Make LLDB's clang module cache path customizable

2018-02-09 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Feb  9 14:08:26 2018
New Revision: 324775

URL: http://llvm.org/viewvc/llvm-project?rev=324775=rev
Log:
Make LLDB's clang module cache path customizable

This patch makes LLDB's clang module cache path customizable via
settings set target.clang-modules-cache-path  and uses it in the
LLDB testsuite to reuse the same location inside the build directory
for LLDB and clang.

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

Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=324775=324774=324775=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Fri Feb  9 14:08:26 2018
@@ -126,6 +126,8 @@ public:
 
   FileSpecList ();
 
+  FileSpec ();
+
   FileSpecList ();
 
   bool GetEnableAutoImportClangModules() const;

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=324775=324774=324775=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Feb  9 14:08:26 
2018
@@ -1914,6 +1914,14 @@ class TestBase(Base):
 # decorators.
 Base.setUp(self)
 
+# Set the clang modules cache path.
+if self.child:
+assert(self.getDebugInfo() == 'default')
+mod_cache = os.path.join(self.getBuildDir(), "module-cache")
+self.runCmd("settings set target.clang-modules-cache-path "
++ mod_cache)
+
+
 if "LLDB_MAX_LAUNCH_COUNT" in os.environ:
 self.maxLaunchCount = int(os.environ["LLDB_MAX_LAUNCH_COUNT"])
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py?rev=324775=324774=324775=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py 
Fri Feb  9 14:08:26 2018
@@ -15,21 +15,20 @@ import re
 import sys
 
 from lldbsuite.test.decorators import *
-from lldbsuite.test import lldbtest
+from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbtest_config
 
 
-class DarwinNSLogOutputTestCase(lldbtest.TestBase):
+class DarwinNSLogOutputTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
-
-mydir = lldbtest.TestBase.compute_mydir(__file__)
+mydir = TestBase.compute_mydir(__file__)
 
 @skipUnlessDarwin
 @skipIfRemote   # this test is currently written using lldb commands & 
assumes running on local system
 
 def setUp(self):
 # Call super's setUp().
-super(DarwinNSLogOutputTestCase, self).setUp()
+TestBase.setUp(self)
 self.child = None
 self.child_prompt = '(lldb) '
 self.strict_sources = False
@@ -42,7 +41,7 @@ class DarwinNSLogOutputTestCase(lldbtest
 self.d = {'OBJC_SOURCES': self.source, 'EXE': self.exe_name}
 
 # Locate breakpoint.
-self.line = lldbtest.line_number(self.source, '// break here')
+self.line = line_number(self.source, '// break here')
 
 def tearDown(self):
 # Shut down the process if it's still running.

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt?rev=324775=324774=324775=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt Fri Feb  9 
14:08:26 2018
@@ -23,6 +23,7 @@ add_lldb_library(lldbPluginExpressionPar
   LINK_LIBS
 clangAST
 clangCodeGen
+clangDriver
 clangEdit
 clangFrontend
 clangLex

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=324775=324774=324775=diff
==
--- 

Re: [Lldb-commits] [PATCH] D43096: [lit] Update how clang and other binaries are found in per-configuration directories

2018-02-09 Thread Zachary Turner via lldb-commits
On Fri, Feb 9, 2018 at 12:19 PM Stiliyana Stamenova <
stiliyana.stamen...@gmail.com> wrote:

> No, we don't need a switch unless we want to be explicit.
>
> I am not sure what you mean by "fix that instead" - the VS generator?
>
What I meant is that if the default behavior (i.e. LLDB_TEST_C_COMPILER and
LLDB_TEST_CXX_COMPILER are not present at CMake configure time) is to use
the just built clang, then there is no need for a flag such as
LLDB_TEST_JUST_BUILT_CLANG.  Because that would be the same as just not
specifying anything.

What I'm trying to avoid is for people who don't use VS generator having to
remember about this in the future.

AFAICT the problem is that CMAKE_CFG_INT_DIR is a string like
"$(Configuration)", but in Python we need the string to be something like
"%(build_mode)s".  Why don't we just make the path have %(build_mode)s in
the first place, instead of making it have $(Configuration)?  Then we don't
have to replace anything.

Specifically, would it make sense to put this logic:

if (CMAKE_CFG_INTDIR STREQUAL ".")
  set(LLVM_BUILD_MODE ".")
else ()
  set(LLVM_BUILD_MODE "%(build_mode)s")
endif ()

higher up in the LLDB CMake (for example near the top of
lldb/CMakeLists.txt), and then don't even use CMAKE_CFG_INT_DIR in the
first place?  For example, we could change this:

set(LLDB_DEFAULT_TEST_C_COMPILER
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
set(LLDB_DEFAULT_TEST_CXX_COMPILER
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")


to this:

set(LLDB_DEFAULT_TEST_C_COMPILER
"${LLVM_BINARY_DIR}/${LLVM_BUILD_MODE}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
set(LLDB_DEFAULT_TEST_CXX_COMPILER
"${LLVM_BINARY_DIR}/${LLVM_BUILD_MODE}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")

and similarly replace this:

  set(LLVM_RUNTIME_OUTPUT_INTDIR
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
  set(LLVM_LIBRARY_OUTPUT_INTDIR
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})

with a similar pattern?
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

To me, the determinant here is whether the llvm project sees many more 
interactive tools in its future.  If lldb is the only one, then moving all this 
functionality to llvm seems like effort better spent elsewhere.  But if there 
are other interactive tools in the offing, it would be great to have all such 
tools have a common behavior, and so there's good motivation for doing this 
work.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [lldb] r324768 - [lldb-mi] This test now passes consistently, unXFAIL it.

2018-02-09 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri Feb  9 11:35:07 2018
New Revision: 324768

URL: http://llvm.org/viewvc/llvm-project?rev=324768=rev
Log:
[lldb-mi] This test now passes consistently, unXFAIL it.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=324768=324767=324768=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py 
Fri Feb  9 11:35:07 2018
@@ -92,7 +92,6 @@ class MiSyntaxTestCase(lldbmi_testcase.M
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfRemote   # We do not currently support remote debugging via the MI.
-@expectedFailureAll(oslist=["macosx"], bugnumber="rdar://28805064")
 def test_lldbmi_output_grammar(self):
 """Test that 'lldb-mi --interpreter' uses standard output syntax."""
 


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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

It's probably possible to make it work, but as Jim said, there's no drop in 
replacement currently.  There's bits and pieces of stuff that, with a dedicated 
effort, could be improved to the point of being sufficient, though.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I don't think there's any battle.  I wouldn't mind moving the command parsing 
code into llvm if there's a suitable replacement.

But so far as I can see llvm's command line parsing was primarily intended for 
parsing args for shell tools.  So it lacks features required for a replacement 
to lldb's command line parser.

The lldb interactive command interpreter absolutely needs completion callbacks. 
 Nobody would be happy with lldb if it didn't complete filenames and symbols 
and the commands themselves.  We also do shortest match rather than exact 
matches which folks find very handy.  And you have to be able to provide our 
alias system which is also very heavily used.  If somebody wants to add all 
these features to the llvm command line parser, then we could use it in lldb.  
I'm not sure that that would be a great idea, it might be seen to overly 
complicate the shell tool only parser.

Anyway, I don't see a drop-in replacement in llvm.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Davide Italiano via Phabricator via lldb-commits
davide added inline comments.



Comment at: source/Target/Target.cpp:3949
+   idx);
+  assert(option_value);
+  return option_value->GetCurrentValue();

aprantl wrote:
> davide wrote:
> > add an assertion message if you don't mind?
> This code is mechanically duplicated from the other functions in this file, 
> and I was actually planning on making another pass that auto-generates all of 
> the properties and the accessor functions from a .inc file using an 
> llvm-style HANDLE_foo() macro.
Sure, even better :) It would be awesome if lldb didn't do its own command line 
handling but would use something like `cl::opt`, but I guess that's a battle 
for another day.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Target/Target.cpp:3949
+   idx);
+  assert(option_value);
+  return option_value->GetCurrentValue();

davide wrote:
> add an assertion message if you don't mind?
This code is mechanically duplicated from the other functions in this file, and 
I was actually planning on making another pass that auto-generates all of the 
properties and the accessor functions from a .inc file using an llvm-style 
HANDLE_foo() macro.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

This looks fine to me.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.

LGTM modulo minor.




Comment at: source/Plugins/ExpressionParser/Clang/CMakeLists.txt:26
 clangCodeGen
+clangDriver
 clangEdit

aprantl wrote:
> I checked and this does not affects LLDB's binary size in any measurable way.
This doesn't surprise me, as the driver is very small.



Comment at: source/Target/Target.cpp:3949
+   idx);
+  assert(option_value);
+  return option_value->GetCurrentValue();

add an assertion message if you don't mind?


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/ExpressionParser/Clang/CMakeLists.txt:26
 clangCodeGen
+clangDriver
 clangEdit

I checked and this does not affects LLDB's binary size in any measurable way.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: 
source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:595-601
+if (Path.empty()) {
+  // This code is copied from the Clang driver.
+  const bool erased_on_reboot = false;
+  llvm::sys::path::system_temp_directory(erased_on_reboot, Path);
+  llvm::sys::path::append(Path, "org.llvm.clang");
+  llvm::sys::path::append(Path, "ModuleCache");
+}

jingham wrote:
> Is there a reason not to have GetClangModulesCachePath do this?  This is 
> roughly the "default value" of the value.  Is there a good reason to make 
> clients compute that?
> 
> I presume you are computing this here because clang doesn't offer an API to 
> do that?
> Is there a reason not to have GetClangModulesCachePath do this?
Yes. It is supposed to return the value of the *property*. Also, I assume that 
Target doesn't necessarily link against Clang, so calling into a Clang API 
there seems to be a layering violation.


https://reviews.llvm.org/D43099



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


[Lldb-commits] [PATCH] D43099: Make LLDB's clang module cache path customizable

2018-02-09 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 133636.
aprantl added a comment.
Herald added subscribers: hintonda, mgorny.

Address most review feedback.


https://reviews.llvm.org/D43099

Files:
  include/lldb/Target/Target.h
  packages/Python/lldbsuite/test/lldbtest.py
  source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -3509,6 +3509,9 @@
  OptionValue::eTypeString, nullptr, nullptr,
  "A list of trap handler function names, e.g. a common Unix user process "
  "one is _sigtramp."},
+{"clang-modules-cache-path",
+ OptionValue::eTypeFileSpec, false, 0, nullptr, nullptr,
+ "The path to the clang modules cache directory (-fmodules-cache-path)."},
 {"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
  nullptr, nullptr, "If true, LLDB will show variables that are meant to "
"support the operation of a language's runtime "
@@ -3558,6 +3561,7 @@
   ePropertyMemoryModuleLoadLevel,
   ePropertyDisplayExpressionsInCrashlogs,
   ePropertyTrapHandlerNames,
+  ePropertyClangModulesCachePath,
   ePropertyDisplayRuntimeSupportValues,
   ePropertyNonStopModeEnabled,
   ePropertyExperimental
@@ -3937,6 +3941,15 @@
   return option_value->GetCurrentValue();
 }
 
+FileSpec ::GetClangModulesCachePath() {
+  const uint32_t idx = ePropertyClangModulesCachePath;
+  OptionValueFileSpec *option_value =
+  m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
+   idx);
+  assert(option_value);
+  return option_value->GetCurrentValue();
+}
+
 FileSpecList ::GetClangModuleSearchPaths() {
   const uint32_t idx = ePropertyClangModuleSearchPaths;
   OptionValueFileSpecList *option_value =
Index: source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -13,6 +13,7 @@
 
 // Other libraries and framework includes
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Driver/Driver.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Lex/Preprocessor.h"
@@ -590,14 +591,12 @@
   // Add additional search paths with { "-I", path } or { "-F", path } here.
 
   {
-llvm::SmallString<128> DefaultModuleCache;
-const bool erased_on_reboot = false;
-llvm::sys::path::system_temp_directory(erased_on_reboot,
-   DefaultModuleCache);
-llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
-llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
+llvm::SmallString<128> Path;
+target.GetClangModulesCachePath().GetPath(Path);
+if (Path.empty())
+  clang::driver::Driver::getDefaultModuleCachePath(Path);
 std::string module_cache_argument("-fmodules-cache-path=");
-module_cache_argument.append(DefaultModuleCache.str().str());
+module_cache_argument.append(Path.str());
 compiler_invocation_arguments.push_back(module_cache_argument);
   }
 
Index: source/Plugins/ExpressionParser/Clang/CMakeLists.txt
===
--- source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -23,6 +23,7 @@
   LINK_LIBS
 clangAST
 clangCodeGen
+clangDriver
 clangEdit
 clangFrontend
 clangLex
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -859,6 +859,10 @@
 self.darwinWithFramework = False
 self.makeBuildDir()
 
+# set the clang modules cache path.
+mod_cache = os.path.join(self.getBuildDir(), "module-cache")
+self.runCmd("settings set target.clang-modules-cache-path " + mod_cache)
+
 def setAsync(self, value):
 """ Sets async mode to True/False and ensures it is reset after the testcase completes."""
 old_async = self.dbg.GetAsync()
Index: include/lldb/Target/Target.h
===
--- include/lldb/Target/Target.h
+++ include/lldb/Target/Target.h
@@ -126,6 +126,8 @@
 
   FileSpecList ();
 
+  FileSpec ();
+
   FileSpecList ();
 
   bool GetEnableAutoImportClangModules() const;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D43096: [lit] Update how clang and other binaries are found in per-configuration directories

2018-02-09 Thread Zachary Turner via lldb-commits
If the default is already to use the just built clang, and an explicit path
allows you to override this, then do we need any switch at all? If the
problem is that the default doesn’t correctly handle visual studio
generator, maybe we could fix that instead?
On Thu, Feb 8, 2018 at 9:43 PM Stiliyana Stamenova <
stiliyana.stamen...@gmail.com> wrote:

> CMAKE_CFG_INTDIR actually evaluates to "." when using make or Ninja, or
> literally the string $(Configuration) when using VS at the point at which
> the lit configuration file is being created. I think that's true for other
> tools as well:
> https://cmake.org/cmake/help/v3.10/variable/CMAKE_CFG_INTDIR.html
>
> If CMAKE_CFG_INTDIR evaluated to Release or Debug, we would not need the
> substitution at all because the path to the tools would be correct already,
> but at the point at which we're looking at CMAKE_CFG_INTDIR in the lit
> configuration file, the path to the just-built compiler gets set to
> something like: "/path/to/llvm/builds/$(Configuration)/bin/clang", so when
> we try to run the tests, the compiler is not found.
>
> That said, adding a new property to make the choice explicit is simple
> enough. Currently, the default is to use the just-built compiler (unless a
> path is specified), so we could add LLDB_TEST_JUST_BUILT_CLANG set to ON by
> default to keep the current default settings.
>
> On Thu, Feb 8, 2018 at 9:07 PM, Zachary Turner  wrote:
>
>> The problem is that CMAKE_CFG_INTDIR evaluates to something very common,
>> like “Debug” or “Release”, and replacing a common string like that in a
>> path creates more problems than it solves in my opinion. What if your build
>> dir is C:\src\LLDBDebugger\out\Debug\clang.exe? Debug appears twice in this
>> string so a replace might have unexpected results.
>>
>> More importantly though, what if you *dont* want to use the just built
>> compiler? Maybe you specifically want to use the one from the release dir
>> because it’s faster, but your lldb is in the debug dir?
>>
>> What if we say that if LLDB_TEST_JUST_BUILT_CLANG is ON, it initializes
>> these values as you’re doing now, but if you specify them manually it uses
>> exactly what you specify with no replacement? Would that work? (Having one
>> variable also saves some typing on the command line anyway)
>>
>> On Thu, Feb 8, 2018 at 8:24 PM Stella Stamenova via Phabricator <
>> revi...@reviews.llvm.org> wrote:
>>
>>> stella.stamenova added inline comments.
>>>
>>>
>>> 
>>> Comment at: lit/CMakeLists.txt:10-13
>>> +string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE}
>>> LLDB_TEST_C_COMPILER ${LLDB_TEST_C_COMPILER})
>>> +string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE}
>>> LLDB_TEST_CXX_COMPILER ${LLDB_TEST_CXX_COMPILER})
>>> +string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR
>>> ${LLVM_LIBRARY_OUTPUT_INTDIR})
>>> +string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR
>>> ${LLVM_RUNTIME_OUTPUT_INTDIR})
>>> 
>>> zturner wrote:
>>> > This only works if you're using a just-built clang, which might not be
>>> the case.  In fact, it's usually not the case, because it's common to want
>>> to run the test suite against a debug build of lldb but using a release
>>> build of clang (otherwise you'll be there all day waiting for it to finish).
>>> >
>>> > I feel like if the user specifies an absolute path to the test
>>> compiler on the command line, that should be what it uses -- always.  If we
>>> want to use a just built toolchain, maybe we need something else, like
>>> `-DLLDB_TEST_BUILT_CLANG=ON`, which would trigger this logic.
>>> >
>>> > As I don't use this configuration though, I'm interested in hearing
>>> your thoughts.
>>> It actually does work in the case when a user specifies a compiler on
>>> the command line as well as when the just-built clang is used and the
>>> default today is to use the just-built clang.
>>>
>>> As far as I can tell, you can specify the compiler with
>>> LLDB_TEST_C_COMPILER (or LLDB_TEST_CXX_COMPILER) when calling CMake or by
>>> passing a value to the tests directly with -C. I assume that you are
>>> concerned about the first case - when passing the property to CMake?
>>>
>>> In that case LLDB_TEST_C_COMPILER is set to /path/to/compiler and these
>>> lines won't actually affect it - unless for some reason the path contained
>>> ${CMAKE_CFG_INTDIR}. If ${CMAKE_CFG_INTDIR} is a period, which is the
>>> likely scenario, it will just be replaced by another period since the build
>>> mode would be the same.
>>>
>>> The only case when it might not work is if ${CMAKE_CFG_INTDIR} is in the
>>> path but not a period - but that is unlikely since the scenario would mean
>>> that ${CMAKE_CFG_INTDIR} is, say, $Configuration and the path that the user
>>> specified contains $Configuration AND it is different than the one they're
>>> using for LLDB.
>>>
>>> On the other hand, without this change it is not possible to use the
>>> just-built 

[Lldb-commits] [lldb] r324743 - [Testsuite] Remove leak tests, it's not useful anymore.

2018-02-09 Thread Davide Italiano via lldb-commits
Author: davide
Date: Fri Feb  9 08:06:39 2018
New Revision: 324743

URL: http://llvm.org/viewvc/llvm-project?rev=324743=rev
Log:
[Testsuite] Remove leak tests, it's not useful anymore.

This only worked on MacOS, which now ships a newer version of
python without this bug. As such, we don't leak the fd, and
this test is not needed anymore (as it also hardcoded the python
version in the check).

Removed:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/main.c

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile?rev=324742=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/Makefile
 (removed)
@@ -1,5 +0,0 @@
-LEVEL = ../../make
-
-C_SOURCES := main.c
-
-include $(LEVEL)/Makefile.rules

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py?rev=324742=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
 (removed)
@@ -1,108 +0,0 @@
-"""
-Test whether a process started by lldb has no extra file descriptors open.
-"""
-
-from __future__ import print_function
-
-
-import os
-import lldb
-from lldbsuite.test import lldbutil
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test.decorators import *
-
-
-def python_leaky_fd_version(test):
-import sys
-# Python random module leaks file descriptors on some versions.
-if sys.version_info >= (2, 7, 8) and sys.version_info < (2, 7, 10):
-return "Python random module leaks file descriptors in this python 
version"
-return None
-
-
-class AvoidsFdLeakTestCase(TestBase):
-
-NO_DEBUG_INFO_TESTCASE = True
-
-mydir = TestBase.compute_mydir(__file__)
-
-@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
-@expectedFailureAll(
-oslist=['freebsd'],
-bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
-# The check for descriptor leakage needs to be implemented differently
-# here.
-@skipIfWindows
-@skipIfTargetAndroid()  # Android have some other file descriptors open by 
the shell
-@skipIfDarwinEmbedded #   # debugserver on ios 
has an extra fd open on launch
-def test_fd_leak_basic(self):
-self.do_test([])
-
-@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
-@expectedFailureAll(
-oslist=['freebsd'],
-bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
-# The check for descriptor leakage needs to be implemented differently
-# here.
-@skipIfWindows
-@skipIfTargetAndroid()  # Android have some other file descriptors open by 
the shell
-@skipIfDarwinEmbedded #   # debugserver on ios 
has an extra fd open on launch
-def test_fd_leak_log(self):
-self.do_test(["log enable -f '/dev/null' lldb commands"])
-
-def do_test(self, commands):
-self.build()
-exe = self.getBuildArtifact("a.out")
-
-for c in commands:
-self.runCmd(c)
-
-target = self.dbg.CreateTarget(exe)
-
-process = target.LaunchSimple(
-None, None, self.get_process_working_directory())
-self.assertTrue(process, PROCESS_IS_VALID)
-
-self.assertTrue(
-process.GetState() == lldb.eStateExited,
-"Process should have exited.")
-self.assertTrue(
-process.GetExitStatus() == 0,
-"Process returned non-zero status. Were incorrect file descriptors 
passed?")
-
-@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
-@expectedFailureAll(
-oslist=['freebsd'],
-bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
-# The check for descriptor leakage needs to be implemented differently
-# here.
-@skipIfWindows
-@skipIfTargetAndroid()  # Android have some other file descriptors open by 
the shell
-@skipIfDarwinEmbedded #   # debugserver on ios 
has an extra fd open on launch
-def test_fd_leak_multitarget(self):
-self.build()
-exe = self.getBuildArtifact("a.out")
-
-target = self.dbg.CreateTarget(exe)
-breakpoint = 

[Lldb-commits] [lldb] r324730 - Fix some warnings in SymbolFilePDB.cpp

2018-02-09 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb  9 03:37:01 2018
New Revision: 324730

URL: http://llvm.org/viewvc/llvm-project?rev=324730=rev
Log:
Fix some warnings in SymbolFilePDB.cpp

Modified:
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=324730=324729=324730=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Fri Feb  9 
03:37:01 2018
@@ -535,10 +535,10 @@ SymbolFilePDB::ResolveSymbolContext(cons
 uint32_t resolve_scope,
 lldb_private::SymbolContext ) {
   uint32_t resolved_flags = 0;
-  if (resolve_scope & eSymbolContextCompUnit |
-  resolve_scope & eSymbolContextVariable |
-  resolve_scope & eSymbolContextFunction |
-  resolve_scope & eSymbolContextBlock |
+  if (resolve_scope & eSymbolContextCompUnit ||
+  resolve_scope & eSymbolContextVariable ||
+  resolve_scope & eSymbolContextFunction ||
+  resolve_scope & eSymbolContextBlock ||
   resolve_scope & eSymbolContextLineEntry) {
 addr_t file_vm_addr = so_addr.GetFileAddress();
 auto symbol_up =
@@ -904,7 +904,6 @@ void SymbolFilePDB::CacheFunctionNames()
   if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) {
 auto demangled_name = pub_sym_up->getUndecoratedName();
 std::vector ids;
-auto cstr_name = ConstString(demangled_name);
 auto vm_addr = pub_sym_up->getVirtualAddress();
 
 // PDB public symbol has mangled name for its associated function.
@@ -941,8 +940,8 @@ uint32_t SymbolFilePDB::FindFunctions(
 return 0;
 
   auto old_size = sc_list.GetSize();
-  if (name_type_mask & eFunctionNameTypeFull |
-  name_type_mask & eFunctionNameTypeBase |
+  if (name_type_mask & eFunctionNameTypeFull ||
+  name_type_mask & eFunctionNameTypeBase ||
   name_type_mask & eFunctionNameTypeMethod) {
 CacheFunctionNames();
 


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


[Lldb-commits] [PATCH] D43076: llgs-test: Parse and store register info recieved from lldb-server

2018-02-09 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324722: llgs-test: Parse and store register info recieved 
from lldb-server (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43076

Files:
  lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp
  lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
  lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
  lldb/trunk/unittests/tools/lldb-server/tests/TestClient.h
  lldb/trunk/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp

Index: lldb/trunk/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp
===
--- lldb/trunk/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp
+++ lldb/trunk/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp
@@ -44,7 +44,7 @@
 << "Thread ID: " << tid << " not in JThreadsInfo.";
 auto pc_value = thread_infos[tid].ReadRegisterAsUint64(pc_reg);
 ASSERT_THAT_EXPECTED(pc_value, Succeeded());
-ASSERT_EQ(stop_reply_pcs[tid], *pc_value)
+ASSERT_EQ(stop_reply_pc.second, *pc_value)
 << "Mismatched PC for thread: " << tid;
   }
 }
Index: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.h
===
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.h
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.h
@@ -74,23 +74,38 @@
   std::string _string);
   llvm::Error SendMessage(llvm::StringRef message, std::string _string,
   PacketResult expected_result);
+
+  template 
+  llvm::Expected SendMessage(llvm::StringRef Message);
   unsigned int GetPcRegisterId();
 
 private:
   TestClient(std::unique_ptr Conn);
 
-  llvm::Error QueryProcessInfo();
+  llvm::Error qProcessInfo();
+  llvm::Error qRegisterInfos();
+  llvm::Error queryProcess();
   llvm::Error Continue(llvm::StringRef message);
   std::string FormatFailedResult(
   const std::string ,
   lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult
   result);
 
   llvm::Optional m_process_info;
   std::unique_ptr m_stop_reply;
-  unsigned int m_pc_register = UINT_MAX;
+  std::vector m_register_infos;
+  unsigned int m_pc_register = LLDB_INVALID_REGNUM;
 };
 
+template 
+llvm::Expected
+TestClient::SendMessage(llvm::StringRef Message) {
+  std::string ResponseText;
+  if (llvm::Error E = SendMessage(Message, ResponseText))
+return std::move(E);
+  return P::create(ResponseText);
+}
+
 } // namespace llgs_tests
 
 #endif // LLDB_SERVER_TESTS_TESTCLIENT_H
Index: lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
===
--- lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
+++ lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
@@ -25,9 +25,11 @@
 typedef llvm::DenseMap U64Map;
 typedef llvm::DenseMap RegisterMap;
 
-class ProcessInfo {
+template  struct Parser { using result_type = T; };
+
+class ProcessInfo : public Parser {
 public:
-  static llvm::Expected Create(llvm::StringRef response);
+  static llvm::Expected create(llvm::StringRef response);
   lldb::pid_t GetPid() const;
   llvm::support::endianness GetEndian() const;
 
@@ -73,6 +75,11 @@
   ThreadInfoMap m_thread_infos;
 };
 
+struct RegisterInfoParser : public Parser {
+  static llvm::Expected
+  create(llvm::StringRef Response);
+};
+
 class StopReply {
 public:
   StopReply() = default;
Index: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
===
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -25,8 +25,7 @@
 using namespace lldb;
 using namespace lldb_private;
 using namespace llvm;
-
-namespace llgs_tests {
+using namespace llgs_tests;
 
 TestClient::TestClient(std::unique_ptr Conn) {
   SetConnection(Conn.release());
@@ -103,7 +102,7 @@
   auto Client = std::unique_ptr(new TestClient(std::move(Conn)));
 
   if (!InferiorArgs.empty()) {
-if (Error E = Client->QueryProcessInfo())
+if (Error E = Client->queryProcess())
   return std::move(E);
   }
 
@@ -128,7 +127,7 @@
 return E;
   if (Error E = SendMessage("qLaunchSuccess"))
 return E;
-  if (Error E = QueryProcessInfo())
+  if (Error E = queryProcess())
 return E;
   return Error::success();
 }
@@ -147,7 +146,9 @@
   return Continue(formatv("vCont;c:{0:x-}", thread_id).str());
 }
 
-const ProcessInfo ::GetProcessInfo() { return *m_process_info; }
+const llgs_tests::ProcessInfo ::GetProcessInfo() {
+  return *m_process_info;
+}
 
 Optional TestClient::GetJThreadsInfo() {
   std::string response;
@@ -201,42 +202,42 @@
 }
 
 unsigned int 

[Lldb-commits] [lldb] r324722 - llgs-test: Parse and store register info recieved from lldb-server

2018-02-09 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb  9 01:40:03 2018
New Revision: 324722

URL: http://llvm.org/viewvc/llvm-project?rev=324722=rev
Log:
llgs-test: Parse and store register info recieved from lldb-server

Summary:
Right now the test client is not parsing register values correctly,
which is manifesting itself in one test failing on 32-bit architectures
(pr36013). This parses the information from the qRegisterInfo packets
and stores it in the client, which will enable fixing the parsing in a
follow up commit.

I am also adding a new templated SendMessage overload, which enables one
to send a message get a parsed response in a single call.

Reviewers: eugene, davide

Subscribers: lldb-commits

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

Modified:
lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp
lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
lldb/trunk/unittests/tools/lldb-server/tests/TestClient.h
lldb/trunk/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp

Modified: lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp?rev=324722=324721=324722=diff
==
--- lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp (original)
+++ lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp Fri Feb  9 
01:40:03 2018
@@ -8,16 +8,18 @@
 
//===--===//
 
 #include "MessageObjects.h"
+#include "lldb/Interpreter/Args.h"
 #include "lldb/Utility/StructuredData.h"
 #include "llvm/ADT/StringExtras.h"
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
+using namespace lldb;
 using namespace llvm;
 using namespace llvm::support;
 namespace llgs_tests {
 
-Expected ProcessInfo::Create(StringRef response) {
+Expected ProcessInfo::create(StringRef response) {
   ProcessInfo process_info;
   auto elements_or_error = SplitUniquePairList("ProcessInfo", response);
   if (!elements_or_error)
@@ -132,6 +134,72 @@ const ThreadInfoMap ::GetTh
   return m_thread_infos;
 }
 
+Expected RegisterInfoParser::create(StringRef Response) {
+  auto ElementsOr = SplitUniquePairList("RegisterInfoParser", Response);
+  if (!ElementsOr)
+return ElementsOr.takeError();
+  auto  = *ElementsOr;
+
+  RegisterInfo Info = {
+  nullptr,   // Name
+  nullptr,   // Alt name
+  0, // byte size
+  0, // offset
+  eEncodingUint, // encoding
+  eFormatHex,// format
+  {
+  LLDB_INVALID_REGNUM, // eh_frame reg num
+  LLDB_INVALID_REGNUM, // DWARF reg num
+  LLDB_INVALID_REGNUM, // generic reg num
+  LLDB_INVALID_REGNUM, // process plugin reg num
+  LLDB_INVALID_REGNUM  // native register number
+  },
+  NULL,
+  NULL,
+  NULL, // Dwarf expression opcode bytes pointer
+  0 // Dwarf expression opcode bytes length
+  };
+  Info.name = ConstString(Elements["name"]).GetCString();
+  if (!Info.name)
+return make_parsing_error("qRegisterInfo: name");
+
+  Info.alt_name = ConstString(Elements["alt-name"]).GetCString();
+
+  if (!to_integer(Elements["bitsize"], Info.byte_size, 10))
+return make_parsing_error("qRegisterInfo: bit-size");
+  Info.byte_size /= CHAR_BIT;
+
+  if (!to_integer(Elements["offset"], Info.byte_offset, 10))
+return make_parsing_error("qRegisterInfo: offset");
+
+  Info.encoding = Args::StringToEncoding(Elements["encoding"]);
+  if (Info.encoding == eEncodingInvalid)
+return make_parsing_error("qRegisterInfo: encoding");
+
+  Info.format = StringSwitch(Elements["format"])
+.Case("binary", eFormatBinary)
+.Case("decimal", eFormatDecimal)
+.Case("hex", eFormatHex)
+.Case("float", eFormatFloat)
+.Case("vector-sint8", eFormatVectorOfSInt8)
+.Case("vector-uint8", eFormatVectorOfUInt8)
+.Case("vector-sint16", eFormatVectorOfSInt16)
+.Case("vector-uint16", eFormatVectorOfUInt16)
+.Case("vector-sint32", eFormatVectorOfSInt32)
+.Case("vector-uint32", eFormatVectorOfUInt32)
+.Case("vector-float32", eFormatVectorOfFloat32)
+.Case("vector-uint64", eFormatVectorOfUInt64)
+.Case("vector-uint128", eFormatVectorOfUInt128)
+.Default(eFormatInvalid);
+  if (Info.format == eFormatInvalid)
+return make_parsing_error("qRegisterInfo: format");
+
+  Info.kinds[eRegisterKindGeneric] =
+  Args::StringToGenericRegister(Elements["generic"]);
+
+  return std::move(Info);
+}
+
 //== StopReply