Re: [Lldb-commits] [PATCH] D11127: [CMake] Don't build Interpreter unittest if python is disabled

2015-07-30 Thread Zachary Turner
zturner added a comment.

You might run into one remaining issue.  In HostPosix (or maybe HostLinux) it 
manually #includes "lldb-python.h" and there is 1 or 2 lines of code that that 
gets the python version using some #define from the python header files.  This 
is the last piece of the puzzle that I did not fix.

The way to fix this is to update ScriptInterpreter base class to provide an 
abstract GetInterpreterVersion() method.  Have ScriptInterpreterPython override 
this to pull the value from the python header.  Then have HostLinux or 
HostPosix or whatever it is use the PluginManager to get the Plugin for 
eLanguagePython, and call the GetInterpreterVersion method.

I didn't fix this yet because my primary focus has been Windows, but AFAIK 
that's all that's necessary to remove the last implicit link dependency on 
Python.


Repository:
  rL LLVM

http://reviews.llvm.org/D11127




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11127: [CMake] Don't build Interpreter unittest if python is disabled

2015-07-30 Thread Zachary Turner
zturner added a comment.

Can you try this again (without your change)?  Building Interpreter unittest 
should no longer cause a link against python.  (What OS are you on btw?)


Repository:
  rL LLVM

http://reviews.llvm.org/D11127




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-29 Thread Zachary Turner
zturner added a comment.

Hi Greg, any comments on this?  AFAIK there are no outstanding issues and it 
should be ok to go in, but as it's kind of large I want to make sure you don't 
have any remaining concerns before I go in.


http://reviews.llvm.org/D11431




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11497: Change Socket::Read / Socket::Write to log to LOG_COMMUNICATION instead of LOG_HOST

2015-07-24 Thread Zachary Turner
Seems reasonable.  lgtm

On Fri, Jul 24, 2015 at 3:18 PM Jason Molenda  wrote:

> jasonmolenda created this revision.
> jasonmolenda added a reviewer: zturner.
> jasonmolenda added a subscriber: lldb-commits.
> jasonmolenda set the repository for this revision to rL LLVM.
>
> I'm adding some new host logging to help diagnose problems of finding
> executable files or dSYMs, Greg suggested we should add it to the Host log
> channel.  Currently Socket::Read and Socket::Write are logging to Host
> which is super verbose.  He suggests that we should switch these over the
> Communication log channel instead.  Some of Socket.cpp is logging to
> LOG_CONNECTION already.  Zachary, any opinion on this?  I think you touched
> this most recently.  Not sure if you're using this logging yourself.
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11497
>
> Files:
>   source/Host/common/Socket.cpp
>
> Index: source/Host/common/Socket.cpp
> ===
> --- source/Host/common/Socket.cpp
> +++ source/Host/common/Socket.cpp
> @@ -139,7 +139,7 @@
>  NativeSocket sock = kInvalidSocketValue;
>  Error error;
>
> -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST));
> +Log *log(lldb_private::GetLogIfAnyCategoriesSet
> (LIBLLDB_LOG_COMMUNICATION));
>  if (log)
>  log->Printf ("Socket::TcpConnect (host/port = %s)",
> host_and_port.data());
>
> @@ -632,7 +632,7 @@
>  else
>  num_bytes = bytes_received;
>
> -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST |
> LIBLLDB_LOG_COMMUNICATION));
> +Log *log(lldb_private::GetLogIfAnyCategoriesSet
> (LIBLLDB_LOG_COMMUNICATION));
>  if (log)
>  {
>  log->Printf ("%p Socket::Read() (socket = %" PRIu64 ", src = %p,
> src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)",
> @@ -674,7 +674,7 @@
>  else
>  num_bytes = bytes_sent;
>
> -Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST));
> +Log *log(lldb_private::GetLogIfAnyCategoriesSet
> (LIBLLDB_LOG_COMMUNICATION));
>  if (log)
>  {
>  log->Printf ("%p Socket::Write() (socket = %" PRIu64 ", src = %p,
> src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)",
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r242529 - Standalone cmake build improvements (bug #23889)

2015-07-20 Thread Zachary Turner
Looks fine to me.

On Mon, Jul 20, 2015 at 9:56 AM Hans Wennborg  wrote:

> +lldb-commits; please keep merge requests on the mailing list
>
> Zach, you're listed as the code owner for the cmake build. OK to merge
> this to 3.7?
>
> Thanks,
> Hans
>
> On Mon, Jul 20, 2015 at 7:26 AM, Pavel Labath  wrote:
> > Hi,
> >
> > would it be possible to merge this commit into the 3.7 branch?
>
> >
> >
> > -- Forwarded message --
> > From: Pavel Labath 
> > Date: 17 July 2015 at 16:50
> > Subject: [Lldb-commits] [lldb] r242529 - Standalone cmake build
> > improvements (bug #23889)
> > To: lldb-commits@cs.uiuc.edu
> >
> >
> > Author: labath
> > Date: Fri Jul 17 10:50:48 2015
> > New Revision: 242529
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=242529&view=rev
> > Log:
> > Standalone cmake build improvements (bug #23889)
> >
> > patch by Eugene Zelenko.
> >
> > Modified:
> > lldb/trunk/CMakeLists.txt
> > lldb/trunk/cmake/modules/LLDBStandalone.cmake
> >
> > Modified: lldb/trunk/CMakeLists.txt
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=242529&r1=242528&r2=242529&view=diff
> >
> ==
> > --- lldb/trunk/CMakeLists.txt (original)
> > +++ lldb/trunk/CMakeLists.txt Fri Jul 17 10:50:48 2015
> > @@ -1,5 +1,7 @@
> > -include(cmake/modules/LLDBConfig.cmake)
> > +cmake_minimum_required(VERSION 2.8)
> > +
> >  include(cmake/modules/LLDBStandalone.cmake)
> > +include(cmake/modules/LLDBConfig.cmake)
> >  include(cmake/modules/AddLLDB.cmake)
> >
> >  #add_subdirectory(include)
> > @@ -13,7 +15,6 @@ add_subdirectory(tools)
> >  add_subdirectory(unittests)
> >  add_subdirectory(lit)
> >
> > -
> >  if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT
> > LLDB_DISABLE_PYTHON )
> > # Add a Post-Build Event to copy over Python files and create
> > the symlink to liblldb.so for the Python API(hardlink on Windows)
> >  add_custom_target( finish_swig ALL
> >
> > Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=242529&r1=242528&r2=242529&view=diff
> >
> ==
> > --- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
> > +++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Fri Jul 17 10:50:48
> 2015
> > @@ -43,6 +43,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
> ># These variables are used by add_llvm_library.
> >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})
> > +  set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
> >
> >include(AddLLVM)
> >include(HandleLLVMOptions)
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Unique file names for TestStarted and TestFinished.

2015-06-05 Thread Zachary Turner
Oh ok, that makes sense then.  Would it be better to use the filename
instead of the pid?  I guess it doesn't matter because nobody really looks
at those files anyway, they're just for bookkeeping for the test suite.  So
lgtm, up to you if you want to use filename or pid.

On Fri, Jun 5, 2015 at 2:00 PM Chaoren Lin  wrote:

> > Why are 2 different instances of dotest.py running in different
> processes both trying to run the same test?
>
>
> They're not. But all test suites write to the same `TestStarted` and
> `TestFinished`.
>
>
> http://reviews.llvm.org/D10284
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Updated dosep.py to output progress and dump std{out, err} on test failure.

2015-06-01 Thread Zachary Turner
Looks ok, did you get a chance to run on Windows to verify that it still
works?

On Sun, May 31, 2015 at 9:30 PM Chaoren Lin  wrote:

> - Accidentally printed stdout again instead of stderr.
> - Passing lock and counter by argument to work on Windows.
>
>
> http://reviews.llvm.org/D10143
>
> Files:
>   test/dosep.py
>
> Index: test/dosep.py
> ===
> --- test/dosep.py
> +++ test/dosep.py
> @@ -66,6 +66,28 @@
>  # Status codes for running command with timeout.
>  eTimedOut, ePassed, eFailed = 124, 0, 1
>
> +output_lock = None
> +test_counter = None
> +total_tests = None
> +
> +def setup_lock_and_counter(lock, counter, total):
> +global output_lock, test_counter, total_tests
> +output_lock = lock
> +test_counter = counter
> +total_tests = total
> +
> +def update_status(name = None, output = None):
> +global output_lock, test_counter, total_tests
> +with output_lock:
> +if output is not None:
> +print >> sys.stderr
> +print >> sys.stderr, 'Test suite %s failed' % name
> +print >> sys.stderr, 'stdout:\n' + output[0]
> +print >> sys.stderr, 'stderr:\n' + output[1]
> +sys.stderr.write("\r%*d out of %d test suites processed" %
> +(len(str(total_tests)), test_counter.value, total_tests))
> +test_counter.value += 1
> +
>  def parse_test_results(output):
>  passes = 0
>  failures = 0
> @@ -84,7 +106,7 @@
>  pass
>  return passes, failures
>
> -def call_with_timeout(command, timeout):
> +def call_with_timeout(command, timeout, name):
>  """Run command with a timeout if possible."""
>  """-s QUIT will create a coredump if they are enabled on your
> system"""
>  process = None
> @@ -103,6 +125,7 @@
>  output = process.communicate()
>  exit_status = process.returncode
>  passes, failures = parse_test_results(output)
> +update_status(name, output if failures > 0 else None)
>  return exit_status, passes, failures
>
>  def process_dir(root, files, test_root, dotest_argv):
> @@ -132,7 +155,7 @@
>
>  timeout = os.getenv("LLDB_%s_TIMEOUT" % timeout_name) or
> default_timeout
>
> -exit_status, pass_count, fail_count = call_with_timeout(command,
> timeout)
> +exit_status, pass_count, fail_count = call_with_timeout(command,
> timeout, name)
>
>  pass_sub_count = pass_sub_count + pass_count
>  fail_sub_count = fail_sub_count + fail_count
> @@ -169,10 +192,19 @@
>  for root, dirs, files in os.walk(test_subdir, topdown=False):
>  test_work_items.append((root, files, test_directory, dotest_argv))
>
> +global output_lock, test_counter, total_tests
> +output_lock = multiprocessing.Lock()
> +total_tests = len(test_work_items)
> +test_counter = multiprocessing.Value('i', 0)
> +print >> sys.stderr, "Testing: %d tests, %d threads" % (total_tests,
> num_threads)
> +update_status()
> +
>  # Run the items, either in a pool (for multicore speedup) or
>  # calling each individually.
>  if num_threads > 1:
> -pool = multiprocessing.Pool(num_threads)
> +pool = multiprocessing.Pool(num_threads,
> +initializer = setup_lock_and_counter,
> +initargs = (output_lock, test_counter, total_tests))
>  test_results = pool.map(process_dir_worker, test_work_items)
>  else:
>  test_results = []
> @@ -355,6 +387,7 @@
>  test_name = os.path.splitext(xtime)[0]
>  touch(os.path.join(session_dir, "{}-{}".format(result,
> test_name)))
>
> +print
>  print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files,
> len(failed), 100.0*len(failed)/num_test_files)
>  print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails,
> 100.0*all_fails/num_tests)
>  if len(failed) > 0:
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r238587 - Re-add #include "lldb-python.h" back in two places.

2015-05-29 Thread Zachary Turner
Author: zturner
Date: Fri May 29 13:18:26 2015
New Revision: 238587

URL: http://llvm.org/viewvc/llvm-project?rev=238587&view=rev
Log:
Re-add #include "lldb-python.h" back in two places.

Fixing these two instances will require some work, so for now
I'm adding these 2 includes back to get the build working.

Modified:
lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
lldb/trunk/source/Host/posix/HostInfoPosix.cpp

Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=238587&r1=238586&r2=238587&view=diff
==
--- lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm (original)
+++ lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm Fri May 29 13:18:26 2015
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+#include "lldb/lldb-python.h"
+
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/macosx/HostInfoMacOSX.h"
 #include "lldb/Interpreter/Args.h"

Modified: lldb/trunk/source/Host/posix/HostInfoPosix.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostInfoPosix.cpp?rev=238587&r1=238586&r2=238587&view=diff
==
--- lldb/trunk/source/Host/posix/HostInfoPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/HostInfoPosix.cpp Fri May 29 13:18:26 2015
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+#include "lldb/lldb-python.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Host/posix/HostInfoPosix.h"
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r238469 - Including with MSVC is buggy, use a workaround here.

2015-05-28 Thread Zachary Turner
Author: zturner
Date: Thu May 28 14:56:43 2015
New Revision: 238469

URL: http://llvm.org/viewvc/llvm-project?rev=238469&view=rev
Log:
Including  with MSVC is buggy, use a workaround here.

Modified:
lldb/trunk/unittests/Host/SocketTest.cpp

Modified: lldb/trunk/unittests/Host/SocketTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/SocketTest.cpp?rev=238469&r1=238468&r2=238469&view=diff
==
--- lldb/trunk/unittests/Host/SocketTest.cpp (original)
+++ lldb/trunk/unittests/Host/SocketTest.cpp Thu May 28 14:56:43 2015
@@ -7,6 +7,12 @@
 //
 
//===--===//
 
+#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
+// Workaround for MSVC standard library bug, which fails to include  
when
+// exceptions are disabled.
+#include 
+#endif
+
 #include 
 
 #include "gtest/gtest.h"


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r238249 - Have lldb-mi tests import pexpect at a narrower scope.

2015-05-26 Thread Zachary Turner
Author: zturner
Date: Tue May 26 15:26:43 2015
New Revision: 238249

URL: http://llvm.org/viewvc/llvm-project?rev=238249&view=rev
Log:
Have lldb-mi tests import pexpect at a narrower scope.

The tests are xfail'ed on Windows, but would still error out since
they were importing pexpect at global scope.  This way the tests
will correctly report as unsupported.

Modified:
lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py

Modified: lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py?rev=238249&r1=238248&r2=238249&view=diff
==
--- lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py Tue May 26 15:26:43 2015
@@ -3,7 +3,6 @@ Base class for lldb-mi test cases.
 """
 
 from lldbtest import *
-import pexpect
 import unittest2
 
 class MiTestCaseBase(Base):
@@ -32,6 +31,7 @@ class MiTestCaseBase(Base):
 Base.tearDown(self)
 
 def spawnLldbMi(self, args=None):
+import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""))
 self.child.setecho(True)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r238239 - On Windows, delete existing log file before renaming temp file.

2015-05-26 Thread Zachary Turner
Author: zturner
Date: Tue May 26 14:52:24 2015
New Revision: 238239

URL: http://llvm.org/viewvc/llvm-project?rev=238239&view=rev
Log:
On Windows, delete existing log file before renaming temp file.

On non-Windows platforms, os.rename() will silently replace the
destination file if it already exists.  On Windows, it doesn't do
this, and the filesystem has no mechanism to simulate the same type
of atomic rename operation.  So on Windows, delete the file first
before calling os.rename().

Modified:
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=238239&r1=238238&r2=238239&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue May 26 14:52:24 2015
@@ -1567,6 +1567,13 @@ class Base(unittest2.TestCase):
 dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
 for src in log_files_for_this_test:
 dst = src.replace(self.log_basename, dst_log_basename)
+if os.name == "nt":
+# On Windows, renaming a -> b will throw an exception if b 
exists.  On non-Windows platforms
+# it silently replaces the destination.  Ultimately this 
means that atomic renames are not
+# guaranteed to be possible on Windows, but we need this 
to work anyway, so just remove the
+# destination first if it already exists.
+os.remove(dst)
+
 os.rename(src, dst)
 else:
 # success!  (and we don't want log files) delete log files


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r238040 - Disable TestConcurrentEvents.py on Windows.

2015-05-22 Thread Zachary Turner
Author: zturner
Date: Fri May 22 14:33:32 2015
New Revision: 238040

URL: http://llvm.org/viewvc/llvm-project?rev=238040&view=rev
Log:
Disable TestConcurrentEvents.py on Windows.

This test takes over 5 minutes to run just by itself, and everything
fails anyway, so it doesn't make sense to keep it running for now.

Modified:

lldb/trunk/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py

Modified: 
lldb/trunk/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py?rev=238040&r1=238039&r2=238040&view=diff
==
--- 
lldb/trunk/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
 (original)
+++ 
lldb/trunk/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
 Fri May 22 14:33:32 2015
@@ -22,7 +22,7 @@ import lldbutil
 signal_names = dict((getattr(signal, n), n) \
 for n in dir(signal) if n.startswith('SIG') and '_' not in n )
 
-
+@skipIfWindows
 class ConcurrentEventsTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r237946 - Don't import module `lock` at global scope.

2015-05-21 Thread Zachary Turner
Author: zturner
Date: Thu May 21 15:16:02 2015
New Revision: 237946

URL: http://llvm.org/viewvc/llvm-project?rev=237946&view=rev
Log:
Don't import module `lock` at global scope.

`lock` depends on `fcntl`, which doesn't exist on Windows.  Until
someone implements an equivalent locking mechanism on Windows, we
can't have lock imported globally.

Modified:
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=237946&r1=237945&r2=237946&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu May 21 15:16:02 2015
@@ -33,7 +33,6 @@ $
 
 import abc
 import glob
-import lock
 import os, sys, traceback
 import os.path
 import re
@@ -961,6 +960,7 @@ class Base(unittest2.TestCase):
 os.chdir(os.path.join(os.environ["LLDB_TEST"], cls.mydir))
 
 if debug_confirm_directory_exclusivity:
+import lock
 cls.dir_lock = lock.Lock(os.path.join(full_dir, ".dirlock"))
 try:
 cls.dir_lock.try_acquire()


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Refactor many file functions to use FileSpec over strings.

2015-05-18 Thread Zachary Turner
On Mon, May 18, 2015 at 2:45 PM Vince Harron  wrote:

> Only got through ProcessPOSIX, will continue later
>
>
> 
> Comment at: source/API/SBLaunchInfo.cpp:178
> @@ -177,2 +177,3 @@
>  {
> -return m_opaque_sp->GetWorkingDirectory();
> +ConstString working_dir{m_opaque_sp->GetWorkingDirectory().GetPath()};
> +return working_dir.GetCString();
> 
> If ConstString gets destructed after GetWorkingDirectory () returns, will
> the memory pointed to by working_dir.GetCString() be freed?


Yea the whole point of ConstString actually is that it interns the string
so it will be available.  That's the only way to return c strings to
python, for example.  I guess a better name would be InternedString.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r237402 - Don't bother dynamic loading the Windows Slim RW Lock API.

2015-05-14 Thread Zachary Turner
Author: zturner
Date: Thu May 14 17:50:19 2015
New Revision: 237402

URL: http://llvm.org/viewvc/llvm-project?rev=237402&view=rev
Log:
Don't bother dynamic loading the Windows Slim RW Lock API.

This API has been present since XP, and I think it's safe to
drop support for XP (since other things have been introduced long
ago which already don't work on XP anyway).

With this patch, we can statically bind against the exports and
not bother falling back to a CRITICAL_SECTION if we can't load
the API.

Modified:
lldb/trunk/source/Host/windows/ProcessRunLock.cpp

Modified: lldb/trunk/source/Host/windows/ProcessRunLock.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessRunLock.cpp?rev=237402&r1=237401&r2=237402&view=diff
==
--- lldb/trunk/source/Host/windows/ProcessRunLock.cpp (original)
+++ lldb/trunk/source/Host/windows/ProcessRunLock.cpp Thu May 14 17:50:19 2015
@@ -1,241 +1,106 @@
-#ifdef _WIN32
-
 #include "lldb/Host/ProcessRunLock.h"
 #include "lldb/Host/windows/windows.h"
 
-namespace lldb_private {
-
-// Windows has slim read-writer lock support on Vista and higher, so we
-// will attempt to load the APIs.  If they exist, we will use them, and
-// if not, we will fall back on critical sections.  When we drop support
-// for XP, we can stop lazy-loading these APIs and just use them directly.
+namespace
+{
 #if defined(__MINGW32__)
-// Taken from WinNT.h
-typedef struct _RTL_SRWLOCK {
-PVOID Ptr;
-} RTL_SRWLOCK, *PRTL_SRWLOCK;
+// Taken from WinNT.h
+typedef struct _RTL_SRWLOCK {
+PVOID Ptr;
+} RTL_SRWLOCK, *PRTL_SRWLOCK;
 
-// Taken from WinBase.h
-typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK;
+// Taken from WinBase.h
+typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK;
 #endif
+}
 
 
-typedef struct Win32RWLOCK
-{
-long int readlockcount;
-HANDLE writable;
-CRITICAL_SECTION writelock;
-long int writelocked;
-} Win32RWLOCK;
-
-typedef Win32RWLOCK* PWin32RWLOCK;
-
-static VOID (WINAPI *fpInitializeSRWLock)(PSRWLOCK lock) = NULL;
-static VOID (WINAPI *fpAcquireSRWLockExclusive)(PSRWLOCK lock) = NULL;
-static VOID (WINAPI *fpAcquireSRWLockShared)(PSRWLOCK lock) = NULL;
-static VOID (WINAPI *fpReleaseSRWLockExclusive)(PSRWLOCK lock) = NULL;
-static VOID (WINAPI *fpReleaseSRWLockShared)(PSRWLOCK lock) = NULL;
-static BOOL (WINAPI *fpTryAcquireSRWLockExclusive)(PSRWLOCK lock) = NULL;
-static BOOL (WINAPI *fpTryAcquireSRWLockShared)(PSRWLOCK lock) = NULL;
-
-static bool sHasSRW = false;
-
-static bool loadSRW()
-{
-static bool sChecked = false;
-if (!sChecked)
-{
-sChecked = true;
-return false;
-
-HMODULE hLib = ::LoadLibrary(TEXT("Kernel32"));
-if (hLib)
-{
-fpInitializeSRWLock =
-(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"InitializeSRWLock");
-fpAcquireSRWLockExclusive =
-(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"AcquireSRWLockExclusive");
-fpAcquireSRWLockShared =
-(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"AcquireSRWLockShared");
-fpReleaseSRWLockExclusive =
-(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"ReleaseSRWLockExclusive");
-fpReleaseSRWLockShared =
-(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"ReleaseSRWLockShared");
-fpTryAcquireSRWLockExclusive =
-(BOOL (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"TryAcquireSRWLockExclusive");
-fpTryAcquireSRWLockShared =
-(BOOL (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
-"TryAcquireSRWLockShared");
-
-::FreeLibrary(hLib);
-
-if (fpInitializeSRWLock != NULL) {
-sHasSRW = true;
-}
-}
-}
-return sHasSRW;
-}
+static PSRWLOCK GetLock(lldb::rwlock_t lock)
+{
+return static_cast(lock);
+}
 
-ProcessRunLock::ProcessRunLock ()
-: m_running(false)
-{
-if (loadSRW())
-{
-m_rwlock = calloc(1, sizeof(SRWLOCK));
-fpInitializeSRWLock(static_cast(m_rwlock));
-}
-else
-{
-m_rwlock = calloc(1, sizeof(Win32RWLOCK));
-static_cast(m_rwlock)->readlockcount = 0;
-static_cast(m_rwlock)->writable = CreateEvent(NULL, 
true, true, NULL);
-
InitializeCriticalSection(&static_cast(m_rwlock)->writelock);
-}
-}
+static bool ReadLock(lldb::rwlock_t rwlock)
+{
+::AcquireSRWLockShared(GetLock(rwlock));
+return true

[Lldb-commits] [lldb] r237292 - Don't import lock on Windows.

2015-05-13 Thread Zachary Turner
Author: zturner
Date: Wed May 13 15:21:33 2015
New Revision: 237292

URL: http://llvm.org/viewvc/llvm-project?rev=237292&view=rev
Log:
Don't import lock on Windows.

lock imports fcntl, which doesn't exist on Windows.  If we need
to use this class on Windows, we will need to implement something
based on the CreateMutex API.

Modified:
lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=237292&r1=237291&r2=237292&view=diff
==
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Wed May 13 15:21:33 2015
@@ -23,7 +23,6 @@ for available options.
 import commands
 import os
 import errno
-import lock
 import platform
 import progress
 import signal
@@ -439,6 +438,7 @@ def setupCrashInfoHook():
 global setCrashInfoHook
 setCrashInfoHook = setCrashInfoHook_NonMac # safe default
 if platform.system() == "Darwin":
+import lock
 test_dir = os.environ['LLDB_TEST']
 if not test_dir or not os.path.exists(test_dir):
 return


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r237291 - Fix broken test, this wasn't supposed to get committed.

2015-05-13 Thread Zachary Turner
Author: zturner
Date: Wed May 13 15:21:22 2015
New Revision: 237291

URL: http://llvm.org/viewvc/llvm-project?rev=237291&view=rev
Log:
Fix broken test, this wasn't supposed to get committed.

Modified:
lldb/trunk/test/functionalities/paths/TestPaths.py

Modified: lldb/trunk/test/functionalities/paths/TestPaths.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/paths/TestPaths.py?rev=237291&r1=237290&r2=237291&view=diff
==
--- lldb/trunk/test/functionalities/paths/TestPaths.py (original)
+++ lldb/trunk/test/functionalities/paths/TestPaths.py Wed May 13 15:21:22 2015
@@ -28,12 +28,6 @@ class TestPaths(TestBase):
 # No directory path types should have the filename set
 self.assertTrue (f.GetFilename() == None);
 
-def test_filespec_resolve_doesnt_prepend_cwd_if_file_doesnt_exist (self):
-file_only = 
lldb.SBFileSpec("VeryUnlikelToExistInTheCurrentWorkingDirectory", True)
-# SBFileSpec(path, True) should not prepend the 
current-working-directory to the
-# file path if it doesn't exist in the current directory.
-self.assertTrue (file_only.GetDirectory() == None)
-
 def test_directory_doesnt_end_with_slash(self):
 current_directory_spec = lldb.SBFileSpec(os.path.curdir)
 current_directory_string = current_directory_spec.GetDirectory()


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r237282 - Fix an issue with finding python on Windows.

2015-05-13 Thread Zachary Turner
Author: zturner
Date: Wed May 13 14:44:57 2015
New Revision: 237282

URL: http://llvm.org/viewvc/llvm-project?rev=237282&view=rev
Log:
Fix an issue with finding python on Windows.

Someone must have changed the behavior of FileSpec slightly
relating to whether or not there is a trailing backslash when calling
GetPath() and GetDirectory().  This caused ScriptInterpreterPython
to find the wrong values when initializing sys.path, and as a result
we couldn't find the lldb module.

This patch fixes the issue, and also adds a test to make sure that
GetDirectory() does not return a string containing a trailing slash.

Modified:
lldb/trunk/source/Host/windows/HostInfoWindows.cpp
lldb/trunk/test/functionalities/paths/TestPaths.py

Modified: lldb/trunk/source/Host/windows/HostInfoWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=237282&r1=237281&r2=237282&view=diff
==
--- lldb/trunk/source/Host/windows/HostInfoWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp Wed May 13 14:44:57 2015
@@ -109,8 +109,7 @@ HostInfoWindows::ComputePythonDirectory(
 FileSpec lldb_file_spec;
 if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
 return false;
-llvm::SmallString<64> path;
-lldb_file_spec.GetPath(path);
+llvm::SmallString<64> path(lldb_file_spec.GetDirectory().AsCString());
 llvm::sys::path::remove_filename(path);
 llvm::sys::path::append(path, "lib", "site-packages");
 std::replace(path.begin(), path.end(), '\\', '/');

Modified: lldb/trunk/test/functionalities/paths/TestPaths.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/paths/TestPaths.py?rev=237282&r1=237281&r2=237282&view=diff
==
--- lldb/trunk/test/functionalities/paths/TestPaths.py (original)
+++ lldb/trunk/test/functionalities/paths/TestPaths.py Wed May 13 14:44:57 2015
@@ -34,6 +34,12 @@ class TestPaths(TestBase):
 # file path if it doesn't exist in the current directory.
 self.assertTrue (file_only.GetDirectory() == None)
 
+def test_directory_doesnt_end_with_slash(self):
+current_directory_spec = lldb.SBFileSpec(os.path.curdir)
+current_directory_string = current_directory_spec.GetDirectory()
+self.assertNotEqual(current_directory_string[-1:], '/')
+pass
+
 @skipUnlessPlatform(["windows"])
 def test_windows_double_slash (self):
 '''Test to check the path with double slash is handled correctly '''


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r236892 - Enable thread-safe logging.

2015-05-11 Thread Zachary Turner
If the reason is to avoid those race conditions, perhaps the default value
should be threadsafe, and the option should disable thread safety.
On Mon, May 11, 2015 at 8:40 AM Pavel Labath  wrote:

> I think the reason is that when you are debugging a race condition,
> the added synchronization resulting from logging can make the problem
> go away as soon as you start investigating it, which can be quite
> annoying.
>
> BTW, there is a way to do atomic writes (at least on posix systems, I
> don't know if there is a windows equivalent) without locking: write
> the string to a temporary buffer in memory (as you do now), and then
> write it to a file which was opened with O_APPEND with a single system
> call. Your implementation probably already does this, so all you need
> to do is make sure O_APPEND is set.
>
> cheers,
> pl
>
>
>
> On 11 May 2015 at 16:23, Zachary Turner  wrote:
> > +greg. I'm not sure either tbh, if there's no contention the cost of
> > acquiring the mutex should be free, and if there is contention then the
> lock
> > is required.
> >
> > On Mon, May 11, 2015 at 7:29 AM Ed Maste  wrote:
> >>
> >> On 8 May 2015 at 14:50, Zachary Turner  wrote:
> >> > Author: zturner
> >> > Date: Fri May  8 13:50:54 2015
> >> > New Revision: 236892
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=236892&view=rev
> >> > Log:
> >> > Enable thread-safe logging.
> >>
> >> Thanks for fixing this up Zach.
> >>
> >> This raises a question though, going back to the original introduction
> >> of logging support -- why is this an option at all, never mind a user
> >> facing option? It's particularly odd that we default to thread-safe,
> >> unless any other options are specified. It seems to me we should just
> >> remove the thread-unsafe path.
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> >
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Skip sysroot creation by module cache if symbolic links are not allowed for active user.

2015-05-07 Thread Zachary Turner
Hmm, yea that's not a bad idea. Let me look into the privilege thing a
little tomorrow. In the meantime, do we properly handle the error case
anyway (at least it should print a log and not have unexpected behavior).
Creating the symlink could fail on other platforms too, not just windows
On Thu, May 7, 2015 at 5:28 PM Oleksiy Vyalov  wrote:

> In http://reviews.llvm.org/D9587#168485, @zturner wrote:
>
> > Even with this check, creating the symbolic link might still fail for
> other reasons related to the filesystem and not related to security.  Would
> it be better to just try to create it no matter what and log the error if
> it fails?
>
>
> I believe calling EnableCreateSymLinkPrivilege might be beneficial anyway
> since as I can tell from running "whoami /priv" that
> SE_CREATE_SYMBOLIC_LINK_NAME is disabled by default . I'm somewhat
> concerned that we may call FileSystem::Symlink when we 100% confident that
> it will fail. As an alternative, we may just call FileSystem::Symlink
> anyway but always ignoring its result...
>
> Please let me know your opinion.
>
>
> http://reviews.llvm.org/D9587
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r236776 - Add logging to ProcessWindows.

2015-05-07 Thread Zachary Turner
Author: zturner
Date: Thu May  7 16:39:33 2015
New Revision: 236776

URL: http://llvm.org/viewvc/llvm-project?rev=236776&view=rev
Log:
Add logging to ProcessWindows.

Modified:
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp
lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/ProcessWindowsLog.cpp
lldb/trunk/source/Plugins/Process/Windows/ProcessWindowsLog.h
lldb/trunk/source/Plugins/Process/Windows/RegisterContextWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=236776&r1=236775&r2=236776&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Thu May  7 16:39:33 2015
@@ -128,6 +128,9 @@ public:
 Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
 virtual void
+VAError(const char *format, va_list args) __attribute__((format(printf, 2, 
3)));
+
+virtual void
 FatalError(int err, const char *fmt, ...) __attribute__((format(printf, 3, 
4)));
 
 virtual void

Modified: lldb/trunk/source/Core/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=236776&r1=236775&r2=236776&view=diff
==
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Thu May  7 16:39:33 2015
@@ -208,11 +208,18 @@ Log::LogIf(uint32_t bits, const char *fo
 void
 Log::Error(const char *format, ...)
 {
-char *arg_msg = nullptr;
 va_list args;
 va_start(args, format);
-::vasprintf(&arg_msg, format, args);
+VAError(format, args);
 va_end(args);
+}
+
+
+void
+Log::VAError(const char *format, va_list args)
+{
+char *arg_msg = nullptr;
+::vasprintf(&arg_msg, format, args);
 
 if (arg_msg == nullptr)
 return;
@@ -221,6 +228,7 @@ Log::Error(const char *format, ...)
 free(arg_msg);
 }
 
+
 //--
 // Printing of errors that ARE fatal. Exit with ERR exit code
 // immediately.

Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=236776&r1=236775&r2=236776&view=diff
==
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Thu May  7 
16:39:33 2015
@@ -171,6 +171,10 @@ SystemInitializerCommon::Terminate()
 PlatformDarwinKernel::Terminate();
 #endif
 
+#if defined(__WIN32__)
+ProcessWindowsLog::Terminate();
+#endif
+
 #ifndef LLDB_DISABLE_PYTHON
 OperatingSystemPython::Terminate();
 #endif

Modified: lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp?rev=236776&r1=236775&r2=236776&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp Thu May  7 
16:39:33 2015
@@ -23,6 +23,8 @@
 #include "lldb/Host/windows/ProcessLauncherWindows.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 
+#include "Plugins/Process/Windows/ProcessWindowsLog.h"
+
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -56,10 +58,19 @@ DebuggerThread::~DebuggerThread()
 Error
 DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info)
 {
-Error error;
+WINLOG_IFALL(WINDOWS_LOG_PROCESS,
+"DebuggerThread::DebugLaunch launching '%s'", 
launch_info.GetExecutableFile().GetPath().c_str());
 
+Error error;
 DebugLaunchContext *context = new DebugLaunchContext(this, launch_info);
-HostThread 
slave_thread(ThreadLauncher::LaunchThread("lldb.plugin.process-windows.slave[?]",
 DebuggerThreadRoutine, context, &error));
+HostThread 
slave_thread(ThreadLauncher::LaunchThread("lldb.plugin.process-windows.slave[?]",
+DebuggerThreadRoutine, context, &error));
+
+if (!error.Success())
+{
+WINERR_IFALL(WINDOWS_LOG_PROCESS,
+"DebugLaunch couldn't launch debugger thread.  %s", 
error.AsCString());
+}
 
 return error;
 }
@@ -80,6 +91,10 @@ DebuggerThread::DebuggerThreadRoutine(co
 // thread routine has exited.
 std::shared_ptr this_ref(shared_from_this());
 
+WINLOG_IFALL(WINDOWS_LOG_PROCESS,
+"Debug

Re: [Lldb-commits] [lldb] r236174 - Introduce a NullLog class, which ignores all messages.

2015-04-30 Thread Zachary Turner
Consider the case where you want to have one function with 3 log statements:

1) The first log statement should happen if both FLAG1 and FLAG2 are set.
2) The second log statement should happen if either FLAG1 or FLAG2 are set.
3) The third log statement should happen in the same as case 1, but only if
verbose is enabled.

Here's how you express this currently (there are alternative approaches:

Log *log1 = GetLogIfAllCategoriesSet(FLAG1 | FLAG2);
if (log1)
log1->Printf("Log statement %d", 1);

Log *log2 = GetLogIfAnyCategoriesSet(FLAG1 | FLAG2);
if (log2)
log2->Printf("Log statement %d", 2);

if (log1 && log1->IsVerbose())
   log1->Printf("Log statement %d", 3);

That's 8 lines of code to print 3 log statements.  Compare to:

LOGF_IFANY(FLAG1|FLAG2, "Log statement %d", 1);   // The F in LOGF means
"with flags" (name not final)
LOGF_IFALL(FLAG1|FLAG2, "Log statement %d", 2);
VLOGF_IFANY(FLAG1|FLAG2, "Log statement %d", 3);   // The V means verbose

This approach has significantly less visual noise, and you always have one
line for each log statement.  So I think it's much more readable.  I agree
in principle that macros are undesirable when they prevent the ability to
reason about the code hiding behind the macro, but of course it's a
tradeoff.  And I think a good one in this case.  The macro is small, and
the benefit is noticeable.  I know this all seems hypothetical, but the
reason I embarked on this is because the logging code I'm adding to
ProcessWindows was seeing the same kind of improvement in readability as
the above example.  So it's solving a real problem.

Of course it's computing the flags each time.  It's a pretty trivial cost
(a few assembly instructions) and I think the improvement in readability is
enough to justify this, but if not, we could have another macro which takes
a pointer to a previously computed Log.  For example:

LOG_IF(log, "Log statement %d", 1);// Note the lack of F in the macro
name.  Differentiates this from the Flags method.


Of course, I agree with you that we shouldn't go and make a blanket change
across the code change because of the amount of churn it would create.  On
the other hand, I don't think we should be so wary of making gradual
improvements to the codebase just because we can't make the change all at
once.  Adding the 'override' keyword was a good example of this.  It's
already helped me to catch a few errors in my own code, and I've even
committed a few patches to code that didn't use override which were broken
as a result, and I went and added the 'override' keyword after the fact.
But if we just said "we're not going to be using the override keyword" then
my the first case might not have been found until much later, and the
second case (which I did find even though not using the override keyword)
is very likely to have wasted someone else's time in the future.

On Thu, Apr 30, 2015 at 12:03 PM  wrote:

> Sorry, mail from lldb-commits has been very flakey for me for some reason,
> I didn't see this part of the thread till just now...
>
> I still think this is a solution in search of a problem, and since we
> certainly shouldn't change all the log statements in lldb to use some macro
> - that is code churn for no very good reason - it will leave us with an
> inconsistent use of logging through-out lldb, which is unfortunate.  I
> don't in general like macros that wrap syntax since then you can't reason
> about the code without knowing what the macro transformation is...
>
> But it is better than the NullLog solution.
>
> Jim
>
>
> > On Apr 30, 2015, at 11:39 AM, Zachary Turner  wrote:
> >
> > Also judging from Pavel's email it sounds like I'm not the only one who
> wants to see more concise logging statements.  So in that regard, locking
> this away in ProcessWindows doesn't seem like the ideal solution either,
> because it will just lead to other people who own different plugins or
> different areas re-inventing their own method to shorten the log
> statements.  So I think it would be great if we could come to some sort of
> compromise.  I feel like the macro solution is the best compromise I've
> seen as of yet.  While there would still be 2 ways to log (the current
> approach of checking the pointer very time, vs using the macro), they would
> have basically identical performance characteristics, and we could always
> begin migrating existing code toward the macro method as we touch
> surrounding code.
> >
> > On Thu, Apr 30, 2015 at 10:55 AM Zachary Turner 
> wrote:
> > Even ignoring the 3 extra lines issue (which I disagree is a problem of
> my own making, I think you'

Re: [Lldb-commits] [lldb] r236174 - Introduce a NullLog class, which ignores all messages.

2015-04-29 Thread Zachary Turner
If you don't want it in Core, I can move it to ProcessWindows.  But locally
I've added logging where you can't even look at the function and tell what
it does anymore because of all the logging.  I really don't want so much
boilerplate code taking up screen space in important methods, preventing
you from understanding what the methods do because each log statement is 4
lines instead of 1.

I'm open to suggestions, but ultimately in the code I'm writing in the
windows plugin, I don't want to check if statements every time I write a
log statement, so I need some kind of solution that makes that not
necessary.

On Wed, Apr 29, 2015 at 6:29 PM  wrote:

> Yes, but that call is only used a handful of times, and only from code
> written back before this was checked into llvm.org, so that's more an
> argument for removing those calls than making that pattern more common.
>
> I really don't want people to have to reason about the expense of
> logging.  I want there to be full rich log output that costs nothing when
> not turned on.  It's so easy to add something that looks harmless to a log,
> but that ends up pulling in a whole bunch of debug information that we were
> trying hard not to touch.  You probably won't notice that till you run on
> something really big, but then we will get slowdowns for no benefit.
>
> Jim
>
>
> > On Apr 29, 2015, at 6:18 PM, Zachary Turner  wrote:
> >
> > It's also worth pointing out that the method I've implemented here is a
> more general case of something already in LLDB.
> lldb_private::LogIfXXXCategoriesSet(). These 2 methods are equivalent to
> getting the log, checking for null, and logging if non null, except they
> always evaluate the arguments, as does my method. But the method I've
> implemented here allows access to every method of Log. Like Warn, Error,
> etc, so is even more flexible
> > On Wed, Apr 29, 2015 at 6:14 PM Enrico Granata 
> wrote:
> > One possible avenue to fix the performance issue would be to have your
> log calls take a lambda expression that returns the string to be printed,
> e.g.
> >
> > #include 
> > #include 
> > #include 
> > #include 
> >
> > typedef std::function LogFunction;
> >
> > void log(bool dolog, LogFunction f) {
> > if (dolog)
> > std::cout << f() << std::endl;
> > }
> >
> > int main() {
> > log(true, [] () -> std::string { return "hello world"; } );
> > log(false, [] {sleep(10); return "hi"; });
> > return 0;
> > }
> >
> > I don’t think the code gets much better doing this compared to the
> previous if (log) model we were using - but that’s at least arguable
> >
> >
> >> More importantly, I don't think this is a good change.  I want to be
> able to freely put complex log statements where ever I need without having
> to worry about the performance implications.  That was always possible,
> because the cost of not logging was checking if log was NULL.
> >>
> >> With this change I'm always going to get back a log, so I'm always
> going to marshall the arguments, and do whatever work was going to go into
> printing, etc and then call a virtual function that does nothing with the
> results.
> >>
> >> That seems undesirable to me.  You could work around this by having any
> code that does logging in a loop or that has complex arguments check if the
> log is a null log and not do the work if it is, but then we're right back
> where we started except now we only do the check sometimes, making things
> even more confusing.
> >>
> >> Jim
> >>
> >> On Apr 29, 2015, at 4:30 PM, Sean Callanan  wrote:
> >>
> >> Zachary,
> >>
> >> Log.cpp doesn’t build anymore with this change.  In particular, you have
> >> –
> >> +virtual void
> >> +VAPrintf(const char *format, va_list args);
> >> –
> >> but at several places VAPrintf is called with no va_list, e.g.,
> >> –
> >> void
> >> -Log::Error (const char *format, ...)
> >> +Log::Error(const char *format, ...)
> >> {
> >> -char *arg_msg = NULL;
> >> +char *arg_msg = nullptr;
> >>   va_list args;
> >> -va_start (args, format);
> >> -::vasprintf (&arg_msg, format, args);
> >> -va_end (args);
> >> +va_start(args, format);
> >> +::vasprintf(&arg_msg, format, args);
> >> +va_end(args);
> >>
> >> -if (arg_msg != NULL)
> >> -  

Re: [Lldb-commits] [lldb] r236174 - Introduce a NullLog class, which ignores all messages.

2015-04-29 Thread Zachary Turner
I actually considered this, and I think it won't be an issue in practice.

There's no code that actually uses this or returns a Log& yet.  I am in the
process of adding logging to ProcessWindows, and that *does* use this, but
it's an implementation detail of ProcessWindows.  None of the existing
global methods like lldb_private::GetLogIfAllCategoriesSet() have been
changed, nor has any of the logging code in other plugins or any of the
call sites.  If I were to make a change like this globally across the
board, it would create prohibitive code churn for not much benefit.  And as
you point out, in some cases the code would be worse.

So you can think of this as an opt-in thing.  It seems useful in general
when computing the arguments to the logging statements is trivial, so in
those cases we can just have a different Get method.  Right now we have
GetLogIfAllCategoriesSet() and GetLogIfAnyCategoriesSet.  We could just
have GetLogIfAllCategoriesSet2() and GetLogIfAnyCategoriesSet2()  (names
not final, obviously) that return references.

Anyone who wants to continue using the pointer versions is free to do so,
so I think that alleviates any concerns surrounding the performance
implications.

On Wed, Apr 29, 2015 at 5:58 PM  wrote:

> More importantly, I don't think this is a good change.  I want to be able
> to freely put complex log statements where ever I need without having to
> worry about the performance implications.  That was always possible,
> because the cost of not logging was checking if log was NULL.
>
> With this change I'm always going to get back a log, so I'm always going
> to marshall the arguments, and do whatever work was going to go into
> printing, etc and then call a virtual function that does nothing with the
> results.
>
> That seems undesirable to me.  You could work around this by having any
> code that does logging in a loop or that has complex arguments check if the
> log is a null log and not do the work if it is, but then we're right back
> where we started except now we only do the check sometimes, making things
> even more confusing.
>
> Jim
>
> > On Apr 29, 2015, at 4:30 PM, Sean Callanan  wrote:
> >
> > Zachary,
> >
> > Log.cpp doesn’t build anymore with this change.  In particular, you have
> > –
> > +virtual void
> > +VAPrintf(const char *format, va_list args);
> > –
> > but at several places VAPrintf is called with no va_list, e.g.,
> > –
> > void
> > -Log::Error (const char *format, ...)
> > +Log::Error(const char *format, ...)
> > {
> > -char *arg_msg = NULL;
> > +char *arg_msg = nullptr;
> >va_list args;
> > -va_start (args, format);
> > -::vasprintf (&arg_msg, format, args);
> > -va_end (args);
> > +va_start(args, format);
> > +::vasprintf(&arg_msg, format, args);
> > +va_end(args);
> >
> > -if (arg_msg != NULL)
> > -{
> > -PrintfWithFlags (LLDB_LOG_FLAG_ERROR, "error: %s", arg_msg);
> > -free (arg_msg);
> > -}
> > +if (arg_msg == nullptr)
> > +return;
> > +
> > +VAPrintf("error: %s", arg_msg);
> > +free(arg_msg);
> > }
> > –
> > Do you have more commits coming that are going to resolve this problem?
> >
> > Sean
> >
> >
> >> On Apr 29, 2015, at 3:55 PM, Zachary Turner  wrote:
> >>
> >> Author: zturner
> >> Date: Wed Apr 29 17:55:28 2015
> >> New Revision: 236174
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=236174&view=rev
> >> Log:
> >> Introduce a NullLog class, which ignores all messages.
> >>
> >> The purpose of this class is so that GetLogIfAllCategoriesSet
> >> can always return an instance of some class, whether it be a real
> >> logging class or a "null" class, which ignores messages.  Code
> >> that is littered with if statements that only log if the pointer
> >> is non-null can get very unwieldy very quickly, so this should
> >> help code readability in such circumstances.
> >>
> >> Since I'm in this code anyway, I'm also deleting the
> >> PrintfWithFlags methods, as well as all the flags, since they
> >> appear to be dead code that have been superceded by newer
> >> mechanisms and all the flags are simply ignored.
> >>
> >> Added:
> >>   lldb/trunk/include/lldb/Core/NullLog.h
> >>   lldb/trunk/source/Core/NullLog.cpp
> >> Modified:
> >>   lldb/trunk/include/lldb/Core/Log.h
> 

Re: [Lldb-commits] [lldb] r236174 - Introduce a NullLog class, which ignores all messages.

2015-04-29 Thread Zachary Turner
Thanks for the heads up.  I got a notification from the bots as well, and I
should already have a fix up.  Apparently va_list is *actually* a const
char* on Windows, so the compiler didn't find that error for me.

On Wed, Apr 29, 2015 at 4:30 PM Sean Callanan  wrote:

> Zachary,
>
> Log.cpp doesn’t build anymore with this change.  In particular, you have
> –
> +virtual void
> +VAPrintf(const char *format, va_list args);
> –
> but at several places VAPrintf is called with no va_list, e.g.,
> –
> void
> -Log::Error (const char *format, ...)
> +Log::Error(const char *format, ...)
> {
> -char *arg_msg = NULL;
> +char *arg_msg = nullptr;
> va_list args;
> -va_start (args, format);
> -::vasprintf (&arg_msg, format, args);
> -va_end (args);
> +va_start(args, format);
> +::vasprintf(&arg_msg, format, args);
> +va_end(args);
>
> -if (arg_msg != NULL)
> -{
> -PrintfWithFlags (LLDB_LOG_FLAG_ERROR, "error: %s", arg_msg);
> -free (arg_msg);
> -}
> +if (arg_msg == nullptr)
> +return;
> +
> +VAPrintf("error: %s", arg_msg);
> +free(arg_msg);
> }
> –
> Do you have more commits coming that are going to resolve this problem?
>
> Sean
>
>
> > On Apr 29, 2015, at 3:55 PM, Zachary Turner  wrote:
> >
> > Author: zturner
> > Date: Wed Apr 29 17:55:28 2015
> > New Revision: 236174
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=236174&view=rev
> > Log:
> > Introduce a NullLog class, which ignores all messages.
> >
> > The purpose of this class is so that GetLogIfAllCategoriesSet
> > can always return an instance of some class, whether it be a real
> > logging class or a "null" class, which ignores messages.  Code
> > that is littered with if statements that only log if the pointer
> > is non-null can get very unwieldy very quickly, so this should
> > help code readability in such circumstances.
> >
> > Since I'm in this code anyway, I'm also deleting the
> > PrintfWithFlags methods, as well as all the flags, since they
> > appear to be dead code that have been superceded by newer
> > mechanisms and all the flags are simply ignored.
> >
> > Added:
> >lldb/trunk/include/lldb/Core/NullLog.h
> >lldb/trunk/source/Core/NullLog.cpp
> > Modified:
> >lldb/trunk/include/lldb/Core/Log.h
> >lldb/trunk/source/Core/CMakeLists.txt
> >lldb/trunk/source/Core/Log.cpp
> >
> > Modified: lldb/trunk/include/lldb/Core/Log.h
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=236174&r1=236173&r2=236174&view=diff
> >
> ==
> > --- lldb/trunk/include/lldb/Core/Log.h (original)
> > +++ lldb/trunk/include/lldb/Core/Log.h Wed Apr 29 17:55:28 2015
> > @@ -26,17 +26,6 @@
> > #include "lldb/Core/PluginInterface.h"
> >
> > //--
> > -// Logging types
> > -//--
> > -#define LLDB_LOG_FLAG_STDOUT(1u << 0)
> > -#define LLDB_LOG_FLAG_STDERR(1u << 1)
> > -#define LLDB_LOG_FLAG_FATAL (1u << 2)
> > -#define LLDB_LOG_FLAG_ERROR (1u << 3)
> > -#define LLDB_LOG_FLAG_WARNING   (1u << 4)
> > -#define LLDB_LOG_FLAG_DEBUG (1u << 5)
> > -#define LLDB_LOG_FLAG_VERBOSE   (1u << 6)
> > -
> > -//--
> > // Logging Options
> > //--
> > #define LLDB_LOG_OPTION_THREADSAFE  (1u << 0)
> > @@ -61,12 +50,10 @@ public:
> > //--
> > // Callback definitions for abstracted plug-in log access.
> > //--
> > -typedef void (*DisableCallback) (const char **categories, Stream
> *feedback_strm);
> > -typedef Log * (*EnableCallback) (lldb::StreamSP &log_stream_sp,
> > - uint32_t log_options,
> > - const char **categories,
> > - Stream *feedback_strm);
> > -typedef void (*ListCategoriesCallback) (Stream *strm);
> > +  typedef void (*DisableCallback)(const char **categories, Stream
> *feedb

[Lldb-commits] [lldb] r236174 - Introduce a NullLog class, which ignores all messages.

2015-04-29 Thread Zachary Turner
Author: zturner
Date: Wed Apr 29 17:55:28 2015
New Revision: 236174

URL: http://llvm.org/viewvc/llvm-project?rev=236174&view=rev
Log:
Introduce a NullLog class, which ignores all messages.

The purpose of this class is so that GetLogIfAllCategoriesSet
can always return an instance of some class, whether it be a real
logging class or a "null" class, which ignores messages.  Code
that is littered with if statements that only log if the pointer
is non-null can get very unwieldy very quickly, so this should
help code readability in such circumstances.

Since I'm in this code anyway, I'm also deleting the
PrintfWithFlags methods, as well as all the flags, since they
appear to be dead code that have been superceded by newer
mechanisms and all the flags are simply ignored.

Added:
lldb/trunk/include/lldb/Core/NullLog.h
lldb/trunk/source/Core/NullLog.cpp
Modified:
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Core/Log.cpp

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=236174&r1=236173&r2=236174&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Wed Apr 29 17:55:28 2015
@@ -26,17 +26,6 @@
 #include "lldb/Core/PluginInterface.h"
 
 //--
-// Logging types
-//--
-#define LLDB_LOG_FLAG_STDOUT(1u << 0)
-#define LLDB_LOG_FLAG_STDERR(1u << 1)
-#define LLDB_LOG_FLAG_FATAL (1u << 2)
-#define LLDB_LOG_FLAG_ERROR (1u << 3)
-#define LLDB_LOG_FLAG_WARNING   (1u << 4)
-#define LLDB_LOG_FLAG_DEBUG (1u << 5)
-#define LLDB_LOG_FLAG_VERBOSE   (1u << 6)
-
-//--
 // Logging Options
 //--
 #define LLDB_LOG_OPTION_THREADSAFE  (1u << 0)
@@ -61,12 +50,10 @@ public:
 //--
 // Callback definitions for abstracted plug-in log access.
 //--
-typedef void (*DisableCallback) (const char **categories, Stream 
*feedback_strm);
-typedef Log * (*EnableCallback) (lldb::StreamSP &log_stream_sp,
- uint32_t log_options,
- const char **categories,
- Stream *feedback_strm);
-typedef void (*ListCategoriesCallback) (Stream *strm);
+  typedef void (*DisableCallback)(const char **categories, Stream 
*feedback_strm);
+  typedef Log *(*EnableCallback)(lldb::StreamSP &log_stream_sp, uint32_t 
log_options, const char **categories,
+ Stream *feedback_strm);
+  typedef void (*ListCategoriesCallback)(Stream *strm);
 
 struct Callbacks
 {
@@ -79,86 +66,78 @@ public:
 // Static accessors for logging channels
 //--
 static void
-RegisterLogChannel (const ConstString &channel,
-const Log::Callbacks &log_callbacks);
+RegisterLogChannel(const ConstString &channel, const Log::Callbacks 
&log_callbacks);
 
 static bool
-UnregisterLogChannel (const ConstString &channel);
+UnregisterLogChannel(const ConstString &channel);
 
 static bool
-GetLogChannelCallbacks (const ConstString &channel,
-Log::Callbacks &log_callbacks);
-
+GetLogChannelCallbacks(const ConstString &channel, Log::Callbacks 
&log_callbacks);
 
 static void
-EnableAllLogChannels (lldb::StreamSP &log_stream_sp,
-  uint32_t log_options,
-  const char **categories,
-  Stream *feedback_strm);
+EnableAllLogChannels(lldb::StreamSP &log_stream_sp, uint32_t log_options, 
const char **categories,
+ Stream *feedback_strm);
 
 static void
-DisableAllLogChannels (Stream *feedback_strm);
+DisableAllLogChannels(Stream *feedback_strm);
 
 static void
-ListAllLogChannels (Stream *strm);
+ListAllLogChannels(Stream *strm);
 
 static void
-Initialize ();
+Initialize();
 
 static void
-Terminate ();
-
+Terminate();
+
 //--
 // Auto completion
 //--
 static void
-AutoCompleteChannelName (const char *channel_name, 
- StringList &matches);
+AutoCompleteChannelName(const char *channel_name, StringList &matches);
 
 //-

[Lldb-commits] [lldb] r235559 - Use the debugginess of the python interpreter when symlinking _lldb.pyd.

2015-04-22 Thread Zachary Turner
Author: zturner
Date: Wed Apr 22 17:53:18 2015
New Revision: 235559

URL: http://llvm.org/viewvc/llvm-project?rev=235559&view=rev
Log:
Use the debugginess of the python interpreter when symlinking _lldb.pyd.

Previously we would pass an argument to finishSwigWrapperClasses.py which
specified whether this was a debug or a release build.  But sometimes
CMAKE_BUILD_TYPE would not be set to anything, causing this argument
to be empty when passed in.  The only purpose of this argument was to
determine whether or not to append _d to the extension module when
creating the symlink.  This is only necessary when doing a debug
build of LLDB on Windows, which implies a debug interpreter, so we
replace this with a check to see if the running interpreter is a debug
one, and append _d if so.

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
lldb/trunk/scripts/finishSwigWrapperClasses.py

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=235559&r1=235558&r2=235559&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed Apr 22 17:53:18 2015
@@ -17,7 +17,7 @@ add_subdirectory(lit)
 if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT 
LLDB_DISABLE_PYTHON )
# Add a Post-Build Event to copy over Python files and create the 
symlink to liblldb.so for the Python API(hardlink on Windows)
 add_custom_target( finish_swig ALL
-COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py 
--buildConfig=${CMAKE_BUILD_TYPE} "--srcRoot=${LLDB_SOURCE_DIR}" 
"--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" 
"--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" 
"--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" 
-m
+COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py 
"--srcRoot=${LLDB_SOURCE_DIR}" 
"--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" 
"--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" 
"--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" 
-m
 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
 COMMENT "Python script sym-linking LLDB Python API")
 add_dependencies(finish_swig liblldb argdumper)

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=235559&r1=235558&r2=235559&view=diff
==
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Wed Apr 22 17:53:18 2015
@@ -73,6 +73,9 @@ strErrMsgMkLinkExecute = "Command mklink
 strErrMsgMakeSymlink = "creating symbolic link";
 strErrMsgUnexpected = "Unexpected error: %s";
 
+def is_debug_interpreter():
+return hasattr(sys, 'gettotalrefcount')
+
 #++---
 # Details:  Copy files needed by lldb/macosx/heap.py to build libheap.dylib.
 # Args: vDictArgs   - (R) Program input parameters.
@@ -348,7 +351,7 @@ def make_symlink_liblldb( vDictArgs, vst
 # When importing an extension module using a debug version of python, 
you
 # write, for example, "import foo", but the interpreter searches for
 # "foo_d.pyd"
-if vDictArgs["--buildConfig"].lower() == "debug":
+if is_debug_interpreter():
 strTarget += "_d";
 strTarget += ".pyd";
 else:
@@ -640,7 +643,6 @@ def get_framework_python_dir( vDictArgs
 -m (optional)   Specify called from Makefile system. If given 
locate
 the LLDBWrapPython.cpp in --srcRoot/source folder
 else in the --targetDir folder.
---buildConfig   The LLDB build configuration (e.g. debug/release).
 --srcRoot   The root of the lldb source tree.
 --targetDir Where the lldb framework/shared library gets put.
 --cfgBlddir Where the buildSwigPythonLLDB.py program will

Modified: lldb/trunk/scripts/finishSwigWrapperClasses.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finishSwigWrapperClasses.py?rev=235559&r1=235558&r2=235559&view=diff
==
--- lldb/trunk/scripts/finishSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/finishSwigWrapperClasses.py Wed Apr 22 17:53:18 2015
@@ -158,14 +158,13 @@ def validate_arguments( vArgv ):
 nResult = 0;
 strListArgs = "hdm"; # Format "hiox:" = -h -i -o -x 
 listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=", 
"cmakeBuildConfiguration=",
-"argsFile", "buildConfig="];
+   

Re: [Lldb-commits] [lldb] r235158 - Add a "force_kill" arg to Process::Destroy(). This is needed after

2015-04-16 Thread Zachary Turner
Could we have a test for this?
On Thu, Apr 16, 2015 at 10:05 PM Jason Molenda  wrote:

> Author: jmolenda
> Date: Fri Apr 17 00:01:58 2015
> New Revision: 235158
>
> URL: http://llvm.org/viewvc/llvm-project?rev=235158&view=rev
> Log:
> Add a "force_kill" arg to Process::Destroy().  This is needed after
> the changes in r233255/r233258.  Normally if lldb attaches to
> a running process, when we call Process::Destroy, we want to detach
> from the process.  If lldb launched the process itself, ::Destroy
> should kill it.
>
> However, if we attach to a process and the driver calls SBProcess::Kill()
> (which calls Destroy), we need to kill it even if we didn't launch it
> originally.
>
> The force_kill param allows for the SBProcess::Kill method to force the
> behavior of Destroy.
>
> 
>
>
> Modified:
> lldb/trunk/include/lldb/Target/Process.h
> lldb/trunk/source/API/SBProcess.cpp
> lldb/trunk/source/Commands/CommandObjectProcess.cpp
> lldb/trunk/source/Core/IOHandler.cpp
> lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
> lldb/trunk/source/Target/Process.cpp
> lldb/trunk/source/Target/Target.cpp
>
> Modified: lldb/trunk/include/lldb/Target/Process.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=235158&r1=235157&r2=235158&view=diff
>
> ==
> --- lldb/trunk/include/lldb/Target/Process.h (original)
> +++ lldb/trunk/include/lldb/Target/Process.h Fri Apr 17 00:01:58 2015
> @@ -1343,11 +1343,19 @@ public:
>  /// This function is not meant to be overridden by Process
>  /// subclasses.
>  ///
> +/// @param[in] force_kill
> +/// Whether lldb should force a kill (instead of a detach) from
> +/// the inferior process.  Normally if lldb launched a binary and
> +/// Destory is called, lldb kills it.  If lldb attached to a
> +/// running process and Destory is called, lldb detaches.  If
> +/// this behavior needs to be over-ridden, this is the bool that
> +/// can be used.
> +///
>  /// @return
>  /// Returns an error object.
>  //--
>  Error
> -Destroy();
> +Destroy(bool force_kill);
>
>  //--
>  /// Sends a process a UNIX signal \a signal.
>
> Modified: lldb/trunk/source/API/SBProcess.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=235158&r1=235157&r2=235158&view=diff
>
> ==
> --- lldb/trunk/source/API/SBProcess.cpp (original)
> +++ lldb/trunk/source/API/SBProcess.cpp Fri Apr 17 00:01:58 2015
> @@ -768,7 +768,7 @@ SBProcess::Destroy ()
>  if (process_sp)
>  {
>  Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
> -sb_error.SetError(process_sp->Destroy());
> +sb_error.SetError(process_sp->Destroy(false));
>  }
>  else
>  sb_error.SetErrorString ("SBProcess is invalid");
> @@ -821,7 +821,7 @@ SBProcess::Kill ()
>  if (process_sp)
>  {
>  Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
> -sb_error.SetError (process_sp->Destroy());
> +sb_error.SetError (process_sp->Destroy(true));
>  }
>  else
>  sb_error.SetErrorString ("SBProcess is invalid");
>
> Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=235158&r1=235157&r2=235158&view=diff
>
> ==
> --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Apr 17
> 00:01:58 2015
> @@ -93,7 +93,7 @@ protected:
>  }
>  else
>  {
> -Error destroy_error (process->Destroy());
> +Error destroy_error (process->Destroy(false));
>  if (destroy_error.Success())
>  {
>  result.SetStatus
> (eReturnStatusSuccessFinishResult);
> @@ -1466,7 +1466,7 @@ protected:
>
>  if (command.GetArgumentCount() == 0)
>  {
> -Error error (process->Destroy());
> +Error error (process->Destroy(false));
>  if (error.Success())
>  {
>  result.SetStatus (eReturnStatusSuccessFinishResult);
>
> Modified: lldb/trunk/source/Core/IOHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=235158&r1=235157&r2=235158&view=diff
>
> ==
> --- lldb/trunk/source/Core/

[Lldb-commits] [lldb] r234660 - Making linking against Python simpler on Windows.

2015-04-10 Thread Zachary Turner
Author: zturner
Date: Fri Apr 10 17:58:56 2015
New Revision: 234660

URL: http://llvm.org/viewvc/llvm-project?rev=234660&view=rev
Log:
Making linking against Python simpler on Windows.

This patch deprecates the three Python CMake variables in favor of
a single variable PYTHON_HOME which points to the root of a python
installation.  Since building Python doesn't output the files in
a structure that is compatible with the PYTHONHOME environment
variable, we also provide a script install_custom_python.py which
will copy the output of a custom python build to the correct
directory structure.

The supported workflow after this patch will be to build python
once for each configuration and architecture {Debug,Release} x {x86,x64}
and then run the script.  Then run CMake specifying -DPYTHON_HOME=

The first time you do this will probably require you to delete your
CMake cache.

The old workflow is still supported during a transitionary period,
but a warning is printed at CMake time, and this will eventually
be removed.

Differential Revision: http://reviews.llvm.org/D8979

Added:
lldb/trunk/scripts/install_custom_python.py
Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/www/build.html

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=234660&r1=234659&r2=234660&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Fri Apr 10 17:58:56 2015
@@ -1,3 +1,7 @@
+set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
+set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
+set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
+
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
   set(LLDB_DEFAULT_DISABLE_PYTHON 0)
   set(LLDB_DEFAULT_DISABLE_CURSES 1)
@@ -10,25 +14,16 @@ else()
 set(LLDB_DEFAULT_DISABLE_CURSES 0)
   endif()
 endif()
+
 set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
   "Disables the Python scripting integration.")
 set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
   "Disables the Curses integration.")
 
-if ( LLDB_DISABLE_PYTHON )
-  set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 0)
-else ()
-  set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 1)
-endif ()
-
-set(LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 
${LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION} CACHE BOOL
+set(LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 1 CACHE BOOL
   "Enables using new Python scripts for SWIG API generation .")  
-
-set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
-set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
-set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
-
-set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting 
integration.")
+set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
+  "Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
@@ -45,15 +40,39 @@ if (NOT LLDB_DISABLE_PYTHON)
   set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
 endif()
   endif()
-  if (MSVC)
-if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL "")
-  message("-- LLDB Embedded python disabled.  Embedding python on Windows 
requires "
-  "manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
-  set(LLDB_DISABLE_PYTHON 1)
+  
+  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+if (NOT "${PYTHON_HOME}" STREQUAL "")
+  file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)
+  if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXECUTABLE)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27_d.lib" PYTHON_LIBRARY)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python27_d.dll" PYTHON_DLL)
+  else()
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXECUTABLE)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_LIBRARY)
+file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_DLL)
+  endif()
+  
+  file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIR)
+  if (NOT LLDB_RELOCATABLE_PYTHON)
+add_definitions( -DLLDB_PYTHON_HOME="${PYTHON_HOME}" )
+  endif()
 else()
+  message("Embedding Python on Windows without specifying a value for 
PYTHON_HOME is deprecated.  Support for this will be dropped soon.")
+
+  if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL 
"")
+message("-- LLDB Embedded python disabled.  Embedding python on 
Windows requires "
+"manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
+set(LLDB_DISABLE_PYTHON 1)
+  endif()
+endif()
+
+if (PYTHON

Re: [Lldb-commits] [PATCH] Add info on running remote test suite to the website

2015-04-07 Thread Zachary Turner
I know this is more work, but would it be possible to split all the testing
stuff out into a totally separate page on the sidebar?

On Tue, Apr 7, 2015 at 9:35 AM Pavel Labath  wrote:

> Hi tberghammer, zturner,
>
> http://reviews.llvm.org/D8873
>
> Files:
>   www/build.html
>
> Index: www/build.html
> ===
> --- www/build.html
> +++ www/build.html
> @@ -402,6 +402,45 @@
>  
>> python dotest.py -h
>  
> +
> +
> +  Besides dotest.py, there is also
> dosep.py, which runs
> +  multiple instances of dotest.py in parallel,
> thereby greatly
> +  decreasing the time it takes to run the full testsuite. The
> number of concurrent
> +  tests is controlled by the LLDB_TEST_THREADS
> environment variable and
> +  defaults to the number of CPUs on your system. To pass
> additional options to
> +  dotest.py, specify those options as an
> -o argument to
> +  dosep.py. For example, the command
> +
> +python dosep.py -o "--executable bin/lldb -C
> bin/clang"
> +
> +  will specify the lldb and clang executables to test for
> each dotest invocation.
> +  ninja check-lldb is wrapper around
> dosep.py.
> +
> +
> +Running the test-suite remotely
> +
> +
> +  Running the test-suite remotely is supported both with
> dotest.py and
> +  dosep.py. The general process is the same as
> when running a local test
> +  suite, but there are two things to have in mind:
> +
> +
> +  
> +You must have the lldb-server running on the
> remote system, ready to
> +accept multiple connections. For more information on how
> to setup remote
> +debugging see the Remote
> debugging page.
> +  
> +  
> +You must tell the test-suite how to connect to the remote
> system. This is
> +achieved using the --platform-name,
> --platform-url and
> +--platform-working-dir parameters to
> dotest.py. These
> +parameters correspond to the platform select
> and platform
> +connect LLDB commands. You will usually also need
> to specify the compiler and
> +architecture for the remote system.
> +  
> +
> +
>  Building API reference documentation
>  
>LLDB exposes a C++ as well as a Python API. To build the
> reference documentation for these two APIs, ensure you have
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Don't compile scripts directory if LLDB_DISABLE_PYTHON is set

2015-04-07 Thread Zachary Turner
Lgtm
On Tue, Apr 7, 2015 at 2:53 AM Pavel Labath  wrote:

> Hi zturner,
>
> What looks like a typo has caused the scripts/Python directory to be
> compiled on non-Windows
> platforms even with LLDB_DISABLE_PYTHON, which failed if Python.h was
> unavaiable. This changes
> the condition to avoid compilation if LLDB_DISABLE_PYTHON is set.
>
> http://reviews.llvm.org/D8855
>
> Files:
>   CMakeLists.txt
>
> Index: CMakeLists.txt
> ===
> --- CMakeLists.txt
> +++ CMakeLists.txt
> @@ -4,7 +4,7 @@
>
>  #add_subdirectory(include)
>  add_subdirectory(docs)
> -if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" OR NOT LLDB_DISABLE_PYTHON)
> +if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT LLDB_DISABLE_PYTHON)
>add_subdirectory(scripts)
>  endif ()
>  add_subdirectory(source)
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] [IRForTarget] Strenghten handling of alternate mangling.

2015-04-06 Thread Zachary Turner
Is it possible to do away with the hardcoded mangled name?  I really
dislike seeing this kind of thing.  Not only because it doesn't work with
all ABIs, but just in general it's very gross for the debugger to have
exceptions for specific mangled names.  Why is this necessary, and is there
any way to get rid of it?

If it is necessary, can we at least move it to somewhere more appropriate
like the Mangled class and provide some kind of generic method like
Mangled::GetAlternateMangling()?

On Mon, Apr 6, 2015 at 3:10 PM Greg Clayton  wrote:

> I'll OK this on the condition that Sean Callanan OKs this. Sean?
>
>
> http://reviews.llvm.org/D8846
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r234030 - Don't use literal slashes when concatenating paths in Python.

2015-04-03 Thread Zachary Turner
Author: zturner
Date: Fri Apr  3 12:19:43 2015
New Revision: 234030

URL: http://llvm.org/viewvc/llvm-project?rev=234030&view=rev
Log:
Don't use literal slashes when concatenating paths in Python.

This patch fixes the swig generation scripts to use os.path.join
instead, which produces correctly normalized paths for platforms
that don't use the standard forward slash separator.

Modified:
lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
lldb/trunk/scripts/finishSwigWrapperClasses.py

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=234030&r1=234029&r2=234030&view=diff
==
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Fri Apr  3 12:19:43 2015
@@ -90,17 +90,17 @@ def macosx_copy_file_for_heap( vDictArgs
 if eOSType != utilsOsType.EnumOsType.Darwin:
 return (bOk, strMsg);
 
-strHeapDir = vstrFrameworkPythonDir + "/macosx/heap";
+strHeapDir = os.path.join(vstrFrameworkPythonDir, "macosx", "heap");
 strHeapDir = os.path.normcase( strHeapDir );
 if (os.path.exists( strHeapDir ) and os.path.isdir( strHeapDir )):
 return (bOk, strMsg);
 
 os.makedirs( strHeapDir );
 
-strRoot = vDictArgs[ "--srcRoot" ];
-strSrc = strRoot + "/examples/darwin/heap_find/heap/heap_find.cpp";
+strRoot = os.path.normpath(vDictArgs[ "--srcRoot" ]);
+strSrc = os.path.join(strRoot, "examples", "darwin", "heap_find", "heap", 
"heap_find.cpp");
 shutil.copy( strSrc, strHeapDir );
-strSrc = strRoot + "/examples/darwin/heap_find/heap/Makefile";
+strSrc = os.path.join(strRoot, "examples", "darwin", "heap_find", "heap", 
"Makefile");
 shutil.copy( strSrc, strHeapDir );
 
 return (bOk, strMsg);
@@ -147,8 +147,7 @@ def create_py_pkg( vDictArgs, vstrFramew
 shutil.copy( strPkgFile, strPkgDir );
 
 # Create a packet init files if there wasn't one
-strPkgIniFile = strPkgDir + "/__init__.py";
-strPkgIniFile = os.path.normcase( strPkgIniFile );
+strPkgIniFile = os.path.normpath(os.path.join(strPkgDir, "__init__.py"));
 if os.path.exists( strPkgIniFile ) and os.path.isfile( strPkgIniFile ):
 return (bOk, strMsg);
 
@@ -190,9 +189,9 @@ def copy_lldbpy_file_to_lldb_pkg_dir( vD
 bDbg = vDictArgs.has_key( "-d" );
 strMsg = "";
 
-strSrc = vstrCfgBldDir + "/lldb.py";
+strSrc = os.path.join(vstrCfgBldDir, "lldb.py");
 strSrc = os.path.normcase( strSrc );
-strDst = vstrFrameworkPythonDir + "/__init__.py";
+strDst = os.path.join(vstrFrameworkPythonDir, "__init__.py");
 strDst = os.path.normcase( strDst );
 
 if not os.path.exists( strSrc ):
@@ -282,7 +281,7 @@ def make_symlink( vDictArgs, vstrFramewo
 bOk = True;
 strErrMsg = "";
 bDbg = vDictArgs.has_key( "-d" );
-strTarget = "%s/%s" % (vstrFrameworkPythonDir, vstrTargetFile);
+strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile);
 strTarget = os.path.normcase( strTarget );
 strSrc = "";
 
@@ -293,16 +292,15 @@ def make_symlink( vDictArgs, vstrFramewo
 return (bOk, strErrMsg);
 else:
 # Resolve vstrSrcFile path relatively the build directory
-strBuildDir = "";
 if eOSType == utilsOsType.EnumOsType.Windows:
 # On a Windows platform the vstrFrameworkPythonDir looks like:
 # llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = "../../..";
+strBuildDir = os.path.join("..", "..", "..");
 else:
 # On a UNIX style platform the vstrFrameworkPythonDir looks like:
 # llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = "../../../..";
-strSrc = os.path.normcase( "%s/%s" % (strBuildDir, vstrSrcFile) );
+strBuildDir = os.path.join("..", "..", "..", "..");
+strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile));
 
 if eOSType == utilsOsType.EnumOsType.Unknown:
 bOk = False;
@@ -358,18 +356,17 @@ def make_symlink_liblldb( vDictArgs, vst
 
 bMakeFileCalled = vDictArgs.has_key( "-m" );
 if not bMakeFileCalled:
-strSrc = "lib/LLDB";
+strSrc = os.path.join("lib", "LLDB");
 else:
 strLibFileExtn = "";
 if eOSType == utilsOsType.EnumOsType.Windows:
-strLibFileExtn = ".dll";
-strSrc = "bin/liblldb%s" % strLibFileExtn;
+strSrc = os.path.join("bin", "liblldb.dll");
 else:
 if eOSType == utilsOsType.EnumOsType.Darwin:
 strLibFileExtn = ".dylib";
 else:
 strLibFileExtn = ".so";
-strSrc = "lib/liblldb%s" % strLibFileExtn;
+strSrc = os.path.join("lib", "liblldb" + strLibFileExtn);
 
 bOk, strErrMsg = make_symlink( vDictArgs, vstrFrameworkPy

Re: [Lldb-commits] [PATCH] Use std::call_once for initialization

2015-04-01 Thread Zachary Turner
Maybe a comment indicating why it's a ManagedStatic would also be helpful so 
people are aware of the history.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8760

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix race condition in Target::Launch

2015-03-26 Thread Zachary Turner
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8562

Files:
  lldb/trunk/source/Target/Target.cpp

Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -2596,26 +2596,23 @@
 {
 EventSP event_sp;
 ListenerSP hijack_listener_sp (launch_info.GetHijackListener());
+if (!hijack_listener_sp)
+{
+hijack_listener_sp.reset(new 
Listener("lldb.Target.Launch.hijack"));
+launch_info.SetHijackListener(hijack_listener_sp);
+m_process_sp->HijackProcessEvents(hijack_listener_sp.get());
+}
 
 StateType state = m_process_sp->WaitForProcessToStop (NULL, 
&event_sp, false, hijack_listener_sp.get(), NULL);
 
 if (state == eStateStopped)
 {
-if (launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == 
false)
+if (!launch_info.GetFlags().Test(eLaunchFlagStopAtEntry))
 {
-if (!synchronous_execution)
-m_process_sp->RestoreProcessEvents ();
-
-error = m_process_sp->PrivateResume();
-
-if (error.Success())
+if (synchronous_execution)
 {
-// there is a race condition where this thread will 
return up the call stack to the main command
-// handler and show an (lldb) prompt before 
HandlePrivateEvent (from PrivateStateThread) has
-// a chance to call PushProcessIOHandler()
-m_process_sp->SyncIOHandler(2000);
-
-if (synchronous_execution)
+error = m_process_sp->PrivateResume();
+if (error.Success())
 {
 state = m_process_sp->WaitForProcessToStop (NULL, 
NULL, true, hijack_listener_sp.get(), stream);
 const bool must_be_alive = false; // eStateExited 
is ok, so this must be false
@@ -2627,14 +2624,26 @@
 }
 else
 {
+m_process_sp->RestoreProcessEvents();
+error = m_process_sp->PrivateResume();
+if (error.Success())
+{
+// there is a race condition where this thread 
will return up the call stack to the main command
+// handler and show an (lldb) prompt before 
HandlePrivateEvent (from PrivateStateThread) has
+// a chance to call PushProcessIOHandler()
+m_process_sp->SyncIOHandler(2000);
+}
+}
+if (!error.Success())
+{
 Error error2;
 error2.SetErrorStringWithFormat("process resume at 
entry point failed: %s", error.AsCString());
 error = error2;
 }
 }
 else
 {
-assert(synchronous_execution && 
launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == true);
+assert(synchronous_execution && 
launch_info.GetFlags().Test(eLaunchFlagStopAtEntry));
 
 // Target was stopped at entry as was intended. Need to 
notify the listeners about it.
 m_process_sp->RestoreProcessEvents();

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -2596,26 +2596,23 @@
 {
 EventSP event_sp;
 ListenerSP hijack_listener_sp (launch_info.GetHijackListener());
+if (!hijack_listener_sp)
+{
+hijack_listener_sp.reset(new Listener("lldb.Target.Launch.hijack"));
+launch_info.SetHijackListener(hijack_listener_sp);
+m_process_sp->HijackProcessEvents(hijack_listener_sp.get());
+}
 
 StateType state = m_process_sp->WaitForProcessToStop (NULL, &event_sp, false, hijack_listener_sp.get(), NULL);
 
 if (state == eStateStopped)
 {
-if (launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == false)
+if (!launch_info.GetFlags().Test(eLaunchFlagStopAtEntry))
 {
-if (!synchronous_execution)
-m_process_sp->RestoreProcessEvents ();
-
-error = m_process_sp->PrivateResume();
-
-if (error.Success())
+   

[Lldb-commits] [lldb] r233308 - Fix the remaining two test failures caused by re-ordering of teardown.

2015-03-26 Thread Zachary Turner
Author: zturner
Date: Thu Mar 26 13:59:56 2015
New Revision: 233308

URL: http://llvm.org/viewvc/llvm-project?rev=233308&view=rev
Log:
Fix the remaining two test failures caused by re-ordering of teardown.

Previously we were using teardown hooks in these two instances to
shutdown processes.  TestBase already deletes all targets in its
own teardown, which will kill processes, so these steps weren't
necessary.

Modified:
lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py

Modified: lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py?rev=233308&r1=233307&r2=233308&view=diff
==
--- lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py Thu Mar 
26 13:59:56 2015
@@ -137,7 +137,6 @@ class AbbreviationsTestCase(TestBase):
 # The test framework relies on detecting either "run" or "process 
launch"
 # command to automatically kill the inferior upon tear down.
 # But we'll be using "pro la" command to launch the inferior.
-self.addTearDownHook(lambda: self.runCmd("process kill"))
 self.expect("pro la",
 patterns = [ "Process .* launched: "])
 

Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=233308&r1=233307&r2=233308&view=diff
==
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Thu Mar 26 
13:59:56 2015
@@ -58,10 +58,6 @@ class LoadUnloadTestCase(TestBase):
 #patterns = ["%s-[^-]*-[^-]*" % self.getArchitecture()])
 # Add an image search path substitution pair.
 self.runCmd("target modules search-paths add %s %s" % (os.getcwd(), 
new_dir))
-# Add teardown hook to clear image-search-paths after the test.
-# rdar://problem/10501020
-# Uncomment the following to reproduce 10501020.
-self.addTearDownHook(lambda: self.runCmd("target modules search-paths 
clear"))
 
 self.expect("target modules search-paths list",
 substrs = [os.getcwd(), new_dir])


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233306 - Fix test failures caused by order of initialization.

2015-03-26 Thread Zachary Turner
Author: zturner
Date: Thu Mar 26 13:54:21 2015
New Revision: 233306

URL: http://llvm.org/viewvc/llvm-project?rev=233306&view=rev
Log:
Fix test failures caused by order of initialization.

tear down hooks run as part of Base.tearDown().  Some of these
hooks rely on accessing the debugger instance.  So although it
looks awkward, we need to call "del self.dbg" after calling
Base.tearDown().

Modified:
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=233306&r1=233305&r2=233306&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Mar 26 13:54:21 2015
@@ -1918,11 +1918,13 @@ class TestBase(Base):
 if lldb.post_flight:
 lldb.post_flight(self)
 
-del self.dbg
-
 # Do this last, to make sure it's in reverse order from how we setup.
 Base.tearDown(self)
 
+# This must be the last statement, otherwise teardown hooks or other
+# lines might depend on this still being active.
+del self.dbg
+
 def switch_to_thread_with_stop_reason(self, stop_reason):
 """
 Run the 'thread list' command, and select the thread with stop reason 
as


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix type detection for 'char' when it is unsigned

2015-03-26 Thread Zachary Turner
unit test?

On Thu, Mar 26, 2015 at 11:50 AM, Tamas Berghammer 
wrote:

>
> Based on it I still believe if the dwarf file contains a basic type with
> name "char" and it is a DW_ATE_unsigned_char then CharTy will be
> initialized to Char_U and everything will work fine and the user will see
> the type name defined in the dwarf file ("char"). If you want I can add a
> check (possibly an assert) to verify that we hit this case only when
> ASTContext.LangOpts.CharIsSigned is false (if it is not true then the dwarf
> file or lldb is broken).
>
>
Or a unit test.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix race condition in Target::Launch

2015-03-26 Thread Zachary Turner
Jim, thoughts?


http://reviews.llvm.org/D8562

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233284 - Tear down tests in reverse order from setting them up.

2015-03-26 Thread Zachary Turner
Author: zturner
Date: Thu Mar 26 11:43:25 2015
New Revision: 233284

URL: http://llvm.org/viewvc/llvm-project?rev=233284&view=rev
Log:
Tear down tests in reverse order from setting them up.

Tests derive from TestBase, which derives from Base.  In the
test setUp() methods, we always call TestBase.setUp() first and
then call implementation-specific setup.  Tear down needs to do
the reverse.

This was causing over 20 failures on Windows, and was the culprit
behind about 80% of the files not being cleaned up after test run.
TestBase.tearDown() is responsible for deleting all targets created
during the test run and without this step, on Windows files will
be locked and cannot be deleted.  But TestBase.tearDown() was
calling Base.tearDown() before its own cleanup (i.e. deleting the
targets) and in some cases one of the teardown hooks would be to
call make clean.  So make clean would be run before the targets
had been deleted, and fail to remove the files, and subsequently
result in a failed test as well.

Modified:
lldb/trunk/test/lldbtest.py
lldb/trunk/test/make/Makefile.rules
lldb/trunk/test/types/AbstractBase.py
lldb/trunk/test/types/HideTestFailures.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=233284&r1=233283&r2=233284&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Mar 26 11:43:25 2015
@@ -339,41 +339,41 @@ def system(commands, **kwargs):
 # Assign the sender object to variable 'test' and remove it from kwargs.
 test = kwargs.pop('sender', None)
 
-separator = None
-separator = " && " if os.name == "nt" else "; "
 # [['make', 'clean', 'foo'], ['make', 'foo']] -> ['make clean foo', 'make 
foo']
 commandList = [' '.join(x) for x in commands]
-# ['make clean foo', 'make foo'] -> 'make clean foo; make foo'
-shellCommand = separator.join(commandList)
-
-if 'stdout' in kwargs:
-raise ValueError('stdout argument not allowed, it will be overridden.')
-if 'shell' in kwargs and kwargs['shell']==False:
-raise ValueError('shell=False not allowed')
-process = Popen(shellCommand, stdout=PIPE, stderr=PIPE, shell=True, 
**kwargs)
-pid = process.pid
-output, error = process.communicate()
-retcode = process.poll()
-
-# Enable trace on failure return while tracking down FreeBSD buildbot 
issues
-trace = traceAlways
-if not trace and retcode and sys.platform.startswith("freebsd"):
-trace = True
-
-with recording(test, trace) as sbuf:
-print >> sbuf
-print >> sbuf, "os command:", shellCommand
-print >> sbuf, "with pid:", pid
-print >> sbuf, "stdout:", output
-print >> sbuf, "stderr:", error
-print >> sbuf, "retcode:", retcode
-print >> sbuf
-
-if retcode:
-cmd = kwargs.get("args")
-if cmd is None:
-cmd = shellCommand
-raise CalledProcessError(retcode, cmd)
+output = ""
+error = ""
+for shellCommand in commandList:
+if 'stdout' in kwargs:
+raise ValueError('stdout argument not allowed, it will be 
overridden.')
+if 'shell' in kwargs and kwargs['shell']==False:
+raise ValueError('shell=False not allowed')
+process = Popen(shellCommand, stdout=PIPE, stderr=PIPE, shell=True, 
**kwargs)
+pid = process.pid
+this_output, this_error = process.communicate()
+retcode = process.poll()
+
+# Enable trace on failure return while tracking down FreeBSD buildbot 
issues
+trace = traceAlways
+if not trace and retcode and sys.platform.startswith("freebsd"):
+trace = True
+
+with recording(test, trace) as sbuf:
+print >> sbuf
+print >> sbuf, "os command:", shellCommand
+print >> sbuf, "with pid:", pid
+print >> sbuf, "stdout:", output
+print >> sbuf, "stderr:", error
+print >> sbuf, "retcode:", retcode
+print >> sbuf
+
+if retcode:
+cmd = kwargs.get("args")
+if cmd is None:
+cmd = shellCommand
+raise CalledProcessError(retcode, cmd)
+output = output + this_output
+error = error + this_error
 return (output, error)
 
 def getsource_if_available(obj):
@@ -1899,8 +1899,6 @@ class TestBase(Base):
 #import traceback
 #traceback.print_stack()
 
-Base.tearDown(self)
-
 # Delete the target(s) from the debugger as a general cleanup step.
 # This includes terminating the process for each target, if any.
 # We'd like to reuse the debugger for our next test without incurring
@@ -1922,6 +1920,9 @@ class TestBase(Base):
 
 del self.dbg
 
+# Do this last, to make sure it's in reverse order from how we setup.
+Ba

[Lldb-commits] [lldb] r233283 - Add a --all command option to "target delete".

2015-03-26 Thread Zachary Turner
Author: zturner
Date: Thu Mar 26 11:43:13 2015
New Revision: 233283

URL: http://llvm.org/viewvc/llvm-project?rev=233283&view=rev
Log:
Add a --all command option to "target delete".

Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=233283&r1=233282&r2=233283&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Mar 26 11:43:13 2015
@@ -601,10 +601,20 @@ public:
  "Delete one or more targets by target index.",
  NULL,
  0),
-m_option_group (interpreter),
-m_cleanup_option (LLDB_OPT_SET_1, false, "clean", 'c', "Perform extra 
cleanup to minimize memory consumption after deleting the target.", false, 
false)
+m_option_group(interpreter),
+m_all_option(LLDB_OPT_SET_1, false, "all", 'a', "Delete all targets.", 
false, true),
+m_cleanup_option(
+LLDB_OPT_SET_1,
+false,
+"clean", 'c',
+"Perform extra cleanup to minimize memory consumption after 
deleting the target.  "
+"By default, LLDB will keep in memory any modules previously 
loaded by the target as well "
+"as all of its debug info.  Specifying --clean will unload all of 
these shared modules and "
+"cause them to be reparsed again the next time the target is run",
+false, true)
 {
-m_option_group.Append (&m_cleanup_option, LLDB_OPT_SET_ALL, 
LLDB_OPT_SET_1);
+m_option_group.Append(&m_all_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+m_option_group.Append(&m_cleanup_option, LLDB_OPT_SET_ALL, 
LLDB_OPT_SET_1);
 m_option_group.Finalize();
 }
 
@@ -626,90 +636,89 @@ protected:
 const size_t argc = args.GetArgumentCount();
 std::vector delete_target_list;
 TargetList &target_list = m_interpreter.GetDebugger().GetTargetList();
-bool success = true;
 TargetSP target_sp;
-if (argc > 0)
+
+if (m_all_option.GetOptionValue())
+{
+for (uint32_t i = 0; i < target_list.GetNumTargets(); ++i)
+delete_target_list.push_back(target_list.GetTargetAtIndex(i));
+}
+else if (argc > 0)
 {
 const uint32_t num_targets = target_list.GetNumTargets();
 // Bail out if don't have any targets.
 if (num_targets == 0) {
 result.AppendError("no targets to delete");
 result.SetStatus(eReturnStatusFailed);
-success = false;
+return false;
 }
 
-for (uint32_t arg_idx = 0; success && arg_idx < argc; ++arg_idx)
+for (uint32_t arg_idx = 0; arg_idx < argc; ++arg_idx)
 {
 const char *target_idx_arg = args.GetArgumentAtIndex(arg_idx);
+bool success = false;
 uint32_t target_idx = StringConvert::ToUInt32 (target_idx_arg, 
UINT32_MAX, 0, &success);
-if (success)
+if (!success)
 {
-if (target_idx < num_targets)
-{
-target_sp = target_list.GetTargetAtIndex (target_idx);
-if (target_sp)
-{
-delete_target_list.push_back (target_sp);
-continue;
-}
-}
-if (num_targets > 1)
-result.AppendErrorWithFormat ("target index %u is out 
of range, valid target indexes are 0 - %u\n",
-  target_idx,
-  num_targets - 1);
-else
-result.AppendErrorWithFormat("target index %u is out 
of range, the only valid index is 0\n",
-target_idx);
-
+result.AppendErrorWithFormat("invalid target index 
'%s'\n", target_idx_arg);
 result.SetStatus (eReturnStatusFailed);
-success = false;
+return false;
 }
-else
+if (target_idx < num_targets)
 {
-result.AppendErrorWithFormat("invalid target index 
'%s'\n", target_idx_arg);
-result.SetStatus (eReturnStatusFailed);
-success = false;
+target_sp = target_list.GetTargetAtIndex (target_idx);
+if (target_sp)
+{
+delete_target_list

Re: [Lldb-commits] [PATCH] Add a --all command option to "target delete"

2015-03-25 Thread Zachary Turner
Ironically even though I've been staring at this problem for 2 days I think
I actually figured this out shortly after my last email.
TestBase.tearDown() already deletes all the targets but it was calling
Base.tearDown before doing TestBase.tearDown().  So the setup looked like
this:

def setup(self):
Base.setup(self)

# Do TestBase specific stuff

def tearDown(self):
Base.tearDown(self)

# Do TestBase specific stuff

the orders here need to be reversed to ensure that teardown happens in
reverse order from setup.  In particular Base.tearDown() was calling the
tear down hooks, one of which in this case was to call make clean.  So make
clean was being called before the targets were deleted.  My clean --all
helped, but as you said, the SB stuff was still holding a reference
somewhere.

I fixed this by reversing the orders and also fixed about 20 other tests in
the process.  Yay for progress.

On Wed, Mar 25, 2015 at 5:52 PM  wrote:

>
> > On Mar 25, 2015, at 5:18 PM, Zachary Turner  wrote:
> >
> > Seems reasonable, I can add something to the help.  What do you think
> about also changing the semantics of --clean to clear the module list
> regardless of if the modules are orphaned?  I've spent the past 2 days
> trying to track down a refcounting bug related to the shared module list
> that only happens when running from the test suite, even if I run the exact
> same sequence of commands from inside LLDB.  But the gist of it is that
> when running from the test suite, when RemoveOrphanSharedModules() is
> called from the CommandObject, the ModuleSP for the executable has a ref
> count of 2, so it isn't unique to the shared module list, and it doesn't
> get removed.
>
> This makes it sound like some Python object that is holding onto a
> reference to the executable isn't getting garbage collected.  Is there some
> way to force Python to do this?
> It seem to me like violating the function of the shared cache,
> particularly from the lldb command line, is not a great idea.  Even --clean
> seems a little unfortunate to have in the command line, since some innocent
> person will run the help command and then be worried about what this whole
> clean thing is and whether it is a good idea and etc.  Might be better, if
> this is necessary, to have it only in the SB API where we can put an
> appropriate comment around it.  That way ordinary users who should 100%
> never have to think about this won't be disturbed by it.
>
> Jim
>
> >
> > I tested to see what happens if I change this logic to remove from the
> module list regardless of whether it's unique, and I can't find any
> unintended side effects other than lots of tests start passing :
> >
> > shared_ptrs are shared, so in theory there shouldn't be any negative
> consequences to just removing it.  Whoever still has a reference can still
> continue to use it.  Alternatively I can add a --force command line option,
> so that the semantics of specifying just --clean are unchanged.
> >
> > Thoughts?
> >
> >
> > http://reviews.llvm.org/D8615
> >
> > EMAIL PREFERENCES
> >  http://reviews.llvm.org/settings/panel/emailpreferences/
> >
> >
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Add a --all command option to "target delete"

2015-03-25 Thread Zachary Turner
Seems reasonable, I can add something to the help.  What do you think about 
also changing the semantics of --clean to clear the module list regardless of 
if the modules are orphaned?  I've spent the past 2 days trying to track down a 
refcounting bug related to the shared module list that only happens when 
running from the test suite, even if I run the exact same sequence of commands 
from inside LLDB.  But the gist of it is that when running from the test suite, 
when RemoveOrphanSharedModules() is called from the CommandObject, the ModuleSP 
for the executable has a ref count of 2, so it isn't unique to the shared 
module list, and it doesn't get removed.

I tested to see what happens if I change this logic to remove from the module 
list regardless of whether it's unique, and I can't find any unintended side 
effects other than lots of tests start passing :)

shared_ptrs are shared, so in theory there shouldn't be any negative 
consequences to just removing it.  Whoever still has a reference can still 
continue to use it.  Alternatively I can add a --force command line option, so 
that the semantics of specifying just --clean are unchanged.

Thoughts?


http://reviews.llvm.org/D8615

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Work around lack of %zd printf format specifier in VC CRT.

2015-03-24 Thread Zachary Turner
lgtm, Maybe you can try committing this yourself?

http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access


http://reviews.llvm.org/D8592

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233106 - Fix build broken by missing `typename` keyword.

2015-03-24 Thread Zachary Turner
Author: zturner
Date: Tue Mar 24 15:22:50 2015
New Revision: 233106

URL: http://llvm.org/viewvc/llvm-project?rev=233106&view=rev
Log:
Fix build broken by missing `typename` keyword.

Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=233106&r1=233105&r2=233106&view=diff
==
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Mar 24 15:22:50 2015
@@ -1548,11 +1548,12 @@ ImportOffsetMap(llvm::DenseMap MapType;
-std::vector sorted_items;
+typedef typename MapType::value_type PairType;
+std::vector sorted_items;
 sorted_items.reserve(source_map.size());
 sorted_items.assign(source_map.begin(), source_map.end());
 std::sort(sorted_items.begin(), sorted_items.end(),
-  [](const MapType::value_type &lhs, const MapType::value_type 
&rhs)
+  [](const PairType &lhs, const PairType &rhs)
   {
   return lhs.second < rhs.second;
   });


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233099 - Fix error introduced by changing function signatures.

2015-03-24 Thread Zachary Turner
Author: zturner
Date: Tue Mar 24 13:56:08 2015
New Revision: 233099

URL: http://llvm.org/viewvc/llvm-project?rev=233099&view=rev
Log:
Fix error introduced by changing function signatures.

Since ClangASTSource::layoutRecordType() was overriding a virtual
function in the base, this was inadvertently causing a new method
to be introduced rather than an override.  To fix this all method
signatures are changed back to taking DenseMaps, and the `override`
keyword is added to make sure this type of error doesn't happen
again.

To keep the original fix intact, which is that fields and bases
must be added in offset order, the ImportOffsetMap() function
now copies the DenseMap into a vector and then sorts the vector
on the value type (e.g. the offset) before iterating over the
sorted vector and inserting the items.

Modified:
lldb/trunk/include/lldb/Expression/ClangASTSource.h
lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
lldb/trunk/source/Expression/ClangASTSource.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp

lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py

lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
lldb/trunk/test/lang/c/bitfields/TestBitfields.py

Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=233099&r1=233098&r2=233099&view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Tue Mar 24 13:56:08 2015
@@ -11,7 +11,6 @@
 #define liblldb_ClangASTSource_h_
 
 #include 
-#include 
 
 #include "clang/Basic/IdentifierTable.h"
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
@@ -21,12 +20,6 @@
 
 #include "llvm/ADT/SmallSet.h"
 
-namespace clang
-{
-class CharUnits;
-class FieldDecl;
-}
-
 namespace lldb_private {
 
 //--
@@ -108,10 +101,8 @@ public:
 /// @return
 /// Whatever SetExternalVisibleDeclsForName returns.
 //--
-bool
-FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
-clang::DeclarationName Name);
-
+bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, 
clang::DeclarationName Name) override;
+
 //--
 /// Enumerate all Decls in a given lexical context.
 ///
@@ -125,13 +116,9 @@ public:
 /// @param[in] Decls
 /// A vector that is filled in with matching Decls.
 //--
-clang::ExternalLoadResult 
-FindExternalLexicalDecls (const clang::DeclContext *DC,
-  bool (*isKindWeWant)(clang::Decl::Kind),
-  llvm::SmallVectorImpl &Decls);
-
-typedef std::vector> 
FieldOffsetList;
-typedef std::vector> BaseOffsetList;
+clang::ExternalLoadResult FindExternalLexicalDecls(const 
clang::DeclContext *DC,
+   bool 
(*isKindWeWant)(clang::Decl::Kind),
+   
llvm::SmallVectorImpl &Decls) override;
 
 //--
 /// Specify the layout of the contents of a RecordDecl.
@@ -167,8 +154,9 @@ public:
 /// True <=> the layout is valid.
 //-
 bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, 
uint64_t &Alignment,
-  FieldOffsetList &FieldOffsets, BaseOffsetList 
&BaseOffsets,
-  BaseOffsetList &VirtualBaseOffsets);
+  llvm::DenseMap 
&FieldOffsets,
+  llvm::DenseMap &BaseOffsets,
+  llvm::DenseMap &VirtualBaseOffsets) override;
 
 //--
 /// Complete a TagDecl.
@@ -176,18 +164,16 @@ public:
 /// @param[in] Tag
 /// The Decl to be completed in place.
 //--
-virtual void
-CompleteType (clang::TagDecl *Tag);
-
+void

Re: [Lldb-commits] [PATCH] Force iteration over FieldDecls and RecordDecls in deterministic order.

2015-03-24 Thread Zachary Turner
I talked to some of the clang guys here and they said to go back to
DenseMaps to conform to the ExternalASTSource interface, but make sure you
iterate over fields and bases in offset order, which means sorting the list
before doing the insertion.  So I will submit a patch to do that today.

On Tue, Mar 24, 2015 at 10:39 AM Zachary Turner  wrote:

> I see what you mean about the interface. I guess that settles that then,
> the interface needs to be consistent. I'll add override keywords so the
> compiler can catch that for me in the future.
>
> But our implementation still needs to add fields in the correct order, so
> iterating over the DenseMap is still not the right approach
>
>
> REPOSITORY
>   rL LLVM
>
> http://reviews.llvm.org/D8512
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Force iteration over FieldDecls and RecordDecls in deterministic order.

2015-03-24 Thread Zachary Turner
I see what you mean about the interface. I guess that settles that then,
the interface needs to be consistent. I'll add override keywords so the
compiler can catch that for me in the future.

But our implementation still needs to add fields in the correct order, so
iterating over the DenseMap is still not the right approach


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8512

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Force iteration over FieldDecls and RecordDecls in deterministic order.

2015-03-24 Thread Zachary Turner
This bug isn't specific to Microsoft layout. Clang as a general rule
requires fields to be added in offset order, and iterating over a dense map
doesn't give you that.

I'll let majnemer or rnk comment on the ExternalASTSource interface
On Tue, Mar 24, 2015 at 10:15 AM Sean Callanan  wrote:

> As an aside, when laying out a RecordDecl, you have the ordering for its
> fields right in the RecordDecl.  If MicrosoftRecordLayoutBuilder relying on
> the llvm::DenseMap for ordering, I think it's MicrosoftRecordLayoutBuilder
> that has the bug.  By my understanding of how record layout works, it
> should only be using the map to go from fields/bases to offsets – nothing
> else.
>
>
> REPOSITORY
>   rL LLVM
>
> http://reviews.llvm.org/D8512
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Force iteration over FieldDecls and RecordDecls in deterministic order.

2015-03-24 Thread Zachary Turner
This bug isn't specific to Microsoft layout. Clang as a general rule
requires fields to be added in offset order, and iterating over a dense map
doesn't give you that.

I'll let majnemer or rnk comment on the ExternalASTSource interface


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8512

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix race condition in Target::Launch

2015-03-23 Thread Zachary Turner

Comment at: source/Target/Target.cpp:2605-2606
@@ -2604,4 +2610,1 @@
 {
-if (!synchronous_execution)
-m_process_sp->RestoreProcessEvents ();
-

ki.stfu wrote:
> Can we use a mixed code (for sync and async execution) to avoid copy-paste?
I'm not crazy about the copy/paste either, but I thought this separation made 
the logic easier to follow.  Let's see what Jim or Greg says, I don't feel very 
strongly, so if there's a consensus one way or the other I'll just go with the 
consensus.


Comment at: source/Target/Target.cpp:2627
@@ -2625,2 +2626,3 @@
 }
+m_process_sp->RestoreProcessEvents();
 }

ki.stfu wrote:
> it's really needed?
I'm still learning this section of the code, but if we hijack the events, 
surely we need to restore them?

http://reviews.llvm.org/D8562

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Initialize ObjC runtime at the right location.

2015-03-23 Thread Zachary Turner
Why are we putting logic for a specific language runtime in generic code?
This doesn't seem right to me.

On Mon, Mar 23, 2015 at 11:38 AM Greg Clayton  wrote:

> lgtm
>
>
> http://reviews.llvm.org/D8558
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r232974 - Rely on Makefile.rules in lldb/test/driver/batch_mode.

2015-03-23 Thread Zachary Turner
Author: zturner
Date: Mon Mar 23 13:00:07 2015
New Revision: 232974

URL: http://llvm.org/viewvc/llvm-project?rev=232974&view=rev
Log:
Rely on Makefile.rules in lldb/test/driver/batch_mode.

This was hardcoding some make rules instead of relying on
Makefile.rules, which was causing some of the logic to be
incorrect for Windows.

Patch by: Adrian McCarthy
Differential Revision: http://reviews.llvm.org/D8363

Modified:
lldb/trunk/test/driver/batch_mode/Makefile

Modified: lldb/trunk/test/driver/batch_mode/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/driver/batch_mode/Makefile?rev=232974&r1=232973&r2=232974&view=diff
==
--- lldb/trunk/test/driver/batch_mode/Makefile (original)
+++ lldb/trunk/test/driver/batch_mode/Makefile Mon Mar 23 13:00:07 2015
@@ -1,28 +1,5 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
-   ARCH = x86_64
-endif
+LEVEL = ../../make
 
-ifeq "$(OS)" ""
-   OS = $(shell uname -s)
-endif
+C_SOURCES := main.c
 
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := lib
-
-ifeq "$(OS)" "Darwin"
-   CFLAGS += -arch $(ARCH)
-endif
-
-all: a.out
-
-a.out: main.o
-   $(CC) $(CFLAGS) -o a.out main.o
-
-main.o: main.c
-   $(CC) $(CFLAGS) -c main.c
-
-clean:
-   rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
+include $(LEVEL)/Makefile.rules


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Rely on Makefile.rules to clean up the lldb\test\driver\batch_mode directory.

2015-03-23 Thread Zachary Turner
lgtm


http://reviews.llvm.org/D8363

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Use the right type for pid_t on FreeBSD

2015-03-20 Thread Zachary Turner
I'm not either fwiw, just explaining the motivation for Davide :)
On Fri, Mar 20, 2015 at 6:38 PM Ed Maste  wrote:

> In http://reviews.llvm.org/D8491#144558, @zturner wrote:
>
> > all of the lldb:: types are 64 bit because it needs to be able to hold a
> >  pid of any platform (if you are remote debugging for example). You need
> to
> >  cast to and from ::pid_t inside your host layer
>
>
> Right - what I meant is I'm not aware of any platform that has a 64-bit
> pid type.
>
>
> http://reviews.llvm.org/D8491
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Move full initialization to lldb/API

2015-03-20 Thread Zachary Turner
What Tamas said.  I can hold it if there's a good reason, but I don't think
there's much risk involved here.  The actual initialization / shutdown code
is a straight copy/paste from what it was before.  So the question is just
if it's calling the initialization and shutdown code correctly.  And the
local linux test suite would catch that if it were an issue.


http://reviews.llvm.org/D8462

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r232823 - Try to fix configure/make build.

2015-03-20 Thread Zachary Turner
Author: zturner
Date: Fri Mar 20 11:23:40 2015
New Revision: 232823

URL: http://llvm.org/viewvc/llvm-project?rev=232823&view=rev
Log:
Try to fix configure/make build.

Modified:
lldb/trunk/lib/Makefile

Modified: lldb/trunk/lib/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=232823&r1=232822&r2=232823&view=diff
==
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Fri Mar 20 11:23:40 2015
@@ -29,6 +29,7 @@ USEDLIBS = lldbAPI.a \
lldbDataFormatters.a \
lldbExpression.a \
lldbHostCommon.a \
+   lldbInitialize.a \
lldbInitAndLog.a \
lldbInterpreter.a \
lldbPluginABIMacOSX_arm.a \


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix for aarch64 lldb-server native builds

2015-03-19 Thread Zachary Turner
I still think this needs to be fixed in LLVM and not in LLDB.  
CMAKE_LIBRARY_ARCHITECTURE is a variable that any library, not just LLDB, might 
want to check.  And if it's not correct in LLDB, then it's not going to be 
correct anywhere else either.

I've added chandlerc.  I know a little about LLVM's CMake, but not as much as 
Chandler, so maybe he could give us a hand and see if he agrees that this 
belongs in LLVM CMake.


http://reviews.llvm.org/D8447

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Move LLDB initialization / shutdown to Application

2015-03-18 Thread Zachary Turner
I actually had it called Initialization originally.  I like Initialization 
slightly better than InternalAPI because it makes it clear that that the stuff 
is specific to initialization.  InternalAPI makes me think I can go put a bunch 
of random stuff in it which might make more sense somewhere else where it's 
more logically grouped.

Other names might be something like DebuggerInit or DebuggerLifetime


http://reviews.llvm.org/D8428

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r232673 - Move some functions from source/lldb.cpp to Utility.

2015-03-18 Thread Zachary Turner
Author: zturner
Date: Wed Mar 18 16:31:45 2015
New Revision: 232673

URL: http://llvm.org/viewvc/llvm-project?rev=232673&view=rev
Log:
Move some functions from source/lldb.cpp to Utility.

Specifically, there were some functions for converting enums
to strings and a function for matching a string using a specific
matching algorithm.  This moves those functions to more appropriate
headers in lldb/Utility and updates references to include the
new headers.

Added:
lldb/trunk/include/lldb/Utility/ConvertEnum.h
lldb/trunk/include/lldb/Utility/NameMatches.h
lldb/trunk/source/Utility/ConvertEnum.cpp
lldb/trunk/source/Utility/NameMatches.cpp
Modified:
lldb/trunk/include/lldb/lldb-private.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Core/Section.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadList.cpp
lldb/trunk/source/Target/ThreadPlan.cpp
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/source/lldb.cpp

Added: lldb/trunk/include/lldb/Utility/ConvertEnum.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ConvertEnum.h?rev=232673&view=auto
==
--- lldb/trunk/include/lldb/Utility/ConvertEnum.h (added)
+++ lldb/trunk/include/lldb/Utility/ConvertEnum.h Wed Mar 18 16:31:45 2015
@@ -0,0 +1,22 @@
+//===-- ConvertEnum.h ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef LLDB_UTILITY_CONVERTENUM_H
+#define LLDB_UTILITY_CONVERTENUM_H
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+
+namespace lldb_private
+{
+
+const char *GetVoteAsCString(Vote vote);
+const char *GetSectionTypeAsCString(lldb::SectionType sect_type);
+}
+
+#endif

Added: lldb/trunk/include/lldb/Utility/NameMatches.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/NameMatches.h?rev=232673&view=auto
==
--- lldb/trunk/include/lldb/Utility/NameMatches.h (added)
+++ lldb/trunk/include/lldb/Utility/NameMatches.h Wed Mar 18 16:31:45 2015
@@ -0,0 +1,19 @@
+//===-- NameMatches.h ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef LLDB_UTILITY_NAMEMATCHES_H
+#define LLDB_UTILITY_NAMEMATCHES_H
+
+#include "lldb/lldb-private-enumerations.h"
+
+namespace lldb_private
+{
+bool NameMatches(const char *name, NameMatchType match_type, const char 
*match);
+}
+
+#endif

Modified: lldb/trunk/include/lldb/lldb-private.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private.h?rev=232673&r1=232672&r2=232673&view=diff
==
--- lldb/trunk/include/lldb/lldb-private.h (original)
+++ lldb/trunk/include/lldb/lldb-private.h Wed Mar 18 16:31:45 2015
@@ -94,15 +94,6 @@ TerminateLLGS();
 const char *
 GetVersion ();
 
-const char *
-GetVoteAsCString (Vote vote);
-
-const char *
-GetSectionTypeAsCString (lldb::SectionType sect_type);
-
-bool
-NameMatches (const char *name, NameMatchType match_type, const char *match);
-
 } // namespace lldb_private
 
 

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=232673&r1=232672&r2=232673&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Mar 18 16:31:45 2015
@@ -684,6 +684,8 @@
33E5E8461A6736D30024ED68 /* StringConvert.h in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = 33E5E8451A6736D30024ED68 /* StringConvert.h */; 
};
33E5E8471A674FB60024ED68 /* StringConvert.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 33E5E8411A672A240024ED68 /* StringConvert.cpp 
*/; };
3F8160A61AB9F7DD001DA9DF /* Logging.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 3F8160A51AB9F7DD001DA9DF /* Logging.cpp */; };
+   3F8169191ABA2419001DA9DF /* ConvertEnum.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 3F8169171ABA2419001DA9DF /* ConvertEnum.cpp */; 
};
+   3F81691A1ABA2419001DA9DF /* NameMatches.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 3F8169181AB

[Lldb-commits] [lldb] r232669 - Try to fix the Makefile build.

2015-03-18 Thread Zachary Turner
Author: zturner
Date: Wed Mar 18 15:58:39 2015
New Revision: 232669

URL: http://llvm.org/viewvc/llvm-project?rev=232669&view=rev
Log:
Try to fix the Makefile build.

I deleted lldb-log.cpp, but the Makefile build lists this file
explicitly, so it is removed in this patch.

Modified:
lldb/trunk/source/Makefile

Modified: lldb/trunk/source/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Makefile?rev=232669&r1=232668&r2=232669&view=diff
==
--- lldb/trunk/source/Makefile (original)
+++ lldb/trunk/source/Makefile Wed Mar 18 15:58:39 2015
@@ -19,7 +19,7 @@ ifeq (Darwin,$(shell uname -s))
 BUILT_SOURCES = LLDB_vers.c
 endif
 
-SOURCES := lldb-log.cpp lldb.cpp
+SOURCES := lldb.cpp
 
 include $(LLDB_LEVEL)/Makefile
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r232653 - Move lldb-log.cpp to core/Logging.cpp

2015-03-18 Thread Zachary Turner
Author: zturner
Date: Wed Mar 18 13:20:42 2015
New Revision: 232653

URL: http://llvm.org/viewvc/llvm-project?rev=232653&view=rev
Log:
Move lldb-log.cpp to core/Logging.cpp

So that we don't have to update every single #include in the entire
codebase to #include this new header (which used to get included by
lldb-private-log.h, we automatically #include "Logging.h" from
within "Log.h".

Added:
lldb/trunk/include/lldb/Core/Logging.h
  - copied, changed from r232649, lldb/trunk/include/lldb/lldb-private-log.h
lldb/trunk/source/Core/Logging.cpp
  - copied, changed from r232649, lldb/trunk/source/lldb-log.cpp
Removed:
lldb/trunk/include/lldb/lldb-private-log.h
lldb/trunk/source/lldb-log.cpp
Modified:
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/include/lldb/lldb-private.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Breakpoint/Breakpoint.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp
lldb/trunk/source/CMakeLists.txt
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Core/AddressResolver.cpp
lldb/trunk/source/Core/AddressResolverFileLine.cpp
lldb/trunk/source/Core/AddressResolverName.cpp
lldb/trunk/source/Core/Broadcaster.cpp
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/ConnectionMachPort.cpp
lldb/trunk/source/Core/ConnectionSharedMemory.cpp
lldb/trunk/source/Core/DataBufferMemoryMap.cpp
lldb/trunk/source/Core/FileLineResolver.cpp
lldb/trunk/source/Core/Listener.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Host/common/NativeRegisterContext.cpp
lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/trunk/source/Symbol/Block.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
lldb/trunk/source/Target/ThreadPlanStepOut.cpp
lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
lldb/trunk/source/Target/ThreadPlanStepRange.cpp
lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
lldb/trunk/source/lldb.cpp
lldb/trunk/tools/lldb-server/CMakeLists.txt
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=232653&r1=232652&r2=232653&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Wed Mar 18 13:20:42 2015
@@ -22,6 +22,7 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Flags.h"
+#include "lldb/Core/Logging.h"
 #include "lldb/Core/PluginInterface.h"
 
 //--

Copied: lldb/trunk/include/lldb/Core/Logging.h (from r232649, 
lldb/trunk/include/lldb/lldb-private-log.h)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Logging.h?p2=lldb/trunk/include/lldb/Core/Logging.h&p1=lldb/trunk/include/lldb/lldb-private-log.h&r1=232649&r2=232653&rev=232653&view=diff
==
--- lldb/trunk/include/lldb/lldb-private-log.h (original)
+++ lldb/trunk/include/lldb/Core/Logging.h Wed Mar 18 13:20:42 2015
@@ -1,4 +1,4 @@
-//===-- lldb-private-log.h --*- C++ 
-*-===//
+//===-- Logging.h ---*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,8 @@
 //
 
//===--===//
 
-#ifndef liblldb_lldb_private_log_h_
-#define liblldb_lldb_private_log_h_
+#ifndef liblldb_Core_Logging_h_
+#define liblldb_Core_Logging_h_
 
 // C Includes
 // C++ Includes
@@ -90,4 +90,4 @@ ListLo

[Lldb-commits] [lldb] r232534 - Remove ScriptInterpreterObject.

2015-03-17 Thread Zachary Turner
Author: zturner
Date: Tue Mar 17 15:04:04 2015
New Revision: 232534

URL: http://llvm.org/viewvc/llvm-project?rev=232534&view=rev
Log:
Remove ScriptInterpreterObject.

This removes ScriptInterpreterObject from the codebase completely.
Places that used to rely on ScriptInterpreterObject now use
StructuredData::Object and its derived classes.  To support this,
a new type of StructuredData object is introduced, called
StructuredData::Generic, which stores a void*.  Internally within
the python library, StructuredPythonObject subclasses this
StructuredData::Generic class so that it can addref and decref
the python object on construction and destruction.

Additionally, all of the classes in PythonDataObjects.h such
as PythonList, PythonDictionary, etc now provide a method to
create an instance of the corresponding StructuredData type.  For
example, there is PythonDictionary::CreateStructuredDictionary.
To eliminate dependencies on PythonDataObjects for external
callers, all ScriptInterpreter methods now return only
StructuredData classes

The rest of the changes in this CL are focused on fixing up
users of PythonDataObjects classes to use the new StructuredData
classes.

Modified:
lldb/trunk/include/lldb/Core/StructuredData.h
lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
lldb/trunk/include/lldb/Interpreter/PythonDataObjects.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/include/lldb/Target/ThreadPlanPython.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Core/StructuredData.cpp
lldb/trunk/source/DataFormatters/TypeSynthetic.cpp
lldb/trunk/source/Interpreter/PythonDataObjects.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/ThreadPlanPython.cpp

Modified: lldb/trunk/include/lldb/Core/StructuredData.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StructuredData.h?rev=232534&r1=232533&r2=232534&view=diff
==
--- lldb/trunk/include/lldb/Core/StructuredData.h (original)
+++ lldb/trunk/include/lldb/Core/StructuredData.h Tue Mar 17 15:04:04 2015
@@ -54,14 +54,22 @@ public:
 class Boolean;
 class String;
 class Dictionary;
+class Generic;
 
 typedef std::shared_ptr ObjectSP;
 typedef std::shared_ptr ArraySP;
+typedef std::shared_ptr IntegerSP;
+typedef std::shared_ptr FloatSP;
+typedef std::shared_ptr BooleanSP;
+typedef std::shared_ptr StringSP;
 typedef std::shared_ptr DictionarySP;
+typedef std::shared_ptr GenericSP;
 
-enum class Type {
+enum class Type
+{
 eTypeInvalid = -1,
 eTypeNull = 0,
+eTypeGeneric,
 eTypeArray,
 eTypeInteger,
 eTypeFloat,
@@ -84,6 +92,12 @@ public:
 {
 }
 
+virtual bool
+IsValid() const
+{
+return true;
+}
+
 virtual void
 Clear ()
 {
@@ -150,9 +164,19 @@ public:
 return NULL;
 }
 
+Generic *
+GetAsGeneric()
+{
+if (m_type == Type::eTypeGeneric)
+return (Generic *)this;
+return NULL;
+}
+
 ObjectSP
 GetObjectForDotSeparatedPath (llvm::StringRef path);
 
+void DumpToStdout() const;
+
 virtual void
 Dump (Stream &s) const = 0; 
 
@@ -174,7 +198,7 @@ public:
 }
 
 size_t
-GetSize()
+GetSize() const
 {
 return m_items.size();
 }
@@ -188,13 +212,97 @@ public:
 }
 
 ObjectSP
-GetItemAtIndex (size_t idx)
+GetItemAtIndex(size_t idx) const
 {
+assert(idx < GetSize());
 if (idx < m_items.size())
 return m_items[idx];
 return ObjectSP();
 }
 
+template 
+bool
+GetItemAtIndexAsInteger(size_t idx, IntType &result) const
+{
+ObjectSP value = GetItemAtIndex(idx);
+if (auto int_value = value->GetAsInteger())
+{
+result = static_cast(int_value->GetValue());
+return true;
+}
+return false;
+}
+
+template 
+bool
+GetItemAtIndexAsInteger(size_t idx, IntType &resul

Re: [Lldb-commits] [PATCH] Delete ScriptInterpreterObject

2015-03-16 Thread Zachary Turner
By the way, I still have trouble running tests on OSX.  I'm not really sure
what the recommended workflow is.  Could we add a section to the website
called "Running LLDB Tests"?  I created a bug for it with some things that
would be useful to have documented in such a page:

https://llvm.org/bugs/show_bug.cgi?id=22887

We wouldn't need to tackle this all at once, but it would be nice if I
didn't have to keep asking you to run the test suite on OSX for me.

On Mon, Mar 16, 2015 at 4:33 PM Greg Clayton  wrote:

> Ahhh, I see. I am running the test suite now with these changes on MacOSX.
>
>
> http://reviews.llvm.org/D8128
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Delete ScriptInterpreterObject

2015-03-16 Thread Zachary Turner
By the way, I still have trouble running tests on OSX.  I'm not really sure
what the recommended workflow is.  Could we add a section to the website
called "Running LLDB Tests"?  I created a bug for it with some things that
would be useful to have documented in such a page:

https://llvm.org/bugs/show_bug.cgi?id=22887

We wouldn't need to tackle this all at once, but it would be nice if I
didn't have to keep asking you to run the test suite on OSX for me.


http://reviews.llvm.org/D8128

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Delete ScriptInterpreterObject

2015-03-16 Thread Zachary Turner
Yea I'm looking into this right now.  I wasn't sure if it was crashing
because OperatingSystemPython had unrelated portability issues on Windows,
so I was reproing this on Linux right now.  In any case, it looks like
there's still a few more issues.

On Mon, Mar 16, 2015 at 1:07 PM, Greg Clayton  wrote:

> If you run this test on MacOSX, it crashes:
>
>   % cd test
>   % ./dotest.py -t -v functionalities/plugins/python_os_plugin
>
>
> http://reviews.llvm.org/D8128
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r232212 - Create a check-lldb-unit target to run unit tests.

2015-03-13 Thread Zachary Turner
Author: zturner
Date: Fri Mar 13 15:55:07 2015
New Revision: 232212

URL: http://llvm.org/viewvc/llvm-project?rev=232212&view=rev
Log:
Create a check-lldb-unit target to run unit tests.

Added:
lldb/trunk/lit/
lldb/trunk/lit/CMakeLists.txt
lldb/trunk/lit/Unit/
lldb/trunk/lit/Unit/lit.cfg
lldb/trunk/lit/Unit/lit.site.cfg.in
lldb/trunk/lit/lit.cfg
lldb/trunk/lit/lit.site.cfg.in
Modified:
lldb/trunk/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=232212&r1=232211&r2=232212&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Mar 13 15:55:07 2015
@@ -11,6 +11,7 @@ add_subdirectory(source)
 add_subdirectory(test)
 add_subdirectory(tools)
 add_subdirectory(unittests)
+add_subdirectory(lit)
 
 
 if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT 
LLDB_DISABLE_PYTHON )

Added: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=232212&view=auto
==
--- lldb/trunk/lit/CMakeLists.txt (added)
+++ lldb/trunk/lit/CMakeLists.txt Fri Mar 13 15:55:07 2015
@@ -0,0 +1,36 @@
+set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
+set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
+set(LLVM_BUILD_MODE "%(build_mode)s")
+set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
+set(LLVM_LIBS_DIR 
"${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s")
+set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
+set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
+if(BUILD_SHARED_LIBS)
+  set(ENABLE_SHARED 1)
+else()
+  set(ENABLE_SHARED 0)
+endif(BUILD_SHARED_LIBS)
+
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
+  )
+
+set(LLDB_TEST_DEPS
+  LLDBUnitTests
+  )
+set(LLDB_TEST_PARAMS
+  lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  )
+
+add_lit_testsuite(check-lldb-unit "Running lldb unit test suite"
+  ${CMAKE_CURRENT_BINARY_DIR}
+  PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+   lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
+  DEPENDS ${LLDB_TEST_DEPS}
+  )
+
+set_target_properties(check-lldb-unit PROPERTIES FOLDER "lldb tests")

Added: lldb/trunk/lit/Unit/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Unit/lit.cfg?rev=232212&view=auto
==
--- lldb/trunk/lit/Unit/lit.cfg (added)
+++ lldb/trunk/lit/Unit/lit.cfg Fri Mar 13 15:55:07 2015
@@ -0,0 +1,23 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+import os
+
+import lit.formats
+
+# name: The name of this test suite.
+config.name = 'lldb-Unit'
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes =  []
+
+# test_source_root: The root path where unit test binaries are located.
+# test_exec_root: The root path where tests should be run.
+config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests')
+config.test_exec_root = config.test_source_root
+
+# testFormat: The test format to use to interpret tests.
+if not hasattr(config, 'llvm_build_mode'):
+lit_config.fatal("unable to find llvm_build_mode value on config")
+config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')

Added: lldb/trunk/lit/Unit/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Unit/lit.site.cfg.in?rev=232212&view=auto
==
--- lldb/trunk/lit/Unit/lit.site.cfg.in (added)
+++ lldb/trunk/lit/Unit/lit.site.cfg.in Fri Mar 13 15:55:07 2015
@@ -0,0 +1,25 @@
+## Autogenerated by LLVM/lld configuration.
+# Do not edit!
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+config.lldb_obj_root = "@LLDB_BINARY_DIR@"
+config.lldb_src_root = "@LLDB_SOURCE_DIR@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.python_executable = "@PYTHON_EXECUTABLE@"
+
+# Support substitution of the tools and libs dirs with user parameters. This is
+# used when we can't determine the tool dir at configuration time.
+try:
+config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
+config.llvm_build_mode = config.llvm_build_mode % lit_config.params
+except KeyError as e:
+key, = e.args
+lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % 
(ke

Re: [Lldb-commits] [PATCH] Create a CODE_OWNERS.txt file for LLDB

2015-03-10 Thread Zachary Turner
Cool.  I'll give it a day to sit in case anyone who I've added has
objections or thinks of something else and I'll commit tomorrow if there's
nothing else.

On Tue, Mar 10, 2015 at 2:53 PM Greg Clayton  wrote:

> Looks good.
>
>
> http://reviews.llvm.org/D8228
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Create a CODE_OWNERS.txt file for LLDB

2015-03-10 Thread Zachary Turner
Updates


http://reviews.llvm.org/D8228

Files:
  CODE_OWNERS.txt

Index: CODE_OWNERS.txt
===
--- /dev/null
+++ CODE_OWNERS.txt
@@ -0,0 +1,50 @@
+This file is a list of the people responsible for ensuring that patches for a
+particular part of LLDB are reviewed, either by themself or by someone else.
+They are also the gatekeepers for their part of LLDB, with the final word on
+what goes in or not.
+
+The list is sorted by surname and formatted to allow easy grepping and
+beautification by scripts.  The fields are: name (N), email (E), web-address
+(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
+(S).
+
+N: Sean Callanan
+E: scalla...@apple.com
+D: Expression evaluator, IR interpreter, Clang integration
+
+N: Greg Clayton
+E: clayb...@gmail.com (Phabricator)
+E: gclay...@apple.com (Direct)
+D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, 
Mac-specific code, 
+D: DynamicLoader, ObjectFile, IOHandler, EditLine, ValueObject, Watchpoints, 
debugserver
+D: Build scripts, Test suite, Platform, gdb-remote, Anything not covered by 
this file
+
+N: Enrico Granata
+E: egran...@apple.com
+D: Data Formatters, Core/Value*, Objective C Language runtime, Test suite, 
Xcode build
+D: SWIG
+
+N: Jim Ingham
+E: jing...@apple.com
+D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, 
Breakpoints, ABI
+D: Watchpoints, Trampolines, Target, Command Interpreter, C++ / Objective C 
Language runtime
+
+N: Ilia K
+E: ki.s...@gmail.com
+D: lldb-mi
+
+N: Ed Maste
+E: ema...@freebsd.org
+D: FreeBSD
+
+N: Jason Molenda
+E: jmole...@apple.com
+D: ABI, Disassembler, Unwinding, iOS, debugserver, Platform
+
+N: Zachary Turner
+E: ztur...@google.com
+D: CMake build, Host (common+windows), Plugins/Process/Windows, Anything 
Windows-specific
+
+N: Oleksiy Vyalov
+E: ovya...@google.com
+D: Linux, Android

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: CODE_OWNERS.txt
===
--- /dev/null
+++ CODE_OWNERS.txt
@@ -0,0 +1,50 @@
+This file is a list of the people responsible for ensuring that patches for a
+particular part of LLDB are reviewed, either by themself or by someone else.
+They are also the gatekeepers for their part of LLDB, with the final word on
+what goes in or not.
+
+The list is sorted by surname and formatted to allow easy grepping and
+beautification by scripts.  The fields are: name (N), email (E), web-address
+(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
+(S).
+
+N: Sean Callanan
+E: scalla...@apple.com
+D: Expression evaluator, IR interpreter, Clang integration
+
+N: Greg Clayton
+E: clayb...@gmail.com (Phabricator)
+E: gclay...@apple.com (Direct)
+D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, Mac-specific code, 
+D: DynamicLoader, ObjectFile, IOHandler, EditLine, ValueObject, Watchpoints, debugserver
+D: Build scripts, Test suite, Platform, gdb-remote, Anything not covered by this file
+
+N: Enrico Granata
+E: egran...@apple.com
+D: Data Formatters, Core/Value*, Objective C Language runtime, Test suite, Xcode build
+D: SWIG
+
+N: Jim Ingham
+E: jing...@apple.com
+D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, Breakpoints, ABI
+D: Watchpoints, Trampolines, Target, Command Interpreter, C++ / Objective C Language runtime
+
+N: Ilia K
+E: ki.s...@gmail.com
+D: lldb-mi
+
+N: Ed Maste
+E: ema...@freebsd.org
+D: FreeBSD
+
+N: Jason Molenda
+E: jmole...@apple.com
+D: ABI, Disassembler, Unwinding, iOS, debugserver, Platform
+
+N: Zachary Turner
+E: ztur...@google.com
+D: CMake build, Host (common+windows), Plugins/Process/Windows, Anything Windows-specific
+
+N: Oleksiy Vyalov
+E: ovya...@google.com
+D: Linux, Android
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Create a CODE_OWNERS.txt file for LLDB

2015-03-10 Thread Zachary Turner
Added Enrico to swig


http://reviews.llvm.org/D8228

Files:
  CODE_OWNERS.txt

Index: CODE_OWNERS.txt
===
--- /dev/null
+++ CODE_OWNERS.txt
@@ -0,0 +1,46 @@
+This file is a list of the people responsible for ensuring that patches for a
+particular part of LLDB are reviewed, either by themself or by someone else.
+They are also the gatekeepers for their part of LLDB, with the final word on
+what goes in or not.
+
+The list is sorted by surname and formatted to allow easy grepping and
+beautification by scripts.  The fields are: name (N), email (E), web-address
+(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
+(S).
+
+N: Sean Callanan
+E: scalla...@apple.com
+D: Expression evaluator, IR interpreter, Clang integration
+
+N: Greg Clayton
+E: clayb...@gmail.com (Phabricator)
+E: gclay...@apple.com (Direct)
+D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, 
Mac-specific code, 
+D: DynamicLoader, ObjectFile, IOHandler, EditLine, ValueObject, Watchpoints, 
debugserver
+D: Build scripts, Test suite, Platform, Anything not covered by this file.
+
+N: Enrico Granata
+E: egran...@apple.com
+D: Data Formatters, Core/Value*, Objective C Language runtime, Test suite, 
Xcode build
+D: SWIG
+
+N: Jim Ingham
+E: jing...@apple.com
+D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, 
Breakpoints, ABI
+D: Watchpoints, Trampolines, Target, Command Interpreter, Objective C / C++ 
Language runtime
+
+N: Ed Maste
+E: ema...@freebsd.org
+D: FreeBSD
+
+N: Jason Molenda
+E: jmole...@apple.com
+D: ABI, Disassembler, Unwinding, iOS, debugserver, Platform
+
+N: Zachary Turner
+E: ztur...@google.com
+D: CMake build, Host (common+windows), Windows
+
+N: Vince Harron
+E: vhar...@google.com
+D: Linux, Android, gdb-remote

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: CODE_OWNERS.txt
===
--- /dev/null
+++ CODE_OWNERS.txt
@@ -0,0 +1,46 @@
+This file is a list of the people responsible for ensuring that patches for a
+particular part of LLDB are reviewed, either by themself or by someone else.
+They are also the gatekeepers for their part of LLDB, with the final word on
+what goes in or not.
+
+The list is sorted by surname and formatted to allow easy grepping and
+beautification by scripts.  The fields are: name (N), email (E), web-address
+(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
+(S).
+
+N: Sean Callanan
+E: scalla...@apple.com
+D: Expression evaluator, IR interpreter, Clang integration
+
+N: Greg Clayton
+E: clayb...@gmail.com (Phabricator)
+E: gclay...@apple.com (Direct)
+D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, Mac-specific code, 
+D: DynamicLoader, ObjectFile, IOHandler, EditLine, ValueObject, Watchpoints, debugserver
+D: Build scripts, Test suite, Platform, Anything not covered by this file.
+
+N: Enrico Granata
+E: egran...@apple.com
+D: Data Formatters, Core/Value*, Objective C Language runtime, Test suite, Xcode build
+D: SWIG
+
+N: Jim Ingham
+E: jing...@apple.com
+D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, Breakpoints, ABI
+D: Watchpoints, Trampolines, Target, Command Interpreter, Objective C / C++ Language runtime
+
+N: Ed Maste
+E: ema...@freebsd.org
+D: FreeBSD
+
+N: Jason Molenda
+E: jmole...@apple.com
+D: ABI, Disassembler, Unwinding, iOS, debugserver, Platform
+
+N: Zachary Turner
+E: ztur...@google.com
+D: CMake build, Host (common+windows), Windows
+
+N: Vince Harron
+E: vhar...@google.com
+D: Linux, Android, gdb-remote
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Update the LLDB website with more information

2015-03-10 Thread Zachary Turner
I wasn't aware that the Xcode build did that. I'll update in a bit. I think
it's useful to say something about the directory structure though because
it lets people know how to update their code. Also will fix the suggestions
about line length
On Tue, Mar 10, 2015 at 12:20 PM Jim Ingham  wrote:

> Couple of comments.
>
> First off, if you are building with Xcode, you don't need to check out
> llvm & clang, the build will do that for you if they don't already exist.
> So for people who want to work on lldb & don't have an extant llvm/clang
> checkout, it is easier to just check out lldb & build.
>
> By saying "The line limit IS 120 characters"... "However you will see
> places" you make it sound like the exceptions are of questionable status,
> which is not at all the intent.  Particularly for these tables, letting
> them run longer is IMO preferable (there are a few of the tables where the
> help text wraps & I find those harder to read.)  You could say something
> like:
>
> The line limit for code statements is...
>
> Then it would be clearer that this statement does not contradict the
> immediately following paragraph.
>
>
> http://reviews.llvm.org/D8222
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r231310 - Introduce lldbassert(x)

2015-03-05 Thread Zachary Turner
And FWIW, please don't take this as me pointing fingers, calling anyone
out, or criticizing previous decisions.  It's really not about that.  I get
that things end up the way they do for lots of different reasons.  But we
should be able to detach and evaluate things objectively.  And at least
from my point of view, I think that we -- as a community -- really need to
stop being so averse to understanding or making changes in LLVM.  I don't
see LLDB as a project which uses LLVM.  I see LLVM as a project which LLDB
is one component of.  All working towards the same goal.  From this angle,
it only makes sense that we should *never* invent an abstraction in LLDB if
the same abstraction could be useful to someone else who uses LLVM.  And we
should *never* invent an abstraction in LLDB when an existing LLVM
abstraction sucks or doesn't meet our needs.  We should fix it.  Other
people might think it sucks too.  So when I call it out in a CL or
something, it's not me being "difficult", it's me trying to make the
changes as useful as possible to as many people as possible.

When I started on this project 9 months ago, I knew what LLVM was only in
name.  I'd never touched it or even thought of working on it.  The point is
-- it's not that scary (the only thing that's scary is having to adjust my
editor settings every time I go edit LLVM code.  But...).  Even better,
most of us have the benefit of working in physical proximity to people who
are experts in all areas of LLVM.  So when someone is not sure if LLVM
supports something, there's someone nearby who can answer the question.
And if not, well there's #llvm and #lldb IRC.  And I'll even do the dirty
work.  I'll test peoples' patches on Windows.  I'll test my own patches on
all 3 platforms.  I spent 3 hours today trying to learn how to mess with
Xcode projects.  None of this stuff benefits me directly, but I think it's
*that* important.

On Thu, Mar 5, 2015 at 2:43 PM Zachary Turner  wrote:

> On Thu, Mar 5, 2015 at 2:18 PM  wrote:
>
>>
>> > On Mar 5, 2015, at 11:59 AM, Zachary Turner  wrote:
>> >
>> > Right, but I was just talking about that specific instance of replacing
>> Host::Backtrace() with llvm::sys::PrintStackTrace().  There is not a good
>> reason for that specific instance of Host::Backtrace to remain as-is
>> instead of being replaced with llvm::sys::PrintStackTrace.  Even
>> independently of whether we delete Host::Backtrace entirely in favor of
>> llvm::sys::PrintStacktrace across the rest of the codebase.  There's
>> nothing particualrly useful or special about having a StreamString at that
>> call-site.
>> >
>>
>> I agree with Enrico here, we should be consistent in our usage.  So if
>> we're going to use the llvm facility we should do it everywhere, otherwise
>> people new to the code have to guess why we did different things in
>> different places.
>>
> I guess what frustrates me is that why isn't this the first response?
> Instead, the first response is "no we don't need this, we already have
> it".  That's not a sufficient answer.  Not everyone has it.  And even if
> everyone does have it, code health and technical debt are important
> considerations that I feel too often take a backseat to "eh well, it works
> for us".  For example...
>
>
>>
>> > As for the larger issue of whether to replace Host::Backtrace across
>> the codebase, llvm is open source and has an easy to work with community.
>> I'm always surprised when I see things like "the right method signature
>> isn't available, let's go re-implement hundreds of lines of code on 4
>> different platforms".  All we need to do is add the method with the right
>> signature.  I've already done that and it's been committed. It would be
>> great for the community if people were more open to and comfortable with
>> working in both codebases.
>>
>> That's not an accurate characterization of what actually happened.  More
>> likely it was, "I need a backtrace and and I can write the 10 lines of code
>> for Darwin (and probably most Linux'es) in much less time that it would
>> take to go figure out whether llvm has such a thing."
>>
> I would argue that no matter how much time it takes to figure out whether
> LLVM has such a thing, the time is worth it.  For example, does the Darwin
> and Linux backtrace implementation print filenames and line numbers, and
> can it backtrace through inlined functions?  I'm pretty sure the answer to
> that is no, because it doesn't use llvm-symbolizer.  The LLVM
> implementation does though.  Maybe it didn't a

Re: [Lldb-commits] [PATCH] Python Split [2/2] - Content change

2015-03-05 Thread Zachary Turner
I think this part needs to be done as a separate patch.  Makes it easier to
review and understand the impact of.  So I will do this part first
(basically delete ScriptInterpreterObject and move everything to
StructuredData) and commit that, then rebase this on top of that and go
from there.

On Thu, Mar 5, 2015 at 2:37 PM Greg Clayton  wrote:

> So seems like part of the work required for this patch to work is to
> change any references in code from PythonList, PythonString, PythonInteger,
> and PythonDictionary to use classes from lldb/Core/StructuredData.h.
>
> The means we probably need to have OperatingSystemPython rely only upon
> virtual functions in ScriptInterpreter and have those functions return
> stuff from StructuredData instead of python variants:
>
>   PythonDictionary dictionary(m_interpreter->OSPlugin_RegisterInfo(m_
> python_object_sp));
>
> Will need to become:
>
>   StructuredData::Dictionary dictionary(m_interpreter->
> OSPlugin_RegisterInfo(m_python_object_sp));
>
> We then need to modify the Python callbacks that return PythonList,
> PythonString, PythonInteger, and PythonDictionary objects, to convert them
> into StructuredData::Array, StructuredData::String, StructuredData::Integer
> and StructuredData::Dictionary respectively.
>
>
> http://reviews.llvm.org/D7957
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Change lldb_assert() to use llvm::sys::PrintBacktrace

2015-03-04 Thread Zachary Turner
On Wed, Mar 4, 2015 at 5:48 PM Enrico Granata  wrote:

> On Mar 4, 2015, at 5:36 PM, Zachary Turner  wrote:
>
> We don't have the wheel though.  For example, it's not implemented on
> Android and it's not implemented on Windows.  I could duplicate a bunch of
> code from LLVM, but why?  The code is already there in LLVM.  And what
> about the Android people?  There's currently about 3 completely different
> implementations of backtracing (MacOSX, FreeBSD, Linux).  All of them print
> backtraces in a different format.  We can call 1 function and have
> backtraces in the same format for everyone, including Windows and Android,
> right now.  This seems like kind of a straightforward case of code reuse to
> me, and a clear win, so I'm not sure why it's that contentious.
>
>
> Two things worry me about this:
>
> 1) we have a sanctioned LLDB facility that retrieves a host backtrace, but
> we’re saying that it does not work on all platforms, and instead of making
> it work on all platforms, we’re going to use another API, but have no plan
> to either improve or remove the existing LLDB API for this
>
> Given that we have an LLDB API to do this task, we should use it. If it is
> not an API that we can reasonably support on all platforms we care about,
> then we should remove it in favor of one that we can support on all
> platforms we care about. But we should not be ad-hoc choosing to use one or
> another way to do this task
>
I'm more than happy to remove Host::Backtrace in favor of
llvm::sys::PrintBacktrace().  It is called from 3 locations in the
codebase, and I believe I can replace all 3 of them by adding a simple
overload to llvm that takes an std::string by reference.

Having a sanctioned API doesn't mean we can't improve on things, or move to
a different sanctioned API.  This API is not exposed through the public
interface, so we have no guarantee or requirement to maintain
compatibility.  And there is a better one in LLVM.

"Sanctioned" shouldn't mean "now and forever no matter what new
developments arise".  It should mean "this is what we use because it
happens to be the best thing, but if something better comes along, then by
all means, go for it"


>
> 2) the LLDB API interoperates nicely with our Streams, whereas the LLVM
> one only supports FILE*. In general, Streams are a much nicer interface to
> work with than FILE* are.
>
LLVM is open source too, why can't we modify it?  I modify it all the time,
I'm quite confident I could push a change to LLVM that adds
PrintStackTrace(std::string &output).  I believe that should address the
concerns surrounding FILE*.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Change lldb_assert() to use llvm::sys::PrintBacktrace

2015-03-04 Thread Zachary Turner
We don't have the wheel though.  For example, it's not implemented on
Android and it's not implemented on Windows.  I could duplicate a bunch of
code from LLVM, but why?  The code is already there in LLVM.  And what
about the Android people?  There's currently about 3 completely different
implementations of backtracing (MacOSX, FreeBSD, Linux).  All of them print
backtraces in a different format.  We can call 1 function and have
backtraces in the same format for everyone, including Windows and Android,
right now.  This seems like kind of a straightforward case of code reuse to
me, and a clear win, so I'm not sure why it's that contentious.

If we need to interoperate with StreamString, then we should implement an
overload **in LLVM** that returns an std::string.

On Wed, Mar 4, 2015 at 5:30 PM Enrico Granata  wrote:

> On Mar 4, 2015, at 5:18 PM, Zachary Turner  wrote:
>
> Hmm, I'm not sure I agree.  Whether it prints to a Stream or directly to
> stderr is kind of an implementation detail.  Not very important since it
> just ends up to stdout or stderr anwyay and we don't do anything else with
> the backtrace except print it and throw it away.
>
> llvm already has functionality built in to serve exactly this purpose.
> Why shouldn't we use it?  Not only are we sure that it's implemented on all
> platforms that LLVM supports,
>
>
> If that is a concern, I posit that we should implement Host::Backtrace()
> on all platforms
>
> The alternative of course would be to get rid of Host::Backtrace()
> entirely, and use the similar LLVM facility - but given how our own
> facility uses Streams instead of FILE*, I don’t think that is actually a
> good change
>
> but the format is consistent on all of these platforms, and anyway why
> reinvent the wheel?
>
>
> Except in this case we already have the wheel
>
>
> On Wed, Mar 4, 2015 at 5:15 PM Enrico Granata 
> wrote:
>
>> 
>> Comment at: source/Utility/LLDBAssert.cpp:14
>> @@ -13,1 +13,3 @@
>> +
>> +#include "llvm/Support/Signals.h"
>>
>> 
>> I would not do this.
>> Printing to a Stream is the LLDB way to do this, no reason for switching
>> to this LLVM API
>>
>> 
>> Comment at: source/Utility/LLDBAssert.cpp:36
>> @@ -37,1 +35,3 @@
>> +llvm::sys::PrintStackTrace(stderr);
>> +fprintf(stderr, "please file a bug report against lldb reporting
>> this failure log, and as many details as possible\n");
>>  }
>> 
>> Printing to stderr is probably a good idea
>> But, again, I prefer to stick to the LLDB host layer
>>
>> It's probably fine to reimplement Host::Backtrace() in terms of LLVM APIs
>> if it can be done generally and with decent performance, but I don't see
>> much in terms of added value in this change
>>
>> http://reviews.llvm.org/D8069
>>
>> EMAIL PREFERENCES
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>>
>>  ___
> lldb-commits mailing list
> lldb-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r231310 - Introduce lldbassert(x)

2015-03-04 Thread Zachary Turner
As mentioned in the other thread, I think the StreamString thing is kind of
irrelevant.  The goal here is to get the backtrace to the screen.  I would
argue the reverse, that we should only be reinventing facilities in LLDB
when there's a good reason to do so.  In this case, I don't think being
able to use a StreamString is a compelling enough reason.  On the other
hand, having a consistent backtrace format which supports all platforms is
definitely a compelling reason to use the LLVM facility.  So I do think it
makes sense here.

On Wed, Mar 4, 2015 at 5:12 PM Enrico Granata  wrote:

> On Mar 4, 2015, at 4:39 PM, Zachary Turner  wrote:
>
> BTW, I have just uploaded http://reviews.llvm.org/D8068 to LLVM which
> implements backtracing of self on Windows (previously only backtracing of
> other threads was supported).  So once that goes through, if we switch this
> code to using llvm::sys::PrintBacktrace(),
>
>
> I don’t think we should make this change.
> Host::Backtrace prints to an lldb_private::Stream which is our preferred
> API for accumulating output - the LLVM version of this seems to print to a
> FILE* which is much less general
>
> I understand using LLVM facilities where it makes sense, but we should not
> be doing so blindly when the net effect is a loss of functionality for us
>
> If you can implement Host::Backtrace in general on all platforms via LLVM,
> feel free to do so - but we should still go through lldb's Host::Backtrace
> for this, and Host::Backtrace should still use our Stream*s*
>
> we should have a standard backtrace format across all platforms that LLVM
> supports.
>
> I like this feature now that I understand the use case, thanks for
> introducing it.
>
>
> We had a power outage here in Cupertino, which delayed my reply
> Glad to hear we all agree on this :-)
>
> On Wed, Mar 4, 2015 at 3:31 PM Siva Chandra 
> wrote:
>
>> On Wed, Mar 4, 2015 at 2:59 PM, Enrico Granata 
>> wrote:
>> > +#ifdef LLDB_CONFIGURATION_DEBUG
>> > +#define lldbassert(x) assert(x)
>> > +#else
>> > +#define lldbassert(x) lldb_private::lldb_assert(x, #x, __FUNCTION__,
>> __FILE__, __LINE__)
>> > +#endif
>>
>> Why should we have this ifdef? As in, why shouldn't we use lldb_assert
>> unconditionally, always (giving us the benefit of backtraces always)?
>> ___
>> lldb-commits mailing list
>> lldb-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>  Thanks,
> *- Enrico*
> 📩 egranata@.com ☎️ 27683
>
>
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Python Split [2/2] - Content change

2015-03-04 Thread Zachary Turner
I almost fixed the argdumper linker errors, but there's a problem.

OperatingSystemPython is linked into lldb-core, so when argdumper links against 
lldb-core.a, it tries to link OperatingSystemPython, which then requires we 
bring in everything else.  But we can't link API into lldb-core, so it doesn't 
work.

Is it possible to have OperatingSystemPython not be part of lldb-core, but 
instead be part of lldb-core-python or something?  This way argdumper could 
just link against lldb-core.a but not lldb-core-python.a, and lldb could link 
against both.

I don't know how to set this up in Xcode though.


http://reviews.llvm.org/D7957

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r231310 - Introduce lldbassert(x)

2015-03-04 Thread Zachary Turner
Doesn't LLVM already have this functionality built in?  How is this
different than writing:

  llvm::sys::PrintStackTraceOnErrorSignal();
  llvm::PrettyStackTraceProgram X(argc_, argv_);

in main?

On Wed, Mar 4, 2015 at 3:06 PM Enrico Granata  wrote:

> Author: enrico
> Date: Wed Mar  4 16:59:20 2015
> New Revision: 231310
>
> URL: http://llvm.org/viewvc/llvm-project?rev=231310&view=rev
> Log:
> Introduce lldbassert(x)
>
> We would like it if LLDB never crashed, especially if we never caused LLDB
> to crash
> On the other hand, having assertions can sometimes be useful
>
> lldbassert(x) is the best of both worlds:
> - in debug builds, it turns into a regular assert, which is fine because
> we don't mind debug LLDB to crash on development machines
> - in non-debug builds, it emits a message formatted just like assert(x)
> would, but then instead of crashing, it dumps a backtrace, suggests filing
> a bug, and keeps running
>
>
> Added:
> lldb/trunk/include/lldb/Utility/LLDBAssert.h
> lldb/trunk/source/Utility/LLDBAssert.cpp
> Modified:
> lldb/trunk/lldb.xcodeproj/project.pbxproj
>
> Added: lldb/trunk/include/lldb/Utility/LLDBAssert.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/
> lldb/Utility/LLDBAssert.h?rev=231310&view=auto
> 
> ==
> --- lldb/trunk/include/lldb/Utility/LLDBAssert.h (added)
> +++ lldb/trunk/include/lldb/Utility/LLDBAssert.h Wed Mar  4 16:59:20 2015
> @@ -0,0 +1,30 @@
> +//===- LLDBAssert.h *-
> C++ -*-===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===--
> ===//
> +
> +#ifndef utility_LLDBAssert_h_
> +#define utility_LLDBAssert_h_
> +
> +#include 
> +
> +#ifdef LLDB_CONFIGURATION_DEBUG
> +#define lldbassert(x) assert(x)
> +#else
> +#define lldbassert(x) lldb_private::lldb_assert(x, #x, __FUNCTION__,
> __FILE__, __LINE__)
> +#endif
> +
> +namespace lldb_private {
> +void
> +lldb_assert (int expression,
> + const char* expr_text,
> + const char* func,
> + const char* file,
> + unsigned int line);
> +}
> +
> +#endif // utility_LLDBAssert_h_
>
> Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.
> xcodeproj/project.pbxproj?rev=231310&r1=231309&r2=231310&view=diff
> 
> ==
> --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
> +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Mar  4 16:59:20 2015
> @@ -770,6 +770,7 @@
> 942AFF0719F84C02007B43B4 /* LibCxxInitializerList.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 942AFF0619F84C02007B43B4 /*
> LibCxxInitializerList.cpp */; };
> 94380B8219940B0A00BFE4A8 /* StringLexer.cpp in Sources */
> = {isa = PBXBuildFile; fileRef = 94380B8119940B0A00BFE4A8 /*
> StringLexer.cpp */; };
> 9439FB1A19EF140C006FD6A4 /* NSIndexPath.cpp in Sources */
> = {isa = PBXBuildFile; fileRef = 9439FB1919EF140C006FD6A4 /*
> NSIndexPath.cpp */; };
> +   943BDEFE1AA7B2F800789CE8 /* LLDBAssert.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = 943BDEFD1AA7B2F800789CE8 /* LLDBAssert.cpp
> */; };
> 944372DC171F6B4300E57C32 /* RegisterContextDummy.cpp in
> Sources */ = {isa = PBXBuildFile; fileRef = 944372DA171F6B4300E57C32 /*
> RegisterContextDummy.cpp */; };
> 944372DD171F6B4300E57C32 /* RegisterContextDummy.h in
> Headers */ = {isa = PBXBuildFile; fileRef = 944372DB171F6B4300E57C32 /*
> RegisterContextDummy.h */; };
> 9443B122140C18C40013457C /* SBData.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = 9443B121140C18C10013457C /* SBData.cpp */; };
> @@ -2397,6 +2398,8 @@
> 94380B8019940B0300BFE4A8 /* StringLexer.h */ = {isa =
> PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StringLexer.h;
> path = include/lldb/Utility/StringLexer.h; sourceTree = ""; };
> 94380B8119940B0A00BFE4A8 /* StringLexer.cpp */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp;
> name = StringLexer.cpp; path = source/Utility/StringLexer.cpp; sourceTree
> = ""; };
> 9439FB1919EF140C006FD6A4 /* NSIndexPath.cpp */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp;
> name = NSIndexPath.cpp; path = source/DataFormatters/NSIndexPath.cpp;
> sourceTree = ""; };
> +   943BDEFC1AA7B2DE00789CE8 /* LLDBAssert.h */ = {isa =
> PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LLDBAssert.h;
> path = include/lldb/Utility/LLDBAssert.h; sourceTree = ""; };
> +

Re: [Lldb-commits] [PATCH] Python split [1/2] - File renames

2015-03-04 Thread Zachary Turner
In http://reviews.llvm.org/D7956#134403, @clayborg wrote:

> It seems like "lldb/Interpreter/ScriptInterpreter.h" still exists in your 
> tree and you are able to compile because it is still there? It isn't there 
> for me and there are 20 locations that are still trying to include it.
>
> After fixing 100 or so build errors I am giving up on this patch. Please try 
> to make it work for MacOSX. The major issues are:
>
> - There is no need to create a new "include/lldb/ScriptInterpreter" directory 
> it will just make merges very hard for us and it gains us nothing since only 
> abstract virtual classes should be in there (and a default implementation for 
> None)


So leave it in Interpreter?  I'm fine with that, I just don't want it to be 
under the API folder, since it should be accessible even when API is not built.

> - Where ever there is a #ifndef LLDB_DISABLE_PYTHON, this will need to be 
> abstracted to go through the abstract ScriptInterpreter class for the current 
> language.


Agree, but this is a MUCH larger change, and I wanted to take the steps 
incrementally.  That has been the end goal all along, but it's too much to do 
all at once.

> - No one should be including ScriptInterpreterPython.h anywhere, they should 
> just use the current ScriptInterpreter subclass gotten from the interpreter 
> and anything that was being done using a special version of this class should 
> be abstracted through ScriptInterpreter


Same as before, I agree, but that's a much larger change.  This is only 
intended to be a first step.

> - cases like ProcessGDBRemote::ParsePythonTargetDefinition(const FileSpec 
> &target_definition_fspec) should find the script interpreter for the target 
> definition file and call through the abstract ScriptInterpreter class to 
> parse it  somehow


Same as before.


http://reviews.llvm.org/D7956

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Python Split [2/2] - Content change

2015-03-04 Thread Zachary Turner
Rebase against ToT


http://reviews.llvm.org/D7957

Files:
  cmake/LLDBDependencies.cmake
  cmake/modules/LLDBConfig.cmake
  include/lldb/API/SBBreakpointLocation.h
  include/lldb/API/SBCommandInterpreter.h
  include/lldb/API/SBFrame.h
  include/lldb/API/bindings/Python/ScriptInterpreterPython.h
  include/lldb/DataFormatters/TypeSummary.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/ScriptInterpreter/ScriptInterpreter.h
  include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
  include/lldb/lldb-forward.h
  source/API/Bindings/CMakeLists.txt
  source/API/Bindings/Python/CMakeLists.txt
  source/API/Bindings/Python/PythonDataObjects.cpp
  source/API/Bindings/Python/ScriptInterpreterPython.cpp
  source/API/CMakeLists.txt
  source/API/SBBreakpoint.cpp
  source/API/SBBreakpointLocation.cpp
  source/API/SBCommandInterpreter.cpp
  source/API/SBDebugger.cpp
  source/API/SBTypeCategory.cpp
  source/CMakeLists.txt
  source/Commands/CommandObjectCommands.cpp
  source/Core/Module.cpp
  source/Core/ValueObject.cpp
  source/DataFormatters/FormatManager.cpp
  source/DataFormatters/TypeSynthetic.cpp
  source/Interpreter/CMakeLists.txt
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectScript.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/ScriptInterpreter/CMakeLists.txt
  source/ScriptInterpreter/ScriptInterpreter.cpp
  source/ScriptInterpreter/ScriptInterpreterNone.cpp
  source/Target/ThreadPlanPython.cpp
  source/lldb.cpp
  tools/driver/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -56,6 +56,7 @@
   lldbPluginSystemRuntimeMacOSX
   lldbPluginProcessElfCore
   lldbPluginJITLoaderGDB
+  lldbScriptInterpreter
   )
 
 # Windows-only libraries
@@ -107,6 +108,10 @@
 )
 endif()
 
+if (NOT LLDB_DISABLE_PYTHON)
+  list(APPEND LLDB_USED_LIBS lldbPythonInterpreter)
+endif()
+
 set( CLANG_USED_LIBS
   clangAnalysis
   clangAST
Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -25,7 +25,7 @@
   "Enables using new Python scripts for SWIG API generation .")  
 
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
-set(LLDB_INCLUDE_ROOT "${LLDB_INCLUDE_ROOT}/include")
+set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
 
 set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting integration.")
 
Index: include/lldb/API/SBBreakpointLocation.h
===
--- include/lldb/API/SBBreakpointLocation.h
+++ include/lldb/API/SBBreakpointLocation.h
@@ -101,9 +101,6 @@
 
 private:
 friend class SBBreakpoint;
-#ifndef LLDB_DISABLE_PYTHON
-friend class lldb_private::ScriptInterpreterPython;
-#endif
 void
 SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
 
Index: include/lldb/API/SBCommandInterpreter.h
===
--- include/lldb/API/SBCommandInterpreter.h
+++ include/lldb/API/SBCommandInterpreter.h
@@ -229,9 +229,6 @@
 private:
 friend class SBDebugger;
 
-static void
-InitializeSWIG ();
-
 lldb_private::CommandInterpreter *m_opaque_ptr;
 };
 
Index: include/lldb/API/SBFrame.h
===
--- include/lldb/API/SBFrame.h
+++ include/lldb/API/SBFrame.h
@@ -213,9 +213,6 @@
 friend class SBInstruction;
 friend class SBThread;
 friend class SBValue;
-#ifndef LLDB_DISABLE_PYTHON
-friend class lldb_private::ScriptInterpreterPython;
-#endif
 
 lldb::StackFrameSP
 GetFrameSP() const;
Index: include/lldb/API/bindings/Python/ScriptInterpreterPython.h
===
--- include/lldb/API/bindings/Python/ScriptInterpreterPython.h
+++ include/lldb/API/bindings/Python/ScriptInterpreterPython.h
@@ -20,8 +20,8 @@
 #include "lldb/lldb-python.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/IOHandler.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
 #include "lldb/Host/Terminal.h"
 
 class IOHandlerPythonInterpreter;
@@ -288,32 +288,6 @@
 static void
 InitializePrivate ();
 
-static void
-InitializeInterpreter (SWIGInitCallback python_swig_

[Lldb-commits] [lldb] r231263 - Don't #include clang headers from BreakpointLocation.h

2015-03-04 Thread Zachary Turner
Author: zturner
Date: Wed Mar  4 11:43:00 2015
New Revision: 231263

URL: http://llvm.org/viewvc/llvm-project?rev=231263&view=rev
Log:
Don't #include clang headers from BreakpointLocation.h

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
lldb/trunk/include/lldb/Expression/ClangUserExpression.h
lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/trunk/source/Breakpoint/BreakpointSite.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=231263&r1=231262&r2=231263&view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Wed Mar  4 11:43:00 
2015
@@ -21,11 +21,8 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
 #include "lldb/Core/Address.h"
-#include "lldb/Core/StringList.h"
 #include "lldb/Core/UserID.h"
 #include "lldb/Host/Mutex.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Expression/ClangUserExpression.h"
 
 namespace lldb_private {
 
@@ -464,7 +461,7 @@ private:
 Breakpoint &m_owner; ///< The breakpoint that produced this object.
 std::unique_ptr m_options_ap; ///< Breakpoint options 
pointer, NULL if we're using our breakpoint's options.
 lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be 
shared by more than one location.)
-ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; ///< The 
compiled expression to use in testing our condition.
+lldb::ClangUserExpressionSP m_user_expression_sp; ///< The compiled 
expression to use in testing our condition.
 Mutex m_condition_mutex; ///< Guards parsing and evaluation of the 
condition, which could be evaluated by multiple processes.
 size_t m_condition_hash; ///< For testing whether the condition source 
code changed.
 

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=231263&r1=231262&r2=231263&view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Wed Mar  4 11:43:00 2015
@@ -18,7 +18,7 @@
 // Other libraries and framework includes
 
 // Project includes
-#include "lldb/lldb-private.h"
+#include "lldb/lldb-forward.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Core/UserID.h"
 #include "lldb/Breakpoint/StoppointLocation.h"

Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=231263&r1=231262&r2=231263&view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Wed Mar  4 
11:43:00 2015
@@ -45,8 +45,7 @@ namespace lldb_private
 class ClangUserExpression : public ClangExpression
 {
 public:
-typedef std::shared_ptr ClangUserExpressionSP;
-
+   
 enum { kDefaultTimeout = 50u };
 //--
 /// Constructor
@@ -146,7 +145,7 @@ public:
 Execute (Stream &error_stream,
  ExecutionContext &exe_ctx,
  const EvaluateExpressionOptions& options,
- ClangUserExpressionSP &shared_ptr_to_me,
+ lldb::ClangUserExpressionSP &shared_ptr_to_me,
  lldb::ClangExpressionVariableSP &result);
  
 //--

Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h?rev=231263&r1=231262&r2=231263&view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h Wed Mar  4 
11:43:00 2015
@@ -15,7 +15,6 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Expression/ClangUserExpression.h"
 #include "lldb/

[Lldb-commits] [lldb] r231202 - Further reduce header footprint of Debugger.h.

2015-03-03 Thread Zachary Turner
Author: zturner
Date: Tue Mar  3 19:58:01 2015
New Revision: 231202

URL: http://llvm.org/viewvc/llvm-project?rev=231202&view=rev
Log:
Further reduce header footprint of Debugger.h.

Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectApropos.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/SourceManager.cpp
lldb/trunk/source/Core/UserSettingsController.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=231202&r1=231201&r2=231202&view=diff
==
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Tue Mar  3 19:58:01 2015
@@ -14,11 +14,8 @@
 
 #include 
 
-#include 
-
 #include "lldb/lldb-public.h"
 #include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Communication.h"
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/Listener.h"
@@ -27,8 +24,6 @@
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/Terminal.h"
-#include "lldb/Interpreter/OptionValueProperties.h"
-#include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/TargetList.h"
 

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=231202&r1=231201&r2=231202&view=diff
==
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Tue Mar  3 19:58:01 2015
@@ -10,6 +10,7 @@
 #include "lldb/lldb-python.h"
 
 #include "lldb/lldb-types.h"
+#include "lldb/Core/Communication.h"
 #include "lldb/Core/SourceManager.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Interpreter/CommandInterpreter.h"

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=231202&r1=231201&r2=231202&view=diff
==
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Tue Mar  3 19:58:01 2015
@@ -25,6 +25,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Target/Target.h"

Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=231202&r1=231201&r2=231202&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Tue Mar  3 19:58:01 2015
@@ -17,6 +17,7 @@
 // Project includes
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/Property.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"

Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=231202&r1=231201&r2=231202&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Tue Mar  3 19:58:01 
2015
@@ -18,6 +18,7 @@
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/CommandCompletions.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
 
 using namespace lldb;
 using namespace lldb_private;

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=231202&r1=231201&r2=231202&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Mar  3 19:58:01 2015
@@ -39,6 +39,7 @@
 #include "lldb/Ho

[Lldb-commits] [lldb] r231145 - Further reduce the header footprint of Process.h

2015-03-03 Thread Zachary Turner
Author: zturner
Date: Tue Mar  3 15:51:25 2015
New Revision: 231145

URL: http://llvm.org/viewvc/llvm-project?rev=231145&view=rev
Log:
Further reduce the header footprint of Process.h

No functional change here, only deletes unnecessary headers
and moves one function's body from the .h file to the .cpp.

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=231145&r1=231144&r2=231145&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Mar  3 15:51:25 2015
@@ -28,33 +28,26 @@
 #include "lldb/Core/Communication.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Event.h"
-#include "lldb/Core/RangeMap.h"
-#include "lldb/Core/StringList.h"
 #include "lldb/Core/ThreadSafeValue.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Breakpoint/BreakpointSiteList.h"
-#include "lldb/Expression/IRDynamicChecks.h"
-#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/ProcessRunLock.h"
-#include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContextScope.h"
-#include "lldb/Target/JITLoaderList.h"
 #include "lldb/Target/Memory.h"
-#include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/ProcessInfo.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 #include "lldb/Target/QueueList.h"
 #include "lldb/Target/ThreadList.h"
-#include "lldb/Target/UnixSignals.h"
-#include "lldb/Utility/PseudoTerminal.h"
 #include "lldb/Target/InstrumentationRuntime.h"
 
 namespace lldb_private {
 
+template 
+struct Range;
+
 //--
 // ProcessProperties
 //--
@@ -1369,18 +1362,10 @@ public:
 Signal (int signal);
 
 void
-SetUnixSignals (const UnixSignalsSP &signals_sp)
-{
-assert (signals_sp && "null signals_sp");
-m_unix_signals_sp = signals_sp;
-}
+SetUnixSignals (const UnixSignalsSP &signals_sp);
 
 UnixSignals &
-GetUnixSignals ()
-{
-assert (m_unix_signals_sp && "null m_unix_signals_sp");
-return *m_unix_signals_sp;
-}
+GetUnixSignals ();
 
 //==
 // Plug-in Process Control Overrides
@@ -2398,33 +2383,8 @@ public:
 /// Returns true if it was able to determine the attributes of the
 /// memory region.  False if not.
 //--
-
 virtual bool
-GetLoadAddressPermissions (lldb::addr_t load_addr, uint32_t &permissions)
-{
-MemoryRegionInfo range_info;
-permissions = 0;
-Error error (GetMemoryRegionInfo (load_addr, range_info));
-if (!error.Success())
-return false;
-if (range_info.GetReadable() == MemoryRegionInfo::eDontKnow 
-|| range_info.GetWritable() == MemoryRegionInfo::eDontKnow 
-|| range_info.GetExecutable() == MemoryRegionInfo::eDontKnow)
-{
-return false;
-}
-
-if (range_info.GetReadable() == MemoryRegionInfo::eYes)
-permissions |= lldb::ePermissionsReadable;
-
-if (range_info.GetWritable() == MemoryRegionInfo::eYes)
-permissions |= lldb::ePermissionsWritable;
-
-if (range_info.GetExecutable() == MemoryRegionInfo::eYes)
-permissions |= lldb::ePermissionsExecutable;
-
-return true;
-}
+GetLoadAddressPermissions (lldb::addr_t load_addr, uint32_t &permissions);
 
 //--
 /// Determines whether executing JIT-compiled code in this process 
@@ -2905,10 +2865,7 @@ public:
 return m_dynamic_checkers_ap.get();
 }
 
-void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers)
-{
-m_dynamic_checkers_ap.reset(dynamic_checkers);
-}
+void SetDynamicCheckers(DynamicCheckerFuncti

[Lldb-commits] [lldb] r231131 - Don't #include ClangPersistentVariables.h from Process.h

2015-03-03 Thread Zachary Turner
Author: zturner
Date: Tue Mar  3 15:05:17 2015
New Revision: 231131

URL: http://llvm.org/viewvc/llvm-project?rev=231131&view=rev
Log:
Don't #include ClangPersistentVariables.h from Process.h

Nothing from this header file was even being referenced in
Process.h anyway, so it was a completely unnecessary include.

Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Expression/Materializer.cpp

lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_arm64.cpp

lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp

lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_powerpc.cpp

lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp
lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
lldb/trunk/source/Target/ABI.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=231131&r1=231130&r2=231131&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Mar  3 15:05:17 2015
@@ -16,6 +16,7 @@
 #include 
 
 // Other libraries and framework includes
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 
 // Project includes
@@ -26,6 +27,7 @@
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/UserID.h"
 #include "lldb/Core/Value.h"
+#include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/Target/Process.h"

Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=231131&r1=231130&r2=231131&view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Tue Mar  3 15:05:17 2015
@@ -22,6 +22,7 @@
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Expression/ClangExpression.h"
+#include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Target/Process.h"
 
 namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=231131&r1=231130&r2=231131&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Mar  3 15:05:17 2015
@@ -34,7 +34,6 @@
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Breakpoint/BreakpointSiteList.h"
-#include "lldb/Expression/ClangPersistentVariables.h"
 #include "lldb/Expression/IRDynamicChecks.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/Host.h"

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=231131&r1=231130&r2=231131&view=diff
==
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Tue Mar  3 15:05:17 2015
@@ -21,6 +21,7 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/ValueObjectRegister.h"
 #include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/Expression/ClangPersistentVariables.h"
 #include "lldb/Expression/ClangUserExpression.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Symbol/Block.h"

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=231131&r1=231130&r2=231131&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Mar  3 15:05:17 2015
@@ -24,6 +24,7 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObjectMemory.h"
 #include "lldb/DataFormatters/ValueObjectPrinter.h"
+#include "lldb/Expression/ClangPersistentVariables.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandReturnObject.h"

Modified: lldb/trunk/source/Core

[Lldb-commits] [lldb] r231107 - Reduce header footprint of Target.h

2015-03-03 Thread Zachary Turner
Author: zturner
Date: Tue Mar  3 13:23:09 2015
New Revision: 231107

URL: http://llvm.org/viewvc/llvm-project?rev=231107&view=rev
Log:
Reduce header footprint of Target.h

This continues the effort to reduce header footprint and improve
build speed by removing clang and other unnecessary headers
from Target.h.  In one case, some headers were included solely
for the purpose of declaring a nested class in Target, which was
not needed by anybody outside the class.  In this case the
definition and implementation of the nested class were isolated
in the .cpp file so the header could be removed.

Modified:
lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
lldb/trunk/include/lldb/Expression/ClangASTSource.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandObjectArgs.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp

lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp

lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
lldb/trunk/source/Target/ThreadPlanStepOut.cpp
lldb/trunk/source/Target/ThreadPlanTracer.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Watchpoint.h?rev=231107&r1=231106&r2=231107&view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/Watchpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h Tue Mar  3 13:23:09 2015
@@ -20,10 +20,11 @@
 
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Core/UserID.h"
 #include "lldb/Breakpoint/WatchpointOptions.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Core/UserID.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/Target.h"
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=231107&r1=231106&r2=231107&view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Tue Mar  3 13:23:09 2015
@@ -15,6 +15,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
 #include "lldb/Symbol/ClangASTImporter.h"
+#include "lldb/Symbol/ClangASTType.h"
 #include "lldb/Target/Target.h"
 
 #include "llvm/ADT/SmallSet.h"

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=231107&r1=231106&r2=231107&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Mar  3 13:23:09 2015
@@ -18,22 +18,12 @@
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Breakpoint/BreakpointList.h"
-#include "lldb/Breakpoint/BreakpointLocationCollection.h"
 #include "lldb/Breakpoint/WatchpointList.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Disassembler.h"
-#include "lldb/Core/Event.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/UserSettingsController.h"
-#include "lldb/Expression/ClangModulesDeclVendor.h"
-#include "lldb/Expression/ClangPersistentVariables.h"
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/OptionValueBoolean.h"
-#include "lldb/Interpreter/OptionValueEnumeration.h"
-#include "lldb/Interpreter/OptionValueFileSpec.h"
-#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/ABI.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/Target/PathMappingList.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
@@ -228,8 +218,6 @@ private:
 ProcessLaunchInfo m_launch_info;
 };
 
-typedef std:

Re: [Lldb-commits] [PATCH] Reduce header footprint of Module.h

2015-03-03 Thread Zachary Turner
Yea I don't plan to impl entire classes.  If I end up with any patches that
I'm unsure about, I'll upload them for you to look at first.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8022

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r231097 - Don't #include ClangASTContext.h from Module.h

2015-03-03 Thread Zachary Turner
Author: zturner
Date: Tue Mar  3 12:34:26 2015
New Revision: 231097

URL: http://llvm.org/viewvc/llvm-project?rev=231097&view=rev
Log:
Don't #include ClangASTContext.h from Module.h

This is part of a larger effort to reduce header file footprints.
Combined, these patches reduce the build time of LLDB locally by
over 30%.  However, they touch many files and make many changes,
so will be submitted in small incremental pieces.

Reviewed By: Greg Clayton
Differential Revision: http://reviews.llvm.org/D8022

Modified:
lldb/trunk/include/lldb/Core/ArchSpec.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Host/common/Symbols.cpp

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=231097&r1=231096&r2=231097&view=diff
==
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Tue Mar  3 12:34:26 2015
@@ -12,9 +12,8 @@
 
 #if defined(__cplusplus)
 
-#include "lldb/lldb-private.h"
+#include "lldb/lldb-forward.h"
 #include "lldb/Core/ConstString.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
 
 namespace lldb_private {
@@ -290,44 +289,6 @@ public:
 //--
 void
 MergeFrom(const ArchSpec &other);
-
-//--
-/// Sets this ArchSpec according to the given architecture name.
-///
-/// The architecture name can be one of the generic system default
-/// values:
-///
-/// @li \c LLDB_ARCH_DEFAULT - The arch the current system defaults
-///to when a program is launched without any extra
-///attributes or settings.
-/// @li \c LLDB_ARCH_DEFAULT_32BIT - The default host architecture
-///for 32 bit (if any).
-/// @li \c LLDB_ARCH_DEFAULT_64BIT - The default host architecture
-///for 64 bit (if any).
-///
-/// Alternatively, if the object type of this ArchSpec has been
-/// configured,  a concrete architecture can be specified to set
-/// the CPU type ("x86_64" for example).
-///
-/// Finally, an encoded object and archetecture format is accepted.
-/// The format contains an object type (like "macho" or "elf"),
-/// followed by a platform dependent encoding of CPU type and
-/// subtype.  For example:
-///
-/// "macho": Specifies an object type of MachO.
-/// "macho-16-6"   : MachO specific encoding for ARMv6.
-/// "elf-43: ELF specific encoding for Sparc V9.
-///
-/// @param[in] arch_name The name of an architecture.
-///
-/// @return True if @p arch_name was successfully translated, false
-/// otherwise.
-//--
-//bool
-//SetArchitecture (const llvm::StringRef& arch_name);
-//
-//bool
-//SetArchitecture (const char *arch_name);
 
 //--
 /// Change the architecture object type and CPU type.

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=231097&r1=231096&r2=231097&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Mar  3 12:34:26 2015
@@ -10,12 +10,12 @@
 #ifndef liblldb_Module_h_
 #define liblldb_Module_h_
 
+#include "lldb/lldb-forward.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Host/TimeValue.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/SymbolContextScope.h"
 #include "lldb/Target/PathMappingList.h"
 
@@ -1098,7 +1098,7 @@ protected:
 mutable Mutex   m_mutex;///< A mutex to keep this 
object happy in multi-threaded environments.
 TimeValue   m_mod_time; ///< The modification time for 
this module when it was created.
 ArchSpecm_arch; ///< The architecture for this 
module.
-lldb_private::UUID  m_uuid; ///< Each module is assumed to 
have a unique identifier to help match it up to debug symbols.
+UUIDm_uuid; ///< Each module is assumed to 
have a unique identifier to help match it up to debug symbols.
 FileSpe

[Lldb-commits] [lldb] r230983 - [Windows] Fix getcwd() on Windows.

2015-03-02 Thread Zachary Turner
Author: zturner
Date: Mon Mar  2 12:33:50 2015
New Revision: 230983

URL: http://llvm.org/viewvc/llvm-project?rev=230983&view=rev
Log:
[Windows] Fix getcwd() on Windows.

Windows doesn't define getcwd(), so this test executable failed
to compile.

Patch by Adrian McCarthy
Differential Revision: http://reviews.llvm.org/D7962

Modified:
lldb/trunk/test/functionalities/process_launch/print_cwd.cpp

Modified: lldb/trunk/test/functionalities/process_launch/print_cwd.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_launch/print_cwd.cpp?rev=230983&r1=230982&r2=230983&view=diff
==
--- lldb/trunk/test/functionalities/process_launch/print_cwd.cpp (original)
+++ lldb/trunk/test/functionalities/process_launch/print_cwd.cpp Mon Mar  2 
12:33:50 2015
@@ -1,5 +1,13 @@
 #include 
+
+#ifdef _MSC_VER
+#define _CRT_NONSTDC_NO_WARNINGS
+#include 
+#undef getcwd
+#define getcwd(buffer, length) _getcwd(buffer, length)
+#else
 #include 
+#endif
 
 int
 main (int argc, char **argv)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Python Split [2/2] - Content change

2015-02-27 Thread Zachary Turner
Attempt 2, formatting issues should be fixed.


http://reviews.llvm.org/D7957

Files:
  CMakeLists.txt
  cmake/LLDBDependencies.cmake
  include/lldb/API/SBBreakpointLocation.h
  include/lldb/API/SBCommandInterpreter.h
  include/lldb/API/SBFrame.h
  include/lldb/API/bindings/Python/ScriptInterpreterPython.h
  include/lldb/DataFormatters/TypeSummary.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/ScriptInterpreter/ScriptInterpreter.h
  include/lldb/ScriptInterpreter/ScriptInterpreterNone.h
  include/lldb/lldb-forward.h
  source/API/Bindings/CMakeLists.txt
  source/API/Bindings/Python/CMakeLists.txt
  source/API/Bindings/Python/PythonDataObjects.cpp
  source/API/Bindings/Python/ScriptInterpreterPython.cpp
  source/API/CMakeLists.txt
  source/API/SBBreakpoint.cpp
  source/API/SBBreakpointLocation.cpp
  source/API/SBCommandInterpreter.cpp
  source/API/SBDebugger.cpp
  source/API/SBTypeCategory.cpp
  source/CMakeLists.txt
  source/Commands/CommandObjectCommands.cpp
  source/Core/Module.cpp
  source/Core/ValueObject.cpp
  source/DataFormatters/FormatManager.cpp
  source/DataFormatters/TypeSynthetic.cpp
  source/Interpreter/CMakeLists.txt
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectScript.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/ScriptInterpreter/CMakeLists.txt
  source/ScriptInterpreter/ScriptInterpreter.cpp
  source/ScriptInterpreter/ScriptInterpreterNone.cpp
  source/Target/ThreadPlanPython.cpp
  source/lldb.cpp
  tools/driver/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -25,7 +25,7 @@
   "Enables using new Python scripts for SWIG API generation .")  
 
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
-set(LLDB_INCLUDE_ROOT "${LLDB_INCLUDE_ROOT}/include")
+set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
 
 # If we are not building as a part of LLVM, build LLDB as an
 # standalone project, using LLVM as an external library:
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -53,6 +53,7 @@
   lldbPluginOSPython
   lldbPluginMemoryHistoryASan
   lldbPluginInstrumentationRuntimeAddressSanitizer
+  lldbScriptInterpreter
   )
 
 # Windows-only libraries
@@ -107,6 +108,10 @@
 )
 endif()
 
+if (NOT LLDB_DISABLE_PYTHON)
+  list(APPEND LLDB_USED_LIBS lldbPythonInterpreter)
+endif()
+
 set( CLANG_USED_LIBS
   clangAnalysis
   clangAST
Index: include/lldb/API/SBBreakpointLocation.h
===
--- include/lldb/API/SBBreakpointLocation.h
+++ include/lldb/API/SBBreakpointLocation.h
@@ -101,9 +101,6 @@
 
 private:
 friend class SBBreakpoint;
-#ifndef LLDB_DISABLE_PYTHON
-friend class lldb_private::ScriptInterpreterPython;
-#endif
 void
 SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
 
Index: include/lldb/API/SBCommandInterpreter.h
===
--- include/lldb/API/SBCommandInterpreter.h
+++ include/lldb/API/SBCommandInterpreter.h
@@ -229,9 +229,6 @@
 private:
 friend class SBDebugger;
 
-static void
-InitializeSWIG ();
-
 lldb_private::CommandInterpreter *m_opaque_ptr;
 };
 
Index: include/lldb/API/SBFrame.h
===
--- include/lldb/API/SBFrame.h
+++ include/lldb/API/SBFrame.h
@@ -213,9 +213,6 @@
 friend class SBInstruction;
 friend class SBThread;
 friend class SBValue;
-#ifndef LLDB_DISABLE_PYTHON
-friend class lldb_private::ScriptInterpreterPython;
-#endif
 
 lldb::StackFrameSP
 GetFrameSP() const;
Index: include/lldb/API/bindings/Python/ScriptInterpreterPython.h
===
--- include/lldb/API/bindings/Python/ScriptInterpreterPython.h
+++ include/lldb/API/bindings/Python/ScriptInterpreterPython.h
@@ -20,8 +20,8 @@
 #include "lldb/lldb-python.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/IOHandler.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/PythonDataObjects.h"
+#include "lldb/ScriptInterpreter/ScriptInterpreter.h"
+#include "lldb/API/Bindings/Python/PythonDataObjects.h"
 #include "lldb/Host/Terminal.h"
 
 class IOHandlerPythonInterpreter;
@@ -288,32 +288,6 @@
 static void
 InitializePrivate ();
 
-static void
-InitializeInterpreter (SWIGInitCallba

[Lldb-commits] [lldb] r230522 - Fix warnings found with clang-cl.

2015-02-25 Thread Zachary Turner
Author: zturner
Date: Wed Feb 25 12:42:47 2015
New Revision: 230522

URL: http://llvm.org/viewvc/llvm-project?rev=230522&view=rev
Log:
Fix warnings found with clang-cl.

Earlier this week I was able to get clang-cl on Windows to be
able to self host.  This opened the door to being able to
get a whole new slew of warnings for the Windows build.

This patch fixes all of the warnings, many of which were real
bugs.

Modified:
lldb/trunk/include/lldb/API/SBCommunication.h
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/Core/Communication.h
lldb/trunk/include/lldb/Host/OptionParser.h
lldb/trunk/include/lldb/Host/Socket.h
lldb/trunk/include/lldb/Host/msvc/Config.h
lldb/trunk/include/lldb/Host/windows/getopt/GetOptInc.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/Target/SectionLoadHistory.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Host/common/OptionParser.cpp
lldb/trunk/source/Host/common/Socket.cpp
lldb/trunk/source/Host/common/Terminal.cpp
lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
lldb/trunk/source/Host/windows/EditLineWin.cpp
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Host/windows/ThisThread.cpp
lldb/trunk/source/Host/windows/getopt/GetOptInc.cpp
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
lldb/trunk/source/Plugins/Process/Windows/DebuggerThread.cpp
lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h
lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/TargetThreadWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Utility/PseudoTerminal.cpp

Modified: lldb/trunk/include/lldb/API/SBCommunication.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommunication.h?rev=230522&r1=230521&r2=230522&view=diff
==
--- lldb/trunk/include/lldb/API/SBCommunication.h (original)
+++ lldb/trunk/include/lldb/API/SBCommunication.h Wed Feb 25 12:42:47 2015
@@ -18,7 +18,7 @@ namespace lldb {
 class LLDB_API SBCommunication
 {
 public:
-enum {
+enum : unsigned {
 eBroadcastBitDisconnected   = (1 << 0), ///< Sent when the 
communications connection is lost.
 eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read 
thread when bytes become available.
 eBroadcastBitReadThreadDidExit  = (1 << 2), ///< Sent by the read 
thread when it exits to inform clients.

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=230522&r1=230521&r2=230522&view=diff
==
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Wed Feb 25 12:42:47 2015
@@ -21,7 +21,6 @@ namespace lldb {
 
 class LLDB_API SBValue
 {
-friend class ValueLocker;
 
 public:
 SBValue ();

Modified: lldb/trunk/include/lldb/Core/Communication.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=230522&r1=230521&r2=230522&view=diff
==
--- lldb/trunk/include/lldb/Core/Communication.h (original)
+++ lldb/trunk/include/lldb/Core/Communication.h Wed Feb 25 12:42:47 2015
@@ -85,14 +85,14 @@ namespace lldb_private {
 class Communication : public Broadcaster
 {
 public:
-enum {
-eBroadcastBitDisconnected   = (1 << 0), ///< Sent when the 
communications connection is lost.
-eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read 
thread when bytes become available.
-eBroadcastBitReadThreadDidExit  = (1 << 2), ///< Sent by the read 
thread when it exits to inform clients.
-eBroadcastBitReadThreadShouldExit   = (1 << 3), ///< Sent by clients 
that need to cancel the read thread.
-eBroadcastBitPacketAvailable= (1 << 4), ///< Sent when data 
received makes a complete packet.
-kLoUserBroadcastBit = (1 << 16),///< Subclasses can 
used bits 31:16 for any needed events.
-kHiUserBroadcastBit = (1 << 31),
+enum : unsigned {
+eBroadcastBitDisconnected   = (1u << 0), ///< Sent when the 
communications connection is lost.
+eBroadcastBitReadThreadGotBytes = (1u << 1), ///< Sent by the read 
thread when bytes become available.
+eBroadcastBitReadThreadDidExit  = (1u << 2), ///< Sent by the read 
thread when it exits to inform clients.
+eBroadcastBitReadThreadShouldExit   = (1u << 3), ///< Sent by clients 
that need to cancel the read

Re: [Lldb-commits] [PATCH] Move the shell expansion code to Host/common

2015-02-25 Thread Zachary Turner
Well, I agree in principle that the API is meant to support process
launching.  But if its utility can be trivially extended to support other
use cases, then why not?

FWIW, when I decided to do this, it was only to enable the functionality
for other platforms (i.e. moving from specific dirs to common), because
only Windows is going to have a different codepath here so it didn't make
sense to increase the code debt for everyone just because of Windows.  Then
changing of the signature was just something I noticed on the side.  I can
change it back if people feel strongly, but at the same time, I really like
making code as general as possible, as long as the generality doesn't
hinder the readability or usability for the primary use case (which in this
case I don't think it does)

On Wed, Feb 25, 2015 at 10:24 AM Enrico Granata  wrote:

> -
> -void
> -SetShellExpandArguments (bool glob);
> -
> +
> +void SetShellExpandArguments(bool expand);
> +
>
> Yes, totally
>
> -static Error
> -ShellExpandArguments (ProcessLaunchInfo &launch_info);
> -
> +static Error ShellExpandArguments(llvm::StringRef input,
> llvm::StringRef working_dir, std::vector &expanded);
> +
>
> Why? I see no benefit to doing this. This API is clearly meant to support
> process launching. This change seems a net loss to me.
>
> The actual moving of the argdumper logic to Host/common is fine (as long
> as the mechanism for individual platforms to opt out is trivial, that is) -
> the change in signature from ProcessLaunchInfo to bunch-of-stuff not so much
>
> -if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments))
>
> This should be fine do to do, yes
>
> On Feb 24, 2015, at 7:31 PM, Zachary Turner  wrote:
>
> Anyone have thoughts on this?  If there's no suggestions I'd like to
> commit, but I'll give another day or two for comments.
>
>
> http://reviews.llvm.org/D7805
>
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
> Thanks,
> *- Enrico*
> 📩 egranata@.com ☎️ 27683
>
>
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r230389 - Resubmit "[CMake] Change lldbAPI to be a CMake OBJECT library."

2015-02-24 Thread Zachary Turner
Author: zturner
Date: Tue Feb 24 16:17:57 2015
New Revision: 230389

URL: http://llvm.org/viewvc/llvm-project?rev=230389&view=rev
Log:
Resubmit "[CMake] Change lldbAPI to be a CMake OBJECT library."

This resubmits r230380.  The primary cause of the failure was
actually just a warning, which we can disable at the CMake level
in a followup patch on the LLVM side.  The other thing which was
actually an error on the bot should be able to be fixed with
a clean.

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/LLDBDependencies.cmake
lldb/trunk/source/API/CMakeLists.txt
lldb/trunk/source/CMakeLists.txt
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=230389&r1=230388&r2=230389&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue Feb 24 16:17:57 2015
@@ -111,9 +111,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 endif()
 
 set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting 
integration.")
-if (LLDB_DISABLE_PYTHON)
-  add_definitions( -DLLDB_DISABLE_PYTHON )
-endif()
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
@@ -139,9 +136,10 @@ if (NOT LLDB_DISABLE_PYTHON)
 endif()
   endif()
   if (MSVC)
-if (PYTHON_INCLUDE_DIR STREQUAL "" OR PYTHON_LIBRARY STREQUAL "")
-  message(FATAL_ERROR "Building on MSVC requires manual specification of "
-  "PYTHON_INCLUDE_DIR and PYTHON_LIBRARY")
+if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL "")
+  message("-- LLDB Embedded python disabled.  Embedding python on Windows 
requires "
+  "manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
+  set(LLDB_DISABLE_PYTHON 1)
 else()
   message("-- Found PythonLibs: ${PYTHON_LIBRARY}")
   include_directories(${PYTHON_INCLUDE_DIR})
@@ -152,6 +150,12 @@ if (NOT LLDB_DISABLE_PYTHON)
   endif()
 endif()
 
+if (LLDB_DISABLE_PYTHON)
+  unset(PYTHON_INCLUDE_DIR)
+  unset(PYTHON_LIBRARY)
+  add_definitions( -DLLDB_DISABLE_PYTHON )
+endif()
+
 include_directories(../clang/include)
 include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
@@ -251,12 +255,12 @@ macro(add_lldb_library name)
   # only supported parameters to this macro are the optional 
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
-"MODULE;SHARED;STATIC"
+"MODULE;SHARED;STATIC;OBJECT"
 ""
 ""
 ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
-  
+
   if (MSVC_IDE OR XCODE)
 string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
 list(GET split_path -1 dir)
@@ -270,6 +274,8 @@ macro(add_lldb_library name)
 set(libkind SHARED)
   elseif (PARAM_STATIC)
 set(libkind STATIC)
+  elseif (PARAM_OBJECT)
+set(libkind OBJECT)
   else ()
 # library type unspecified - controlled by BUILD_SHARED_LIBS
 unset(libkind)
@@ -279,45 +285,43 @@ macro(add_lldb_library name)
   if (NOT MSVC)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
   endif()
-  llvm_add_library(${name} ${libkind} ${srcs})
-  #if (LLVM_COMMON_DEPENDS)
-  ##add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
-  #endif()
 
-  if ("${libkind}" STREQUAL "STATIC")
-set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
-  else ()
-set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
-  endif ()
+  if (PARAM_OBJECT)
+add_library(${name} ${libkind} ${srcs})
+  else()
+llvm_add_library(${name} ${libkind} ${srcs})
 
-  if(LLDB_USED_LIBS)
-# The Darwin linker doesn't understand --start-group/--end-group.
-if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES 
"Darwin")
-  target_link_libraries(${name} ${lldb_library_keyword}
--Wl,--start-group ${LLDB_USED_LIBS} 
-Wl,--end-group)
-else()
-  target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS})
+if (PARAM_STATIC)
+  set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
+else ()
+  set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
+endif ()
+
+if(LLDB_USED_LIBS)
+  # The Darwin linker doesn't understand --start-group/--end-group.
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" 
MATCHES "Darwin")
+target_link_libraries(${name} ${lldb_library_keyword}
+  -Wl,--start-group ${LLDB_USED_LIBS} 
-Wl,--end-group)
+  else()
+target_link_libraries(${name} ${lldb_library_keyword} 
${LLDB_USED_LIBS})
+  endif()
 endif()
-  endif()
-  target_link_libraries(${name} ${lldb_library_keyword} ${CLANG_USED_LIBS})
-  target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_USED_LIBS})
-  llvm_config(${name} ${LLVM_LINK_COMPONENTS})
-  target_link_libraries(${name} ${l

[Lldb-commits] [lldb] r230380 - [CMake] Change lldbAPI to be a CMake OBJECT library.

2015-02-24 Thread Zachary Turner
Author: zturner
Date: Tue Feb 24 14:58:39 2015
New Revision: 230380

URL: http://llvm.org/viewvc/llvm-project?rev=230380&view=rev
Log:
[CMake] Change lldbAPI to be a CMake OBJECT library.

An OBJECT library is a special type of CMake library that produces
no archive, has no link interface, and no link inputs.  It is like
a regular archive, just without the physical output.  To link
against an OBJECT library, you reference it in the *source* file
list of a library using the special syntax $.
This will cause every object file to be passed to the linker
independently, as opposed to a single archive being passed to the
linker.

This is *extremely* important on Windows.  lldbAPI exports all of the
SB classes using __declspec(dllexport).  Unfortunately for technical
reasons it is not possible (well, extremely difficult) to get the
linker to propagate a __declspec(dllexport) attribute from a symbol
in an object file in an archive to a DLL that links against that
archive.  The solution to this is for the DLL to link the object files
directly.  So lldbAPI must be an OBJECT library.

This fixes an issue that has been present since the duplicated
lldbAPI file lists were removed, which would cause linker failures.

As a side effect, this also makes LLDB_DISABLE_PYTHON=1 work again
on Windows, which was previously totally broken.

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/LLDBDependencies.cmake
lldb/trunk/source/API/CMakeLists.txt
lldb/trunk/source/CMakeLists.txt
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=230380&r1=230379&r2=230380&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue Feb 24 14:58:39 2015
@@ -111,9 +111,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 endif()
 
 set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting 
integration.")
-if (LLDB_DISABLE_PYTHON)
-  add_definitions( -DLLDB_DISABLE_PYTHON )
-endif()
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
@@ -139,9 +136,10 @@ if (NOT LLDB_DISABLE_PYTHON)
 endif()
   endif()
   if (MSVC)
-if (PYTHON_INCLUDE_DIR STREQUAL "" OR PYTHON_LIBRARY STREQUAL "")
-  message(FATAL_ERROR "Building on MSVC requires manual specification of "
-  "PYTHON_INCLUDE_DIR and PYTHON_LIBRARY")
+if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL "")
+  message("-- LLDB Embedded python disabled.  Embedding python on Windows 
requires "
+  "manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
+  set(LLDB_DISABLE_PYTHON 1)
 else()
   message("-- Found PythonLibs: ${PYTHON_LIBRARY}")
   include_directories(${PYTHON_INCLUDE_DIR})
@@ -152,6 +150,12 @@ if (NOT LLDB_DISABLE_PYTHON)
   endif()
 endif()
 
+if (LLDB_DISABLE_PYTHON)
+  unset(PYTHON_INCLUDE_DIR)
+  unset(PYTHON_LIBRARY)
+  add_definitions( -DLLDB_DISABLE_PYTHON )
+endif()
+
 include_directories(../clang/include)
 include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
@@ -251,12 +255,12 @@ macro(add_lldb_library name)
   # only supported parameters to this macro are the optional 
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
-"MODULE;SHARED;STATIC"
+"MODULE;SHARED;STATIC;OBJECT"
 ""
 ""
 ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
-  
+
   if (MSVC_IDE OR XCODE)
 string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
 list(GET split_path -1 dir)
@@ -270,6 +274,8 @@ macro(add_lldb_library name)
 set(libkind SHARED)
   elseif (PARAM_STATIC)
 set(libkind STATIC)
+  elseif (PARAM_OBJECT)
+set(libkind OBJECT)
   else ()
 # library type unspecified - controlled by BUILD_SHARED_LIBS
 unset(libkind)
@@ -279,45 +285,43 @@ macro(add_lldb_library name)
   if (NOT MSVC)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
   endif()
-  llvm_add_library(${name} ${libkind} ${srcs})
-  #if (LLVM_COMMON_DEPENDS)
-  ##add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
-  #endif()
 
-  if ("${libkind}" STREQUAL "STATIC")
-set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
-  else ()
-set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
-  endif ()
+  if (PARAM_OBJECT)
+add_library(${name} ${libkind} ${srcs})
+  else()
+llvm_add_library(${name} ${libkind} ${srcs})
 
-  if(LLDB_USED_LIBS)
-# The Darwin linker doesn't understand --start-group/--end-group.
-if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES 
"Darwin")
-  target_link_libraries(${name} ${lldb_library_keyword}
--Wl,--start-group ${LLDB_USED_LIBS} 
-Wl,--end-group)
-else()
-  target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS})
+

Re: [Lldb-commits] [PATCH] Skip symlinks to the original file when searching for debug info

2015-02-24 Thread Zachary Turner
Agree with all your comments here. Lgtm, but give others a chance to
comment more before committing
On Tue, Feb 24, 2015 at 1:43 AM Pavel Labath  wrote:

> I have added an explanation about the test to the commit message. As for
> where the equivalent call should go to, I very much like the idea of the
> separation of responsibilities, as in std::path and std::filesystem.
> However, this seems out of scope of this patch. I think the next best
> solution is to leave the bare call to equivalent in Symbols.cpp, as it is
> now. I don't think of it as system-dependent, as all of that should be
> hidden deep in llvm.
>
> I'll wait for additional comments, and commit it in the present form if
> there is no pushback.
>
>
> 
> Comment at: test/functionalities/unwind/noreturn/TestNoreturnUnwind.
> py:47-49
> @@ -46,3 +46,5 @@
>  for f in thread.frames:
> -if f.GetFunctionName() == "abort":
> +# We use endswith() to look for abort() since some C
> libraries mangle the symbol into
> +# __GI_abort or similar.
> +if f.GetFunctionName().endswith("abort"):
>  break
> 
> zturner wrote:
> > :(  Really dislike seeing assumptions about mangling schemes hardcoded
> into string comparisons.  Although admittedly, I don't think this is worse
> than before, and even worse, there's no good alternative.  Mostly just a
> drive by comment.  That said, this will detect any function that ends with
> abort.
> >
> > We don't have a perfect solution at this point, but checking against an
> explicit list of known manglings would generate fewer false positives.  For
> example, the algorithm here would catch a function called
> "completely_unrelated_abort".  The comment says some C libraries mangle
> into __GI_abort "or similar".  Is the list of similar manglings long?
> This is not actually "mangling" as the mangling of C++ names into strings.
> This is just libc declaring it's function as "__GI_abort" (a completely
> arbitrary string), and then linking the name "abort" to it using some elf
> symbol reference mechanism (or something, I don't know much about these
> things). But basically, since this is an arbitrary string and an
> implementation detail of the library, we would need to go through all c
> libraries and check how they resolve "abort". The list probably wouldn't be
> long, but it would never be definitive, as these things can change at any
> time.
>
> As I say in the commit message it would better to teach lldb to prefer
> public names for a symbol, but this is an unrelated issue, which this
> commit merely exposed. For a test, I think checking for endswith("abort")
> is fine as the danger of false positives is quite minimal.
>
> http://reviews.llvm.org/D7836
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix handling of backslashes in Args parsing

2015-02-24 Thread Zachary Turner
Can you add a test with the examples you summarized? What does a\b generate
with this change?
On Tue, Feb 24, 2015 at 3:11 AM Pavel Labath  wrote:

> Hi clayborg,
>
> Presently Args::SetCommandString allows quotes to be escaped with
> backslash. However, the
> backslash itself is not removed from the argument, nor there is a way to
> escape the backslash
> itself. This leads to surprising results:
>
> "a b" c"   -> 'a b', 'c'  # Here we actually have an unterminated quote,
> but that is ignored
> "a b\" c"  -> 'a b\" c'   # We try to escape the quote. That works but the
> backslash is not removed.
> "a b\\" c" -> 'a b\\" c'  # Escaping the backslash has no effect.
>
> This change removes the possibility to escape the terminating quotes,
> making every quote run from
> one quote character to the next one. The contents for the quote are always
> taken literally, just
> like the single quotes in a posix shell. The only way to insert a literal
> quote character is to
> close the quote and then escape it with a backslash or to use a different
> kind of quotes.
>
> To summarize:
> "a b" c"-> 'a b', 'c'   # unterminated quotes are still ignored
> "a b"\"" c" -> 'a b" c' # first way to insert a literal quote
> 'a b" c'-> 'a b" c' # second way to insert a literal quote
> "a b\" c-> 'a b\', c# backslash has no effect, we still get two
> arguments
> "a b\\" c   -> 'a b\\', c   # same here
>
> This change also removes some dead quote-handling code. This code
> (branching on the value of
> quote_char) was never executed since all quote handling was concentrated
> in the case '"': block,
> and the value was always set to 0 after exiting the block.
>
> http://reviews.llvm.org/D7855
>
> Files:
>   source/Interpreter/Args.cpp
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
> ___
> lldb-commits mailing list
> lldb-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r230046 - Add an OptionValueLanguage class

2015-02-23 Thread Zachary Turner
FWIW Pavel's original suggestion (which I missed in my original response)
appears pretty easy to do.  All the called function does is to do a case
insensitive string compare, which StringRef contains a method for.  So it
seems easy to change that function to take a StringRef, which is better
than any of the other suggestions proposed anyway.

On Mon Feb 23 2015 at 2:16:57 PM Vince Harron  wrote:

> Hi all,
>
> We can't assume StringRef is null terminated, ever.
>
> Vince
>  On Feb 23, 2015 4:48 PM, "Joerg Sonnenberger" 
> wrote:
>
>> On Mon, Feb 23, 2015 at 05:31:50PM +, Zachary Turner wrote:
>> > How so? Suppose you've got a function which takes a const char*.
>> Obviously
>> > it's null terminated or your function wouldn't be able to work. If you
>> > replace that with a StringRef it's still null terminated because the
>> call
>> > site hasn't changed. Either way, its up to the caller to pass something
>> > null terminated.
>> >
>> > Any time you construct a StringRef from a std::string or ConstString,
>> which
>> > is very close to 100% of what we do, the StringRef is guaranteed to be
>> null
>> > terminated.
>>
>> But StringRef is normally a part of either a std::string or const char *.
>> While there might be a null byte somewhere, it has no relation to the
>> size of the string referenced by StringRef. The point is that accessing
>> the data of a StringRef doesn't give a null terminated string of the
>> same size as the StringRef, if at all.
>>
>> Joerg
>>
> ___
>> lldb-commits mailing list
>> lldb-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Skip symlinks to the original file when searching for debug info

2015-02-23 Thread Zachary Turner
Bleh: This came across really ugly in the email Phab sent out due to me 
responding from email.  Not sure if this will be any be better, but here it is 
again

Well I really like to keep ifdefs out of code.  I know that Host is the place 
for ifdefs, and FileSpec is in Host, but I still like to keep them to a 
minimum.  It's too easy to break things when you have to try to figure out 
which ifdef paths you need to modify.  That was the reason for creating the 
FileSystem class.  It exposes a platform agnostic interface to low level FS 
operations.  Similar to llvm::sys::fs, and there's probably some duplication 
there that could be removed, but I just didn't want to break too much stuff at 
the time.

I really wouldn't want to see a bunch of ifdefs ending up in FileSpec (there's 
already some there that I'd like to see removed, as described below).  A lot of 
what it does is consistent across all platforms and is just focused on 
splitting apart a string, and constifying the directory and filename portions.  
And so I think it would be a shame to muck up this (mostly) platform-agnostic 
class with some platform specific stuff.  It would be great if there were a way 
to isolate the disk access part.  I don't think it's too crazy to write 
something like

  FileSpec MyFile("/usr/bin/foo");
  FileSystem::DirectoryEnumerator Enumerator(MyFile);
  for (FileSpec &Child : Enumerator) {
  if (FileSystem::IsDirectory(Child)) {
  // Do something.
  }
  }

In fact I think it's even better.

1. It improves readability by making it clear that you're hitting the file 
system, so you should be careful about what type of path you're using.
2. It improves modularity by isolating the code that hits the file system from 
the code that doesn't.
3. It cleans up the FileSpec implementation somewhat.  Currently 
EnumerateDirectory is a big ugly function with a couple of different 
preprocessor branches.
4. Separating the responsibilities like this leads to more flexible usage 
patterns.  Like having DirectoryEnumerator be an object that can be used in a 
range-based for loop here, instead of forcing its usage to conform to what you 
can write with a single function call.

Anyway, TL;DR of all this is that I know it was originally designed to be all 
things related to files, but as it grows, it starts to become really heavy.  I 
think it makes sense to consider a separation of responsibilities.  Does a 
function that mmaps file contents really belong in the same class as a function 
that resolves a symlink?  I don't think we need or even should have 1 class 
that is all things file system.  We should try to find ways to break it down 
into smaller, more targeted, more meaningful components.


http://reviews.llvm.org/D7836

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r230262 - [CMake] On Windows, require manual specification of python libs.

2015-02-23 Thread Zachary Turner
Author: zturner
Date: Mon Feb 23 15:20:59 2015
New Revision: 230262

URL: http://llvm.org/viewvc/llvm-project?rev=230262&view=rev
Log:
[CMake] On Windows, require manual specification of python libs.

Embedding python with MSVC is very finicky, for reasons having
to do with the operating system's CRT, the implementation of
python itself on Windows, and even bugs in CMake.

One side effect of this is that we cannot rely on FindPythonLibs
and FindPythonInterp CMake functions to locate the correct
version of Python.  We must instead manually specify the location
of PYTHON_LIBRARY and PYTHON_INCLUDE_DIR.

As a side effect, this fixes building LLDB in release mode by
specifying -DCMAKE_BUILD_TYPE=Release, which was previously
broken.

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/source/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=230262&r1=230261&r2=230262&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Mon Feb 23 15:20:59 2015
@@ -72,15 +72,17 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   include(HandleLLVMOptions)
 
   # Verify that we can find a Python 2 interpreter.  Python 3 is unsupported.
-  set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
-  include(FindPythonInterp)
-  if( NOT PYTHONINTERP_FOUND )
-message(FATAL_ERROR
-  "Unable to find Python interpreter, required for builds and testing.
-
-  Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
+  if (PYTHON_EXECUTABLE STREQUAL "")
+set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
+include(FindPythonInterp)
+if( NOT PYTHONINTERP_FOUND )
+  message(FATAL_ERROR
+  "Unable to find Python interpreter, required for builds and 
testing.
+   Please install Python or specify the PYTHON_EXECUTABLE CMake 
variable.")
+endif()
+  else()
+message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
   endif()
-
   # Import CMake library targets from LLVM and Clang.
   include("${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake")
   include("${LLDB_PATH_TO_CLANG_BUILD}/share/clang/cmake/ClangConfig.cmake")
@@ -136,8 +138,18 @@ if (NOT LLDB_DISABLE_PYTHON)
   set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
 endif()
   endif()
-  find_package(PythonLibs REQUIRED)
-  include_directories(${PYTHON_INCLUDE_DIRS})
+  if (MSVC)
+if (PYTHON_INCLUDE_DIR STREQUAL "" OR PYTHON_LIBRARY STREQUAL "")
+  message(FATAL_ERROR "Building on MSVC requires manual specification of "
+  "PYTHON_INCLUDE_DIR and PYTHON_LIBRARY")
+else()
+  message("-- Found PythonLibs: ${PYTHON_LIBRARY}")
+  include_directories(${PYTHON_INCLUDE_DIR})
+endif()
+  else()
+find_package(PythonLibs REQUIRED)
+include_directories(${PYTHON_INCLUDE_DIRS})
+  endif()
 endif()
 
 include_directories(../clang/include)

Modified: lldb/trunk/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=230262&r1=230261&r2=230262&view=diff
==
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Mon Feb 23 15:20:59 2015
@@ -47,20 +47,26 @@ add_lldb_library(liblldb SHARED
   ${LLDB_VERS_GENERATED_FILE}
   )
 
+
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-target_link_libraries(liblldb PRIVATE lldbAPI)
+  target_link_libraries(liblldb PRIVATE lldbAPI)
+  # Only MSVC has the ABI compatibility and avoids using FindPythonLibs,
+  # so only it needs to explicitly link against ${PYTHON_LIBRARY}
+  if (MSVC)
+target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
+  endif()
 
-set_target_properties(liblldb
-  PROPERTIES
-  OUTPUT_NAME liblldb
-  VERSION ${LLDB_VERSION}
-  )
+  set_target_properties(liblldb
+PROPERTIES
+OUTPUT_NAME liblldb
+VERSION ${LLDB_VERSION}
+)
 else()
-set_target_properties(liblldb
-  PROPERTIES
-  OUTPUT_NAME lldb
-  VERSION ${LLDB_VERSION}
-  )
+  set_target_properties(liblldb
+PROPERTIES
+OUTPUT_NAME lldb
+VERSION ${LLDB_VERSION}
+)
 endif()
 
 if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Skip symlinks to the original file when searching for debug info

2015-02-23 Thread Zachary Turner

Comment at: test/functionalities/unwind/noreturn/TestNoreturnUnwind.py:47-49
@@ -46,3 +46,5 @@
 for f in thread.frames:
-if f.GetFunctionName() == "abort":
+# We use endswith() to look for abort() since some C libraries 
mangle the symbol into
+# __GI_abort or similar.
+if f.GetFunctionName().endswith("abort"):
 break

:(  Really dislike seeing assumptions about mangling schemes hardcoded into 
string comparisons.  Although admittedly, I don't think this is worse than 
before, and even worse, there's no good alternative.  Mostly just a drive by 
comment.  That said, this will detect any function that ends with abort.  

We don't have a perfect solution at this point, but checking against an 
explicit list of known manglings would generate fewer false positives.  For 
example, the algorithm here would catch a function called 
"completely_unrelated_abort".  The comment says some C libraries mangle into 
__GI_abort "or similar".  Is the list of similar manglings long?

http://reviews.llvm.org/D7836

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r230128 - Add missing #include. This should fix the Windows build.

2015-02-20 Thread Zachary Turner
Author: zturner
Date: Fri Feb 20 22:45:12 2015
New Revision: 230128

URL: http://llvm.org/viewvc/llvm-project?rev=230128&view=rev
Log:
Add missing #include.  This should fix the Windows build.

Modified:
lldb/trunk/source/Host/windows/Host.cpp

Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=230128&r1=230127&r2=230128&view=diff
==
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Fri Feb 20 22:45:12 2015
@@ -20,6 +20,7 @@
 #include "lldb/Target/Process.h"
 
 #include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/StreamFile.h"


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


  1   2   3   4   5   >