Re: [Lldb-commits] [PATCH] D18886: Reset continue_after_async only if neither SIGINIT nor SIGSTOP received

2016-04-08 Thread Pavel Labath via lldb-commits
labath added a subscriber: labath.
labath added a comment.

Does this fix an existing test or is a new issue? If it's new (it sounds like 
it is, as I don't see any test failures), could you also add a test for this. 
It shouldn't be too difficult to write one... Would something like this:

  dbg.SetAsync(true)
  process.Continue()
  lldbutil.expect_state_changes(self,dbg.GetListener(), [eStateRunning])
  target.BreakpointCreateBySourceRegex("// some code which will not get 
executed by the inferior")
  do_some_assertions_on_the_breakpoint()
  while dbg.GetListener().WaitForEvent(2, event):
if SBProcess.GetStateFromEvent(event) == eStateStopped and 
SBProcess.GetRestartedFromEvent(state):
  continue
if SBProcess.GetStateFromEvent(event) == eStateRunning:
  continue
self.fail("Setting a breakpoint generated an unexpected event: 
%s"%SBDebugger.StateAsCString(SBProcess.GetStateFromEvent(event)));

do the trick?


http://reviews.llvm.org/D18886



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


[Lldb-commits] [lldb] r265787 - Fix-up LLDB build after rL13179

2016-04-08 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Apr  8 09:31:13 2016
New Revision: 265787

URL: http://llvm.org/viewvc/llvm-project?rev=265787&view=rev
Log:
Fix-up LLDB build after rL13179

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=265787&r1=265786&r2=265787&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Apr  8 09:31:13 2016
@@ -4776,18 +4776,42 @@ ClangASTContext::GetEncoding (lldb::opaq
 case clang::BuiltinType::Kind::Dependent:
 case clang::BuiltinType::Kind::OCLClkEvent:
 case clang::BuiltinType::Kind::OCLEvent:
-case clang::BuiltinType::Kind::OCLImage1d:
-case clang::BuiltinType::Kind::OCLImage1dArray:
-case clang::BuiltinType::Kind::OCLImage1dBuffer:
-case clang::BuiltinType::Kind::OCLImage2d:
-case clang::BuiltinType::Kind::OCLImage2dArray:
-case clang::BuiltinType::Kind::OCLImage2dArrayDepth:
-case clang::BuiltinType::Kind::OCLImage2dArrayMSAA:
-case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepth:
-case clang::BuiltinType::Kind::OCLImage2dDepth:
-case clang::BuiltinType::Kind::OCLImage2dMSAA:
-case clang::BuiltinType::Kind::OCLImage2dMSAADepth:
-case clang::BuiltinType::Kind::OCLImage3d:
+case clang::BuiltinType::Kind::OCLImage1dRO:
+case clang::BuiltinType::Kind::OCLImage1dWO:
+case clang::BuiltinType::Kind::OCLImage1dRW:
+case clang::BuiltinType::Kind::OCLImage1dArrayRO:
+case clang::BuiltinType::Kind::OCLImage1dArrayWO:
+case clang::BuiltinType::Kind::OCLImage1dArrayRW:
+case clang::BuiltinType::Kind::OCLImage1dBufferRO:
+case clang::BuiltinType::Kind::OCLImage1dBufferWO:
+case clang::BuiltinType::Kind::OCLImage1dBufferRW:
+case clang::BuiltinType::Kind::OCLImage2dRO:
+case clang::BuiltinType::Kind::OCLImage2dWO:
+case clang::BuiltinType::Kind::OCLImage2dRW:
+case clang::BuiltinType::Kind::OCLImage2dArrayRO:
+case clang::BuiltinType::Kind::OCLImage2dArrayWO:
+case clang::BuiltinType::Kind::OCLImage2dArrayRW:
+case clang::BuiltinType::Kind::OCLImage2dArrayDepthRO:
+case clang::BuiltinType::Kind::OCLImage2dArrayDepthWO:
+case clang::BuiltinType::Kind::OCLImage2dArrayDepthRW:
+case clang::BuiltinType::Kind::OCLImage2dArrayMSAARO:
+case clang::BuiltinType::Kind::OCLImage2dArrayMSAAWO:
+case clang::BuiltinType::Kind::OCLImage2dArrayMSAARW:
+case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepthRO:
+case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepthWO:
+case clang::BuiltinType::Kind::OCLImage2dArrayMSAADepthRW:
+case clang::BuiltinType::Kind::OCLImage2dDepthRO:
+case clang::BuiltinType::Kind::OCLImage2dDepthWO:
+case clang::BuiltinType::Kind::OCLImage2dDepthRW:
+case clang::BuiltinType::Kind::OCLImage2dMSAARO:
+case clang::BuiltinType::Kind::OCLImage2dMSAAWO:
+case clang::BuiltinType::Kind::OCLImage2dMSAARW:
+case clang::BuiltinType::Kind::OCLImage2dMSAADepthRO:
+case clang::BuiltinType::Kind::OCLImage2dMSAADepthWO:
+case clang::BuiltinType::Kind::OCLImage2dMSAADepthRW:
+case clang::BuiltinType::Kind::OCLImage3dRO:
+case clang::BuiltinType::Kind::OCLImage3dWO:
+case clang::BuiltinType::Kind::OCLImage3dRW:
 case clang::BuiltinType::Kind::OCLQueue:
 case clang::BuiltinType::Kind::OCLNDRange:
 case clang::BuiltinType::Kind::OCLReserveID:
@@ -5816,12 +5840,24 @@ ClangASTContext::GetNumPointeeChildren (
 case clang::BuiltinType::Void:
 case clang::BuiltinType::NullPtr:
 case clang::BuiltinType::OCLEvent:
-case clang::BuiltinType::OCLImage1d:
-case clang::BuiltinType::OCLImage1dArray:
-case clang::BuiltinType::OCLImage1dBuffer:
-case clang::BuiltinType::OCLImage2d:
-case clang::BuiltinType::OCLImage2dArray:
-case clang::BuiltinType::OCLImage3d:
+case clang::BuiltinType::OCLImage1dRO:
+case clang::BuiltinType::OCLImage1dWO:
+case clang::BuiltinType::OCLImage1dRW:
+case clang::BuiltinType::OCLImage1dArrayRO:
+case clang::BuiltinType::OCLImage1dArrayWO:
+case clang::BuiltinType::OCLImage1dArrayRW:
+case clang::BuiltinType::OCLImage1dBufferRO:
+case clang::BuiltinType::O

Re: [Lldb-commits] [PATCH] D18880: -thread-info in lldbmi does not conform to protocol. Should end with current thread id

2016-04-08 Thread Jackson Davis via lldb-commits
jacdavis updated this revision to Diff 53028.
jacdavis added a comment.

Ran formatting tool with lldb format. pthread linker option is still required 
for C++11 threads so left it in. New test still disabled for windows.


http://reviews.llvm.org/D18880

Files:
  Makefile
  TestMiThreadInfo.py
  test_threadinfo.cpp

Index: test_threadinfo.cpp
===
--- test_threadinfo.cpp
+++ test_threadinfo.cpp
@@ -0,0 +1,21 @@
+#include 
+#include 
+#include 
+
+using namespace std;
+
+void
+ThreadProc()
+{
+int i = 0;
+i++;
+}
+
+int
+main()
+{
+thread t(ThreadProc);
+t.join();
+
+return 0;
+}
Index: TestMiThreadInfo.py
===
--- TestMiThreadInfo.py
+++ TestMiThreadInfo.py
@@ -0,0 +1,39 @@
+"""
+Test lldb-mi -thread-info command.
+"""
+
+from __future__ import print_function
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class MiThreadInfoTestCase(lldbmi_testcase.MiTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows # pthreads not supported on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread 
races
+def test_lldbmi_thread_info(self):
+"""Test that -thread-info prints thread info and the 
current-thread-id"""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert ThreadProc")
+self.expect("\^done")
+
+# Run to the breakpoint
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+self.runCmd("-thread-info")
+
self.expect("\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"")
+
+self.runCmd("-gdb-quit")
+   
Index: Makefile
===
--- Makefile
+++ Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+LDFLAGS=-pthread
+
+CXX_SOURCES := test_threadinfo.cpp
+
+include $(LEVEL)/Makefile.rules


Index: test_threadinfo.cpp
===
--- test_threadinfo.cpp
+++ test_threadinfo.cpp
@@ -0,0 +1,21 @@
+#include 
+#include 
+#include 
+
+using namespace std;
+
+void
+ThreadProc()
+{
+int i = 0;
+i++;
+}
+
+int
+main()
+{
+thread t(ThreadProc);
+t.join();
+
+return 0;
+}
Index: TestMiThreadInfo.py
===
--- TestMiThreadInfo.py
+++ TestMiThreadInfo.py
@@ -0,0 +1,39 @@
+"""
+Test lldb-mi -thread-info command.
+"""
+
+from __future__ import print_function
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class MiThreadInfoTestCase(lldbmi_testcase.MiTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows # pthreads not supported on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+def test_lldbmi_thread_info(self):
+"""Test that -thread-info prints thread info and the current-thread-id"""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert ThreadProc")
+self.expect("\^done")
+
+# Run to the breakpoint
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+self.runCmd("-thread-info")
+self.expect("\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"")
+
+self.runCmd("-gdb-quit")
+   
Index: Makefile
===
--- Makefile
+++ Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+LDFLAGS=-pthread
+
+CXX_SOURCES := test_threadinfo.cpp
+
+include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18880: -thread-info in lldbmi does not conform to protocol. Should end with current thread id

2016-04-08 Thread Jackson Davis via lldb-commits
jacdavis updated this revision to Diff 53031.
jacdavis added a comment.

last diff missed lldb-mi changes


http://reviews.llvm.org/D18880

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile
  packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
  packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
  tools/lldb-mi/MICmdCmdThread.cpp
  tools/lldb-mi/MICmdCmdThread.h

Index: tools/lldb-mi/MICmdCmdThread.h
===
--- tools/lldb-mi/MICmdCmdThread.h
+++ tools/lldb-mi/MICmdCmdThread.h
@@ -60,4 +60,8 @@
 bool m_bThreadInvalid; // True = invalid, false = ok
 VecMIValueTuple_t m_vecMIValueTuple;
 const CMIUtilString m_constStrArgNamedThreadId;
+
+// mi value of current-thread-id if multiple threads are requested
+bool m_bHasCurrentThread;
+CMICmnMIValue m_miValueCurrThreadId;
 };
Index: tools/lldb-mi/MICmdCmdThread.cpp
===
--- tools/lldb-mi/MICmdCmdThread.cpp
+++ tools/lldb-mi/MICmdCmdThread.cpp
@@ -29,9 +29,10 @@
 // Throws:  None.
 //--
 CMICmdCmdThreadInfo::CMICmdCmdThreadInfo()
-: m_bSingleThread(false)
-, m_bThreadInvalid(true)
-, m_constStrArgNamedThreadId("thread-id")
+: m_bSingleThread(false),
+  m_bThreadInvalid(true),
+  m_constStrArgNamedThreadId("thread-id"),
+  m_bHasCurrentThread(false)
 {
 // Command factory matches this name with that received from the stdin stream
 m_strMiCmd = "thread-info";
@@ -124,6 +125,15 @@
 }
 }
 
+// -thread-info with multiple threads ends with the current thread id if any
+if (thread.IsValid())
+{
+const CMIUtilString strId(CMIUtilString::Format("%d", thread.GetIndexID()));
+CMICmnMIValueConst miValueCurrThreadId(strId);
+m_miValueCurrThreadId = miValueCurrThreadId;
+m_bHasCurrentThread = true;
+}
+
 return MIstatus::success;
 }
 
@@ -179,7 +189,12 @@
 ++it;
 }
 
-const CMICmnMIValueResult miValueResult("threads", miValueList);
+CMICmnMIValueResult miValueResult("threads", miValueList);
+if (m_bHasCurrentThread)
+{
+CMIUtilString strCurrThreadId = "current-thread-id";
+miValueResult.Add(strCurrThreadId, m_miValueCurrThreadId);
+}
 const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, miValueResult);
 m_miResultRecord = miRecordResult;
 
Index: packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
+++ packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
@@ -0,0 +1,21 @@
+#include 
+#include 
+#include 
+
+using namespace std;
+
+void
+ThreadProc()
+{
+int i = 0;
+i++;
+}
+
+int
+main()
+{
+thread t(ThreadProc);
+t.join();
+
+return 0;
+}
Index: packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
@@ -0,0 +1,39 @@
+"""
+Test lldb-mi -thread-info command.
+"""
+
+from __future__ import print_function
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class MiThreadInfoTestCase(lldbmi_testcase.MiTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows # pthreads not supported on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+def test_lldbmi_thread_info(self):
+"""Test that -thread-info prints thread info and the current-thread-id"""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert ThreadProc")
+self.expect("\^done")
+
+# Run to the breakpoint
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+self.runCmd("-thread-info")
+self.expect("\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"")
+
+self.runCmd("-gdb-quit")
+   
Index: packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile
+++ packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+LDFLAGS=-pthread
+
+CXX_SOURCES := test_threadinfo.cpp
+
+include $(LEVEL)/Makefile.rules
_

Re: [Lldb-commits] [PATCH] D18886: Reset continue_after_async only if neither SIGINIT nor SIGSTOP received

2016-04-08 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D18886



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


[Lldb-commits] [lldb] r265797 - Fix indentation for commit 263859.

2016-04-08 Thread Luke Drummond via lldb-commits
Author: ldrumm
Date: Fri Apr  8 11:30:55 2016
New Revision: 265797

URL: http://llvm.org/viewvc/llvm-project?rev=265797&view=rev
Log:
Fix indentation for commit 263859.

Modified:
lldb/trunk/include/lldb/Expression/LLVMUserExpression.h

Modified: lldb/trunk/include/lldb/Expression/LLVMUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/LLVMUserExpression.h?rev=265797&r1=265796&r2=265797&view=diff
==
--- lldb/trunk/include/lldb/Expression/LLVMUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/LLVMUserExpression.h Fri Apr  8 11:30:55 
2016
@@ -16,6 +16,9 @@
 #include 
 #include 
 
+// Other libraries and framework includes
+#include "llvm/IR/LegacyPassManager.h"
+
 // Project includes
 #include "lldb/Expression/UserExpression.h"
 
@@ -34,7 +37,18 @@ namespace lldb_private
 //--
 class LLVMUserExpression : public UserExpression
 {
-  public:
+public:
+// The IRPasses struct is filled in by a runtime after an expression is 
compiled and can be used to to run
+// fixups/analysis passes as required. EarlyPasses are run on the 
generated module before lldb runs its own IR
+// fixups and inserts instrumentation code/pointer checks. LatePasses are 
run after the module has been processed by
+// llvm, before the module is assembled and run in the ThreadPlan.
+struct IRPasses
+{
+IRPasses() : EarlyPasses(nullptr), LatePasses(nullptr){};
+std::shared_ptr EarlyPasses;
+std::shared_ptr LatePasses;
+};
+
   LLVMUserExpression(ExecutionContextScope &exe_scope, const char *expr, 
const char *expr_prefix,
  lldb::LanguageType language, ResultType desired_type,
  const EvaluateExpressionOptions &options);


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


[Lldb-commits] [lldb] r265799 - Revert bad commit 265797.

2016-04-08 Thread Luke Drummond via lldb-commits
Author: ldrumm
Date: Fri Apr  8 11:35:58 2016
New Revision: 265799

URL: http://llvm.org/viewvc/llvm-project?rev=265799&view=rev
Log:
Revert bad commit 265797.

Modified:
lldb/trunk/include/lldb/Expression/LLVMUserExpression.h

Modified: lldb/trunk/include/lldb/Expression/LLVMUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/LLVMUserExpression.h?rev=265799&r1=265798&r2=265799&view=diff
==
--- lldb/trunk/include/lldb/Expression/LLVMUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/LLVMUserExpression.h Fri Apr  8 11:35:58 
2016
@@ -16,9 +16,6 @@
 #include 
 #include 
 
-// Other libraries and framework includes
-#include "llvm/IR/LegacyPassManager.h"
-
 // Project includes
 #include "lldb/Expression/UserExpression.h"
 
@@ -37,18 +34,7 @@ namespace lldb_private
 //--
 class LLVMUserExpression : public UserExpression
 {
-public:
-// The IRPasses struct is filled in by a runtime after an expression is 
compiled and can be used to to run
-// fixups/analysis passes as required. EarlyPasses are run on the 
generated module before lldb runs its own IR
-// fixups and inserts instrumentation code/pointer checks. LatePasses are 
run after the module has been processed by
-// llvm, before the module is assembled and run in the ThreadPlan.
-struct IRPasses
-{
-IRPasses() : EarlyPasses(nullptr), LatePasses(nullptr){};
-std::shared_ptr EarlyPasses;
-std::shared_ptr LatePasses;
-};
-
+  public:
   LLVMUserExpression(ExecutionContextScope &exe_scope, const char *expr, 
const char *expr_prefix,
  lldb::LanguageType language, ResultType desired_type,
  const EvaluateExpressionOptions &options);


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


[Lldb-commits] [lldb] r265808 - Remove bad indentation introduced in 263859

2016-04-08 Thread Luke Drummond via lldb-commits
Author: ldrumm
Date: Fri Apr  8 11:52:40 2016
New Revision: 265808

URL: http://llvm.org/viewvc/llvm-project?rev=265808&view=rev
Log:
Remove bad indentation introduced in 263859

This commit touches whitespace only.
This commit was the original intention of the botched 265797



Modified:
lldb/trunk/include/lldb/Expression/LLVMUserExpression.h

Modified: lldb/trunk/include/lldb/Expression/LLVMUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/LLVMUserExpression.h?rev=265808&r1=265807&r2=265808&view=diff
==
--- lldb/trunk/include/lldb/Expression/LLVMUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/LLVMUserExpression.h Fri Apr  8 11:52:40 
2016
@@ -34,27 +34,27 @@ namespace lldb_private
 //--
 class LLVMUserExpression : public UserExpression
 {
-  public:
-  LLVMUserExpression(ExecutionContextScope &exe_scope, const char *expr, 
const char *expr_prefix,
- lldb::LanguageType language, ResultType desired_type,
- const EvaluateExpressionOptions &options);
-  ~LLVMUserExpression() override;
+public:
+LLVMUserExpression(ExecutionContextScope &exe_scope, const char *expr, 
const char *expr_prefix,
+   lldb::LanguageType language, ResultType desired_type,
+   const EvaluateExpressionOptions &options);
+~LLVMUserExpression() override;
 
-  lldb::ExpressionResults
-  Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
-  const EvaluateExpressionOptions &options, lldb::UserExpressionSP 
&shared_ptr_to_me,
-  lldb::ExpressionVariableSP &result) override;
+lldb::ExpressionResults
+Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+const EvaluateExpressionOptions &options, lldb::UserExpressionSP 
&shared_ptr_to_me,
+lldb::ExpressionVariableSP &result) override;
 
-  bool
-  FinalizeJITExecution(DiagnosticManager &diagnostic_manager, 
ExecutionContext &exe_ctx,
-   lldb::ExpressionVariableSP &result,
-   lldb::addr_t function_stack_bottom = 
LLDB_INVALID_ADDRESS,
-   lldb::addr_t function_stack_top = 
LLDB_INVALID_ADDRESS) override;
+bool
+FinalizeJITExecution(DiagnosticManager &diagnostic_manager, 
ExecutionContext &exe_ctx,
+ lldb::ExpressionVariableSP &result,
+ lldb::addr_t function_stack_bottom = 
LLDB_INVALID_ADDRESS,
+ lldb::addr_t function_stack_top = 
LLDB_INVALID_ADDRESS) override;
 
-  bool
-  CanInterpret() override
-  {
-  return m_can_interpret;
+bool
+CanInterpret() override
+{
+return m_can_interpret;
 }
 
 //--


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


Re: [Lldb-commits] [PATCH] D18880: -thread-info in lldbmi does not conform to protocol. Should end with current thread id

2016-04-08 Thread Zachary Turner via lldb-commits
zturner accepted this revision.
zturner added a reviewer: zturner.
zturner added a comment.
This revision is now accepted and ready to land.

Looks fine to me.  TBH I haven't seen any of the lldb-mi owners around in 
months, so I'm not sure if they're still active


http://reviews.llvm.org/D18880



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


Re: [Lldb-commits] [PATCH] D18789: [NFC] Cleanup the code used to run shell commands from tests

2016-04-08 Thread Todd Fiala via lldb-commits
The exponential back off code forgot to import 'time'.  This code will
trigger (and has on our end) a python exception for 'time' missing.

I'm fixing this now.

On Tue, Apr 5, 2016 at 7:13 AM, Tamas Berghammer via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL265398: [NFC] Cleanup the code used to run shell
> commands from tests (authored by tberghammer).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D18789?vs=52681&id=52685#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D18789
>
> Files:
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
>   lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>   lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
>
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
>
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>


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


Re: [Lldb-commits] [PATCH] D18789: [NFC] Cleanup the code used to run shell commands from tests

2016-04-08 Thread Todd Fiala via lldb-commits
tfiala added a subscriber: tfiala.
tfiala added a comment.

The exponential back off code forgot to import 'time'.  This code will
trigger (and has on our end) a python exception for 'time' missing.

I'm fixing this now.


Repository:
  rL LLVM

http://reviews.llvm.org/D18789



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


[Lldb-commits] [lldb] r265819 - Add help for our regular expression commands when aliased

2016-04-08 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Apr  8 12:56:26 2016
New Revision: 265819

URL: http://llvm.org/viewvc/llvm-project?rev=265819&view=rev
Log:
Add help for our regular expression commands when aliased

Modified:
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=265819&r1=265818&r2=265819&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Apr  8 12:56:26 
2016
@@ -198,9 +198,7 @@ CommandInterpreter::Initialize ()
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-attach",false);
 if (cmd_obj_sp)
-{
-AddAlias ("attach", cmd_obj_sp);
-}
+AddAlias ("attach", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("process detach",false);
 if (cmd_obj_sp)
@@ -221,7 +219,7 @@ CommandInterpreter::Initialize ()
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-tbreak",false);
 if (cmd_obj_sp)
-AddAlias ("tbreak", cmd_obj_sp);
+AddAlias ("tbreak", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("thread step-inst", false);
 if (cmd_obj_sp)
@@ -279,22 +277,20 @@ CommandInterpreter::Initialize ()
 cmd_obj_sp = GetCommandSPExact ("_regexp-jump",false);
 if (cmd_obj_sp)
 {
-AddAlias ("j", cmd_obj_sp);
-AddAlias ("jump", cmd_obj_sp);
+AddAlias ("j", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
+AddAlias ("jump", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 }
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-list", false);
 if (cmd_obj_sp)
 {
-AddAlias ("l", cmd_obj_sp);
-AddAlias ("list", cmd_obj_sp);
+AddAlias ("l", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
+AddAlias ("list", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 }
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-env", false);
 if (cmd_obj_sp)
-{
-AddAlias ("env", cmd_obj_sp);
-}
+AddAlias ("env", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("memory read", false);
 if (cmd_obj_sp)
@@ -302,15 +298,15 @@ CommandInterpreter::Initialize ()
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-up", false);
 if (cmd_obj_sp)
-AddAlias ("up", cmd_obj_sp);
+AddAlias ("up", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-down", false);
 if (cmd_obj_sp)
-AddAlias ("down", cmd_obj_sp);
+AddAlias ("down", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-display", false);
 if (cmd_obj_sp)
-AddAlias ("display", cmd_obj_sp);
+AddAlias ("display", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("disassemble", false);
 if (cmd_obj_sp)
@@ -324,11 +320,11 @@ CommandInterpreter::Initialize ()
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-undisplay", false);
 if (cmd_obj_sp)
-AddAlias ("undisplay", cmd_obj_sp);
+AddAlias ("undisplay", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("_regexp-bt", false);
 if (cmd_obj_sp)
-AddAlias ("bt", cmd_obj_sp);
+AddAlias ("bt", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
 cmd_obj_sp = GetCommandSPExact ("target create", false);
 if (cmd_obj_sp)


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


[Lldb-commits] [lldb] r265820 - Cleanups to command alias to refer to itself as 'command alias' and not allow to make aliases starting with a - as that isn't really supported, and is most often a mist

2016-04-08 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Apr  8 12:56:57 2016
New Revision: 265820

URL: http://llvm.org/viewvc/llvm-project?rev=265820&view=rev
Log:
Cleanups to command alias to refer to itself as 'command alias' and not allow 
to make aliases starting with a - as that isn't really supported, and is most 
often a mistake (trying to pass options)

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

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=265820&r1=265819&r2=265820&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Apr  8 12:56:57 
2016
@@ -631,7 +631,7 @@ protected:
 {
 if (!raw_command_line || !raw_command_line[0])
 {
-result.AppendError ("'alias' requires at least two arguments");
+result.AppendError ("'command alias' requires at least two 
arguments");
 return false;
 }
 
@@ -686,7 +686,7 @@ protected:
 
 if (argc < 2)
 {
-result.AppendError ("'alias' requires at least two arguments");
+result.AppendError ("'command alias' requires at least two 
arguments");
 result.SetStatus (eReturnStatusFailed);
 return false;
 }
@@ -694,6 +694,17 @@ protected:
 // Get the alias command.
 
 const std::string alias_command = args.GetArgumentAtIndex (0);
+if (alias_command.size() > 1 &&
+alias_command[0] == '-')
+{
+result.AppendError("aliases starting with a dash are not 
supported");
+if (alias_command == "--help" || alias_command == "--long-help")
+{
+result.AppendWarning("if trying to pass options to 'command 
alias' add a -- at the end of the options");
+}
+result.SetStatus (eReturnStatusFailed);
+return false;
+}
 
 // Strip the new alias name off 'raw_command_string'  (leave it on 
args, which gets passed to 'Execute', which
 // does the stripping itself.
@@ -724,12 +735,13 @@ protected:
 
 // Get CommandObject that is being aliased. The command name is read 
from the front of raw_command_string.
 // raw_command_string is returned with the name of the command object 
stripped off the front.
+std::string original_raw_command_string(raw_command_string);
 CommandObject *cmd_obj = m_interpreter.GetCommandObjectForCommand 
(raw_command_string);
 
 if (!cmd_obj)
 {
-result.AppendErrorWithFormat ("invalid command given to 'alias'. 
'%s' does not begin with a valid command."
-  "  No alias created.", 
raw_command_string.c_str());
+result.AppendErrorWithFormat ("invalid command given to 'command 
alias'. '%s' does not begin with a valid command."
+  "  No alias created.", 
original_raw_command_string.c_str());
 result.SetStatus (eReturnStatusFailed);
 return false;
 }
@@ -792,7 +804,7 @@ protected:
 
 if (argc < 2)
 {
-result.AppendError ("'alias' requires at least two arguments");
+result.AppendError ("'command alias' requires at least two 
arguments");
 result.SetStatus (eReturnStatusFailed);
 return false;
 }


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


[Lldb-commits] [lldb] r265818 - Append a missing \n

2016-04-08 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Apr  8 12:55:59 2016
New Revision: 265818

URL: http://llvm.org/viewvc/llvm-project?rev=265818&view=rev
Log:
Append a missing \n

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

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=265818&r1=265817&r2=265818&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Fri Apr  8 12:55:59 2016
@@ -1438,7 +1438,7 @@ protected:
 result.SetStatus(eReturnStatusSuccessFinishResult);
 else
 {
-result.GetOutputStream().PutCString("no matching results found.");
+result.GetOutputStream().PutCString("no matching results 
found.\n");
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
 }
 return result.Succeeded();


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


[Lldb-commits] [lldb] r265821 - fix missing import of 'time' in lldbutil.wait_for_file_on_target

2016-04-08 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Fri Apr  8 13:06:11 2016
New Revision: 265821

URL: http://llvm.org/viewvc/llvm-project?rev=265821&view=rev
Log:
fix missing import of 'time' in lldbutil.wait_for_file_on_target

This triggers in some timeout scenarios in the LLDB test suite.

Fixes:
https://bugs.swift.org/browse/SR-1193

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=265821&r1=265820&r2=265821&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Fri Apr  8 13:06:11 
2016
@@ -1038,6 +1038,7 @@ def wait_for_file_on_target(testcase, fi
 break
 if i < max_attempts:
 # Exponential backoff!
+import time
 time.sleep(pow(2, i) * 0.25)
 else:
 testcase.fail("File %s not found even after %d attempts." % 
(file_path, max_attempts))


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


[Lldb-commits] [PATCH] D18904: Ensure swig Python type map #if __APPLE__ directive makes it into the swig output.

2016-04-08 Thread Todd Fiala via lldb-commits
tfiala created this revision.
tfiala added a reviewer: clayborg.
tfiala added a subscriber: lldb-commits.

The swig call generates our Python bindings for LLDB.  Fix a #if __APPLE___ 
directive in the type map file to be evaluated at LLDBWrapPython.cpp build time 
rather than generation time.

http://reviews.llvm.org/D18904

Files:
  scripts/Python/python-typemaps.swig

Index: scripts/Python/python-typemaps.swig
===
--- scripts/Python/python-typemaps.swig
+++ scripts/Python/python-typemaps.swig
@@ -534,7 +534,7 @@
 
 %typemap(out) FILE * {
char mode[4] = {0};
-#ifdef __APPLE__
+%#ifdef __APPLE__
int i = 0;
if ($1)
{
@@ -547,7 +547,7 @@
else // if (flags & __SRW)
   mode[i++] = 'a';
 }
-#endif
+%#endif
using namespace lldb_private;
File file($1, false);
PythonFile py_file(file, mode);


Index: scripts/Python/python-typemaps.swig
===
--- scripts/Python/python-typemaps.swig
+++ scripts/Python/python-typemaps.swig
@@ -534,7 +534,7 @@
 
 %typemap(out) FILE * {
char mode[4] = {0};
-#ifdef __APPLE__
+%#ifdef __APPLE__
int i = 0;
if ($1)
{
@@ -547,7 +547,7 @@
else // if (flags & __SRW)
   mode[i++] = 'a';
 }
-#endif
+%#endif
using namespace lldb_private;
File file($1, false);
PythonFile py_file(file, mode);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r265829 - Fix #ifdef __APPLE__ code is the swig Python bindings

2016-04-08 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Fri Apr  8 13:58:07 2016
New Revision: 265829

URL: http://llvm.org/viewvc/llvm-project?rev=265829&view=rev
Log:
Fix #ifdef __APPLE__ code is the swig Python bindings

This code was getting evaluated unintentionally at binding
generation time instead of binding file compilation time.

Addresses:
https://bugs.swift.org/browse/SR-1192

Modified:
lldb/trunk/scripts/Python/python-typemaps.swig

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=265829&r1=265828&r2=265829&view=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Fri Apr  8 13:58:07 2016
@@ -534,7 +534,7 @@
 
 %typemap(out) FILE * {
char mode[4] = {0};
-#ifdef __APPLE__
+%#ifdef __APPLE__
int i = 0;
if ($1)
{
@@ -547,7 +547,7 @@
else // if (flags & __SRW)
   mode[i++] = 'a';
 }
-#endif
+%#endif
using namespace lldb_private;
File file($1, false);
PythonFile py_file(file, mode);


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


Re: [Lldb-commits] [PATCH] D18904: Ensure swig Python type map #if __APPLE__ directive makes it into the swig output.

2016-04-08 Thread Todd Fiala via lldb-commits
tfiala closed this revision.
tfiala added a comment.

Closed with LLDB svn trunk r265829.


http://reviews.llvm.org/D18904



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


Re: [Lldb-commits] [PATCH] D18886: Reset continue_after_async only if neither SIGINIT nor SIGSTOP received

2016-04-08 Thread Oleksiy Vyalov via lldb-commits
ovyalov updated this revision to Diff 53054.
ovyalov added a comment.

Added new TestBreakpointSetRestart test to cover the addressed issue.


http://reviews.llvm.org/D18886

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1165,12 +1165,13 @@
 // binaries that would send two stop replies 
anytime the process
 // was interrupted, so we need to also check for 
an extra
 // stop reply packet if we interrupted the process
-if (m_interrupt_sent || (signo != sigint_signo && 
signo != sigstop_signo))
+const bool received_nonstop_signal = signo != 
sigint_signo && signo != sigstop_signo;
+if (m_interrupt_sent || received_nonstop_signal)
 {
-continue_after_async = false;
+if (received_nonstop_signal)
+continue_after_async = false;
 
-// We didn't get a SIGINT or SIGSTOP, so try 
for a
-// very brief time (0.1s) to get another stop 
reply
+// Try for a very brief time (0.1s) to get 
another stop reply
 // packet to make sure it doesn't get in the 
way
 StringExtractorGDBRemote 
extra_stop_reply_packet;
 uint32_t timeout_usec = 10;
Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
===
--- 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
+++ 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
@@ -0,0 +1,19 @@
+//===-- main.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 
+
+int main(int argc, char const *argv[])
+{
+getchar();
+printf("Set a breakpoint here.\n");
+return 0;
+}
+
Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
===
--- 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
+++ 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
@@ -0,0 +1,37 @@
+"""
+Test inferior restart when breakpoint is set on running target.
+"""
+
+import os
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class BreakpointSetRestart(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+BREAKPOINT_TEXT = 'Set a breakpoint here'
+
+def test_breakpoint_set_restart(self):
+self.build()
+
+cwd = self.get_process_working_directory()
+exe = os.path.join(cwd, "a.out")
+target = self.dbg.CreateTarget(exe)
+
+self.dbg.SetAsync(True)
+process = target.LaunchSimple(None, None, cwd)
+
+lldbutil.expect_state_changes(self, self.dbg.GetListener(), 
[lldb.eStateRunning])
+bp = target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
+  
lldb.SBFileSpec(os.path.join(cwd, 'main.cpp')))
+self.assertTrue(bp.IsValid() and bp.GetNumLocations() == 1, 
VALID_BREAKPOINT)
+
+event = lldb.SBEvent()
+while self.dbg.GetListener().WaitForEvent(2, event):
+if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateStopped 
and lldb.SBProcess.GetRestartedFromEvent(event):
+continue
+if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
+continue
+self.fail("Setting a breakpoint generated an unexpected event: %s" 
% lldb.SBDebugger.StateAsCString(lldb.SBProcess.GetStateFromEvent(event)))
+
Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoin

Re: [Lldb-commits] [PATCH] D18886: Reset continue_after_async only if neither SIGINIT nor SIGSTOP received

2016-04-08 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

In http://reviews.llvm.org/D18886#395216, @labath wrote:

> Does this fix an existing test or is a new issue? If it's new (it sounds like 
> it is, as I don't see any test failures), could you also add a test for this. 
> It shouldn't be too difficult to write one... Would something like this:
>
>   dbg.SetAsync(true)
>   process.Continue()
>   lldbutil.expect_state_changes(self,dbg.GetListener(), [eStateRunning])
>   target.BreakpointCreateBySourceRegex("// some code which will not get 
> executed by the inferior")
>   do_some_assertions_on_the_breakpoint()
>   while dbg.GetListener().WaitForEvent(2, event):
> if SBProcess.GetStateFromEvent(event) == eStateStopped and 
> SBProcess.GetRestartedFromEvent(state):
>   continue
> if SBProcess.GetStateFromEvent(event) == eStateRunning:
>   continue
> self.fail("Setting a breakpoint generated an unexpected event: 
> %s"%SBDebugger.StateAsCString(SBProcess.GetStateFromEvent(event)));
>
>
> do the trick?


Thanks for suggested test, Pavel.


http://reviews.llvm.org/D18886



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


Re: [Lldb-commits] [PATCH] D18848: Add PDBASTParser and parse type information from PDB

2016-04-08 Thread Zachary Turner via lldb-commits
zturner added a comment.

Greg, what should happen when you look up a builtin type like "char" or 
"float"?  Is there supposed to be a unique `TypeSP` for this somewhere, with a 
unique uid?


http://reviews.llvm.org/D18848



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


[Lldb-commits] [lldb] r265843 - Reset continue_after_async only if neither SIGINIT nor SIGSTOP received.

2016-04-08 Thread Oleksiy Vyalov via lldb-commits
Author: ovyalov
Date: Fri Apr  8 15:44:28 2016
New Revision: 265843

URL: http://llvm.org/viewvc/llvm-project?rev=265843&view=rev
Log:
Reset continue_after_async only if neither SIGINIT nor SIGSTOP received.

http://reviews.llvm.org/D18886


Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
Modified:

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

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile?rev=265843&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile
 Fri Apr  8 15:44:28 2016
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py?rev=265843&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
 Fri Apr  8 15:44:28 2016
@@ -0,0 +1,37 @@
+"""
+Test inferior restart when breakpoint is set on running target.
+"""
+
+import os
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class BreakpointSetRestart(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+BREAKPOINT_TEXT = 'Set a breakpoint here'
+
+def test_breakpoint_set_restart(self):
+self.build()
+
+cwd = self.get_process_working_directory()
+exe = os.path.join(cwd, "a.out")
+target = self.dbg.CreateTarget(exe)
+
+self.dbg.SetAsync(True)
+process = target.LaunchSimple(None, None, cwd)
+
+lldbutil.expect_state_changes(self, self.dbg.GetListener(), 
[lldb.eStateRunning])
+bp = target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
+  
lldb.SBFileSpec(os.path.join(cwd, 'main.cpp')))
+self.assertTrue(bp.IsValid() and bp.GetNumLocations() == 1, 
VALID_BREAKPOINT)
+
+event = lldb.SBEvent()
+while self.dbg.GetListener().WaitForEvent(2, event):
+if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateStopped 
and lldb.SBProcess.GetRestartedFromEvent(event):
+continue
+if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
+continue
+self.fail("Setting a breakpoint generated an unexpected event: %s" 
% lldb.SBDebugger.StateAsCString(lldb.SBProcess.GetStateFromEvent(event)))
+

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp?rev=265843&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
 Fri Apr  8 15:44:28 2016
@@ -0,0 +1,19 @@
+//===-- main.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 
+
+int main(int argc, char const *argv[])
+{
+getchar();
+printf("Set a breakpoint here.\n");
+return 0;
+}
+

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=265843&r1=265842&r2=

Re: [Lldb-commits] [PATCH] D18886: Reset continue_after_async only if neither SIGINIT nor SIGSTOP received

2016-04-08 Thread Oleksiy Vyalov via lldb-commits
ovyalov closed this revision.
ovyalov added a comment.

Submitted as http://reviews.llvm.org/rL265843


http://reviews.llvm.org/D18886



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


[Lldb-commits] [lldb] r265849 - Remove even more of the data formatters that silently run code

2016-04-08 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Apr  8 16:24:24 2016
New Revision: 265849

URL: http://llvm.org/viewvc/llvm-project?rev=265849&view=rev
Log:
Remove even more of the data formatters that silently run code

Fixes 


Modified:
lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
lldb/trunk/source/DataFormatters/FormattersHelpers.cpp
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.h
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h?rev=265849&r1=265848&r2=265849&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h Fri Apr  8 
16:24:24 2016
@@ -75,35 +75,7 @@ namespace lldb_private {
 ScriptedSyntheticChildren::Flags flags,
 bool regex = false);
 #endif
-
-StackFrame*
-GetViableFrame (ExecutionContext exe_ctx);
-
-bool
-ExtractValueFromObjCExpression (ValueObject &valobj,
-const char* target_type,
-const char* selector,
-uint64_t &value);
-
-bool
-ExtractSummaryFromObjCExpression (ValueObject &valobj,
-  const char* target_type,
-  const char* selector,
-  Stream &stream,
-  lldb::LanguageType lang_type);
-
-lldb::ValueObjectSP
-CallSelectorOnObject (ValueObject &valobj,
-  const char* return_type,
-  const char* selector,
-  uint64_t index);
-
-lldb::ValueObjectSP
-CallSelectorOnObject (ValueObject &valobj,
-  const char* return_type,
-  const char* selector,
-  const char* key);
-
+
 size_t
 ExtractIndexFromString (const char* item_name);
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=265849&r1=265848&r2=265849&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
 Fri Apr  8 16:24:24 2016
@@ -67,11 +67,6 @@ class ObjCDataFormatterTestCase(TestBase
 """Test formatters for NSException."""
 self.appkit_tester_impl(self.nsexception_data_formatter_commands)
 
-@skipUnlessDarwin
-def test_nsmisc_with_run_command(self):
-"""Test formatters for misc NS classes."""
-self.appkit_tester_impl(self.nsmisc_data_formatter_commands)
-
 
 @skipUnlessDarwin
 def test_nsdate_with_run_command(self):
@@ -271,20 +266,6 @@ class ObjCDataFormatterTestCase(TestBase
 '(NSException *) except2 = ','name: 
@"TheGuyWhoHasNoName`2" - reason: @"cuz it\'s funny"',
 '(NSException *) except3 = ','name: 
@"TheGuyWhoHasNoName/3" - reason: @"cuz it\'s funny"'])
 
-def nsmisc_data_formatter_commands(self):
-self.expect('frame variable localhost',
-substrs = [' localhost ((','"127.0.0.1"'])
-
-if self.getArchitecture() in ['i386', 'x86_64']:
-self.expect('frame variable my_task',
-substrs = ['http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=265849&r1=265848&r2=265849&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
 Fri Apr  8 16:24:24 2016
@@ -506,8 +506,6 @@ int main (int argc, const char * argv[])
NSException* except2 = [[NSException

Re: [Lldb-commits] [PATCH] D18848: Add PDBASTParser and parse type information from PDB

2016-04-08 Thread Zachary Turner via lldb-commits
zturner added a comment.

I mean for example if someone calls `FindTypes(..., "char", ...);

Should a `TypeSP` go into the map?


http://reviews.llvm.org/D18848



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


[Lldb-commits] [PATCH] D18912: sleep and retry on failure to delete temp file in tests

2016-04-08 Thread Adrian McCarthy via lldb-commits
amccarth created this revision.
amccarth added a reviewer: zturner.
amccarth added a subscriber: lldb-commits.

This solves a flaky test on Windows.

We have similar logic elsewhere for log files.  I considered trying to combine 
them, but since they are methods of different objects, there wasn't really a 
clean approach.

http://reviews.llvm.org/D18912

Files:
  packages/Python/lldbsuite/test/lldbtest.py

Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1996,4 +1996,10 @@
 @classmethod
 def RemoveTempFile(cls, file):
 if os.path.exists(file):
-os.remove(file)
+try:
+os.remove(file)
+except:
+# On Windows, we can sometimes need a retry because 
antimalware may
+# briefly hold the file open.
+time.sleep(0.5)
+os.remove(file)


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1996,4 +1996,10 @@
 @classmethod
 def RemoveTempFile(cls, file):
 if os.path.exists(file):
-os.remove(file)
+try:
+os.remove(file)
+except:
+# On Windows, we can sometimes need a retry because antimalware may
+# briefly hold the file open.
+time.sleep(0.5)
+os.remove(file)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18912: sleep and retry on failure to delete temp file in tests

2016-04-08 Thread Zachary Turner via lldb-commits
zturner added a comment.

How about add a function to `lldbsuite\support\fs.py`?

  def remove_file(file, num_retries, sleep_duration):

Then just call this everywhere you need to.  Could even nuke this whole 
`RemoveTempFile` method.


http://reviews.llvm.org/D18912



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


[Lldb-commits] [lldb] r265858 - -thread-info in lldbmi does not conform to protocol. Should end with current thread id

2016-04-08 Thread Chuck Ries via lldb-commits
Author: chuckr
Date: Fri Apr  8 17:17:53 2016
New Revision: 265858

URL: http://llvm.org/viewvc/llvm-project?rev=265858&view=rev
Log:
-thread-info in lldbmi does not conform to protocol. Should end with current 
thread id

-thread-info in lldbmi does not conform to protocol. Should end with
current thread id as described here:
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Thread-Commands.html#GDB_002fMI-Thread-Commands

When printing all threads, the current thread id should be printed
afterwards.

Example:
-thread-info
 ^done,threads=[
 {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
frame={level="0",addr="0xe410",func="__kernel_vsyscall",
args=[]},state="running"},
 {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
frame={level="0",addr="0x0804891f",func="foo",
args=[{name="i",value="10"}],
file="/tmp/a.c",fullname="/tmp/a.c",line="158"},
state="running"}],
 current-thread-id="1"
 (gdb)

Patch from jacda...@microsoft.com

Reviewers: zturner, chuckr

Differential Revision: http://reviews.llvm.org/differential/revision/edit/18880/

Added:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile

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

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdThread.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdThread.h

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile?rev=265858&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile 
Fri Apr  8 17:17:53 2016
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+LDFLAGS=-pthread
+
+CXX_SOURCES := test_threadinfo.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py?rev=265858&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
 Fri Apr  8 17:17:53 2016
@@ -0,0 +1,39 @@
+"""
+Test lldb-mi -thread-info command.
+"""
+
+from __future__ import print_function
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class MiThreadInfoTestCase(lldbmi_testcase.MiTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows # pthreads not supported on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread 
races
+def test_lldbmi_thread_info(self):
+"""Test that -thread-info prints thread info and the 
current-thread-id"""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert ThreadProc")
+self.expect("\^done")
+
+# Run to the breakpoint
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+self.runCmd("-thread-info")
+
self.expect("\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"")
+
+self.runCmd("-gdb-quit")
+   

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp?rev=265858&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp
 Fri Apr  8 17:17:53 2016
@@ -0,0 +1,21 @@
+#include 
+#include 
+#include 
+
+using namespace std;
+
+void
+ThreadProc()
+{
+int i = 0;
+i++;
+}
+
+int
+main()
+{
+thread t(ThreadProc);
+t.join();
+
+return 0;
+}

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdThread.cpp?rev=265858&r1=265857&r2=265858&view=diff

Re: [Lldb-commits] [PATCH] D18848: Add PDBASTParser and parse type information from PDB

2016-04-08 Thread Greg Clayton via lldb-commits
clayborg added a comment.

In http://reviews.llvm.org/D18848#395933, @zturner wrote:

> I mean for example if someone calls `FindTypes(..., "char", ...);`
>
> Should a `TypeSP` go into the map?


No you don't have to make one up if you don't have one. At least this is what 
the DWARF parser does. The main problem is the definition for "char" can be 
signed or unsigned depending on how your translation unit was compiled. 
Probably some other char types can vary as well. No expressions will ask for 
built in types since the expression parser already knows about them. And it is 
useful to try and lookup "char" in a SymbolFile to see what the notion that 
that symbol file has for "char" (signed or unsigned).

So if you actually have one, return it. Or if PDB always has some around and it 
has some unique identifiers for the builtin types you can easily create them 
from your clang::ASTContext with the "ast->IntTy" and the many other built int 
types. But if you don't have any, don't worry about creating them from nothing.


http://reviews.llvm.org/D18848



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


Re: [Lldb-commits] [PATCH] D18880: -thread-info in lldbmi does not conform to protocol. Should end with current thread id

2016-04-08 Thread Chuck Ries via lldb-commits
ChuckR added a subscriber: ChuckR.
ChuckR closed this revision.
ChuckR added a comment.

closed with http://reviews.llvm.org/rL265858


http://reviews.llvm.org/D18880



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


Re: [Lldb-commits] [PATCH] D18912: sleep and retry on failure to delete temp file in tests

2016-04-08 Thread Adrian McCarthy via lldb-commits
amccarth updated this revision to Diff 53100.
amccarth added a comment.

Consolidated the os.remove and os.unlink calls with a function to do the 
retries.  Tested on Windows.


http://reviews.llvm.org/D18912

Files:
  packages/Python/lldbsuite/test/lldbtest.py

Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1049,23 +1049,13 @@
 # it silently replaces the destination.  Ultimately 
this means that atomic renames are not
 # guaranteed to be possible on Windows, but we need 
this to work anyway, so just remove the
 # destination first if it already exists.
-os.remove(dst)
+remove_file(dst)
 
 os.rename(src, dst)
 else:
 # success!  (and we don't want log files) delete log files
 for log_file in log_files_for_this_test:
-try:
-os.unlink(log_file)
-except:
-# We've seen consistent unlink failures on Windows, 
perhaps because the
-# just-created log file is being scanned by anti-virus.  
Empirically, this
-# sleep-and-retry approach allows tests to succeed much 
more reliably.
-# Attempts to figure out exactly what process was still 
holding a file handle
-# have failed because running instrumentation like Process 
Monitor seems to
-# slow things down enough that the problem becomes much 
less consistent.
-time.sleep(0.5)
-os.unlink(log_file)
+remove_file(log_file)
 
 # 
 # Config. methods supported through a plugin interface
@@ -1996,4 +1986,19 @@
 @classmethod
 def RemoveTempFile(cls, file):
 if os.path.exists(file):
+remove_file(file)
+
+# On Windows, the first attempt to delete a recently-touched file can fail
+# because of a race with antimalware scanners.  This function will detect a
+# failure and retry.
+def remove_file(file, num_retries = 1, sleep_duration = 0.5):
+while True:
+try:
 os.remove(file)
+return True
+except:
+if num_retries == 0:
+return False
+num_retries -= 1
+time.sleep(sleep_duration)
+continue


Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1049,23 +1049,13 @@
 # it silently replaces the destination.  Ultimately this means that atomic renames are not
 # guaranteed to be possible on Windows, but we need this to work anyway, so just remove the
 # destination first if it already exists.
-os.remove(dst)
+remove_file(dst)
 
 os.rename(src, dst)
 else:
 # success!  (and we don't want log files) delete log files
 for log_file in log_files_for_this_test:
-try:
-os.unlink(log_file)
-except:
-# We've seen consistent unlink failures on Windows, perhaps because the
-# just-created log file is being scanned by anti-virus.  Empirically, this
-# sleep-and-retry approach allows tests to succeed much more reliably.
-# Attempts to figure out exactly what process was still holding a file handle
-# have failed because running instrumentation like Process Monitor seems to
-# slow things down enough that the problem becomes much less consistent.
-time.sleep(0.5)
-os.unlink(log_file)
+remove_file(log_file)
 
 # 
 # Config. methods supported through a plugin interface
@@ -1996,4 +1986,19 @@
 @classmethod
 def RemoveTempFile(cls, file):
 if os.path.exists(file):
+remove_file(file)
+
+# On Windows, the first attempt to delete a recently-touched file can fail
+# because of a race with antimalware scanners.  This function will detect a
+# failure and retry.
+def remove_file(file, num_retries = 1, sleep_duration = 0.5):
+while True:
+try:
 os.remove(file)
+return True
+except:
+if num_retries == 0:
+return False
+num_retries -= 1
+time.sleep(sleep_duration)
+continue
__

[Lldb-commits] [lldb] r265865 - Remove what I believe are the last known instances of formatters that run code

2016-04-08 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Apr  8 17:49:31 2016
New Revision: 265865

URL: http://llvm.org/viewvc/llvm-project?rev=265865&view=rev
Log:
Remove what I believe are the last known instances of formatters that run code

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/main.m
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/trunk/source/Plugins/Language/ObjC/CF.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=265865&r1=265864&r2=265865&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
 Fri Apr  8 17:49:31 2016
@@ -214,11 +214,9 @@ class ObjCDataFormatterTestCase(TestBase
 self.expect('frame variable iset1 iset2 imset',
 substrs = ['4 indexes','512 indexes','10 indexes'])
 
-self.expect('frame variable mutable_bag_ref cfbag_ref binheap_ref',
-substrs = ['(CFMutableBagRef) mutable_bag_ref = ','@"17 
values"',
-'(CFBagRef) cfbag_ref = ','@"15 values"',
-'(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
-
+self.expect('frame variable binheap_ref',
+substrs = ['(CFBinaryHeapRef) binheap_ref = ','@"21 
items"'])
+
 self.expect('expression -d run -- [NSArray new]', substrs=['@"0 
elements"'])
 
 def nsdata_data_formatter_commands(self):

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=265865&r1=265864&r2=265865&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
 Fri Apr  8 17:49:31 2016
@@ -431,31 +431,6 @@ int main (int argc, const char * argv[])
CFArraySetValueAtIndex(mutable_array_ref, 9, str11);
CFArraySetValueAtIndex(mutable_array_ref, 10, str12);
 
-   CFMutableBagRef mutable_bag_ref = CFBagCreateMutable(NULL, 15, 
NULL);
-
-   CFBagSetValue(mutable_bag_ref, strB10);
-   CFBagSetValue(mutable_bag_ref, str1);
-   CFBagSetValue(mutable_bag_ref, str2);
-   CFBagSetValue(mutable_bag_ref, str3);
-   CFBagSetValue(mutable_bag_ref, str4);
-   CFBagSetValue(mutable_bag_ref, str5);
-   CFBagSetValue(mutable_bag_ref, str6);
-   CFBagSetValue(mutable_bag_ref, str7);
-   CFBagSetValue(mutable_bag_ref, str8);
-   CFBagSetValue(mutable_bag_ref, str9);
-   CFBagSetValue(mutable_bag_ref, str10);
-   CFBagSetValue(mutable_bag_ref, str11);
-   CFBagSetValue(mutable_bag_ref, str12);
-   CFBagSetValue(mutable_bag_ref, strA1);
-   CFBagSetValue(mutable_bag_ref, strA2);
-   CFBagSetValue(mutable_bag_ref, strA3);
-
-   CFBagRef cfbag_ref = CFBagCreateCopy(NULL, mutable_bag_ref);
-
-   CFBagSetValue(mutable_bag_ref, strB8);
-   CFBagSetValue(mutable_bag_ref, strC4);
-
-
CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, 
&kCFStringBinaryHeapCallBacks, NULL);
CFBinaryHeapAddValue(binheap_ref, str1);
CFBinaryHeapAddValue(binheap_ref, str2);

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py?rev=265865&r1=265864&r2=265865&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py
 (orig

Re: [Lldb-commits] [PATCH] D18912: sleep and retry on failure to delete temp file in tests

2016-04-08 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: packages/Python/lldbsuite/test/lldbtest.py:1994
@@ +1993,3 @@
+# failure and retry.
+def remove_file(file, num_retries = 1, sleep_duration = 0.5):
+while True:

I think the default for `num_retries` should be 0.  Usually you just want to 
try once without retry.


Comment at: packages/Python/lldbsuite/test/lldbtest.py:1995
@@ +1994,3 @@
+def remove_file(file, num_retries = 1, sleep_duration = 0.5):
+while True:
+try:

You could do `for i in range(num_retries+1):` and get rid of a bunch of the 
counter updating and junk


http://reviews.llvm.org/D18912



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


Re: [Lldb-commits] [PATCH] D18912: sleep and retry on failure to delete temp file in tests

2016-04-08 Thread Adrian McCarthy via lldb-commits
amccarth added inline comments.


Comment at: packages/Python/lldbsuite/test/lldbtest.py:1994
@@ +1993,3 @@
+# failure and retry.
+def remove_file(file, num_retries = 1, sleep_duration = 0.5):
+while True:

zturner wrote:
> I think the default for `num_retries` should be 0.  Usually you just want to 
> try once without retry.
I disagree.  Every call site was already doing exactly one retry.  I don't see 
value in making each of them specify that explicitly.


Comment at: packages/Python/lldbsuite/test/lldbtest.py:1995
@@ +1994,3 @@
+def remove_file(file, num_retries = 1, sleep_duration = 0.5):
+while True:
+try:

zturner wrote:
> You could do `for i in range(num_retries+1):` and get rid of a bunch of the 
> counter updating and junk
Fine, but that changes the behavior a bit.  My approach avoided that extra 
sleep after the last retry.


http://reviews.llvm.org/D18912



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


Re: [Lldb-commits] [PATCH] D18912: sleep and retry on failure to delete temp file in tests

2016-04-08 Thread Zachary Turner via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

Ahh, you're right, I didn't notice that.


http://reviews.llvm.org/D18912



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


[Lldb-commits] [lldb] r265869 - Fix TestBreakpointSetRestart failure on Android.

2016-04-08 Thread Oleksiy Vyalov via lldb-commits
Author: ovyalov
Date: Fri Apr  8 22:08:02 2016
New Revision: 265869

URL: http://llvm.org/viewvc/llvm-project?rev=265869&view=rev
Log:
Fix TestBreakpointSetRestart failure on Android.


Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py?rev=265869&r1=265868&r2=265869&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
 Fri Apr  8 22:08:02 2016
@@ -5,7 +5,6 @@ Test inferior restart when breakpoint is
 import os
 import lldb
 from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
 
 class BreakpointSetRestart(TestBase):
 
@@ -15,19 +14,26 @@ class BreakpointSetRestart(TestBase):
 def test_breakpoint_set_restart(self):
 self.build()
 
-cwd = self.get_process_working_directory()
-exe = os.path.join(cwd, "a.out")
+cwd = os.getcwd()
+exe = os.path.join(cwd, 'a.out')
+
 target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
 
 self.dbg.SetAsync(True)
-process = target.LaunchSimple(None, None, cwd)
+process = target.LaunchSimple(None, None, 
self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
 
-lldbutil.expect_state_changes(self, self.dbg.GetListener(), 
[lldb.eStateRunning])
+event = lldb.SBEvent()
+# Wait for inferior to transition to running state
+while self.dbg.GetListener().WaitForEvent(2, event):
+if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
+break
+
 bp = target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
   
lldb.SBFileSpec(os.path.join(cwd, 'main.cpp')))
 self.assertTrue(bp.IsValid() and bp.GetNumLocations() == 1, 
VALID_BREAKPOINT)
 
-event = lldb.SBEvent()
 while self.dbg.GetListener().WaitForEvent(2, event):
 if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateStopped 
and lldb.SBProcess.GetRestartedFromEvent(event):
 continue


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