Re: [Lldb-commits] [lldb] r327356 - [ExpressionParser] Fix crash when evaluating invalid expresssions.

2018-03-14 Thread Pavel Labath via lldb-commits
I'm not familiar with all of the magic we do when we synthesize clang
Decls, but I feel I should point out that we can't get out of business of
sanity-checking the declarations we inject into clang. The reason for that
is, even if we had debug info for operator==, the debug info itself could
describe it's prototype as operator==(...) (due to a compiler bug, corrupt
file, or whatever). So we still need to make sure that the declarations we
synthesize from debug info don't violate clang's invariants (and that's
what we try to do at present, cf.
ClangASTContext::CheckOverloadedOperatorParameterCount).

So maybe the solution here is not to refuse injecting any declarations
without debug info, but instead to make sure that whatever declarations we
inject that way satisfy the same validity criteria as the ones we
synthesize from the debug info?

cheers,
pl

On Wed, 14 Mar 2018 at 01:25, Davide Italiano via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> On Tue, Mar 13, 2018 at 2:43 PM, Jason Molenda  wrote:
> >
> >
> >> On Mar 13, 2018, at 11:51 AM, Davide Italiano via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> >>
> >> We had the report of a crash where lldb was setting a conditional
> >> breakpoint on an invalid condition (CGRect == pointer, which is,
> >> ill-formed).
> >> The symbol-based resolution of lldb was picking a random operator==,
> >> inserting a generic function decl operator== in the context because it
> >> happened to find a matching symbol somewhere in the system.
> >>
> >> clang expects operator== to have at least one argument, so you end up
> >> hitting this assertion in Sema.
> >>
> >> (lldb) Assertion failed: (i < getNumParams() && "Illegal param #"),
> >> function getParamDecl, file
> >>
> /Users/davide/work/llvm-monorepo/llvm-project-20170507/llvm/tools/clang/include/clang/AST/Decl.h,
> >> line 2232.
> >>
> >> So, to answer your question, Greg, I just want lldb to not inject
> >> arbitrary C++ func decl. What do you think is the best way of
> >> achieving this?
> >>
> >
> >
> > I put together a repo case that might help make this clearer (attached)
> >
> >
> >
> >
> >
> > we have a test program with three translation units.  One has C++
> methods and was built with debug info ("foo"), one has C++ methods and was
> built without debug info ("bar").  It tries calling these from lldb:
> >
> >
> > (lldb) p (void)foo('c')
> > in foo(char)
> > (lldb) p (void)foo(5)
> > in foo(int)
> > (lldb) p (void)foo(5, 5)
> > in foo(int, int)
> >
> > We had debug info for foo(), called the correct methods.
> >
> >
> > (lldb) p (void)bar('c')
> > in bar(char *)
> > (lldb) p (void)bar(5)
> > in bar(char *)
> > (lldb) p (void)bar(5, 5)
> > in bar(char *)
> >
> >
> > Here, we have no debug info for bar(), so we grabbed the first bar()
> method we found and used it for all calls.  This is a problem.
> >
> >
> > (lldb) p (void)_Z3barc('c')
> > in bar(char)
> > (lldb) p (void)_Z3bari(5)
> > in bar(int)
> > (lldb) p (void)_Z3barii(5,5)
> > in bar(int, int)
> >
> > Calling the mangled name bar()'s directly works as expected.
> >
> >
> >
> > Davide is trying to solve that middle one.  I think the problem he was
> working on is where we had an expression using operator== and the first
> "decl" we found of this was in a no-debug-info translation unit, and that
> randomly chosen operator== was used when there WAS debug info for this
> operator== in a different translation unit in the process.
> >
> > The question I have is -- should this even be allowed.  Should you be
> able to call a C++ method using a demangled name with no debug info?  I'm
> trying to think of a case where people do this today.  Clearly it does not
> work correctly today for overloaded functions.  And apparently this could
> be chosen over a debug info definition that might appear elsewhere in the
> process?  I didn't try to test that.
> >
>
> The debug info version, if present has precedence. The scary bit is
> that if you have several symbols matching the decl name (e.g.
> `operator==`) lldb will pick a random one [the last one in the list it
> builds according to some order]. I don't think this is the expected
> behavior, but this is what we have today.
>
> Thanks,
>
> --
> Davide
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r327483 - Skip TestWatchedVarHitWhenInScope.py everywhere

2018-03-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar 14 02:13:33 2018
New Revision: 327483

URL: http://llvm.org/viewvc/llvm-project?rev=327483&view=rev
Log:
Skip TestWatchedVarHitWhenInScope.py everywhere

The expression-hits tracking logic is not available on any platform. The
reason this tests happens to pass on some platforms is that the test is
written poorly -- it relies on the fact that post-main cleanup code will
write to the stack memory once occupied by the watched variable, but
this is not the case everywhere (e.g. linux glibc does not seem to do
this, but android's bionic library does).

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py?rev=327483&r1=327482&r2=327483&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
 Wed Mar 14 02:13:33 2018
@@ -23,8 +23,6 @@ class WatchedVariableHitWhenInScopeTestC
 # but the way this was done was incorrect, and it is unclear that for the
 # most part that's not what folks mostly want, so we have to provide a
 # clearer API to express this.
-#
-# This functionality is currently unsupported on Darwin.
 
 def setUp(self):
 # Call super's setUp().
@@ -36,7 +34,7 @@ class WatchedVariableHitWhenInScopeTestC
 
 # Test hangs due to a kernel bug, see fdfeff0f in the linux kernel for 
details
 @skipIfTargetAndroid(api_levels=list(range(25+1)), archs=["aarch64", 
"arm"])
-@skipIfDarwin
+@skipIf
 def test_watched_var_should_only_hit_when_in_scope(self):
 """Test that a variable watchpoint should only hit when in scope."""
 self.build(dictionary=self.d)


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


[Lldb-commits] [PATCH] D44379: [cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)

2018-03-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: cmake/modules/LLDBConfig.cmake:349
 
-if (HAVE_LIBPTHREAD)
-  list(APPEND system_libs pthread)
-endif(HAVE_LIBPTHREAD)
-
-if (HAVE_LIBDL)
-  list(APPEND system_libs ${CMAKE_DL_LIBS})
+if(UNIX)
+  set(CMAKE_THREAD_PREFER_PTHREAD TRUE)

krytarowski wrote:
> labath wrote:
> > krytarowski wrote:
> > > Why UNIX here?
> > > 
> > > Why CMAKE_THREAD_PREFER_PTHREAD? It looks like used only on IRIX and that 
> > > one is not going anywhere nowadays. (And certainly similarly to other 
> > > commercial OSes, due to legal work/removing not-owned code, it's not 
> > > possible to push it to Open-Source).
> > > 
> > > Assuming that system_libs can accept "-pthreads", this patch looks good 
> > > to me.
> > For the second part, I copied it out of the llvm's build scripts without 
> > looking at what it does (with the idea of trying to maintain a consistent 
> > build). However, if it's only used at irix, then I guess I can remove that.
> > 
> > The UNIX part is also inspired by llvm, but I simplified it a bit (they use 
> > CYGWIN OR NOT WINDOWS). I was assuming the idea was to make sure we use 
> > native thread support and not pthreads (which are present there sometimes, 
> > I think).
> I see, I would use `CYGWIN OR NOT WINDOWS` without changing the logic.
> 
> Keeping here `CMAKE_THREAD_PREFER_PTHREAD` does not make harm. non-pthreading 
> on UNIX systems is rather in extinct and remnant of 90ties (Minix has 
> something like that.. and lack of pthreads).
> 
> The UNIX part looks correct.
Thanks, I'll update the logic to match and submit.


https://reviews.llvm.org/D44379



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


[Lldb-commits] [lldb] r327490 - [cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)

2018-03-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar 14 03:08:21 2018
New Revision: 327490

URL: http://llvm.org/viewvc/llvm-project?rev=327490&view=rev
Log:
[cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)

Summary:
To make this build work, I needed to add detection code for the pthread
library. This is necessary, because we have direct calls to these
libraries (instead of going through llvm) and in the standalone build we
cannot rely on llvm to detect these for us. In a standalone non-dylib
build this was accidentaly working because these libraries were pulled
in as an interface dependency of the .a files, but in a dylib build
these are no longer part of the link interface, and so we need to add
them explicitly.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits, mgorny

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

Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=327490&r1=327489&r2=327490&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Wed Mar 14 03:08:21 2018
@@ -346,14 +346,18 @@ else()
 
 endif()
 
-if (HAVE_LIBPTHREAD)
-  list(APPEND system_libs pthread)
-endif(HAVE_LIBPTHREAD)
+if( WIN32 AND NOT CYGWIN )
+  set(PURE_WINDOWS 1)
+endif()
 
-if (HAVE_LIBDL)
-  list(APPEND system_libs ${CMAKE_DL_LIBS})
+if(NOT PURE_WINDOWS)
+  set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+  find_package(Threads REQUIRED)
+  list(APPEND system_libs ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
+list(APPEND system_libs ${CMAKE_DL_LIBS})
+
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")


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


[Lldb-commits] [PATCH] D44379: [cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)

2018-03-14 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327490: [cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds 
(pr36687) (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D44379?vs=138034&id=138316#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44379

Files:
  lldb/trunk/cmake/modules/LLDBConfig.cmake


Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -346,14 +346,18 @@
 
 endif()
 
-if (HAVE_LIBPTHREAD)
-  list(APPEND system_libs pthread)
-endif(HAVE_LIBPTHREAD)
+if( WIN32 AND NOT CYGWIN )
+  set(PURE_WINDOWS 1)
+endif()
 
-if (HAVE_LIBDL)
-  list(APPEND system_libs ${CMAKE_DL_LIBS})
+if(NOT PURE_WINDOWS)
+  set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+  find_package(Threads REQUIRED)
+  list(APPEND system_libs ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
+list(APPEND system_libs ${CMAKE_DL_LIBS})
+
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")


Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -346,14 +346,18 @@
 
 endif()
 
-if (HAVE_LIBPTHREAD)
-  list(APPEND system_libs pthread)
-endif(HAVE_LIBPTHREAD)
+if( WIN32 AND NOT CYGWIN )
+  set(PURE_WINDOWS 1)
+endif()
 
-if (HAVE_LIBDL)
-  list(APPEND system_libs ${CMAKE_DL_LIBS})
+if(NOT PURE_WINDOWS)
+  set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+  find_package(Threads REQUIRED)
+  list(APPEND system_libs ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
+list(APPEND system_libs ${CMAKE_DL_LIBS})
+
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r327501 - Update selected thread after loading mach core

2018-03-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Mar 14 04:50:10 2018
New Revision: 327501

URL: http://llvm.org/viewvc/llvm-project?rev=327501&view=rev
Log:
Update selected thread after loading mach core

The OS plugins might have updated the thread list after a core file has
been loaded. The physical thread in the core file may no longer be the
one that should be selected. Hence we should run the thread selection
logic after loading the core.

Differential revision: https://reviews.llvm.org/D44139

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml
Modified:
lldb/trunk/source/Target/Process.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=327501&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 Wed Mar 14 04:50:10 2018
@@ -0,0 +1,68 @@
+"""
+Test basics of mach core file debugging.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MachCoreTestCase(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+super(MachCoreTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MachCoreTestCase, self).tearDown()
+
+def test_selected_thread(self):
+"""Test that the right thread is selected after a core is loaded."""
+# Create core form YAML.
+self.yaml2obj("test.core.yaml", self.getBuildArtifact("test.core"))
+
+# Set debugger into synchronous mode
+self.dbg.SetAsync(False)
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget("")
+
+# Load OS plugin.
+python_os_plugin_path = os.path.join(self.getSourceDir(),
+ 'operating_system.py')
+command = "settings set target.process.python-os-plugin-path 
'{}'".format(
+python_os_plugin_path)
+self.dbg.HandleCommand(command)
+
+# Load core.
+process = target.LoadCore(self.getBuildArtifact("test.core"))
+self.assertTrue(process, PROCESS_IS_VALID)
+self.assertEqual(process.GetNumThreads(), 3)
+
+# Verify our OS plug-in threads showed up
+thread = process.GetThreadByID(0x1)
+self.assertTrue(thread.IsValid(
+), "Make sure there is a thread 0x1 after we load the python 
OS plug-in"
+)
+thread = process.GetThreadByID(0x2)
+self.assertTrue(thread.IsValid(
+), "Make sure there is a thread 0x2 after we load the python 
OS plug-in"
+)
+thread = process.GetThreadByID(0x3)
+self.assertTrue(thread.IsValid(
+), "Make sure there is a thread 0x3 after we load the python 
OS plug-in"
+)
+
+# Verify that the correct thread is selected
+thread = process.GetSelectedThread()
+self.assertEqual(thread.GetThreadID(), 0x3)

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py?rev=327501&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py
 Wed Mar 14 04:50:10 2018
@@ -0,0 +1,45 @@
+import lldb
+import struct
+
+
+class OperatingSystemPlugIn(object):
+"""Class that provides data for an instance of a LLDB 
'OperatingSystemPython' plug-in class"""
+
+def __init__(self, process):
+'''Initialization needs a valid.SBProcess object.
+
+This plug-in will get created after a live process is valid and has 
stopped for the first time.
+'''
+self.process = None
+self

[Lldb-commits] [PATCH] D44139: Update selected thread after loading mach core

2018-03-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327501: Update selected thread after loading mach core 
(authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44139?vs=137993&id=138331#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44139

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/operating_system.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml
  lldb/trunk/source/Target/Process.cpp

Index: lldb/trunk/source/Target/Process.cpp
===
--- lldb/trunk/source/Target/Process.cpp
+++ lldb/trunk/source/Target/Process.cpp
@@ -2857,10 +2857,10 @@
 // state.
 SetPrivateState(eStateStopped);
 
-// Wait indefinitely for a stopped event since we just posted one above...
+// Wait for a stopped event since we just posted one above...
 lldb::EventSP event_sp;
-listener_sp->GetEvent(event_sp, llvm::None);
-StateType state = ProcessEventData::GetStateFromEvent(event_sp.get());
+StateType state =
+WaitForProcessToStop(seconds(10), &event_sp, true, listener_sp);
 
 if (!StateIsStoppedState(state, false)) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
@@ -0,0 +1,68 @@
+"""
+Test basics of mach core file debugging.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MachCoreTestCase(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+super(MachCoreTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MachCoreTestCase, self).tearDown()
+
+def test_selected_thread(self):
+"""Test that the right thread is selected after a core is loaded."""
+# Create core form YAML.
+self.yaml2obj("test.core.yaml", self.getBuildArtifact("test.core"))
+
+# Set debugger into synchronous mode
+self.dbg.SetAsync(False)
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget("")
+
+# Load OS plugin.
+python_os_plugin_path = os.path.join(self.getSourceDir(),
+ 'operating_system.py')
+command = "settings set target.process.python-os-plugin-path '{}'".format(
+python_os_plugin_path)
+self.dbg.HandleCommand(command)
+
+# Load core.
+process = target.LoadCore(self.getBuildArtifact("test.core"))
+self.assertTrue(process, PROCESS_IS_VALID)
+self.assertEqual(process.GetNumThreads(), 3)
+
+# Verify our OS plug-in threads showed up
+thread = process.GetThreadByID(0x1)
+self.assertTrue(thread.IsValid(
+), "Make sure there is a thread 0x1 after we load the python OS plug-in"
+)
+thread = process.GetThreadByID(0x2)
+self.assertTrue(thread.IsValid(
+), "Make sure there is a thread 0x2 after we load the python OS plug-in"
+)
+thread = process.GetThreadByID(0x3)
+self.assertTrue(thread.IsValid(
+), "Make sure there is a thread 0x3 after we load the python OS plug-in"
+)
+
+# Verify that the correct thread is selected
+thread = process.GetSelectedThread()
+self.assertEqual(thread.GetThreadID(), 0x3)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/test.core.yaml
@@ -0,0 +1,853 @@
+--- !mach-o
+FileHeader:  
+  magic:   0xFEEDFACF
+  cputype: 0x0107
+  cpusubtype:  0x0003
+  filetype:0x0004
+  ncmds:   59
+  sizeofcmds:  4384
+  flags:   0x
+  reserved:0x
+LoadCommands:
+  - cmd: LC_THREAD
+cmds

[Lldb-commits] [PATCH] D44139: Update selected thread after loading mach core

2018-03-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In https://reviews.llvm.org/D44139#1036521, @jasonmolenda wrote:

> (or rather, not "conflict with the OperatingSystemPlugIn stop reason" -- but 
> would make it confusing to users.  I think it might be best to remove 
> ThreadMachCore::CalculateStopInfo.)


Sounds reasonable, I'll do that in a follow-up commit!


Repository:
  rL LLVM

https://reviews.llvm.org/D44139



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


[Lldb-commits] [lldb] r327512 - [test] Disable TestMachCore everywhere except on Darwin

2018-03-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Mar 14 07:16:23 2018
New Revision: 327512

URL: http://llvm.org/viewvc/llvm-project?rev=327512&view=rev
Log:
[test] Disable TestMachCore everywhere except on Darwin

Apparently the parser is wrapped inside ifdef's so the logic isn't
available on non-Darwin platforms.

Should fix build bot failure:
  http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=327512&r1=327511&r2=327512&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 Wed Mar 14 07:16:23 2018
@@ -26,6 +26,7 @@ class MachCoreTestCase(TestBase):
 lldb.DBG.SetSelectedPlatform(self._initial_platform)
 super(MachCoreTestCase, self).tearDown()
 
+@skipUnlessDarwin
 def test_selected_thread(self):
 """Test that the right thread is selected after a core is loaded."""
 # Create core form YAML.


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


[Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: davide, labath, zturner.
Herald added subscribers: llvm-commits, mgorny.

This makes llvm-dotest a custom target so you can run `ninja
llvm-dotest` to rebuild whatever is necessary before rerunning the
tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D44473

Files:
  test/CMakeLists.txt


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -147,6 +147,9 @@
   INPUT
   ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(llvm-dotest)
+add_dependencies(llvm-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -147,6 +147,9 @@
   INPUT
   ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(llvm-dotest)
+add_dependencies(llvm-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

https://reviews.llvm.org/D44473



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


Re: [Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Zachary Turner via lldb-commits
Shouldn’t it be lldb-dotest? I’m confused about what this target does
On Wed, Mar 14, 2018 at 8:21 AM Davide Italiano via Phabricator <
revi...@reviews.llvm.org> wrote:

> davide accepted this revision.
> davide added a comment.
> This revision is now accepted and ready to land.
>
> LGTM
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D44473
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a subscriber: JDevlieghere.
zturner added a comment.

Shouldn’t it be lldb-dotest? I’m confused about what this target does


Repository:
  rL LLVM

https://reviews.llvm.org/D44473



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


[Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Also, I second the feeling of having `lldb` somewhere in the name for the 
utility (rather than `llvm` :)


Repository:
  rL LLVM

https://reviews.llvm.org/D44473



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


[Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

The name should be changed (also the utility name), but that should be done 
separately.


Repository:
  rL LLVM

https://reviews.llvm.org/D44473



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


[Lldb-commits] [PATCH] D44473: [dotest] Make llvm-dotest a custom target

2018-03-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 138370.
JDevlieghere added a comment.

Yeah, that's more sensible indeed. I must have had `llvm-lit` in mind and never 
gave it a second thought.


Repository:
  rL LLVM

https://reviews.llvm.org/D44473

Files:
  test/CMakeLists.txt
  test/lldb-dotest.in
  test/llvm-dotest.in


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -137,16 +137,19 @@
 string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
-  llvm-dotest.in
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  lldb-dotest.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
 # We need this to expand the generator expressions.
 file(GENERATE
   OUTPUT
-  $/llvm-dotest
+  $/lldb-dotest
   INPUT
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(lldb-dotest)
+add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -137,16 +137,19 @@
 string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
-  llvm-dotest.in
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  lldb-dotest.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
 # We need this to expand the generator expressions.
 file(GENERATE
   OUTPUT
-  $/llvm-dotest
+  $/lldb-dotest
   INPUT
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(lldb-dotest)
+add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r327519 - [dotest] Rename llvm-dotest -> lldb-dotest and make it a custom target

2018-03-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Mar 14 08:36:32 2018
New Revision: 327519

URL: http://llvm.org/viewvc/llvm-project?rev=327519&view=rev
Log:
[dotest] Rename llvm-dotest -> lldb-dotest and make it a custom target

This renames llvm-dotest to lldb-dotest and makes it a custom target so
you can run `ninja lldb-dotest` to rebuild whatever is necessary before
rerunning the tests.

Differential revision: https://reviews.llvm.org/D44473

Added:
lldb/trunk/test/lldb-dotest.in
  - copied, changed from r327512, lldb/trunk/test/llvm-dotest.in
Removed:
lldb/trunk/test/llvm-dotest.in
Modified:
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=327519&r1=327518&r2=327519&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Wed Mar 14 08:36:32 2018
@@ -137,16 +137,19 @@ add_python_test_target(check-lldb
 string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
-  llvm-dotest.in
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  lldb-dotest.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
 # We need this to expand the generator expressions.
 file(GENERATE
   OUTPUT
-  $/llvm-dotest
+  $/lldb-dotest
   INPUT
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(lldb-dotest)
+add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.

Copied: lldb/trunk/test/lldb-dotest.in (from r327512, 
lldb/trunk/test/llvm-dotest.in)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb-dotest.in?p2=lldb/trunk/test/lldb-dotest.in&p1=lldb/trunk/test/llvm-dotest.in&r1=327512&r2=327519&rev=327519&view=diff
==
(empty)

Removed: lldb/trunk/test/llvm-dotest.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/llvm-dotest.in?rev=327518&view=auto
==
--- lldb/trunk/test/llvm-dotest.in (original)
+++ lldb/trunk/test/llvm-dotest.in (removed)
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-import sys
-import os
-
-dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
-
-if __name__ == '__main__':
-# FIXME: It would be nice if we can mimic the approach taken by llvm-lit
-# and pass a python configuration straight to dotest, rather than going
-# through the operating system.
-command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
-sys.argv[1:]))
-os.system(command)


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


[Lldb-commits] [PATCH] D44473: [dotest] Rename llvm-dotest -> lldb-dotest and make it a custom target

2018-03-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327519: [dotest] Rename llvm-dotest -> lldb-dotest and 
make it a custom target (authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44473?vs=138370&id=138372#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44473

Files:
  lldb/trunk/test/CMakeLists.txt
  lldb/trunk/test/lldb-dotest.in
  lldb/trunk/test/llvm-dotest.in


Index: lldb/trunk/test/lldb-dotest.in
===
--- lldb/trunk/test/lldb-dotest.in
+++ lldb/trunk/test/lldb-dotest.in
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+import sys
+import os
+
+dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
+dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+
+if __name__ == '__main__':
+# FIXME: It would be nice if we can mimic the approach taken by llvm-lit
+# and pass a python configuration straight to dotest, rather than going
+# through the operating system.
+command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
+sys.argv[1:]))
+os.system(command)
Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -137,16 +137,19 @@
 string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
-  llvm-dotest.in
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  lldb-dotest.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
 # We need this to expand the generator expressions.
 file(GENERATE
   OUTPUT
-  $/llvm-dotest
+  $/lldb-dotest
   INPUT
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(lldb-dotest)
+add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.
Index: lldb/trunk/test/llvm-dotest.in
===
--- lldb/trunk/test/llvm-dotest.in
+++ lldb/trunk/test/llvm-dotest.in
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-import sys
-import os
-
-dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
-
-if __name__ == '__main__':
-# FIXME: It would be nice if we can mimic the approach taken by llvm-lit
-# and pass a python configuration straight to dotest, rather than going
-# through the operating system.
-command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
-sys.argv[1:]))
-os.system(command)


Index: lldb/trunk/test/lldb-dotest.in
===
--- lldb/trunk/test/lldb-dotest.in
+++ lldb/trunk/test/lldb-dotest.in
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+import sys
+import os
+
+dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
+dotest_args = '@LLDB_DOTEST_ARGS_STR@'
+
+if __name__ == '__main__':
+# FIXME: It would be nice if we can mimic the approach taken by llvm-lit
+# and pass a python configuration straight to dotest, rather than going
+# through the operating system.
+command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
+sys.argv[1:]))
+os.system(command)
Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -137,16 +137,19 @@
 string (REPLACE ";" " " LLDB_DOTEST_ARGS_STR  "${LLDB_DOTEST_ARGS}")
 # We need this to substitute variables.
 configure_file(
-  llvm-dotest.in
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  lldb-dotest.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
 # We need this to expand the generator expressions.
 file(GENERATE
   OUTPUT
-  $/llvm-dotest
+  $/lldb-dotest
   INPUT
-  ${CMAKE_CURRENT_BINARY_DIR}/llvm-dotest.configured
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
   )
+# Make this a custom target.
+add_custom_target(lldb-dotest)
+add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
 
 # If we're building with an in-tree clang, then list clang as a dependency
 # to run tests.
Index: lldb/trunk/test/llvm-dotest.in
===
--- lldb/trunk/test/llvm-dotest.in
+++ lldb/trunk/test/llvm-dotest.in
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-import sys
-import os
-
-dotest_path = '@LLDB_SOURCE_DIR@/test/dotest.py'
-dotest_args = '@LLDB_DOTEST_ARGS_STR@'
-
-if __name__ == '__main__':
-# FIXME: It would be nice if we can mimic the approach taken by llvm-lit
-# and pass a python configuration straight to dotest, rather than going
-# through the operating system.
-command = '{} -q {} {}'.format(dotest_path, dotest_args, ' '.join(
-sys.argv[1:]))
-os.system(command)
__

Re: [Lldb-commits] [lldb] r327512 - [test] Disable TestMachCore everywhere except on Darwin

2018-03-14 Thread Greg Clayton via lldb-commits
What part is ifdef'ed? Mach core files should be available on any platform?

> On Mar 14, 2018, at 7:16 AM, Jonas Devlieghere via lldb-commits 
>  wrote:
> 
> Author: jdevlieghere
> Date: Wed Mar 14 07:16:23 2018
> New Revision: 327512
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=327512&view=rev
> Log:
> [test] Disable TestMachCore everywhere except on Darwin
> 
> Apparently the parser is wrapped inside ifdef's so the logic isn't
> available on non-Darwin platforms.
> 
> Should fix build bot failure:
>  http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463
> 
> Modified:
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> 
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=327512&r1=327511&r2=327512&view=diff
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
>  (original)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
>  Wed Mar 14 07:16:23 2018
> @@ -26,6 +26,7 @@ class MachCoreTestCase(TestBase):
> lldb.DBG.SetSelectedPlatform(self._initial_platform)
> super(MachCoreTestCase, self).tearDown()
> 
> +@skipUnlessDarwin
> def test_selected_thread(self):
> """Test that the right thread is selected after a core is loaded."""
> # Create core form YAML.
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] r327512 - [test] Disable TestMachCore everywhere except on Darwin

2018-03-14 Thread Pavel Labath via lldb-commits
Take a look at #ifdef __APPLE__ around ObjectFileMachO in
SystemInitializerCommon.cpp.

I tried removing that, but that led to a bunch of undefined symbol errors
(because of other stuff that was ifdefed out). It could be this is just a
matter of removing enough ifdefs, but I haven't tried following through on
that (so I don't know whether we'll run into some code including system
headers or such...).


On Wed, 14 Mar 2018 at 17:20, Greg Clayton via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> What part is ifdef'ed? Mach core files should be available on any platform?
>
> > On Mar 14, 2018, at 7:16 AM, Jonas Devlieghere via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
> >
> > Author: jdevlieghere
> > Date: Wed Mar 14 07:16:23 2018
> > New Revision: 327512
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=327512&view=rev
> > Log:
> > [test] Disable TestMachCore everywhere except on Darwin
> >
> > Apparently the parser is wrapped inside ifdef's so the logic isn't
> > available on non-Darwin platforms.
> >
> > Should fix build bot failure:
> >
> http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463
> >
> > Modified:
> >
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> >
> > Modified:
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=327512&r1=327511&r2=327512&view=diff
> >
> ==
> > ---
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> (original)
> > +++
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> Wed Mar 14 07:16:23 2018
> > @@ -26,6 +26,7 @@ class MachCoreTestCase(TestBase):
> > lldb.DBG.SetSelectedPlatform(self._initial_platform)
> > super(MachCoreTestCase, self).tearDown()
> >
> > +@skipUnlessDarwin
> > def test_selected_thread(self):
> > """Test that the right thread is selected after a core is
> loaded."""
> > # Create core form YAML.
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44306: Move Args::StringToAddress to Target::EvaluateAddressExpression

2018-03-14 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 138418.
labath added a comment.
Herald added a subscriber: mgorny.

This is a version that moves the StringTo*** functions to a new
"OptionArgParser" class. I'm not terribly proud of the name, but I couldn't
think of anything better -- we already have a OptionParser class, so I wanted
to make it clear that this is for parsing the *arguments* of the options.

I deliberately left out three functions out of this move (StringToVersion,
StringToGenericRegister and StringToVersion), as these are not used by the
Interpreter/Command libraries, but things like Host and ProcessGDBRemote, and
so I think they should have a different home.

Let me know what you think.


https://reviews.llvm.org/D44306

Files:
  include/lldb/Interpreter/Args.h
  include/lldb/Interpreter/OptionArgParser.h
  include/lldb/Interpreter/Options.h
  source/API/SBDebugger.cpp
  source/Commands/CommandObjectBreakpoint.cpp
  source/Commands/CommandObjectBreakpointCommand.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectDisassemble.cpp
  source/Commands/CommandObjectExpression.cpp
  source/Commands/CommandObjectLog.cpp
  source/Commands/CommandObjectMemory.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Commands/CommandObjectSource.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Commands/CommandObjectThread.cpp
  source/Commands/CommandObjectType.cpp
  source/Commands/CommandObjectWatchpointCommand.cpp
  source/Interpreter/Args.cpp
  source/Interpreter/CMakeLists.txt
  source/Interpreter/OptionArgParser.cpp
  source/Interpreter/OptionGroupValueObjectDisplay.cpp
  source/Interpreter/OptionGroupWatchpoint.cpp
  source/Interpreter/OptionValueBoolean.cpp
  source/Interpreter/OptionValueChar.cpp
  source/Interpreter/OptionValueFormat.cpp
  source/Interpreter/Property.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  source/Target/Process.cpp
  unittests/Interpreter/CMakeLists.txt
  unittests/Interpreter/TestArgs.cpp
  unittests/Interpreter/TestOptionArgParser.cpp

Index: unittests/Interpreter/TestOptionArgParser.cpp
===
--- /dev/null
+++ unittests/Interpreter/TestOptionArgParser.cpp
@@ -0,0 +1,121 @@
+//===-- ArgsTest.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+#include "lldb/Interpreter/OptionArgParser.h"
+
+using namespace lldb_private;
+
+TEST(OptionArgParserTest, toBoolean) {
+  bool success = false;
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("true"), false, nullptr));
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("on"), false, nullptr));
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("yes"), false, nullptr));
+  EXPECT_TRUE(OptionArgParser::toBoolean(llvm::StringRef("1"), false, nullptr));
+
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("true"), false, &success));
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("on"), false, &success));
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("yes"), false, &success));
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("1"), false, &success));
+  EXPECT_TRUE(success);
+
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("false"), true, nullptr));
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("off"), true, nullptr));
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("no"), true, nullptr));
+  EXPECT_FALSE(OptionArgParser::toBoolean(llvm::StringRef("0"), true, nullptr));
+
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("false"), true, &success));
+  EXPECT_TRUE(success);
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("off"), true, &success));
+  EXPECT_TRUE(success);
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("no"), true, &success));
+  EXPECT_TRUE(success);
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("0"), true, &success));
+  EXPECT_TRUE(success);
+
+  EXPECT_FALSE(
+  OptionArgParser::toBoolean(llvm::StringRef("10"), false, &success));
+  EXPECT_FALSE(success);
+  EXPECT_TRUE(
+  OptionArgParser::toBoolean(llvm::StringRef("10"), true, &success));
+  EXPECT_FALSE(success);
+  EXPECT_TRUE(OptionArgParser::toBoolean(l

Re: [Lldb-commits] [lldb] r327512 - [test] Disable TestMachCore everywhere except on Darwin

2018-03-14 Thread Greg Clayton via lldb-commits
That shouldn't be there. Lets remove it and see how things go.


> On Mar 14, 2018, at 10:30 AM, Pavel Labath  wrote:
> 
> Take a look at #ifdef __APPLE__ around ObjectFileMachO in 
> SystemInitializerCommon.cpp.
> 
> I tried removing that, but that led to a bunch of undefined symbol errors 
> (because of other stuff that was ifdefed out). It could be this is just a 
> matter of removing enough ifdefs, but I haven't tried following through on 
> that (so I don't know whether we'll run into some code including system 
> headers or such...).
> 
> 
> On Wed, 14 Mar 2018 at 17:20, Greg Clayton via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> What part is ifdef'ed? Mach core files should be available on any platform?
> 
> > On Mar 14, 2018, at 7:16 AM, Jonas Devlieghere via lldb-commits 
> > mailto:lldb-commits@lists.llvm.org>> wrote:
> >
> > Author: jdevlieghere
> > Date: Wed Mar 14 07:16:23 2018
> > New Revision: 327512
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=327512&view=rev 
> > 
> > Log:
> > [test] Disable TestMachCore everywhere except on Darwin
> >
> > Apparently the parser is wrapped inside ifdef's so the logic isn't
> > available on non-Darwin platforms.
> >
> > Should fix build bot failure:
> >  
> > http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463
> >  
> > 
> >
> > Modified:
> >
> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> >
> > Modified: 
> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> > URL: 
> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=327512&r1=327511&r2=327512&view=diff
> >  
> > 
> > ==
> > --- 
> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> >  (original)
> > +++ 
> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
> >  Wed Mar 14 07:16:23 2018
> > @@ -26,6 +26,7 @@ class MachCoreTestCase(TestBase):
> > lldb.DBG.SetSelectedPlatform(self._initial_platform)
> > super(MachCoreTestCase, self).tearDown()
> >
> > +@skipUnlessDarwin
> > def test_selected_thread(self):
> > """Test that the right thread is selected after a core is loaded."""
> > # Create core form YAML.
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org 
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
> > 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
> 

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


Re: [Lldb-commits] [lldb] r327512 - [test] Disable TestMachCore everywhere except on Darwin

2018-03-14 Thread Greg Clayton via lldb-commits
That might have been there from before when we might have used system headers 
for the mach-o stuff. That was a way long time ago. We now use LLVM's headers 
for everything so it should be safe.

> On Mar 14, 2018, at 11:29 AM, Greg Clayton  wrote:
> 
> That shouldn't be there. Lets remove it and see how things go.
> 
> 
>> On Mar 14, 2018, at 10:30 AM, Pavel Labath > > wrote:
>> 
>> Take a look at #ifdef __APPLE__ around ObjectFileMachO in 
>> SystemInitializerCommon.cpp.
>> 
>> I tried removing that, but that led to a bunch of undefined symbol errors 
>> (because of other stuff that was ifdefed out). It could be this is just a 
>> matter of removing enough ifdefs, but I haven't tried following through on 
>> that (so I don't know whether we'll run into some code including system 
>> headers or such...).
>> 
>> 
>> On Wed, 14 Mar 2018 at 17:20, Greg Clayton via lldb-commits 
>> mailto:lldb-commits@lists.llvm.org>> wrote:
>> What part is ifdef'ed? Mach core files should be available on any platform?
>> 
>> > On Mar 14, 2018, at 7:16 AM, Jonas Devlieghere via lldb-commits 
>> > mailto:lldb-commits@lists.llvm.org>> wrote:
>> >
>> > Author: jdevlieghere
>> > Date: Wed Mar 14 07:16:23 2018
>> > New Revision: 327512
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=327512&view=rev 
>> > 
>> > Log:
>> > [test] Disable TestMachCore everywhere except on Darwin
>> >
>> > Apparently the parser is wrapped inside ifdef's so the logic isn't
>> > available on non-Darwin platforms.
>> >
>> > Should fix build bot failure:
>> >  
>> > http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463
>> >  
>> > 
>> >
>> > Modified:
>> >
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
>> >
>> > Modified: 
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
>> > URL: 
>> > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=327512&r1=327511&r2=327512&view=diff
>> >  
>> > 
>> > ==
>> > --- 
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
>> >  (original)
>> > +++ 
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
>> >  Wed Mar 14 07:16:23 2018
>> > @@ -26,6 +26,7 @@ class MachCoreTestCase(TestBase):
>> > lldb.DBG.SetSelectedPlatform(self._initial_platform)
>> > super(MachCoreTestCase, self).tearDown()
>> >
>> > +@skipUnlessDarwin
>> > def test_selected_thread(self):
>> > """Test that the right thread is selected after a core is 
>> > loaded."""
>> > # Create core form YAML.
>> >
>> >
>> > ___
>> > lldb-commits mailing list
>> > lldb-commits@lists.llvm.org 
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
>> > 
>> 
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
>> 
> 

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


[Lldb-commits] [PATCH] D44306: Move Args::StringToAddress to Target::EvaluateAddressExpression

2018-03-14 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Except for the to -> To to keep consistent with all the other lldb function 
naming this looks fine.

Now that they are all together it's easy to see we haven't been consistent in 
these functions.  We really should make ToFormat return the format & take an 
error reference, and have ToBoolean take an error so callers don't have to cons 
it up.  But that's orthogonal to this patch.




Comment at: include/lldb/Interpreter/OptionArgParser.h:18-19
+struct OptionArgParser {
+  static lldb::addr_t toAddress(const ExecutionContext *exe_ctx,
+llvm::StringRef s, lldb::addr_t fail_value,
+Status *error);

Should be ToAddress.


https://reviews.llvm.org/D44306



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


Re: [Lldb-commits] [PATCH] D44306: Move Args::StringToAddress to Target::EvaluateAddressExpression

2018-03-14 Thread Zachary Turner via lldb-commits
I think having all parsing functions in a single place will just move the
layering problem elsewhere, since a bunch of conversion functions for
objects from various libraries will be mushed together into one place.

On Wed, Mar 14, 2018 at 11:34 AM Jim Ingham via Phabricator <
revi...@reviews.llvm.org> wrote:

> jingham added a comment.
>
> Except for the to -> To to keep consistent with all the other lldb
> function naming this looks fine.
>
> Now that they are all together it's easy to see we haven't been consistent
> in these functions.  We really should make ToFormat return the format &
> take an error reference, and have ToBoolean take an error so callers don't
> have to cons it up.  But that's orthogonal to this patch.
>
>
>
> 
> Comment at: include/lldb/Interpreter/OptionArgParser.h:18-19
> +struct OptionArgParser {
> +  static lldb::addr_t toAddress(const ExecutionContext *exe_ctx,
> +llvm::StringRef s, lldb::addr_t
> fail_value,
> +Status *error);
> 
> Should be ToAddress.
>
>
> https://reviews.llvm.org/D44306
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r327552 - [test] Delete some xfailed lldb-mi tests

2018-03-14 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Wed Mar 14 11:37:13 2018
New Revision: 327552

URL: http://llvm.org/viewvc/llvm-project?rev=327552&view=rev
Log:
[test] Delete some xfailed lldb-mi tests

This is a first pass at removing some lldb-mi tests which have been
xfailed and unmaintained for a while. We have open PRs for most of these
tests already. I've opened up the following additional PRs:

  llvm.org/PR36739 - lldb-mi driver exits properly
  llvm.org/PR36740 - lldb-mi -gdb-set and -gdb-show
  llvm.org/PR36741 - lldb-mi -symbol-xxx

The motivation here is to address timeout and pexpect-related issues in
the test suite. This was discussed on lldb-dev in the thread: "increase
timeout for tests?".

After this change, the lldb-mi tests seem to be in better health (on
Darwin at least). I consistently get:

$ ./bin/llvm-dotest -p TestMi
===
Test Result Summary
===
Test Methods:101
Reruns:0
Success:  88
Expected Failure:  0
Failure:   0
Error: 0
Exceptional Exit:  0
Unexpected Success:0
Skip: 13
Timeout:   0
Expected Timeout:  0

Removed:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py
Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py

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

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py

Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py?rev=327551&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py 
(removed)
@@ -1,97 +0,0 @@
-"""
-Test that the lldb-mi driver exits properly.
-"""
-
-from __future__ import print_function
-
-import lldbmi_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
-@skipIfDarwin   # pexpect is known to be unreliable on Darwin
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_gdb_exit(self):
-"""Test that '-gdb-exit' terminates local debug session and exits."""
-
-self.spawnLldbMi(args=None)
-
-# Load executable
-self.runCmd("-file-exec-and-symbols %s" % self.myexe)
-self.expect("\^done")
-
-# Run to main
-self.runCmd("-break-insert -f main")
-self.expect("\^done,bkpt={number=\"1\"")
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
-# Test -gdb-exit: try to exit and check that program is finished
-self.runCmd("-gdb-exit")
-self.expect("\^exit")
-import pexpect
-self.expect(pexpect.EOF)
-
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
-@skipIfDarwin   # pexpect is known to be unreliable on Darwin
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_quit(self):
-"""Test that 'quit' exits immediately."""
-
-self.spawnLldbMi(args=None)
-
-# Load executable
-self.runCmd("-file-exec-and-symbols %s" % self.myexe)
-self.expect("\^done")
-
-# Run to main
-self.runCmd("-break-insert -f main")
-self.expect("\^done,bkpt={number=\"1\"")
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
-# Test quit: try to exit and check that program is finished
-self.runCmd("quit")
-import pexpect
-self.expect(pexpect.EOF)
-
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
-@skipIfDarwin   # pexpect is known to be unreliable on Darwin
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to kn

[Lldb-commits] [PATCH] D44306: Move Args::StringToAddress to Target::EvaluateAddressExpression

2018-03-14 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a subscriber: labath.
zturner added a comment.

I think having all parsing functions in a single place will just move the
layering problem elsewhere, since a bunch of conversion functions for
objects from various libraries will be mushed together into one place.


https://reviews.llvm.org/D44306



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


[Lldb-commits] [PATCH] D44306: Move Args::StringToAddress to Target::EvaluateAddressExpression

2018-03-14 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

As long as these functions are used for parsing options args in individual 
CommandObject implementations, and don't get dragged lower in the stack, I 
don't think that's a problem.  By the time you're getting to individual 
commands you are on top of pretty much everything else in lldb, and can expect 
to rely on whatever.  And the value of having all the converters gathered in 
one place so people writing new commands can easily do the right thing when 
ingesting arguments more than justifies this gathering of disparate elements 
IMO.


https://reviews.llvm.org/D44306



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


[Lldb-commits] [PATCH] D44306: Move Args::StringToAddress to Target::EvaluateAddressExpression

2018-03-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I agree with Jim. I deliberately put here only the types that are used for 
command parsing, since I presume these are the things that the 
Command/Interpreter modules will depend on (it's not fully clear to me where to 
draw the line between these two, so it may end up needing to be moved from one 
to the other in the future, but I think that future will be pretty far away).

I also thought about the case when something else, which is logically lower 
than Interpreter/Command needs the string conversion functions -- in this case 
we could put the conversion function in a different module, but still keep the 
function in OptionArgParser as a wrapper on top of that. This way you would 
still have all the argument parsing functions in one place, while the things in 
the other modules (which by definition will not be parsing option arguments, or 
else they would be in these modules), can call the lower level function 
directly.

Ultimately, solving the layering of string conversion functions is not my goal 
here. I would be fully satisfied with breaking even. My goal is to move this 
stuff out of the Args class, so it can be moved down to Utility, as it is one 
of the main causes that everything depends on Interpreter (and then everything 
else).


https://reviews.llvm.org/D44306



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


[Lldb-commits] [lldb] r327568 - [test] Skip some lldb-mi tests which time out on Darwin

2018-03-14 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Wed Mar 14 13:32:10 2018
New Revision: 327568

URL: http://llvm.org/viewvc/llvm-project?rev=327568&view=rev
Log:
[test] Skip some lldb-mi tests which time out on Darwin

These don't always timeout, but it's inconvenient when they do.

Modified:

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

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py?rev=327568&r1=327567&r2=327568&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py 
Wed Mar 14 13:32:10 2018
@@ -18,6 +18,7 @@ class MiLibraryLoadedTestCase(lldbmi_tes
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfRemote   # We do not currently support remote debugging via the MI.
+@skipIfDarwin
 def test_lldbmi_library_loaded(self):
 """Test that 'lldb-mi --interpreter' shows the =library-loaded 
notifications."""
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=327568&r1=327567&r2=327568&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 Wed Mar 14 13:32:10 2018
@@ -18,6 +18,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 @skipIfRemote   # We do not currently support remote debugging via the MI.
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfDarwin
 def test_lldbmi_executable_option_file(self):
 """Test that 'lldb-mi --interpreter %s' loads executable file."""
 
@@ -44,6 +45,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfDarwin
 def test_lldbmi_executable_option_unknown_file(self):
 """Test that 'lldb-mi --interpreter %s' fails on unknown executable 
file."""
 
@@ -64,6 +66,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 @skipIfRemote   # We do not currently support remote debugging via the MI.
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfDarwin
 def test_lldbmi_executable_option_absolute_path(self):
 """Test that 'lldb-mi --interpreter %s' loads executable which is 
specified via absolute path."""
 
@@ -86,6 +89,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 @skipIfRemote   # We do not currently support remote debugging via the MI.
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfDarwin
 def test_lldbmi_executable_option_relative_path(self):
 """Test that 'lldb-mi --interpreter %s' loads executable which is 
specified via relative path."""
 
@@ -108,6 +112,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfDarwin
 def test_lldbmi_executable_option_unknown_path(self):
 """Test that 'lldb-mi --interpreter %s' fails on executable file which 
is specified via unknown path."""
 
@@ -139,6 +144,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+@skipIfDarwin
 def test_lldbmi_source_option_start_script(self):
 """Test that 'lldb-mi --interpreter' can execute user's commands after 
initial commands were executed."""
 
@@ -182,6 +188,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure pres

[Lldb-commits] [lldb] r327586 - [test] Skip more lldb-mi tests which occasionally time out on Darwin

2018-03-14 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Wed Mar 14 15:52:32 2018
New Revision: 327586

URL: http://llvm.org/viewvc/llvm-project?rev=327586&view=rev
Log:
[test] Skip more lldb-mi tests which occasionally time out on Darwin

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py?rev=327586&r1=327585&r2=327586&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py 
Wed Mar 14 15:52:32 2018
@@ -18,6 +18,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfRemote   # We do not currently support remote debugging via the MI.
+@skipIfDarwin
 def test_lldbmi_eval(self):
 """Test that 'lldb-mi --interpreter' works for evaluating."""
 
@@ -159,7 +160,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
-@skipIfDarwin # rdar://33462982
+@skipIfDarwin
 @skipIfRemote   # We do not currently support remote debugging via the MI.
 def test_lldbmi_var_update(self):
 """Test that 'lldb-mi --interpreter' works for -var-update."""
@@ -231,6 +232,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfRemote   # We do not currently support remote debugging via the MI.
+@skipIfDarwin
 def test_lldbmi_var_create_register(self):
 """Test that 'lldb-mi --interpreter' works for -var-create $regname."""
 
@@ -275,6 +277,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
 @skipIfRemote   # We do not currently support remote debugging via the MI.
+@skipIfDarwin
 def test_lldbmi_var_list_children(self):
 """Test that 'lldb-mi --interpreter' works for -var-list-children."""
 
@@ -395,6 +398,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
 @skipIfRemote   # We do not currently support remote debugging via the MI.
+@skipIfDarwin
 def test_lldbmi_var_create_for_stl_types(self):
 """Test that 'lldb-mi --interpreter' print summary for STL types."""
 
@@ -421,6 +425,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
 @skipIfRemote   # We do not currently support remote debugging via the MI.
+@skipIfDarwin
 def test_lldbmi_var_create_for_unnamed_objects(self):
 """Test that 'lldb-mi --interpreter' can expand unnamed structures and 
unions."""
 


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


[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-14 Thread Timothee Cour via Phabricator via lldb-commits
timotheecour updated this revision to Diff 138471.
timotheecour added a comment.

- added d_terminate
- format


https://reviews.llvm.org/D44321

Files:
  include/lldb/Core/Mangled.h
  include/lldb/Core/PluginManager.h
  source/API/SystemInitializerFull.cpp
  source/Core/CMakeLists.txt
  source/Core/Mangled.cpp
  source/Core/PluginManager.cpp
  source/Plugins/Language/CMakeLists.txt
  source/Plugins/Language/D/CMakeLists.txt
  source/Plugins/Language/D/DLanguage.cpp
  source/Plugins/Language/D/DLanguage.h

Index: source/Plugins/Language/D/DLanguage.h
===
--- /dev/null
+++ source/Plugins/Language/D/DLanguage.h
@@ -0,0 +1,81 @@
+//===-- DLanguage.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+/*
+to use, add this to .lldbinit:
+settings set plugin.language.D.pluginfile "path/to/liblldbdplugin.dylib"
+example of such plugin:
+https://github.com/timotheecour/dtools/blob/master/dtools/lldbdplugin.d
+*/
+
+#ifndef liblldb_DLanguage_h_
+#define liblldb_DLanguage_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Language.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class DLanguageProperties : public Properties {
+public:
+  DLanguageProperties();
+
+  ~DLanguageProperties() override;
+
+  llvm::StringRef GetPluginfileDlang();
+};
+
+class DLanguage : public Language {
+public:
+  typedef std::shared_ptr DLanguagePropertiesSP;
+
+  DLanguage() = default;
+
+  ~DLanguage() override = default;
+
+  lldb::LanguageType GetLanguageType() const override {
+return lldb::eLanguageTypeD;
+  }
+
+  //--
+  // Static Functions
+  //--
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::Language *CreateInstance(lldb::LanguageType language);
+
+  static void DebuggerInitialize(lldb_private::Debugger &debugger);
+
+  static DLanguage *Instance();
+
+  static const DLanguagePropertiesSP &GetGlobalProperties();
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  static bool IsDMangledName(const char *name);
+  // Consider using non-static methods
+  static char *demangle(const ConstString &mangled);
+
+  //--
+  // PluginInterface protocol
+  //--
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DLanguage_h_
Index: source/Plugins/Language/D/DLanguage.cpp
===
--- /dev/null
+++ source/Plugins/Language/D/DLanguage.cpp
@@ -0,0 +1,156 @@
+//===-- DLanguage.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "DLanguage.h"
+
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/Property.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Log.h"
+#include "llvm/Support/DynamicLibrary.h"
+
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+using llvm::sys::DynamicLibrary;
+
+namespace {
+
+template 
+Fun *getTypedSymbol(DynamicLibrary &lib, const char *symbol) {
+  return reinterpret_cast(lib.getAddressOfSymbol(symbol));
+}
+
+// D Plugin will define these symbols. They're declared to use with decltype.
+extern "C" {
+// called once, to initialize druntime. Return true on success
+bool d_initialize();
+// can be called to release resources allocated via d_initialize. Return true on
+// success.
+bool d_terminate();
+// The returned pointer should be allocated via malloc and owned by the caller.
+char *lldbd_demangle(size_t length, const char *mangled);
+}
+
+static PropertyDefinition g_properties[] = {
+{"pluginfile", OptionValue::eTypeString, true,
+ OptionValueString::eOptionEncodeCharacterEscapeSequences, "", nullptr,
+ "The plugin shared library file to use for D language."},
+};
+
+enum {
+  ePropertyPluginfileDlang,
+};
+
+} // anonymous namespace
+
+// DLanguageProperties
+DLanguageProperties::~DLanguageProperties() = default;
+
+DLanguageProperties::DLanguageProperties() : Properties() {
+  m_collectio

[Lldb-commits] [lldb] r327587 - [DataFormatters] Implement summary for __NSDictionary0.

2018-03-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Mar 14 16:09:36 2018
New Revision: 327587

URL: http://llvm.org/viewvc/llvm-project?rev=327587&view=rev
Log:
[DataFormatters] Implement summary for __NSDictionary0.

Before the patch:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x000100304420

After:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x000100304420 0 key/value pairs

There's nothing much else we can do, as this is always empty by
definition.



Added:
lldb/trunk/lit/DataFormatters/
lldb/trunk/lit/DataFormatters/Inputs/
lldb/trunk/lit/DataFormatters/Inputs/NSDict.commands
lldb/trunk/lit/DataFormatters/Inputs/NSDict.m
lldb/trunk/lit/DataFormatters/TestEmptyDictionary.test
lldb/trunk/lit/DataFormatters/lit.local.cfg
Modified:
lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp

Added: lldb/trunk/lit/DataFormatters/Inputs/NSDict.commands
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/DataFormatters/Inputs/NSDict.commands?rev=327587&view=auto
==
--- lldb/trunk/lit/DataFormatters/Inputs/NSDict.commands (added)
+++ lldb/trunk/lit/DataFormatters/Inputs/NSDict.commands Wed Mar 14 16:09:36 
2018
@@ -0,0 +1,3 @@
+breakpoint set --file NSDict.m --line 8
+run
+frame var

Added: lldb/trunk/lit/DataFormatters/Inputs/NSDict.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/DataFormatters/Inputs/NSDict.m?rev=327587&view=auto
==
--- lldb/trunk/lit/DataFormatters/Inputs/NSDict.m (added)
+++ lldb/trunk/lit/DataFormatters/Inputs/NSDict.m Wed Mar 14 16:09:36 2018
@@ -0,0 +1,9 @@
+#include 
+
+int main(void)
+{
+  NSDictionary *emptyDictionary = [[NSDictionary alloc] init];
+  NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionary];
+  NSDictionary *dictionary = @{ @"key": @{} };
+  return 0;
+}

Added: lldb/trunk/lit/DataFormatters/TestEmptyDictionary.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/DataFormatters/TestEmptyDictionary.test?rev=327587&view=auto
==
--- lldb/trunk/lit/DataFormatters/TestEmptyDictionary.test (added)
+++ lldb/trunk/lit/DataFormatters/TestEmptyDictionary.test Wed Mar 14 16:09:36 
2018
@@ -0,0 +1,7 @@
+# Test that foundation NSDictionary0 is formatted correctly (the summary).
+# Foundation is only available on Darwin so just restrict the test to run 
there.
+# REQUIRES: darwin
+# RUN: %cc %p/Inputs/NSDict.m -framework Foundation -g -o %t && %lldb -b \
+# RUN:  -s %p/Inputs/NSDict.commands -- %t 2>&1 | FileCheck %s
+
+# CHECK: (__NSDictionary0 *) emptyDictionary = {{.*}} 0 key/value pairs

Added: lldb/trunk/lit/DataFormatters/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/DataFormatters/lit.local.cfg?rev=327587&view=auto
==
--- lldb/trunk/lit/DataFormatters/lit.local.cfg (added)
+++ lldb/trunk/lit/DataFormatters/lit.local.cfg Wed Mar 14 16:09:36 2018
@@ -0,0 +1 @@
+config.suffixes = ['.test']

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp?rev=327587&r1=327586&r2=327587&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp Wed Mar 14 
16:09:36 2018
@@ -396,6 +396,7 @@ bool lldb_private::formatters::NSDiction
   static const ConstString g_DictionaryMLegacy("__NSDictionaryM_Legacy");
   static const ConstString g_DictionaryMImmutable("__NSDictionaryM_Immutable");
   static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
+  static const ConstString g_Dictionary0("__NSDictionary0");
 
   if (class_name.IsEmpty())
 return false;
@@ -423,6 +424,8 @@ bool lldb_private::formatters::NSDiction
   return false;
   } else if (class_name == g_Dictionary1) {
 value = 1;
+  } else if (class_name == g_Dictionary0) {
+value = 0;
   }
   else {
 auto &map(NSDictionary_Additionals::GetAdditionalSummaries());
@@ -481,6 +484,7 @@ lldb_private::formatters::NSDictionarySy
   static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
   static const ConstString g_DictionaryImmutable("__NSDictionaryM_Immutable");
   static const ConstString g_DictionaryMLegacy("__NSDictionaryM_Legacy");
+  static const ConstString g_Dictionary0("__NSDictionary0");
 
   if (class_name.IsEmpty())
 return nullptr;


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


[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-14 Thread Timothee Cour via Phabricator via lldb-commits
timotheecour added a comment.

> How do you de-initialize druntime? (without de-init, there is a big mem leak)

There is no memory leak because `d_initialize` once (using c++11 static 
initialization pattern) and is intended to last for duration of application; so 
druntime will be initialized only once, upon 1st use.

I've however added `d_terminate` in case a future PR wants to de-initialize 
druntime (eg in DLanguage::Terminate)


https://reviews.llvm.org/D44321



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


[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

2018-03-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: jingham, labath, lldb-commits.

When using:

  (lldb) settings set target.source-map ./ /path/to/source

LLDB would fail to set a source file and line breakpoint with:

  (lldb) breakpoint set --file /path/to/source/main.c --line 2

Because code in the target was undoing the remapping of 
"/path/to/source/main.c" to "./main.c" and then it would resolve this path, 
which would append the current working directory to the path. We don't want to 
resolve paths that we unmap.

Test case added.


https://reviews.llvm.org/D44502

Files:
  
packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
  packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -330,7 +330,7 @@
   ConstString remapped_path;
   if (GetSourcePathMap().ReverseRemapPath(ConstString(file.GetPath().c_str()),
   remapped_path))
-remapped_file.SetFile(remapped_path.AsCString(), true);
+remapped_file.SetFile(remapped_path.AsCString(), false);
   else
 remapped_file = file;
 
Index: packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
===
--- packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
+++ packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
@@ -0,0 +1,396 @@
+--- !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x0107
+  cpusubtype:  0x0003
+  filetype:0x000A
+  ncmds:   6
+  sizeofcmds:  1376
+  flags:   0x
+  reserved:0x
+LoadCommands:
+  - cmd: LC_UUID
+cmdsize: 24
+uuid:D37CC773-C218-3F97-99C9-CE4E77DDF2CE
+  - cmd: LC_SYMTAB
+cmdsize: 24
+symoff:  4096
+nsyms:   2
+stroff:  4128
+strsize: 28
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __PAGEZERO
+vmaddr:  0
+vmsize:  4294967296
+fileoff: 0
+filesize:0
+maxprot: 0
+initprot:0
+nsects:  0
+flags:   0
+  - cmd: LC_SEGMENT_64
+cmdsize: 232
+segname: __TEXT
+vmaddr:  4294967296
+vmsize:  4096
+fileoff: 0
+filesize:0
+maxprot: 7
+initprot:5
+nsects:  2
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x00010FA0
+size:15
+offset:  0x
+align:   4
+reloff:  0x
+nreloc:  0
+flags:   0x8400
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - sectname:__unwind_info
+segname: __TEXT
+addr:0x00010FB0
+size:72
+offset:  0x
+align:   2
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __LINKEDIT
+vmaddr:  4294971392
+vmsize:  4096
+fileoff: 4096
+filesize:60
+maxprot: 7
+initprot:1
+nsects:  0
+flags:   0
+  - cmd: LC_SEGMENT_64
+cmdsize: 952
+segname: __DWARF
+vmaddr:  4294975488
+vmsize:  4096
+fileoff: 8192
+filesize:563
+maxprot: 7
+initprot:3
+nsects:  11
+flags:   0
+Sections:
+  - sectname:__debug_line
+segname: __DWARF
+addr:0x00012000
+size:60
+offset:  0x2000
+align:   0
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - sectname:__debug_pubnames
+segname: __DWARF
+addr:0x0001203C
+size:27
+offset:  0x203C
+align:   0
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x

[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-14 Thread Johan Engelen via Phabricator via lldb-commits
johanengelen added a comment.

In https://reviews.llvm.org/D44321#1038160, @timotheecour wrote:

> > How do you de-initialize druntime? (without de-init, there is a big mem 
> > leak)
>
> There is no memory leak because `d_initialize` once (using c++11 static 
> initialization pattern) and is intended to last for duration of application; 
> so druntime will be initialized only once, upon 1st use.


When druntime is initialized, a number of resources are allocated (e.g. memory 
and mutex). Yes you initialize druntime once, I can see that. You don't 
deinitialize druntime at all: that's the resource leak.


https://reviews.llvm.org/D44321



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


[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

2018-03-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

The DWARF file that this produces has a DW_AT_comp_dir set to ".". This is 
similar to how some builds work at Facebook when using Buck to build things.


https://reviews.llvm.org/D44502



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


[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-14 Thread Timothee Cour via Phabricator via lldb-commits
timotheecour added a comment.

> When druntime is initialized, a number of resources are allocated (e.g. 
> memory and mutex). Yes you initialize druntime once, I can see that. You 
> don't deinitialize druntime at all: that's the resource leak.

Where would you want me to deinit? inside ` DLanguage::Terminate` ?


https://reviews.llvm.org/D44321



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


[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-14 Thread Timothee Cour via Phabricator via lldb-commits
timotheecour added inline comments.



Comment at: source/Plugins/Language/D/DLanguage.cpp:108
+
+auto fun0=lib2->getFun("d_initialize");
+(*fun0)();

johanengelen wrote:
> timotheecour wrote:
> > johanengelen wrote:
> > > Would it help to initialize druntime using a static module constructor in 
> > > the lldbdplugin dll?
> > > (then you can also do de-init using a static module destructor)
> > I don't really like static module constructor because it adds cyclic 
> > dependencies, see for vibe.d moving away from it: 
> > https://forum.dlang.org/post/qtabwblpaqwpteyst...@forum.dlang.org
> > explicit calling `d_initialize` is simple enough.
> > 
> > 
> > 
> Module ctors don't add cyclic dependencies by themselves. There is also no 
> danger of that here.
> How do you de-initialize druntime? (without de-init, there is a big mem leak)
> Module ctors don't add cyclic dependencies by themselves. There is also no 
> danger of that here.

* We can have cyclic dependencies but not when Module ctors are involved; see 
previous argument I made with vibe.d, or other threads (eg 
https://forum.dlang.org/post/rrcshskphugsvksao...@forum.dlang.org).

* Also, current code allows for liblldbplugin.d to be imported from another 
module whereas it would cause complications if it contained a module ctor that 
would initialize druntime.

calling `d_initialize` as I'm doing works fine.




Comment at: source/Plugins/Language/D/DLanguage.cpp:108
+
+auto fun0=lib2->getFun("d_initialize");
+(*fun0)();

timotheecour wrote:
> johanengelen wrote:
> > timotheecour wrote:
> > > johanengelen wrote:
> > > > Would it help to initialize druntime using a static module constructor 
> > > > in the lldbdplugin dll?
> > > > (then you can also do de-init using a static module destructor)
> > > I don't really like static module constructor because it adds cyclic 
> > > dependencies, see for vibe.d moving away from it: 
> > > https://forum.dlang.org/post/qtabwblpaqwpteyst...@forum.dlang.org
> > > explicit calling `d_initialize` is simple enough.
> > > 
> > > 
> > > 
> > Module ctors don't add cyclic dependencies by themselves. There is also no 
> > danger of that here.
> > How do you de-initialize druntime? (without de-init, there is a big mem 
> > leak)
> > Module ctors don't add cyclic dependencies by themselves. There is also no 
> > danger of that here.
> 
> * We can have cyclic dependencies but not when Module ctors are involved; see 
> previous argument I made with vibe.d, or other threads (eg 
> https://forum.dlang.org/post/rrcshskphugsvksao...@forum.dlang.org).
> 
> * Also, current code allows for liblldbplugin.d to be imported from another 
> module whereas it would cause complications if it contained a module ctor 
> that would initialize druntime.
> 
> calling `d_initialize` as I'm doing works fine.
> 
> How do you de-initialize druntime? (without de-init, there is a big mem leak)

There is no memory leak because d_initialize once (using c++11 static 
initialization pattern) and is intended to last for duration of application; so 
druntime will be initialized only once, upon 1st use.

I've however added d_terminate in case a future PR wants to de-initialize 
druntime (eg in DLanguage::Terminate)


https://reviews.llvm.org/D44321



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


[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

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

This seems clearly right to me.  Thanks for the test.


https://reviews.llvm.org/D44502



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


[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

2018-03-14 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

(please wait a day or two if @labath has comments) but this should be fine.


https://reviews.llvm.org/D44502



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


[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

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

LGTM, thanks


https://reviews.llvm.org/D44502



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


[Lldb-commits] [PATCH] D44321: Support demangling for D symbols via dlopen

2018-03-14 Thread Timothee Cour via Phabricator via lldb-commits
timotheecour updated this revision to Diff 138477.
timotheecour added a comment.

- fix assert fail when plugin.language.D.pluginfile empty


https://reviews.llvm.org/D44321

Files:
  include/lldb/Core/Mangled.h
  include/lldb/Core/PluginManager.h
  source/API/SystemInitializerFull.cpp
  source/Core/CMakeLists.txt
  source/Core/Mangled.cpp
  source/Core/PluginManager.cpp
  source/Plugins/Language/CMakeLists.txt
  source/Plugins/Language/D/CMakeLists.txt
  source/Plugins/Language/D/DLanguage.cpp
  source/Plugins/Language/D/DLanguage.h

Index: source/Plugins/Language/D/DLanguage.h
===
--- /dev/null
+++ source/Plugins/Language/D/DLanguage.h
@@ -0,0 +1,81 @@
+//===-- DLanguage.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+/*
+to use, add this to .lldbinit:
+settings set plugin.language.D.pluginfile "path/to/liblldbdplugin.dylib"
+example of such plugin:
+https://github.com/timotheecour/dtools/blob/master/dtools/lldbdplugin.d
+*/
+
+#ifndef liblldb_DLanguage_h_
+#define liblldb_DLanguage_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Language.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class DLanguageProperties : public Properties {
+public:
+  DLanguageProperties();
+
+  ~DLanguageProperties() override;
+
+  llvm::StringRef GetPluginfileDlang();
+};
+
+class DLanguage : public Language {
+public:
+  typedef std::shared_ptr DLanguagePropertiesSP;
+
+  DLanguage() = default;
+
+  ~DLanguage() override = default;
+
+  lldb::LanguageType GetLanguageType() const override {
+return lldb::eLanguageTypeD;
+  }
+
+  //--
+  // Static Functions
+  //--
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::Language *CreateInstance(lldb::LanguageType language);
+
+  static void DebuggerInitialize(lldb_private::Debugger &debugger);
+
+  static DLanguage *Instance();
+
+  static const DLanguagePropertiesSP &GetGlobalProperties();
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  static bool IsDMangledName(const char *name);
+  // Consider using non-static methods
+  static char *demangle(const ConstString &mangled);
+
+  //--
+  // PluginInterface protocol
+  //--
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DLanguage_h_
Index: source/Plugins/Language/D/DLanguage.cpp
===
--- /dev/null
+++ source/Plugins/Language/D/DLanguage.cpp
@@ -0,0 +1,158 @@
+//===-- DLanguage.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "DLanguage.h"
+
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/Property.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Log.h"
+#include "llvm/Support/DynamicLibrary.h"
+
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+using llvm::sys::DynamicLibrary;
+
+namespace {
+
+template 
+Fun *getTypedSymbol(DynamicLibrary &lib, const char *symbol) {
+  return reinterpret_cast(lib.getAddressOfSymbol(symbol));
+}
+
+// D Plugin will define these symbols. They're declared to use with decltype.
+extern "C" {
+// called once, to initialize druntime. Return true on success
+bool d_initialize();
+// can be called to release resources allocated via d_initialize. Return true on
+// success.
+bool d_terminate();
+// The returned pointer should be allocated via malloc and owned by the caller.
+char *lldbd_demangle(size_t length, const char *mangled);
+}
+
+static PropertyDefinition g_properties[] = {
+{"pluginfile", OptionValue::eTypeString, true,
+ OptionValueString::eOptionEncodeCharacterEscapeSequences, "", nullptr,
+ "The plugin shared library file to use for D language."},
+};
+
+enum {
+  ePropertyPluginfileDlang,
+};
+
+} // anonymous namespace
+
+// DLanguageProperties
+DLanguageProperties::~DLanguageProperties() = default;
+
+DLanguageProperties::DLanguageProperties() : 

[Lldb-commits] [lldb] r327592 - [Dictionary] Rewrite the test added in r327587 as an inline test.

2018-03-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Mar 14 17:07:05 2018
New Revision: 327592

URL: http://llvm.org/viewvc/llvm-project?rev=327592&view=rev
Log:
[Dictionary] Rewrite the test added in r327587 as an inline test.

Until we have a better story for putting commands and check lines
in the same file (they're currently ignored), it seems that inline
tests are actually more concise and easier to understand.
Too bad we have still some python boilerplate, but that's not
really substantial so we can live with it.

Thanks to Fred for pointing out and Jim for explaining me how
to use the inline test format.



Added:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m
Removed:
lldb/trunk/lit/DataFormatters/

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py?rev=327592&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/TestNSDictionary0.py
 Wed Mar 14 17:07:05 2018
@@ -0,0 +1,6 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(
+__file__, globals(), [
+decorators.skipIfFreeBSD, decorators.skipIfLinux, 
decorators.skipIfWindows])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m?rev=327592&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-foundation-dictionary-empty/main.m
 Wed Mar 14 17:07:05 2018
@@ -0,0 +1,7 @@
+#import 
+
+int main(void)
+{
+  NSDictionary *emptyDictionary = [[NSDictionary alloc] init];
+  return 0; //% self.expect("frame var emptyDictionary", substrs = ["0 
key/value pairs"]);
+}


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


[Lldb-commits] [lldb] r327595 - [test] cmake: Ensure liblldb builds before tests run

2018-03-14 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Wed Mar 14 18:09:13 2018
New Revision: 327595

URL: http://llvm.org/viewvc/llvm-project?rev=327595&view=rev
Log:
[test] cmake: Ensure liblldb builds before tests run

Without liblldb as a test dependency, tests which link it in from an
lldb framework (via Base.buildDriver()) won't work.

Modified:
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=327595&r1=327594&r2=327595&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Wed Mar 14 18:09:13 2018
@@ -40,6 +40,10 @@ if(NOT LLDB_BUILT_STANDALONE)
   list(APPEND LLDB_TEST_DEPS yaml2obj)
 endif()
 
+if(TARGET liblldb)
+  list(APPEND LLDB_TEST_DEPS liblldb)
+endif()
+
 # The default architecture with which to compile test executables is the 
default LLVM target
 # architecture, which itself defaults to the host architecture.
 string(TOLOWER "${LLVM_TARGET_ARCH}" LLDB_DEFAULT_TEST_ARCH)


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


[Lldb-commits] [lldb] r327600 - Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

2018-03-14 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Mar 14 22:13:15 2018
New Revision: 327600

URL: http://llvm.org/viewvc/llvm-project?rev=327600&view=rev
Log:
Fix a bug in "target.source-map" where we would resolve unmapped paths 
incorrectly

When using:

(lldb) settings set target.source-map ./ /path/to/source
LLDB would fail to set a source file and line breakpoint with:

(lldb) breakpoint set --file /path/to/source/main.c --line 2
Because code in the target was undoing the remapping of 
"/path/to/source/main.c" to "./main.c" and then it would resolve this path, 
which would append the current working directory to the path. We don't want to 
resolve paths that we unmap.

Test case added.

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


Added:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
Modified:
lldb/trunk/source/Target/Target.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py?rev=327600&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
 Wed Mar 14 22:13:15 2018
@@ -0,0 +1,41 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+
+class TestTargetSourceMap(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test_source_map(self):
+"""Test target.source-map' functionality."""
+# Set the target soure map to map "./" to the current test directory
+src_dir = self.getSourceDir()
+src_path = os.path.join(src_dir, "main.c")
+yaml_path = os.path.join(src_dir, "a.yaml")
+yaml_base, ext = os.path.splitext(yaml_path)
+obj_path = self.getBuildArtifact(yaml_base)
+self.yaml2obj(yaml_path, obj_path)
+
+def cleanup():
+if os.path.exists(obj_path):
+os.unlink(obj_path)
+
+# Execute the cleanup function during test case tear down.
+self.addTearDownHook(cleanup)
+
+# Create a target with the object file we just created from YAML
+target = self.dbg.CreateTarget(obj_path)
+
+# Set a breakpoint before we remap source and verify that it fails
+bp = target.BreakpointCreateByLocation(src_path, 2)
+self.assertTrue(bp.GetNumLocations() == 0,
+"make sure no breakpoints were resolved without map")
+src_map_cmd = 'settings set target.source-map ./ "%s"' % (src_dir)
+self.dbg.HandleCommand(src_map_cmd)
+
+# Set a breakpoint after we remap source and verify that it succeeds
+bp = target.BreakpointCreateByLocation(src_path, 2)
+self.assertTrue(bp.GetNumLocations() == 1,
+"make sure breakpoint was resolved with map")

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml?rev=327600&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml 
Wed Mar 14 22:13:15 2018
@@ -0,0 +1,396 @@
+--- !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x0107
+  cpusubtype:  0x0003
+  filetype:0x000A
+  ncmds:   6
+  sizeofcmds:  1376
+  flags:   0x
+  reserved:0x
+LoadCommands:
+  - cmd: LC_UUID
+cmdsize: 24
+uuid:D37CC773-C218-3F97-99C9-CE4E77DDF2CE
+  - cmd: LC_SYMTAB
+cmdsize: 24
+symoff:  4096
+nsyms:   2
+stroff:  4128
+strsize: 28
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __PAGEZERO
+vmaddr:  0
+vmsize:  4294967296
+fileoff: 0
+filesize:0
+maxprot: 0
+initprot:0
+nsects:  0
+flags:   0
+  - cmd: LC_SEGMENT_64
+cmdsize: 232
+segname: __TEXT
+vmaddr:  4294967296
+vmsize:  4096
+fileoff: 0
+filesize:0
+maxprot: 7
+initprot:5
+nsects:  2
+flags:   0
+Sections:
+  - sectname:__text
+

[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

2018-03-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Committed revision 327600.


https://reviews.llvm.org/D44502



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


[Lldb-commits] [PATCH] D44502: Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

2018-03-14 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327600: Fix a bug in "target.source-map" where we 
would resolve unmapped paths… (authored by gclayton, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D44502?vs=138472&id=138491#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44502

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/TestTargetSourceMap.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
  lldb/trunk/source/Target/Target.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/source-map/a.yaml
@@ -0,0 +1,396 @@
+--- !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x0107
+  cpusubtype:  0x0003
+  filetype:0x000A
+  ncmds:   6
+  sizeofcmds:  1376
+  flags:   0x
+  reserved:0x
+LoadCommands:
+  - cmd: LC_UUID
+cmdsize: 24
+uuid:D37CC773-C218-3F97-99C9-CE4E77DDF2CE
+  - cmd: LC_SYMTAB
+cmdsize: 24
+symoff:  4096
+nsyms:   2
+stroff:  4128
+strsize: 28
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __PAGEZERO
+vmaddr:  0
+vmsize:  4294967296
+fileoff: 0
+filesize:0
+maxprot: 0
+initprot:0
+nsects:  0
+flags:   0
+  - cmd: LC_SEGMENT_64
+cmdsize: 232
+segname: __TEXT
+vmaddr:  4294967296
+vmsize:  4096
+fileoff: 0
+filesize:0
+maxprot: 7
+initprot:5
+nsects:  2
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x00010FA0
+size:15
+offset:  0x
+align:   4
+reloff:  0x
+nreloc:  0
+flags:   0x8400
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - sectname:__unwind_info
+segname: __TEXT
+addr:0x00010FB0
+size:72
+offset:  0x
+align:   2
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - cmd: LC_SEGMENT_64
+cmdsize: 72
+segname: __LINKEDIT
+vmaddr:  4294971392
+vmsize:  4096
+fileoff: 4096
+filesize:60
+maxprot: 7
+initprot:1
+nsects:  0
+flags:   0
+  - cmd: LC_SEGMENT_64
+cmdsize: 952
+segname: __DWARF
+vmaddr:  4294975488
+vmsize:  4096
+fileoff: 8192
+filesize:563
+maxprot: 7
+initprot:3
+nsects:  11
+flags:   0
+Sections:
+  - sectname:__debug_line
+segname: __DWARF
+addr:0x00012000
+size:60
+offset:  0x2000
+align:   0
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - sectname:__debug_pubnames
+segname: __DWARF
+addr:0x0001203C
+size:27
+offset:  0x203C
+align:   0
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - sectname:__debug_pubtypes
+segname: __DWARF
+addr:0x00012057
+size:26
+offset:  0x2057
+align:   0
+reloff:  0x
+nreloc:  0
+flags:   0x
+reserved1:   0x
+reserved2:   0x
+reserved3:   0x
+  - sectname:__debug_aranges
+segname: __DWARF
+addr:0x00012071
+size:48
+   

[Lldb-commits] [PATCH] D44507: [cmake] Copy system debugserver from the right place when only CommandLineTools are installed

2018-03-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: vsk, beanz.
Herald added a subscriber: mgorny.

Instead of building debugserver when building lldb, I'd rather pass
LLDB_CODESIGN_IDENTITY="" to cmake and use the one already on my system.
However, on one of my machines I only have the CommandLineTools installed, and
so the hardcoded path to the system debugserver does not work for me.
Additionally, we should verify the LLDB framework exists on the machine before
trying to set the path to debugserver. This allows us to warn the user at
configure time that a system debugserver can't be found if they choose not to
build it themselves.


https://reviews.llvm.org/D44507

Files:
  tools/debugserver/source/CMakeLists.txt


Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -106,8 +106,15 @@
 COMMAND xcode-select -p
 OUTPUT_VARIABLE XCODE_DEV_DIR)
   string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR)
-  set(DEBUGSERVER_PATH
-
"${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver" 
CACHE PATH "Path to debugserver.")
+  if(EXISTS "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/")
+set(DEBUGSERVER_PATH
+  
"${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver" 
CACHE PATH "Path to debugserver.")
+  elseif(EXISTS "${XCODE_DEV_DIR}/Library/PrivateFrameworks/LLDB.framework/")
+set(DEBUGSERVER_PATH
+  
"${XCODE_DEV_DIR}/Library/PrivateFrameworks/LLDB.framework/Resources/debugserver"
 CACHE PATH "Path to debugserver.")
+  else()
+message(SEND_ERROR "Cannot find debugserver on system.")
+  endif()
   set(SKIP_DEBUGSERVER ON CACHE BOOL "Skip building the in-tree debug server")
 endif()
 message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}")


Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -106,8 +106,15 @@
 COMMAND xcode-select -p
 OUTPUT_VARIABLE XCODE_DEV_DIR)
   string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR)
-  set(DEBUGSERVER_PATH
-"${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver" CACHE PATH "Path to debugserver.")
+  if(EXISTS "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/")
+set(DEBUGSERVER_PATH
+  "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver" CACHE PATH "Path to debugserver.")
+  elseif(EXISTS "${XCODE_DEV_DIR}/Library/PrivateFrameworks/LLDB.framework/")
+set(DEBUGSERVER_PATH
+  "${XCODE_DEV_DIR}/Library/PrivateFrameworks/LLDB.framework/Resources/debugserver" CACHE PATH "Path to debugserver.")
+  else()
+message(SEND_ERROR "Cannot find debugserver on system.")
+  endif()
   set(SKIP_DEBUGSERVER ON CACHE BOOL "Skip building the in-tree debug server")
 endif()
 message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits