[Lldb-commits] [lldb] r297259 - Back to xfailing this. For some reason on our buildbots

2017-03-07 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Mar  8 00:45:34 2017
New Revision: 297259

URL: http://llvm.org/viewvc/llvm-project?rev=297259&view=rev
Log:
Back to xfailing this.  For some reason on our buildbots
it fails, but it works on the local workstations.  I'll
need to figure out what the difference is between these.
 

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=297259&r1=297258&r2=297259&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Wed 
Mar  8 00:45:34 2017
@@ -18,6 +18,7 @@ class TestQueues(TestBase):
 
 @skipUnlessDarwin
 @add_test_categories(['pyapi'])
+@expectedFailureAll(bugnumber="rdar://30915340")
 def test_with_python_api(self):
 """Test queues inspection SB APIs."""
 self.build()


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


[Lldb-commits] [lldb] r297258 - TestQueues should be passing again, remove the expected fail.

2017-03-07 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Mar  7 23:51:00 2017
New Revision: 297258

URL: http://llvm.org/viewvc/llvm-project?rev=297258&view=rev
Log:
TestQueues should be passing again, remove the expected fail.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=297258&r1=297257&r2=297258&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Tue 
Mar  7 23:51:00 2017
@@ -18,7 +18,6 @@ class TestQueues(TestBase):
 
 @skipUnlessDarwin
 @add_test_categories(['pyapi'])
-@expectedFailureAll(bugnumber="rdar://28658529")
 def test_with_python_api(self):
 """Test queues inspection SB APIs."""
 self.build()


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


Re: [Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

2017-03-07 Thread Zachary Turner via lldb-commits
I can run build TargetTests though (I guess it doesn't depend on editline),
and that one passes.

On Tue, Mar 7, 2017 at 2:26 PM Zachary Turner  wrote:

> =
> Issue Details
> =
> UNEXPECTED SUCCESS: test_and_run_command_dwarf
> (lang/c/register_variables/TestRegisterVariables.py)
> UNEXPECTED SUCCESS: test_and_run_command_dwo
> (lang/c/register_variables/TestRegisterVariables.py)
> UNEXPECTED SUCCESS: test_dwarf
> (functionalities/thread/exit_during_break/TestExitDuringBreak.py)
> UNEXPECTED SUCCESS: test_dwo
> (functionalities/thread/exit_during_break/TestExitDuringBreak.py)
> UNEXPECTED SUCCESS: test_lldbmi_gdb_set_target_async_off
> (tools/lldb-mi/TestMiGdbSetShow.py)
> UNEXPECTED SUCCESS: test_lldbmi_process_output
> (tools/lldb-mi/syntax/TestMiSyntax.py)
> UNEXPECTED SUCCESS: test_lldbmi_settings_set_target_run_args_after
> (tools/lldb-mi/interpreter/TestMiInterpreterExec.py)
> UNEXPECTED SUCCESS: test_multiple_debuggers_dwarf
> (api/multiple-debuggers/TestMultipleDebuggers.py)
> UNEXPECTED SUCCESS: test_process_interrupt_dwo
> (functionalities/thread/state/TestThreadStates.py)
> UNEXPECTED SUCCESS: test_sb_api_listener_resume_dwarf
> (api/multithreaded/TestMultithreaded.py)
> UNEXPECTED SUCCESS: test_sb_api_listener_resume_dwo
> (api/multithreaded/TestMultithreaded.py)
> UNEXPECTED SUCCESS: test_with_dwarf (lang/cpp/printf/TestPrintf.py)
> UNEXPECTED SUCCESS: test_with_dwo (lang/cpp/printf/TestPrintf.py)
>
> ===
> Test Result Summary
> ===
> Test Methods:   1905
> Reruns:0
> Success:1203
> Expected Failure:117
> Failure:   0
> Error: 0
> Exceptional Exit:  0
> Unexpected Success:   13
> Skip:572
> Timeout:   0
> Expected Timeout:  0
>
> I can't seem to run unittests because I'm getting undefined references to
> editline which I haven't dug into, but the regular tests pass.
>
> On Tue, Mar 7, 2017 at 1:47 PM Pavel Labath via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
>> labath accepted this revision.
>> labath added a comment.
>> This revision is now accepted and ready to land.
>>
>> OK, let's give this another shot. (I haven't tried it on linux yet, so if
>> you haven't either then let's wait until tomorrow, or maybe @eugene could
>> try it out (?)). I don't think we need to be worried about symlink
>> overwrite in the ModuleCache test.
>>
>>
>>
>> 
>> Comment at: llvm/include/llvm/Support/FileSystem.h:500
>> +/// @param result Set to true if \a path is a directory (after following
>> +///   symlinks, false if it is not. Undefined otherwise.
>>  /// @returns errc::success if result has been successfully set,
>> otherwise a
>> 
>> missing closing paren here
>>
>>
>> https://reviews.llvm.org/D30698
>>
>>
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

2017-03-07 Thread Zachary Turner via lldb-commits
=
Issue Details
=
UNEXPECTED SUCCESS: test_and_run_command_dwarf
(lang/c/register_variables/TestRegisterVariables.py)
UNEXPECTED SUCCESS: test_and_run_command_dwo
(lang/c/register_variables/TestRegisterVariables.py)
UNEXPECTED SUCCESS: test_dwarf
(functionalities/thread/exit_during_break/TestExitDuringBreak.py)
UNEXPECTED SUCCESS: test_dwo
(functionalities/thread/exit_during_break/TestExitDuringBreak.py)
UNEXPECTED SUCCESS: test_lldbmi_gdb_set_target_async_off
(tools/lldb-mi/TestMiGdbSetShow.py)
UNEXPECTED SUCCESS: test_lldbmi_process_output
(tools/lldb-mi/syntax/TestMiSyntax.py)
UNEXPECTED SUCCESS: test_lldbmi_settings_set_target_run_args_after
(tools/lldb-mi/interpreter/TestMiInterpreterExec.py)
UNEXPECTED SUCCESS: test_multiple_debuggers_dwarf
(api/multiple-debuggers/TestMultipleDebuggers.py)
UNEXPECTED SUCCESS: test_process_interrupt_dwo
(functionalities/thread/state/TestThreadStates.py)
UNEXPECTED SUCCESS: test_sb_api_listener_resume_dwarf
(api/multithreaded/TestMultithreaded.py)
UNEXPECTED SUCCESS: test_sb_api_listener_resume_dwo
(api/multithreaded/TestMultithreaded.py)
UNEXPECTED SUCCESS: test_with_dwarf (lang/cpp/printf/TestPrintf.py)
UNEXPECTED SUCCESS: test_with_dwo (lang/cpp/printf/TestPrintf.py)

===
Test Result Summary
===
Test Methods:   1905
Reruns:0
Success:1203
Expected Failure:117
Failure:   0
Error: 0
Exceptional Exit:  0
Unexpected Success:   13
Skip:572
Timeout:   0
Expected Timeout:  0

I can't seem to run unittests because I'm getting undefined references to
editline which I haven't dug into, but the regular tests pass.

On Tue, Mar 7, 2017 at 1:47 PM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath accepted this revision.
> labath added a comment.
> This revision is now accepted and ready to land.
>
> OK, let's give this another shot. (I haven't tried it on linux yet, so if
> you haven't either then let's wait until tomorrow, or maybe @eugene could
> try it out (?)). I don't think we need to be worried about symlink
> overwrite in the ModuleCache test.
>
>
>
> 
> Comment at: llvm/include/llvm/Support/FileSystem.h:500
> +/// @param result Set to true if \a path is a directory (after following
> +///   symlinks, false if it is not. Undefined otherwise.
>  /// @returns errc::success if result has been successfully set, otherwise
> a
> 
> missing closing paren here
>
>
> https://reviews.llvm.org/D30698
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-07 Thread Eugene Zemtsov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297231: Make LLDB skip server-client roundtrip for signals 
that don't require any… (authored by eugene).

Changed prior to commit:
  https://reviews.llvm.org/D30520?vs=90921&id=90930#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30520

Files:
  lldb/trunk/include/lldb/Target/Process.h
  lldb/trunk/include/lldb/Target/UnixSignals.h
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/trunk/source/Target/Process.cpp
  lldb/trunk/source/Target/UnixSignals.cpp
  lldb/trunk/unittests/CMakeLists.txt
  lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  lldb/trunk/unittests/Signals/CMakeLists.txt
  lldb/trunk/unittests/Signals/UnixSignalsTest.cpp

Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -307,3 +307,27 @@
   << ss.GetString();
   ASSERT_EQ(10, num_packets);
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, SendSignalsToIgnore) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::tid_t tid = 0x47;
+  const uint32_t reg_num = 4;
+  std::future result = std::async(std::launch::async, [&] {
+return client.SendSignalsToIgnore({2, 3, 5, 7, 0xB, 0xD, 0x11});
+  });
+
+  HandlePacket(server, "QPassSignals:02;03;05;07;0b;0d;11", "OK");
+  EXPECT_TRUE(result.get().Success());
+
+  result = std::async(std::launch::async, [&] {
+return client.SendSignalsToIgnore(std::vector());
+  });
+
+  HandlePacket(server, "QPassSignals:", "OK");
+  EXPECT_TRUE(result.get().Success());
+}
Index: lldb/trunk/unittests/CMakeLists.txt
===
--- lldb/trunk/unittests/CMakeLists.txt
+++ lldb/trunk/unittests/CMakeLists.txt
@@ -63,6 +63,7 @@
 add_subdirectory(Platform)
 add_subdirectory(Process)
 add_subdirectory(ScriptInterpreter)
+add_subdirectory(Signals)
 add_subdirectory(Symbol)
 add_subdirectory(SymbolFile)
 add_subdirectory(Target)
Index: lldb/trunk/unittests/Signals/CMakeLists.txt
===
--- lldb/trunk/unittests/Signals/CMakeLists.txt
+++ lldb/trunk/unittests/Signals/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_unittest(SignalsTests
+  UnixSignalsTest.cpp
+
+  LINK_LIBS
+lldbTarget
+  )
Index: lldb/trunk/unittests/Signals/UnixSignalsTest.cpp
===
--- lldb/trunk/unittests/Signals/UnixSignalsTest.cpp
+++ lldb/trunk/unittests/Signals/UnixSignalsTest.cpp
@@ -0,0 +1,140 @@
+//===-- UnixSignalsTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#include 
+
+#include "gtest/gtest.h"
+
+#include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using llvm::None;
+
+class TestSignals : public UnixSignals {
+public:
+  TestSignals() {
+m_signals.clear();
+AddSignal(2, "SIG2", false, true, true, "DESC2");
+AddSignal(4, "SIG4", true, false, true, "DESC4");
+AddSignal(8, "SIG8", true, true, true, "DESC8");
+AddSignal(16, "SIG16", true, false, false, "DESC16");
+  }
+};
+
+void ExpectEqArrays(llvm::ArrayRef expected,
+llvm::ArrayRef observed, const char *file,
+int line) {
+  std::string location = llvm::formatv("{0}:{1}", file, line);
+  ASSERT_EQ(expected.size(), observed.size()) << location;
+
+  for (size_t i = 0; i < observed.size(); ++i) {
+ASSERT_EQ(expected[i], observed[i])
+<< "array index: " << i << "location:" << location;
+  }
+}
+
+#define EXPECT_EQ_ARRAYS(expected, observed)   \
+  ExpectEqArrays((expected), (observed), __FILE__, __LINE__);
+
+TEST(UnixSignalsTest, Iteration) {
+  TestSignals signals;
+
+  EXPECT_EQ(4, signals.GetNumSignals());
+  EXPECT_EQ(2, signals.GetFirstSignalNumber());
+  EXPECT_EQ(4, signals.GetNextSignalNumber(2));
+  EXPECT_EQ(8, signals.GetNextSignalNumber(4));
+  EXPECT_EQ(16, signals.GetNextSignalNumber(8));
+  EXPECT_EQ(LLDB_INVALID_SIGNAL_NUMBER, signals.GetNextSignalNumber(16));
+}
+
+TEST(UnixSignalsTest, GetInfo) {
+  TestSignals signals;
+
+  bool shoul

[Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

2017-03-07 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

OK, let's give this another shot. (I haven't tried it on linux yet, so if you 
haven't either then let's wait until tomorrow, or maybe @eugene could try it 
out (?)). I don't think we need to be worried about symlink overwrite in the 
ModuleCache test.




Comment at: llvm/include/llvm/Support/FileSystem.h:500
+/// @param result Set to true if \a path is a directory (after following
+///   symlinks, false if it is not. Undefined otherwise.
 /// @returns errc::success if result has been successfully set, otherwise a

missing closing paren here


https://reviews.llvm.org/D30698



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


[Lldb-commits] [lldb] r297231 - Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-07 Thread Eugene Zemtsov via lldb-commits
Author: eugene
Date: Tue Mar  7 15:34:40 2017
New Revision: 297231

URL: http://llvm.org/viewvc/llvm-project?rev=297231&view=rev
Log:
Make LLDB skip server-client roundtrip for signals that don't require any 
actions

If QPassSignals packaet is supported by lldb-server, lldb-client will
utilize it and ask the server to ignore signals that don't require stops
or notifications.
Such signals will be immediately re-injected into inferior to continue
normal execution.

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

Added:
lldb/trunk/unittests/Signals/
lldb/trunk/unittests/Signals/CMakeLists.txt
lldb/trunk/unittests/Signals/UnixSignalsTest.cpp
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/UnixSignals.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/UnixSignals.cpp
lldb/trunk/unittests/CMakeLists.txt
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=297231&r1=297230&r2=297231&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Mar  7 15:34:40 2017
@@ -2607,7 +2607,7 @@ public:
   bool RunPreResumeActions();
 
   void ClearPreResumeActions();
-  
+
   void ClearPreResumeAction(PreResumeActionCallback callback, void *baton);
 
   ProcessRunLock &GetRunLock();
@@ -3145,6 +3145,8 @@ protected:
 
   Error StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
 
+  virtual Error UpdateAutomaticSignalFiltering();
+
   bool StateChangedIsExternallyHijacked();
 
   void LoadOperatingSystemPlugin(bool flush);

Modified: lldb/trunk/include/lldb/Target/UnixSignals.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/UnixSignals.h?rev=297231&r1=297230&r2=297231&view=diff
==
--- lldb/trunk/include/lldb/Target/UnixSignals.h (original)
+++ lldb/trunk/include/lldb/Target/UnixSignals.h Tue Mar  7 15:34:40 2017
@@ -14,11 +14,13 @@
 // C++ Includes
 #include 
 #include 
+#include 
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
+#include "llvm/ADT/Optional.h"
 
 namespace lldb_private {
 
@@ -88,6 +90,19 @@ public:
 
   void RemoveSignal(int signo);
 
+  // Returns a current version of the data stored in this class.
+  // Version gets incremented each time Set... method is called.
+  uint64_t GetVersion() const;
+
+  // Returns a vector of signals that meet criteria provided in arguments.
+  // Each should_[suppress|stop|notify] flag can be
+  // None  - no filtering by this flag
+  // true  - only signals that have it set to true are returned
+  // false - only signals that have it set to true are returned
+  std::vector GetFilteredSignals(llvm::Optional should_suppress,
+  llvm::Optional should_stop,
+  llvm::Optional should_notify);
+
 protected:
   //--
   // Classes that inherit from UnixSignals can see and modify these
@@ -111,6 +126,12 @@ protected:
 
   collection m_signals;
 
+  // This version gets incremented every time something is changing in
+  // this class, including when we call AddSignal from the constructor.
+  // So after the object is constructed m_version is going to be > 0
+  // if it has at least one signal registered in it.
+  uint64_t m_version = 0;
+
   // GDBRemote signals need to be copyable.
   UnixSignals(const UnixSignals &rhs);
 

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=297231&r1=297230&r2=297231&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Mar  7 15:34:40 2017
@@ -87,6 +87,7 @@ GDBRemoteCommunicationClient::GDBRemoteC
   m_supports_jThreadExtendedInfo(eLazyBoolCalculate),
   m_supports_jLoadedDynamicLibrariesInfos(eLazyBoolCalculate),
   m_supports_jGetSharedCacheInfo(eLazyBoolCalculate),
+  m_supports_QPassSignals(eLazyBoolCalculate),
   m_supports_qProcessInfoPID(true), 

[Lldb-commits] [PATCH] D30702: Fix remaining threading issues in Log.h

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



Comment at: source/Utility/Log.cpp:90-91
   uint32_t options, uint32_t flags) {
-  log.GetMask().Set(flags);
-  if (log.GetMask().Get()) {
-log.GetOptions().Reset(options);
+  uint32_t mask = log.m_mask.load(std::memory_order_acquire) | flags;
+  log.m_mask.store(mask, std::memory_order_release);
+  if (mask) {

How about 

```
uint32_t old_mask = log.m_mask.fetch_or(flags);
if (old_mask  & flags) {
  ...
}
```

Also, there is still a race if two people call this function at the same time.



Comment at: source/Utility/Log.cpp:103-104
 return;
-  log->GetMask().Clear(flags);
-  if (!log->GetMask().Get()) {
+  uint32_t mask = log->m_mask.load(std::memory_order_acquire) & ~flags;
+  log->m_mask.store(mask, std::memory_order_release);
+  if (!mask) {

```
uint32_t old_mask = log->m_mask.fetch_and(~flags);
if (!(old_mask & ~flags)) {
  ...
}
```



Comment at: source/Utility/Log.cpp:116
+const Flags Log::GetMask() const {
+  return m_mask.load(std::memory_order_acquire);
+}

Any reason you always use the explicit `load(memory_order_acquire)` syntax 
instead of using the default sequentially consistent ordering?


https://reviews.llvm.org/D30702



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


[Lldb-commits] [PATCH] D30702: Fix remaining threading issues in Log.h

2017-03-07 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene added inline comments.



Comment at: include/lldb/Utility/Log.h:152
 
-  Flags &GetOptions();
+  const Flags GetOptions() const;
 

Seems like const on return value is not really needed.



Comment at: include/lldb/Utility/Log.h:163
+  std::atomic m_options{0};
+  std::atomic m_mask{0};
+

Do we actually need atomics here? 

It seems like the stream itself is protected by the mutex, and It doesn't seem 
to affect performance.
Can we use the same (or a different) mutex to protect flags and options?


https://reviews.llvm.org/D30702



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


[Lldb-commits] [lldb] r297228 - fix format specifier warnings

2017-03-07 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Tue Mar  7 15:26:04 2017
New Revision: 297228

URL: http://llvm.org/viewvc/llvm-project?rev=297228&view=rev
Log:
fix format specifier warnings

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp

Modified: 
lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp?rev=297228&r1=297227&r2=297228&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp 
(original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp 
Tue Mar  7 15:26:04 2017
@@ -692,7 +692,7 @@ void DarwinLogCollector::CancelActivityS
 
   DNBLogThreadedIf(LOG_DARWIN_LOG, "DarwinLogCollector::%s(): canceling "
"activity stream %p",
-   __FUNCTION__, m_activity_stream);
+   __FUNCTION__, reinterpret_cast(m_activity_stream));
   (*s_os_activity_stream_cancel)(m_activity_stream);
   m_activity_stream = nullptr;
 }

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=297228&r1=297227&r2=297228&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Tue Mar  7 
15:26:04 2017
@@ -1269,7 +1269,7 @@ bool MachProcess::Interrupt() {
 bool MachProcess::Signal(int signal, const struct timespec *timeout_abstime) {
   DNBLogThreadedIf(LOG_PROCESS,
"MachProcess::Signal (signal = %d, timeout = %p)", signal,
-   timeout_abstime);
+   reinterpret_cast(timeout_abstime));
   nub_state_t state = GetState();
   if (::kill(ProcessID(), signal) == 0) {
 // If we were running and we have a timeout, wait for the signal to stop
@@ -1277,20 +1277,21 @@ bool MachProcess::Signal(int signal, con
   DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout 
"
 "= %p) waiting for signal to stop "
 "process...",
-   signal, timeout_abstime);
+   signal, reinterpret_cast(timeout_abstime));
   m_private_events.WaitForSetEvents(eEventProcessStoppedStateChanged,
 timeout_abstime);
   state = GetState();
   DNBLogThreadedIf(
   LOG_PROCESS,
   "MachProcess::Signal (signal = %d, timeout = %p) state = %s", signal,
-  timeout_abstime, DNBStateAsString(state));
+  reinterpret_cast(timeout_abstime),
+  DNBStateAsString(state));
   return !IsRunning(state);
 }
 DNBLogThreadedIf(
 LOG_PROCESS,
 "MachProcess::Signal (signal = %d, timeout = %p) not waiting...",
-signal, timeout_abstime);
+signal, reinterpret_cast(timeout_abstime));
 return true;
   }
   DNBError err(errno, DNBError::POSIX);
@@ -1596,7 +1597,8 @@ DNBBreakpoint *MachProcess::CreateBreakp
   if (EnableBreakpoint(addr)) {
 DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = "
   "0x%8.8llx, length = %llu) => %p",
- (uint64_t)addr, (uint64_t)length, bp);
+ (uint64_t)addr, (uint64_t)length,
+ reinterpret_cast(bp));
 return bp;
   } else if (bp->Release() == 0) {
 m_breakpoints.Remove(addr);
@@ -1627,7 +1629,8 @@ DNBBreakpoint *MachProcess::CreateWatchp
   if (EnableWatchpoint(addr)) {
 DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = "
   "0x%8.8llx, length = %llu) => %p",
- (uint64_t)addr, (uint64_t)length, wp);
+ (uint64_t)addr, (uint64_t)length,
+ reinterpret_cast(wp));
 return wp;
   } else {
 DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = "
@@ -2156,7 +2159,7 @@ void MachProcess::AppendSTDOUT(char *s,
 
 size_t MachProcess::GetAvailableSTDOUT(char *buf, size_t buf_size) {
   DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", 
__FUNCTION__,
-   buf, (uint64_t)buf_size);
+   reinterpret_cast(buf), (uint64_t)buf_size);
   PTHREAD_MUTEX_LOCKER(locker, m_stdio_mutex);
   size_t bytes_available = m_stdout_data.size();
   if (bytes_available > 0) {
@@ -2316,7 +2319,7 @@ void MachProcess::SignalAsyncProfileData
 
 size_t MachProcess::GetAsyncProfileData(char *buf, size_t buf_size) 

[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-07 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

Thank you.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30702: Fix remaining threading issues in Log.h

2017-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

With my limited std::atomic experience, this seems fine.


https://reviews.llvm.org/D30702



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-07 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene updated this revision to Diff 90921.
eugene added a comment.

Rename ASSERT_EQ_ARRAYS to EXPECT_EQ_ARRAYS


https://reviews.llvm.org/D30520

Files:
  include/lldb/Target/Process.h
  include/lldb/Target/UnixSignals.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Process.cpp
  source/Target/UnixSignals.cpp
  unittests/CMakeLists.txt
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  unittests/Signals/CMakeLists.txt
  unittests/Signals/UnixSignalsTest.cpp

Index: unittests/Signals/UnixSignalsTest.cpp
===
--- /dev/null
+++ unittests/Signals/UnixSignalsTest.cpp
@@ -0,0 +1,140 @@
+//===-- UnixSignalsTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#include 
+
+#include "gtest/gtest.h"
+
+#include "lldb/Target/UnixSignals.h"
+#include "llvm/Support/FormatVariadic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using llvm::None;
+
+class TestSignals : public UnixSignals {
+public:
+  TestSignals() {
+m_signals.clear();
+AddSignal(2, "SIG2", false, true, true, "DESC2");
+AddSignal(4, "SIG4", true, false, true, "DESC4");
+AddSignal(8, "SIG8", true, true, true, "DESC8");
+AddSignal(16, "SIG16", true, false, false, "DESC16");
+  }
+};
+
+void ExpectEqArrays(llvm::ArrayRef expected,
+llvm::ArrayRef observed, const char *file,
+int line) {
+  std::string location = llvm::formatv("{0}:{1}", file, line);
+  ASSERT_EQ(expected.size(), observed.size()) << location;
+
+  for (size_t i = 0; i < observed.size(); ++i) {
+ASSERT_EQ(expected[i], observed[i])
+<< "array index: " << i << "location:" << location;
+  }
+}
+
+#define EXPECT_EQ_ARRAYS(expected, observed)   \
+  ExpectEqArrays((expected), (observed), __FILE__, __LINE__);
+
+TEST(UnixSignalsTest, Iteration) {
+  TestSignals signals;
+
+  EXPECT_EQ(4, signals.GetNumSignals());
+  EXPECT_EQ(2, signals.GetFirstSignalNumber());
+  EXPECT_EQ(4, signals.GetNextSignalNumber(2));
+  EXPECT_EQ(8, signals.GetNextSignalNumber(4));
+  EXPECT_EQ(16, signals.GetNextSignalNumber(8));
+  EXPECT_EQ(LLDB_INVALID_SIGNAL_NUMBER, signals.GetNextSignalNumber(16));
+}
+
+TEST(UnixSignalsTest, GetInfo) {
+  TestSignals signals;
+
+  bool should_suppress = false, should_stop = false, should_notify = false;
+  int32_t signo = 4;
+  std::string name =
+  signals.GetSignalInfo(signo, should_suppress, should_stop, should_notify);
+  EXPECT_EQ("SIG4", name);
+  EXPECT_EQ(true, should_suppress);
+  EXPECT_EQ(false, should_stop);
+  EXPECT_EQ(true, should_notify);
+
+  EXPECT_EQ(true, signals.GetShouldSuppress(signo));
+  EXPECT_EQ(false, signals.GetShouldStop(signo));
+  EXPECT_EQ(true, signals.GetShouldNotify(signo));
+  EXPECT_EQ(name, signals.GetSignalAsCString(signo));
+}
+
+TEST(UnixSignalsTest, VersionChange) {
+  TestSignals signals;
+
+  int32_t signo = 8;
+  uint64_t ver = signals.GetVersion();
+  EXPECT_GT(ver, 0ull);
+  EXPECT_EQ(true, signals.GetShouldSuppress(signo));
+  EXPECT_EQ(true, signals.GetShouldStop(signo));
+  EXPECT_EQ(true, signals.GetShouldNotify(signo));
+
+  EXPECT_EQ(signals.GetVersion(), ver);
+
+  signals.SetShouldSuppress(signo, false);
+  EXPECT_LT(ver, signals.GetVersion());
+  ver = signals.GetVersion();
+
+  signals.SetShouldStop(signo, true);
+  EXPECT_LT(ver, signals.GetVersion());
+  ver = signals.GetVersion();
+
+  signals.SetShouldNotify(signo, false);
+  EXPECT_LT(ver, signals.GetVersion());
+  ver = signals.GetVersion();
+
+  EXPECT_EQ(false, signals.GetShouldSuppress(signo));
+  EXPECT_EQ(true, signals.GetShouldStop(signo));
+  EXPECT_EQ(false, signals.GetShouldNotify(signo));
+
+  EXPECT_EQ(ver, signals.GetVersion());
+}
+
+TEST(UnixSignalsTest, GetFilteredSignals) {
+  TestSignals signals;
+
+  auto all_signals = signals.GetFilteredSignals(None, None, None);
+  std::vector expected = {2, 4, 8, 16};
+  EXPECT_EQ_ARRAYS(expected, all_signals);
+
+  auto supressed = signals.GetFilteredSignals(true, None, None);
+  expected = {4, 8, 16};
+  EXPECT_EQ_ARRAYS(expected, supressed);
+
+  auto not_supressed = signals.GetFilteredSignals(false, None, None);
+  expected = {2};
+  EXPECT_EQ_ARRAYS(expected, not_supressed);
+
+  auto stopped = signals.GetFilteredSignals(None, true, None);
+  expected = {2, 8};
+  EXPECT_EQ_ARRAYS(expected, stopped);
+
+  auto not_stopped = signals.GetFilteredSignals(None, false, None);
+  expected = {4, 16};
+  EXPECT_EQ_ARRAYS(expected, not

[Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

2017-03-07 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 90905.
zturner added a comment.

Fixed all the outstanding issues.  I simplified the logic in `ModuleCache`, but 
I think it makes more sense this way, and the unit tests still pass.  If we 
really care about the case where we want to create a directory on top of an 
existing broken symbolic link, we can see about adding that to LLVM, but in 
pratcice I don't think it matters.

I also went back and audited all the existing uses of the various functions, 
and I think they are all correct.  Will run the entire test suite in a bit.


https://reviews.llvm.org/D30698

Files:
  lldb/include/lldb/Host/FileSpec.h
  lldb/include/lldb/Utility/Error.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/FileSpecList.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/PluginManager.cpp
  lldb/source/Host/common/FileSpec.cpp
  lldb/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/source/Host/common/Symbols.cpp
  lldb/source/Host/macosx/Host.mm
  lldb/source/Host/macosx/HostInfoMacOSX.mm
  lldb/source/Host/macosx/Symbols.cpp
  lldb/source/Host/posix/FileSystem.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/TargetList.cpp
  lldb/source/Utility/Error.cpp
  llvm/include/llvm/Support/FileSystem.h
  llvm/lib/Support/Path.cpp

Index: llvm/lib/Support/Path.cpp
===
--- llvm/lib/Support/Path.cpp
+++ llvm/lib/Support/Path.cpp
@@ -984,6 +984,18 @@
   return std::error_code();
 }
 
+bool is_symlink_file(file_status status) {
+  return status.type() == file_type::symlink_file;
+}
+
+std::error_code is_symlink_file(const Twine &path, bool &result) {
+  file_status st;
+  if (std::error_code ec = status(path, st, false))
+return ec;
+  result = is_symlink_file(st);
+  return std::error_code();
+}
+
 bool is_other(file_status status) {
   return exists(status) &&
  !is_regular_file(status) &&
Index: llvm/include/llvm/Support/FileSystem.h
===
--- llvm/include/llvm/Support/FileSystem.h
+++ llvm/include/llvm/Support/FileSystem.h
@@ -482,8 +482,10 @@
 /// @brief Does status represent a directory?
 ///
 /// @param Path The path to get the type of.
+/// @param follow For symbolic links, indicates whether to return the file type
+///   of the link itself, or of the target.
 /// @returns A value from the file_type enumeration indicating the type of file.
-file_type get_file_type(const Twine &Path, bool follow = true);
+file_type get_file_type(const Twine &Path, bool Follow = true);
 
 /// @brief Does status represent a directory?
 ///
@@ -494,8 +496,8 @@
 /// @brief Is path a directory?
 ///
 /// @param path Input path.
-/// @param result Set to true if \a path is a directory, false if it is not.
-///   Undefined otherwise.
+/// @param result Set to true if \a path is a directory (after following
+///   symlinks, false if it is not. Undefined otherwise.
 /// @returns errc::success if result has been successfully set, otherwise a
 ///  platform-specific error_code.
 std::error_code is_directory(const Twine &path, bool &result);
@@ -516,8 +518,8 @@
 /// @brief Is path a regular file?
 ///
 /// @param path Input path.
-/// @param result Set to true if \a path is a regular file, false if it is not.
-///   Undefined otherwise.
+/// @param result Set to true if \a path is a regular file (after following
+///   symlinks), false if it is not. Undefined otherwise.
 /// @returns errc::success if result has been successfully set, 

Re: [Lldb-commits] [lldb] r297139 - Revert "Use LLVM for all stat-related functionality."

2017-03-07 Thread Sean Callanan via lldb-commits
Thanks, Pavel.
I think if we do this again we should indirect the new API through the LLDB 
FileSpec API or at least a global function somewhere in LLDB, so that we can 
change implementations without having to touch so much source code.

Sean

> On Mar 7, 2017, at 5:19 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> Author: labath
> Date: Tue Mar  7 07:19:15 2017
> New Revision: 297139
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=297139&view=rev
> Log:
> Revert "Use LLVM for all stat-related functionality."
> 
> this reverts r297116 because it breaks the unittests and
> TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but
> the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat
> functionality is not a drop-in replacement for lldb's. The former is
> based on stat(2) (which does symlink resolution), while the latter is
> based on lstat(2) (which does not).
> 
> This also reverts subsequent build fixes (r297128, r297120, 297117) and
> r297119 (Remove FileSpec dependency on FileSystem) which builds on top
> of this.
> 
> Modified:
>lldb/trunk/include/lldb/Host/FileSpec.h
>lldb/trunk/source/API/SBPlatform.cpp
>lldb/trunk/source/Commands/CommandCompletions.cpp
>lldb/trunk/source/Commands/CommandObjectTarget.cpp
>lldb/trunk/source/Core/Debugger.cpp
>lldb/trunk/source/Core/FileSpecList.cpp
>lldb/trunk/source/Core/Module.cpp
>lldb/trunk/source/Core/ModuleList.cpp
>lldb/trunk/source/Core/PluginManager.cpp
>lldb/trunk/source/Host/common/FileSpec.cpp
>lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
>lldb/trunk/source/Host/common/Symbols.cpp
>lldb/trunk/source/Host/macosx/Host.mm
>lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
>lldb/trunk/source/Host/macosx/Symbols.cpp
>lldb/trunk/source/Host/posix/FileSystem.cpp
>lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
>lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
>lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
>lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
>lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
>
> lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
>lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
>lldb/trunk/source/Target/ModuleCache.cpp
>lldb/trunk/source/Target/Platform.cpp
>lldb/trunk/source/Target/TargetList.cpp
> 
> Modified: lldb/trunk/include/lldb/Host/FileSpec.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=297139&r1=297138&r2=297139&view=diff
> ==
> --- lldb/trunk/include/lldb/Host/FileSpec.h (original)
> +++ lldb/trunk/include/lldb/Host/FileSpec.h Tue Mar  7 07:19:15 2017
> @@ -22,7 +22,6 @@
> #include "lldb/lldb-private.h"
> 
> #include "llvm/ADT/Triple.h"
> -#include "llvm/Support/FileSystem.h"
> #include "llvm/Support/FormatVariadic.h"
> 
> namespace lldb_private {
> @@ -47,6 +46,17 @@ namespace lldb_private {
> //--
> class FileSpec {
> public:
> +  typedef enum FileType {
> +eFileTypeInvalid = -1,
> +eFileTypeUnknown = 0,
> +eFileTypeDirectory,
> +eFileTypePipe,
> +eFileTypeRegular,
> +eFileTypeSocket,
> +eFileTypeSymbolicLink,
> +eFileTypeOther
> +  } FileType;
> +
>   enum PathSyntax {
> ePathSyntaxPosix,
> ePathSyntaxWindows,
> @@ -445,6 +455,8 @@ public:
>   //--
>   ConstString GetFileNameStrippingExtension() const;
> 
> +  FileType GetFileType() const;
> +
>   //--
>   /// Return the current permissions of the path.
>   ///
> @@ -459,6 +471,20 @@ public:
>   //--
>   uint32_t GetPermissions() const;
> 
> +  bool IsDirectory() const {
> +return GetFileType() == FileSpec::eFileTypeDirectory;
>

[Lldb-commits] [PATCH] D30702: Fix remaining threading issues in Log.h

2017-03-07 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.

This fixes two threading issues in the logging code. The access to the
mask and options flags had data races when we were trying to
enable/disable logging while another thread was writing to the log.
Since we can log from almost any context, and we want it to be fast, so
I avoided locking primitives and used atomic variables instead. I have
also removed the (unused) setters for the mask and flags to make sure
that the only way to set them is through the enable/disable channel
functions.

I also add tests, which when run under tsan, verify that the use cases
like "doing an LLDB_LOGV while another thread disables logging" are
data-race-free.


https://reviews.llvm.org/D30702

Files:
  include/lldb/Utility/Log.h
  source/Utility/Log.cpp
  unittests/Utility/LogTest.cpp

Index: unittests/Utility/LogTest.cpp
===
--- unittests/Utility/LogTest.cpp
+++ unittests/Utility/LogTest.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Utility/StreamString.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Threading.h"
+#include 
 #include 
 
 using namespace lldb;
@@ -214,3 +215,51 @@
   EXPECT_TRUE(stream_sp->str() == "" || stream_sp->str() == "Hello World\n")
   << "str(): " << stream_sp->str();
 }
+
+TEST_F(LogChannelTest, LogVerboseThread) {
+  // Test that we are able to concurrently check the verbose flag of a log
+  // channel and enable it.
+  std::string message;
+  std::shared_ptr stream_sp(
+  new llvm::raw_string_ostream(message));
+  StreamString err;
+  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {}, err));
+
+  Log *log = test_channel.GetLogIfAll(FOO);
+
+  // Start logging on one thread. Concurrently, try enabling the log channel
+  // (with different log options).
+  std::thread log_thread([log] { LLDB_LOGV(log, "Hello World"); });
+  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, LLDB_LOG_OPTION_VERBOSE, "chan",
+{}, err));
+  log_thread.join();
+  EXPECT_TRUE(Log::DisableLogChannel("chan", {}, err));
+
+  // The log thread either managed to write to the log, or it didn't. In either
+  // case, we should not trip any undefined behavior (run the test under TSAN to
+  // verify this).
+  EXPECT_TRUE(stream_sp->str() == "" || stream_sp->str() == "Hello World\n")
+  << "str(): " << stream_sp->str();
+}
+
+TEST_F(LogChannelTest, LogGetLogThread) {
+  // Test that we are able to concurrently get mask of a Log object and disable
+  // it.
+  std::string message;
+  std::shared_ptr stream_sp(
+  new llvm::raw_string_ostream(message));
+  StreamString err;
+  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {}, err));
+  Log *log = test_channel.GetLogIfAll(FOO);
+
+  // Try fetching the log on one thread. Concurrently, try disabling the log
+  // channel.
+  uint32_t mask;
+  std::thread log_thread([log, &mask] { mask = log->GetMask().Get(); });
+  EXPECT_TRUE(Log::DisableLogChannel("chan", {}, err));
+  log_thread.join();
+
+  // The mask should be either zero of "FOO". In either case, we should not trip
+  // any undefined behavior (run the test under TSAN to verify this).
+  EXPECT_TRUE(mask == 0 || mask == FOO) << "mask: " << mask;
+}
Index: source/Utility/Log.cpp
===
--- source/Utility/Log.cpp
+++ source/Utility/Log.cpp
@@ -87,9 +87,10 @@
 void Log::Channel::Enable(Log &log,
   const std::shared_ptr &stream_sp,
   uint32_t options, uint32_t flags) {
-  log.GetMask().Set(flags);
-  if (log.GetMask().Get()) {
-log.GetOptions().Reset(options);
+  uint32_t mask = log.m_mask.load(std::memory_order_acquire) | flags;
+  log.m_mask.store(mask, std::memory_order_release);
+  if (mask) {
+log.m_options.store(options, std::memory_order_release);
 log.SetStream(stream_sp);
 log_ptr.store(&log, std::memory_order_release);
   }
@@ -99,27 +100,21 @@
   Log *log = log_ptr.load(std::memory_order_acquire);
   if (!log)
 return;
-  log->GetMask().Clear(flags);
-  if (!log->GetMask().Get()) {
+  uint32_t mask = log->m_mask.load(std::memory_order_acquire) & ~flags;
+  log->m_mask.store(mask, std::memory_order_release);
+  if (!mask) {
 log->SetStream(nullptr);
 log_ptr.store(nullptr, std::memory_order_release);
   }
 }
 
-Log::Log() : m_stream_sp(), m_options(0), m_mask_bits(0) {}
-
-Log::Log(const std::shared_ptr &stream_sp)
-: m_stream_sp(stream_sp), m_options(0), m_mask_bits(0) {}
-
-Log::~Log() = default;
-
-Flags &Log::GetOptions() { return m_options; }
-
-const Flags &Log::GetOptions() const { return m_options; }
-
-Flags &Log::GetMask() { return m_mask_bits; }
+const Flags Log::GetOptions() const {
+  return m_options.load(std::memory_order_acquire);
+}
 
-const Flags &Log::GetMask() const { return m_mask_bits; }
+const Flags Log::GetMask() const {
+  return m_mask.load(std::memory_order_acquire);
+}
 
 void Log::Pu

[Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

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



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:197
+  namespace fs = llvm::sys::fs;
+  if (fs::get_file_type(local_path_spec.GetPath(), false) !=
+  fs::file_type::symlink_file)

labath wrote:
> labath wrote:
> > This still breaks TestCompDirSymLink.py. I haven't yet dug into why, but it 
> > looks like some problem in the get_file_type implementation.
> ok, so the problem is in `llvm::sys::fs::fillStatus` implementation. It is 
> missing the call to `S_ISLNK` to decode the symlink bit (probably because it 
> was not necessary until now).
I literally just came to the same conclusion.  Glad we agree on the fix!  I'll 
also do a full audit of all the changes in regards to your other comment about 
the functionality change, and make sure that same mistake does not appear 
anywhere else.


https://reviews.llvm.org/D30698



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


[Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

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






Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:197
+  namespace fs = llvm::sys::fs;
+  if (fs::get_file_type(local_path_spec.GetPath(), false) !=
+  fs::file_type::symlink_file)

labath wrote:
> This still breaks TestCompDirSymLink.py. I haven't yet dug into why, but it 
> looks like some problem in the get_file_type implementation.
ok, so the problem is in `llvm::sys::fs::fillStatus` implementation. It is 
missing the call to `S_ISLNK` to decode the symlink bit (probably because it 
was not necessary until now).


https://reviews.llvm.org/D30698



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


[Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

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

Unfortunately, this does not seem to help. I'll try to debug today if I can 
find the time.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:197
+  namespace fs = llvm::sys::fs;
+  if (fs::get_file_type(local_path_spec.GetPath(), false) !=
+  fs::file_type::symlink_file)

This still breaks TestCompDirSymLink.py. I haven't yet dug into why, but it 
looks like some problem in the get_file_type implementation.



Comment at: lldb/source/Target/ModuleCache.cpp:70
+  llvm::sys::fs::file_status st;
+  if (status(dir_path.GetPath(), st, false))
+return Error("Could not stat path");

This changes behavior (and breaks ModuleCache unit tests). The point of this 
was to check whether path is a directory, so if we cannot stat it, we should 
still try to create it.


https://reviews.llvm.org/D30698



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


[Lldb-commits] [PATCH] D29581: Initial implementation of SB APIs for Tracing support.

2017-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: include/lldb/API/SBTraceOptions.h:38
+  /// They should be formatted as a JSON Array.
+  void setTraceParams(lldb::SBStream ¶ms);
+

ravitheja wrote:
> clayborg wrote:
> > This should probably be:
> > 
> > ```
> > void setTraceParams(lldb::SBStructuredData ¶ms);
> > ```
> > 
> > Then we can add extra functions to SBStructuredData that allow you 
> > construct one from XML, JSON, Apple plist, or any other structured data.
> Hi, this would also mean we make SBTraceOptions a friend class of 
> SBStructuredData so that we can get access to the StructuredDataObject inside 
> ?
Yeah you need a way for internal clients to get the StructuredData::ObjectSP 
from the SBStructuredData. You probably need to allow access to the 
StructuredDataImpl class that is currently defined in SBStructuredData.cpp. So 
a few things need to happen:

- move StructuredDataImpl somewhere into its own internal header file so that 
other clients in LLDB can access it
- make a protected member function in SBStructuredData that hands out a 
"StructuredDataImpl *" to allow clients to access it
- anyone that needs to get to the StructuredData::ObjectSP will then call a new 
accessor that must be added on StructuredDataImpl to retrieve it
- add new ways to load the SBStructuredData from JSON (something like 
SBStructuredData::SetFromJSON(...))



https://reviews.llvm.org/D29581



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


[Lldb-commits] [PATCH] D30454: [LLDB][MIPS] Fix typo in MatchesModuleSpec()

2017-03-07 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

How does VSDO get loaded when debugging a normal process? In the core file case 
you probably need to create the VSDO module from memory by locating it somehow 
and add it to the target before the dynamic loader goes looking for it. 
Wouldn't that fix the issue?


https://reviews.llvm.org/D30454



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


[Lldb-commits] [PATCH] D30698: Resubmit "Use LLVM for all stat related calls"

2017-03-07 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
Herald added a subscriber: emaste.

This was broken due to LLVM's stat code following symlinks.  I've added an 
option on the LLVM side to not follow symlinks and updated this patch to use it 
everywhere possible.  The cases I couldn't get were where LLDB calls 
`is_directory` / `is_regular_file` / `exists`, etc.  Those would return false 
on symlinks before, but now return true if the target is a directory / file / 
exists.  I don't think that should be an issue, as I think generally that's 
what'e expected.

I can test this on Linux in a couple of hours unless someone beats me to it.


https://reviews.llvm.org/D30698

Files:
  lldb/include/lldb/Host/FileSpec.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/FileSpecList.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/PluginManager.cpp
  lldb/source/Host/common/FileSpec.cpp
  lldb/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/source/Host/common/Symbols.cpp
  lldb/source/Host/macosx/Host.mm
  lldb/source/Host/macosx/HostInfoMacOSX.mm
  lldb/source/Host/macosx/Symbols.cpp
  lldb/source/Host/posix/FileSystem.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/TargetList.cpp

Index: lldb/source/Target/TargetList.cpp
===
--- lldb/source/Target/TargetList.cpp
+++ lldb/source/Target/TargetList.cpp
@@ -362,7 +362,7 @@
   char resolved_bundle_exe_path[PATH_MAX];
   resolved_bundle_exe_path[0] = '\0';
   if (file) {
-if (file.GetFileType() == FileSpec::eFileTypeDirectory)
+if (llvm::sys::fs::is_directory(file.GetPath()))
   user_exe_path_is_bundle = true;
 
 if (file.IsRelative() && !user_exe_path.empty()) {
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -42,6 +42,8 @@
 #include "lldb/Utility/Error.h"
 #include "lldb/Utility/Log.h"
 
+#include "llvm/Support/FileSystem.h"
+
 // Define these constants from POSIX mman.h rather than include the file
 // so that they will be correct even when compiled on Linux.
 #define MAP_PRIVATE 2
@@ -541,17 +543,18 @@
 };
 
 static FileSpec::EnumerateDirectoryResult
-RecurseCopy_Callback(void *baton, FileSpec::FileType file_type,
+RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft,
  const FileSpec &src) {
   RecurseCopyBaton *rc_baton = (RecurseCopyBaton *)baton;
-  switch (file_type) {
-  case FileSpec::eFileTypePipe:
-  case FileSpec::eFileTypeSocket:
+  namespace fs = llvm::sys::fs;
+  switch (ft) {
+  case fs::file_type::fifo_file:
+  case fs::file_type::socket_file:
 // we have no way to copy pipes and sockets - ignore them and continue
 return FileSpec::eEnumerateDirectoryResultNext;
 break;
 
-  case FileSpec::eFileTypeDirectory: {
+  case fs::file_type::directory_file: {
 // make the new directory and get in there
 FileSpec dst_dir = rc_baton->dst;
 if (!dst_dir.GetFilename())
@@ -581,7 +584,7 @@
 return FileSpec::eEnumerateDirectoryResultNext;
   } break;
 
-  case FileSpec::eFileTypeSymbolicLink: {
+  case fs::file_type::symlink_file: {
 // copy the file and keep going
 FileSpec dst_file = rc_baton->dst;
 if (!dst_file.GetFilename())
@@ -603,7 +606,7 @@
 return FileSpec::eEnumerateDirectoryResultNext;
   } break;
 
-  case FileSpec::eFileTypeRegular: {
+  case fs::file_type::regular_file: {
 // copy the file and keep going
 FileSpec dst_file = rc_baton->dst;
 if (!dst_file.GetFilename())
@@ -616,15 +619,13

[Lldb-commits] [PATCH] D30574: Android.rules: add support for clang compiler

2017-03-07 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297145: Android.rules: add support for clang compiler 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D30574?vs=90477&id=90850#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30574

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

Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -14,22 +14,51 @@
 ifeq "$(ARCH)" "arm"
 	SYSROOT_ARCH := arm
 	STL_ARCH := armeabi-v7a
+	TRIPLE_ARCH := armv7
 	ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
 else ifeq "$(ARCH)" "aarch64"
 	SYSROOT_ARCH := arm64
+	TRIPLE_ARCH := aarch64
 	STL_ARCH := arm64-v8a
 else ifeq "$(ARCH)" "i386"
 	SYSROOT_ARCH := x86
 	STL_ARCH := x86
+	TRIPLE_ARCH := i686
 else ifeq "$(ARCH)" "mips64r6"
 	SYSROOT_ARCH := mips64
 	STL_ARCH := mips64
+	TRIPLE_ARCH := mips64el
 else ifeq "$(ARCH)" "mips32"
 	SYSROOT_ARCH := mips
 	STL_ARCH := mips
+	TRIPLE_ARCH := mipsel
 else
 	SYSROOT_ARCH := $(ARCH)
 	STL_ARCH := $(ARCH)
+	TRIPLE_ARCH := $(ARCH)
+endif
+
+ifeq "$(findstring 86,$(ARCH))" "86"
+	TOOLCHAIN_DIR := $(STL_ARCH)-4.9
+else
+	TOOLCHAIN_DIR := $(TRIPLE_ARCH)-linux-android-4.9
+endif
+
+ifeq "$(HOST_OS)" "Linux"
+	HOST_TAG := linux-x86_64
+else ifeq "$(HOST_OS)" "Darwin"
+	HOST_TAG := darwin-x86_64
+else
+	HOST_TAG := windows-x86_64
+endif
+
+ifeq "$(findstring clang,$(CC))" "clang"
+	ARCH_CFLAGS += \
+		-target $(TRIPLE_ARCH)-none-linux-android \
+		-gcc-toolchain $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
+	ARCH_LDFLAGS += \
+		-target $(TRIPLE_ARCH)-none-linux-android \
+		-gcc-toolchain $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
 ARCH_CFLAGS += \
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -32,6 +32,22 @@
 
 
 #--
+# If OS is not defined, use 'uname -s' to determine the OS name.
+#
+# uname on Windows gives "windows32", but most environments standardize
+# on "Windows_NT", so we'll make it consistent here.  When running
+# tests from Visual Studio, the environment variable isn't inherited
+# all the way down to the process spawned for make.
+#--
+HOST_OS = $(shell uname -s)
+ifeq "$(HOST_OS)" "windows32"
+	HOST_OS = Windows_NT
+endif
+ifeq "$(OS)" ""
+	OS = $(HOST_OS)
+endif
+
+#--
 # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
 # from the triple alone
 #--
@@ -69,22 +85,6 @@
 endif
 
 #--
-# If OS is not defined, use 'uname -s' to determine the OS name.
-#
-# uname on Windows gives "windows32", but most environments standardize
-# on "Windows_NT", so we'll make it consistent here.  When running
-# tests from Visual Studio, the environment variable isn't inherited
-# all the way down to the process spawned for make.
-#--
-HOST_OS = $(shell uname -s)
-ifeq "$(HOST_OS)" "windows32"
-	HOST_OS = Windows_NT
-endif
-ifeq "$(OS)" ""
-	OS = $(HOST_OS)
-endif
-
-#--
 # If ARCH is not defined, default to x86_64.
 #--
 ifeq "$(ARCH)" ""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r297145 - Android.rules: add support for clang compiler

2017-03-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar  7 08:57:37 2017
New Revision: 297145

URL: http://llvm.org/viewvc/llvm-project?rev=297145&view=rev
Log:
Android.rules: add support for clang compiler

Summary:
building executables with the NDK clang requires -target and
-gcc-toolchain arguments.

Reviewers: eugene, danalbert

Subscribers: srhines, lldb-commits

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

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=297145&r1=297144&r2=297145&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Tue Mar  7 
08:57:37 2017
@@ -14,22 +14,51 @@ endif
 ifeq "$(ARCH)" "arm"
SYSROOT_ARCH := arm
STL_ARCH := armeabi-v7a
+   TRIPLE_ARCH := armv7
ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
 else ifeq "$(ARCH)" "aarch64"
SYSROOT_ARCH := arm64
+   TRIPLE_ARCH := aarch64
STL_ARCH := arm64-v8a
 else ifeq "$(ARCH)" "i386"
SYSROOT_ARCH := x86
STL_ARCH := x86
+   TRIPLE_ARCH := i686
 else ifeq "$(ARCH)" "mips64r6"
SYSROOT_ARCH := mips64
STL_ARCH := mips64
+   TRIPLE_ARCH := mips64el
 else ifeq "$(ARCH)" "mips32"
SYSROOT_ARCH := mips
STL_ARCH := mips
+   TRIPLE_ARCH := mipsel
 else
SYSROOT_ARCH := $(ARCH)
STL_ARCH := $(ARCH)
+   TRIPLE_ARCH := $(ARCH)
+endif
+
+ifeq "$(findstring 86,$(ARCH))" "86"
+   TOOLCHAIN_DIR := $(STL_ARCH)-4.9
+else
+   TOOLCHAIN_DIR := $(TRIPLE_ARCH)-linux-android-4.9
+endif
+
+ifeq "$(HOST_OS)" "Linux"
+   HOST_TAG := linux-x86_64
+else ifeq "$(HOST_OS)" "Darwin"
+   HOST_TAG := darwin-x86_64
+else
+   HOST_TAG := windows-x86_64
+endif
+
+ifeq "$(findstring clang,$(CC))" "clang"
+   ARCH_CFLAGS += \
+   -target $(TRIPLE_ARCH)-none-linux-android \
+   -gcc-toolchain 
$(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
+   ARCH_LDFLAGS += \
+   -target $(TRIPLE_ARCH)-none-linux-android \
+   -gcc-toolchain 
$(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
 ARCH_CFLAGS += \

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=297145&r1=297144&r2=297145&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Tue Mar  7 
08:57:37 2017
@@ -32,6 +32,22 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)../../.
 
 
 #--
+# If OS is not defined, use 'uname -s' to determine the OS name.
+#
+# uname on Windows gives "windows32", but most environments standardize
+# on "Windows_NT", so we'll make it consistent here.  When running
+# tests from Visual Studio, the environment variable isn't inherited
+# all the way down to the process spawned for make.
+#--
+HOST_OS = $(shell uname -s)
+ifeq "$(HOST_OS)" "windows32"
+   HOST_OS = Windows_NT
+endif
+ifeq "$(OS)" ""
+   OS = $(HOST_OS)
+endif
+
+#--
 # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
 # from the triple alone
 #--
@@ -69,22 +85,6 @@ ifeq "$(OS)" "Android"
 endif
 
 #--
-# If OS is not defined, use 'uname -s' to determine the OS name.
-#
-# uname on Windows gives "windows32", but most environments standardize
-# on "Windows_NT", so we'll make it consistent here.  When running
-# tests from Visual Studio, the environment variable isn't inherited
-# all the way down to the process spawned for make.
-#--
-HOST_OS = $(shell uname -s)
-ifeq "$(HOST_OS)" "windows32"
-   HOST_OS = Windows_NT
-endif
-ifeq "$(OS)" ""
-   OS = $(HOST_OS)
-endif
-
-#--
 # If ARCH is not defined, default to x86_64.
 #--
 ifeq "$(ARCH)" ""


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


[Lldb-commits] [PATCH] D30457: [LLDB][MIPS] Core Dump Support

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

Thank you for updating that. Let me know what the make_core investigation 
uncovers.




Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp:164
+  case llvm::Triple::mips64el:
+const RegisterContextLinux_mips64 *reg_context_mips64;
+reg_context_mips64 = (const RegisterContextLinux_mips64 *)

no need to fiddle with pointers:
`const auto &context = static_cast(GetRegisterInfoInterface());`



Comment at: source/Plugins/Process/elf-core/ThreadElfCore.h:22
 
+#define MIPS_LINUX_PR_STATUS_SIZE_O32 96
+#define MIPS_LINUX_PR_STATUS_SIZE_N32 72

Thank you for introducing these constants. Since we already started using 
constexpr variables for constants, let's make these such as well. You could 
even hide these into the cpp file if you move the GetSize function there (it's 
grown so big it does not belong to a header anyway).


https://reviews.llvm.org/D30457



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


Re: [Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

2017-03-07 Thread Pavel Labath via lldb-commits
Yea, that would do the trick.

On 7 March 2017 at 14:47, Zachary Turner  wrote:
> I think i can address this by adding a bool to llvm::sys::fs::status which
> indicates whether to follow symlinks
>
> On Tue, Mar 7, 2017 at 5:41 AM Pavel Labath via Phabricator
>  wrote:
>>
>> labath added a comment.
>>
>> Zachary, unfortunately I had to revert this -- while investigating the
>> breakages I've found a problem I don't think any of us realised -- llvm's
>> statting code is based on stat(2), while lldb uses lstat(2). I think we need
>> to go back and re-audit each case to see whether the behavior difference is
>> a problem. In most of the cases, I think using stat would make things
>> simpler (no need to special case symlink as a file type), but at least one
>> case (SymbolFileDWARF) really depends on the lstat behavior (not resolving
>> symlinks), so we need to figure out how to handle that.
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D30624
>>
>>
>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

2017-03-07 Thread Zachary Turner via lldb-commits
I think i can address this by adding a bool to llvm::sys::fs::status which
indicates whether to follow symlinks
On Tue, Mar 7, 2017 at 5:41 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added a comment.
>
> Zachary, unfortunately I had to revert this -- while investigating the
> breakages I've found a problem I don't think any of us realised -- llvm's
> statting code is based on stat(2), while lldb uses lstat(2). I think we
> need to go back and re-audit each case to see whether the behavior
> difference is a problem. In most of the cases, I think using stat would
> make things simpler (no need to special case symlink as a file type), but
> at least one case (SymbolFileDWARF) really depends on the lstat behavior
> (not resolving symlinks), so we need to figure out how to handle that.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D30624
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29581: Initial implementation of SB APIs for Tracing support.

2017-03-07 Thread Ravitheja Addepally via Phabricator via lldb-commits
ravitheja added inline comments.



Comment at: include/lldb/API/SBTraceOptions.h:38
+  /// They should be formatted as a JSON Array.
+  void setTraceParams(lldb::SBStream ¶ms);
+

clayborg wrote:
> This should probably be:
> 
> ```
> void setTraceParams(lldb::SBStructuredData ¶ms);
> ```
> 
> Then we can add extra functions to SBStructuredData that allow you construct 
> one from XML, JSON, Apple plist, or any other structured data.
Hi, this would also mean we make SBTraceOptions a friend class of 
SBStructuredData so that we can get access to the StructuredDataObject inside ?


https://reviews.llvm.org/D29581



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


[Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

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

Zachary, unfortunately I had to revert this -- while investigating the 
breakages I've found a problem I don't think any of us realised -- llvm's 
statting code is based on stat(2), while lldb uses lstat(2). I think we need to 
go back and re-audit each case to see whether the behavior difference is a 
problem. In most of the cases, I think using stat would make things simpler (no 
need to special case symlink as a file type), but at least one case 
(SymbolFileDWARF) really depends on the lstat behavior (not resolving 
symlinks), so we need to figure out how to handle that.


Repository:
  rL LLVM

https://reviews.llvm.org/D30624



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


[Lldb-commits] [PATCH] D30454: [LLDB][MIPS] Fix typo in MatchesModuleSpec()

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

The VDSO is a pretty standard shared library in most aspects -- it contains the 
implementations of a couple of functions whose implementation can depend on the 
specific hardware revision (the fastest way to make a syscall, the fastest way 
to obtain system time, etc.). The main special thing about it is that it does 
not exist as a file on the disk. In case of a live process, we load it by 
directly reading the contents out of inferior memory. I am not sure what we 
should do in the core file case...


https://reviews.llvm.org/D30454



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


[Lldb-commits] [lldb] r297139 - Revert "Use LLVM for all stat-related functionality."

2017-03-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar  7 07:19:15 2017
New Revision: 297139

URL: http://llvm.org/viewvc/llvm-project?rev=297139&view=rev
Log:
Revert "Use LLVM for all stat-related functionality."

this reverts r297116 because it breaks the unittests and
TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but
the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat
functionality is not a drop-in replacement for lldb's. The former is
based on stat(2) (which does symlink resolution), while the latter is
based on lstat(2) (which does not).

This also reverts subsequent build fixes (r297128, r297120, 297117) and
r297119 (Remove FileSpec dependency on FileSystem) which builds on top
of this.

Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/API/SBPlatform.cpp
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/FileSpecList.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp
lldb/trunk/source/Host/common/Symbols.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
lldb/trunk/source/Host/macosx/Symbols.cpp
lldb/trunk/source/Host/posix/FileSystem.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/ModuleCache.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/TargetList.cpp

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=297139&r1=297138&r2=297139&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Tue Mar  7 07:19:15 2017
@@ -22,7 +22,6 @@
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/Triple.h"
-#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatVariadic.h"
 
 namespace lldb_private {
@@ -47,6 +46,17 @@ namespace lldb_private {
 //--
 class FileSpec {
 public:
+  typedef enum FileType {
+eFileTypeInvalid = -1,
+eFileTypeUnknown = 0,
+eFileTypeDirectory,
+eFileTypePipe,
+eFileTypeRegular,
+eFileTypeSocket,
+eFileTypeSymbolicLink,
+eFileTypeOther
+  } FileType;
+
   enum PathSyntax {
 ePathSyntaxPosix,
 ePathSyntaxWindows,
@@ -445,6 +455,8 @@ public:
   //--
   ConstString GetFileNameStrippingExtension() const;
 
+  FileType GetFileType() const;
+
   //--
   /// Return the current permissions of the path.
   ///
@@ -459,6 +471,20 @@ public:
   //--
   uint32_t GetPermissions() const;
 
+  bool IsDirectory() const {
+return GetFileType() == FileSpec::eFileTypeDirectory;
+  }
+
+  bool IsPipe() const { return GetFileType() == FileSpec::eFileTypePipe; }
+
+  bool IsRegularFile() const {
+return GetFileType() == FileSpec::eFileTypeRegular;
+  }
+
+  bool IsSocket() const { return GetFileType() == FileSpec::eFileTypeSocket; }
+
+  bool IsSymbolicLink() const;
+
   //--
   /// Get the memory cost of this object.
   ///
@@ -570,7 +596,7 @@ public:
   };
 
   typedef Enumerate

[Lldb-commits] [PATCH] D30454: [LLDB][MIPS] Fix typo in MatchesModuleSpec()

2017-03-07 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain added a comment.

In https://reviews.llvm.org/D30454#693614, @clayborg wrote:

> So a ModuleSpec allows you to specify a module by path, UUID and many other 
> things. This is falling down for a magic file that doesn't actually exist 
> right?




  Yes.

> "vsdo" is just a made up name for the table of loaded shared libraries? Is 
> that correct? I need to understand what is going on before I can offer 
> correct guidance.

I am not sure about that. From Man page, the "vDSO" (virtual dynamic shared 
object) is a small shared library that the kernel automatically maps into the 
address space of all user-space applications.

Thanks


https://reviews.llvm.org/D30454



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

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






Comment at: unittests/Signals/UnixSignalsTest.cpp:43
+
+#define ASSERT_EQ_ARRAYS(expected, observed)   
\
+  AssertEqArrays((expected), (observed), __FILE__, __LINE__);

eugene wrote:
> labath wrote:
> > This (and the function) should probably have an EXPECT_.. prefix instead, 
> > as it does not abort the evaluation of the function it is in (like other 
> > ASSERT_*** macros).
> This function calls ASSERT_EQ so it does abort evaluation.
Unfortunately it does not. If you look up what ASSERT_EQ does, you'll see that 
it basically amounts to `EXPECT_EQ(a,b); return;` 
,
 
.
 So it does abort, but only the top most frame. Since your topmost frame is the 
`AssertEqArrays` function, it will just do an early return from that, and the 
caller will happily continue. If you wanted to be fancy you could define the 
macro to something like `CompareArrays(...); if(HasFailure()) return;`. Another 
solution would be to write a comparison function that returns an 
`AssertionResult` 

 and then use that in EXPECT_TRUE/ASSERT_TRUE  as you see fit (but that's 
probably overkill).


https://reviews.llvm.org/D30520



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


[Lldb-commits] [lldb] r297128 - Fixed a missing brace.

2017-03-07 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Tue Mar  7 02:31:41 2017
New Revision: 297128

URL: http://llvm.org/viewvc/llvm-project?rev=297128&view=rev
Log:
Fixed a missing brace.

Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=297128&r1=297127&r2=297128&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp 
(original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Tue Mar  
7 02:31:41 2017
@@ -398,7 +398,7 @@ void PlatformDarwinKernel::GetUserSpecif
   for (uint32_t i = 0; i < user_dirs_count; i++) {
 FileSpec dir = user_dirs.GetFileSpecAtIndex(i);
 dir.ResolvePath();
-if (llvm::sys::fs::is_directory(dir.GetPath()))
+if (llvm::sys::fs::is_directory(dir.GetPath())) {
   m_search_directories.push_back(dir);
 }
   }


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