[Lldb-commits] [lldb] r243922 - XFAIL TestInferiorAssert for Android API <= 16.

2015-08-03 Thread Chaoren Lin
Author: chaoren
Date: Mon Aug  3 18:59:41 2015
New Revision: 243922

URL: http://llvm.org/viewvc/llvm-project?rev=243922&view=rev
Log:
XFAIL TestInferiorAssert for Android API <= 16.

Modified:
lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py

Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=243922&r1=243921&r2=243922&view=diff
==
--- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py 
(original)
+++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Mon 
Aug  3 18:59:41 2015
@@ -31,6 +31,7 @@ class AssertingInferiorTestCase(TestBase
 self.inferior_asserting_registers()
 
 @expectedFailureWindows("llvm.org/pr21793: need to implement support for 
detecting assertion / abort on Windows")
+@expectedFailureAndroid(api_levels=range(16 + 1)) # b.android.com/179836
 def test_inferior_asserting_register_dwarf(self):
 """Test that lldb reliably reads registers from the inferior after 
asserting (command)."""
 self.buildDwarf()


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


Re: [Lldb-commits] [PATCH] D11667: Allow ValueObject::Dereference to dereference references.

2015-07-30 Thread Chaoren Lin
This revision was automatically updated to reflect the committed changes.
Closed by commit rL243716: Allow ValueObject::Dereference to dereference 
references. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11667?vs=31084&id=31091#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11667

Files:
  lldb/trunk/source/Core/ValueObject.cpp

Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -3711,9 +3711,9 @@
 {
 if (m_deref_valobj)
 return m_deref_valobj->GetSP();
-
-const bool is_pointer_type = IsPointerType();
-if (is_pointer_type)
+
+const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
+if (is_pointer_or_reference_type)
 {
 bool omit_empty_base_classes = true;
 bool ignore_array_bounds = false;
@@ -3730,7 +3730,7 @@
 ClangASTType child_clang_type;
 
 ExecutionContext exe_ctx (GetExecutionContextRef());
-
+
 child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
 0,
 
transparent_pointers,
@@ -3773,10 +3773,10 @@
 StreamString strm;
 GetExpressionPath(strm, true);
 
-if (is_pointer_type)
+if (is_pointer_or_reference_type)
 error.SetErrorStringWithFormat("dereference failed: (%s) %s", 
GetTypeName().AsCString(""), strm.GetString().c_str());
 else
-error.SetErrorStringWithFormat("not a pointer type: (%s) %s", 
GetTypeName().AsCString(""), strm.GetString().c_str());
+error.SetErrorStringWithFormat("not a pointer or reference type: 
(%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
 return ValueObjectSP();
 }
 }


Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -3711,9 +3711,9 @@
 {
 if (m_deref_valobj)
 return m_deref_valobj->GetSP();
-
-const bool is_pointer_type = IsPointerType();
-if (is_pointer_type)
+
+const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
+if (is_pointer_or_reference_type)
 {
 bool omit_empty_base_classes = true;
 bool ignore_array_bounds = false;
@@ -3730,7 +3730,7 @@
 ClangASTType child_clang_type;
 
 ExecutionContext exe_ctx (GetExecutionContextRef());
-
+
 child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
 0,
 transparent_pointers,
@@ -3773,10 +3773,10 @@
 StreamString strm;
 GetExpressionPath(strm, true);
 
-if (is_pointer_type)
+if (is_pointer_or_reference_type)
 error.SetErrorStringWithFormat("dereference failed: (%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
 else
-error.SetErrorStringWithFormat("not a pointer type: (%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
+error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
 return ValueObjectSP();
 }
 }
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D11667: Allow ValueObject::Dereference to dereference references.

2015-07-30 Thread Chaoren Lin
chaoren created this revision.
chaoren added a reviewer: clayborg.
chaoren added a subscriber: lldb-commits.

http://reviews.llvm.org/D11667

Files:
  source/Core/ValueObject.cpp

Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -3711,9 +3711,9 @@
 {
 if (m_deref_valobj)
 return m_deref_valobj->GetSP();
-
-const bool is_pointer_type = IsPointerType();
-if (is_pointer_type)
+
+const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
+if (is_pointer_or_reference_type)
 {
 bool omit_empty_base_classes = true;
 bool ignore_array_bounds = false;
@@ -3730,7 +3730,7 @@
 ClangASTType child_clang_type;
 
 ExecutionContext exe_ctx (GetExecutionContextRef());
-
+
 child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
 0,
 
transparent_pointers,
@@ -3773,10 +3773,10 @@
 StreamString strm;
 GetExpressionPath(strm, true);
 
-if (is_pointer_type)
+if (is_pointer_or_reference_type)
 error.SetErrorStringWithFormat("dereference failed: (%s) %s", 
GetTypeName().AsCString(""), strm.GetString().c_str());
 else
-error.SetErrorStringWithFormat("not a pointer type: (%s) %s", 
GetTypeName().AsCString(""), strm.GetString().c_str());
+error.SetErrorStringWithFormat("not a pointer or reference type: 
(%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
 return ValueObjectSP();
 }
 }


Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -3711,9 +3711,9 @@
 {
 if (m_deref_valobj)
 return m_deref_valobj->GetSP();
-
-const bool is_pointer_type = IsPointerType();
-if (is_pointer_type)
+
+const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
+if (is_pointer_or_reference_type)
 {
 bool omit_empty_base_classes = true;
 bool ignore_array_bounds = false;
@@ -3730,7 +3730,7 @@
 ClangASTType child_clang_type;
 
 ExecutionContext exe_ctx (GetExecutionContextRef());
-
+
 child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
 0,
 transparent_pointers,
@@ -3773,10 +3773,10 @@
 StreamString strm;
 GetExpressionPath(strm, true);
 
-if (is_pointer_type)
+if (is_pointer_or_reference_type)
 error.SetErrorStringWithFormat("dereference failed: (%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
 else
-error.SetErrorStringWithFormat("not a pointer type: (%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
+error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s", GetTypeName().AsCString(""), strm.GetString().c_str());
 return ValueObjectSP();
 }
 }
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r243667 - Use only unnamed pipes to launch lldb-server gdbserver.

2015-07-30 Thread Chaoren Lin
Author: chaoren
Date: Thu Jul 30 12:48:44 2015
New Revision: 243667

URL: http://llvm.org/viewvc/llvm-project?rev=243667&view=rev
Log:
Use only unnamed pipes to launch lldb-server gdbserver.

Summary:
If we used unnamed pipes instead of named pipes, we can avoid having the
file system littered with debugserver-named-pipes if lldb-server happens to
crash for whatever reason. Also, on some buggy systems, it's possible to be
able to create but not to delete a fifo. Ideally, support for unnamed pipes
should be added to debugserver as well, so we can avoid the `#ifdef` here.

Reviewers: clayborg, vharron, chying

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=243667&r1=243666&r2=243667&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu 
Jul 30 12:48:44 2015
@@ -1200,35 +1200,37 @@ GDBRemoteCommunication::StartDebugserver
 // output of the command into this file. We will later read this 
file
 // if all goes well and fill the data into "command_output_ptr"
 
+#if defined(__APPLE__)
 // Binding to port zero, we need to figure out what port it ends up
 // using using a named pipe...
 error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", 
false, named_pipe_path);
-if (error.Success())
+if (error.Fail())
 {
-debugserver_args.AppendArgument("--named-pipe");
-debugserver_args.AppendArgument(named_pipe_path.c_str());
+if (log)
+log->Printf("GDBRemoteCommunication::%s() "
+"named pipe creation failed: %s",
+__FUNCTION__, error.AsCString());
+return error;
 }
-else
+debugserver_args.AppendArgument("--named-pipe");
+debugserver_args.AppendArgument(named_pipe_path.c_str());
+#else
+// Binding to port zero, we need to figure out what port it ends up
+// using using an unnamed pipe...
+error = port_pipe.CreateNew(true);
+if (error.Fail())
 {
 if (log)
 log->Printf("GDBRemoteCommunication::%s() "
-"named pipe creation failed: %s",
+"unnamed pipe creation failed: %s",
 __FUNCTION__, error.AsCString());
-// let's try an unnamed pipe
-error = port_pipe.CreateNew(true);
-if (error.Fail())
-{
-if (log)
-log->Printf("GDBRemoteCommunication::%s() "
-"unnamed pipe creation failed: %s",
-__FUNCTION__, error.AsCString());
-return error;
-}
-int write_fd = port_pipe.GetWriteFileDescriptor();
-debugserver_args.AppendArgument("--pipe");
-
debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
-
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+return error;
 }
+int write_fd = port_pipe.GetWriteFileDescriptor();
+debugserver_args.AppendArgument("--pipe");
+debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
+
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+#endif
 }
 else
 {


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


Re: [Lldb-commits] [PATCH] D11609: Use only unnamed pipes to launch lldb-server gdbserver.

2015-07-30 Thread Chaoren Lin
This revision was automatically updated to reflect the committed changes.
Closed by commit rL243667: Use only unnamed pipes to launch lldb-server 
gdbserver. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11609?vs=30946&id=31050#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11609

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1200,35 +1200,37 @@
 // output of the command into this file. We will later read this 
file
 // if all goes well and fill the data into "command_output_ptr"
 
+#if defined(__APPLE__)
 // Binding to port zero, we need to figure out what port it ends up
 // using using a named pipe...
 error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", 
false, named_pipe_path);
-if (error.Success())
+if (error.Fail())
 {
-debugserver_args.AppendArgument("--named-pipe");
-debugserver_args.AppendArgument(named_pipe_path.c_str());
+if (log)
+log->Printf("GDBRemoteCommunication::%s() "
+"named pipe creation failed: %s",
+__FUNCTION__, error.AsCString());
+return error;
 }
-else
+debugserver_args.AppendArgument("--named-pipe");
+debugserver_args.AppendArgument(named_pipe_path.c_str());
+#else
+// Binding to port zero, we need to figure out what port it ends up
+// using using an unnamed pipe...
+error = port_pipe.CreateNew(true);
+if (error.Fail())
 {
 if (log)
 log->Printf("GDBRemoteCommunication::%s() "
-"named pipe creation failed: %s",
+"unnamed pipe creation failed: %s",
 __FUNCTION__, error.AsCString());
-// let's try an unnamed pipe
-error = port_pipe.CreateNew(true);
-if (error.Fail())
-{
-if (log)
-log->Printf("GDBRemoteCommunication::%s() "
-"unnamed pipe creation failed: %s",
-__FUNCTION__, error.AsCString());
-return error;
-}
-int write_fd = port_pipe.GetWriteFileDescriptor();
-debugserver_args.AppendArgument("--pipe");
-
debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
-
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+return error;
 }
+int write_fd = port_pipe.GetWriteFileDescriptor();
+debugserver_args.AppendArgument("--pipe");
+debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
+
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+#endif
 }
 else
 {


Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1200,35 +1200,37 @@
 // output of the command into this file. We will later read this file
 // if all goes well and fill the data into "command_output_ptr"
 
+#if defined(__APPLE__)
 // Binding to port zero, we need to figure out what port it ends up
 // using using a named pipe...
 error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", false, named_pipe_path);
-if (error.Success())
+if (error.Fail())
 {
-debugserver_args.AppendArgument("--named-pipe");
-debugserver_args.AppendArgument(named_pipe_path.c_str());
+if (log)
+log->Printf("GDBRemoteCommunication::%s() "
+"named pipe creation failed: %s",
+__FUNCTION__, error.AsCString());
+return error;
 }
-else
+debugserver_args.AppendArgument("--named-pipe");
+debugserver_args.AppendArgument(named_pipe_path.c_str());
+#else
+// Binding to port zero, we need to figure out what port it ends up
+// using using an unnamed pipe...
+error = port_pipe.CreateNew(true);
+if (error.Fail())
  

[Lldb-commits] [PATCH] D11609: Use only unnamed pipes to launch lldb-server gdbserver.

2015-07-29 Thread Chaoren Lin
chaoren created this revision.
chaoren added reviewers: clayborg, vharron, chying.
chaoren added a subscriber: lldb-commits.

If we used unnamed pipes instead of named pipes, we can avoid having the
file system littered with debugserver-named-pipes if lldb-server happens to
crash for whatever reason. Also, on some buggy systems, it's possible to be
able to create but not to delete a fifo. Ideally, support for unnamed pipes
should be added to debugserver as well, so we can avoid the `#ifdef` here.

http://reviews.llvm.org/D11609

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1200,35 +1200,37 @@
 // output of the command into this file. We will later read this 
file
 // if all goes well and fill the data into "command_output_ptr"
 
+#if defined(__APPLE__)
 // Binding to port zero, we need to figure out what port it ends up
 // using using a named pipe...
 error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", 
false, named_pipe_path);
-if (error.Success())
+if (error.Fail())
 {
-debugserver_args.AppendArgument("--named-pipe");
-debugserver_args.AppendArgument(named_pipe_path.c_str());
+if (log)
+log->Printf("GDBRemoteCommunication::%s() "
+"named pipe creation failed: %s",
+__FUNCTION__, error.AsCString());
+return error;
 }
-else
+debugserver_args.AppendArgument("--named-pipe");
+debugserver_args.AppendArgument(named_pipe_path.c_str());
+#else
+// Binding to port zero, we need to figure out what port it ends up
+// using using an unnamed pipe...
+error = port_pipe.CreateNew(true);
+if (error.Fail())
 {
 if (log)
 log->Printf("GDBRemoteCommunication::%s() "
-"named pipe creation failed: %s",
+"unnamed pipe creation failed: %s",
 __FUNCTION__, error.AsCString());
-// let's try an unnamed pipe
-error = port_pipe.CreateNew(true);
-if (error.Fail())
-{
-if (log)
-log->Printf("GDBRemoteCommunication::%s() "
-"unnamed pipe creation failed: %s",
-__FUNCTION__, error.AsCString());
-return error;
-}
-int write_fd = port_pipe.GetWriteFileDescriptor();
-debugserver_args.AppendArgument("--pipe");
-
debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
-
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+return error;
 }
+int write_fd = port_pipe.GetWriteFileDescriptor();
+debugserver_args.AppendArgument("--pipe");
+debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
+
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+#endif
 }
 else
 {


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1200,35 +1200,37 @@
 // output of the command into this file. We will later read this file
 // if all goes well and fill the data into "command_output_ptr"
 
+#if defined(__APPLE__)
 // Binding to port zero, we need to figure out what port it ends up
 // using using a named pipe...
 error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", false, named_pipe_path);
-if (error.Success())
+if (error.Fail())
 {
-debugserver_args.AppendArgument("--named-pipe");
-debugserver_args.AppendArgument(named_pipe_path.c_str());
+if (log)
+log->Printf("GDBRemoteCommunication::%s() "
+"named pipe creation failed: %s",
+__FUNCTION__, error.AsCString());
+return error;
 }
-else
+debugserver_args.AppendArgument("--named-pipe");
+debugserver_args.AppendArgument(named_pipe_path.c_str());
+#else
+// Binding to port zero, we need to figure out what port it ends

Re: [Lldb-commits] [PATCH] D11540: Deprecate `SBValue::TypeIsPointerType`.

2015-07-27 Thread Chaoren Lin
Isn't this autogenerated?

```
// \deprecated { Please use blah instead }
```

Should work right?

On Mon, Jul 27, 2015 at 2:36 PM, Siva Chandra 
wrote:

> sivachandra added a subscriber: sivachandra.
> sivachandra added a comment.
>
> If this change is OK, you should probably update the Python reference as
> well: http://lldb.llvm.org/python_reference/lldb.SBValue-class.html
>
>
> http://reviews.llvm.org/D11540
>
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11540: Deprecate `SBValue::TypeIsPointerType`.

2015-07-27 Thread Chaoren Lin
chaoren added a subscriber: chaoren.
chaoren added a comment.

Isn't this autogenerated?

  // \deprecated { Please use blah instead }

Should work right?


http://reviews.llvm.org/D11540




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


Re: [Lldb-commits] [PATCH] D11539: Only test ObjC expression options on Darwin.

2015-07-27 Thread Chaoren Lin
This revision was automatically updated to reflect the committed changes.
Closed by commit rL243329: Only test ObjC expression options on Darwin. 
(authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11539?vs=30735&id=30736#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11539

Files:
  lldb/trunk/test/expression_command/options/TestExprOptions.py

Index: lldb/trunk/test/expression_command/options/TestExprOptions.py
===
--- lldb/trunk/test/expression_command/options/TestExprOptions.py
+++ lldb/trunk/test/expression_command/options/TestExprOptions.py
@@ -26,9 +26,15 @@
 self.line = line_number('main.cpp', '// breakpoint_in_main')
 self.exe = os.path.join(os.getcwd(), "a.out")
 
-@expectedFailureFreeBSD # ObjC expression broken on FreeBSD?
-@expectedFailureLinux # ObjC expression broken on Linux?
-def test_expr_options(self):
+@skipUnlessDarwin
+def test_expr_options_objc_cpp(self):
+self.expr_options(test_objc = True, test_cpp = True)
+
+@skipIfDarwin # Already covered by test_expr_options_objc_cpp
+def test_expr_options_cpp(self):
+self.expr_options(test_objc = False, test_cpp = True)
+
+def expr_options(self, test_objc, test_cpp):
 """These expression command options should work as expected."""
 self.buildDefault()
 
@@ -53,47 +59,49 @@
 frame = threads[0].GetFrameAtIndex(0)
 options = lldb.SBExpressionOptions()
 
-# -- test --language on ObjC builtin type using the SB API's --
-# Make sure we can evaluate the ObjC builtin type 'id':
-val = frame.EvaluateExpression('id my_id = 0; my_id')
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.assertEqual(val.GetValueAsUnsigned(0), 0)
-self.DebugSBValue(val)
-
-# Make sure it still works if language is set to ObjC:
-options.SetLanguage(lldb.eLanguageTypeObjC)
-val = frame.EvaluateExpression('id my_id = 0; my_id', options)
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.assertEqual(val.GetValueAsUnsigned(0), 0)
-self.DebugSBValue(val)
-
-# Make sure it fails if language is set to C:
-options.SetLanguage(lldb.eLanguageTypeC)
-val = frame.EvaluateExpression('id my_id = 0; my_id', options)
-self.assertTrue(val.IsValid())
-self.assertFalse(val.GetError().Success())
-
-# -- test --language on C++ expression using the SB API's --
-# Make sure we can evaluate 'ns::func'.
-val = frame.EvaluateExpression('ns::func')
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.DebugSBValue(val)
-
-# Make sure it still works if language is set to C++:
-options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
-val = frame.EvaluateExpression('ns::func', options)
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.DebugSBValue(val)
-
-# Make sure it fails if language is set to C:
-options.SetLanguage(lldb.eLanguageTypeC)
-val = frame.EvaluateExpression('ns::func', options)
-self.assertTrue(val.IsValid())
-self.assertFalse(val.GetError().Success())
+if test_objc:
+# -- test --language on ObjC builtin type using the SB API's --
+# Make sure we can evaluate the ObjC builtin type 'id':
+val = frame.EvaluateExpression('id my_id = 0; my_id')
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.assertEqual(val.GetValueAsUnsigned(0), 0)
+self.DebugSBValue(val)
+
+# Make sure it still works if language is set to ObjC:
+options.SetLanguage(lldb.eLanguageTypeObjC)
+val = frame.EvaluateExpression('id my_id = 0; my_id', options)
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.assertEqual(val.GetValueAsUnsigned(0), 0)
+self.DebugSBValue(val)
+
+# Make sure it fails if language is set to C:
+options.SetLanguage(lldb.eLanguageTypeC)
+val = frame.EvaluateExpression('id my_id = 0; my_id', options)
+self.assertTrue(val.IsValid())
+self.assertFalse(val.GetError().Success())
+
+if test_cpp:
+# -- test --language on C++ expression using the SB API's --
+# Make sure we can evaluate 'ns::func'.
+val = frame.EvaluateExpression('ns::func')
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.DebugSBValue(val)
+
+# Make sure it still works if language is set to C++:
+options.SetLanguage(lldb.eLanguageTypeC_plus

[Lldb-commits] [lldb] r243329 - Only test ObjC expression options on Darwin.

2015-07-27 Thread Chaoren Lin
Author: chaoren
Date: Mon Jul 27 16:15:01 2015
New Revision: 243329

URL: http://llvm.org/viewvc/llvm-project?rev=243329&view=rev
Log:
Only test ObjC expression options on Darwin.

Reviewers: dawn, emaste, vharron, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/expression_command/options/TestExprOptions.py

Modified: lldb/trunk/test/expression_command/options/TestExprOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/options/TestExprOptions.py?rev=243329&r1=243328&r2=243329&view=diff
==
--- lldb/trunk/test/expression_command/options/TestExprOptions.py (original)
+++ lldb/trunk/test/expression_command/options/TestExprOptions.py Mon Jul 27 
16:15:01 2015
@@ -26,9 +26,15 @@ class ExprOptionsTestCase(TestBase):
 self.line = line_number('main.cpp', '// breakpoint_in_main')
 self.exe = os.path.join(os.getcwd(), "a.out")
 
-@expectedFailureFreeBSD # ObjC expression broken on FreeBSD?
-@expectedFailureLinux # ObjC expression broken on Linux?
-def test_expr_options(self):
+@skipUnlessDarwin
+def test_expr_options_objc_cpp(self):
+self.expr_options(test_objc = True, test_cpp = True)
+
+@skipIfDarwin # Already covered by test_expr_options_objc_cpp
+def test_expr_options_cpp(self):
+self.expr_options(test_objc = False, test_cpp = True)
+
+def expr_options(self, test_objc, test_cpp):
 """These expression command options should work as expected."""
 self.buildDefault()
 
@@ -53,47 +59,49 @@ class ExprOptionsTestCase(TestBase):
 frame = threads[0].GetFrameAtIndex(0)
 options = lldb.SBExpressionOptions()
 
-# -- test --language on ObjC builtin type using the SB API's --
-# Make sure we can evaluate the ObjC builtin type 'id':
-val = frame.EvaluateExpression('id my_id = 0; my_id')
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.assertEqual(val.GetValueAsUnsigned(0), 0)
-self.DebugSBValue(val)
-
-# Make sure it still works if language is set to ObjC:
-options.SetLanguage(lldb.eLanguageTypeObjC)
-val = frame.EvaluateExpression('id my_id = 0; my_id', options)
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.assertEqual(val.GetValueAsUnsigned(0), 0)
-self.DebugSBValue(val)
-
-# Make sure it fails if language is set to C:
-options.SetLanguage(lldb.eLanguageTypeC)
-val = frame.EvaluateExpression('id my_id = 0; my_id', options)
-self.assertTrue(val.IsValid())
-self.assertFalse(val.GetError().Success())
-
-# -- test --language on C++ expression using the SB API's --
-# Make sure we can evaluate 'ns::func'.
-val = frame.EvaluateExpression('ns::func')
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.DebugSBValue(val)
-
-# Make sure it still works if language is set to C++:
-options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
-val = frame.EvaluateExpression('ns::func', options)
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.DebugSBValue(val)
-
-# Make sure it fails if language is set to C:
-options.SetLanguage(lldb.eLanguageTypeC)
-val = frame.EvaluateExpression('ns::func', options)
-self.assertTrue(val.IsValid())
-self.assertFalse(val.GetError().Success())
+if test_objc:
+# -- test --language on ObjC builtin type using the SB API's --
+# Make sure we can evaluate the ObjC builtin type 'id':
+val = frame.EvaluateExpression('id my_id = 0; my_id')
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.assertEqual(val.GetValueAsUnsigned(0), 0)
+self.DebugSBValue(val)
+
+# Make sure it still works if language is set to ObjC:
+options.SetLanguage(lldb.eLanguageTypeObjC)
+val = frame.EvaluateExpression('id my_id = 0; my_id', options)
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.assertEqual(val.GetValueAsUnsigned(0), 0)
+self.DebugSBValue(val)
+
+# Make sure it fails if language is set to C:
+options.SetLanguage(lldb.eLanguageTypeC)
+val = frame.EvaluateExpression('id my_id = 0; my_id', options)
+self.assertTrue(val.IsValid())
+self.assertFalse(val.GetError().Success())
+
+if test_cpp:
+# -- test --language on C++ expression using the SB API's --
+# Make sure we can evaluate 'ns::func'.
+val = frame.EvaluateExpressio

[Lldb-commits] [PATCH] D11539: Only test ObjC expression options on Darwin.

2015-07-27 Thread Chaoren Lin
chaoren created this revision.
chaoren added reviewers: dawn, clayborg, emaste, vharron.
chaoren added a subscriber: lldb-commits.

http://reviews.llvm.org/D11539

Files:
  test/expression_command/options/TestExprOptions.py

Index: test/expression_command/options/TestExprOptions.py
===
--- test/expression_command/options/TestExprOptions.py
+++ test/expression_command/options/TestExprOptions.py
@@ -26,9 +26,15 @@
 self.line = line_number('main.cpp', '// breakpoint_in_main')
 self.exe = os.path.join(os.getcwd(), "a.out")
 
-@expectedFailureFreeBSD # ObjC expression broken on FreeBSD?
-@expectedFailureLinux # ObjC expression broken on Linux?
-def test_expr_options(self):
+@skipUnlessDarwin
+def test_expr_options_objc_cpp(self):
+self.expr_options(test_objc = True, test_cpp = True)
+
+@skipIfDarwin # Already covered by test_expr_options_objc_cpp
+def test_expr_options_cpp(self):
+self.expr_options(test_objc = False, test_cpp = True)
+
+def expr_options(self, test_objc, test_cpp):
 """These expression command options should work as expected."""
 self.buildDefault()
 
@@ -53,47 +59,49 @@
 frame = threads[0].GetFrameAtIndex(0)
 options = lldb.SBExpressionOptions()
 
-# -- test --language on ObjC builtin type using the SB API's --
-# Make sure we can evaluate the ObjC builtin type 'id':
-val = frame.EvaluateExpression('id my_id = 0; my_id')
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.assertEqual(val.GetValueAsUnsigned(0), 0)
-self.DebugSBValue(val)
-
-# Make sure it still works if language is set to ObjC:
-options.SetLanguage(lldb.eLanguageTypeObjC)
-val = frame.EvaluateExpression('id my_id = 0; my_id', options)
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.assertEqual(val.GetValueAsUnsigned(0), 0)
-self.DebugSBValue(val)
-
-# Make sure it fails if language is set to C:
-options.SetLanguage(lldb.eLanguageTypeC)
-val = frame.EvaluateExpression('id my_id = 0; my_id', options)
-self.assertTrue(val.IsValid())
-self.assertFalse(val.GetError().Success())
-
-# -- test --language on C++ expression using the SB API's --
-# Make sure we can evaluate 'ns::func'.
-val = frame.EvaluateExpression('ns::func')
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.DebugSBValue(val)
-
-# Make sure it still works if language is set to C++:
-options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
-val = frame.EvaluateExpression('ns::func', options)
-self.assertTrue(val.IsValid())
-self.assertTrue(val.GetError().Success())
-self.DebugSBValue(val)
-
-# Make sure it fails if language is set to C:
-options.SetLanguage(lldb.eLanguageTypeC)
-val = frame.EvaluateExpression('ns::func', options)
-self.assertTrue(val.IsValid())
-self.assertFalse(val.GetError().Success())
+if test_objc:
+# -- test --language on ObjC builtin type using the SB API's --
+# Make sure we can evaluate the ObjC builtin type 'id':
+val = frame.EvaluateExpression('id my_id = 0; my_id')
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.assertEqual(val.GetValueAsUnsigned(0), 0)
+self.DebugSBValue(val)
+
+# Make sure it still works if language is set to ObjC:
+options.SetLanguage(lldb.eLanguageTypeObjC)
+val = frame.EvaluateExpression('id my_id = 0; my_id', options)
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.assertEqual(val.GetValueAsUnsigned(0), 0)
+self.DebugSBValue(val)
+
+# Make sure it fails if language is set to C:
+options.SetLanguage(lldb.eLanguageTypeC)
+val = frame.EvaluateExpression('id my_id = 0; my_id', options)
+self.assertTrue(val.IsValid())
+self.assertFalse(val.GetError().Success())
+
+if test_cpp:
+# -- test --language on C++ expression using the SB API's --
+# Make sure we can evaluate 'ns::func'.
+val = frame.EvaluateExpression('ns::func')
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.DebugSBValue(val)
+
+# Make sure it still works if language is set to C++:
+options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
+val = frame.EvaluateExpression('ns::func', options)
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+sel

[Lldb-commits] [PATCH] D11533: Add SBValue::TypeIsReferenceType to SB API.

2015-07-27 Thread Chaoren Lin
chaoren created this revision.
chaoren added a reviewer: clayborg.
chaoren added a subscriber: lldb-commits.

http://reviews.llvm.org/D11533

Files:
  include/lldb/API/SBValue.h
  include/lldb/Core/ValueObject.h
  scripts/interface/SBValue.i
  source/API/SBValue.cpp
  source/Core/ValueObject.cpp
  test/python_api/value/Makefile
  test/python_api/value/TestValueAPI.py
  test/python_api/value/main.c
  test/python_api/value/main.cpp

Index: test/python_api/value/main.cpp
===
--- test/python_api/value/main.cpp
+++ test/python_api/value/main.cpp
@@ -43,10 +43,12 @@
 struct MyStruct s = { 11, 22 };
 int *my_int_ptr = &g_my_int;
 printf("my_int_ptr points to location %p\n", my_int_ptr);
+int &my_int_ref = g_my_int;
+printf("my_int_ref refers to location %p\n", &my_int_ref);
 const char **str_ptr = days_of_week;
 for (i = 0; i < 7; ++i)
 printf("%s\n", str_ptr[i]); // Break at this line
 // and do str_ptr_val.GetChildAtIndex(5, lldb.eNoDynamicValues, True).
-
+
 return 0;
 }
Index: test/python_api/value/TestValueAPI.py
===
--- test/python_api/value/TestValueAPI.py
+++ test/python_api/value/TestValueAPI.py
@@ -36,8 +36,7 @@
 TestBase.setUp(self)
 # We'll use the test method name as the exe_name.
 self.exe_name = self.testMethodName
-# Find the line number to of function 'c'.
-self.line = line_number('main.c', '// Break at this line')
+self.line = line_number('main.cpp', '// Break at this line')
 
 def value_api(self, exe_name):
 """Exercise some SBValue APIs."""
@@ -48,7 +47,7 @@
 self.assertTrue(target, VALID_TARGET)
 
 # Create the breakpoint inside function 'main'.
-breakpoint = target.BreakpointCreateByLocation('main.c', self.line)
+breakpoint = target.BreakpointCreateByLocation('main.cpp', self.line)
 self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
 # Now launch the process, and do not stop at entry point.
@@ -107,6 +106,17 @@
 self.expect(symbol.GetName(), exe=False,
 startstr = 'g_my_int')
 
+# Get variable 'my_int_ref'.
+value = frame0.FindVariable('my_int_ref')
+self.assertTrue(value, VALID_VARIABLE)
+self.DebugSBValue(value)
+
+# SBValue::TypeIsPointerType() should return false.
+self.assertFalse(value.TypeIsPointerType())
+
+# SBValue::TypeIsReferenceType() should return true.
+self.assertTrue(value.TypeIsReferenceType())
+
 # Get variable 'str_ptr'.
 value = frame0.FindVariable('str_ptr')
 self.assertTrue(value, VALID_VARIABLE)
Index: test/python_api/value/Makefile
===
--- test/python_api/value/Makefile
+++ test/python_api/value/Makefile
@@ -1,5 +1,5 @@
 LEVEL = ../../make
 
-C_SOURCES := main.c
+CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -2035,6 +2035,12 @@
 }
 
 bool
+ValueObject::IsReferenceType()
+{
+return GetClangType().IsReferenceType();
+}
+
+bool
 ValueObject::IsArrayType ()
 {
 return GetClangType().IsArrayType (NULL, NULL, NULL);
Index: source/API/SBValue.cpp
===
--- source/API/SBValue.cpp
+++ source/API/SBValue.cpp
@@ -1324,6 +1324,24 @@
 return is_ptr_type;
 }
 
+bool
+SBValue::TypeIsReferenceType()
+{
+bool is_ref_type = false;
+
+ValueLocker locker;
+lldb::ValueObjectSP value_sp(GetSP(locker));
+if (value_sp)
+is_ref_type = value_sp->IsReferenceType();
+
+Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+if (log)
+log->Printf("SBValue(%p)::TypeIsReferenceType() => %i",
+static_cast(value_sp.get()), is_ref_type);
+
+return is_ref_type;
+}
+
 void *
 SBValue::GetOpaqueType()
 {
Index: scripts/interface/SBValue.i
===
--- scripts/interface/SBValue.i
+++ scripts/interface/SBValue.i
@@ -332,7 +332,10 @@
 
 bool
 TypeIsPointerType ();
-
+
+bool
+TypeIsReferenceType();
+
 lldb::SBTarget
 GetTarget();
 
Index: include/lldb/Core/ValueObject.h
===
--- include/lldb/Core/ValueObject.h
+++ include/lldb/Core/ValueObject.h
@@ -412,7 +412,10 @@
 
 virtual bool
 IsPointerType ();
-
+
+virtual bool
+IsReferenceType();
+
 virtual bool
 IsArrayType ();
 
Index: include/lldb/API/SBValue.h
===
--- include/lldb/API/SBValue.h
+++ include/lldb/API

[Lldb-commits] [lldb] r243230 - XFAIL TestExprOptions on Linux.

2015-07-25 Thread Chaoren Lin
Author: chaoren
Date: Sat Jul 25 17:06:48 2015
New Revision: 243230

URL: http://llvm.org/viewvc/llvm-project?rev=243230&view=rev
Log:
XFAIL TestExprOptions on Linux.

Modified:
lldb/trunk/test/expression_command/options/TestExprOptions.py

Modified: lldb/trunk/test/expression_command/options/TestExprOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/options/TestExprOptions.py?rev=243230&r1=243229&r2=243230&view=diff
==
--- lldb/trunk/test/expression_command/options/TestExprOptions.py (original)
+++ lldb/trunk/test/expression_command/options/TestExprOptions.py Sat Jul 25 
17:06:48 2015
@@ -26,6 +26,7 @@ class ExprOptionsTestCase(TestBase):
 self.line = line_number('main.cpp', '// breakpoint_in_main')
 self.exe = os.path.join(os.getcwd(), "a.out")
 
+@expectedFailureLinux # ObjC expression broken on Linux?
 def test_expr_options(self):
 """These expression command options should work as expected."""
 self.buildDefault()


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


[Lldb-commits] [PATCH] D11444: XFAIL TestReturnValue for OS X as well.

2015-07-22 Thread Chaoren Lin
chaoren created this revision.
chaoren added reviewers: clayborg, tberghammer.
chaoren added a subscriber: lldb-commits.

Same reason as r242910; increased test coverage caused new failures.

http://reviews.llvm.org/D11444

Files:
  test/functionalities/return-value/TestReturnValue.py

Index: test/functionalities/return-value/TestReturnValue.py
===
--- test/functionalities/return-value/TestReturnValue.py
+++ test/functionalities/return-value/TestReturnValue.py
@@ -16,15 +16,16 @@
 @expectedFailurei386
 @python_api_test
 @dsym_test
+@expectedFailureAll(compiler="clang", archs=["x86_64"])
 def test_with_dsym_python(self):
 """Test getting return values from stepping out with dsyms."""
 self.buildDsym()
 self.do_return_value()
 
 @expectedFailurei386
 @python_api_test
 @dwarf_test
-@expectedFailureAll(oslist=["linux"], compiler="clang", archs=["x86_64"])
+@expectedFailureAll(oslist=["linux", "macosx"], compiler="clang", 
archs=["x86_64"])
 def test_with_dwarf_python(self):
 """Test getting return values from stepping out."""
 self.buildDwarf()


Index: test/functionalities/return-value/TestReturnValue.py
===
--- test/functionalities/return-value/TestReturnValue.py
+++ test/functionalities/return-value/TestReturnValue.py
@@ -16,15 +16,16 @@
 @expectedFailurei386
 @python_api_test
 @dsym_test
+@expectedFailureAll(compiler="clang", archs=["x86_64"])
 def test_with_dsym_python(self):
 """Test getting return values from stepping out with dsyms."""
 self.buildDsym()
 self.do_return_value()
 
 @expectedFailurei386
 @python_api_test
 @dwarf_test
-@expectedFailureAll(oslist=["linux"], compiler="clang", archs=["x86_64"])
+@expectedFailureAll(oslist=["linux", "macosx"], compiler="clang", archs=["x86_64"])
 def test_with_dwarf_python(self):
 """Test getting return values from stepping out."""
 self.buildDwarf()
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242932 - Xtimeout TestProcessAttach for Linux.

2015-07-22 Thread Chaoren Lin
Author: chaoren
Date: Wed Jul 22 15:52:17 2015
New Revision: 242932

URL: http://llvm.org/viewvc/llvm-project?rev=242932&view=rev
Log:
Xtimeout TestProcessAttach for Linux.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=242932&r1=242931&r2=242932&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Wed Jul 22 15:52:17 2015
@@ -244,6 +244,7 @@ def getExpectedTimeouts(platform_name):
 expected_timeout |= {
 "TestAttachDenied.py",
 "TestAttachResume.py",
+"TestProcessAttach.py",
 "TestConnectRemote.py",
 "TestCreateAfterAttach.py",
 "TestEvents.py",


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


[Lldb-commits] [lldb] r242814 - Re-enable static Android build after build master restart.

2015-07-21 Thread Chaoren Lin
Author: chaoren
Date: Tue Jul 21 12:50:49 2015
New Revision: 242814

URL: http://llvm.org/viewvc/llvm-project?rev=242814&view=rev
Log:
Re-enable static Android build after build master restart.

Modified:
lldb/trunk/cmake/platforms/Android.cmake

Modified: lldb/trunk/cmake/platforms/Android.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=242814&r1=242813&r2=242814&view=diff
==
--- lldb/trunk/cmake/platforms/Android.cmake (original)
+++ lldb/trunk/cmake/platforms/Android.cmake Tue Jul 21 12:50:49 2015
@@ -43,9 +43,9 @@ set( __ANDROID_NDK__ True )
 # a non-pie shim on API 16-, but that requires lldb-server to dynamically 
export
 # its symbols, which significantly increases the binary size. Static linking, 
on
 # the other hand, has little to no effect on the binary size.
-#if( NOT DEFINED LLVM_BUILD_STATIC )
-# set( LLVM_BUILD_STATIC True )
-#endif()
+if( NOT DEFINED LLVM_BUILD_STATIC )
+ set( LLVM_BUILD_STATIC True )
+endif()
 
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE INTERNAL "Android Abi" FORCE )
 if( ANDROID_ABI STREQUAL "x86" )


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


[Lldb-commits] [lldb] r242815 - Xfail TestGdbRemoteAbort for Android API <= 16.

2015-07-21 Thread Chaoren Lin
Author: chaoren
Date: Tue Jul 21 12:50:52 2015
New Revision: 242815

URL: http://llvm.org/viewvc/llvm-project?rev=242815&view=rev
Log:
Xfail TestGdbRemoteAbort for Android API <= 16.

Reviewers: sivachandra

Subscribers: tberghammer, danalbert, srhines, lldb-commits

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

Modified:
lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py?rev=242815&r1=242814&r2=242815&view=diff
==
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py 
(original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py Tue 
Jul 21 12:50:52 2015
@@ -33,7 +33,8 @@ class TestGdbRemoteAbort(gdbremote_testc
 
 @llgs_test
 @dwarf_test
-@skipIfTargetAndroid(api_levels=[16]) # abort() on API 16 raises SIGSEGV!
+# std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
+@expectedFailureAndroid(api_levels=range(16 + 1))
 def test_inferior_abort_received_llgs_dwarf(self):
 self.init_llgs_test()
 self.buildDwarf()


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


Re: [Lldb-commits] [PATCH] D11367: Update TestLoadUnload to use base Makefile.

2015-07-21 Thread Chaoren Lin
This revision was automatically updated to reflect the committed changes.
Closed by commit rL242813: Update TestLoadUnload to use base Makefile. 
(authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11367?vs=30271&id=30272#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11367

Files:
  lldb/trunk/test/functionalities/load_unload/Makefile
  lldb/trunk/test/functionalities/load_unload/a.mk
  lldb/trunk/test/functionalities/load_unload/b.mk
  lldb/trunk/test/functionalities/load_unload/c.mk
  lldb/trunk/test/functionalities/load_unload/d.c
  lldb/trunk/test/functionalities/load_unload/d.mk
  lldb/trunk/test/functionalities/load_unload/hidden/.keep
  lldb/trunk/test/functionalities/load_unload/hidden/Makefile
  lldb/trunk/test/functionalities/load_unload/hidden/d.c
  lldb/trunk/test/make/Makefile.rules

Index: lldb/trunk/test/make/Makefile.rules
===
--- lldb/trunk/test/make/Makefile.rules
+++ lldb/trunk/test/make/Makefile.rules
@@ -200,6 +200,7 @@
 ifneq "$(DYLIB_NAME)" ""
 	ifeq "$(OS)" "Darwin"
 		DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
+		DYLIB_EXECUTABLE_PATH ?= @executable_path
 	else ifeq "$(OS)" "Windows_NT"
 		DYLIB_FILENAME = $(DYLIB_NAME).dll
 	else
@@ -452,7 +453,7 @@
 
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"
-	$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
+	$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_EXECUTABLE_PATH)/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
 ifneq "$(MAKE_DSYM)" "NO"
 ifneq "$(DS)" ""
 	"$(DS)" $(DSFLAGS) "$(DYLIB_FILENAME)"
Index: lldb/trunk/test/functionalities/load_unload/Makefile
===
--- lldb/trunk/test/functionalities/load_unload/Makefile
+++ lldb/trunk/test/functionalities/load_unload/Makefile
@@ -1,84 +1,24 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
-	ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
-	OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := libloadunload_
-
-ifeq "$(OS)" "Darwin"
-	CFLAGS += -arch $(ARCH)
-	DS := dsymutil
-	LD_FLAGS := -dynamiclib
-	LIB_A := $(LIB_PREFIX)a.dylib
-	LIB_B := $(LIB_PREFIX)b.dylib
-	LIB_C := $(LIB_PREFIX)c.dylib
-	LIB_D := $(LIB_PREFIX)d.dylib
-	EXEC_PATH := "@executable_path"
-	EXEC_PATH_A := -install_name $(EXEC_PATH)/$(LIB_A)
-	EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
-	EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
-	EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
-
-	DS_IF_DARWIN = $(DS) -o $@.dSYM $@
-else
-	CFLAGS += -fPIC
-	LD_FLAGS := -shared
-	LIB_DL := -ldl
-	LIB_A := $(LIB_PREFIX)a.so
-	LIB_B := $(LIB_PREFIX)b.so
-	LIB_C := $(LIB_PREFIX)c.so
-	LIB_D := $(LIB_PREFIX)d.so
-endif
-
-all: a.out $(LIB_A) $(LIB_B) $(LIB_C) $(LIB_D) hidden/$(LIB_D)
-
-a.out: main.o $(LIB_D)
-	$(CC) $(CFLAGS) -o a.out main.o -L. -pie -lloadunload_d $(LIB_DL)
-
-main.o: main.c
-	$(CC) $(CFLAGS) -c main.c
-
-hidden/$(LIB_D): dh.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-	$(DS_IF_DARWIN)
-
-$(LIB_A): a.o $(LIB_B)
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. -lloadunload_b
-	$(DS_IF_DARWIN)
-
-a.o: a.c
-	$(CC) $(CFLAGS) -c a.c
-
-$(LIB_B): b.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-	$(DS_IF_DARWIN)
-
-b.o: b.c
-	$(CC) $(CFLAGS) -c b.c
-
-$(LIB_C): c.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-	$(DS_IF_DARWIN)
-
-c.o: c.c
-	$(CC) $(CFLAGS) -c c.c
-
-$(LIB_D): d.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-	$(DS_IF_DARWIN)
+LEVEL := ../../make
 
-d.o: d.c
-	$(CC) $(CFLAGS) -c d.c
+LIB_PREFIX := loadunload_
 
-dh.o: d.c
-	$(CC) $(CFLAGS) -DHIDDEN -c d.c -o dh.o
+LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl
+C_SOURCES := main.c
 
-clean:
-	rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM hidden/*)
+include $(LEVEL)/Makefile.rules
+
+.PHONY:
+a.out: lib_a lib_b lib_c lib_d hidden_lib_d
+
+lib_%:
+	$(MAKE) -f $*.mk
+
+hidden_lib_d:
+	$(MAKE) -C hidden
+
+clean::
+	$(MAKE) -f a.mk clean
+	$(MAKE) -f b.mk clean
+	$(MAKE) -f c.mk clean
+	$(MAKE) -f d.mk clean
+	$(MAKE) -C hidden clean
Index: lldb/trunk/test/functionalities/load_unload/hidden/d.c
===
--- lldb/trunk/test/functionalities/load_unload/hidden/d.c
+++ lldb/trunk/test/functionalities/load_unload/hidden/d.c
@@ -0,0 +1,13 @@
+//===-- c.c -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+int
+d_function ()
+{ // Find this line number within d_dunction().
+return 12345;
+}
Index: lldb/trunk/test/functionalities/load_unload/hidden/Makefile
==

[Lldb-commits] [lldb] r242813 - Update TestLoadUnload to use base Makefile.

2015-07-21 Thread Chaoren Lin
Author: chaoren
Date: Tue Jul 21 12:50:16 2015
New Revision: 242813

URL: http://llvm.org/viewvc/llvm-project?rev=242813&view=rev
Log:
Update TestLoadUnload to use base Makefile.

Summary:
The current Makefile scheme only allows one dylib to be specified in each make
invocation, so TestLoadUnload had a custom Makefile that's unrelated to the
base Makefile.rules. This change uses recursive make invocations to bypass the
single dylib restriction. See D11202 for more context.

Reviewers: clayborg

Subscribers: chaoren, lldb-commits

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

Added:
lldb/trunk/test/functionalities/load_unload/a.mk
lldb/trunk/test/functionalities/load_unload/b.mk
lldb/trunk/test/functionalities/load_unload/c.mk
lldb/trunk/test/functionalities/load_unload/d.mk
lldb/trunk/test/functionalities/load_unload/hidden/Makefile
lldb/trunk/test/functionalities/load_unload/hidden/d.c
  - copied, changed from r242783, 
lldb/trunk/test/functionalities/load_unload/d.c
Removed:
lldb/trunk/test/functionalities/load_unload/hidden/.keep
Modified:
lldb/trunk/test/functionalities/load_unload/Makefile
lldb/trunk/test/functionalities/load_unload/d.c
lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/functionalities/load_unload/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/Makefile?rev=242813&r1=242812&r2=242813&view=diff
==
--- lldb/trunk/test/functionalities/load_unload/Makefile (original)
+++ lldb/trunk/test/functionalities/load_unload/Makefile Tue Jul 21 12:50:16 
2015
@@ -1,84 +1,24 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
-   ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
-   OS = $(shell uname -s)
-endif
-
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
-
-LIB_PREFIX := libloadunload_
-
-ifeq "$(OS)" "Darwin"
-   CFLAGS += -arch $(ARCH)
-   DS := dsymutil
-   LD_FLAGS := -dynamiclib
-   LIB_A := $(LIB_PREFIX)a.dylib
-   LIB_B := $(LIB_PREFIX)b.dylib
-   LIB_C := $(LIB_PREFIX)c.dylib
-   LIB_D := $(LIB_PREFIX)d.dylib
-   EXEC_PATH := "@executable_path"
-   EXEC_PATH_A := -install_name $(EXEC_PATH)/$(LIB_A)
-   EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
-   EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
-   EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
-
-   DS_IF_DARWIN = $(DS) -o $@.dSYM $@
-else
-   CFLAGS += -fPIC
-   LD_FLAGS := -shared
-   LIB_DL := -ldl
-   LIB_A := $(LIB_PREFIX)a.so
-   LIB_B := $(LIB_PREFIX)b.so
-   LIB_C := $(LIB_PREFIX)c.so
-   LIB_D := $(LIB_PREFIX)d.so
-endif
-
-all: a.out $(LIB_A) $(LIB_B) $(LIB_C) $(LIB_D) hidden/$(LIB_D)
-
-a.out: main.o $(LIB_D)
-   $(CC) $(CFLAGS) -o a.out main.o -L. -pie -lloadunload_d $(LIB_DL)
-
-main.o: main.c
-   $(CC) $(CFLAGS) -c main.c
-
-hidden/$(LIB_D): dh.o
-   $(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-   $(DS_IF_DARWIN)
-
-$(LIB_A): a.o $(LIB_B)
-   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. 
-lloadunload_b
-   $(DS_IF_DARWIN)
-
-a.o: a.c
-   $(CC) $(CFLAGS) -c a.c
-
-$(LIB_B): b.o
-   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-   $(DS_IF_DARWIN)
-
-b.o: b.c
-   $(CC) $(CFLAGS) -c b.c
-
-$(LIB_C): c.o
-   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-   $(DS_IF_DARWIN)
-
-c.o: c.c
-   $(CC) $(CFLAGS) -c c.c
-
-$(LIB_D): d.o
-   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-   $(DS_IF_DARWIN)
+LEVEL := ../../make
 
-d.o: d.c
-   $(CC) $(CFLAGS) -c d.c
+LIB_PREFIX := loadunload_
 
-dh.o: d.c
-   $(CC) $(CFLAGS) -DHIDDEN -c d.c -o dh.o
+LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl
+C_SOURCES := main.c
 
-clean:
-   rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM hidden/*)
+include $(LEVEL)/Makefile.rules
+
+.PHONY:
+a.out: lib_a lib_b lib_c lib_d hidden_lib_d
+
+lib_%:
+   $(MAKE) -f $*.mk
+
+hidden_lib_d:
+   $(MAKE) -C hidden
+
+clean::
+   $(MAKE) -f a.mk clean
+   $(MAKE) -f b.mk clean
+   $(MAKE) -f c.mk clean
+   $(MAKE) -f d.mk clean
+   $(MAKE) -C hidden clean

Added: lldb/trunk/test/functionalities/load_unload/a.mk
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/a.mk?rev=242813&view=auto
==
--- lldb/trunk/test/functionalities/load_unload/a.mk (added)
+++ lldb/trunk/test/functionalities/load_unload/a.mk Tue Jul 21 12:50:16 2015
@@ -0,0 +1,21 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+CFLAGS_EXTRAS := -fPIC
+LD_EXTRAS := -L. -l$(LIB_PREFIX)b
+
+DYLIB_NAME := $(LIB_PREFIX)a
+DYLIB_C_SOURCES := a.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
+
+.PHONY:
+$(DYLIB_FILENAME): lib_b
+
+lib_b:
+   $(MAKE) -f b.mk
+
+clean::
+   $(MAKE) -f b.mk clean

Added: lldb/trunk/test/func

Re: [Lldb-commits] [PATCH] D11378: Xfail TestGdbRemoteAbort for Android API <= 16.

2015-07-21 Thread Chaoren Lin
chaoren updated this revision to Diff 30269.
chaoren added a comment.

Address review.


http://reviews.llvm.org/D11378

Files:
  test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py

Index: test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
===
--- test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
+++ test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
@@ -33,7 +33,8 @@
 
 @llgs_test
 @dwarf_test
-@skipIfTargetAndroid(api_levels=[16]) # abort() on API 16 raises SIGSEGV!
+# std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
+@expectedFailureAndroid(api_levels=range(16 + 1))
 def test_inferior_abort_received_llgs_dwarf(self):
 self.init_llgs_test()
 self.buildDwarf()


Index: test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
===
--- test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
+++ test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
@@ -33,7 +33,8 @@
 
 @llgs_test
 @dwarf_test
-@skipIfTargetAndroid(api_levels=[16]) # abort() on API 16 raises SIGSEGV!
+# std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
+@expectedFailureAndroid(api_levels=range(16 + 1))
 def test_inferior_abort_received_llgs_dwarf(self):
 self.init_llgs_test()
 self.buildDwarf()
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11367: Update TestLoadUnload to use base Makefile.

2015-07-20 Thread Chaoren Lin
chaoren updated this revision to Diff 30211.
chaoren added a comment.

- Split Makefile to isolate each dylib.


http://reviews.llvm.org/D11367

Files:
  test/functionalities/load_unload/Makefile
  test/functionalities/load_unload/a.mk
  test/functionalities/load_unload/b.mk
  test/functionalities/load_unload/c.mk
  test/functionalities/load_unload/d.mk
  test/functionalities/load_unload/hidden/.keep
  test/functionalities/load_unload/hidden/Makefile

Index: test/functionalities/load_unload/hidden/Makefile
===
--- /dev/null
+++ test/functionalities/load_unload/hidden/Makefile
@@ -0,0 +1,11 @@
+LEVEL := ../../../make
+
+LIB_PREFIX := loadunload_
+
+CFLAGS_EXTRAS := -DHIDDEN
+
+DYLIB_NAME := $(LIB_PREFIX)d
+DYLIB_C_SOURCES := ../d.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Index: test/functionalities/load_unload/d.mk
===
--- /dev/null
+++ test/functionalities/load_unload/d.mk
@@ -0,0 +1,9 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_NAME := $(LIB_PREFIX)d
+DYLIB_C_SOURCES := d.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Index: test/functionalities/load_unload/c.mk
===
--- /dev/null
+++ test/functionalities/load_unload/c.mk
@@ -0,0 +1,9 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_NAME := $(LIB_PREFIX)c
+DYLIB_C_SOURCES := c.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Index: test/functionalities/load_unload/b.mk
===
--- /dev/null
+++ test/functionalities/load_unload/b.mk
@@ -0,0 +1,9 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+DYLIB_NAME := $(LIB_PREFIX)b
+DYLIB_C_SOURCES := b.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Index: test/functionalities/load_unload/a.mk
===
--- /dev/null
+++ test/functionalities/load_unload/a.mk
@@ -0,0 +1,21 @@
+LEVEL := ../../make
+
+LIB_PREFIX := loadunload_
+
+CFLAGS_EXTRAS := -fPIC
+LD_EXTRAS := -L. -l$(LIB_PREFIX)b
+
+DYLIB_NAME := $(LIB_PREFIX)a
+DYLIB_C_SOURCES := a.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
+
+.PHONY:
+$(DYLIB_FILENAME): lib_b
+
+lib_b:
+	$(MAKE) -f b.mk
+
+clean::
+	$(MAKE) -f b.mk clean
Index: test/functionalities/load_unload/Makefile
===
--- test/functionalities/load_unload/Makefile
+++ test/functionalities/load_unload/Makefile
@@ -1,84 +1,24 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
-	ARCH = x86_64
-endif
+LEVEL := ../../make
 
-ifeq "$(OS)" ""
-	OS = $(shell uname -s)
-endif
+LIB_PREFIX := loadunload_
 
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
+LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl
+C_SOURCES := main.c
 
-LIB_PREFIX := libloadunload_
+include $(LEVEL)/Makefile.rules
 
-ifeq "$(OS)" "Darwin"
-	CFLAGS += -arch $(ARCH)
-	DS := dsymutil
-	LD_FLAGS := -dynamiclib
-	LIB_A := $(LIB_PREFIX)a.dylib
-	LIB_B := $(LIB_PREFIX)b.dylib
-	LIB_C := $(LIB_PREFIX)c.dylib
-	LIB_D := $(LIB_PREFIX)d.dylib
-	EXEC_PATH := "@executable_path"
-	EXEC_PATH_A := -install_name $(EXEC_PATH)/$(LIB_A)
-	EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
-	EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
-	EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
+.PHONY:
+a.out: lib_a lib_b lib_c lib_d hidden_lib_d
 
-	DS_IF_DARWIN = $(DS) -o $@.dSYM $@
-else
-	CFLAGS += -fPIC
-	LD_FLAGS := -shared
-	LIB_DL := -ldl
-	LIB_A := $(LIB_PREFIX)a.so
-	LIB_B := $(LIB_PREFIX)b.so
-	LIB_C := $(LIB_PREFIX)c.so
-	LIB_D := $(LIB_PREFIX)d.so
-endif
+lib_%:
+	$(MAKE) -f $*.mk
 
-all: a.out $(LIB_A) $(LIB_B) $(LIB_C) $(LIB_D) hidden/$(LIB_D)
+hidden_lib_d:
+	$(MAKE) -C hidden
 
-a.out: main.o $(LIB_D)
-	$(CC) $(CFLAGS) -o a.out main.o -L. -pie -lloadunload_d $(LIB_DL)
-
-main.o: main.c
-	$(CC) $(CFLAGS) -c main.c
-
-hidden/$(LIB_D): dh.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-	$(DS_IF_DARWIN)
-
-$(LIB_A): a.o $(LIB_B)
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. -lloadunload_b
-	$(DS_IF_DARWIN)
-
-a.o: a.c
-	$(CC) $(CFLAGS) -c a.c
-
-$(LIB_B): b.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-	$(DS_IF_DARWIN)
-
-b.o: b.c
-	$(CC) $(CFLAGS) -c b.c
-
-$(LIB_C): c.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-	$(DS_IF_DARWIN)
-
-c.o: c.c
-	$(CC) $(CFLAGS) -c c.c
-
-$(LIB_D): d.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-	$(DS_IF_DARWIN)
-
-d.o: d.c
-	$(CC) $(CFLAGS) -c d.c
-
-dh.o: d.c
-	$(CC) $(CFLAGS) -DHIDDEN -c d.c -o dh.o
-
-clean:
-	rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM hidden/*)
+clean::
+	$(MAKE) -f a.mk clean
+	$(MAKE) -f b.mk clean
+	$(MAKE) -f c.mk clean
+	$(MAKE) -f d.mk clean
+	$(MAKE) -C hidden clean
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/m

[Lldb-commits] [PATCH] D11367: Update TestLoadUnload to use base Makefile.

2015-07-20 Thread Chaoren Lin
chaoren created this revision.
chaoren added a reviewer: clayborg.
chaoren added a subscriber: lldb-commits.

The current Makefile scheme only allows one dylib to be specified in each make
invocation, so TestLoadUnload had a custom Makefile that's unrelated to the
base Makefile.rules. This change uses recursive make invocations to bypass the
single dylib restriction. See D11202 for more context.

http://reviews.llvm.org/D11367

Files:
  test/functionalities/load_unload/Makefile
  test/functionalities/load_unload/hidden/.keep
  test/functionalities/load_unload/hidden/Makefile

Index: test/functionalities/load_unload/hidden/Makefile
===
--- /dev/null
+++ test/functionalities/load_unload/hidden/Makefile
@@ -0,0 +1,8 @@
+LEVEL := ../../../make
+
+CFLAGS_EXTRAS := -DHIDDEN
+DYLIB_NAME := loadunload_d
+DYLIB_C_SOURCES := ../d.c
+DYLIB_ONLY := YES
+
+include $(LEVEL)/Makefile.rules
Index: test/functionalities/load_unload/Makefile
===
--- test/functionalities/load_unload/Makefile
+++ test/functionalities/load_unload/Makefile
@@ -1,84 +1,46 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
-	ARCH = x86_64
+LEVEL := ../../make
+
+.PHONY: a b c d dh
+ifeq "$(MAKECMDGOALS)" ""
+all: a.out a b c d dh
+a.out a b c d:
+	$(MAKE) $@
+dh:
+	$(MAKE) -C hidden
 endif
 
-ifeq "$(OS)" ""
-	OS = $(shell uname -s)
+LIB_PREFIX := loadunload_
+
+ifeq "$(MAKECMDGOALS)" "a.out"
+a.out: d
+d:
+	$(MAKE) $@
+LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl
+C_SOURCES := main.c
+endif # a.out
+
+ifeq "$(MAKECMDGOALS)" "a"
+a: b
+b:
+	$(MAKE) $@
+CFLAGS_EXTRAS := -fPIC
+LD_EXTRAS := -L. -l$(LIB_PREFIX)b
+endif # a
+
+ifneq "$(filter a b c d,$(MAKECMDGOALS))" ""
+DYLIB_NAME := $(LIB_PREFIX)$(MAKECMDGOALS)
+DYLIB_C_SOURCES := $(MAKECMDGOALS).c
+DYLIB_ONLY := YES
+endif # a b c d
+
+ifneq "$(MAKECMDGOALS)" ""
+include $(LEVEL)/Makefile.rules
 endif
 
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
+ifneq "$(filter a b c d,$(MAKECMDGOALS))" ""
+$(MAKECMDGOALS): $(DYLIB_FILENAME)
+endif # a b c d
 
-LIB_PREFIX := libloadunload_
-
-ifeq "$(OS)" "Darwin"
-	CFLAGS += -arch $(ARCH)
-	DS := dsymutil
-	LD_FLAGS := -dynamiclib
-	LIB_A := $(LIB_PREFIX)a.dylib
-	LIB_B := $(LIB_PREFIX)b.dylib
-	LIB_C := $(LIB_PREFIX)c.dylib
-	LIB_D := $(LIB_PREFIX)d.dylib
-	EXEC_PATH := "@executable_path"
-	EXEC_PATH_A := -install_name $(EXEC_PATH)/$(LIB_A)
-	EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
-	EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
-	EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
-
-	DS_IF_DARWIN = $(DS) -o $@.dSYM $@
-else
-	CFLAGS += -fPIC
-	LD_FLAGS := -shared
-	LIB_DL := -ldl
-	LIB_A := $(LIB_PREFIX)a.so
-	LIB_B := $(LIB_PREFIX)b.so
-	LIB_C := $(LIB_PREFIX)c.so
-	LIB_D := $(LIB_PREFIX)d.so
-endif
-
-all: a.out $(LIB_A) $(LIB_B) $(LIB_C) $(LIB_D) hidden/$(LIB_D)
-
-a.out: main.o $(LIB_D)
-	$(CC) $(CFLAGS) -o a.out main.o -L. -pie -lloadunload_d $(LIB_DL)
-
-main.o: main.c
-	$(CC) $(CFLAGS) -c main.c
-
-hidden/$(LIB_D): dh.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-	$(DS_IF_DARWIN)
-
-$(LIB_A): a.o $(LIB_B)
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. -lloadunload_b
-	$(DS_IF_DARWIN)
-
-a.o: a.c
-	$(CC) $(CFLAGS) -c a.c
-
-$(LIB_B): b.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-	$(DS_IF_DARWIN)
-
-b.o: b.c
-	$(CC) $(CFLAGS) -c b.c
-
-$(LIB_C): c.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-	$(DS_IF_DARWIN)
-
-c.o: c.c
-	$(CC) $(CFLAGS) -c c.c
-
-$(LIB_D): d.o
-	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-	$(DS_IF_DARWIN)
-
-d.o: d.c
-	$(CC) $(CFLAGS) -c d.c
-
-dh.o: d.c
-	$(CC) $(CFLAGS) -DHIDDEN -c d.c -o dh.o
-
-clean:
-	rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM hidden/*)
+clean::
+	rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)
+	$(MAKE) -C hidden clean
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11357: Resolve DW_AT_comp_dir path if it contains a symlink

2015-07-20 Thread Chaoren Lin
chaoren accepted this revision.
chaoren added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D11357




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


[Lldb-commits] [lldb] r242599 - Add evil hack to workaround the missing libdl.a in the Android toolchain.

2015-07-17 Thread Chaoren Lin
Author: chaoren
Date: Fri Jul 17 20:09:43 2015
New Revision: 242599

URL: http://llvm.org/viewvc/llvm-project?rev=242599&view=rev
Log:
Add evil hack to workaround the missing libdl.a in the Android toolchain.

Reviewers: vharron, ovyalov

Subscribers: tberghammer, danalbert, srhines, lldb-commits

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

Modified:
lldb/trunk/cmake/platforms/Android.cmake

Modified: lldb/trunk/cmake/platforms/Android.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=242599&r1=242598&r2=242599&view=diff
==
--- lldb/trunk/cmake/platforms/Android.cmake (original)
+++ lldb/trunk/cmake/platforms/Android.cmake Fri Jul 17 20:09:43 2015
@@ -119,6 +119,25 @@ endif()
 set( ANDROID_CXX_FLAGS"${ANDROID_CXX_FLAGS} -fdata-sections 
-ffunction-sections" )
 set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
 
+# BEGIN EVIL HACK ##
+# lldb-server links against libdl even though it's not being used and
+# libdl.a is currently missing from the toolchain (b.android.com/178517).
+# Therefore, in order to statically link lldb-server, we need a temporary
+# workaround. This creates a dummy libdl.a stub until the actual
+# libdl.a can be implemented in the toolchain.
+set( ANDROID_LIBDL_STUB "${CMAKE_BINARY_DIR}/libdl_stub" )
+file( MAKE_DIRECTORY ${ANDROID_LIBDL_STUB} )
+file( WRITE "${ANDROID_LIBDL_STUB}/libdl.c" "
+#include 
+void *   dlopen  (const char *filename, int flag)   { return 0; }
+const char * dlerror (void) { return 0; }
+void *   dlsym   (void *handle, const char *symbol) { return 0; }
+int  dlclose (void *handle) { return 0; }")
+execute_process( COMMAND ${CMAKE_C_COMPILER} -c ${ANDROID_LIBDL_STUB}/libdl.c 
-o ${ANDROID_LIBDL_STUB}/libdl.o )
+execute_process( COMMAND ${CMAKE_AR} rcs ${ANDROID_LIBDL_STUB}/libdl.a 
${ANDROID_LIBDL_STUB}/libdl.o )
+set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -L${ANDROID_LIBDL_STUB}" )
+# END EVIL HACK ##
+
 # cache flags
 set( CMAKE_CXX_FLAGS   ""CACHE STRING "c++ 
flags" )
 set( CMAKE_C_FLAGS ""CACHE STRING "c 
flags" )


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


[Lldb-commits] [lldb] r242598 - Apply Android -pie switch to buildDefault as well.

2015-07-17 Thread Chaoren Lin
Author: chaoren
Date: Fri Jul 17 19:37:55 2015
New Revision: 242598

URL: http://llvm.org/viewvc/llvm-project?rev=242598&view=rev
Log:
Apply Android -pie switch to buildDefault as well.

Reviewers: ovyalov

Subscribers: tberghammer, danalbert, srhines, lldb-commits

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

Modified:
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=242598&r1=242597&r2=242598&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Jul 17 19:37:55 2015
@@ -431,6 +431,14 @@ def run_adb_command(cmd, device_id):
 stdout, stderr = p.communicate()
 return p.returncode, stdout, stderr
 
+def append_android_envs(dictionary):
+if dictionary is None:
+dictionary = {}
+dictionary["OS"] = "Android"
+if android_device_api() >= 16:
+dictionary["PIE"] = 1
+return dictionary
+
 def target_is_android():
 if not hasattr(target_is_android, 'result'):
 triple = lldb.DBG.GetSelectedPlatform().GetTriple()
@@ -1974,6 +1982,8 @@ class Base(unittest2.TestCase):
 if lldb.skip_build_and_cleanup:
 return
 module = builder_module()
+if target_is_android():
+dictionary = append_android_envs(dictionary)
 if not module.buildDefault(self, architecture, compiler, dictionary, 
clean):
 raise Exception("Don't know how to build default binary")
 
@@ -1991,11 +2001,7 @@ class Base(unittest2.TestCase):
 return
 module = builder_module()
 if target_is_android():
-if dictionary is None:
-dictionary = {}
-dictionary["OS"] = "Android"
-if android_device_api() >= 16:
-dictionary["PIE"] = 1
+dictionary = append_android_envs(dictionary)
 if not module.buildDwarf(self, architecture, compiler, dictionary, 
clean):
 raise Exception("Don't know how to build binary with dwarf")
 


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


[Lldb-commits] [lldb] r242580 - Detect if necessary to build inferior with -pie for Android.

2015-07-17 Thread Chaoren Lin
Author: chaoren
Date: Fri Jul 17 17:13:29 2015
New Revision: 242580

URL: http://llvm.org/viewvc/llvm-project?rev=242580&view=rev
Log:
Detect if necessary to build inferior with -pie for Android.

Summary:
- Add target_is_android check (with cached results).
- Make android_device_api also cache results.
- Also removes the need to pass --env OS=Android when testing against Android.

Reviewers: sivachandra, tberghammer, clayborg, danalbert

Subscribers: chaoren, tberghammer, danalbert, srhines, lldb-commits

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

Modified:
lldb/trunk/cmake/platforms/Android.cmake
lldb/trunk/test/lldbtest.py
lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/cmake/platforms/Android.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=242580&r1=242579&r2=242580&view=diff
==
--- lldb/trunk/cmake/platforms/Android.cmake (original)
+++ lldb/trunk/cmake/platforms/Android.cmake Fri Jul 17 17:13:29 2015
@@ -39,8 +39,8 @@ set( ANDROID True )
 set( __ANDROID_NDK__ True )
 
 # linking lldb-server statically for Android avoids the need to ship two
-# binaries (pie for API 21+ and non-pie for API 14-). It's possible to use
-# a non-pie shim on API 14-, but that requires lldb-server to dynamically 
export
+# binaries (pie for API 21+ and non-pie for API 16-). It's possible to use
+# a non-pie shim on API 16-, but that requires lldb-server to dynamically 
export
 # its symbols, which significantly increases the binary size. Static linking, 
on
 # the other hand, has little to no effect on the binary size.
 if ( NOT DEFINED LLVM_BUILD_STATIC )
@@ -110,8 +110,8 @@ endif()
 
 if ( NOT LLVM_BUILD_STATIC )
  # PIE is required for API 21+ so we enable it if we're not statically linking
- # unfortunately, it is not supported before API 14 so we need to do something 
else there
- # see http://llvm.org/pr23457
+ # unfortunately, it is not supported before API 16 so we need to do something
+ # else there see http://llvm.org/pr23457
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
 endif()
 

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=242580&r1=242579&r2=242580&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Jul 17 17:13:29 2015
@@ -431,21 +431,30 @@ def run_adb_command(cmd, device_id):
 stdout, stderr = p.communicate()
 return p.returncode, stdout, stderr
 
+def target_is_android():
+if not hasattr(target_is_android, 'result'):
+triple = lldb.DBG.GetSelectedPlatform().GetTriple()
+match = re.match(".*-.*-.*-android", triple)
+target_is_android.result = match is not None
+return target_is_android.result
+
 def android_device_api():
-assert lldb.platform_url is not None
-device_id = None
-parsed_url = urlparse.urlparse(lldb.platform_url)
-if parsed_url.scheme == "adb":
-device_id = parsed_url.netloc.split(":")[0]
-retcode, stdout, stderr = run_adb_command(
-["shell", "getprop", "ro.build.version.sdk"], device_id)
-if retcode == 0:
-return int(stdout)
-else:
-raise LookupError(
-">>> Unable to determine the API level of the Android device.\n"
-">>> stdout:\n%s\n"
-">>> stderr:\n%s\n" % (stdout, stderr))
+if not hasattr(android_device_api, 'result'):
+assert lldb.platform_url is not None
+device_id = None
+parsed_url = urlparse.urlparse(lldb.platform_url)
+if parsed_url.scheme == "adb":
+device_id = parsed_url.netloc.split(":")[0]
+retcode, stdout, stderr = run_adb_command(
+["shell", "getprop", "ro.build.version.sdk"], device_id)
+if retcode == 0:
+android_device_api.result = int(stdout)
+else:
+raise LookupError(
+">>> Unable to determine the API level of the Android 
device.\n"
+">>> stdout:\n%s\n"
+">>> stderr:\n%s\n" % (stdout, stderr))
+return android_device_api.result
 
 #
 # Decorators for categorizing test cases.
@@ -690,9 +699,7 @@ def expectedFailureAndroid(bugnumber=Non
 for which a test is expected to fail.
 """
 def fn(self):
-triple = self.dbg.GetSelectedPlatform().GetTriple()
-match = re.match(".*-.*-.*-android", triple)
-if match:
+if target_is_android():
 if not api_levels:
 return True
 device_api = android_device_api()
@@ -1036,8 +1043,7 @@ def skipIfTargetAndroid(api_levels=None)
 def wrapper(*args, **kwargs):
 from unittest2 import case
 self = args[0]
-triple = self.dbg.GetSelectedPlatform().GetTriple()
-if re.match(

[Lldb-commits] [lldb] r242560 - freeaddrinfo(NULL) segfaults on Android.

2015-07-17 Thread Chaoren Lin
Author: chaoren
Date: Fri Jul 17 14:12:33 2015
New Revision: 242560

URL: http://llvm.org/viewvc/llvm-project?rev=242560&view=rev
Log:
freeaddrinfo(NULL) segfaults on Android.

Reviewers: tberghammer

Subscribers: tberghammer, danalbert, lldb-commits

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

Modified:
lldb/trunk/source/Host/common/SocketAddress.cpp

Modified: lldb/trunk/source/Host/common/SocketAddress.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/SocketAddress.cpp?rev=242560&r1=242559&r2=242560&view=diff
==
--- lldb/trunk/source/Host/common/SocketAddress.cpp (original)
+++ lldb/trunk/source/Host/common/SocketAddress.cpp Fri Jul 17 14:12:33 2015
@@ -304,8 +304,10 @@ SocketAddress::getaddrinfo (const char *
 *this = service_info_list;
 result = IsValid ();
 }
-
-:: freeaddrinfo (service_info_list);
+
+if (service_info_list)
+::freeaddrinfo(service_info_list);
+
 return result;
 }
 


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


[Lldb-commits] [PATCH] D11285: freeaddrinfo(NULL) segfaults on Android.

2015-07-16 Thread Chaoren Lin
chaoren created this revision.
chaoren added a reviewer: tberghammer.
chaoren added a subscriber: lldb-commits.
Herald added subscribers: danalbert, tberghammer.

http://reviews.llvm.org/D11285

Files:
  source/Host/common/SocketAddress.cpp

Index: source/Host/common/SocketAddress.cpp
===
--- source/Host/common/SocketAddress.cpp
+++ source/Host/common/SocketAddress.cpp
@@ -304,8 +304,10 @@
 *this = service_info_list;
 result = IsValid ();
 }
-
-:: freeaddrinfo (service_info_list);
+
+if (service_info_list)
+::freeaddrinfo(service_info_list);
+
 return result;
 }
 


Index: source/Host/common/SocketAddress.cpp
===
--- source/Host/common/SocketAddress.cpp
+++ source/Host/common/SocketAddress.cpp
@@ -304,8 +304,10 @@
 *this = service_info_list;
 result = IsValid ();
 }
-
-:: freeaddrinfo (service_info_list);
+
+if (service_info_list)
+::freeaddrinfo(service_info_list);
+
 return result;
 }
 
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11150: [NativeProcessLinux] Integrate MainLoop

2015-07-15 Thread Chaoren Lin
I wouldn't be surprised if this were Android specific (libc/kernel bug).
Since we did run into problems with pthread_sigmask before.

On Wed, Jul 15, 2015 at 11:17 PM, Chaoren Lin  wrote:

> Yeah, it's definitely related. Those two tests launch a large number of
> processes. LLDB kinda hangs waiting for the inferior exit SIGCHLD. Multiply
> that by the number of processes and you have hanging tests.
> On Jul 15, 2015 23:14, "Oleksiy Vyalov"  wrote:
>
>> Starting with this build
>> <http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-android/builds/678>
>>  which
>> includes the CL next 2 tests started to timeout - TestIntegerTypes
>> & TestIntegerTypesExpr.
>> Could you check whether it's related or not?
>>
>> On Wed, Jul 15, 2015 at 7:06 PM, Chaoren Lin  wrote:
>>
>>> Hi Pavel,
>>>
>>> I think there's some problems with the signal handling. SIGCHLD is
>>> received 6 times, but SigchldHandler is only called 5 times (missing the
>>> exit signal).
>>>
>>> The following error occurs when trying to `process kill` an Android
>>> inferior:
>>> ```
>>> Handle_k: failed to kill spawned pid ###, ignoring.
>>> ```
>>>
>>> It doesn't seem to be directly causing any test failures, but it's
>>> significantly slowing down the test suite.
>>>
>>> Could you please look into this?
>>>
>>> On Wed, Jul 15, 2015 at 10:20 AM, Pavel Labath 
>>> wrote:
>>>
>>>> This revision was automatically updated to reflect the committed
>>>> changes.
>>>> Closed by commit rL242305: [NativeProcessLinux] Integrate MainLoop
>>>> (authored by labath).
>>>>
>>>> Changed prior to commit:
>>>>   http://reviews.llvm.org/D11150?vs=29660&id=29789#toc
>>>>
>>>> Repository:
>>>>   rL LLVM
>>>>
>>>> http://reviews.llvm.org/D11150
>>>>
>>>> Files:
>>>>   lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
>>>>   lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
>>>>   lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
>>>>   lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
>>>>   lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
>>>>
>>>> lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
>>>>
>>>> lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
>>>>
>>>> lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
>>>>
>>>> lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
>>>>
>>>>
>>>
>>
>>
>> --
>> Oleksiy Vyalov | Software Engineer | ovya...@google.com
>>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242332 - Remove shell-specific code from TestLoadUnload Makefile.

2015-07-15 Thread Chaoren Lin
Author: chaoren
Date: Wed Jul 15 16:18:26 2015
New Revision: 242332

URL: http://llvm.org/viewvc/llvm-project?rev=242332&view=rev
Log:
Remove shell-specific code from TestLoadUnload Makefile.

Reviewers: clayborg, sivachandra

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/functionalities/load_unload/Makefile

Modified: lldb/trunk/test/functionalities/load_unload/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/Makefile?rev=242332&r1=242331&r2=242332&view=diff
==
--- lldb/trunk/test/functionalities/load_unload/Makefile (original)
+++ lldb/trunk/test/functionalities/load_unload/Makefile Wed Jul 15 16:18:26 
2015
@@ -25,6 +25,8 @@ ifeq "$(OS)" "Darwin"
EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
+
+   DS_IF_DARWIN = $(DS) -o $@.dSYM $@
 else
CFLAGS += -fPIC
LD_FLAGS := -shared
@@ -45,32 +47,32 @@ main.o: main.c
 
 hidden/$(LIB_D): dh.o
$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil -o hidden/$(LIB_D).dSYM 
hidden/$(LIB_D); fi
+   $(DS_IF_DARWIN)
 
 $(LIB_A): a.o $(LIB_B)
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. 
-lloadunload_b
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_A); fi
+   $(DS_IF_DARWIN)
 
 a.o: a.c
$(CC) $(CFLAGS) -c a.c
 
 $(LIB_B): b.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_B); fi
+   $(DS_IF_DARWIN)
 
 b.o: b.c
$(CC) $(CFLAGS) -c b.c
 
 $(LIB_C): c.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_C); fi
+   $(DS_IF_DARWIN)
 
 c.o: c.c
$(CC) $(CFLAGS) -c c.c
 
 $(LIB_D): d.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_D); fi
+   $(DS_IF_DARWIN)
 
 d.o: d.c
$(CC) $(CFLAGS) -c d.c


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


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-15 Thread Chaoren Lin
chaoren updated this revision to Diff 29811.
chaoren added a comment.

- Address review comments.


http://reviews.llvm.org/D10887

Files:
  cmake/platforms/Android.cmake
  source/Host/common/Socket.cpp

Index: source/Host/common/Socket.cpp
===
--- source/Host/common/Socket.cpp
+++ source/Host/common/Socket.cpp
@@ -24,7 +24,11 @@
 #include 
 #include 
 #include 
-#endif
+#if defined(ANDROID_ARM_BUILD_STATIC)
+#include 
+#include 
+#endif // ANDROID_ARM_BUILD_STATIC
+#endif // __ANDROID_NDK__
 
 #ifndef LLDB_DISABLE_POSIX
 #include 
@@ -70,7 +74,20 @@
 
 NativeSocket Accept(NativeSocket sockfd, struct sockaddr *addr, socklen_t 
*addrlen, bool child_processes_inherit)
 {
-#ifdef SOCK_CLOEXEC
+#if defined(ANDROID_ARM_BUILD_STATIC)
+   // Temporary workaround for statically linking Android lldb-server with 
the
+   // latest API.
+   int fd = syscall(__NR_accept, sockfd, addr, addrlen);
+   if (fd >= 0 && !child_processes_inherit)
+   {
+   int flags = ::fcntl(fd, F_GETFD);
+   if (flags == -1)
+   return -1;
+   if (::fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
+   return -1;
+   }
+   return fd;
+#elif defined(SOCK_CLOEXEC)
 int flags = 0;
 if (!child_processes_inherit) {
 flags |= SOCK_CLOEXEC;
Index: cmake/platforms/Android.cmake
===
--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -44,7 +44,7 @@
 # its symbols, which significantly increases the binary size. Static linking, 
on
 # the other hand, has little to no effect on the binary size.
 if (NOT DEFINED LLVM_BUILD_STATIC)
-  set( LLVM_BUILD_STATIC True )
+ set( LLVM_BUILD_STATIC True )
 endif()
 
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE INTERNAL "Android Abi" FORCE )
@@ -102,6 +102,10 @@
  # 64 bit atomic operations used in c++ libraries require armv7-a instructions
  # armv5te and armv6 were tried but do not work.
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a" )
+ if ( LLVM_BUILD_STATIC )
+  # Temporary workaround for static linking with the latest API.
+  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -DANDROID_ARM_BUILD_STATIC" )
+ endif()
 endif()
 
 # linker flags


Index: source/Host/common/Socket.cpp
===
--- source/Host/common/Socket.cpp
+++ source/Host/common/Socket.cpp
@@ -24,7 +24,11 @@
 #include 
 #include 
 #include 
-#endif
+#if defined(ANDROID_ARM_BUILD_STATIC)
+#include 
+#include 
+#endif // ANDROID_ARM_BUILD_STATIC
+#endif // __ANDROID_NDK__
 
 #ifndef LLDB_DISABLE_POSIX
 #include 
@@ -70,7 +74,20 @@
 
 NativeSocket Accept(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, bool child_processes_inherit)
 {
-#ifdef SOCK_CLOEXEC
+#if defined(ANDROID_ARM_BUILD_STATIC)
+	// Temporary workaround for statically linking Android lldb-server with the
+	// latest API.
+	int fd = syscall(__NR_accept, sockfd, addr, addrlen);
+	if (fd >= 0 && !child_processes_inherit)
+	{
+		int flags = ::fcntl(fd, F_GETFD);
+		if (flags == -1)
+			return -1;
+		if (::fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
+			return -1;
+	}
+	return fd;
+#elif defined(SOCK_CLOEXEC)
 int flags = 0;
 if (!child_processes_inherit) {
 flags |= SOCK_CLOEXEC;
Index: cmake/platforms/Android.cmake
===
--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -44,7 +44,7 @@
 # its symbols, which significantly increases the binary size. Static linking, on
 # the other hand, has little to no effect on the binary size.
 if (NOT DEFINED LLVM_BUILD_STATIC)
-  set( LLVM_BUILD_STATIC True )
+ set( LLVM_BUILD_STATIC True )
 endif()
 
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE INTERNAL "Android Abi" FORCE )
@@ -102,6 +102,10 @@
  # 64 bit atomic operations used in c++ libraries require armv7-a instructions
  # armv5te and armv6 were tried but do not work.
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a" )
+ if ( LLVM_BUILD_STATIC )
+  # Temporary workaround for static linking with the latest API.
+  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -DANDROID_ARM_BUILD_STATIC" )
+ endif()
 endif()
 
 # linker flags
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11202: Remove shell-specific code from TestLoadUnload Makefile.

2015-07-15 Thread Chaoren Lin
chaoren updated this revision to Diff 29808.
chaoren added a comment.

- Added back the $(DS) variable since we don't source the base Makefile.


http://reviews.llvm.org/D11202

Files:
  test/functionalities/load_unload/Makefile

Index: test/functionalities/load_unload/Makefile
===
--- test/functionalities/load_unload/Makefile
+++ test/functionalities/load_unload/Makefile
@@ -25,6 +25,8 @@
EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
+
+   DS_IF_DARWIN = $(DS) -o $@.dSYM $@
 else
CFLAGS += -fPIC
LD_FLAGS := -shared
@@ -45,32 +47,32 @@
 
 hidden/$(LIB_D): dh.o
$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil -o hidden/$(LIB_D).dSYM 
hidden/$(LIB_D); fi
+   $(DS_IF_DARWIN)
 
 $(LIB_A): a.o $(LIB_B)
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. 
-lloadunload_b
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_A); fi
+   $(DS_IF_DARWIN)
 
 a.o: a.c
$(CC) $(CFLAGS) -c a.c
 
 $(LIB_B): b.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_B); fi
+   $(DS_IF_DARWIN)
 
 b.o: b.c
$(CC) $(CFLAGS) -c b.c
 
 $(LIB_C): c.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_C); fi
+   $(DS_IF_DARWIN)
 
 c.o: c.c
$(CC) $(CFLAGS) -c c.c
 
 $(LIB_D): d.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_D); fi
+   $(DS_IF_DARWIN)
 
 d.o: d.c
$(CC) $(CFLAGS) -c d.c


Index: test/functionalities/load_unload/Makefile
===
--- test/functionalities/load_unload/Makefile
+++ test/functionalities/load_unload/Makefile
@@ -25,6 +25,8 @@
 	EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
 	EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
 	EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
+
+	DS_IF_DARWIN = $(DS) -o $@.dSYM $@
 else
 	CFLAGS += -fPIC
 	LD_FLAGS := -shared
@@ -45,32 +47,32 @@
 
 hidden/$(LIB_D): dh.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil -o hidden/$(LIB_D).dSYM hidden/$(LIB_D); fi
+	$(DS_IF_DARWIN)
 
 $(LIB_A): a.o $(LIB_B)
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. -lloadunload_b
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_A); fi
+	$(DS_IF_DARWIN)
 
 a.o: a.c
 	$(CC) $(CFLAGS) -c a.c
 
 $(LIB_B): b.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_B); fi
+	$(DS_IF_DARWIN)
 
 b.o: b.c
 	$(CC) $(CFLAGS) -c b.c
 
 $(LIB_C): c.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_C); fi
+	$(DS_IF_DARWIN)
 
 c.o: c.c
 	$(CC) $(CFLAGS) -c c.c
 
 $(LIB_D): d.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_D); fi
+	$(DS_IF_DARWIN)
 
 d.o: d.c
 	$(CC) $(CFLAGS) -c d.c
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D11202: Remove shell-specific code from TestLoadUnload Makefile.

2015-07-14 Thread Chaoren Lin
chaoren created this revision.
chaoren added reviewers: clayborg, sivachandra.
chaoren added a subscriber: lldb-commits.

http://reviews.llvm.org/D11202

Files:
  test/functionalities/load_unload/Makefile

Index: test/functionalities/load_unload/Makefile
===
--- test/functionalities/load_unload/Makefile
+++ test/functionalities/load_unload/Makefile
@@ -14,7 +14,6 @@
 
 ifeq "$(OS)" "Darwin"
CFLAGS += -arch $(ARCH)
-   DS := dsymutil
LD_FLAGS := -dynamiclib
LIB_A := $(LIB_PREFIX)a.dylib
LIB_B := $(LIB_PREFIX)b.dylib
@@ -25,6 +24,8 @@
EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
+
+   DS_IF_DARWIN = dsymutil -o $@.dSYM $@
 else
CFLAGS += -fPIC
LD_FLAGS := -shared
@@ -45,32 +46,32 @@
 
 hidden/$(LIB_D): dh.o
$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil -o hidden/$(LIB_D).dSYM 
hidden/$(LIB_D); fi
+   $(DS_IF_DARWIN)
 
 $(LIB_A): a.o $(LIB_B)
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. 
-lloadunload_b
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_A); fi
+   $(DS_IF_DARWIN)
 
 a.o: a.c
$(CC) $(CFLAGS) -c a.c
 
 $(LIB_B): b.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_B); fi
+   $(DS_IF_DARWIN)
 
 b.o: b.c
$(CC) $(CFLAGS) -c b.c
 
 $(LIB_C): c.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_C); fi
+   $(DS_IF_DARWIN)
 
 c.o: c.c
$(CC) $(CFLAGS) -c c.c
 
 $(LIB_D): d.o
$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-   if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_D); fi
+   $(DS_IF_DARWIN)
 
 d.o: d.c
$(CC) $(CFLAGS) -c d.c


Index: test/functionalities/load_unload/Makefile
===
--- test/functionalities/load_unload/Makefile
+++ test/functionalities/load_unload/Makefile
@@ -14,7 +14,6 @@
 
 ifeq "$(OS)" "Darwin"
 	CFLAGS += -arch $(ARCH)
-	DS := dsymutil
 	LD_FLAGS := -dynamiclib
 	LIB_A := $(LIB_PREFIX)a.dylib
 	LIB_B := $(LIB_PREFIX)b.dylib
@@ -25,6 +24,8 @@
 	EXEC_PATH_B := -install_name $(EXEC_PATH)/$(LIB_B)
 	EXEC_PATH_C := -install_name $(EXEC_PATH)/$(LIB_C)
 	EXEC_PATH_D := -install_name $(CWD)/$(LIB_D)
+
+	DS_IF_DARWIN = dsymutil -o $@.dSYM $@
 else
 	CFLAGS += -fPIC
 	LD_FLAGS := -shared
@@ -45,32 +46,32 @@
 
 hidden/$(LIB_D): dh.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) -o hidden/$(LIB_D) dh.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil -o hidden/$(LIB_D).dSYM hidden/$(LIB_D); fi
+	$(DS_IF_DARWIN)
 
 $(LIB_A): a.o $(LIB_B)
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_A) -o $(LIB_A) a.o -L. -lloadunload_b
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_A); fi
+	$(DS_IF_DARWIN)
 
 a.o: a.c
 	$(CC) $(CFLAGS) -c a.c
 
 $(LIB_B): b.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_B) -o $(LIB_B) b.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_B); fi
+	$(DS_IF_DARWIN)
 
 b.o: b.c
 	$(CC) $(CFLAGS) -c b.c
 
 $(LIB_C): c.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_C) -o $(LIB_C) c.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_C); fi
+	$(DS_IF_DARWIN)
 
 c.o: c.c
 	$(CC) $(CFLAGS) -c c.c
 
 $(LIB_D): d.o
 	$(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_D) -o $(LIB_D) d.o
-	if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_D); fi
+	$(DS_IF_DARWIN)
 
 d.o: d.c
 	$(CC) $(CFLAGS) -c d.c
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11099: [ClangASTType] Catch unhandled clang types at compile time

2015-07-14 Thread Chaoren Lin
AFAIK, there's no equivalent for this with MSVC. I think it would be a good
idea to wrap the pragma around an ifdef.

On Tue, Jul 14, 2015 at 2:09 AM, Pavel Labath  wrote:

> labath added a comment.
>
> In http://reviews.llvm.org/D11099#204409, @chaoren wrote:
>
> > Is it only this one switch statement that needs this assertion? Maybe
> the pragma should be localized to this part (with push/pop)? Also, I'm not
> sure if any other compilers are supported but this wouldn't work with MSVC.
>
>
> I am no expert in this area, but it seems to me that basically the whole
> file is made of switch statements on clang enums and that they all could
> use some protection.
>
> It is true that we won't get this protection on MSVC, but I don't think
> that's a big problem. Since this is not OS-dependent, it should be enough
> that at least some compilers are verifying this. However, if you know the
> right incantations to produce an error on MSVC, we can definitely add them.
>
> For clang and gcc we pass -Wno-unknown-pragma, but I don't know if we have
> a MSVC equivalent. If we don't and this produces a warning there, we can
> make this pragma #ifndef MSVC.
>
>
> http://reviews.llvm.org/D11099
>
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-13 Thread Chaoren Lin
We use local signals.
```
return getattr(signal, signal_name)
```

On Mon, Jul 13, 2015 at 11:07 AM, Greg Clayton  wrote:

> clayborg added a comment.
>
> So what happens if we are not connected to a remote platform? Do we get
> UnixSignal that are empty? Do we fall back to some constant notion of what
> we think the signal should be?
>
>
> http://reviews.llvm.org/D11094
>
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-10 Thread Chaoren Lin
chaoren added a comment.

> It would be nice from the standpoint that you might be able to grab a copy of 
> them and modify them before any processes are launched, but I don't see us 
> doing any of this anywhere so I would rather avoid it until we do.


We do this in the gdb remote tests. I added the `kill -l` workaround, but that 
doesn't work on prehistoric shells.

> Each platform might be able to guess what signals it has by making a constant 
> copy of some signals from some version of the their previous OS's but this 
> can get out of date


Yes, that's the fall back. Doesn't Process do this currently? If so, I don't 
see how this is worse.


http://reviews.llvm.org/D11094




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


Re: [Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-10 Thread Chaoren Lin
chaoren added inline comments.


Comment at: include/lldb/API/SBUnixSignals.h:68
@@ -67,2 +67,3 @@
 friend class SBProcess;
+SBUnixSignals(const lldb::ProcessSP &process_sp);
 

labath wrote:
> You are changing the public API here. We are maintaining binary compatibility 
> wrt. SBAPI. You can see  for 
> details, but the short version is that you can add signatures, but not modfy 
> or remove existing ones.
This is protected: so it's not part of the public API. Actually, now that you 
mention it, it should probably be private: instead, since there's no 
inheritance.


Comment at: include/lldb/API/SBUnixSignals.h:78
@@ -79,1 +77,3 @@
+lldb::UnixSignalsSP m_opaque_sp;
+lldb::ProcessWP m_process_wp;
 };

labath wrote:
> Modifying the members ( = size of the object) is also a no-no.
We can probably do without the process pointer (depending on the answer to my 
3rd question). But I'm not sure it makes sense to use a WP for UnixSignals.


Comment at: source/Host/common/Host.cpp:1078
@@ -1077,1 +1077,3 @@
+const UnixSignalsSP &
+Host::GetUnixSignals(const ArchSpec &arch)
 {

labath wrote:
> I am not sure this function belongs to the Host layer anymore (which I 
> understand as providing information about the host lldb is running on), since 
> it now provides signals for any platform. Perhaps if we move this function to 
> process/Utility then we wouldn't have the host layer calling back into other 
> stuff (was this the reason for your question #2?). What do you think?
We can probably move this function to UnixSignals itself. The signals are 
usually platform specific rather than process specific, so I thought it was a 
little weird to still have them in Process/Utility.


http://reviews.llvm.org/D11094




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


Re: [Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-09 Thread Chaoren Lin
chaoren updated this revision to Diff 29418.
chaoren added a comment.

- UnixSignals::Reset should be virtual.


http://reviews.llvm.org/D11094

Files:
  include/lldb/API/SBPlatform.h
  include/lldb/API/SBUnixSignals.h
  include/lldb/Core/StructuredData.h
  include/lldb/Host/Host.h
  include/lldb/Target/Platform.h
  include/lldb/Target/Process.h
  include/lldb/Target/UnixSignals.h
  include/lldb/lldb-forward.h
  include/lldb/lldb-private-forward.h
  scripts/interface/SBPlatform.i
  source/API/SBPlatform.cpp
  source/API/SBProcess.cpp
  source/API/SBThread.cpp
  source/API/SBUnixSignals.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Host/common/Host.cpp
  source/Host/freebsd/Host.cpp
  source/Host/linux/Host.cpp
  source/Plugins/Platform/Linux/PlatformLinux.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Utility/CMakeLists.txt
  source/Plugins/Process/Utility/FreeBSDSignals.cpp
  source/Plugins/Process/Utility/FreeBSDSignals.h
  source/Plugins/Process/Utility/GDBRemoteSignals.cpp
  source/Plugins/Process/Utility/GDBRemoteSignals.h
  source/Plugins/Process/Utility/LinuxSignals.cpp
  source/Plugins/Process/Utility/LinuxSignals.h
  source/Plugins/Process/Utility/MipsLinuxSignals.cpp
  source/Plugins/Process/Utility/MipsLinuxSignals.h
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Process.cpp
  source/Target/StopInfo.cpp
  source/Target/UnixSignals.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h
  test/lldbutil.py

Index: test/lldbutil.py
===
--- test/lldbutil.py
+++ test/lldbutil.py
@@ -934,35 +934,9 @@
 
 def get_signal_number(signal_name):
 platform = lldb.remote_platform
-if platform:
-if platform.GetName() == 'remote-linux':
-command = lldb.SBPlatformShellCommand('kill -l %d' % signal_name)
-if platform.Run(command).Success() and command.GetStatus() == 0:
-try:
-return int(command.GetOutput())
-except ValueError:
-pass
-elif platform.GetName() == 'remote-android':
-for signal_number in range(1, 65):
-command = lldb.SBPlatformShellCommand('kill -l %d' % signal_number)
-if platform.Run(command).Fail() or command.GetStatus() != 0:
-continue
-output = command.GetOutput().strip().upper()
-if not output.startswith('SIG'):
-output = 'SIG' + output
-if output == signal_name:
-return signal_number
-if lldb.debugger:
-for target_index in range(lldb.debugger.GetNumTargets()):
-target = lldb.debugger.GetTargetAtIndex(target_index)
-if not target.IsValid():
-continue
-process = target.GetProcess()
-if not process.IsValid():
-continue
-signals = process.GetUnixSignals()
-if not signals.IsValid():
-continue
+if platform and platform.IsValid():
+signals = platform.GetUnixSignals()
+if signals.IsValid():
 signal_number = signals.GetSignalNumberFromName(signal_name)
 if signal_number > 0:
 return signal_number
Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -118,6 +118,8 @@
 eServerPacketType_qWatchpointSupportInfoSupported,
 eServerPacketType_qXfer_auxv_read,
 
+eServerPacketType_jSignalsInfo,
+
 eServerPacketType_vAttach,
 eServerPacketType_vAttachWait,
 eServerPacketType_vAttachOrWait,
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -82,7 +82,7 @@
 
 case 'A':
 return eServerPacketType_A;
-
+
 case 'Q':
 
 switch (packet_cstr[1])
@@ -122,7 +122,7 @@
 break;
 }
 break;
-
+
 case 'q':
 switch (packet

[Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-09 Thread Chaoren Lin
chaoren created this revision.
chaoren added reviewers: ovyalov, clayborg.
chaoren added a subscriber: lldb-commits.
Herald added subscribers: tberghammer, emaste.

- Consolidate Unix signals selection in Host.
- Make Unix signals available from platform.
- Delegate remote signal to platform.
- Update SB API for signals.
- Update signal utility in test suite.
- Add jSignalsInfo packet to retrieve Unix signals from remote platform.

http://reviews.llvm.org/D11094

Files:
  include/lldb/API/SBPlatform.h
  include/lldb/API/SBUnixSignals.h
  include/lldb/Core/StructuredData.h
  include/lldb/Host/Host.h
  include/lldb/Target/Platform.h
  include/lldb/Target/Process.h
  include/lldb/Target/UnixSignals.h
  include/lldb/lldb-forward.h
  include/lldb/lldb-private-forward.h
  scripts/interface/SBPlatform.i
  source/API/SBPlatform.cpp
  source/API/SBProcess.cpp
  source/API/SBThread.cpp
  source/API/SBUnixSignals.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Host/common/Host.cpp
  source/Host/freebsd/Host.cpp
  source/Host/linux/Host.cpp
  source/Plugins/Platform/Linux/PlatformLinux.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Utility/CMakeLists.txt
  source/Plugins/Process/Utility/FreeBSDSignals.cpp
  source/Plugins/Process/Utility/FreeBSDSignals.h
  source/Plugins/Process/Utility/GDBRemoteSignals.cpp
  source/Plugins/Process/Utility/GDBRemoteSignals.h
  source/Plugins/Process/Utility/LinuxSignals.cpp
  source/Plugins/Process/Utility/LinuxSignals.h
  source/Plugins/Process/Utility/MipsLinuxSignals.cpp
  source/Plugins/Process/Utility/MipsLinuxSignals.h
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Process.cpp
  source/Target/StopInfo.cpp
  source/Target/UnixSignals.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h
  test/lldbutil.py

Index: test/lldbutil.py
===
--- test/lldbutil.py
+++ test/lldbutil.py
@@ -934,35 +934,9 @@
 
 def get_signal_number(signal_name):
 platform = lldb.remote_platform
-if platform:
-if platform.GetName() == 'remote-linux':
-command = lldb.SBPlatformShellCommand('kill -l %d' % signal_name)
-if platform.Run(command).Success() and command.GetStatus() == 0:
-try:
-return int(command.GetOutput())
-except ValueError:
-pass
-elif platform.GetName() == 'remote-android':
-for signal_number in range(1, 65):
-command = lldb.SBPlatformShellCommand('kill -l %d' % signal_number)
-if platform.Run(command).Fail() or command.GetStatus() != 0:
-continue
-output = command.GetOutput().strip().upper()
-if not output.startswith('SIG'):
-output = 'SIG' + output
-if output == signal_name:
-return signal_number
-if lldb.debugger:
-for target_index in range(lldb.debugger.GetNumTargets()):
-target = lldb.debugger.GetTargetAtIndex(target_index)
-if not target.IsValid():
-continue
-process = target.GetProcess()
-if not process.IsValid():
-continue
-signals = process.GetUnixSignals()
-if not signals.IsValid():
-continue
+if platform and platform.IsValid():
+signals = platform.GetUnixSignals()
+if signals.IsValid():
 signal_number = signals.GetSignalNumberFromName(signal_name)
 if signal_number > 0:
 return signal_number
Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -118,6 +118,8 @@
 eServerPacketType_qWatchpointSupportInfoSupported,
 eServerPacketType_qXfer_auxv_read,
 
+eServerPacketType_jSignalsInfo,
+
 eServerPacketType_vAttach,
 eServerPacketType_vAttachWait,
 eServerPacketType_vAttachOrWait,
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtract

[Lldb-commits] [lldb] r241837 - Fix 32-bit Linux watchpoint failures.

2015-07-09 Thread Chaoren Lin
Author: chaoren
Date: Thu Jul  9 13:35:16 2015
New Revision: 241837

URL: http://llvm.org/viewvc/llvm-project?rev=241837&view=rev
Log:
Fix 32-bit Linux watchpoint failures.

Summary:
32-bit signed return value from ptrace got sign extended when being converted to
64-bit unsigned.

Also, replaced tabs with spaces in the source.

Reviewers: labath, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp?rev=241837&r1=241836&r2=241837&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp Thu 
Jul  9 13:35:16 2015
@@ -22,7 +22,7 @@ using namespace lldb_private::process_li
 NativeRegisterContextLinux::NativeRegisterContextLinux(NativeThreadProtocol 
&native_thread,
uint32_t 
concrete_frame_idx,
RegisterInfoInterface 
*reg_info_interface_p) :
-   NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx, 
reg_info_interface_p)
+NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx, 
reg_info_interface_p)
 {}
 
 lldb::ByteOrder
@@ -48,7 +48,7 @@ NativeRegisterContextLinux::ReadRegister
 {
 const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index);
 if (!reg_info)
-   return Error("register %" PRIu32 " not found", reg_index);
+return Error("register %" PRIu32 " not found", reg_index);
 
 NativeProcessProtocolSP process_sp(m_thread.GetProcess());
 if (!process_sp)
@@ -70,7 +70,7 @@ NativeRegisterContextLinux::WriteRegiste
 const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_index);
 if (reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != 
LLDB_INVALID_REGNUM))
 {
-   Error error;
+Error error;
 
 RegisterValue full_value;
 uint32_t full_reg = reg_info->invalidate_regs[0];
@@ -110,7 +110,7 @@ NativeRegisterContextLinux::WriteRegiste
 
 NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
 if (!process_sp)
-   return Error("NativeProcessProtocol is NULL");
+return Error("NativeProcessProtocol is NULL");
 
 const RegisterInfo *const register_to_write_info_p = 
GetRegisterInfoAtIndex (reg_to_write);
 assert (register_to_write_info_p && "register to write does not have valid 
RegisterInfo");
@@ -126,13 +126,13 @@ NativeRegisterContextLinux::WriteRegiste
 Error
 NativeRegisterContextLinux::ReadGPR()
 {
-   NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
+NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
 if (!process_sp)
 return Error("NativeProcessProtocol is NULL");
 
 void* buf = GetGPRBuffer();
 if (!buf)
-   return Error("GPR buffer is NULL");
+return Error("GPR buffer is NULL");
 size_t buf_size = GetGPRSize();
 
 NativeProcessLinux* process_p = 
static_cast(process_sp.get());
@@ -142,13 +142,13 @@ NativeRegisterContextLinux::ReadGPR()
 Error
 NativeRegisterContextLinux::WriteGPR()
 {
-   NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
+NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
 if (!process_sp)
 return Error("NativeProcessProtocol is NULL");
 
 void* buf = GetGPRBuffer();
 if (!buf)
-   return Error("GPR buffer is NULL");
+return Error("GPR buffer is NULL");
 size_t buf_size = GetGPRSize();
 
 NativeProcessLinux* process_p = 
static_cast(process_sp.get());
@@ -158,13 +158,13 @@ NativeRegisterContextLinux::WriteGPR()
 Error
 NativeRegisterContextLinux::ReadFPR()
 {
-   NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
+NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
 if (!process_sp)
 return Error("NativeProcessProtocol is NULL");
 
 void* buf = GetFPRBuffer();
 if (!buf)
-   return Error("GPR buffer is NULL");
+return Error("GPR buffer is NULL");
 size_t buf_size = GetFPRSize();
 
 NativeProcessLinux* process_p = 
static_cast(process_sp.get());
@@ -174,13 +174,13 @@ NativeRegisterContextLinux::ReadFPR()
 Error
 NativeRegisterContextLinux::WriteFPR()
 {
-   NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
+NativeProcessProtocolSP process_sp (m_thread.GetProcess ());
 if (!process_sp)
 return Error("NativeProcessProtocol is NULL");
 
 void* buf = GetFPRBuffer();
 if (!buf)
-   return Error("GPR buffer is NULL");
+return Error("GPR buffer is NULL");
 size_

Re: [Lldb-commits] [PATCH] D11014: Skip test that requires fork on Windows, which doesn't have fork.

2015-07-07 Thread Chaoren Lin
chaoren accepted this revision.

This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D11014




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


[Lldb-commits] [PATCH] D10976: Fix APFloat construction from 16 byte APInt.

2015-07-06 Thread Chaoren Lin

chaoren added a reviewer: clayborg.
chaoren added a subscriber: lldb-commits.

http://reviews.llvm.org/D10976

Files:
  source/Core/DataExtractor.cpp

Index: source/Core/DataExtractor.cpp
===
--- source/Core/DataExtractor.cpp
+++ source/Core/DataExtractor.cpp
@@ -1830,26 +1830,16 @@
 }
 else if (item_bit_size == 
ast->getTypeSize(ast->LongDoubleTy))
 {
+auto byte_size = item_byte_size;
+const auto &semantics = 
ast->getFloatTypeSemantics(ast->LongDoubleTy);
+if (&semantics == 
&llvm::APFloat::x87DoubleExtended)
+byte_size = 10;
+
 llvm::APInt apint;
-switch 
(target_sp->GetArchitecture().GetMachine())
+if (GetAPInt(*this, &offset, byte_size, apint))
 {
-case llvm::Triple::x86:
-case llvm::Triple::x86_64:
-// clang will assert when constructing 
the apfloat if we use a 16 byte integer value
-if (GetAPInt (*this, &offset, 10, 
apint))
-{
-llvm::APFloat apfloat 
(ast->getFloatTypeSemantics(ast->LongDoubleTy), apint);
-apfloat.toString(sv, 
format_precision, format_max_padding);
-}
-break;
-
-default:
-if (GetAPInt (*this, &offset, 
item_byte_size, apint))
-{
-llvm::APFloat apfloat 
(ast->getFloatTypeSemantics(ast->LongDoubleTy), apint);
-apfloat.toString(sv, 
format_precision, format_max_padding);
-}
-break;
+llvm::APFloat apfloat(semantics, apint);
+apfloat.toString(sv, format_precision, 
format_max_padding);
 }
 }
 else if (item_bit_size == 
ast->getTypeSize(ast->HalfTy))


Index: source/Core/DataExtractor.cpp
===
--- source/Core/DataExtractor.cpp
+++ source/Core/DataExtractor.cpp
@@ -1830,26 +1830,16 @@
 }
 else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy))
 {
+auto byte_size = item_byte_size;
+const auto &semantics = ast->getFloatTypeSemantics(ast->LongDoubleTy);
+if (&semantics == &llvm::APFloat::x87DoubleExtended)
+byte_size = 10;
+
 llvm::APInt apint;
-switch (target_sp->GetArchitecture().GetMachine())
+if (GetAPInt(*this, &offset, byte_size, apint))
 {
-case llvm::Triple::x86:
-case llvm::Triple::x86_64:
-// clang will assert when constructing the apfloat if we use a 16 byte integer value
-if (GetAPInt (*this, &offset, 10, apint))
-{
-llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint);
-apfloat.toString(sv, format_precision, format_max_padding);
-}
-break;
-
-default:
-if (GetAPInt (*this, &offset, item_byte_size, apint))
-{
-llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint);
-apfloat.toString(sv, format_precision, format_max_padding);
-}
-break;
+llvm::APFloat apfloat(semantics, apint);
+apfloat.toString(sv, format_precision, format_max_padding);

Re: [Lldb-commits] [PATCH] D10858: Default to linking lldb-server statically for Android.

2015-07-06 Thread Chaoren Lin


- Add comment for rational.


http://reviews.llvm.org/D10858

Files:
  cmake/LLDBDependencies.cmake
  cmake/platforms/Android.cmake

Index: cmake/platforms/Android.cmake
===
--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -38,6 +38,15 @@
 set( ANDROID True )
 set( __ANDROID_NDK__ True )
 
+# linking lldb-server statically for Android avoids the need to ship two
+# binaries (pie for API 21+ and non-pie for API 14-). It's possible to use
+# a non-pie shim on API 14-, but that requires lldb-server to dynamically 
export
+# its symbols, which significantly increases the binary size. Static linking, 
on
+# the other hand, has little to no effect on the binary size.
+if (NOT DEFINED LLVM_BUILD_STATIC)
+  set( LLVM_BUILD_STATIC True )
+endif()
+
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE INTERNAL "Android Abi" FORCE )
 if( ANDROID_ABI STREQUAL "x86" )
  set( CMAKE_SYSTEM_PROCESSOR "i686" )
@@ -95,11 +104,6 @@
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a" )
 endif()
 
-# PIE is required for API 21+ so we enable it
-# unfortunately, it is not supported before API 14 so we need to do something 
else there
-# see http://llvm.org/pr23457
-set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
-
 # linker flags
 set( ANDROID_CXX_FLAGS"${ANDROID_CXX_FLAGS} -fdata-sections 
-ffunction-sections" )
 set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -154,7 +154,12 @@
 list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
 
 if (LLVM_BUILD_STATIC)
-  list(APPEND LLDB_SYSTEM_LIBS python2.7 z util termcap gpm ssl crypto bsd)
+  if (NOT LLDB_DISABLE_PYTHON)
+  list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
+  endif()
+  if (NOT LLDB_DISABLE_CURSES)
+  list(APPEND LLDB_SYSTEM_LIBS gpm)
+  endif()
 endif()
 
 set( LLVM_LINK_COMPONENTS


Index: cmake/platforms/Android.cmake
===
--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -38,6 +38,15 @@
 set( ANDROID True )
 set( __ANDROID_NDK__ True )
 
+# linking lldb-server statically for Android avoids the need to ship two
+# binaries (pie for API 21+ and non-pie for API 14-). It's possible to use
+# a non-pie shim on API 14-, but that requires lldb-server to dynamically export
+# its symbols, which significantly increases the binary size. Static linking, on
+# the other hand, has little to no effect on the binary size.
+if (NOT DEFINED LLVM_BUILD_STATIC)
+  set( LLVM_BUILD_STATIC True )
+endif()
+
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE INTERNAL "Android Abi" FORCE )
 if( ANDROID_ABI STREQUAL "x86" )
  set( CMAKE_SYSTEM_PROCESSOR "i686" )
@@ -95,11 +104,6 @@
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a" )
 endif()
 
-# PIE is required for API 21+ so we enable it
-# unfortunately, it is not supported before API 14 so we need to do something else there
-# see http://llvm.org/pr23457
-set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
-
 # linker flags
 set( ANDROID_CXX_FLAGS"${ANDROID_CXX_FLAGS} -fdata-sections -ffunction-sections" )
 set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -154,7 +154,12 @@
 list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
 
 if (LLVM_BUILD_STATIC)
-  list(APPEND LLDB_SYSTEM_LIBS python2.7 z util termcap gpm ssl crypto bsd)
+  if (NOT LLDB_DISABLE_PYTHON)
+  list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
+  endif()
+  if (NOT LLDB_DISABLE_CURSES)
+  list(APPEND LLDB_SYSTEM_LIBS gpm)
+  endif()
 endif()
 
 set( LLVM_LINK_COMPONENTS
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-02 Thread Chaoren Lin
chaoren added a comment.

We can't patch bugs on the system libc of shipped devices, while with
static linking, we can avoid all but the latest bugs in the toolchain
(which I think the toolchain guys would be more receptive to fixing).
labath added a comment.

In http://reviews.llvm.org/D10887#198526, @chaoren wrote:

> Using a shim results in about a 5M increase in the lldb-server binary

> 

>   because of the need to export all symbols dynamically. And still has


those

>   two bugs (which would be in the system libs, if linked dynamically).


Couldn't this be avoided somehow (with some __attribute__ magic or
something). In reality, we just need one symbol, "lldb_main", or such).

And if that proves unfeasible and we have to statically link, I would
prefer patching bugs in older libc over patching "features" in newer ones.

http://reviews.llvm.org/D10887


http://reviews.llvm.org/D10887




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


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-02 Thread Chaoren Lin
chaoren added a comment.

That's what the shim does. You need to export the main symbol to call it
with dlopen.


http://reviews.llvm.org/D10887




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


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-02 Thread Chaoren Lin
For reference, the gdbserver binary currently in the toolchain is
statically linked.

Using a shim results in about a 5M increase in the lldb-server binary
because of the need to export all symbols dynamically. And still has those
two bugs (which would be in the system libs, if linked dynamically).
On Jul 2, 2015 08:32, "Pavel Labath"  wrote:

> labath added a comment.
>
> In http://reviews.llvm.org/D10887#198515, @chaoren wrote:
>
> > - b.android.com/178448
> > - pthread_sigmask doesn't work at all in the older toolchains
> >
> >   The only possible problems I can see right now are missing syscalls,
> and we can easily get a diff of those between API 21 and API 9.
>
>
> The sentence "in general, statically linked binaries are compatible with
> neither older nor newer releases, especially where networking is concerned"
> from the bug leads me to believe that we should reconsider the static
> linking approach. I would normally expect these to be at least forward
> compatible, but if they don't guarantee even that, I think we should go
> back to the idea of using a non-pie shim process to load the lldb-server on
> old devices. Otherwise, we can encounter subtle and annoying breakages,
> which I would prefer to avoid.
>
>
> http://reviews.llvm.org/D10887
>
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-02 Thread Chaoren Lin
chaoren added a comment.

For reference, the gdbserver binary currently in the toolchain is
statically linked.

Using a shim results in about a 5M increase in the lldb-server binary
because of the need to export all symbols dynamically. And still has those
two bugs (which would be in the system libs, if linked dynamically).


http://reviews.llvm.org/D10887




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


[Lldb-commits] [lldb] r241276 - Remove outdated comment.

2015-07-02 Thread Chaoren Lin
Author: chaoren
Date: Thu Jul  2 10:30:59 2015
New Revision: 241276

URL: http://llvm.org/viewvc/llvm-project?rev=241276&view=rev
Log:
Remove outdated comment.

Modified:

lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py

Modified: 
lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py?rev=241276&r1=241275&r2=241276&view=diff
==
--- 
lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
 (original)
+++ 
lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
 Thu Jul  2 10:30:59 2015
@@ -38,7 +38,6 @@ class HelloWatchpointTestCase(TestBase):
 self.line = line_number(self.source, '// Set break point at this 
line.')
 # And the watchpoint variable declaration line number.
 self.decl = line_number(self.source, '// Watchpoint variable 
declaration.')
-# Build dictionary to have unique executable names for each test 
method.
 self.exe_name = 'a.out'
 self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
 


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


Re: [Lldb-commits] [PATCH] Change executable name to a.out.

2015-07-02 Thread Chaoren Lin
Oops. Yeah, that doesn't make sense anymore. I'll remove it.
On Jul 2, 2015 04:06, "Bruce Mitchener"  wrote:

> REPOSITORY
>   rL LLVM
>
> 
> Comment at:
> lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py:41
> @@ -40,2 +40,3 @@
>  self.decl = line_number(self.source, '// Watchpoint variable
> declaration.')
>  # Build dictionary to have unique executable names for each test
> method.
> +self.exe_name = 'a.out'
> 
> A bit late, but shouldn't this comment be updated?
>
> http://reviews.llvm.org/D10888
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-02 Thread Chaoren Lin
chaoren added a comment.

- b.android.com/178448
- pthread_sigmask doesn't work at all in the older toolchains

The only possible problems I can see right now are missing syscalls, and we
can easily get a diff of those between API 21 and API 9.
labath requested changes to this revision.
labath added a reviewer: labath.
labath added a comment.

What kind of bugs are we talking about?

I find the idea of using an API 21-built binary and running it on an older
device extremely troubling, and I would not trust it even if it did seem to
work. I think we should find another way to achive this.

http://reviews.llvm.org/D10887


http://reviews.llvm.org/D10887




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


Re: [Lldb-commits] [PATCH] D10887: Use accept instead of accept4 for Android.

2015-07-02 Thread Chaoren Lin
chaoren added a subscriber: chaoren.
chaoren added a comment.

I am statically linking against API-21. There are some bugs in the old
toolchains that can be avoided by doing this. Aside from this issue, the
resulting binary seem to run fine on API 10 devices (and passes most of the
test suite).


http://reviews.llvm.org/D10887




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


Re: [Lldb-commits] [PATCH] Fix TestCreateAfterAttach on Windows

2015-07-01 Thread Chaoren Lin

Comment at: 
test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py:93
@@ -90,1 +92,3 @@
+   'main',
+   'stop reason = breakpoint'])
 

amccarth wrote:
> chaoren wrote:
> > amccarth wrote:
> > > labath wrote:
> > > > I think this would be a good time to switch from substring matching to 
> > > > checking things properly using the SBAPI. Right now, it's getting quite 
> > > > hard to tell what this tests exactly, and if the all edge cases are 
> > > > treated properly (e.g. what would happen if one thread stops in "main", 
> > > > but some other thread has "stop reason = breakpoint"). lldbutil has a 
> > > > lot of wrappers to make it easy to use the python api. For example, 
> > > > this fragment could be written way more robustly like this:
> > > > ```
> > > > threads = lldbutil.continue_to_breakpoint(process, 1) # run to first 
> > > > breakpoint
> > > > self.assertEquals(len(threads), 1)
> > > > self.assertEquals(threads[0].GetFrameAtIndex(0).GetFunctionName(), 
> > > > "main")
> > > > ```
> > > > (disclaimer: I did not test this code, but I believe you get the idea)
> > > I agree that should be done, but I would prefer to do it later, in a 
> > > separate patch.  This patch has been blocked for two weeks while I 
> > > tracked down the problem with the confusion between the thread resume 
> > > state and the thread temporary resume state in the Windows 
> > > implementation.  Further modification of the test increases the risk of 
> > > breaking it for other platforms than the one I'm focused on.
> > > 
> > > There are higher priority things now.  For example, because of some 
> > > crashing tests, simply running ninja check-lldb hangs, leaving dozens of 
> > > orphaned processes.
> > ```
> > self.assertEquals(len(threads), 1)
> > ```
> > 
> > I don't think you can make any assumptions on the number of threads because 
> > of the thread pool. But it is an important assertion to make on other 
> > platforms.
> At this point, even on other platforms, there are at least two threads at 
> this point:  the main thread, and the one spawned before this breakpoint.
> 
> I could do self.assertGreaterEqual(len(threads), 2), if you think that's 
> useful.
I think it's useful to assert to exact number of threads, and the creation 
order of those threads, and we'd still have a problem even if using the SB api. 
Perhaps you could create a Windows version of this test case where thread 
numbers/order don't matter and disable this one?

http://reviews.llvm.org/D10850

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



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


Re: [Lldb-commits] [PATCH] Default to linking lldb-server statically for Android.

2015-07-01 Thread Chaoren Lin
-pie is not compatible with -static. lldb-server can work on any API if
linked statically.
On Jul 1, 2015 02:17, "Tamas Berghammer"  wrote:

> 
> Comment at: cmake/platforms/Android.cmake:98-102
> @@ -97,7 +101,2 @@
>
> -# PIE is required for API 21+ so we enable it
> -# unfortunately, it is not supported before API 14 so we need to do
> something else there
> -# see http://llvm.org/pr23457
> -set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
> -
>  # linker flags
> 
> Who will specify the "-pie" flag for API 21+? Without it lldb-server won't
> work in those API levels.
>
> http://reviews.llvm.org/D10858
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix TestCreateAfterAttach on Windows

2015-06-30 Thread Chaoren Lin

Comment at: 
test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py:83
@@ -80,1 +82,3 @@
+# std::thread may cause the program to spin up a thread pool (and it 
does on
+# Windows), so the thread numbers are non-deterministic.
 

amccarth wrote:
> chaoren wrote:
> > I thought these thread numbers are assigned by order of creation. When you 
> > say non-deterministic, do you mean the new thread notifications (if it 
> > exists on Windows), come in non-deterministic order? Even if the thread 
> > creations are separated by a long interval?
> Microsoft's std::thread implementation seems to spin up a thread pool when 
> you create your first thread.  On my machine, it immediately creates three 
> new threads, and which if them is actually tasked to do the work seems to be 
> non-deterministic.
Ah, I see what you mean. Would it be possible to identify and hide these 
auxiliary threads? I can't think of a scenario in which it would be beneficial 
to see them. Aside from that, the regular threads //do// come in the correct 
order right? If I understood you correctly, a new thread creation could be 1) 
actually creating a new thread 2) assigning an existing thread from the thread 
pool to the task. Would it be possible to detect case 2) and treat it as a new 
thread creation?

http://reviews.llvm.org/D10850

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



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


Re: [Lldb-commits] [PATCH] Fix demangling of names if required by language

2015-06-30 Thread Chaoren Lin
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10744

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



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


Re: [Lldb-commits] [PATCH] [NativeProcessLinux] Refactor PtraceWrapper

2015-06-30 Thread Chaoren Lin
LGTM.


http://reviews.llvm.org/D10808

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



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


Re: [Lldb-commits] [PATCH] Rewrite FileSpec::EnumerateDirectory to avoid code duplication.

2015-06-29 Thread Chaoren Lin
- Shouldn't try to be clever.


http://reviews.llvm.org/D10811

Files:
  include/lldb/Host/FileSpec.h
  source/Host/common/FileSpec.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/Host/FileSpec.h
===
--- include/lldb/Host/FileSpec.h
+++ include/lldb/Host/FileSpec.h
@@ -801,8 +801,7 @@
 
 typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
 FileType file_type,
-const FileSpec &spec
-);
+const FileSpec &spec);
 
 static EnumerateDirectoryResult
 EnumerateDirectory (const char *dir_path,
Index: source/Host/common/FileSpec.cpp
===
--- source/Host/common/FileSpec.cpp
+++ source/Host/common/FileSpec.cpp
@@ -1272,207 +1272,23 @@
 void *callback_baton
 )
 {
-if (dir_path && dir_path[0])
-{
-#if _WIN32
-std::string szDir(dir_path);
-szDir += "\\*";
-
-WIN32_FIND_DATA ffd;
-HANDLE hFind = FindFirstFile(szDir.c_str(), &ffd);
-
-if (hFind == INVALID_HANDLE_VALUE)
-{
-return eEnumerateDirectoryResultNext;
-}
-
-do
-{
-bool call_callback = false;
-FileSpec::FileType file_type = eFileTypeUnknown;
-if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-{
-size_t len = strlen(ffd.cFileName);
-
-if (len == 1 && ffd.cFileName[0] == '.')
-continue;
-
-if (len == 2 && ffd.cFileName[0] == '.' && ffd.cFileName[1] == '.')
-continue;
-
-file_type = eFileTypeDirectory;
-call_callback = find_directories;
-}
-else if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DEVICE)
-{
-file_type = eFileTypeOther;
-call_callback = find_other;
-}
-else
-{
-file_type = eFileTypeRegular;
-call_callback = find_files;
-}
-if (call_callback)
-{
-char child_path[MAX_PATH];
-const int child_path_len = ::snprintf (child_path, sizeof(child_path), "%s\\%s", dir_path, ffd.cFileName);
-if (child_path_len < (int)(sizeof(child_path) - 1))
+return ForEachItemInDirectory(dir_path,
+[&find_directories, &find_files, &find_other, &callback, &callback_baton]
+(FileType file_type, const FileSpec &file_spec) {
+switch (file_type)
 {
-// Don't resolve the file type or path
-FileSpec child_path_spec (child_path, false);
-
-EnumerateDirectoryResult result = callback (callback_baton, file_type, child_path_spec);
-
-switch (result)
-{
-case eEnumerateDirectoryResultNext:
-// Enumerate next entry in the current directory. We just
-// exit this switch and will continue enumerating the
-// current directory as we currently are...
-break;
-
-case eEnumerateDirectoryResultEnter: // Recurse into the current entry if it is a directory or symlink, or next if not
-if (FileSpec::EnumerateDirectory(child_path,
-find_directories,
-find_files,
-find_other,
-callback,
-callback_baton) == eEnumerateDirectoryResultQuit)
-{
-// The subdirectory returned Quit, which means to 
-// stop all directory enumerations at all levels.
-return eEnumerateDirectoryResultQuit;
-}
-break;
-
-case eEnumerateDirectoryResultExit:  // Exit from the current directory at the current level.
-// Exit from this directory level and tell parent to 
-// keep enumerating.
-return eEnumerateDirectoryResultNext;
-
-case eEnumerateDirectoryResultQuit:  // Stop directory enumerations at any level
-return eEnumerateDirectoryResultQuit;
-}
-}
-}
-} while (FindNextFile(hFind, &ffd) != 0);
-
-FindClose(hFind);
-#else
-lldb_utility::CleanUp  dir_path_dir(opendir(dir_path), NULL, closedir);
-if (dir_path_dir.is_val

[Lldb-commits] [PATCH] Rewrite FileSpec::EnumerateDirectory to avoid code duplication.

2015-06-29 Thread Chaoren Lin
Hi clayborg,

http://reviews.llvm.org/D10811

Files:
  include/lldb/Host/FileSpec.h
  source/Host/common/FileSpec.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/Host/FileSpec.h
===
--- include/lldb/Host/FileSpec.h
+++ include/lldb/Host/FileSpec.h
@@ -801,8 +801,7 @@
 
 typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
 FileType file_type,
-const FileSpec &spec
-);
+const FileSpec &spec);
 
 static EnumerateDirectoryResult
 EnumerateDirectory (const char *dir_path,
Index: source/Host/common/FileSpec.cpp
===
--- source/Host/common/FileSpec.cpp
+++ source/Host/common/FileSpec.cpp
@@ -1272,207 +1272,21 @@
 void *callback_baton
 )
 {
-if (dir_path && dir_path[0])
-{
-#if _WIN32
-std::string szDir(dir_path);
-szDir += "\\*";
-
-WIN32_FIND_DATA ffd;
-HANDLE hFind = FindFirstFile(szDir.c_str(), &ffd);
-
-if (hFind == INVALID_HANDLE_VALUE)
-{
-return eEnumerateDirectoryResultNext;
-}
-
-do
-{
-bool call_callback = false;
-FileSpec::FileType file_type = eFileTypeUnknown;
-if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-{
-size_t len = strlen(ffd.cFileName);
-
-if (len == 1 && ffd.cFileName[0] == '.')
-continue;
-
-if (len == 2 && ffd.cFileName[0] == '.' && ffd.cFileName[1] == '.')
-continue;
-
-file_type = eFileTypeDirectory;
-call_callback = find_directories;
-}
-else if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DEVICE)
-{
-file_type = eFileTypeOther;
-call_callback = find_other;
-}
-else
-{
-file_type = eFileTypeRegular;
-call_callback = find_files;
-}
-if (call_callback)
-{
-char child_path[MAX_PATH];
-const int child_path_len = ::snprintf (child_path, sizeof(child_path), "%s\\%s", dir_path, ffd.cFileName);
-if (child_path_len < (int)(sizeof(child_path) - 1))
+return ForEachItemInDirectory(dir_path,
+[&find_directories, &find_files, &find_other, &callback, &callback_baton]
+(FileType file_type, const FileSpec &file_spec) {
+switch (file_type)
 {
-// Don't resolve the file type or path
-FileSpec child_path_spec (child_path, false);
-
-EnumerateDirectoryResult result = callback (callback_baton, file_type, child_path_spec);
-
-switch (result)
-{
-case eEnumerateDirectoryResultNext:
-// Enumerate next entry in the current directory. We just
-// exit this switch and will continue enumerating the
-// current directory as we currently are...
-break;
-
-case eEnumerateDirectoryResultEnter: // Recurse into the current entry if it is a directory or symlink, or next if not
-if (FileSpec::EnumerateDirectory(child_path,
-find_directories,
-find_files,
-find_other,
-callback,
-callback_baton) == eEnumerateDirectoryResultQuit)
-{
-// The subdirectory returned Quit, which means to 
-// stop all directory enumerations at all levels.
-return eEnumerateDirectoryResultQuit;
-}
-break;
-
-case eEnumerateDirectoryResultExit:  // Exit from the current directory at the current level.
-// Exit from this directory level and tell parent to 
-// keep enumerating.
-return eEnumerateDirectoryResultNext;
-
-case eEnumerateDirectoryResultQuit:  // Stop directory enumerations at any level
-return eEnumerateDirectoryResultQuit;
-}
-}
-}
-} while (FindNextFile(hFind, &ffd) != 0);
-
-FindClose(hFind);
-#else
-lldb_utility::CleanUp  dir_path_dir(opendir(dir_path), NULL, closedir);
-if (dir_path_dir.is_valid())
-{
-

Re: [Lldb-commits] [PATCH] Replace `rm -rf` with more portable implementation.

2015-06-29 Thread Chaoren Lin
Please let me fix this. I need to redeem myself.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10787

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



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


Re: [Lldb-commits] [PATCH] Replace `rm -rf` with more portable implementation.

2015-06-29 Thread Chaoren Lin
Please let me fix this. I need to redeem myself.

On Mon, Jun 29, 2015 at 10:36 AM, Greg Clayton  wrote:

> Ah, I missed that this was committed. I will fix this.
>
>
> REPOSITORY
>   rL LLVM
>
> http://reviews.llvm.org/D10787
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] [NativeProcessLinux] Refactor PtraceWrapper

2015-06-29 Thread Chaoren Lin

Comment at: source/Plugins/Process/Linux/NativeProcessLinux.h:145
@@ -146,1 +144,3 @@
+static Error
+PtraceWrapper(int req, lldb::pid_t pid, void *addr, void *data, size_t 
data_size, long *result = nullptr);
 

It seems like every argument besides `req` could use a default. (`0` or 
`nullptr`).

http://reviews.llvm.org/D10808

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



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


[Lldb-commits] [lldb] r240894 - timegm in LibcGlue needs to be extern, not static.

2015-06-27 Thread Chaoren Lin
Author: chaoren
Date: Sat Jun 27 18:11:32 2015
New Revision: 240894

URL: http://llvm.org/viewvc/llvm-project?rev=240894&view=rev
Log:
timegm in LibcGlue needs to be extern, not static.

Reviewers: vharron

Reviewed By: vharron

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/Time.h

Modified: lldb/trunk/include/lldb/Host/Time.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Time.h?rev=240894&r1=240893&r2=240894&view=diff
==
--- lldb/trunk/include/lldb/Host/Time.h (original)
+++ lldb/trunk/include/lldb/Host/Time.h Sat Jun 27 18:11:32 2015
@@ -18,7 +18,7 @@
 
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
 #include 
-static time_t timegm(struct tm* t);
+extern time_t timegm(struct tm* t);
 #else
 #include 
 #endif


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


Re: [Lldb-commits] [PATCH] Replace `rm -rf` with more portable implementation.

2015-06-27 Thread Chaoren Lin
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10787

Files:
  lldb/trunk/source/Host/posix/FileSystem.cpp

Index: lldb/trunk/source/Host/posix/FileSystem.cpp
===
--- lldb/trunk/source/Host/posix/FileSystem.cpp
+++ lldb/trunk/source/Host/posix/FileSystem.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Host/FileSystem.h"
 
 // C includes
+#include 
 #include 
 #include 
 #include 
@@ -81,11 +82,25 @@
 {
 if (recurse)
 {
-StreamString command;
-command.Printf("rm -rf \"%s\"", file_spec.GetCString());
-int status = ::system(command.GetString().c_str());
-if (status != 0)
-error.SetError(status, eErrorTypeGeneric);
+DIR *dirp = opendir(file_spec.GetCString());
+if (!dirp)
+{
+error.SetErrorToErrno();
+return error;
+}
+struct dirent *direntp;
+while (error.Success() && (direntp = readdir(dirp)))
+{
+if (direntp->d_type == DT_DIR)
+error = DeleteDirectory(FileSpec{direntp->d_name, false}, 
true);
+else if (::unlink(direntp->d_name) != 0)
+error.SetErrorToErrno();
+}
+if (closedir(dirp) != 0)
+error.SetErrorToErrno();
+if (error.Fail())
+return error;
+return DeleteDirectory(file_spec, false);
 }
 else
 {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Host/posix/FileSystem.cpp
===
--- lldb/trunk/source/Host/posix/FileSystem.cpp
+++ lldb/trunk/source/Host/posix/FileSystem.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Host/FileSystem.h"
 
 // C includes
+#include 
 #include 
 #include 
 #include 
@@ -81,11 +82,25 @@
 {
 if (recurse)
 {
-StreamString command;
-command.Printf("rm -rf \"%s\"", file_spec.GetCString());
-int status = ::system(command.GetString().c_str());
-if (status != 0)
-error.SetError(status, eErrorTypeGeneric);
+DIR *dirp = opendir(file_spec.GetCString());
+if (!dirp)
+{
+error.SetErrorToErrno();
+return error;
+}
+struct dirent *direntp;
+while (error.Success() && (direntp = readdir(dirp)))
+{
+if (direntp->d_type == DT_DIR)
+error = DeleteDirectory(FileSpec{direntp->d_name, false}, true);
+else if (::unlink(direntp->d_name) != 0)
+error.SetErrorToErrno();
+}
+if (closedir(dirp) != 0)
+error.SetErrorToErrno();
+if (error.Fail())
+return error;
+return DeleteDirectory(file_spec, false);
 }
 else
 {
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] timegm in LibcGlue needs to be extern, not static.

2015-06-27 Thread Chaoren Lin
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10778

Files:
  lldb/trunk/include/lldb/Host/Time.h

Index: lldb/trunk/include/lldb/Host/Time.h
===
--- lldb/trunk/include/lldb/Host/Time.h
+++ lldb/trunk/include/lldb/Host/Time.h
@@ -18,7 +18,7 @@
 
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
 #include 
-static time_t timegm(struct tm* t);
+extern time_t timegm(struct tm* t);
 #else
 #include 
 #endif

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/include/lldb/Host/Time.h
===
--- lldb/trunk/include/lldb/Host/Time.h
+++ lldb/trunk/include/lldb/Host/Time.h
@@ -18,7 +18,7 @@
 
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
 #include 
-static time_t timegm(struct tm* t);
+extern time_t timegm(struct tm* t);
 #else
 #include 
 #endif
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r240895 - Replace `rm -rf` with more portable implementation.

2015-06-27 Thread Chaoren Lin
Author: chaoren
Date: Sat Jun 27 18:11:34 2015
New Revision: 240895

URL: http://llvm.org/viewvc/llvm-project?rev=240895&view=rev
Log:
Replace `rm -rf` with more portable implementation.

Reviewers: clayborg, vharron

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Host/posix/FileSystem.cpp

Modified: lldb/trunk/source/Host/posix/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=240895&r1=240894&r2=240895&view=diff
==
--- lldb/trunk/source/Host/posix/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/posix/FileSystem.cpp Sat Jun 27 18:11:34 2015
@@ -10,6 +10,7 @@
 #include "lldb/Host/FileSystem.h"
 
 // C includes
+#include 
 #include 
 #include 
 #include 
@@ -81,11 +82,25 @@ FileSystem::DeleteDirectory(const FileSp
 {
 if (recurse)
 {
-StreamString command;
-command.Printf("rm -rf \"%s\"", file_spec.GetCString());
-int status = ::system(command.GetString().c_str());
-if (status != 0)
-error.SetError(status, eErrorTypeGeneric);
+DIR *dirp = opendir(file_spec.GetCString());
+if (!dirp)
+{
+error.SetErrorToErrno();
+return error;
+}
+struct dirent *direntp;
+while (error.Success() && (direntp = readdir(dirp)))
+{
+if (direntp->d_type == DT_DIR)
+error = DeleteDirectory(FileSpec{direntp->d_name, false}, 
true);
+else if (::unlink(direntp->d_name) != 0)
+error.SetErrorToErrno();
+}
+if (closedir(dirp) != 0)
+error.SetErrorToErrno();
+if (error.Fail())
+return error;
+return DeleteDirectory(file_spec, false);
 }
 else
 {


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


[Lldb-commits] [PATCH] Replace `rm -rf` with more portable implementation.

2015-06-26 Thread Chaoren Lin
Hi vharron, clayborg,

http://reviews.llvm.org/D10787

Files:
  source/Host/posix/FileSystem.cpp

Index: source/Host/posix/FileSystem.cpp
===
--- source/Host/posix/FileSystem.cpp
+++ source/Host/posix/FileSystem.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Host/FileSystem.h"
 
 // C includes
+#include 
 #include 
 #include 
 #include 
@@ -81,11 +82,25 @@
 {
 if (recurse)
 {
-StreamString command;
-command.Printf("rm -rf \"%s\"", file_spec.GetCString());
-int status = ::system(command.GetString().c_str());
-if (status != 0)
-error.SetError(status, eErrorTypeGeneric);
+DIR *dirp = opendir(file_spec.GetCString());
+if (!dirp)
+{
+error.SetErrorToErrno();
+return error;
+}
+struct dirent *direntp;
+while (error.Success() && (direntp = readdir(dirp)))
+{
+if (direntp->d_type == DT_DIR)
+error = DeleteDirectory(FileSpec{direntp->d_name, false}, 
true);
+else if (::unlink(direntp->d_name) != 0)
+error.SetErrorToErrno();
+}
+if (closedir(dirp) != 0)
+error.SetErrorToErrno();
+if (error.Fail())
+return error;
+return DeleteDirectory(file_spec, false);
 }
 else
 {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Host/posix/FileSystem.cpp
===
--- source/Host/posix/FileSystem.cpp
+++ source/Host/posix/FileSystem.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Host/FileSystem.h"
 
 // C includes
+#include 
 #include 
 #include 
 #include 
@@ -81,11 +82,25 @@
 {
 if (recurse)
 {
-StreamString command;
-command.Printf("rm -rf \"%s\"", file_spec.GetCString());
-int status = ::system(command.GetString().c_str());
-if (status != 0)
-error.SetError(status, eErrorTypeGeneric);
+DIR *dirp = opendir(file_spec.GetCString());
+if (!dirp)
+{
+error.SetErrorToErrno();
+return error;
+}
+struct dirent *direntp;
+while (error.Success() && (direntp = readdir(dirp)))
+{
+if (direntp->d_type == DT_DIR)
+error = DeleteDirectory(FileSpec{direntp->d_name, false}, true);
+else if (::unlink(direntp->d_name) != 0)
+error.SetErrorToErrno();
+}
+if (closedir(dirp) != 0)
+error.SetErrorToErrno();
+if (error.Fail())
+return error;
+return DeleteDirectory(file_spec, false);
 }
 else
 {
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] [NativeProcessLinux] Use lambdas in DoOperation calls

2015-06-24 Thread Chaoren Lin

Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:3171
@@ +3170,3 @@
+
+intptr_t data = 0;
+

chaoren wrote:
> Why not make this `void *` to begin with?
Whoops, didn't see the assignment right below. Please ignore this.

http://reviews.llvm.org/D10694

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



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


[Lldb-commits] [lldb] r240371 - Revert "Reduced packet counts to the remote GDB server where possible."

2015-06-22 Thread Chaoren Lin
Author: chaoren
Date: Mon Jun 22 22:17:01 2015
New Revision: 240371

URL: http://llvm.org/viewvc/llvm-project?rev=240371&view=rev
Log:
Revert "Reduced packet counts to the remote GDB server where possible."

This reverts commit 0cc0745ea9c68d7fdcadc9904cee3f13c96dae60.

Due to breakage on Linux build bot:

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/3436

Removed:
lldb/trunk/tools/debugserver/source/JSONGenerator.h
Modified:
lldb/trunk/include/lldb/Core/RangeMap.h
lldb/trunk/include/lldb/Core/StructuredData.h
lldb/trunk/include/lldb/Target/Memory.h
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Core/StructuredData.cpp

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/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/trunk/source/Target/Memory.cpp
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.h

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=240371&r1=240370&r2=240371&view=diff
==
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Mon Jun 22 22:17:01 2015
@@ -128,10 +128,9 @@ namespace lldb_private {
 {
 return Contains(range.GetRangeBase()) && 
ContainsEndInclusive(range.GetRangeEnd());
 }
-
-// Returns true if the two ranges adjoing or intersect
+
 bool
-DoesAdjoinOrIntersect (const Range &rhs) const
+Overlap (const Range &rhs) const
 {
 const BaseType lhs_base = this->GetRangeBase();
 const BaseType rhs_base = rhs.GetRangeBase();
@@ -140,19 +139,7 @@ namespace lldb_private {
 bool result = (lhs_base <= rhs_end) && (lhs_end >= rhs_base);
 return result;
 }
-
-// Returns true if the two ranges intersect
-bool
-DoesIntersect (const Range &rhs) const
-{
-const BaseType lhs_base = this->GetRangeBase();
-const BaseType rhs_base = rhs.GetRangeBase();
-const BaseType lhs_end = this->GetRangeEnd();
-const BaseType rhs_end = rhs.GetRangeEnd();
-bool result = (lhs_base < rhs_end) && (lhs_end > rhs_base);
-return result;
-}
-
+
 bool
 operator < (const Range &rhs) const
 {
@@ -254,7 +241,7 @@ namespace lldb_private {
 // don't end up allocating and making a new collection for no 
reason
 for (pos = m_entries.begin(), end = m_entries.end(), prev = 
end; pos != end; prev = pos++)
 {
-if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
+if (prev != end && prev->Overlap(*pos))
 {
 can_combine = true;
 break;
@@ -268,7 +255,7 @@ namespace lldb_private {
 Collection minimal_ranges;
 for (pos = m_entries.begin(), end = m_entries.end(), prev 
= end; pos != end; prev = pos++)
 {
-if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
+if (prev != end && prev->Overlap(*pos))
 minimal_ranges.back().SetRangeEnd 
(std::max(prev->GetRangeEnd(), pos->GetRangeEnd()));
 else
 minimal_ranges.push_back (*pos);
@@ -534,7 +521,7 @@ namespace lldb_private {
 // don't end up allocating and making a new collection for no 
reason
 for (pos = m_entries.begin(), end = m_entries.end(), prev = 
end; pos != end; prev = pos++)
 {
-if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
+if (prev != end && prev->Overlap(*pos))
 {
 can_combine = true;
 break;
@@ -548,7 +535,7 @@ namespace lldb_private {
 Collection minimal_ranges;
 for (pos = m_entries.begin(), end = m_entries.end(), prev 
= end; pos != end; prev = pos++)
 {
-if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
+if (prev != end && prev->Overlap(*pos))
 minimal_ranges.back().SetRangeEnd 
(std::max(prev->GetRangeEnd(), pos->GetRangeEnd()));
 else
 minimal_ranges.push_back 

[Lldb-commits] [lldb] r239419 - Rename `FileSpec::IsRelativeToCurrentWorkingDirectory` to `IsRelative`.

2015-06-09 Thread Chaoren Lin
Author: chaoren
Date: Tue Jun  9 12:54:27 2015
New Revision: 239419

URL: http://llvm.org/viewvc/llvm-project?rev=239419&view=rev
Log:
Rename `FileSpec::IsRelativeToCurrentWorkingDirectory` to `IsRelative`.

Summary:
`IsRelativeToCurrentWorkingDirectory` was misleading, because relative paths
are sometimes appended to other directories, not just the cwd. Plus, the new
name is shorter. Also added `IsAbsolute` for completeness.

Reviewers: clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Host/linux/HostInfoLinux.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/ProcessLaunchInfo.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=239419&r1=239418&r2=239419&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Tue Jun  9 12:54:27 2015
@@ -365,16 +365,25 @@ public:
 IsSourceImplementationFile () const;
 
 //--
-/// Returns true if the filespec represents path that is relative
-/// path to the current working directory.
+/// Returns true if the filespec represents a relative path.
 ///
 /// @return
-/// \b true if the filespec represents a current working
-/// directory relative path, \b false otherwise.
+/// \b true if the filespec represents a relative path,
+/// \b false otherwise.
 //--
 bool
-IsRelativeToCurrentWorkingDirectory () const;
-
+IsRelative() const;
+
+//--
+/// Returns true if the filespec represents an absolute path.
+///
+/// @return
+/// \b true if the filespec represents an absolute path,
+/// \b false otherwise.
+//--
+bool
+IsAbsolute() const;
+
 TimeValue
 GetModificationTime () const;
 

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=239419&r1=239418&r2=239419&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Tue Jun  9 12:54:27 2015
@@ -1484,7 +1484,7 @@ FileSpec::IsSourceImplementationFile ()
 }
 
 bool
-FileSpec::IsRelativeToCurrentWorkingDirectory () const
+FileSpec::IsRelative() const
 {
 const char *dir = m_directory.GetCString();
 llvm::StringRef directory(dir ? dir : "");
@@ -1519,3 +1519,9 @@ FileSpec::IsRelativeToCurrentWorkingDire
 }
 return false;
 }
+
+bool
+FileSpec::IsAbsolute() const
+{
+return !FileSpec::IsRelative();
+}

Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=239419&r1=239418&r2=239419&view=diff
==
--- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Tue Jun  9 12:54:27 2015
@@ -225,7 +225,7 @@ bool
 HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec)
 {
 if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) &&
-!file_spec.IsRelativeToCurrentWorkingDirectory() &&
+file_spec.IsAbsolute() &&
 file_spec.Exists())
 return true;
 file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory();

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=239419&r1=239418&r2=239419&view=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Tue Jun  9 
12:54:27 2015
@@ -215,7 +215,7 @@ PlatformAndroid::GetFile (const FileSpec
 return PlatformLinux::GetFile(source, destination);
 
 FileSpec source_spec (source.GetPath (false), false, 
FileSpec::ePathSyntaxPosix);
-if (source_spec.IsRelativeToCurrentWorkingDirectory ())
+if (source_spec.IsRelative())
 source_spec = GetRemo

[Lldb-commits] [lldb] r239414 - XFail pexpect tests for Windows hosts.

2015-06-09 Thread Chaoren Lin
Author: chaoren
Date: Tue Jun  9 12:39:27 2015
New Revision: 239414

URL: http://llvm.org/viewvc/llvm-project?rev=239414&view=rev
Log:
XFail pexpect tests for Windows hosts.

Reviewers: vharron, zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py
lldb/trunk/test/functionalities/completion/TestCompletion.py
lldb/trunk/test/functionalities/format/TestFormats.py

lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
lldb/trunk/test/lldbtest.py
lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py

Modified: lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py?rev=239414&r1=239413&r2=239414&view=diff
==
--- lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py (original)
+++ lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py Tue Jun  
9 12:39:27 2015
@@ -12,7 +12,7 @@ class CommandRegexTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureFreeBSD("llvm.org/pr22784: pexpect failing on the FreeBSD 
buildbot")
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 def test_command_regex(self):
 """Test a simple scenario of 'command regex' invocation and subsequent 
use."""
 import pexpect

Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=239414&r1=239413&r2=239414&view=diff
==
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Tue Jun  9 
12:39:27 2015
@@ -20,153 +20,153 @@ class CommandLineCompletionTestCase(Test
 except:
 pass
 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 @skipIfFreeBSD # timing out on the FreeBSD buildbot
 def test_at(self):
 """Test that 'at' completes to 'attach '."""
 self.complete_from_to('at', 'attach ')
 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 @skipIfFreeBSD # timing out on the FreeBSD buildbot
 def test_de(self):
 """Test that 'de' completes to 'detach '."""
 self.complete_from_to('de', 'detach ')
 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 @skipIfFreeBSD # timing out on the FreeBSD buildbot
 def test_process_attach_dash_dash_con(self):
 """Test that 'process attach --con' completes to 'process attach 
--continue '."""
 self.complete_from_to('process attach --con', 'process attach 
--continue ')
 
 # 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 @skipIfFreeBSD # timing out on the FreeBSD buildbot
 def test_infinite_loop_while_completing(self):
 """Test that 'process print hello\' completes to itself and does not 
infinite loop."""
 self.complete_from_to('process print hello\\', 'process print hello\\',
   turn_off_re_match=True)
 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 @skipIfFreeBSD # timing out on the FreeBSD buildbot
 def test_watchpoint_co(self):
 """Test that 'watchpoint co' completes to 'watchpoint command '."""
 self.complete_from_to('watchpoint co', 'watchpoint command ')
 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
+@expectedFailureHostWindows("llvm.org/pr22274: need a pexpect replacement 
for windows")
 @skipIfFreeBSD # timing out on the FreeBSD buildbot
 def test_watchpoint_command_space(self):
 """Test that 'watchpoint command ' completes to ['Available 
completions:', 'add', 'delete', 'list']."""
 self.complete_from_to('watchpoint command ', ['Available 
completions:', 'add', 'delete', 'list'])
 
-@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacem

[Lldb-commits] [lldb] r239258 - Update dosep to display dotest command invoked on failure.

2015-06-07 Thread Chaoren Lin
Author: chaoren
Date: Sun Jun  7 13:50:40 2015
New Revision: 239258

URL: http://llvm.org/viewvc/llvm-project?rev=239258&view=rev
Log:
Update dosep to display dotest command invoked on failure.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=239258&r1=239257&r2=239258&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Sun Jun  7 13:50:40 2015
@@ -76,14 +76,15 @@ def setup_lock_and_counter(lock, counter
 test_counter = counter
 total_tests = total
 
-def update_status(name = None, output = None):
+def update_status(name = None, command = None, output = None):
 global output_lock, test_counter, total_tests
 with output_lock:
 if output is not None:
 print >> sys.stderr
-print >> sys.stderr, 'Test suite %s failed' % name
-print >> sys.stderr, 'stdout:\n' + output[0]
-print >> sys.stderr, 'stderr:\n' + output[1]
+print >> sys.stderr, "Failed test suite: %s" % name
+print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
+print >> sys.stderr, "stdout:\n%s" % output[0]
+print >> sys.stderr, "stderr:\n%s" % output[1]
 sys.stderr.write("\r%*d out of %d test suites processed" %
 (len(str(total_tests)), test_counter.value, total_tests))
 test_counter.value += 1
@@ -125,7 +126,7 @@ def call_with_timeout(command, timeout,
 output = process.communicate()
 exit_status = process.returncode
 passes, failures = parse_test_results(output)
-update_status(name, output if exit_status != 0 else None)
+update_status(name, command, output if exit_status != 0 else None)
 return exit_status, passes, failures
 
 def process_dir(root, files, test_root, dotest_argv):


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


Re: [Lldb-commits] [PATCH] Skip TestInferiorChanged if host platform is windows.

2015-06-05 Thread Chaoren Lin
Actually, if Linux to Windows debugging ever becomes a thing, it'd be
possible for the inferior binary to change since it's on the host (Linux),
and the target (Windows) server can unlink and fetch the new binary.
However, when Windows is the host platform, no matter what the target
platform is, it'll be impossible for the inferior binaries to be modified.
On Jun 5, 2015 21:42, "Chaoren Lin"  wrote:

> The host platform is not necessarily the same as the target platform.
> On Jun 5, 2015 21:41, "Zachary Turner"  wrote:
>
>>
>>
>> On Fri, Jun 5, 2015 at 8:31 PM Chaoren Lin  wrote:
>>
>>> Hi ovyalov, zturner, clayborg,
>>>
>>> Opened files on Windows cannot be modified, so this test doesn't make
>>> sense.
>>>
>>> http://reviews.llvm.org/D10295
>>>
>>> Files:
>>>   test/functionalities/inferior-changed/TestInferiorChanged.py
>>>   test/lldbtest.py
>>>
>>> Index: test/functionalities/inferior-changed/TestInferiorChanged.py
>>> ===
>>> --- test/functionalities/inferior-changed/TestInferiorChanged.py
>>> +++ test/functionalities/inferior-changed/TestInferiorChanged.py
>>> @@ -21,6 +21,7 @@
>>>  self.setTearDownCleanup(dictionary=d)
>>>  self.inferior_not_crashing()
>>>
>>> +@skipIfHostWindows
>>>  def test_inferior_crashing_dwarf(self):
>>>  """Test lldb reloads the inferior after it was changed during
>>> the session."""
>>>  self.buildDwarf()
>>> Index: test/lldbtest.py
>>> ===
>>> --- test/lldbtest.py
>>> +++ test/lldbtest.py
>>> @@ -778,6 +778,10 @@
>>>  """Decorate the item to skip tests that should be skipped on
>>> Windows."""
>>>  return skipIfPlatform(["windows"])(func)
>>>
>>> +def skipIfHostWindows(func):
>>> +"""Decorate the item to skip tests that should be skipped on
>>> Windows."""
>>> +return skipIfHostPlatform(["windows"])(func)
>>> +
>>>
>> How is this different than @skipIfWindows, which we already have?  Seems
>> like we should use one or the other.
>>
>>
>>
>>>  def skipUnlessDarwin(func):
>>>  """Decorate the item to skip tests that should be skipped on any
>>> non Darwin platform."""
>>>  return skipUnlessPlatform(getDarwinOSTriples())(func)
>>> @@ -827,6 +831,16 @@
>>>  func(*args, **kwargs)
>>>  return wrapper
>>>
>>> +def skipIfHostPlatform(oslist):
>>> +"""Decorate the item to skip tests if running on one of the listed
>>> host platforms."""
>>> +return unittest2.skipIf(getHostPlatform() in oslist,
>>> +"skip on %s" % (", ".join(oslist)))
>>> +
>>> +def skipUnlessHostPlatform(oslist):
>>> +"""Decorate the item to skip tests unless running on one of the
>>> listed host platforms."""
>>> +return unittest2.skipUnless(getHostPlatform() in oslist,
>>> +"requires on of %s" % (",
>>> ".join(oslist)))
>>> +
>>>  def skipIfPlatform(oslist):
>>>  """Decorate the item to skip tests if running on one of the listed
>>> platforms."""
>>>  return unittest2.skipIf(getPlatform() in oslist,
>>>
>>> EMAIL PREFERENCES
>>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>>
>>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r239135 - Check before using platform specific attributes.

2015-06-04 Thread Chaoren Lin
Author: chaoren
Date: Fri Jun  5 01:28:43 2015
New Revision: 239135

URL: http://llvm.org/viewvc/llvm-project?rev=239135&view=rev
Log:
Check before using platform specific attributes.

Summary: `os.uname` in TestUniversal and `os.geteuid` in TestTerminal.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/functionalities/tty/TestTerminal.py
lldb/trunk/test/macosx/universal/TestUniversal.py

Modified: lldb/trunk/test/functionalities/tty/TestTerminal.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/tty/TestTerminal.py?rev=239135&r1=239134&r2=239135&view=diff
==
--- lldb/trunk/test/functionalities/tty/TestTerminal.py (original)
+++ lldb/trunk/test/functionalities/tty/TestTerminal.py Fri Jun  5 01:28:43 2015
@@ -20,7 +20,8 @@ class LaunchInTerminalTestCase(TestBase)
 
 # If the test is being run under sudo, the spawned terminal won't retain 
that elevated
 # privilege so it can't open the socket to talk back to the test case
-@unittest2.skipUnless(os.geteuid() != 0, "test cannot be run as root")
+@unittest2.skipUnless(not hasattr(os, 'geteuid') or os.geteuid() != 0,
+"test cannot be run as root")
 
 # Do we need to disable this test if the testsuite is being run on a 
remote system?
 # This env var is only defined when the shell is running in a local mac 
terminal window

Modified: lldb/trunk/test/macosx/universal/TestUniversal.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/TestUniversal.py?rev=239135&r1=239134&r2=239135&view=diff
==
--- lldb/trunk/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/test/macosx/universal/TestUniversal.py Fri Jun  5 01:28:43 2015
@@ -18,7 +18,8 @@ class UniversalTestCase(TestBase):
 
 @python_api_test
 @skipUnlessDarwin
-@unittest2.skipUnless(os.uname()[4] in ['i386', 'x86_64'], "requires i386 
or x86_64")
+@unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 
'x86_64'],
+"requires i386 or x86_64")
 def test_sbdebugger_create_target_with_file_and_target_triple(self):
 """Test the SBDebugger.CreateTargetWithFileAndTargetTriple() API."""
 # Invoke the default build rule.
@@ -36,7 +37,8 @@ class UniversalTestCase(TestBase):
 self.assertTrue(process, PROCESS_IS_VALID)
 
 @skipUnlessDarwin
-@unittest2.skipUnless(os.uname()[4] in ['i386', 'x86_64'], "requires i386 
or x86_64")
+@unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 
'x86_64'],
+"requires i386 or x86_64")
 def test_process_launch_for_universal(self):
 """Test process launch of a universal binary."""
 from lldbutil import print_registers


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


[Lldb-commits] [lldb] r238852 - Use new get_signal_number utility function for tests.

2015-06-02 Thread Chaoren Lin
Author: chaoren
Date: Tue Jun  2 12:01:13 2015
New Revision: 238852

URL: http://llvm.org/viewvc/llvm-project?rev=238852&view=rev
Log:
Use new get_signal_number utility function for tests.

Summary:
This fixes TestLldbGdbServer and TestSendSignal from Windows to Android.
This change depends on D10171.

Reviewers: clayborg, ovyalov

Reviewed By: clayborg, ovyalov

Subscribers: tberghammer, lldb-commits

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

Modified:
lldb/trunk/test/functionalities/signal/TestSendSignal.py
lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py

Modified: lldb/trunk/test/functionalities/signal/TestSendSignal.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/signal/TestSendSignal.py?rev=238852&r1=238851&r2=238852&view=diff
==
--- lldb/trunk/test/functionalities/signal/TestSendSignal.py (original)
+++ lldb/trunk/test/functionalities/signal/TestSendSignal.py Tue Jun  2 
12:01:13 2015
@@ -100,7 +100,7 @@ class SendSignalTestCase(TestBase):
 self.match_state(process_listener, lldb.eStateRunning)
 
 # Now signal the process, and make sure it stops:
-process.Signal(signal.SIGUSR1)
+process.Signal(lldbutil.get_signal_number('SIGUSR1'))
 
 self.match_state(process_listener, lldb.eStateStopped)
 
@@ -110,7 +110,8 @@ class SendSignalTestCase(TestBase):
 thread = threads[0]
 
 self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data 
in the event.")
-self.assertTrue(thread.GetStopReasonDataAtIndex(0) == signal.SIGUSR1, 
"The stop signal was SIGUSR1")
+self.assertTrue(thread.GetStopReasonDataAtIndex(0) == 
lldbutil.get_signal_number('SIGUSR1'),
+"The stop signal was SIGUSR1")
 
 if __name__ == '__main__':
 import atexit

Modified: lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py?rev=238852&r1=238851&r2=238852&view=diff
==
--- lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py Tue Jun  2 12:01:13 
2015
@@ -825,8 +825,8 @@ class LldbGdbServerTestCase(gdbremote_te
  # Continue sending the signal number to the continue thread.
  # The commented out packet is a way to do this same operation 
without using
  # a $Hc (but this test is testing $Hc, so we'll stick with 
the former).
- "read packet: $C{0:x}#00".format(signal.SIGUSR1),
- # "read packet: 
$vCont;C{0:x}:{1:x};c#00".format(signal.SIGUSR1, thread_id),
+ "read packet: 
$C{0:x}#00".format(lldbutil.get_signal_number('SIGUSR1')),
+ # "read packet: 
$vCont;C{0:x}:{1:x};c#00".format(lldbutil.get_signal_number('SIGUSR1'), 
thread_id),
 
  # FIXME: Linux does not report the thread stop on the 
delivered signal (SIGUSR1 here).  MacOSX debugserver does.
  # But MacOSX debugserver isn't guaranteeing the thread the 
signal handler runs on, so currently its an XFAIL.
@@ -845,8 +845,8 @@ class LldbGdbServerTestCase(gdbremote_te
 # Ensure the stop signal is the signal we delivered.
 # stop_signo = context.get("stop_signo")
 # self.assertIsNotNone(stop_signo)
-# self.assertEquals(int(stop_signo,16), signal.SIGUSR1)
-
+# self.assertEquals(int(stop_signo,16), 
lldbutil.get_signal_number('SIGUSR1'))
+
 # Ensure the stop thread is the thread to which we delivered the 
signal.
 # stop_thread_id = context.get("stop_thread_id")
 # self.assertIsNotNone(stop_thread_id)
@@ -883,7 +883,7 @@ class LldbGdbServerTestCase(gdbremote_te
 self.init_llgs_test()
 self.buildDwarf()
 self.set_inferior_startup_launch()
-self.Hc_then_Csignal_signals_correct_thread(signal.SIGSEGV)
+
self.Hc_then_Csignal_signals_correct_thread(lldbutil.get_signal_number('SIGSEGV'))
 
 def m_packet_reads_memory(self):
 # This is the memory we will write into the inferior and then ensure 
we can read back with $m.
@@ -1219,7 +1219,7 @@ class LldbGdbServerTestCase(gdbremote_te
 # Verify the stop signal reported was the breakpoint signal number.
 stop_signo = context.get("stop_signo")
 self.assertIsNotNone(stop_signo)
-self.assertEquals(int(stop_signo,16), signal.SIGTRAP)
+self.assertEquals(int(stop_signo,16), 
lldbutil.get_signal_number('SIGTRAP'))
 
 # Ensure we did not receive any output.  If the breakpoint was not 
set, we would
 # see output (from a launched process with captured stdio) printing a 
hello, world message.

[Lldb-commits] [lldb] r238849 - Fix OBJCOPY and AR for Android.

2015-06-02 Thread Chaoren Lin
Author: chaoren
Date: Tue Jun  2 11:43:19 2015
New Revision: 238849

URL: http://llvm.org/viewvc/llvm-project?rev=238849&view=rev
Log:
Fix OBJCOPY and AR for Android.

Summary:
Previously, OBJCOPY was empty because of the missing comma,
and ar was just `ar`.

Reviewers: ovyalov, tberghammer

Subscribers: tberghammer, lldb-commits

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

Modified:
lldb/trunk/test/make/Makefile.rules

Modified: lldb/trunk/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=238849&r1=238848&r2=238849&view=diff
==
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Tue Jun  2 11:43:19 2015
@@ -216,15 +216,19 @@ endif
 # Android specific options
 #--
 ifeq "$(OS)" "Android"
-objcopy_notdir = $(if $(findstring clang,$(1)), \
-  $(subst clang,objcopy,$(1)), \
-   $(if $(findstring gcc,$(1)), \
-$(subst gcc,objcopy,$(1)), \
-$(subst cc,objcopy,$(1))
-objcopy = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
objcopy_notdir,$(notdir $(1,$(call objcopy_notdir,$(1)))
-
 LDFLAGS += -pie
-OBJCOPY = $(call objcopy $(CC))
+replace_with = $(if $(findstring clang,$(1)), \
+$(subst clang,$(2),$(1)), \
+$(if $(findstring gcc,$(1)), \
+ $(subst gcc,$(2),$(1)), \
+ $(subst cc,$(2),$(1
+ifeq "$(notdir $(CC))" "$(CC)"
+replace_cc_with = $(call replace_with,$(CC),$(1))
+else
+replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(notdir 
$(CC)),$(1)))
+endif
+OBJCOPY = $(call replace_cc_with,objcopy)
+AR = $(call replace_cc_with,ar)
 endif
 
 #--


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


Re: [Lldb-commits] [PATCH] Added utility function to get correct signal number from remote platform.

2015-06-01 Thread Chaoren Lin
Whoops.

On Mon, Jun 1, 2015 at 6:27 PM, Oleksiy Vyalov  wrote:

> 
> Comment at: test/lldbutil.py:956
> @@ +955,3 @@
> +continue
> +process = lldb.SBProcess()
> +if not process.IsValid():
> 
> target.GetProcess() ?
>
> http://reviews.llvm.org/D10171
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r238771 - Dump error if dotest itself fails and no tests were run.

2015-06-01 Thread Chaoren Lin
Author: chaoren
Date: Mon Jun  1 14:06:01 2015
New Revision: 238771

URL: http://llvm.org/viewvc/llvm-project?rev=238771&view=rev
Log:
Dump error if dotest itself fails and no tests were run.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=238771&r1=238770&r2=238771&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Mon Jun  1 14:06:01 2015
@@ -125,7 +125,7 @@ def call_with_timeout(command, timeout,
 output = process.communicate()
 exit_status = process.returncode
 passes, failures = parse_test_results(output)
-update_status(name, output if failures > 0 else None)
+update_status(name, output if exit_status != 0 else None)
 return exit_status, passes, failures
 
 def process_dir(root, files, test_root, dotest_argv):
@@ -388,8 +388,10 @@ Run lldb test suite using a separate pro
 touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
 
 print
-print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, 
len(failed), 100.0*len(failed)/num_test_files)
-print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails, 
100.0*all_fails/num_tests)
+print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, 
len(failed),
+(100.0 * len(failed) / num_test_files) if num_test_files > 0 else 
float('NaN'))
+print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails,
+(100.0 * all_fails / num_tests) if num_tests > 0 else float('NaN'))
 if len(failed) > 0:
 failed.sort()
 print "Failing Tests (%d)" % len(failed)


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


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

2015-06-01 Thread Chaoren Lin
Author: chaoren
Date: Mon Jun  1 12:49:25 2015
New Revision: 238765

URL: http://llvm.org/viewvc/llvm-project?rev=238765&view=rev
Log:
Updated dosep.py to output progress and dump std{out,err} on test failure.

Reviewers: vharron, clayborg, zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=238765&r1=238764&r2=238765&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Mon Jun  1 12:49:25 2015
@@ -66,6 +66,28 @@ default_timeout = os.getenv("LLDB_TEST_T
 # Status codes for running command with timeout.
 eTimedOut, ePassed, eFailed = 124, 0, 1
 
+output_lock = None
+test_counter = None
+total_tests = None
+
+def setup_lock_and_counter(lock, counter, total):
+global output_lock, test_counter, total_tests
+output_lock = lock
+test_counter = counter
+total_tests = total
+
+def update_status(name = None, output = None):
+global output_lock, test_counter, total_tests
+with output_lock:
+if output is not None:
+print >> sys.stderr
+print >> sys.stderr, 'Test suite %s failed' % name
+print >> sys.stderr, 'stdout:\n' + output[0]
+print >> sys.stderr, 'stderr:\n' + output[1]
+sys.stderr.write("\r%*d out of %d test suites processed" %
+(len(str(total_tests)), test_counter.value, total_tests))
+test_counter.value += 1
+
 def parse_test_results(output):
 passes = 0
 failures = 0
@@ -84,7 +106,7 @@ def parse_test_results(output):
 pass
 return passes, failures
 
-def call_with_timeout(command, timeout):
+def call_with_timeout(command, timeout, name):
 """Run command with a timeout if possible."""
 """-s QUIT will create a coredump if they are enabled on your system"""
 process = None
@@ -103,6 +125,7 @@ def call_with_timeout(command, timeout):
 output = process.communicate()
 exit_status = process.returncode
 passes, failures = parse_test_results(output)
+update_status(name, output if failures > 0 else None)
 return exit_status, passes, failures
 
 def process_dir(root, files, test_root, dotest_argv):
@@ -132,7 +155,7 @@ def process_dir(root, files, test_root,
 
 timeout = os.getenv("LLDB_%s_TIMEOUT" % timeout_name) or 
default_timeout
 
-exit_status, pass_count, fail_count = call_with_timeout(command, 
timeout)
+exit_status, pass_count, fail_count = call_with_timeout(command, 
timeout, name)
 
 pass_sub_count = pass_sub_count + pass_count
 fail_sub_count = fail_sub_count + fail_count
@@ -169,10 +192,19 @@ def walk_and_invoke(test_directory, test
 for root, dirs, files in os.walk(test_subdir, topdown=False):
 test_work_items.append((root, files, test_directory, dotest_argv))
 
+global output_lock, test_counter, total_tests
+output_lock = multiprocessing.Lock()
+total_tests = len(test_work_items)
+test_counter = multiprocessing.Value('i', 0)
+print >> sys.stderr, "Testing: %d tests, %d threads" % (total_tests, 
num_threads)
+update_status()
+
 # Run the items, either in a pool (for multicore speedup) or
 # calling each individually.
 if num_threads > 1:
-pool = multiprocessing.Pool(num_threads)
+pool = multiprocessing.Pool(num_threads,
+initializer = setup_lock_and_counter,
+initargs = (output_lock, test_counter, total_tests))
 test_results = pool.map(process_dir_worker, test_work_items)
 else:
 test_results = []
@@ -355,6 +387,7 @@ Run lldb test suite using a separate pro
 test_name = os.path.splitext(xtime)[0]
 touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
 
+print
 print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, 
len(failed), 100.0*len(failed)/num_test_files)
 print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails, 
100.0*all_fails/num_tests)
 if len(failed) > 0:


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


[Lldb-commits] [lldb] r238605 - Working directory FileSpec should use remote path syntax to display correctly.

2015-05-29 Thread Chaoren Lin
Author: chaoren
Date: Fri May 29 14:52:37 2015
New Revision: 238605

URL: http://llvm.org/viewvc/llvm-project?rev=238605&view=rev
Log:
Working directory FileSpec should use remote path syntax to display correctly.

Summary: Depends on D9728.

Reviewers: ovyalov, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/Host/common/FileSpec.cpp

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

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=238605&r1=238604&r2=238605&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Fri May 29 14:52:37 2015
@@ -669,8 +669,14 @@ public:
 SetFile (const char *path, bool resolve_path, PathSyntax syntax = 
ePathSyntaxHostNative);
 
 void
+SetFile(const char *path, bool resolve_path, ArchSpec arch);
+
+void
 SetFile(const std::string &path, bool resolve_path, PathSyntax syntax = 
ePathSyntaxHostNative);
 
+void
+SetFile(const std::string &path, bool resolve_path, ArchSpec arch);
+
 bool
 IsResolved () const
 {

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=238605&r1=238604&r2=238605&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri May 29 14:52:37 2015
@@ -345,11 +345,26 @@ FileSpec::SetFile (const char *pathname,
 }
 
 void
+FileSpec::SetFile(const char *pathname, bool resolve, ArchSpec arch)
+{
+return SetFile(pathname, resolve,
+arch.GetTriple().isOSWindows()
+? ePathSyntaxWindows
+: ePathSyntaxPosix);
+}
+
+void
 FileSpec::SetFile(const std::string &pathname, bool resolve, PathSyntax syntax)
 {
 return SetFile(pathname.c_str(), resolve, syntax);
 }
 
+void
+FileSpec::SetFile(const std::string &pathname, bool resolve, ArchSpec arch)
+{
+return SetFile(pathname.c_str(), resolve, arch);
+}
+
 //--
 // Convert to pointer operator. This allows code to check any FileSpec
 // objects to see if they contain anything valid using code such as:

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=238605&r1=238604&r2=238605&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Fri May 29 14:52:37 2015
@@ -2301,7 +2301,7 @@ GDBRemoteCommunicationClient::GetWorking
 return false;
 std::string cwd;
 response.GetHexByteString(cwd);
-working_dir.SetFile(cwd, false);
+working_dir.SetFile(cwd, false, GetHostArchitecture());
 return !cwd.empty();
 }
 return false;


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


[Lldb-commits] [lldb] r238599 - Implement snprintf for MSVC with correct return value.

2015-05-29 Thread Chaoren Lin
Author: chaoren
Date: Fri May 29 14:34:57 2015
New Revision: 238599

URL: http://llvm.org/viewvc/llvm-project?rev=238599&view=rev
Log:
Implement snprintf for MSVC with correct return value.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/windows/win32.h
lldb/trunk/source/Host/windows/Windows.cpp

Modified: lldb/trunk/include/lldb/Host/windows/win32.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/win32.h?rev=238599&r1=238598&r2=238599&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/win32.h (original)
+++ lldb/trunk/include/lldb/Host/windows/win32.h Fri May 29 14:34:57 2015
@@ -52,7 +52,7 @@ typedef unsigned short mode_t;
 
 #ifdef LLDB_DISABLE_PYTHON
 typedef uint32_t pid_t;
-#endif
+#endif // LLDB_DISABLE_PYTHON
 
 int usleep(uint32_t useconds);
 
@@ -63,6 +63,7 @@ char *dirname(char *path);
 
 int strcasecmp(const char* s1, const char* s2);
 int strncasecmp(const char* s1, const char* s2, size_t n);
+int snprintf(char *buffer, size_t count, const char *format, ...);
 
 #define STDIN_FILENO  0
 #define STDOUT_FILENO 1
@@ -73,8 +74,7 @@ int strncasecmp(const char* s1, const ch
 #define S_IFDIR  _S_IFDIR
 #define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
 
-#define snprintf _snprintf
-#endif
+#endif // _MSC_VER
 
 // timespec
 struct timespec

Modified: lldb/trunk/source/Host/windows/Windows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Windows.cpp?rev=238599&r1=238598&r2=238599&view=diff
==
--- lldb/trunk/source/Host/windows/Windows.cpp (original)
+++ lldb/trunk/source/Host/windows/Windows.cpp Fri May 29 14:34:57 2015
@@ -198,8 +198,33 @@ int strncasecmp(const char* s1, const ch
 
 int usleep(uint32_t useconds)
 {
-   Sleep(useconds / 1000);
-   return 0;
+Sleep(useconds / 1000);
+return 0;
+}
+
+int snprintf(char *buffer, size_t count, const char *format, ...)
+{
+int old_errno = errno;
+va_list argptr;
+va_start(argptr, format);
+int r = vsnprintf(buffer, count, format, argptr);
+int new_errno = errno;
+buffer[count-1] = '\0';
+if (r == -1 || r == count)
+{
+FILE *nul = fopen("nul", "w");
+int bytes_written = vfprintf(nul, format, argptr);
+fclose(nul);
+if (bytes_written < count)
+errno = new_errno;
+else
+{
+errno = old_errno;
+r = bytes_written;
+}
+}
+va_end(argptr);
+return r;
 }
 
 #endif // _MSC_VER


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


[Lldb-commits] [lldb] r238594 - Fix hanging test suite when dosep.py is invoked directly.

2015-05-29 Thread Chaoren Lin
Author: chaoren
Date: Fri May 29 13:43:46 2015
New Revision: 238594

URL: http://llvm.org/viewvc/llvm-project?rev=238594&view=rev
Log:
Fix hanging test suite when dosep.py is invoked directly.

Reviewers: zturner, sivachandra

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=238594&r1=238593&r2=238594&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Fri May 29 13:43:46 2015
@@ -92,9 +92,14 @@ def call_with_timeout(command, timeout):
 command = [timeout_command, '-s', 'QUIT', timeout] + command
 # Specifying a value for close_fds is unsupported on Windows when using 
subprocess.PIPE
 if os.name != "nt":
-process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, close_fds=True)
+process = subprocess.Popen(command, stdin=subprocess.PIPE,
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE,
+close_fds=True)
 else:
-process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
+process = subprocess.Popen(command, stdin=subprocess.PIPE,
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
 output = process.communicate()
 exit_status = process.returncode
 passes, failures = parse_test_results(output)


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


[Lldb-commits] [lldb] r238522 - Remove warning when testing for timeout command.

2015-05-28 Thread Chaoren Lin
Author: chaoren
Date: Thu May 28 18:00:10 2015
New Revision: 238522

URL: http://llvm.org/viewvc/llvm-project?rev=238522&view=rev
Log:
Remove warning when testing for timeout command.

Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=238522&r1=238521&r2=238522&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Thu May 28 18:00:10 2015
@@ -48,12 +48,12 @@ def get_timeout_command():
 if sys.platform.startswith("win32"):
 return None
 try:
-subprocess.call("timeout")
+subprocess.call("timeout", stderr=subprocess.PIPE)
 return "timeout"
 except OSError:
 pass
 try:
-subprocess.call("gtimeout")
+subprocess.call("gtimeout", stderr=subprocess.PIPE)
 return "gtimeout"
 except OSError:
 pass


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


[Lldb-commits] [lldb] r238510 - Simplify regex in TestDataFormatterUnordered.py for better readability.

2015-05-28 Thread Chaoren Lin
Author: chaoren
Date: Thu May 28 16:52:07 2015
New Revision: 238510

URL: http://llvm.org/viewvc/llvm-project?rev=238510&view=rev
Log:
Simplify regex in TestDataFormatterUnordered.py for better readability.

Summary:
Using `(match){3}` instead of `matchmatchmatch`.
This is an update to D10078.

Test Plan: no change in test behavior.

Reviewers: clayborg, sivachandra

Reviewed By: sivachandra

Subscribers: lldb-commits

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

Modified:

lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py

Modified: 
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py?rev=238510&r1=238509&r2=238510&view=diff
==
--- 
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
 (original)
+++ 
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
 Thu May 28 16:52:07 2015
@@ -61,12 +61,28 @@ class LibcxxUnorderedDataFormatterTestCa
 
 self.expect('image list', substrs = self.getLibcPlusPlusLibs())
 
-self.look_for_content_and_continue("map", ['size=5 {', 'hello', 
'world', 'this', 'is', 'me'])
-self.look_for_content_and_continue("mmap", ['size=6 {', 'first = 3', 
'second = "this"', 'first = 2', 'second = "hello"'])
-self.look_for_content_and_continue("iset", ['size=5 {', '\[\d\] = 5', 
'\[\d\] = 3', '\[\d\] = 2'])
-self.look_for_content_and_continue("sset", ['size=5 {', '\[\d\] = 
"is"', '\[\d\] = "world"', '\[\d\] = "hello"'])
-self.look_for_content_and_continue("imset", ['size=6 {', '\[\d\] = 
3(\\n|.)+\[\d\] = 3(\\n|.)+\[\d\] = 3', '\[\d\] = 2', '\[\d\] = 1'])
-self.look_for_content_and_continue("smset", ['size=5 {', '\[\d\] = 
"is"(\\n|.)+\[\d\] = "is"', '\[\d\] = "world"(\\n|.)+\[\d\] = "world"'])
+self.look_for_content_and_continue(
+"map", ['size=5 {', 'hello', 'world', 'this', 'is', 'me'])
+
+self.look_for_content_and_continue(
+"mmap", ['size=6 {', 'first = 3', 'second = "this"',
+ 'first = 2', 'second = "hello"'])
+
+self.look_for_content_and_continue(
+"iset", ['size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2'])
+
+self.look_for_content_and_continue(
+"sset", ['size=5 {', '\[\d\] = "is"', '\[\d\] = "world"',
+ '\[\d\] = "hello"'])
+
+self.look_for_content_and_continue(
+"imset", ['size=6 {', '(\[\d\] = 3(\\n|.)+){3}',
+  '\[\d\] = 2', '\[\d\] = 1'])
+
+self.look_for_content_and_continue(
+"smset",
+['size=5 {', '(\[\d\] = "is"(\\n|.)+){2}',
+ '(\[\d\] = "world"(\\n|.)+){2}'])
 
 if __name__ == '__main__':
 import atexit


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


[Lldb-commits] [lldb] r238460 - Allow both MSVC and Itanium mangling schemes.

2015-05-28 Thread Chaoren Lin
Author: chaoren
Date: Thu May 28 14:15:31 2015
New Revision: 238460

URL: http://llvm.org/viewvc/llvm-project?rev=238460&view=rev
Log:
Allow both MSVC and Itanium mangling schemes.

Summary:
LLDB on Windows should now be able to demangle Linux/Android symbols.

Also updated CxaDemangle.cpp to be compatible with MSVC.

Depends on D9949, D9954, D10048.

Reviewers: zturner, emaste, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Core/Mangled.h
lldb/trunk/source/Core/CxaDemangle.cpp
lldb/trunk/source/Core/Mangled.cpp

Modified: lldb/trunk/include/lldb/Core/Mangled.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Mangled.h?rev=238460&r1=238459&r2=238460&view=diff
==
--- lldb/trunk/include/lldb/Core/Mangled.h (original)
+++ lldb/trunk/include/lldb/Core/Mangled.h Thu May 28 14:15:31 2015
@@ -41,6 +41,13 @@ public:
 ePreferDemangledWithoutArguments
 };
 
+enum ManglingScheme
+{
+eManglingSchemeNone = 0,
+eManglingSchemeMSVC,
+eManglingSchemeItanium
+};
+
 //--
 /// Default constructor.
 ///

Modified: lldb/trunk/source/Core/CxaDemangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CxaDemangle.cpp?rev=238460&r1=238459&r2=238460&view=diff
==
--- lldb/trunk/source/Core/CxaDemangle.cpp (original)
+++ lldb/trunk/source/Core/CxaDemangle.cpp Thu May 28 14:15:31 2015
@@ -8,9 +8,18 @@
 // - Stripped GCC attributes()
 // - Removed extern "C" from the cxa_demangle function
 // - Added "#undef _LIBCPP_EXTERN_TEMPLATE" to avoid warning
+// - Implemented missing rebind, construct, destroy in malloc_alloc
+// - Replaced noexcept, constexpr, alignas with their LLVM_* equivalents
+// - Included win32.h for snprintf implementation for MSVC
+// - Removed constexpr member initialization for MSVC
+// - Changed argument to alignas() to a literal for MSVC
 //--
 
-#undef _LIBCPP_EXTERN_TEMPLATE // Avoid warning below
+#if defined(_MSC_VER)
+#include "lldb/Host/windows/win32.h" // snprintf
+#endif
+#include "llvm/Support/Compiler.h"   // LLVM_{NOEXCEPT, CONSTEXPR, ALIGNAS}
+#undef _LIBCPP_EXTERN_TEMPLATE   // Avoid warning below
 
 //===-- cxa_demangle.cpp 
--===//
 //
@@ -152,20 +161,20 @@ struct float_data
 {
 static const size_t mangled_size = 8;
 static const size_t max_demangled_size = 24;
-static constexpr const char* spec = "%af";
+static const char* spec;
 };
 
-constexpr const char* float_data::spec;
+const char* float_data::spec = "%af";
 
 template <>
 struct float_data
 {
 static const size_t mangled_size = 16;
 static const size_t max_demangled_size = 32;
-static constexpr const char* spec = "%a";
+static const char* spec;
 };
 
-constexpr const char* float_data::spec;
+const char* float_data::spec = "%a";
 
 template <>
 struct float_data
@@ -176,10 +185,10 @@ struct float_data
 static const size_t mangled_size = 20;  // May need to be adjusted to 16 
or 24 on other platforms
 #endif
 static const size_t max_demangled_size = 40;
-static constexpr const char* spec = "%LaL";
+static const char* spec;
 };
 
-constexpr const char* float_data::spec;
+const char* float_data::spec = "%LaL";
 
 template 
 const char*
@@ -4722,27 +4731,27 @@ template 
 class arena
 {
 static const std::size_t alignment = 16;
-alignas(alignment) char buf_[N];
+LLVM_ALIGNAS(16) char buf_[N];
 char* ptr_;
 
 std::size_t 
-align_up(std::size_t n) noexcept
+align_up(std::size_t n) LLVM_NOEXCEPT
 {return (n + (alignment-1)) & ~(alignment-1);}
 
 bool
-pointer_in_buffer(char* p) noexcept
+pointer_in_buffer(char* p) LLVM_NOEXCEPT
 {return buf_ <= p && p <= buf_ + N;}
 
 public:
-arena() noexcept : ptr_(buf_) {}
+arena() LLVM_NOEXCEPT : ptr_(buf_) {}
 ~arena() {ptr_ = nullptr;}
 arena(const arena&) = delete;
 arena& operator=(const arena&) = delete;
 
 char* allocate(std::size_t n);
-void deallocate(char* p, std::size_t n) noexcept;
+void deallocate(char* p, std::size_t n) LLVM_NOEXCEPT;
 
-static constexpr std::size_t size() {return N;}
+static LLVM_CONSTEXPR std::size_t size() {return N;}
 std::size_t used() const {return static_cast(ptr_ - buf_);}
 void reset() {ptr_ = buf_;}
 };
@@ -4763,7 +4772,7 @@ arena::allocate(std::size_t n)
 
 template 
 void
-arena::deallocate(char* p, std::size_t n) noexcept
+arena::deallocate(char* p, std::size_t n) LLVM_NOEXCEPT
 {
 if (pointer_in_buffer(p))
 {
@@ -4785,9 +4794,9 @@ public:
 public:
 tem

Re: [Lldb-commits] [PATCH] [TestDataFormatterUnordered] Use patterns to match unordered_set elements

2015-05-27 Thread Chaoren Lin
I think it makes sense to update 64 and 65 as well.

On Wed, May 27, 2015 at 5:29 PM, Siva Chandra 
wrote:

> 
> Comment at:
> test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py:66
> @@ -65,5 +65,3 @@
>  self.look_for_content_and_continue("mmap",['size=6 {','first =
> 3','second = "this"','first = 2','second = "hello"'])
> -self.look_for_content_and_continue("iset",['size=5 {','[0] =
> 5','[2] = 3','[3] = 2'])
> -self.look_for_content_and_continue("sset",['size=5 {','[0] =
> "is"','[1] = "world"','[4] = "hello"'])
> -self.look_for_content_and_continue("imset",['size=6 {','[0] =
> 3','[1] = 3','[2] = 3','[4] = 2','[5] = 1'])
> -self.look_for_content_and_continue("smset",['size=5 {','[0] =
> "is"','[1] = "is"','[2] = "world"','[3] = "world"'])
> +self.look_for_content_and_continue("iset",['size=5 {','\[\d\] =
> 5','\[\d\] = 3','\[\d\] = 2'])
> +self.look_for_content_and_continue("sset",['size=5 {','\[\d\] =
> "is"','\[\d\] = "world"','\[\d\] = "hello"'])
> 
> chaoren wrote:
> > Could you please add a space after each comma for readability? It'd be
> even nicer if they're all lined up.
> I thought about it. If I add spaces here, would be odd if I do not add for
> lines 64 and 65. However, these lines are beyond the scope of this patch
> IMO.
>
> That said, anything for an LGTM: Should I only update 66-69, or all of
> 64-69?
>
> http://reviews.llvm.org/D10078
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Make FileSpec::Dump use FileSpec::GetPath(), not the other way around.

2015-05-27 Thread Chaoren Lin
>
> GetPath() is supposed to have not put a trailing slash in that case.


But it should (the only case in which it should). `'/'`(root directory) is
not the same as an empty (invalid) path.

On Wed, May 27, 2015 at 4:11 PM, Zachary Turner  wrote:

> GetPath() is supposed to have not put a trailing slash in that case. See
> the call to rtrim() in GetPath()
> On Wed, May 27, 2015 at 3:14 PM Chaoren Lin  wrote:
>
>> 
>> Comment at: source/Host/common/FileSpec.cpp:630
>> @@ +629,3 @@
>> +std::string path = GetPath();
>> +if (!m_filename && !path.empty())
>> +path.push_back(GetPathSeparator());
>> 
>> What if `path == "/"`?
>>
>> 
>> Comment at: source/Host/common/FileSpec.cpp:844
>> @@ +843,3 @@
>> +{
>> +if (m_directory)
>> +path.push_back('/');
>> 
>> What if `m_directory == '/'`? We'd get `//filename`.
>>
>> http://reviews.llvm.org/D9942
>>
>> EMAIL PREFERENCES
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>>
>>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r237966 - Fix lldb-platform usage string.

2015-05-21 Thread Chaoren Lin
Author: chaoren
Date: Thu May 21 17:43:43 2015
New Revision: 237966

URL: http://llvm.org/viewvc/llvm-project?rev=237966&view=rev
Log:
Fix lldb-platform usage string.

Modified:
lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=237966&r1=237965&r2=237966&view=diff
==
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Thu May 21 17:43:43 2015
@@ -93,7 +93,8 @@ signal_handler(int signo)
 static void
 display_usage (const char *progname, const char *subcommand)
 {
-fprintf(stderr, "Usage:\n  %s %s [--log-file log-file-path] [--log-flags 
flags] --listen port\n", progname, subcommand);
+fprintf(stderr, "Usage:\n  %s %s [--server] --listen port\n",
+progname, subcommand);
 exit(0);
 }
 


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


Re: [Lldb-commits] [PATCH] [TestAttachDenied] Use a file instead of a pipe for synchronization.

2015-05-14 Thread Chaoren Lin
The workaround is for Android, the timeout is for Linux. I don't think
they're related.

On Thu, May 14, 2015 at 6:56 PM, Oleksiy Vyalov  wrote:

> With this CL in is
> https://github.com/llvm-mirror/lldb/commit/8aca555d92918451fd852a71f6432c40b5bd7723
> still relevant?
>
>
> http://reviews.llvm.org/D9768
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r237016 - Doc talks about Platform_RunCommand while we actually use Platform_shell.

2015-05-11 Thread Chaoren Lin
Author: chaoren
Date: Mon May 11 14:48:37 2015
New Revision: 237016

URL: http://llvm.org/viewvc/llvm-project?rev=237016&view=rev
Log:
Doc talks about Platform_RunCommand while we actually use Platform_shell.

Modified:
lldb/trunk/docs/lldb-gdb-remote.txt

Modified: lldb/trunk/docs/lldb-gdb-remote.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-gdb-remote.txt?rev=237016&r1=237015&r2=237016&view=diff
==
--- lldb/trunk/docs/lldb-gdb-remote.txt (original)
+++ lldb/trunk/docs/lldb-gdb-remote.txt Mon May 11 14:48:37 2015
@@ -474,7 +474,7 @@ invalidate-regs
 change depending on if the mode has changed. 
 
 //--
-// "qPlatform_RunCommand"
+// "qPlatform_shell"
 //
 // BRIEF
 //  Run a command in a shell on the connected remote machine.
@@ -494,7 +494,7 @@ of captured program output.
 
 Below is an example communication from a client sending an "ls -la" command:
 
-send packet: $qPlatform_RunCommand:6c73202d6c61,0002#ec
+send packet: $qPlatform_shell:6c73202d6c61,0002#ec
 read packet: $F,,,total 4736
 drwxrwxr-x 16 username groupname4096 Aug 15 21:36 .
 drwxr-xr-x 17 username groupname4096 Aug 10 16:39 ..


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


[Lldb-commits] [lldb] r236688 - Fix adb forward in gdbremote_testcase to support multiple devices.

2015-05-06 Thread Chaoren Lin
Author: chaoren
Date: Wed May  6 20:42:53 2015
New Revision: 236688

URL: http://llvm.org/viewvc/llvm-project?rev=236688&view=rev
Log:
Fix adb forward in gdbremote_testcase to support multiple devices.

Summary: Update to D9510.

Reviewers: chying, tberghammer, ovyalov

Reviewed By: ovyalov

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py

Modified: lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py?rev=236688&r1=236687&r2=236688&view=diff
==
--- lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py Wed May  6 20:42:53 
2015
@@ -62,7 +62,12 @@ class GdbRemoteTestCaseBase(TestBase):
 self.stub_sends_two_stop_notifications_on_kill = False
 if lldb.platform_url:
 scheme, host = re.match('(.+)://(.+):\d+', 
lldb.platform_url).groups()
-self.stub_hostname = 'localhost' if scheme == 'adb' else host
+if scheme == 'adb':
+self.stub_device = host
+self.stub_hostname = 'localhost'
+else:
+self.stub_device = None
+self.stub_hostname = host
 else:
 self.stub_hostname = "localhost"
 
@@ -177,11 +182,12 @@ class GdbRemoteTestCaseBase(TestBase):
 # when the process truly dies.
 self.stub_sends_two_stop_notifications_on_kill = True
 
-def forward_adb_port(self, source, target, direction):
+def forward_adb_port(self, source, target, direction, device):
+adb = [ 'adb' ] + ([ '-s', device ] if device else []) + [ direction ]
 def remove_port_forward():
-subprocess.call(["adb", direction, "--remove", "tcp:%d" % source])
-
-subprocess.call(["adb", direction, "tcp:%d" % source, "tcp:%d" % 
target])
+subprocess.call(adb + [ "--remove", "tcp:%d" % source])
+
+subprocess.call(adb + [ "tcp:%d" % source, "tcp:%d" % target])
 self.addTearDownHook(remove_port_forward)
 
 def create_socket(self):
@@ -190,7 +196,7 @@ class GdbRemoteTestCaseBase(TestBase):
 
 triple = self.dbg.GetSelectedPlatform().GetTriple()
 if re.match(".*-.*-.*-android", triple):
-self.forward_adb_port(self.port, self.port, "forward")
+self.forward_adb_port(self.port, self.port, "forward", 
self.stub_device)
 
 connect_info = (self.stub_hostname, self.port)
 sock.connect(connect_info)


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


[Lldb-commits] [lldb] r236543 - Fix typo. platfrom -> platform

2015-05-05 Thread Chaoren Lin
Author: chaoren
Date: Tue May  5 15:34:36 2015
New Revision: 236543

URL: http://llvm.org/viewvc/llvm-project?rev=236543&view=rev
Log:
Fix typo. platfrom -> platform

Modified:
lldb/trunk/test/dotest.py
lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py

Modified: lldb/trunk/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=236543&r1=236542&r2=236543&view=diff
==
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Tue May  5 15:34:36 2015
@@ -1336,7 +1336,7 @@ if lldb_platform_name:
 if lldb_platform_url:
 # We must connect to a remote platform if a LLDB platform URL was 
specified
 print "Connecting to remote platform '%s' at '%s'..." % 
(lldb_platform_name, lldb_platform_url)
-lldb.platfrom_url = lldb_platform_url
+lldb.platform_url = lldb_platform_url
 platform_connect_options = 
lldb.SBPlatformConnectOptions(lldb_platform_url)
 err = lldb.remote_platform.ConnectRemote(platform_connect_options)
 if err.Success():
@@ -1345,7 +1345,7 @@ if lldb_platform_name:
 print "error: failed to connect to remote platform using URL '%s': 
%s" % (lldb_platform_url, err)
 exitTestSuite(1)
 else:
-lldb.platfrom_url = None
+lldb.platform_url = None
 
 if lldb_platform_working_dir:
 print "Setting remote platform working directory to '%s'..." % 
(lldb_platform_working_dir)
@@ -1356,7 +1356,7 @@ if lldb_platform_name:
 else:
 lldb.remote_platform = None
 lldb.remote_platform_working_dir = None
-lldb.platfrom_url = None
+lldb.platform_url = None
 
 target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
 

Modified: lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py?rev=236543&r1=236542&r2=236543&view=diff
==
--- lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py Tue May  5 15:34:36 
2015
@@ -60,8 +60,8 @@ class GdbRemoteTestCaseBase(TestBase):
 self.named_pipe = None
 self.named_pipe_fd = None
 self.stub_sends_two_stop_notifications_on_kill = False
-if lldb.platfrom_url:
-self.stub_hostname = re.match(".*://(.*):[0-9]+", 
lldb.platfrom_url).group(1)
+if lldb.platform_url:
+self.stub_hostname = re.match(".*://(.*):[0-9]+", 
lldb.platform_url).group(1)
 else:
 self.stub_hostname = "localhost"
 


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


[Lldb-commits] [lldb] r236138 - lldb-gdbserver should not use unnamed pipes on Windows.

2015-04-29 Thread Chaoren Lin
Author: chaoren
Date: Wed Apr 29 14:01:43 2015
New Revision: 236138

URL: http://llvm.org/viewvc/llvm-project?rev=236138&view=rev
Log:
lldb-gdbserver should not use unnamed pipes on Windows.

Modified:
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=236138&r1=236137&r2=236138&view=diff
==
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Wed Apr 29 14:01:43 2015
@@ -344,8 +344,12 @@ writePortToPipe(const char *const named_
 Error
 writePortToPipe(int unnamed_pipe_fd, const uint16_t port)
 {
+#if defined(_WIN32)
+return Error("Unnamed pipes are not supported on Windows.");
+#else
 Pipe port_pipe{Pipe::kInvalidDescriptor, unnamed_pipe_fd};
 return WritePortToPipe(port_pipe, port);
+#endif
 }
 
 void


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


[Lldb-commits] [lldb] r236136 - Expose Close{Read/Write}FileDescriptor for pipes.

2015-04-29 Thread Chaoren Lin
Author: chaoren
Date: Wed Apr 29 13:25:18 2015
New Revision: 236136

URL: http://llvm.org/viewvc/llvm-project?rev=236136&view=rev
Log:
Expose Close{Read/Write}FileDescriptor for pipes.

Modified:
lldb/trunk/include/lldb/Host/PipeBase.h
lldb/trunk/include/lldb/Host/posix/PipePosix.h
lldb/trunk/include/lldb/Host/windows/PipeWindows.h
lldb/trunk/source/Host/windows/PipeWindows.cpp

Modified: lldb/trunk/include/lldb/Host/PipeBase.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PipeBase.h?rev=236136&r1=236135&r2=236136&view=diff
==
--- lldb/trunk/include/lldb/Host/PipeBase.h (original)
+++ lldb/trunk/include/lldb/Host/PipeBase.h Wed Apr 29 13:25:18 2015
@@ -40,6 +40,8 @@ class PipeBase
 virtual int GetWriteFileDescriptor() const = 0;
 virtual int ReleaseReadFileDescriptor() = 0;
 virtual int ReleaseWriteFileDescriptor() = 0;
+virtual void CloseReadFileDescriptor() = 0;
+virtual void CloseWriteFileDescriptor() = 0;
 
 // Close both descriptors
 virtual void Close() = 0;

Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=236136&r1=236135&r2=236136&view=diff
==
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Wed Apr 29 13:25:18 2015
@@ -56,6 +56,11 @@ public:
 ReleaseReadFileDescriptor() override;
 int
 ReleaseWriteFileDescriptor() override;
+void
+CloseReadFileDescriptor() override;
+void
+CloseWriteFileDescriptor() override;
+
 
 // Close both descriptors
 void
@@ -69,11 +74,6 @@ public:
 Error
 ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds 
&timeout, size_t &bytes_read) override;
 
-void
-CloseReadFileDescriptor();
-void
-CloseWriteFileDescriptor();
-
 private:
 int m_fds[2];
 };

Modified: lldb/trunk/include/lldb/Host/windows/PipeWindows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PipeWindows.h?rev=236136&r1=236135&r2=236136&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/PipeWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PipeWindows.h Wed Apr 29 13:25:18 2015
@@ -42,6 +42,8 @@ class PipeWindows : public PipeBase
 int GetWriteFileDescriptor() const override;
 int ReleaseReadFileDescriptor() override;
 int ReleaseWriteFileDescriptor() override;
+void CloseReadFileDescriptor() override;
+void CloseWriteFileDescriptor() override;
 
 void Close() override;
 
@@ -57,9 +59,6 @@ class PipeWindows : public PipeBase
   private:
 Error OpenNamedPipe(llvm::StringRef name, bool child_process_inherit, bool 
is_read);
 
-void CloseReadEndpoint();
-void CloseWriteEndpoint();
-
 HANDLE m_read;
 HANDLE m_write;
 

Modified: lldb/trunk/source/Host/windows/PipeWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/PipeWindows.cpp?rev=236136&r1=236135&r2=236136&view=diff
==
--- lldb/trunk/source/Host/windows/PipeWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/PipeWindows.cpp Wed Apr 29 13:25:18 2015
@@ -85,7 +85,7 @@ PipeWindows::CreateNew(llvm::StringRef n
 Error result = OpenNamedPipe(name, child_process_inherit, false);
 if (!result.Success())
 {
-CloseReadEndpoint();
+CloseReadFileDescriptor();
 return result;
 }
 
@@ -215,7 +215,7 @@ PipeWindows::ReleaseWriteFileDescriptor(
 }
 
 void
-PipeWindows::CloseReadEndpoint()
+PipeWindows::CloseReadFileDescriptor()
 {
 if (!CanRead())
 return;
@@ -229,7 +229,7 @@ PipeWindows::CloseReadEndpoint()
 }
 
 void
-PipeWindows::CloseWriteEndpoint()
+PipeWindows::CloseWriteFileDescriptor()
 {
 if (!CanWrite())
 return;
@@ -243,8 +243,8 @@ PipeWindows::CloseWriteEndpoint()
 void
 PipeWindows::Close()
 {
-CloseReadEndpoint();
-CloseWriteEndpoint();
+CloseReadFileDescriptor();
+CloseWriteFileDescriptor();
 }
 
 Error


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


[Lldb-commits] [lldb] r236133 - Add file descriptor constructor for PipePosix.

2015-04-29 Thread Chaoren Lin
Author: chaoren
Date: Wed Apr 29 12:36:58 2015
New Revision: 236133

URL: http://llvm.org/viewvc/llvm-project?rev=236133&view=rev
Log:
Add file descriptor constructor for PipePosix.

Modified:
lldb/trunk/include/lldb/Host/posix/PipePosix.h
lldb/trunk/source/Host/posix/PipePosix.cpp
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=236133&r1=236132&r2=236133&view=diff
==
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Wed Apr 29 12:36:58 2015
@@ -28,6 +28,7 @@ public:
 static int kInvalidDescriptor;
 
 PipePosix();
+PipePosix(int read_fd, int write_fd);
 
 ~PipePosix() override;
 
@@ -36,8 +37,6 @@ public:
 Error
 CreateNew(llvm::StringRef name, bool child_process_inherit) override;
 Error
-CreateWithFD(int read_fd, int write_fd);
-Error
 CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, 
llvm::SmallVectorImpl& name) override;
 Error
 OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;

Modified: lldb/trunk/source/Host/posix/PipePosix.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/PipePosix.cpp?rev=236133&r1=236132&r2=236133&view=diff
==
--- lldb/trunk/source/Host/posix/PipePosix.cpp (original)
+++ lldb/trunk/source/Host/posix/PipePosix.cpp Wed Apr 29 12:36:58 2015
@@ -129,10 +129,10 @@ SelectIO(int handle, bool is_read, const
 }
 
 PipePosix::PipePosix()
-{
-m_fds[READ] = PipePosix::kInvalidDescriptor;
-m_fds[WRITE] = PipePosix::kInvalidDescriptor;
-}
+: m_fds{PipePosix::kInvalidDescriptor, PipePosix::kInvalidDescriptor} {}
+
+PipePosix::PipePosix(int read_fd, int write_fd)
+: m_fds{read_fd, write_fd} {}
 
 PipePosix::~PipePosix()
 {
@@ -187,15 +187,6 @@ PipePosix::CreateNew(llvm::StringRef nam
 }
 
 Error
-PipePosix::CreateWithFD(int read_fd, int write_fd) {
-if (CanRead() || CanWrite())
-return Error("Pipe is already opened");
-m_fds[READ] = read_fd;
-m_fds[WRITE] = write_fd;
-return Error();
-}
-
-Error
 PipePosix::CreateWithUniqueName(llvm::StringRef prefix, bool 
child_process_inherit, llvm::SmallVectorImpl& name)
 {
 llvm::SmallString named_pipe_path;

Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=236133&r1=236132&r2=236133&view=diff
==
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Wed Apr 29 12:36:58 2015
@@ -344,11 +344,7 @@ writePortToPipe(const char *const named_
 Error
 writePortToPipe(int unnamed_pipe_fd, const uint16_t port)
 {
-Pipe port_pipe;
-// Wait for 10 seconds for pipe to be opened.
-auto error = port_pipe.CreateWithFD(Pipe::kInvalidDescriptor, 
unnamed_pipe_fd);
-if (error.Fail())
-return error;
+Pipe port_pipe{Pipe::kInvalidDescriptor, unnamed_pipe_fd};
 return WritePortToPipe(port_pipe, port);
 }
 


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


[Lldb-commits] [lldb] r236132 - Remove trap code from disassembly.

2015-04-29 Thread Chaoren Lin
Author: chaoren
Date: Wed Apr 29 12:24:48 2015
New Revision: 236132

URL: http://llvm.org/viewvc/llvm-project?rev=236132&view=rev
Log:
Remove trap code from disassembly.

Summary:
NativeProcessProtocol uses ReadMemory internally for setting/checking
breakpoints but also for generic memory reads (Handle_m), this change adds a
ReadMemoryWithoutTrap for that purpose. Also fixes a bunch of misuses of addr_t
as size/length.

Test Plan: `disassemble` no longer shows the trap code.

Reviewers: jingham, vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h
lldb/trunk/source/Host/common/NativeBreakpointList.cpp
lldb/trunk/source/Host/common/NativeRegisterContext.cpp
lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h

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

Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h?rev=236132&r1=236131&r2=236132&view=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h Wed Apr 29 
12:24:48 2015
@@ -42,6 +42,9 @@ namespace lldb_private
 Error
 GetBreakpoint (lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp);
 
+Error
+RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const;
+
 private:
 typedef std::map BreakpointMap;
 

Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=236132&r1=236131&r2=236132&view=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Wed Apr 29 
12:24:48 2015
@@ -90,13 +90,16 @@ namespace lldb_private
 GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo 
&range_info);
 
 virtual Error
-ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, 
lldb::addr_t &bytes_read) = 0;
+ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t 
&bytes_read) = 0;
 
 virtual Error
-WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, 
lldb::addr_t &bytes_written) = 0;
+ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, 
size_t &bytes_read) = 0;
 
 virtual Error
-AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t 
&addr) = 0;
+WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t 
&bytes_written) = 0;
+
+virtual Error
+AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) 
= 0;
 
 virtual Error
 DeallocateMemory (lldb::addr_t addr) = 0;

Modified: lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h?rev=236132&r1=236131&r2=236132&view=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h Wed Apr 29 
12:24:48 2015
@@ -115,10 +115,10 @@ public:
 HardwareSingleStep (bool enable);
 
 virtual Error
-ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, 
lldb::addr_t src_addr, lldb::addr_t src_len, RegisterValue ®_value);
+ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, 
lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value);
 
 virtual Error
-WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, 
lldb::addr_t dst_addr, lldb::addr_t dst_len, const RegisterValue ®_value);
+WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, 
lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value);
 
 //--
 // Subclasses should not override these

Modified: lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h?rev=236132&r1=236131&r2=236132&view=diff
==

[Lldb-commits] [lldb] r235653 - Fix build.

2015-04-23 Thread Chaoren Lin
Author: chaoren
Date: Thu Apr 23 17:19:29 2015
New Revision: 235653

URL: http://llvm.org/viewvc/llvm-project?rev=235653&view=rev
Log:
Fix build.

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

Modified: lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp?rev=235653&r1=235652&r2=235653&view=diff
==
--- lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Expression/ClangModulesDeclVendor.cpp Thu Apr 23 17:19:29 
2015
@@ -450,7 +450,7 @@ ClangModulesDeclVendorImpl::ForEachMacro
  directive != nullptr;
  directive = directive->getPrevious())
 {
-unsigned module_id = directive->getOwningModuleID();
+unsigned module_id = 
directive->getMacroInfo()->getOwningModuleID();
 
 if (!module_id)
 continue;


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


[Lldb-commits] [lldb] r235454 - Same issue as in D8685 but for i386.

2015-04-21 Thread Chaoren Lin
Author: chaoren
Date: Tue Apr 21 18:00:58 2015
New Revision: 235454

URL: http://llvm.org/viewvc/llvm-project?rev=235454&view=rev
Log:
Same issue as in D8685 but for i386.

Modified:
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h
lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp?rev=235454&r1=235453&r2=235454&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp 
Tue Apr 21 18:00:58 2015
@@ -45,6 +45,13 @@ struct dbreg {
  /* Index 7: debug control */
 };
 
+using FPR_i386 = FXSAVE;
+
+struct UserArea
+{
+GPR gpr;
+FPR_i386 i387;
+};
 
 #define DR_SIZE sizeof(uint32_t)
 #define DR_OFFSET(reg_index) \

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp?rev=235454&r1=235453&r2=235454&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Tue 
Apr 21 18:00:58 2015
@@ -66,7 +66,7 @@ struct UserArea
 {
 GPR  regs;  // General purpose registers.
 int32_t  fpvalid;   // True if FPU is being used.
-FPR_i386   i387;// FPU registers.
+FPR_i386 i387;  // FPU registers.
 uint32_t tsize; // Text segment size.
 uint32_t dsize; // Data segment size.
 uint32_t ssize; // Stack segment size.

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h?rev=235454&r1=235453&r2=235454&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_i386.h Tue Apr 21 
18:00:58 2015
@@ -18,12 +18,16 @@
 
 // Computes the offset of the given FPR in the extended data area.
 #define FPR_OFFSET(regname)  \
-(LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(FXSAVE, regname))
+(LLVM_EXTENSION offsetof(UserArea, i387) + \
+ LLVM_EXTENSION offsetof(FPR_i386, regname))
 
 // Computes the offset of the YMM register assembled from register halves.
-#define YMM_OFFSET(regname) \
-(LLVM_EXTENSION offsetof(YMM, regname))
+// Based on DNBArchImplI386.cpp from debugserver
+#define YMM_OFFSET(reg_index) \
+(LLVM_EXTENSION offsetof(UserArea, i387) + \
+ LLVM_EXTENSION offsetof(FPR, xstate) + \
+ LLVM_EXTENSION offsetof(FXSAVE, xmm[7]) + \
+ sizeof(XMMReg) + (32 * reg_index))
 
 // Number of bytes needed to represent a FPR.
 #if !defined(FPR_SIZE)
@@ -70,7 +74,7 @@
 
 // I believe the YMM registers use dwarf_xmm_%_i386 register numbers and then 
differentiate based on register size.
 #define DEFINE_YMM(reg, i) \
-{ #reg#i, NULL, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(reg[i]),   \
+{ #reg#i, NULL, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(i),\
   eEncodingVector, eFormatVectorOfUInt8,   \
   { LLDB_INVALID_REGNUM, dwarf_xmm##i##_i386, LLDB_INVALID_REGNUM, 
gdb_##reg##i##h_i386, lldb_##reg##i##_i386 }, \
   NULL, NULL }

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h?rev=235454&r1=235453&r2=235454&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfos_x86_64.h Tue Apr 21 
18:00:58 2015
@@ -21,10 +21,11 @@
  LLVM_EXTENSION offsetof(FXSAVE, regname))
 
 // Computes the offset of the YMM register assembled from register halves.
+// Based on DNBArchImplX86_64.cpp from debugserver
 #define YMM_OFFSET(reg_index) \
 (LLVM_EXTENSION offsetof(UserArea, fpr) + \
  LLVM_EXTENSION offsetof(FPR, xstate) + \
- LLVM_EXTENSION offsetof(XSAVE, ymmh[reg_index]) + \
+ LLVM_EXTENSION offsetof(XSAVE, ymmh[0]) + \
  (32 * reg_index))
 
 #ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT



Re: [Lldb-commits] [PATCH] TestMiBreak - func isn't always ??.

2015-04-17 Thread Chaoren Lin
Why not `func=\".*\"`?
On Apr 17, 2015 06:26, "Ilia K"  wrote:

> 
> Comment at: test/tools/lldb-mi/breakpoint/TestMiBreak.py:34
> @@ -33,3 +33,3 @@
>  self.expect("\^running")
> -
> self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"\?\?\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
> +
> self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
>  self.expect("\*stopped,reason=\"breakpoint-hit\"")
> 
> update this patch after r235189 and use the following:
> ```
> func=\".+?\"
> ```
>
> http://reviews.llvm.org/D9060
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r235214 - TestMiBreak - func isn't always ??.

2015-04-17 Thread Chaoren Lin
Author: chaoren
Date: Fri Apr 17 12:33:43 2015
New Revision: 235214

URL: http://llvm.org/viewvc/llvm-project?rev=235214&view=rev
Log:
TestMiBreak - func isn't always ??.

Summary: Caused a failure because it showed up as `__printf`.

Reviewers: ki.stfu

Subscribers: lldb-commits

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

Modified:
lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py

Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=235214&r1=235213&r2=235214&view=diff
==
--- lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py Fri Apr 17 12:33:43 
2015
@@ -31,7 +31,7 @@ class MiBreakTestCase(lldbmi_testcase.Mi
 
 self.runCmd("-exec-run")
 self.expect("\^running")
-
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"\?\?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
+
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
 self.expect("\*stopped,reason=\"breakpoint-hit\"")
 
 @lldbmi_test


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


[Lldb-commits] [lldb] r234828 - Remove gcc xfail for TestTargetWatchAddress.

2015-04-13 Thread Chaoren Lin
Author: chaoren
Date: Mon Apr 13 19:51:57 2015
New Revision: 234828

URL: http://llvm.org/viewvc/llvm-project?rev=234828&view=rev
Log:
Remove gcc xfail for TestTargetWatchAddress.

Modified:

lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py

Modified: 
lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=234828&r1=234827&r2=234828&view=diff
==
--- 
lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py 
(original)
+++ 
lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py 
Mon Apr 13 19:51:57 2015
@@ -48,7 +48,6 @@ class TargetWatchAddressAPITestCase(Test
 
 @python_api_test
 @dwarf_test
-@expectedFailureGcc #xfail to get buildbot green, test failed with gcc4.8.2
 def test_watch_address_with_invalid_watch_size_with_dwarf(self):
 """Exercise SBTarget.WatchAddress() API but pass an invalid 
watch_size."""
 self.buildDwarf()


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


  1   2   >