Re: [Lldb-commits] [PATCH] D13667: cmake: provide flag that enables 'log enable --stack' to provide useful file/line info on POSIX systems

2015-10-14 Thread Pavel Labath via lldb-commits
labath added a comment.

sounds reasonable


http://reviews.llvm.org/D13667



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


[Lldb-commits] [lldb] r250280 - Mark TestBatchMode as flaky on linux

2015-10-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Oct 14 03:57:55 2015
New Revision: 250280

URL: http://llvm.org/viewvc/llvm-project?rev=250280&view=rev
Log:
Mark TestBatchMode as flaky on linux

Modified:
lldb/trunk/test/driver/batch_mode/TestBatchMode.py

Modified: lldb/trunk/test/driver/batch_mode/TestBatchMode.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/driver/batch_mode/TestBatchMode.py?rev=250280&r1=250279&r2=250280&view=diff
==
--- lldb/trunk/test/driver/batch_mode/TestBatchMode.py (original)
+++ lldb/trunk/test/driver/batch_mode/TestBatchMode.py Wed Oct 14 03:57:55 2015
@@ -16,6 +16,7 @@ class DriverBatchModeTest (TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIfRemote # test not remote-ready llvm.org/pr24813
+@expectedFlakeyLinux("llvm.org/pr25172")
 @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for 
windows")
 def test_driver_batch_mode(self):
 """Test that the lldb driver's batch mode works correctly."""


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


Re: [Lldb-commits] [PATCH] D13699: RenderScript command for printing allocation contents.

2015-10-14 Thread Ewan Crawford via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250281: RenderScript command for printing allocation 
contents (authored by EwanCrawford).

Changed prior to commit:
  http://reviews.llvm.org/D13699?vs=37251&id=37324#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13699

Files:
  lldb/trunk/include/lldb/lldb-enumerations.h
  lldb/trunk/source/Core/DataExtractor.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h

Index: lldb/trunk/include/lldb/lldb-enumerations.h
===
--- lldb/trunk/include/lldb/lldb-enumerations.h
+++ lldb/trunk/include/lldb/lldb-enumerations.h
@@ -146,6 +146,7 @@
 eFormatVectorOfUInt32,
 eFormatVectorOfSInt64,
 eFormatVectorOfUInt64,
+eFormatVectorOfFloat16,
 eFormatVectorOfFloat32,
 eFormatVectorOfFloat64,
 eFormatVectorOfUInt128,
Index: lldb/trunk/source/Core/DataExtractor.cpp
===
--- lldb/trunk/source/Core/DataExtractor.cpp
+++ lldb/trunk/source/Core/DataExtractor.cpp
@@ -2012,6 +2012,12 @@
 s->PutChar('}');
 break;
 
+case eFormatVectorOfFloat16:
+s->PutChar('{');
+offset = Dump (s, offset, eFormatFloat,   2, item_byte_size / 2, item_byte_size / 2, LLDB_INVALID_ADDRESS, 0, 0);
+s->PutChar('}');
+break;
+
 case eFormatVectorOfFloat32:
 s->PutChar('{');
 offset = Dump (s, offset, eFormatFloat,   4, item_byte_size / 4, item_byte_size / 4, LLDB_INVALID_ADDRESS, 0, 0);
Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
===
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -202,6 +202,8 @@
 
 void DumpKernels(Stream &strm) const;
 
+bool DumpAllocation(Stream &strm, StackFrame* frame_ptr, const uint32_t id);
+
 void ListAllocations(Stream &strm, StackFrame* frame_ptr, bool recompute);
 
 void AttemptBreakpointAtKernelName(Stream &strm, const char *name, Error &error, lldb::TargetSP target);
@@ -298,6 +300,8 @@
 void CaptureAllocationInit1(RuntimeHook* hook_info, ExecutionContext& context);
 void CaptureSetGlobalVar1(RuntimeHook* hook_info, ExecutionContext& context);
 
+AllocationDetails* FindAllocByID(Stream &strm, const uint32_t alloc_id);
+
 //
 // Helper functions for jitting the runtime
 //
@@ -310,6 +314,10 @@
 
 bool JITElementPacked(AllocationDetails* allocation, StackFrame* frame_ptr);
 
+bool JITAllocationSize(AllocationDetails* allocation, StackFrame* frame_ptr, const uint32_t elem_size);
+
+bool JITAllocationStride(AllocationDetails* allocation, StackFrame* frame_ptr);
+
 // Search for a script detail object using a target address.
 // If a script does not currently exist this function will return nullptr.
 // If 'create' is true and there is no previous script with this address,
Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -14,6 +14,7 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Host/StringConvert.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/Process.h"
@@ -188,6 +189,9 @@
 // Maps Allocation DataKind enum to printable strings
 static const char* RsDataKindToString[];
 
+// Maps allocation types to format sizes for printing.
+static const unsigned int RSTypeToFormat[][3];
+
 // Give each allocation an ID as a way
 // for commands to reference it.
 const unsigned int id;
@@ -201,6 +205,8 @@
 empirical_type type_ptr;// Pointer to the RS Type of the Allocation
 empirical_type element_ptr; // Pointer to the RS Element of the Type
 empirical_type context; // Pointer to the RS Context of the Allocation
+empirical_type size;// Size of the allocation
+empirical_type stride;  // Stride between rows of the allocation
 
 // Give each allocation an id, so we can reference it in user commands.
 AllocationDetails(): id(ID++)
@@ -242,6 +248,31 @@
 {"bool", "bool2", "bool3", "bool4"}
 };
 
+// Used as an index into the RSTypeToFormat arr

[Lldb-commits] [lldb] r250281 - RenderScript command for printing allocation contents

2015-10-14 Thread Ewan Crawford via lldb-commits
Author: ewancrawford
Date: Wed Oct 14 04:02:20 2015
New Revision: 250281

URL: http://llvm.org/viewvc/llvm-project?rev=250281&view=rev
Log:
RenderScript command for printing allocation contents

This patch adds the command 'language renderscript allocation dump ' for 
printing the contents of a RS allocation.
Displaying the coordinate of each element as well as its formatted value

e.g (lldb) language renderscript allocation dump 1
  Data (X, Y, Z):
 (0, 0, 0) = {0 1}
 (1, 0, 0) = {2 3}
 (2, 0, 0) = {4 5}

A --file  option is also included, since for large allocations it may 
be more helpful to view this text as a file.

Reviewed by: jingham, clayborg
Subscribers: lldb-commits, ADodds, domipheus, brucem
Differential Revision: http://reviews.llvm.org/D13699

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Core/DataExtractor.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=250281&r1=250280&r2=250281&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Oct 14 04:02:20 2015
@@ -146,6 +146,7 @@ namespace lldb {
 eFormatVectorOfUInt32,
 eFormatVectorOfSInt64,
 eFormatVectorOfUInt64,
+eFormatVectorOfFloat16,
 eFormatVectorOfFloat32,
 eFormatVectorOfFloat64,
 eFormatVectorOfUInt128,

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=250281&r1=250280&r2=250281&view=diff
==
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Wed Oct 14 04:02:20 2015
@@ -2012,6 +2012,12 @@ DataExtractor::Dump (Stream *s,
 s->PutChar('}');
 break;
 
+case eFormatVectorOfFloat16:
+s->PutChar('{');
+offset = Dump (s, offset, eFormatFloat,   2, item_byte_size / 
2, item_byte_size / 2, LLDB_INVALID_ADDRESS, 0, 0);
+s->PutChar('}');
+break;
+
 case eFormatVectorOfFloat32:
 s->PutChar('{');
 offset = Dump (s, offset, eFormatFloat,   4, item_byte_size / 
4, item_byte_size / 4, LLDB_INVALID_ADDRESS, 0, 0);

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=250281&r1=250280&r2=250281&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Wed Oct 14 04:02:20 2015
@@ -14,6 +14,7 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Host/StringConvert.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/Process.h"
@@ -188,6 +189,9 @@ struct RenderScriptRuntime::AllocationDe
 // Maps Allocation DataKind enum to printable strings
 static const char* RsDataKindToString[];
 
+// Maps allocation types to format sizes for printing.
+static const unsigned int RSTypeToFormat[][3];
+
 // Give each allocation an ID as a way
 // for commands to reference it.
 const unsigned int id;
@@ -201,6 +205,8 @@ struct RenderScriptRuntime::AllocationDe
 empirical_type type_ptr;// Pointer to the RS Type of the 
Allocation
 empirical_type element_ptr; // Pointer to the RS Element of 
the Type
 empirical_type context; // Pointer to the RS Context of 
the Allocation
+empirical_type size;// Size of the allocation
+empirical_type stride;  // Stride between rows of the 
allocation
 
 // Give each allocation an id, so we can reference it in user commands.
 AllocationDetails(): id(ID++)
@@ -242,6 +248,31 @@ const char* RenderScriptRuntime::Allocat
 {"bool", "bool2", "bool3", "bool4"}
 };
 
+// Used as an index into the RSTypeToFormat array elements
+enum TypeToFormatIndex {
+   eFormatSingle = 0,
+   eFormatVector,
+   eElementSize
+};
+
+// { format enum of single element, format enum of element vector, size of 
element}
+const unsigned int RenderScriptRuntime::AllocationDetails::RSTypeToFormat[][3] 
=
+{
+{eFormatHex, eFormatHex, 1}, // RS_TYPE_NONE
+{eFormatFl

[Lldb-commits] [lldb] r250282 - Fix compiler warnings in ScriptInterpreterPython

2015-10-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Oct 14 04:18:23 2015
New Revision: 250282

URL: http://llvm.org/viewvc/llvm-project?rev=250282&view=rev
Log:
Fix compiler warnings in ScriptInterpreterPython

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=250282&r1=250281&r2=250282&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Wed Oct 14 04:18:23 2015
@@ -468,7 +468,7 @@ ScriptInterpreterPython::LeaveSession ()
 }
 
 static PythonObject
-PyFile_FromFile_Const(FILE *fp, char *mode)
+PyFile_FromFile_Const(FILE *fp, const char *mode)
 {
 char *cmode = const_cast(mode);
 #if PY_MAJOR_VERSION >= 3


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


[Lldb-commits] [PATCH] D13719: Fix warnings in LLDBWrapPython.cpp with gcc 4.9.

2015-10-14 Thread Hafiz Abid Qadeer via lldb-commits
abidh created this revision.
abidh added reviewers: zturner, clayborg.
abidh added a subscriber: lldb-commits.

I see a lot of following warnings in LLDBWrapPython.cpp while building with gcc 
4.9 on Linux.
"warning: cast from type ‘const char*’ to type ‘char*’ casts away qualifiers 
[-Wcast-qual]"

Is it ok to add -Wno-cast-qual for this file in cmake for gcc. This option 
seems to be already present
for autotool case.

http://reviews.llvm.org/D13719

Files:
  cmake/LLDBDependencies.cmake

Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -191,6 +191,6 @@
   if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
   NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
 set_property(SOURCE ${LLDB_WRAP_PYTHON}
- APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point")
+ APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point 
-Wno-cast-qual")
   endif ()
 endif()


Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -191,6 +191,6 @@
   if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
   NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
 set_property(SOURCE ${LLDB_WRAP_PYTHON}
- APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point")
+ APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
   endif ()
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13699: RenderScript command for printing allocation contents.

2015-10-14 Thread Pavel Labath via lldb-commits
labath added a subscriber: labath.
labath added a comment.

Hi Ewan,

this commit introduces a new warning:

  lldb/source/Commands/CommandObjectMemory.cpp:1502:21: warning: enumeration 
value 'eFormatVectorOfFloat16' not handled in switch [-Wswitch]
  switch (m_format_options.GetFormat())

Also, it breaks TestDataFormatterSmartArray.py.

File 
"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py",
 line 19, in test_with_run_command
  self.data_formatter_commands()
File 
"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py",
 line 279, in data_formatter_commands
  '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}'])
File 
"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/lldbtest.py", 
line 2794, in expect
  msg if msg else EXP_MSG(str, exe))
  AssertionError: False is not True : 
'{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}' returns expected result

Could you look into these issues? If you can't look into it now, shall we 
revert it until you get a chance to have a look?


Repository:
  rL LLVM

http://reviews.llvm.org/D13699



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


Re: [Lldb-commits] [PATCH] D13699: RenderScript command for printing allocation contents.

2015-10-14 Thread Ewan Crawford via lldb-commits
EwanCrawford added a comment.

Hi Pavel, 
 Thanks for letting me know, I'll look into it now.


Repository:
  rL LLVM

http://reviews.llvm.org/D13699



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


Re: [Lldb-commits] [PATCH] D12994: Improve support of the ncurses dependency on NetBSD

2015-10-14 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

There is already preliminary NetBSD support merged with trunk, I need this 
commit (or altered version of it) to build lldb against ncurses on this 
platform.

Thank you for your time.


Repository:
  rL LLVM

http://reviews.llvm.org/D12994



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


[Lldb-commits] [lldb] r250287 - Fix warning in CommandObjectMemory

2015-10-14 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Oct 14 05:29:36 2015
New Revision: 250287

URL: http://llvm.org/viewvc/llvm-project?rev=250287&view=rev
Log:
Fix warning in CommandObjectMemory

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

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=250287&r1=250286&r2=250287&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Oct 14 05:29:36 2015
@@ -1518,6 +1518,7 @@ protected:
 case eFormatVectorOfUInt32:
 case eFormatVectorOfSInt64:
 case eFormatVectorOfUInt64:
+case eFormatVectorOfFloat16:
 case eFormatVectorOfFloat32:
 case eFormatVectorOfFloat64:
 case eFormatVectorOfUInt128:


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


[Lldb-commits] [lldb] r250286 - Make use of lldv::Triple::isAndroid

2015-10-14 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Oct 14 05:29:17 2015
New Revision: 250286

URL: http://llvm.org/viewvc/llvm-project?rev=250286&view=rev
Log:
Make use of lldv::Triple::isAndroid

It is a new function added to the llvm::Triple class to simplify the
checking if we are targeting android to clean up the confusion between
android being an OS or an environment.

Modified:
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp?rev=250286&r1=250285&r2=250286&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp Wed 
Oct 14 05:29:17 2015
@@ -291,19 +291,13 @@ DYLDRendezvous::SOEntryIsMainExecutable(
 // FreeBSD and on Android it is the full path to the executable.
 
 auto triple = m_process->GetTarget().GetArchitecture().GetTriple();
-auto os_type = triple.getOS();
-auto env_type = triple.getEnvironment();
-
-switch (os_type) {
+switch (triple.getOS()) {
 case llvm::Triple::FreeBSD:
 return entry.file_spec == m_exe_file_spec;
 case llvm::Triple::Linux:
-switch (env_type) {
-case llvm::Triple::Android:
-return entry.file_spec == m_exe_file_spec;
-default:
-return !entry.file_spec;
-}
+if (triple.isAndroid())
+return entry.file_spec == m_exe_file_spec;
+return !entry.file_spec;
 default:
 return false;
 }
@@ -381,7 +375,7 @@ isLoadBiasIncorrect(Target& target, cons
 // On Android L (API 21, 22) the load address of the "/system/bin/linker" 
isn't filled in
 // correctly.
 uint32_t os_major = 0, os_minor = 0, os_update = 0;
-if (target.GetArchitecture().GetTriple().getEnvironment() == 
llvm::Triple::Android &&
+if (target.GetArchitecture().GetTriple().isAndroid() &&
 target.GetPlatform()->GetOSVersion(os_major, os_minor, os_update) &&
 (os_major == 21 || os_major == 22) &&
 (file_path == "/system/bin/linker" || file_path == 
"/system/bin/linker64"))

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=250286&r1=250285&r2=250286&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Wed Oct 
14 05:29:17 2015
@@ -290,7 +290,7 @@ EmulateInstructionARM::GetRegisterInfo (
 uint32_t
 EmulateInstructionARM::GetFramePointerRegisterNumber () const
 {
-if (m_arch.GetTriple().getEnvironment() == llvm::Triple::Android)
+if (m_arch.GetTriple().isAndroid())
 return LLDB_INVALID_REGNUM; // Don't use frame pointer on android
 
 bool is_apple = false;

Modified: 
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=250286&r1=250285&r2=250286&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Wed 
Oct 14 05:29:17 2015
@@ -405,7 +405,7 @@ EmulateInstructionARM64::CreateFunctionE
 uint32_t
 EmulateInstructionARM64::GetFramePointerRegisterNumber () const
 {
-if (m_arch.GetTriple().getEnvironment() == llvm::Triple::Android)
+if (m_arch.GetTriple().isAndroid())
 return LLDB_INVALID_REGNUM; // Don't use frame pointer on android
 
 return arm64_dwarf::sp;


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


Re: [Lldb-commits] [PATCH] D13652: Change ConstString to support massive multi-threaded access

2015-10-14 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250289: Change ConstString to support massive multi-threaded 
access (authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D13652?vs=37258&id=37328#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13652

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

Index: lldb/trunk/source/Core/ConstString.cpp
===
--- lldb/trunk/source/Core/ConstString.cpp
+++ lldb/trunk/source/Core/ConstString.cpp
@@ -8,39 +8,21 @@
 //===--===//
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Stream.h"
-#include "lldb/Host/Mutex.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/RWMutex.h"
 
-#include  // std::once
+#include 
+#include 
 
 using namespace lldb_private;
 
-
 class Pool
 {
 public:
 typedef const char * StringPoolValueType;
 typedef llvm::StringMap StringPool;
 typedef llvm::StringMapEntry StringPoolEntryType;
-
-//--
-// Default constructor
-//
-// Initialize the member variables and create the empty string.
-//--
-Pool () :
-m_mutex (Mutex::eMutexTypeRecursive),
-m_string_map ()
-{
-}
-
-//--
-// Destructor
-//--
-~Pool ()
-{
-}
-
 
 static StringPoolEntryType &
 GetStringMapEntryFromKeyData (const char *keyData)
@@ -85,42 +67,49 @@
 {
 if (cstr)
 return GetConstCStringWithLength (cstr, strlen (cstr));
-return NULL;
+return nullptr;
 }
 
 const char *
 GetConstCStringWithLength (const char *cstr, size_t cstr_len)
 {
 if (cstr)
-{
-Mutex::Locker locker (m_mutex);
-llvm::StringRef string_ref (cstr, cstr_len);
-StringPoolEntryType& entry = *m_string_map.insert (std::make_pair (string_ref, (StringPoolValueType)NULL)).first;
-return entry.getKeyData();
-}
-return NULL;
+return GetConstCStringWithStringRef(llvm::StringRef(cstr, cstr_len));
+return nullptr;
 }
 
 const char *
 GetConstCStringWithStringRef (const llvm::StringRef &string_ref)
 {
 if (string_ref.data())
 {
-Mutex::Locker locker (m_mutex);
-StringPoolEntryType& entry = *m_string_map.insert (std::make_pair (string_ref, (StringPoolValueType)NULL)).first;
+uint8_t h = hash (string_ref);
+
+{
+llvm::sys::SmartScopedReader rlock(m_string_pools[h].m_mutex);
+auto it = m_string_pools[h].m_string_map.find (string_ref);
+if (it != m_string_pools[h].m_string_map.end())
+return it->getKeyData();
+}
+
+llvm::sys::SmartScopedWriter wlock(m_string_pools[h].m_mutex);
+StringPoolEntryType& entry = *m_string_pools[h].m_string_map.insert (std::make_pair (string_ref, nullptr)).first;
 return entry.getKeyData();
 }
-return NULL;
+return nullptr;
 }
 
 const char *
 GetConstCStringAndSetMangledCounterPart (const char *demangled_cstr, const char *mangled_ccstr)
 {
 if (demangled_cstr)
 {
-Mutex::Locker locker (m_mutex);
+llvm::StringRef string_ref (demangled_cstr);
+uint8_t h = hash (string_ref);
+llvm::sys::SmartScopedWriter wlock(m_string_pools[h].m_mutex);
+
 // Make string pool entry with the mangled counterpart already set
-StringPoolEntryType& entry = *m_string_map.insert (std::make_pair (llvm::StringRef (demangled_cstr), mangled_ccstr)).first;
+StringPoolEntryType& entry = *m_string_pools[h].m_string_map.insert (std::make_pair (string_ref, mangled_ccstr)).first;
 
 // Extract the const version of the demangled_cstr
 const char *demangled_ccstr = entry.getKeyData();
@@ -130,7 +119,7 @@
 // Return the constant demangled C string
 return demangled_ccstr;
 }
-return NULL;
+return nullptr;
 }
 
 const char *
@@ -141,7 +130,7 @@
 const size_t trimmed_len = std::min (strlen (cstr), cstr_len);
 return GetConstCStringWithLength (cstr, trimmed_len);
 }
-return NULL;
+return nullptr;
 }
 
 //--
@@ -152,28 +141,31 @@
 size_t
 MemorySize() const
 {
-Mutex::Locker locker (m_mutex);
 size_t mem_size = sizeof(Pool);
-const_iterator

[Lldb-commits] [lldb] r250289 - Change ConstString to support massive multi-threaded access

2015-10-14 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Wed Oct 14 05:38:22 2015
New Revision: 250289

URL: http://llvm.org/viewvc/llvm-project?rev=250289&view=rev
Log:
Change ConstString to support massive multi-threaded access

Previously ConstString had a single mutex guarding the global string
pool for each access what become a bottleneck when using it with a
large number of threads.

This CL distributes the strings to 256 individual string pools based on
a simple hash function to eliminate the bottleneck and speed up the
multi-thread access.

The goal of the change is to prepare to multi-threaded symbol parsing code
to speed up the symbol parsing speed.

Differential revision: http://reviews.llvm.org/D13652

Modified:
lldb/trunk/source/Core/ConstString.cpp

Modified: lldb/trunk/source/Core/ConstString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConstString.cpp?rev=250289&r1=250288&r2=250289&view=diff
==
--- lldb/trunk/source/Core/ConstString.cpp (original)
+++ lldb/trunk/source/Core/ConstString.cpp Wed Oct 14 05:38:22 2015
@@ -8,39 +8,21 @@
 
//===--===//
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Stream.h"
-#include "lldb/Host/Mutex.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/RWMutex.h"
 
-#include  // std::once
+#include 
+#include 
 
 using namespace lldb_private;
 
-
 class Pool
 {
 public:
 typedef const char * StringPoolValueType;
 typedef llvm::StringMap 
StringPool;
 typedef llvm::StringMapEntry StringPoolEntryType;
-
-//--
-// Default constructor
-//
-// Initialize the member variables and create the empty string.
-//--
-Pool () :
-m_mutex (Mutex::eMutexTypeRecursive),
-m_string_map ()
-{
-}
-
-//--
-// Destructor
-//--
-~Pool ()
-{
-}
-
 
 static StringPoolEntryType &
 GetStringMapEntryFromKeyData (const char *keyData)
@@ -85,20 +67,15 @@ public:
 {
 if (cstr)
 return GetConstCStringWithLength (cstr, strlen (cstr));
-return NULL;
+return nullptr;
 }
 
 const char *
 GetConstCStringWithLength (const char *cstr, size_t cstr_len)
 {
 if (cstr)
-{
-Mutex::Locker locker (m_mutex);
-llvm::StringRef string_ref (cstr, cstr_len);
-StringPoolEntryType& entry = *m_string_map.insert (std::make_pair 
(string_ref, (StringPoolValueType)NULL)).first;
-return entry.getKeyData();
-}
-return NULL;
+return GetConstCStringWithStringRef(llvm::StringRef(cstr, 
cstr_len));
+return nullptr;
 }
 
 const char *
@@ -106,11 +83,20 @@ public:
 {
 if (string_ref.data())
 {
-Mutex::Locker locker (m_mutex);
-StringPoolEntryType& entry = *m_string_map.insert (std::make_pair 
(string_ref, (StringPoolValueType)NULL)).first;
+uint8_t h = hash (string_ref);
+
+{
+llvm::sys::SmartScopedReader 
rlock(m_string_pools[h].m_mutex);
+auto it = m_string_pools[h].m_string_map.find (string_ref);
+if (it != m_string_pools[h].m_string_map.end())
+return it->getKeyData();
+}
+
+llvm::sys::SmartScopedWriter 
wlock(m_string_pools[h].m_mutex);
+StringPoolEntryType& entry = 
*m_string_pools[h].m_string_map.insert (std::make_pair (string_ref, 
nullptr)).first;
 return entry.getKeyData();
 }
-return NULL;
+return nullptr;
 }
 
 const char *
@@ -118,9 +104,12 @@ public:
 {
 if (demangled_cstr)
 {
-Mutex::Locker locker (m_mutex);
+llvm::StringRef string_ref (demangled_cstr);
+uint8_t h = hash (string_ref);
+llvm::sys::SmartScopedWriter 
wlock(m_string_pools[h].m_mutex);
+
 // Make string pool entry with the mangled counterpart already set
-StringPoolEntryType& entry = *m_string_map.insert (std::make_pair 
(llvm::StringRef (demangled_cstr), mangled_ccstr)).first;
+StringPoolEntryType& entry = 
*m_string_pools[h].m_string_map.insert (std::make_pair (string_ref, 
mangled_ccstr)).first;
 
 // Extract the const version of the demangled_cstr
 const char *demangled_ccstr = entry.getKeyData();
@@ -130,7 +119,7 @@ public:
 // Return the constant demangled C string
 return demangled_ccstr;
 }
-return NULL;
+return nullptr;
 }
 
 const char *
@@ -141,7 +130

[Lldb-commits] [lldb] r250290 - Revert "RenderScript command for printing allocation contents"

2015-10-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Oct 14 06:50:37 2015
New Revision: 250290

URL: http://llvm.org/viewvc/llvm-project?rev=250290&view=rev
Log:
Revert "RenderScript command for printing allocation contents"

This commit breaks TestDataFormatterSmartArray on all buildbots.

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/DataExtractor.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=250290&r1=250289&r2=250290&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Oct 14 06:50:37 2015
@@ -146,7 +146,6 @@ namespace lldb {
 eFormatVectorOfUInt32,
 eFormatVectorOfSInt64,
 eFormatVectorOfUInt64,
-eFormatVectorOfFloat16,
 eFormatVectorOfFloat32,
 eFormatVectorOfFloat64,
 eFormatVectorOfUInt128,

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=250290&r1=250289&r2=250290&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Oct 14 06:50:37 2015
@@ -1518,7 +1518,6 @@ protected:
 case eFormatVectorOfUInt32:
 case eFormatVectorOfSInt64:
 case eFormatVectorOfUInt64:
-case eFormatVectorOfFloat16:
 case eFormatVectorOfFloat32:
 case eFormatVectorOfFloat64:
 case eFormatVectorOfUInt128:

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=250290&r1=250289&r2=250290&view=diff
==
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Wed Oct 14 06:50:37 2015
@@ -2012,12 +2012,6 @@ DataExtractor::Dump (Stream *s,
 s->PutChar('}');
 break;
 
-case eFormatVectorOfFloat16:
-s->PutChar('{');
-offset = Dump (s, offset, eFormatFloat,   2, item_byte_size / 
2, item_byte_size / 2, LLDB_INVALID_ADDRESS, 0, 0);
-s->PutChar('}');
-break;
-
 case eFormatVectorOfFloat32:
 s->PutChar('{');
 offset = Dump (s, offset, eFormatFloat,   4, item_byte_size / 
4, item_byte_size / 4, LLDB_INVALID_ADDRESS, 0, 0);

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=250290&r1=250289&r2=250290&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Wed Oct 14 06:50:37 2015
@@ -14,7 +14,6 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
-#include "lldb/Host/StringConvert.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/Process.h"
@@ -189,9 +188,6 @@ struct RenderScriptRuntime::AllocationDe
 // Maps Allocation DataKind enum to printable strings
 static const char* RsDataKindToString[];
 
-// Maps allocation types to format sizes for printing.
-static const unsigned int RSTypeToFormat[][3];
-
 // Give each allocation an ID as a way
 // for commands to reference it.
 const unsigned int id;
@@ -205,8 +201,6 @@ struct RenderScriptRuntime::AllocationDe
 empirical_type type_ptr;// Pointer to the RS Type of the 
Allocation
 empirical_type element_ptr; // Pointer to the RS Element of 
the Type
 empirical_type context; // Pointer to the RS Context of 
the Allocation
-empirical_type size;// Size of the allocation
-empirical_type stride;  // Stride between rows of the 
allocation
 
 // Give each allocation an id, so we can reference it in user commands.
 AllocationDetails(): id(ID++)
@@ -248,31 +242,6 @@ const char* RenderScriptRuntime::Allocat
 {"bool", "bool2", "bool3", "bool4"}
 };
 
-// Used as an index into the RSTypeToFormat array elements
-enum TypeToFormatIndex {
-   eFormatSingle = 0,

Re: [Lldb-commits] [PATCH] D13699: RenderScript command for printing allocation contents.

2015-10-14 Thread Pavel Labath via lldb-commits
labath added a comment.

Hi,

I have reverted this as all the bots were getting red. In the test, variable 
was getting printed as `[{},{},{},{},{},{},{}]` instead of 
`{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}`. Please resubmit once the 
issue is resolved.


Repository:
  rL LLVM

http://reviews.llvm.org/D13699



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


Re: [Lldb-commits] [PATCH] D13695: lldb-server: add support for binary memory reads

2015-10-14 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 37340.
labath added a comment.

The new functionality gets picked up by the client and automatically used 
everywhere, so I'm not
really worried about testing it. A more important issue would be making sure 
that the legacy read
packet does not rot as it is now unused. I have added a test which makes sure 
both packets return
the same value (modulo hex-encoding), which should prevent that.


http://reviews.llvm.org/D13695

Files:
  examples/python/read_test.py
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h
  test/functionalities/archives/a.dwo
  test/functionalities/archives/b.dwo
  test/lang/cpp/incomplete-types/length_limit.dwo
  test/lang/cpp/incomplete-types/length_nolimit.dwo
  test/lang/go/goroutines/a.out
  test/lang/go/types/a.out
  test/tools/lldb-server/TestGDBRemoteMemoryRead.py
  test/types/recursive_type_1.d
  test/types/recursive_type_1.dwo
  test/types/recursive_type_1.o

Index: test/types/recursive_type_1.d
===
--- /dev/null
+++ test/types/recursive_type_1.d
@@ -0,0 +1,2 @@
+recursive_type_1.o recursive_type_1.d : recursive_type_1.cpp \
+  /usr/local/google/home/labath/ll/lldb/test/make/test_common.h
Index: test/tools/lldb-server/TestGDBRemoteMemoryRead.py
===
--- /dev/null
+++ test/tools/lldb-server/TestGDBRemoteMemoryRead.py
@@ -0,0 +1,45 @@
+"""
+Tests the binary ($x) and hex ($m) memory read packets of the remote stub
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+import binascii
+
+
+class MemoryReadTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessPlatform(getDarwinOSTriples()+["linux"])
+def test_memory_read(self):
+self.build()
+exe = os.path.join (os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+lldbutil.run_break_set_by_symbol(self, "main")
+
+process = target.LaunchSimple (None, None, self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
+self.assertEqual(process.GetState(), lldb.eStateStopped, "Process is stopped")
+
+pc = process.GetSelectedThread().GetSelectedFrame().GetPC()
+for size in [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]:
+error = lldb.SBError()
+memory = process.ReadMemory(pc, size, error)
+self.assertTrue(error.Success())
+self.match("process plugin packet send x%x,%x" % (pc, size), ["response:", memory])
+self.match("process plugin packet send m%x,%x" % (pc, size), ["response:", binascii.hexlify(memory)])
+
+process.Continue()
+self.assertEqual(process.GetState(), lldb.eStateExited, "Process exited")
+
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()
Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -145,6 +145,8 @@
 eServerPacketType_s,
 eServerPacketType_S,
 eServerPacketType_T,
+eServerPacketType_x,
+eServerPacketType_X,
 eServerPacketType_Z,
 eServerPacketType_z,
 
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -310,6 +310,12 @@
   case 'S':
 return eServerPacketType_S;
 
+  case 'x':
+return eServerPacketType_x;
+
+  case 'X':
+return eServerPacketType_X;
+
   case 'T':
 return eServerPacketType_T;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3043,14 +3043,8 @@
 char packet[64];
 int packet_len;
 bool binary_memory_read = m_gdb_comm.GetxPacketSupported();
-if (binary_memory_read)
-{
-packet_len = ::snprintf (packet, sizeof(packet), "x0x%" PRIx64 ",0x%" PRIx64, (uint64_t)addr, (uint64_t)size);
-}
-else
-{
-packet_len = ::snprintf (packet, sizeof(packet), "m%" PRIx64 ",%" PRIx64, (uint64_t)addr, (uint64_t)size);
-}
+packet_len = ::snprintf(packet, sizeof(packet), "%c%" PRIx64 ",%" PRIx64,
+binary_memory_read ? 'x' : 'm', (uint64_t)addr, (uint64_t)size);
 asse

Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Eugene Leviant via lldb-commits
evgeny777 updated this revision to Diff 37339.
evgeny777 added a comment.

Looks like can be done much easier


http://reviews.llvm.org/D13657

Files:
  include/lldb/API/SBTypeSummary.h
  source/API/SBTypeSummary.cpp

Index: source/API/SBTypeSummary.cpp
===
--- source/API/SBTypeSummary.cpp
+++ source/API/SBTypeSummary.cpp
@@ -146,6 +146,25 @@
 return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, 
"", data)));
 }
 
+SBTypeSummary
+SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
+{
+return SBTypeSummary(
+   TypeSummaryImplSP(
+   new CXXFunctionSummaryFormat(options, 
+   [cb] (ValueObject& valobj, Stream& stm, const 
TypeSummaryOptions& opt) -> bool {
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;
+stm.Write(stream.GetData(), stream.GetSize());
+return true;
+   },
+   "SBTypeSummary formatter callbacxk"
+   )
+)
+);
+}
+
 SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
 m_opaque_sp(rhs.m_opaque_sp)
 {
Index: include/lldb/API/SBTypeSummary.h
===
--- include/lldb/API/SBTypeSummary.h
+++ include/lldb/API/SBTypeSummary.h
@@ -69,6 +69,8 @@
 class SBTypeSummary
 {
 public:
+// Native function summary formatter callback
+typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, 
SBStream&);
 
 SBTypeSummary();
 
@@ -83,6 +85,9 @@
 static SBTypeSummary
 CreateWithScriptCode (const char* data,
   uint32_t options = 0); // see lldb::eTypeOption 
values
+static SBTypeSummary
+CreateWithCallback (FormatCallback cb, 
+uint32_t options = 0);
 
 SBTypeSummary (const lldb::SBTypeSummary &rhs);
 


Index: source/API/SBTypeSummary.cpp
===
--- source/API/SBTypeSummary.cpp
+++ source/API/SBTypeSummary.cpp
@@ -146,6 +146,25 @@
 return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data)));
 }
 
+SBTypeSummary
+SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
+{
+return SBTypeSummary(
+   TypeSummaryImplSP(
+   new CXXFunctionSummaryFormat(options, 
+   [cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;
+stm.Write(stream.GetData(), stream.GetSize());
+return true;
+   },
+   "SBTypeSummary formatter callbacxk"
+   )
+)
+);
+}
+
 SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
 m_opaque_sp(rhs.m_opaque_sp)
 {
Index: include/lldb/API/SBTypeSummary.h
===
--- include/lldb/API/SBTypeSummary.h
+++ include/lldb/API/SBTypeSummary.h
@@ -69,6 +69,8 @@
 class SBTypeSummary
 {
 public:
+// Native function summary formatter callback
+typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&);
 
 SBTypeSummary();
 
@@ -83,6 +85,9 @@
 static SBTypeSummary
 CreateWithScriptCode (const char* data,
   uint32_t options = 0); // see lldb::eTypeOption values
+static SBTypeSummary
+CreateWithCallback (FormatCallback cb, 
+uint32_t options = 0);
 
 SBTypeSummary (const lldb::SBTypeSummary &rhs);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13695: lldb-server: add support for binary memory reads

2015-10-14 Thread Pavel Labath via lldb-commits
labath updated this revision to Diff 37341.
labath added a comment.

Remove files which slipped in...


http://reviews.llvm.org/D13695

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h
  test/tools/lldb-server/TestGDBRemoteMemoryRead.py

Index: test/tools/lldb-server/TestGDBRemoteMemoryRead.py
===
--- /dev/null
+++ test/tools/lldb-server/TestGDBRemoteMemoryRead.py
@@ -0,0 +1,45 @@
+"""
+Tests the binary ($x) and hex ($m) memory read packets of the remote stub
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+import binascii
+
+
+class MemoryReadTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessPlatform(getDarwinOSTriples()+["linux"])
+def test_memory_read(self):
+self.build()
+exe = os.path.join (os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+lldbutil.run_break_set_by_symbol(self, "main")
+
+process = target.LaunchSimple (None, None, self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
+self.assertEqual(process.GetState(), lldb.eStateStopped, "Process is stopped")
+
+pc = process.GetSelectedThread().GetSelectedFrame().GetPC()
+for size in [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]:
+error = lldb.SBError()
+memory = process.ReadMemory(pc, size, error)
+self.assertTrue(error.Success())
+self.match("process plugin packet send x%x,%x" % (pc, size), ["response:", memory])
+self.match("process plugin packet send m%x,%x" % (pc, size), ["response:", binascii.hexlify(memory)])
+
+process.Continue()
+self.assertEqual(process.GetState(), lldb.eStateExited, "Process exited")
+
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()
Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -145,6 +145,8 @@
 eServerPacketType_s,
 eServerPacketType_S,
 eServerPacketType_T,
+eServerPacketType_x,
+eServerPacketType_X,
 eServerPacketType_Z,
 eServerPacketType_z,
 
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -310,6 +310,12 @@
   case 'S':
 return eServerPacketType_S;
 
+  case 'x':
+return eServerPacketType_x;
+
+  case 'X':
+return eServerPacketType_X;
+
   case 'T':
 return eServerPacketType_T;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3043,14 +3043,8 @@
 char packet[64];
 int packet_len;
 bool binary_memory_read = m_gdb_comm.GetxPacketSupported();
-if (binary_memory_read)
-{
-packet_len = ::snprintf (packet, sizeof(packet), "x0x%" PRIx64 ",0x%" PRIx64, (uint64_t)addr, (uint64_t)size);
-}
-else
-{
-packet_len = ::snprintf (packet, sizeof(packet), "m%" PRIx64 ",%" PRIx64, (uint64_t)addr, (uint64_t)size);
-}
+packet_len = ::snprintf(packet, sizeof(packet), "%c%" PRIx64 ",%" PRIx64,
+binary_memory_read ? 'x' : 'm', (uint64_t)addr, (uint64_t)size);
 assert (packet_len + 1 < (int)sizeof(packet));
 StringExtractorGDBRemote response;
 if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true) == GDBRemoteCommunication::PacketResult::Success)
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -202,8 +202,9 @@
 PacketResult
 Handle_interrupt (StringExtractorGDBRemote &packet);
 
+// Handles $m and $x packets.
 PacketResult
-Handle_m (StringExtractorGDBRemote &packet);
+Handle_memory_read (StringExtractorGDBRemote &packet);
 
 PacketResult
 Handle_M (StringExtractorGDBRemote &packet);
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- sou

Re: [Lldb-commits] [PATCH] D13695: lldb-server: add support for binary memory reads

2015-10-14 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.
This revision is now accepted and ready to land.

Looks good


http://reviews.llvm.org/D13695



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


Re: [Lldb-commits] [PATCH] D13699: RenderScript command for printing allocation contents.

2015-10-14 Thread Ewan Crawford via lldb-commits
EwanCrawford added a comment.

No bother, thanks for reverting


Repository:
  rL LLVM

http://reviews.llvm.org/D13699



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


[Lldb-commits] [lldb] r250295 - lldb-server: add support for binary memory reads

2015-10-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Oct 14 07:59:37 2015
New Revision: 250295

URL: http://llvm.org/viewvc/llvm-project?rev=250295&view=rev
Log:
lldb-server: add support for binary memory reads

Summary:
This commit adds support for binary memory reads ($x) to lldb-server. It also 
removes the "0x"
prefix from the $x client packet, to make it more compatible with the old $m 
packet. This allows
us to use almost the same code for handling both packet types. I have verified 
that debugserver
correctly handles $x packets even without the leading "0x". I have added a test 
which verifies
that the stub returns the same memory contents for both kinds of memory reads 
($x and $m).

Reviewers: tberghammer, jasonmolenda

Subscribers: iancottrell, lldb-commits

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

Added:
lldb/trunk/test/tools/lldb-server/TestGDBRemoteMemoryRead.py
Modified:

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

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
lldb/trunk/source/Utility/StringExtractorGDBRemote.h

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=250295&r1=250294&r2=250295&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Wed Oct 14 07:59:37 2015
@@ -113,7 +113,7 @@ GDBRemoteCommunicationServerLLGS::Regist
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_interrupt,
   
&GDBRemoteCommunicationServerLLGS::Handle_interrupt);
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_m,
-  &GDBRemoteCommunicationServerLLGS::Handle_m);
+  
&GDBRemoteCommunicationServerLLGS::Handle_memory_read);
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_M,
   &GDBRemoteCommunicationServerLLGS::Handle_M);
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_p,
@@ -164,6 +164,8 @@ GDBRemoteCommunicationServerLLGS::Regist
   
&GDBRemoteCommunicationServerLLGS::Handle_vCont);
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_vCont_actions,
   
&GDBRemoteCommunicationServerLLGS::Handle_vCont_actions);
+
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_x,
+  
&GDBRemoteCommunicationServerLLGS::Handle_memory_read);
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_Z,
   &GDBRemoteCommunicationServerLLGS::Handle_Z);
 
RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_z,
@@ -1975,7 +1977,7 @@ GDBRemoteCommunicationServerLLGS::Handle
 }
 
 GDBRemoteCommunication::PacketResult
-GDBRemoteCommunicationServerLLGS::Handle_m (StringExtractorGDBRemote &packet)
+GDBRemoteCommunicationServerLLGS::Handle_memory_read(StringExtractorGDBRemote 
&packet)
 {
 Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 
@@ -2008,7 +2010,7 @@ GDBRemoteCommunicationServerLLGS::Handle
 {
 if (log)
 log->Printf ("GDBRemoteCommunicationServerLLGS::%s nothing to 
read: zero-length packet", __FUNCTION__);
-return PacketResult::Success;
+return SendOKResponse();
 }
 
 // Allocate the response buffer.
@@ -2035,8 +2037,16 @@ GDBRemoteCommunicationServerLLGS::Handle
 }
 
 StreamGDBRemote response;
-for (size_t i = 0; i < bytes_read; ++i)
-response.PutHex8(buf[i]);
+packet.SetFilePos(0);
+char kind = packet.GetChar('?');
+if (kind == 'x')
+response.PutEscapedBytes(buf.data(), byte_count);
+else
+{
+assert(kind == 'm');
+for (size_t i = 0; i < bytes_read; ++i)
+response.PutHex8(buf[i]);
+}
 
 return SendPacketNoLock(response.GetData(), response.GetSize());
 }

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h?rev=250295&r1=250294&r2=250295&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBR

Re: [Lldb-commits] [PATCH] D13695: lldb-server: add support for binary memory reads

2015-10-14 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250295: lldb-server: add support for binary memory reads 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D13695?vs=37341&id=37342#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13695

Files:
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
  lldb/trunk/source/Utility/StringExtractorGDBRemote.h
  lldb/trunk/test/tools/lldb-server/TestGDBRemoteMemoryRead.py

Index: lldb/trunk/source/Utility/StringExtractorGDBRemote.h
===
--- lldb/trunk/source/Utility/StringExtractorGDBRemote.h
+++ lldb/trunk/source/Utility/StringExtractorGDBRemote.h
@@ -145,6 +145,8 @@
 eServerPacketType_s,
 eServerPacketType_S,
 eServerPacketType_T,
+eServerPacketType_x,
+eServerPacketType_X,
 eServerPacketType_Z,
 eServerPacketType_z,
 
Index: lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
===
--- lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
+++ lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
@@ -310,6 +310,12 @@
   case 'S':
 return eServerPacketType_S;
 
+  case 'x':
+return eServerPacketType_x;
+
+  case 'X':
+return eServerPacketType_X;
+
   case 'T':
 return eServerPacketType_T;
 
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -202,8 +202,9 @@
 PacketResult
 Handle_interrupt (StringExtractorGDBRemote &packet);
 
+// Handles $m and $x packets.
 PacketResult
-Handle_m (StringExtractorGDBRemote &packet);
+Handle_memory_read (StringExtractorGDBRemote &packet);
 
 PacketResult
 Handle_M (StringExtractorGDBRemote &packet);
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3043,14 +3043,8 @@
 char packet[64];
 int packet_len;
 bool binary_memory_read = m_gdb_comm.GetxPacketSupported();
-if (binary_memory_read)
-{
-packet_len = ::snprintf (packet, sizeof(packet), "x0x%" PRIx64 ",0x%" PRIx64, (uint64_t)addr, (uint64_t)size);
-}
-else
-{
-packet_len = ::snprintf (packet, sizeof(packet), "m%" PRIx64 ",%" PRIx64, (uint64_t)addr, (uint64_t)size);
-}
+packet_len = ::snprintf(packet, sizeof(packet), "%c%" PRIx64 ",%" PRIx64,
+binary_memory_read ? 'x' : 'm', (uint64_t)addr, (uint64_t)size);
 assert (packet_len + 1 < (int)sizeof(packet));
 StringExtractorGDBRemote response;
 if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true) == GDBRemoteCommunication::PacketResult::Success)
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -113,7 +113,7 @@
 RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_interrupt,
   &GDBRemoteCommunicationServerLLGS::Handle_interrupt);
 RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_m,
-  &GDBRemoteCommunicationServerLLGS::Handle_m);
+  &GDBRemoteCommunicationServerLLGS::Handle_memory_read);
 RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_M,
   &GDBRemoteCommunicationServerLLGS::Handle_M);
 RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_p,
@@ -164,6 +164,8 @@
   &GDBRemoteCommunicationServerLLGS::Handle_vCont);
 RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_vCont_actions,
   &GDBRemoteCommunicationServerLLGS::Handle_vCont_actions);
+RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_x,
+  &GDBRemoteCommunicationServerLLGS::Handle_memory_read);
 RegisterMemberFunctionHandler(StringE

[Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: labath, clayborg, vharron, zturner.
tberghammer added a subscriber: lldb-commits.
Herald added a subscriber: iancottrell.

Add a new task pool class to LLDB to make it easy to execute tasks in parallel

Basic design goals:
* Have a very lightweight and easy to use interface where a list of lambdas can 
be executed in parallel
* Use a global thread pool to limit the number of threads used (std::async 
don't do it on Linux) and to eliminate the thread creation overhead

Possible future improvements (please weight in about priorities about these and 
add what additional features you want to see):
* Possibility to cancel already added, but not yet started tasks
* Lazy creation of the worker threads
* Removing unused worker threads after some time
* Parallel for_each implementation

The first user of the thread pool will be the dwarf parsing code. An example of 
how it will be used is available at http://reviews.llvm.org/D13662 (diff 2)

http://reviews.llvm.org/D13727

Files:
  include/lldb/Utility/TaskPool.h
  source/Utility/CMakeLists.txt
  source/Utility/TaskPool.cpp

Index: source/Utility/TaskPool.cpp
===
--- /dev/null
+++ source/Utility/TaskPool.cpp
@@ -0,0 +1,59 @@
+//===- TaskPool.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Utility/TaskPool.h"
+
+TaskPool::TaskPoolImpl&
+TaskPool::GetImplementation()
+{
+static TaskPool::TaskPoolImpl g_task_pool_impl(std::thread::hardware_concurrency());
+return g_task_pool_impl;
+}
+
+TaskPool::TaskPoolImpl::TaskPoolImpl(uint32_t num_threads) :
+m_stop(false)
+{
+for (uint32_t i = 0; i < num_threads; ++i)
+m_threads.emplace_back(Worker, this);
+}
+
+TaskPool::TaskPoolImpl::~TaskPoolImpl()
+{
+Stop();
+}
+
+void
+TaskPool::TaskPoolImpl::Stop()
+{
+std::unique_lock lock(m_tasks_mutex);
+m_stop = true;
+lock.unlock();
+m_tasks_cv.notify_all();
+for (auto& t : m_threads)
+t.join();
+}
+
+void
+TaskPool::TaskPoolImpl::Worker(TaskPoolImpl* pool)
+{
+while (true)
+{
+std::unique_lock lock(pool->m_tasks_mutex);
+if (pool->m_tasks.empty())
+pool->m_tasks_cv.wait(lock, [pool](){ return !pool->m_tasks.empty() || pool->m_stop; });
+if (pool->m_tasks.empty())
+break;
+
+std::function f = pool->m_tasks.front();
+pool->m_tasks.pop();
+lock.unlock();
+
+f();
+}
+}
Index: source/Utility/CMakeLists.txt
===
--- source/Utility/CMakeLists.txt
+++ source/Utility/CMakeLists.txt
@@ -14,6 +14,7 @@
   StringExtractor.cpp
   StringExtractorGDBRemote.cpp
   StringLexer.cpp
+  TaskPool.cpp
   TimeSpecTimeout.cpp
   UriParser.cpp
   )
Index: include/lldb/Utility/TaskPool.h
===
--- /dev/null
+++ include/lldb/Utility/TaskPool.h
@@ -0,0 +1,210 @@
+//===- TaskPool.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+class TaskPool
+{
+public:
+TaskPool() = delete;
+
+// Add a new task to the thread pool and return a std::future belongs for the newly created task.
+// The caller of this function have to wait on the future for this task to complete.
+template
+static std::future::type>
+AddTask(F&& f, Args&&... args);
+
+// Run all of the specified tasks on the thread pool and wait until all of them are finished
+// before returning
+template
+static void
+RunTasks(T&&... t);
+
+private:
+template
+struct RunTaskImpl;
+
+class TaskPoolImpl
+{
+public:
+TaskPoolImpl(uint32_t num_threads);
+
+~TaskPoolImpl();
+
+template
+std::future::type>
+AddTask(F&& f, Args&&... args);
+
+void
+Stop();
+
+private:
+static void
+Worker(TaskPoolImpl* pool);
+
+std::queue> m_tasks;
+std::mutexm_tasks_mutex;
+std::condition_variable   m_tasks_cv;
+bool  m_stop;
+std::vector  m_threads;
+};
+
+static TaskPoolImpl&
+GetImplementation();
+};
+
+template 
+class TaskRunner
+{
+public:
+template
+void
+AddTask(F

Re: [Lldb-commits] [PATCH] D13662: Make dwarf parsing multi-threaded

2015-10-14 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 37353.
tberghammer added a comment.
Herald added a subscriber: iancottrell.

Use the new ThreadPool class and make the Append+Finalize stage parallel.


http://reviews.llvm.org/D13662

Files:
  source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  source/Plugins/SymbolFile/DWARF/NameToDIE.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -50,6 +50,8 @@
 
 #include "lldb/Target/Language.h"
 
+#include "lldb/Utility/TaskPool.h"
+
 #include "DWARFASTParser.h"
 #include "DWARFCompileUnit.h"
 #include "DWARFDebugAbbrev.h"
@@ -2035,40 +2037,71 @@
 "SymbolFileDWARF::Index (%s)",
 GetObjectFile()->GetFileSpec().GetFilename().AsCString(""));
 
+
+
 DWARFDebugInfo* debug_info = DebugInfo();
 if (debug_info)
 {
-uint32_t cu_idx = 0;
 const uint32_t num_compile_units = GetNumCompileUnits();
-for (cu_idx = 0; cu_idx < num_compile_units; ++cu_idx)
+std::vector function_basename_index(num_compile_units);
+std::vector function_fullname_index(num_compile_units);
+std::vector function_method_index(num_compile_units);
+std::vector function_selector_index(num_compile_units);
+std::vector objc_class_selectors_index(num_compile_units);
+std::vector global_index(num_compile_units);
+std::vector type_index(num_compile_units);
+std::vector namespace_index(num_compile_units);
+
+auto parser_fn = [this,
+  debug_info,
+  &function_basename_index,
+  &function_fullname_index,
+  &function_method_index,
+  &function_selector_index,
+  &objc_class_selectors_index,
+  &global_index,
+  &type_index,
+  &namespace_index](uint32_t cu_idx)
 {
 DWARFCompileUnit* dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
+bool clear_dies = dwarf_cu->ExtractDIEsIfNeeded(false) > 1;
 
-bool clear_dies = dwarf_cu->ExtractDIEsIfNeeded (false) > 1;
+dwarf_cu->Index(function_basename_index[cu_idx],
+function_fullname_index[cu_idx],
+function_method_index[cu_idx],
+function_selector_index[cu_idx],
+objc_class_selectors_index[cu_idx],
+global_index[cu_idx],
+type_index[cu_idx],
+namespace_index[cu_idx]);
 
-dwarf_cu->Index (m_function_basename_index,
- m_function_fullname_index,
- m_function_method_index,
- m_function_selector_index,
- m_objc_class_selectors_index,
- m_global_index, 
- m_type_index,
- m_namespace_index);
-
 // Keep memory down by clearing DIEs if this generate function
 // caused them to be parsed
 if (clear_dies)
-dwarf_cu->ClearDIEs (true);
-}
-
-m_function_basename_index.Finalize();
-m_function_fullname_index.Finalize();
-m_function_method_index.Finalize();
-m_function_selector_index.Finalize();
-m_objc_class_selectors_index.Finalize();
-m_global_index.Finalize(); 
-m_type_index.Finalize();
-m_namespace_index.Finalize();
+dwarf_cu->ClearDIEs(true);
+};
+
+TaskRunner task_runner;
+for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx)
+task_runner.AddTask(parser_fn, cu_idx);
+task_runner.WaitForAllTask();
+
+auto merge_fn = [](NameToDIE& target, const std::vector& sources)
+{
+for (const auto& src : sources)
+target.Append(src);
+target.Finalize();
+};
+
+TaskPool::RunTasks(
+[&]() { merge_fn(m_function_basename_index, function_basename_index); },
+[&]() { merge_fn(m_function_fullname_index, function_fullname_index); },
+[&]() { merge_fn(m_function_method_index, function_method_index); },
+[&]() { merge_fn(m_function_selector_index, function_selector_index); },
+[&]() { merge_fn(m_objc_class_selectors_index, objc_class_selectors_index); },
+[&]() { merge_fn(m_global_index, global_index); },
+[&]() { merge_fn(m_type_index, type_index); },
+[&]() { merge_fn(

[Lldb-commits] [lldb] r250299 - cmake: provide flag that enables 'log enable --stack' to provide useful file/function info on POSIX systems

2015-10-14 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Wed Oct 14 09:52:15 2015
New Revision: 250299

URL: http://llvm.org/viewvc/llvm-project?rev=250299&view=rev
Log:
cmake: provide flag that enables 'log enable --stack' to provide useful 
file/function info on POSIX systems

Adding the following flag to a cmake line:
-DLLDB_EXPORT_ALL_SYMBOLS=TRUE

will cause all symbols to be exported from liblldb.  This enables the llvm
backtrace mechanism to see and report backtrace symbols properly when using
(lldb) log enable --stack ...

Prior to this change, only the SB API symbols would show up on Linux and other
systems that use a public-symbols-based backtrace lookup mechanism.

log enable --stack ... is a very handy, quick way to understand the flow
of how some log lines are getting hit within lldb without having to hook
up a top-level debugger over your current debug session.

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/source/API/CMakeLists.txt

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=250299&r1=250298&r2=250299&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Wed Oct 14 09:52:15 2015
@@ -96,3 +96,19 @@ macro(add_lldb_executable name)
   add_llvm_executable(${name} ${ARGN})
   set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
 endmacro(add_lldb_executable)
+
+# Support appending linker flags to an existing target.
+# This will preserve the existing linker flags on the
+# target, if there are any.
+function(lldb_append_link_flags target_name new_link_flags)
+  # Retrieve existing linker flags.
+  get_target_property(current_link_flags ${target_name} LINK_FLAGS)
+
+  # If we had any linker flags, include them first in the new linker flags.
+  if(current_link_flags)
+set(new_link_flags "${current_link_flags} ${new_link_flags}")
+  endif()
+
+  # Now set them onto the target.
+  set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
+endfunction()

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=250299&r1=250298&r2=250299&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Wed Oct 14 09:52:15 2015
@@ -29,6 +29,15 @@ set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_D
 set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
   "Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
 
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
+"Causes lldb to export all symbols when building liblldb.")
+else()
+  # Windows doesn't support toggling this, so don't bother making it a
+  # cache variable.
+  set(LLDB_EXPORT_ALL_SYMBOLS 0)
+endif()
+
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
 endif()

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=250299&r1=250298&r2=250299&view=diff
==
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Wed Oct 14 09:52:15 2015
@@ -82,7 +82,21 @@ set_target_properties(liblldb
   )
 
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
+  if (NOT LLDB_EXPORT_ALL_SYMBOLS)
+# If we're not exporting all symbols, we'll want to explicitly set
+# the exported symbols here.  This prevents 'log enable --stack ...'
+# from working on some systems but limits the liblldb size.
+MESSAGE("-- Symbols (liblldb): only exporting liblldb.exports symbols")
+add_llvm_symbol_exports(liblldb 
${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
+  else()
+# Don't use an explicit export.  Instead, tell the linker to
+# export all symbols.
+MESSAGE("-- Symbols (liblldb): exporting all symbols")
+# Darwin linker doesn't need this extra step.
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  lldb_append_link_flags(liblldb "-Wl,--export-dynamic")
+endif()
+  endif()
 endif()
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )


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


Re: [Lldb-commits] [PATCH] D13667: cmake: provide flag that enables 'log enable --stack' to provide useful file/line info on POSIX systems

2015-10-14 Thread Todd Fiala via lldb-commits
tfiala closed this revision.
tfiala added a comment.

Closed by the following commit:

  svn commit
  Sendingcmake/modules/AddLLDB.cmake
  Sendingcmake/modules/LLDBConfig.cmake
  Sendingsource/API/CMakeLists.txt
  Transmitting file data ...
  Committed revision 250299.


http://reviews.llvm.org/D13667



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


Re: [Lldb-commits] [PATCH] D10624: [ValueObjectPrinter::GetValueSummaryError] Get summary of non-synthetic values.

2015-10-14 Thread Michael Mayers via lldb-commits
tweakoz added a subscriber: tweakoz.
tweakoz added a comment.

I am hitting this also.
Happens when I want a summary and a synthetic on the same type...


http://reviews.llvm.org/D10624



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Pavel Labath via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

Although it may not seem from the number of my comments, I actually quite like 
this implementation. However, I think more work needs to be done to make this 
future-proof.

- we definitely need unit tests for this.
- we need more documentation (especially on the public interfaces, but the 
trickier internal parts could use some explanation as well).



Comment at: include/lldb/Utility/TaskPool.h:23
@@ +22,3 @@
+
+// Add a new task to the thread pool and return a std::future belongs for 
the newly created task.
+// The caller of this function have to wait on the future for this task to 
complete.

belonging to


Comment at: include/lldb/Utility/TaskPool.h:24
@@ +23,3 @@
+// Add a new task to the thread pool and return a std::future belongs for 
the newly created task.
+// The caller of this function have to wait on the future for this task to 
complete.
+template

s/have/has


Comment at: include/lldb/Utility/TaskPool.h:33
@@ +32,3 @@
+static void
+RunTasks(T&&... t);
+

Perhahs the entire TaskPool could be an implementation detail and this 
functionality would be accessed (via a static method on) TaskRunner? What do 
you think? I have found it confusing it the other commit, why you sometimes use 
TaskPool and another time TaskRunner...


Comment at: include/lldb/Utility/TaskPool.h:80
@@ +79,3 @@
+void
+WaitForAllTask();
+

WaitForAllTasks


Comment at: include/lldb/Utility/TaskPool.h:103
@@ +102,3 @@
+
+template
+struct TaskPool::RunTaskImpl

Suggestion: name these `Head`, `Tail`. You use `T` for other purposes 
elsewhere, and I have spent a lot of time trying to figure out why is this `H` 
and not `F` before I figured out what's going on here.


Comment at: include/lldb/Utility/TaskPool.h:126
@@ +125,3 @@
+{
+auto task = std::make_shared::type()>>(
+std::bind(std::forward(f), std::forward(args)...));

task_sp


Comment at: include/lldb/Utility/TaskPool.h:138
@@ +137,3 @@
+
+template 
+template

You use `T` for both "task" and the "result value of a task". Could you 
disambiguate the two. Suggestion: `Ret` (or `Return`) and `Task`.


Comment at: include/lldb/Utility/TaskPool.h:145
@@ +144,3 @@
+auto it = m_pending.emplace(m_pending.end());
+*it = std::move(TaskPool::AddTask(
+[this, it](F&& f, Args&&... args)

This construction is quite convoluted. Do you actually need a list of the 
pending tasks anywhere? As far as I can tell, you only need to check if there 
are any tasks pending, which can be done with a simple (atomic) integer.


Comment at: include/lldb/Utility/TaskPool.h:148
@@ +147,3 @@
+{
+T&& r = f(args...);
+

Is `std::forward` needed here?


http://reviews.llvm.org/D13727



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


[Lldb-commits] [PATCH] D13730: Resubmit: RenderScript command for printing allocation contents

2015-10-14 Thread Ewan Crawford via lldb-commits
EwanCrawford created this revision.
EwanCrawford added reviewers: granata.enrico, clayborg, jingham.
EwanCrawford added subscribers: lldb-commits, domipheus, labath.
EwanCrawford set the repository for this revision to rL LLVM.

Previous patch http://reviews.llvm.org/D13699 broke 
TestDataFormatterSmartArray.py
Resolved in in this patch by adding the new enum `eFormatVectorOfFloat16` to 
FormatManager.

I'm not too familiar with DataFormatter code, so +Enrico as he's code owner.



Repository:
  rL LLVM

http://reviews.llvm.org/D13730

Files:
  include/lldb/lldb-enumerations.h
  source/Commands/CommandObjectMemory.cpp
  source/Core/DataExtractor.cpp
  source/DataFormatters/FormatManager.cpp
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h

Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
===
--- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -202,6 +202,8 @@
 
 void DumpKernels(Stream &strm) const;
 
+bool DumpAllocation(Stream &strm, StackFrame* frame_ptr, const uint32_t id);
+
 void ListAllocations(Stream &strm, StackFrame* frame_ptr, bool recompute);
 
 void AttemptBreakpointAtKernelName(Stream &strm, const char *name, Error &error, lldb::TargetSP target);
@@ -298,6 +300,8 @@
 void CaptureAllocationInit1(RuntimeHook* hook_info, ExecutionContext& context);
 void CaptureSetGlobalVar1(RuntimeHook* hook_info, ExecutionContext& context);
 
+AllocationDetails* FindAllocByID(Stream &strm, const uint32_t alloc_id);
+
 //
 // Helper functions for jitting the runtime
 //
@@ -310,6 +314,10 @@
 
 bool JITElementPacked(AllocationDetails* allocation, StackFrame* frame_ptr);
 
+bool JITAllocationSize(AllocationDetails* allocation, StackFrame* frame_ptr, const uint32_t elem_size);
+
+bool JITAllocationStride(AllocationDetails* allocation, StackFrame* frame_ptr);
+
 // Search for a script detail object using a target address.
 // If a script does not currently exist this function will return nullptr.
 // If 'create' is true and there is no previous script with this address,
Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===
--- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -14,6 +14,7 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Host/StringConvert.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/Process.h"
@@ -188,6 +189,9 @@
 // Maps Allocation DataKind enum to printable strings
 static const char* RsDataKindToString[];
 
+// Maps allocation types to format sizes for printing.
+static const unsigned int RSTypeToFormat[][3];
+
 // Give each allocation an ID as a way
 // for commands to reference it.
 const unsigned int id;
@@ -201,6 +205,8 @@
 empirical_type type_ptr;// Pointer to the RS Type of the Allocation
 empirical_type element_ptr; // Pointer to the RS Element of the Type
 empirical_type context; // Pointer to the RS Context of the Allocation
+empirical_type size;// Size of the allocation
+empirical_type stride;  // Stride between rows of the allocation
 
 // Give each allocation an id, so we can reference it in user commands.
 AllocationDetails(): id(ID++)
@@ -242,6 +248,31 @@
 {"bool", "bool2", "bool3", "bool4"}
 };
 
+// Used as an index into the RSTypeToFormat array elements
+enum TypeToFormatIndex {
+   eFormatSingle = 0,
+   eFormatVector,
+   eElementSize
+};
+
+// { format enum of single element, format enum of element vector, size of element}
+const unsigned int RenderScriptRuntime::AllocationDetails::RSTypeToFormat[][3] =
+{
+{eFormatHex, eFormatHex, 1}, // RS_TYPE_NONE
+{eFormatFloat, eFormatVectorOfFloat16, 2}, // RS_TYPE_FLOAT_16
+{eFormatFloat, eFormatVectorOfFloat32, sizeof(float)}, // RS_TYPE_FLOAT_32
+{eFormatFloat, eFormatVectorOfFloat64, sizeof(double)}, // RS_TYPE_FLOAT_64
+{eFormatDecimal, eFormatVectorOfSInt8, sizeof(int8_t)}, // RS_TYPE_SIGNED_8
+{eFormatDecimal, eFormatVectorOfSInt16, sizeof(int16_t)}, // RS_TYPE_SIGNED_16
+{eFormatDecimal, eFormatVectorOfSInt32, sizeof(int32_t)}, // RS_TYPE_SIGNED_32
+{eFormatDecimal, eFormatVectorOfSInt64, sizeof(int64_t)}, // RS_TYPE_SIGNED_64
+{eFormatDecimal, eFormatVectorOfUInt8, sizeof(uint8_t)}, // RS_TYPE_UNSIGNED_8
+{eFormatDecimal, eFormatV

Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Zachary Turner via lldb-commits
zturner added a comment.

Can this be done in such a way that everything boils down to a single call to 
std::async on platforms that support thread limiting?

Alternatively, why not just put a semaphore inside of the lambda that you run 
with std::async to limit the number of threads?  This seems overly complicated 
when you could solve it much simpler in a way that makes the most efficient use 
of every platform's asynchronous handling support.


http://reviews.llvm.org/D13727



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


[Lldb-commits] [lldb] r250304 - Minor cleanup on PythonDataObject constructors.

2015-10-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 14 11:59:44 2015
New Revision: 250304

URL: http://llvm.org/viewvc/llvm-project?rev=250304&view=rev
Log:
Minor cleanup on PythonDataObject constructors.

Added a constructor that takes list_size for `PythonList`.
Made all single-argument constructors explicit.
Re-ordered constructors to be consistent with other classes.

Modified:
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=250304&r1=250303&r2=250304&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
Wed Oct 14 11:59:44 2015
@@ -378,6 +378,12 @@ PythonList::PythonList(PyInitialValue va
 Reset(PyRefType::Owned, PyList_New(0));
 }
 
+PythonList::PythonList(int list_size)
+: PythonObject()
+{
+Reset(PyRefType::Owned, PyList_New(list_size));
+}
+
 PythonList::PythonList(PyRefType type, PyObject *py_obj)
 : PythonObject()
 {

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h?rev=250304&r1=250303&r2=250304&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h Wed 
Oct 14 11:59:44 2015
@@ -215,10 +215,10 @@ class PythonString : public PythonObject
 {
 public:
 PythonString();
-PythonString(PyRefType type, PyObject *o);
-PythonString(const PythonString &object);
 explicit PythonString(llvm::StringRef string);
 explicit PythonString(const char *string);
+PythonString(PyRefType type, PyObject *o);
+PythonString(const PythonString &object);
 ~PythonString() override;
 
 static bool Check(PyObject *py_obj);
@@ -243,9 +243,9 @@ class PythonInteger : public PythonObjec
 {
 public:
 PythonInteger();
+explicit PythonInteger(int64_t value);
 PythonInteger(PyRefType type, PyObject *o);
 PythonInteger(const PythonInteger &object);
-explicit PythonInteger(int64_t value);
 ~PythonInteger() override;
 
 static bool Check(PyObject *py_obj);
@@ -266,7 +266,8 @@ public:
 class PythonList : public PythonObject
 {
 public:
-PythonList(PyInitialValue value);
+explicit PythonList(PyInitialValue value);
+explicit PythonList(int list_size);
 PythonList(PyRefType type, PyObject *o);
 PythonList(const PythonList &list);
 ~PythonList() override;
@@ -292,7 +293,7 @@ public:
 class PythonDictionary : public PythonObject
 {
 public:
-PythonDictionary(PyInitialValue value);
+explicit PythonDictionary(PyInitialValue value);
 PythonDictionary(PyRefType type, PyObject *o);
 PythonDictionary(const PythonDictionary &dict);
 ~PythonDictionary() override;
@@ -313,6 +314,7 @@ public:
 
 StructuredData::DictionarySP CreateStructuredDictionary() const;
 };
+
 } // namespace lldb_private
 
 #endif  // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H


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


[Lldb-commits] [lldb] r250303 - Change swig interface files to use PythonDataObjects.

2015-10-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 14 11:59:32 2015
New Revision: 250303

URL: http://llvm.org/viewvc/llvm-project?rev=250303&view=rev
Log:
Change swig interface files to use PythonDataObjects.

Modified:
lldb/trunk/scripts/Python/python-extensions.swig
lldb/trunk/scripts/Python/python-typemaps.swig
lldb/trunk/scripts/lldb.swig
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: lldb/trunk/scripts/Python/python-extensions.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=250303&r1=250302&r2=250303&view=diff
==
--- lldb/trunk/scripts/Python/python-extensions.swig (original)
+++ lldb/trunk/scripts/Python/python-extensions.swig Wed Oct 14 11:59:32 2015
@@ -8,9 +8,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 }
 %extend lldb::SBBlock {
@@ -22,9 +22,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 }
 %extend lldb::SBBreakpoint {
@@ -36,9 +36,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 
 %pythoncode %{ 
@@ -65,9 +65,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 }
 
@@ -96,9 +96,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 
 /* the write() and flush() calls are not part of the SB API proper, 
and are solely for Python usage
@@ -123,9 +123,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 %pythoncode %{ 
 def __eq__(self, rhs):
@@ -150,9 +150,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromStringAndSize (desc, desc_len);
+return lldb_private::PythonString(llvm::StringRef(desc, 
desc_len)).release();
 else
-return PyString_FromString("");
+return lldb_private::PythonString("").release();
 }
 }
 %extend lldb::SBDebugger {
@@ -164,9 +164,9 @@
 if (desc_len > 0 && (desc[desc_len-1] == '\n' || 
desc[desc_len-1] == '\r'))
 --desc_len;
 if (desc_len > 0)
-return PyString_FromS

Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

We can change this class to use std::async on Windows and an std::thread based 
implementation on Linux with the same interface (other OS-es should be decided) 
but I would prefer to use just 1 logic as it is easier to maintain.

Limiting the number of threads with adding a semaphore to the beginning of the 
lambda given to std::async wouldn't work because if the number of threads 
aren't limited inside the implementation of std::async then we still create a 
huge number of threads what will be blocked on the semaphore call but they 
still consume the resources. Guarding the std::async calls with a semaphore can 
limit the number of thread but it will make them a blocking call what isn't 
really something I want to see.

On Linux using this thread pooling code instead of std::async achieved a ~25% 
speedup on the dwarf parsing code. I haven't investigated the exact reasons but 
I think the difference is that we don't create a lot of thread (thread creation 
isn't too cheap) and the lower number of threads decrease the number of 
congestion.


http://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [PATCH] D13662: Make dwarf parsing multi-threaded

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Missing the TaskPool.h and TaskPool.cpp files?


http://reviews.llvm.org/D13662



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Zachary Turner via lldb-commits
zturner added a comment.

Ok, it seems reasonable to just use std::async on platforms that this is ok on, 
and not use it on platforms which it's not ok on.  I think it should be enabled 
on Windows, but I'll leave it up to you to decide whether it's a whitelist or a 
blacklist.


http://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

Admittedly way simpler than my original idea. +1

Having the RTTI support so that these SBTypeSummary objects can actually be 
used for anything other than mere creation would be nice.
However, I can fill that gap myself later.



Comment at: source/API/SBTypeSummary.cpp:157
@@ +156,3 @@
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;

I assume you are essentially relying on the SBValue constructor that takes a 
ValueObjectSP here, right?
And similarly for the SummaryOptions?


Comment at: source/API/SBTypeSummary.cpp:162
@@ +161,3 @@
+   },
+   "SBTypeSummary formatter callbacxk"
+   )

Any reason not to let people submit their own name/description for the summary 
formatter here?


http://reviews.llvm.org/D13657



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


[Lldb-commits] [lldb] r250306 - Fix Python initialization for Python 3.

2015-10-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 14 12:51:29 2015
New Revision: 250306

URL: http://llvm.org/viewvc/llvm-project?rev=250306&view=rev
Log:
Fix Python initialization for Python 3.

Python 3 reverses the order in which you must call Py_InitializeEx
and PyEval_InitThreads.  Since that log is in itself already a
little nuanced, it is refactored into a function so that the reversal
is more clear.  At the same time, there's a lot of logic during
Python initialization to save off a bunch of state and then restore
it after initialization is complete.  To express this more cleanly,
it is refactored to an RAII-style pattern where state is saved off
on acquisition and restored on release.

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=250306&r1=250305&r2=250306&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Wed Oct 14 12:51:29 2015
@@ -80,27 +80,101 @@ static ScriptInterpreterPython::SWIGPyth
 
 static bool g_initialized = false;
 
-#if PY_MAJOR_VERSION >= 3 && defined(LLDB_PYTHON_HOME)
-typedef wchar_t PythonHomeChar;
+namespace
+{
+
+// Initializing Python is not a straightforward process.  We cannot control 
what
+// external code may have done before getting to this point in LLDB, including
+// potentially having already initialized Python, so we need to do a lot of 
work
+// to ensure that the existing state of the system is maintained across our
+// initialization.  We do this by using an RAII pattern where we save off 
initial
+// state at the beginning, and restore it at the end 
+struct InitializePythonRAII
+{
+public:
+InitializePythonRAII() :
+m_was_already_initialized(false),
+m_gil_state(PyGILState_UNLOCKED)
+{
+// Python will muck with STDIN terminal state, so save off any current 
TTY
+// settings so we can restore them.
+m_stdin_tty_state.Save(STDIN_FILENO, false);
+
+InitializePythonHome();
+
+// Python < 3.2 and Python >= 3.2 reversed the ordering requirements 
for
+// calling `Py_Initialize` and `PyEval_InitThreads`.  < 3.2 requires 
that you
+// call `PyEval_InitThreads` first, and >= 3.2 requires that you call 
it last.
+#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2) || (PY_MAJOR_VERSION > 3)
+Py_InitializeEx(0);
+InitializeThreadsPrivate();
 #else
-typedef char PythonHomeChar;
+InitializeThreadsPrivate();
+Py_InitializeEx(0);
 #endif
+}
 
-PythonHomeChar *
-GetDesiredPythonHome()
-{
+~InitializePythonRAII()
+{
+if (m_was_already_initialized)
+{
+Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT 
| LIBLLDB_LOG_VERBOSE));
+
+if (log)
+{
+log->Printf("Releasing PyGILState. Returning to state = 
%slocked\n",
+m_was_already_initialized == PyGILState_UNLOCKED ? "un" : 
"");
+}
+PyGILState_Release(m_gil_state);
+}
+else
+{
+// We initialized the threads in this function, just unlock the 
GIL.
+PyEval_SaveThread();
+}
+
+m_stdin_tty_state.Restore();
+}
+
+private:
+void InitializePythonHome()
+{
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static PythonHomeChar *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, 
&size);
-return g_python_home;
+size_t size = 0;
+static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, 
&size);
 #else
-static PythonHomeChar *g_python_home = LLDB_PYTHON_HOME;
-return g_python_home;
+static char *g_python_home = LLDB_PYTHON_HOME;
 #endif
-#else
-return nullptr;
+Py_SetPythonHome(g_python_home);
 #endif
+}
+
+void InitializeThreadsPrivate()
+{
+if (PyEval_ThreadsInitialized())
+{
+Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT 
| LIBLLDB_LOG_VERBOSE));
+
+m_was_already_initialized = true;
+m_gil_state = PyGILState_Ensure();
+if (log)
+{
+log->Printf("Ensured PyGILState. Previous state = %slocked\n",
+m_gil_state == PyGILState_UNLOCKED ? "un" : "");
+}
+return;
+}
+
+// InitThreads acquires the GIL if it hasn't been called before.
+PyEval_InitThreads();
+}
+
+TerminalState m_stdin_tty_state;
+PyGILState_STATE m_gil_state;
+bool m_was_already_initialized;
+};
+
 }
 
 static s

Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Enrico Granata via lldb-commits
granata.enrico added inline comments.


Comment at: source/API/SBTypeSummary.cpp:155
@@ +154,3 @@
+   new CXXFunctionSummaryFormat(options, 
+   [cb] (ValueObject& valobj, Stream& stm, const 
TypeSummaryOptions& opt) -> bool {
+SBStream stream;

Should we check for cb != null here?


http://reviews.llvm.org/D13657



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


Re: [Lldb-commits] [PATCH] D13699: RenderScript command for printing allocation contents.

2015-10-14 Thread Enrico Granata via lldb-commits
granata.enrico added a subscriber: granata.enrico.
granata.enrico added a comment.

Is there any reason why we need a special command here?

Are these allocations not bound to any user-visible variable, such that one 
could get the same result by using our existing data inspection commands 
(expression, frame variable, ...) with some data formatter support?


Repository:
  rL LLVM

http://reviews.llvm.org/D13699



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


Re: [Lldb-commits] [PATCH] D13662: Make dwarf parsing multi-threaded

2015-10-14 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

Please see http://reviews.llvm.org/D13727


http://reviews.llvm.org/D13662



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.

I agree with labath's comments and see if we can move TaskPoolImpl into the 
.cpp file.



Comment at: include/lldb/Utility/TaskPool.h:39-66
@@ +38,30 @@
+
+class TaskPoolImpl
+{
+public:
+TaskPoolImpl(uint32_t num_threads);
+
+~TaskPoolImpl();
+
+template
+std::future::type>
+AddTask(F&& f, Args&&... args);
+
+void
+Stop();
+
+private:
+static void
+Worker(TaskPoolImpl* pool);
+
+std::queue> m_tasks;
+std::mutexm_tasks_mutex;
+std::condition_variable   m_tasks_cv;
+bool  m_stop;
+std::vector  m_threads;
+};
+
+static TaskPoolImpl&
+GetImplementation();
+};
+

Can TaskPoolImpl be moved to the .cpp file in the anonymous namespace?


http://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Any std::async adoption will need to be able to deliver tasks as they complete 
via "TaskRunner::WaitForNextCompletedTask()".

We had a previous example where 1000 items could be pushed onto a std::vector 
of tasks and then the code was doing:

  for (i=0; ihttp://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [PATCH] D13662: Make dwarf parsing multi-threaded

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Just saw that patch, so this looks good then pending the other patch.


http://reviews.llvm.org/D13662



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


Re: [Lldb-commits] [PATCH] D13662: Make dwarf parsing multi-threaded

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg added a comment.

BTW: if we can modify clang to produce the Apple accelerator tables, we won't 
need to do any of this indexing which will really speed up debugging! We only 
produce the Apple accelerator tables on Darwin, but we could on other systems. 
There is also a new version of the accelerator tables that is going to be in 
DWARF 5 that is a modified version of our Apple accelerator tables. The Apple 
accelerator tables are actual accelerator tables that can be mmap'ed in and 
used as is. All other DWARF accelerator tables are actually not accelerator 
tables, they are randomly ordered tables that need to be sorted and ingested 
and often don't contain the correct things that a debugger wants. Like 
".debug_pubtypes" will only mention "public" types. Any private types are not 
in the table. So the table is useless. Same goes for "debug_pubnames": only 
"public" names... Useless. So our new accelerator tables actually have all of 
the data in a format that can be used as is, no extra sorting required. They 
really speed up debugging and stop us from having to index the DWARF manually.


http://reviews.llvm.org/D13662



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Zachary Turner via lldb-commits
zturner added a comment.

I thought about this some more and I'm fine with going with a single 
implementation and not using std async.  It would be nice to take advantage of 
any deep optimizations std::async provides over a hand-rolled solution, but at 
the same time there's a cost to adding complexity and asymmetric 
implementations, even if the asymmetry is hidden behind this interface.  And 
the gain we get from goign single threaded -> this implementation is much 
greater than we would theoretically get from going from this implementation -> 
std async.

I'll look more closely at the implementation and see if I have other comments, 
but the general idea is fine.


http://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [lldb] r250306 - Fix Python initialization for Python 3.

2015-10-14 Thread Ed Maste via lldb-commits
On 14 October 2015 at 13:51, Zachary Turner via lldb-commits
 wrote:
> Author: zturner
> Date: Wed Oct 14 12:51:29 2015
> New Revision: 250306
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250306&view=rev
> Log:
> Fix Python initialization for Python 3.

This introduced a new warning for me:

../tools/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:96:9:
warning: field 'm_was_already_initialized' will be initialized after
field 'm_gil_state' [-Wreorder]
m_was_already_initialized(false),
^
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Eugene Leviant via lldb-commits
evgeny777 added a comment.

One question: CreateWithCallback and CreateWithSummaryString do not require 
Python support and can be used with LLDB_DISABLE_PYTHON. May be it makes sense 
to remove conditional compilation, like it is done here:

http://reviews.llvm.org/D13577



Comment at: source/API/SBTypeSummary.cpp:155
@@ +154,3 @@
+   new CXXFunctionSummaryFormat(options, 
+   [cb] (ValueObject& valobj, Stream& stm, const 
TypeSummaryOptions& opt) -> bool {
+SBStream stream;

granata.enrico wrote:
> Should we check for cb != null here?
May be assert(cb) ?


Comment at: source/API/SBTypeSummary.cpp:157
@@ +156,3 @@
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;

granata.enrico wrote:
> I assume you are essentially relying on the SBValue constructor that takes a 
> ValueObjectSP here, right?
> And similarly for the SummaryOptions?
You're right - implicit construction here


Comment at: source/API/SBTypeSummary.cpp:162
@@ +161,3 @@
+   },
+   "SBTypeSummary formatter callbacxk"
+   )

granata.enrico wrote:
> Any reason not to let people submit their own name/description for the 
> summary formatter here?
Probably it makes sense adding extra parameter to CreateWithCallback()


http://reviews.llvm.org/D13657



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Zachary Turner via lldb-commits
zturner added a comment.

The only real suggestion / question I have is a design one.

By using this implementation we can't take advantage of the system thread pool. 
 That was the point of using std async in the first place, but we found that it 
doesn't always limit the number of threads.  Maybe there's a way to get the 
best of both worlds.

What if, instead of storing a `std::queue>` you instead 
store a `std::queue`.  Now the only problem that remains is 
how to guarantee that no more than `std::hardware_concurrency()` of these 
`packaged_task` is waiting at any given time.  You could do this by taking the 
`std::function` that someone gives you, and wrapping it in a `packaged_task` 
which first runs the function, and then signals a condition variable after the 
function completes.  Then a single "dispatch" thread (for lack of a better 
word) could wake on this condition variable, pull a new `packaged_task` off the 
queue, and execute it asynchronously.  You'd also need to signal that same 
condition variable when a new item is added to the queue so that the dispatch 
thread could decide whether to run it immediately (if it's under-scheduled) or 
wait if it's full.

This would probably also make the implementation quite a bit simpler as well as 
being able to take advantage of any deep optimizations a platform has in its 
own thread pool implementation (if any).


http://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Enrico Granata via lldb-commits
granata.enrico added inline comments.


Comment at: source/API/SBTypeSummary.cpp:155
@@ +154,3 @@
+   new CXXFunctionSummaryFormat(options, 
+   [cb] (ValueObject& valobj, Stream& stm, const 
TypeSummaryOptions& opt) -> bool {
+SBStream stream;

evgeny777 wrote:
> granata.enrico wrote:
> > Should we check for cb != null here?
> May be assert(cb) ?
No, I would rather much us create an hollow SBTypeSummary (with a 
TypeSummaryImplSP that points to nullptr). Then you would get an invalid one 
(IsValid() == false) but not cause a crash


Comment at: source/API/SBTypeSummary.cpp:157
@@ +156,3 @@
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;

evgeny777 wrote:
> granata.enrico wrote:
> > I assume you are essentially relying on the SBValue constructor that takes 
> > a ValueObjectSP here, right?
> > And similarly for the SummaryOptions?
> You're right - implicit construction here
Sorry to nitpick, but is there any advantage to not using explicit construction 
here?


http://reviews.llvm.org/D13657



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


Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Eugene Leviant via lldb-commits
evgeny777 added inline comments.


Comment at: source/API/SBTypeSummary.cpp:157
@@ +156,3 @@
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;

granata.enrico wrote:
> evgeny777 wrote:
> > granata.enrico wrote:
> > > I assume you are essentially relying on the SBValue constructor that 
> > > takes a ValueObjectSP here, right?
> > > And similarly for the SummaryOptions?
> > You're right - implicit construction here
> Sorry to nitpick, but is there any advantage to not using explicit 
> construction here?
None, except more compact code. Would like to use explicit construction here?


http://reviews.llvm.org/D13657



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


Re: [Lldb-commits] [lldb] r250306 - Fix Python initialization for Python 3.

2015-10-14 Thread Zachary Turner via lldb-commits
Thanks for the heads up.  I have some more patches coming in soon, since
this is just a warning and not a blocker I'll fix it in one of these
followup patches.

On Wed, Oct 14, 2015 at 11:38 AM Ed Maste  wrote:

> On 14 October 2015 at 13:51, Zachary Turner via lldb-commits
>  wrote:
> > Author: zturner
> > Date: Wed Oct 14 12:51:29 2015
> > New Revision: 250306
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=250306&view=rev
> > Log:
> > Fix Python initialization for Python 3.
>
> This introduced a new warning for me:
>
>
> ../tools/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:96:9:
> warning: field 'm_was_already_initialized' will be initialized after
> field 'm_gil_state' [-Wreorder]
> m_was_already_initialized(false),
> ^
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Zach: If these are implementation details, lets get this in first and then 
worry about optimizations later.


http://reviews.llvm.org/D13727



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


Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB

2015-10-14 Thread Zachary Turner via lldb-commits
zturner added a comment.

Well, it's not just an optimization.  Threading code is hard to reason about, 
and the more complicated an implementation the more likely it is to have race 
conditions or other problems.  So any opportunity to reduce the amount of 
manual thread management is a win in that sense.

Anyway, it was mostly a question / suggestion, not something I'm going to block 
over, so if everyone feels it's ok to go in this way then go for it.  But if 
you read through the CL, it's not easy to be 100% confident that there are no 
race conditions.  If all you've got is a single condition variable which wakes 
up and sends something to the standard library implementation, it's a lot 
easier to have that confidence.  The optimization is just a side benefit.


http://reviews.llvm.org/D13727



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


[Lldb-commits] [lldb] r250322 - Avoid a -Wreorder warning in ScriptInterpreterPython.cpp.

2015-10-14 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Wed Oct 14 15:39:41 2015
New Revision: 250322

URL: http://llvm.org/viewvc/llvm-project?rev=250322&view=rev
Log:
Avoid a -Wreorder warning in ScriptInterpreterPython.cpp.

Modified:

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=250322&r1=250321&r2=250322&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Wed Oct 14 15:39:41 2015
@@ -93,8 +93,8 @@ struct InitializePythonRAII
 {
 public:
 InitializePythonRAII() :
-m_was_already_initialized(false),
-m_gil_state(PyGILState_UNLOCKED)
+m_gil_state(PyGILState_UNLOCKED),
+m_was_already_initialized(false)
 {
 // Python will muck with STDIN terminal state, so save off any current 
TTY
 // settings so we can restore them.


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


Re: [Lldb-commits] [PATCH] D13657: [lldb] char summary provider

2015-10-14 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

So, if you do the explicit constructor change and handle the case of a nullptr 
Callback I think it should be good to go. Looking forward to it!



Comment at: source/API/SBTypeSummary.cpp:157
@@ +156,3 @@
+SBStream stream;
+if (!cb(valobj.GetSP(), &opt, stream))
+return false;

evgeny777 wrote:
> granata.enrico wrote:
> > evgeny777 wrote:
> > > granata.enrico wrote:
> > > > I assume you are essentially relying on the SBValue constructor that 
> > > > takes a ValueObjectSP here, right?
> > > > And similarly for the SummaryOptions?
> > > You're right - implicit construction here
> > Sorry to nitpick, but is there any advantage to not using explicit 
> > construction here?
> None, except more compact code. Would like to use explicit construction here?
Yes, I would prefer that

It saves us a few lines of code, but it is confusing to read, and I want to 
make sure we don't break sometime in the future due to changes in the 
constructor (the ones taking SPs are technically private to us)


http://reviews.llvm.org/D13657



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


Re: [Lldb-commits] [lldb] r250322 - Avoid a -Wreorder warning in ScriptInterpreterPython.cpp.

2015-10-14 Thread Zachary Turner via lldb-commits
Thanks, I had a CL coming to fix this but you beat me to it.

On Wed, Oct 14, 2015 at 1:41 PM Stephane Sezer via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: sas
> Date: Wed Oct 14 15:39:41 2015
> New Revision: 250322
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250322&view=rev
> Log:
> Avoid a -Wreorder warning in ScriptInterpreterPython.cpp.
>
> Modified:
>
> lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
>
> Modified:
> lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=250322&r1=250321&r2=250322&view=diff
>
> ==
> ---
> lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
> Wed Oct 14 15:39:41 2015
> @@ -93,8 +93,8 @@ struct InitializePythonRAII
>  {
>  public:
>  InitializePythonRAII() :
> -m_was_already_initialized(false),
> -m_gil_state(PyGILState_UNLOCKED)
> +m_gil_state(PyGILState_UNLOCKED),
> +m_was_already_initialized(false)
>  {
>  // Python will muck with STDIN terminal state, so save off any
> current TTY
>  // settings so we can restore them.
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D13742: Fix codesign command with cmake.

2015-10-14 Thread Stephane Sezer via lldb-commits
sas created this revision.
sas added reviewers: clayborg, dawn, brucem, tfiala.
sas added a subscriber: lldb-commits.

Looks like having a space in the Xcode path triggers this bug. We need
to use cmake -E env FOO=bar [COMMAND] to set the environment instead.

I am using cmake 3.3.1 and ninja 1.6.0 and I get this:

[2681/2756] Linking CXX executable bin/debugserver
FAILED: : && 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
   -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics 
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated-register 
-Wno-vla-extension  -fno-exceptions -fno-rtti 
-Wno-gnu-zero-variadic-macro-arguments -Wno-zero-length-array 
-Wno-extended-offsetof -g -Wl,-search_paths_first 
-Wl,-headerpad_max_install_names -stdlib=libc++ 
-Wl,-sectcreate,__TEXT,__info_plist,/Users/sas/Source/llvm/tools/lldb/tools/debugserver/source/../resources/lldb-debugserver-Info.plist
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/HasAVX.s.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFBundle.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFData.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFString.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/Genealogy.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachException.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachProcess.mm.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachTask.mm.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachThread.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachThreadList.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachVMMemory.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachVMRegion.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/mach_excServer.c.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/mach_excUser.c.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/debugserver_vers.c.o
  -o bin/debugserver  lib/liblldbDebugserverCommon.a lib/liblldbUtility.a 
lib/liblldbDebugserverMacOSX_I386.a lib/liblldbDebugserverMacOSX_X86_64.a 
-framework Cocoa -Wl,-rpath,@executable_path/../lib && cd 
/Users/sas/Source/llvm/build/bin && "CODESIGN_ALLOCATE=/Applications/Xcode 
6.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
 codesign --force --sign lldb_codesign debugserver
/bin/sh: CODESIGN_ALLOCATE=/Applications/Xcode 
6.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
 No such file or directory
[2681/2756] Building CXX object 
tools/lldb/source/Target/CMakeFiles/lldbTarget.dir/Target.cpp.o
ninja: build stopped: subcommand failed.

http://reviews.llvm.org/D13742

Files:
  tools/debugserver/source/MacOSX/CMakeLists.txt

Index: tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- tools/debugserver/source/MacOSX/CMakeLists.txt
+++ tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -70,7 +70,7 @@
   POST_BUILD
   # --entitlements option removed, as it causes errors when debugging.
   #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements 
${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign 
${CODESIGN_IDENTITY} debugserver
-  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign 
${CODESIGN_IDENTITY} debugserver
+  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} 
codesign --force --sign ${CODESIGN_IDENTITY} debugserver
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
   )
 


Index: tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- tools/debugserver/source/MacOSX/CMakeLists.txt
+++ tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -70,7 +70,7 @@
   POST_BUILD
   # --entitlements option removed, as it causes errors when debugging.
   #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver
-  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
+  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
   )
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.or

[Lldb-commits] [lldb] r250327 - Get Python unit tests working with Python 3.

2015-10-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 14 16:06:13 2015
New Revision: 250327

URL: http://llvm.org/viewvc/llvm-project?rev=250327&view=rev
Log:
Get Python unit tests working with Python 3.

There were a couple of issues related to string handling that
needed to be fixed.  In particular, we cannot get away with
converting `PyUnicode` objects to `PyBytes` objects and storing
the `PyBytes` regardless of Python version.  Instead we have to
store a `PyUnicode` on Python 3 and a `PyString` on Python 2.

The reason for this is that if you call `PyObject_Str` on a
`PyBytes` in Python 3, it will return you a string that actually
contains the string value wrappedin the characters b''.  So if we
create a `PythonString` with the value "test", and we call Str()
on it, we will get back the string "b'test'", which breaks string
equality.  The only way to fix this is to store a native
`PyUnicode` object under Python 3.

With this CL, ScriptInterpreterPythonTests unit tests pass 100%
under Python 2 and Python 3.

Modified:
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=250327&r1=250326&r2=250327&view=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
Wed Oct 14 16:06:13 2015
@@ -67,22 +67,14 @@ PythonObject::GetObjectType() const
 if (!IsAllocated())
 return PyObjectType::None;
 
-if (PyList_Check(m_py_obj))
+if (PythonList::Check(m_py_obj))
 return PyObjectType::List;
-if (PyDict_Check(m_py_obj))
+if (PythonDictionary::Check(m_py_obj))
 return PyObjectType::Dictionary;
-if (PyUnicode_Check(m_py_obj))
+if (PythonString::Check(m_py_obj))
 return PyObjectType::String;
-if (PyLong_Check(m_py_obj))
+if (PythonInteger::Check(m_py_obj))
 return PyObjectType::Integer;
-#if PY_MAJOR_VERSION < 3
-// These functions don't exist in Python 3.x.  PyString is PyUnicode
-// and PyInt is PyLong.
-if (PyString_Check(m_py_obj))
-return PyObjectType::String;
-if (PyInt_Check(m_py_obj))
-return PyObjectType::Integer;
-#endif
 return PyObjectType::Unknown;
 }
 
@@ -187,11 +179,11 @@ PythonString::Check(PyObject *py_obj)
 {
 if (!py_obj)
 return false;
+
 #if PY_MAJOR_VERSION >= 3
-// Python 3 does not have PyString objects, only PyUnicode.
 return PyUnicode_Check(py_obj);
 #else
-return PyUnicode_Check(py_obj) || PyString_Check(py_obj);
+return PyString_Check(py_obj);
 #endif
 }
 
@@ -208,18 +200,6 @@ PythonString::Reset(PyRefType type, PyOb
 return;
 }
 
-// Convert this to a PyBytes object, and only store the PyBytes.  Note 
that in
-// Python 2.x, PyString and PyUnicode are interchangeable, and PyBytes is 
an alias
-// of PyString.  So on 2.x, if we get into this branch, we already have a 
PyBytes.
-if (PyUnicode_Check(py_obj))
-{
-// Since we're converting this to a different object, we assume 
ownership of the
-// new object regardless of the value of `type`.
-result.Reset(PyRefType::Owned, PyUnicode_AsUTF8String(py_obj));
-}
-
-assert(PyBytes_Check(result.get()) && "PythonString::Reset received a 
non-string");
-
 // Calling PythonObject::Reset(const PythonObject&) will lead to stack 
overflow since it calls
 // back into the virtual implementation.
 PythonObject::Reset(PyRefType::Borrowed, result.get());
@@ -228,21 +208,31 @@ PythonString::Reset(PyRefType type, PyOb
 llvm::StringRef
 PythonString::GetString() const
 {
-if (IsValid())
-{
-Py_ssize_t size;
-char *c;
-PyBytes_AsStringAndSize(m_py_obj, &c, &size);
-return llvm::StringRef(c, size);
-}
-return llvm::StringRef();
+if (!IsValid())
+return llvm::StringRef();
+
+Py_ssize_t size;
+char *c;
+
+#if PY_MAJOR_VERSION >= 3
+c = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
+#else
+PyString_AsStringAndSize(m_py_obj, &c, &size);
+#endif
+return llvm::StringRef(c, size);
 }
 
 size_t
 PythonString::GetSize() const
 {
 if (IsValid())
-return PyBytes_Size(m_py_obj);
+{
+#if PY_MAJOR_VERSION >= 3
+return PyUnicode_GetSize(m_py_obj);
+#else
+return PyString_Size(m_py_obj);
+#endif
+}
 return 0;
 }
 
@@ -251,11 +241,10 @@ PythonString::SetString (llvm::StringRef
 {
 #if PY_MAJOR_VERSION >= 3
 PyObject *unicode = PyUnicode_FromStringAndSize(string.data(), 
string.size());
-PyObject *bytes = PyUnicode_AsUTF8String(unicode);
-PythonObject::Reset(PyRefType::Owned, byt

Re: [Lldb-commits] [PATCH] D13742: Fix codesign command with cmake.

2015-10-14 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D13742



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


[Lldb-commits] [lldb] r250331 - Make uses of /dev/null portable across OSes.

2015-10-14 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Oct 14 16:37:36 2015
New Revision: 250331

URL: http://llvm.org/viewvc/llvm-project?rev=250331&view=rev
Log:
Make uses of /dev/null portable across OSes.

Most platforms have "/dev/null".  Windows has "nul".  Instead of
hardcoding the string /dev/null at various places, make a constant
that contains the correct value depending on the platform, and use
that everywhere instead.

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/posix/FileSystem.cpp
lldb/trunk/source/Host/windows/FileSystem.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ProcessLaunchInfo.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=250331&r1=250330&r2=250331&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 14 16:37:36 2015
@@ -22,6 +22,8 @@ namespace lldb_private
 class FileSystem
 {
   public:
+static const char *DEV_NULL;
+
 static FileSpec::PathSyntax GetNativePathSyntax();
 
 static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode);

Modified: lldb/trunk/source/Host/posix/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=250331&r1=250330&r2=250331&view=diff
==
--- lldb/trunk/source/Host/posix/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/posix/FileSystem.cpp Wed Oct 14 16:37:36 2015
@@ -32,6 +32,9 @@
 using namespace lldb;
 using namespace lldb_private;
 
+const char *
+FileSystem::DEV_NULL = "/dev/null";
+
 FileSpec::PathSyntax
 FileSystem::GetNativePathSyntax()
 {

Modified: lldb/trunk/source/Host/windows/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/FileSystem.cpp?rev=250331&r1=250330&r2=250331&view=diff
==
--- lldb/trunk/source/Host/windows/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/windows/FileSystem.cpp Wed Oct 14 16:37:36 2015
@@ -19,6 +19,9 @@
 
 using namespace lldb_private;
 
+const char *
+FileSystem::DEV_NULL = "nul";
+
 FileSpec::PathSyntax
 FileSystem::GetNativePathSyntax()
 {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=250331&r1=250330&r2=250331&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Oct 
14 16:37:36 2015
@@ -40,6 +40,7 @@
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/Value.h"
 #include "lldb/DataFormatters/FormatManager.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Host/Symbols.h"
@@ -1004,11 +1005,11 @@ ProcessGDBRemote::DoLaunch (Module *exe_
 {
 // set to /dev/null unless redirected to a file above
 if (!stdin_file_spec)
-stdin_file_spec.SetFile("/dev/null", false);
+stdin_file_spec.SetFile(FileSystem::DEV_NULL, false);
 if (!stdout_file_spec)
-stdout_file_spec.SetFile("/dev/null", false);
+stdout_file_spec.SetFile(FileSystem::DEV_NULL, false);
 if (!stderr_file_spec)
-stderr_file_spec.SetFile("/dev/null", false);
+stderr_file_spec.SetFile(FileSystem::DEV_NULL, false);
 }
 else if (platform_sp && platform_sp->IsHost())
 {

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=250331&r1=250330&r2=250331&view=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
Wed Oct 14 16:37:36 2015
@@ -34,6 +34,7 @@
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/TypeSummary.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/Pipe.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
@@ -809,9 +810,9 @@ ScriptInterpreterPython::ExecuteOneL

Re: [Lldb-commits] [PATCH] D13742: Fix codesign command with cmake.

2015-10-14 Thread Stephane Sezer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250335: Fix codesign command with cmake. (authored by sas).

Changed prior to commit:
  http://reviews.llvm.org/D13742?vs=37387&id=37405#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13742

Files:
  lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt

Index: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -70,7 +70,7 @@
   POST_BUILD
   # --entitlements option removed, as it causes errors when debugging.
   #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements 
${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign 
${CODESIGN_IDENTITY} debugserver
-  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign 
${CODESIGN_IDENTITY} debugserver
+  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} 
codesign --force --sign ${CODESIGN_IDENTITY} debugserver
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
   )
 


Index: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -70,7 +70,7 @@
   POST_BUILD
   # --entitlements option removed, as it causes errors when debugging.
   #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver
-  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
+  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
   )
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r250335 - Fix codesign command with cmake.

2015-10-14 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Wed Oct 14 17:25:43 2015
New Revision: 250335

URL: http://llvm.org/viewvc/llvm-project?rev=250335&view=rev
Log:
Fix codesign command with cmake.

Summary:
Looks like having a space in the Xcode path triggers this bug. We need
to use cmake -E env FOO=bar [COMMAND] to set the environment instead.

I am using cmake 3.3.1 and ninja 1.6.0 and I get this:

[2681/2756] Linking CXX executable bin/debugserver
FAILED: : && 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
   -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics 
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated-register 
-Wno-vla-extension  -fno-exceptions -fno-rtti 
-Wno-gnu-zero-variadic-macro-arguments -Wno-zero-length-array 
-Wno-extended-offsetof -g -Wl,-search_paths_first 
-Wl,-headerpad_max_install_names -stdlib=libc++ 
-Wl,-sectcreate,__TEXT,__info_plist,/Users/sas/Source/llvm/tools/lldb/tools/debugserver/source/../resources/lldb-debugserver-Info.plist
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/HasAVX.s.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFBundle.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFData.cpp.o
 tools/lldb/tools/de
 bugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFString.cpp.o 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/Genealogy.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachException.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachProcess.mm.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachTask.mm.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachThread.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachThreadList.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachVMMemory.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachVMRegion.cpp.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/mach_excServer.c.o
 
tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/mach_excUser.c.o
 tools/lldb/tools/debugserver/source/MacOSX/CMakeFile
 s/debugserver.dir/debugserver_vers.c.o  -o bin/debugserver  
lib/liblldbDebugserverCommon.a lib/liblldbUtility.a 
lib/liblldbDebugserverMacOSX_I386.a lib/liblldbDebugserverMacOSX_X86_64.a 
-framework Cocoa -Wl,-rpath,@executable_path/../lib && cd 
/Users/sas/Source/llvm/build/bin && "CODESIGN_ALLOCATE=/Applications/Xcode 
6.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
 codesign --force --sign lldb_codesign debugserver
/bin/sh: CODESIGN_ALLOCATE=/Applications/Xcode 
6.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
 No such file or directory
[2681/2756] Building CXX object 
tools/lldb/source/Target/CMakeFiles/lldbTarget.dir/Target.cpp.o
ninja: build stopped: subcommand failed.

Reviewers: clayborg, dawn, brucem, tfiala

Subscribers: lldb-commits

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

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt

Modified: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt?rev=250335&r1=250334&r2=250335&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt Wed Oct 14 
17:25:43 2015
@@ -70,7 +70,7 @@ add_custom_command(TARGET debugserver
   POST_BUILD
   # --entitlements option removed, as it causes errors when debugging.
   #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements 
${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign 
${CODESIGN_IDENTITY} debugserver
-  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign 
${CODESIGN_IDENTITY} debugserver
+  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} 
codesign --force --sign ${CODESIGN_IDENTITY} debugserver
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
   )
 


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


[Lldb-commits] [lldb] r250339 - Fix a problem where LLDB could sometimes try to get the size of an Objective-C type without passing an appropriate ExecutionContext

2015-10-14 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 14 17:44:30 2015
New Revision: 250339

URL: http://llvm.org/viewvc/llvm-project?rev=250339&view=rev
Log:
Fix a problem where LLDB could sometimes try to get the size of an Objective-C 
type without passing an appropriate ExecutionContext


Modified:
lldb/trunk/include/lldb/Core/Value.h
lldb/trunk/source/Core/Value.cpp
lldb/trunk/source/Core/ValueObjectCast.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp

Modified: lldb/trunk/include/lldb/Core/Value.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=250339&r1=250338&r2=250339&view=diff
==
--- lldb/trunk/include/lldb/Core/Value.h (original)
+++ lldb/trunk/include/lldb/Core/Value.h Wed Oct 14 17:44:30 2015
@@ -265,7 +265,7 @@ public:
 GetValueDefaultFormat ();
 
 uint64_t
-GetValueByteSize (Error *error_ptr);
+GetValueByteSize (Error *error_ptr, ExecutionContext *exe_ctx);
 
 Error
 GetValueAsData (ExecutionContext *exe_ctx, 

Modified: lldb/trunk/source/Core/Value.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=250339&r1=250338&r2=250339&view=diff
==
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Wed Oct 14 17:44:30 2015
@@ -260,7 +260,7 @@ Value::ValueOf(ExecutionContext *exe_ctx
 }
 
 uint64_t
-Value::GetValueByteSize (Error *error_ptr)
+Value::GetValueByteSize (Error *error_ptr, ExecutionContext *exe_ctx)
 {
 uint64_t byte_size = 0;
 
@@ -277,7 +277,7 @@ Value::GetValueByteSize (Error *error_pt
 {
 const CompilerType &ast_type = GetCompilerType();
 if (ast_type.IsValid())
-byte_size = ast_type.GetByteSize(nullptr);
+byte_size = ast_type.GetByteSize(exe_ctx ? 
exe_ctx->GetBestExecutionContextScope() : nullptr);
 }
 break;
 }
@@ -434,7 +434,7 @@ Value::GetValueAsData (ExecutionContext
 lldb::Encoding type_encoding = 
ast_type.GetEncoding(type_encoding_count);
 
 if (type_encoding == eEncodingUint || type_encoding == 
eEncodingSint)
-limit_byte_size = ast_type.GetByteSize(nullptr);
+limit_byte_size = ast_type.GetByteSize(exe_ctx ? 
exe_ctx->GetBestExecutionContextScope() : nullptr);
 }
 
 if (m_value.GetData (data, limit_byte_size))
@@ -639,7 +639,7 @@ Value::GetValueAsData (ExecutionContext
 }
 
 // If we got here, we need to read the value from memory
-size_t byte_size = GetValueByteSize (&error);
+size_t byte_size = GetValueByteSize (&error, exe_ctx);
 
 // Bail if we encountered any errors getting the byte size
 if (error.Fail())

Modified: lldb/trunk/source/Core/ValueObjectCast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectCast.cpp?rev=250339&r1=250338&r2=250339&view=diff
==
--- lldb/trunk/source/Core/ValueObjectCast.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectCast.cpp Wed Oct 14 17:44:30 2015
@@ -76,7 +76,8 @@ ValueObjectCast::CalculateNumChildren()
 uint64_t
 ValueObjectCast::GetByteSize()
 {
-return m_value.GetValueByteSize(NULL);
+ExecutionContext exe_ctx (GetExecutionContextRef());
+return m_value.GetValueByteSize(nullptr, &exe_ctx);
 }
 
 lldb::ValueType

Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=250339&r1=250338&r2=250339&view=diff
==
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Wed Oct 14 17:44:30 2015
@@ -127,7 +127,10 @@ ValueObjectDynamicValue::GetByteSize()
 {
 const bool success = UpdateValueIfNeeded(false);
 if (success && m_dynamic_type_info.HasType())
-return m_value.GetValueByteSize(nullptr);
+{
+ExecutionContext exe_ctx (GetExecutionContextRef());
+return m_value.GetValueByteSize(nullptr, &exe_ctx);
+}
 else
 return m_parent->GetByteSize();
 }


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


[Lldb-commits] [lldb] r250340 - Fix a couple issues where trying to print a type would cause LLDB to crash

2015-10-14 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 14 17:44:50 2015
New Revision: 250340

URL: http://llvm.org/viewvc/llvm-project?rev=250340&view=rev
Log:
Fix a couple issues where trying to print a type would cause LLDB to crash


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

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=250340&r1=250339&r2=250340&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Oct 14 17:44:50 2015
@@ -4431,7 +4431,7 @@ ClangASTContext::GetBitSize (lldb::opaqu
 if (!g_printed)
 {
 StreamString s;
-DumpTypeDescription(&s);
+DumpTypeDescription(type, &s);
 
 llvm::outs() << "warning: trying to determine the size 
of type ";
 llvm::outs() << s.GetString() << "\n";
@@ -8822,7 +8822,7 @@ void
 ClangASTContext::DumpTypeDescription (lldb::opaque_compiler_type_t type)
 {
 StreamFile s (stdout, false);
-DumpTypeDescription (&s);
+DumpTypeDescription (type, &s);
 ClangASTMetadata *metadata = ClangASTContext::GetMetadata 
(getASTContext(), type);
 if (metadata)
 {


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


[Lldb-commits] [lldb] r250341 - Add a data formatter for __NSArray0, the type of empty arrays

2015-10-14 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 14 17:45:04 2015
New Revision: 250341

URL: http://llvm.org/viewvc/llvm-project?rev=250341&view=rev
Log:
Add a data formatter for __NSArray0, the type of empty arrays

Modified:
lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

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

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=250341&r1=250340&r2=250341&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Wed Oct 14 17:45:04 2015
@@ -202,6 +202,31 @@ namespace  lldb_private {
 std::vector m_children;
 };
 
+class NSArray0SyntheticFrontEnd : public SyntheticChildrenFrontEnd
+{
+public:
+NSArray0SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+virtual size_t
+CalculateNumChildren ();
+
+virtual lldb::ValueObjectSP
+GetChildAtIndex (size_t idx);
+
+virtual bool
+Update();
+
+virtual bool
+MightHaveChildren ();
+
+virtual size_t
+GetIndexOfChildWithName (const ConstString &name);
+
+virtual
+~NSArray0SyntheticFrontEnd ();
+private:
+};
+
 class NSArrayCodeRunningSyntheticFrontEnd : public 
SyntheticChildrenFrontEnd
 {
 public:
@@ -275,6 +300,10 @@ lldb_private::formatters::NSArraySummary
 if (error.Fail())
 return false;
 }
+else if (!strcmp(class_name,"__NSArray0"))
+{
+value = 0;
+}
 else if (!strcmp(class_name,"__NSCFArray"))
 {
 Error error;
@@ -632,6 +661,45 @@ lldb_private::formatters::NSArrayISynthe
 return retval_sp;
 }
 
+lldb_private::formatters::NSArray0SyntheticFrontEnd::NSArray0SyntheticFrontEnd 
(lldb::ValueObjectSP valobj_sp) :
+SyntheticChildrenFrontEnd (*valobj_sp.get())
+{
+}
+
+lldb_private::formatters::NSArray0SyntheticFrontEnd::~NSArray0SyntheticFrontEnd
 ()
+{
+}
+
+size_t
+lldb_private::formatters::NSArray0SyntheticFrontEnd::GetIndexOfChildWithName 
(const ConstString &name)
+{
+return UINT32_MAX;
+}
+
+size_t
+lldb_private::formatters::NSArray0SyntheticFrontEnd::CalculateNumChildren ()
+{
+return 0;
+}
+
+bool
+lldb_private::formatters::NSArray0SyntheticFrontEnd::Update()
+{
+return false;
+}
+
+bool
+lldb_private::formatters::NSArray0SyntheticFrontEnd::MightHaveChildren ()
+{
+return false;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::NSArray0SyntheticFrontEnd::GetChildAtIndex (size_t 
idx)
+{
+return lldb::ValueObjectSP();
+}
+
 SyntheticChildrenFrontEnd* 
lldb_private::formatters::NSArraySyntheticFrontEndCreator 
(CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
 {
 if (!valobj_sp)
@@ -669,6 +737,10 @@ SyntheticChildrenFrontEnd* lldb_private:
 {
 return (new NSArrayISyntheticFrontEnd(valobj_sp));
 }
+else if (!strcmp(class_name,"__NSArray0"))
+{
+return (new NSArray0SyntheticFrontEnd(valobj_sp));
+}
 else if (!strcmp(class_name,"__NSArrayM"))
 {
 if (runtime->GetFoundationVersion() >= 1100)

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp?rev=250341&r1=250340&r2=250341&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Wed Oct 14 
17:45:04 2015
@@ -446,6 +446,7 @@ LoadObjCFormatters(TypeCategoryImplSP ob
 AddCXXSummary(objc_category_sp, 
lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", 
ConstString("NSArray"), appkit_flags);
 AddCXXSummary(objc_category_sp, 
lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", 
ConstString("NSMutableArray"), appkit_flags);
 AddCXXSummary(objc_category_sp, 
lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", 
ConstString("__NSArrayI"), appkit_flags);
+AddCXXSummary(objc_category_sp, 
lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", 
ConstString("__NSArray0"), appkit_flags);
 AddCXXSummary(objc_category_sp, 
lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", 
ConstString("__NSArrayM"), appkit_flags);
 AddCXXSummary(objc_category_sp, 
lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", 
ConstString("__NSCFA

[Lldb-commits] [PATCH] D13754: Split Socket class into Tcp/Udp/DomainSocket subclasses.

2015-10-14 Thread Oleksiy Vyalov via lldb-commits
ovyalov created this revision.
ovyalov added reviewers: clayborg, zturner, labath.
ovyalov added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

There are a few reasons for this change:
 - Support generic logic flow for different socket types - a preparation step 
to support domain sockets in lldb-server along with TCP.
 - Offload Socket.cpp and make it more readable and serving more as a factory 
class.
 - Move out protocol-specific members like m_udp_send_sockaddr to more 
fine-grained classes.

http://reviews.llvm.org/D13754

Files:
  include/lldb/Host/Socket.h
  include/lldb/Host/common/TcpSocket.h
  include/lldb/Host/common/UdpSocket.h
  include/lldb/Host/posix/DomainSocket.h
  lldb.xcodeproj/project.pbxproj
  source/Host/CMakeLists.txt
  source/Host/common/Socket.cpp
  source/Host/common/TcpSocket.cpp
  source/Host/common/UdpSocket.cpp
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Host/posix/DomainSocket.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  tools/lldb-server/lldb-platform.cpp
  unittests/Host/SocketTest.cpp

Index: unittests/Host/SocketTest.cpp
===
--- unittests/Host/SocketTest.cpp
+++ unittests/Host/SocketTest.cpp
@@ -18,6 +18,7 @@
 #include "gtest/gtest.h"
 
 #include "lldb/Host/Socket.h"
+#include "lldb/Host/common/TcpSocket.h"
 
 using namespace lldb_private;
 
@@ -46,7 +47,7 @@
 AcceptThread(Socket *listen_socket, const char *listen_remote_address, bool child_processes_inherit,
  Socket **accept_socket, Error *error)
 {
-*error = listen_socket->BlockingAccept(listen_remote_address, child_processes_inherit, *accept_socket);
+*error = listen_socket->Accept(listen_remote_address, child_processes_inherit, *accept_socket);
 }
 
 void
@@ -139,10 +140,13 @@
 std::unique_ptr socket_a_up;
 std::unique_ptr socket_b_up;
 CreateConnectedSockets (&socket_a_up, &socket_b_up);
-
-EXPECT_EQ (socket_a_up->GetLocalPortNumber (), socket_b_up->GetRemotePortNumber ());
-EXPECT_EQ (socket_b_up->GetLocalPortNumber (), socket_a_up->GetRemotePortNumber ());
-EXPECT_NE (socket_a_up->GetLocalPortNumber (), socket_b_up->GetLocalPortNumber ());
-EXPECT_STREQ ("127.0.0.1", socket_a_up->GetRemoteIPAddress ().c_str ());
-EXPECT_STREQ ("127.0.0.1", socket_b_up->GetRemoteIPAddress ().c_str ());
+
+TcpSocket* tcp_socket_a(static_cast(socket_a_up.get()));
+TcpSocket* tcp_socket_b(static_cast(socket_b_up.get()));
+
+EXPECT_EQ (tcp_socket_a->GetLocalPortNumber (), tcp_socket_b->GetRemotePortNumber ());
+EXPECT_EQ (tcp_socket_b->GetLocalPortNumber (), tcp_socket_a->GetRemotePortNumber ());
+EXPECT_NE (tcp_socket_a->GetLocalPortNumber (), tcp_socket_b->GetLocalPortNumber ());
+EXPECT_STREQ ("127.0.0.1", tcp_socket_a->GetRemoteIPAddress ().c_str ());
+EXPECT_STREQ ("127.0.0.1", tcp_socket_b->GetRemoteIPAddress ().c_str ());
 }
Index: tools/lldb-server/lldb-platform.cpp
===
--- tools/lldb-server/lldb-platform.cpp
+++ tools/lldb-server/lldb-platform.cpp
@@ -29,7 +29,7 @@
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostGetOpt.h"
 #include "lldb/Host/OptionParser.h"
-#include "lldb/Host/Socket.h"
+#include "lldb/Host/common/TcpSocket.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
 #include "LLDBServerUtilities.h"
@@ -283,22 +283,26 @@
 exit(option_error);
 }
 
-std::unique_ptr listening_socket_up;
 Socket *socket = nullptr;
 const bool children_inherit_listen_socket = false;
 
 // the test suite makes many connections in parallel, let's not miss any.
 // The highest this should get reasonably is a function of the number 
 // of target CPUs.  For now, let's just use 100
 const int backlog = 100;
-error = Socket::TcpListen(listen_host_port.c_str(), children_inherit_listen_socket, socket, NULL, backlog);
+std::unique_ptr listening_socket_up(new TcpSocket(children_inherit_listen_socket, error));
+if (error.Fail())
+{
+fprintf(stderr, "failed to create socket: %s", error.AsCString());
+exit(socket_error);
+}
+
+error = listening_socket_up->Listen(listen_host_port.c_str(), backlog);
 if (error.Fail())
 {
 printf("error: %s\n", error.AsCString());
 exit(socket_error);
 }
-listening_socket_up.reset(socket);
-printf ("Listening for a connection from %u...\n", listening_socket_up->GetLocalPortNumber());
 if (port_file)
 {
 error = save_port_to_file(listening_socket_up->GetLocalPortNumber(), port_file);
@@ -322,7 +326,7 @@
 
 const bool children_inherit_accept_socket = true;
 socket = nullptr;
-error = listening_socket_up->BlockingAccept(listen_host_port.c_str(), ch

Re: [Lldb-commits] [PATCH] D13754: Split Socket class into Tcp/Udp/DomainSocket subclasses.

2015-10-14 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Can we change "TcpSocket" to be "TCPSocket" and "UdpSocket" to be "UDPSocket" 
in all code and in the file names? Other than that it looks good.



Comment at: source/Host/common/Socket.cpp:403
@@ +402,3 @@
+socketType |= SOCK_CLOEXEC;
+  #endif
+auto sock = ::socket (domain, socketType, protocol);

indent wrong


http://reviews.llvm.org/D13754



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


[Lldb-commits] [lldb] r250353 - Fix the ability to quit and use a custom exception. Also print tree items out so they are more aligned.

2015-10-14 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Oct 14 19:49:36 2015
New Revision: 250353

URL: http://llvm.org/viewvc/llvm-project?rev=250353&view=rev
Log:
Fix the ability to quit and use a custom exception. Also print tree items out 
so they are more aligned.


Modified:
lldb/trunk/test/lldbcurses.py

Modified: lldb/trunk/test/lldbcurses.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=250353&r1=250352&r2=250353&view=diff
==
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py Wed Oct 14 19:49:36 2015
@@ -57,6 +57,10 @@ class Rect(object):
 return pt.y >= self.get_min_y()
 return False
 
+class QuitException(Exception):
+def __init__(self):
+super(QuitException, self).__init__('QuitException')
+
 class Window(object):
 def __init__(self, window, delegate = None, can_become_first_responder = 
True):
 self.window = window
@@ -327,6 +331,9 @@ class Window(object):
 def update(self):
 for child in self.children:
 child.update()
+
+def quit_action(self):
+raise QuitException
 
 def key_event_loop(self, timeout_msec=-1, n=sys.maxint):
 '''Run an event loop to receive key presses and pass them along to the
@@ -339,13 +346,14 @@ class Window(object):

n is the number of times to go through the event loop before 
exiting'''
 self.timeout(timeout_msec)
-while n > 0:
+done = False
+while not done and n > 0:
 c = self.window.getch()
 if c != -1:
 try:
 self.handle_key(c)
-except:
-break
+except QuitException:
+done = True
 n -= 1
 
 class Panel(Window):
@@ -524,6 +532,24 @@ class Item(object):
 self.title = title
 self.action = action
 
+class TreeItemDelegate(object):
+
+def might_have_children(self):
+return False
+
+def update_children(self, item):
+'''Return a list of child Item objects'''
+return None
+
+def draw_item_string(self, tree_window, item, s):
+pt = tree_window.get_cursor()
+width = tree_window.get_size().w - 1
+if width > pt.x:
+tree_window.addnstr(s, width - pt.x)
+
+def draw_item(self, tree_window, item):
+self.draw_item_string(tree_window, item, item.title)
+
 class TreeItem(object):
 def __init__(self, delegate, parent = None, title = None, action = None, 
is_expanded = False):
 self.parent = parent
@@ -531,17 +557,24 @@ class TreeItem(object):
 self.action = action
 self.delegate = delegate
 self.is_expanded = not parent or is_expanded == True
-self.might_have_children_value = None
+self._might_have_children = None
 self.children = None
+self._children_might_have_children = False

 def get_children(self):
 if self.is_expanded and self.might_have_children():
 if self.children is None:
+self._children_might_have_children = False
 self.children = self.update_children()
+for child in self.children:
+if child.might_have_children():
+self._children_might_have_children = True
+break
 else:
+self._children_might_have_children = False
 self.children = None
 return self.children
-
+
 def append_visible_items(self, items):
 items.append(self)
 children = self.get_children()
@@ -550,15 +583,18 @@ class TreeItem(object):
 child.append_visible_items(items)
 
 def might_have_children(self):
-if self.might_have_children_value is None:
+if self._might_have_children is None:
 if not self.parent:
 # Root item always might have children
-self.might_have_children_value = True
+self._might_have_children = True
 else:
 # Check with the delegate to see if the item might have 
children
-self.might_have_children_value = 
self.delegate.might_have_children()
-return self.might_have_children_value
-
+self._might_have_children = self.delegate.might_have_children()
+return self._might_have_children
+
+def children_might_have_children(self):
+return self._children_might_have_children
+
 def update_children(self):
 if self.is_expanded and self.might_have_children():
 self.children = self.delegate.update_children(self)
@@ -584,7 +620,9 @@ class TreeItem(object):
 if self.might_have_children():
 tree_window.addch (curses.ACS_DIAMOND)
 tree_window.addch (curses.ACS

Re: [Lldb-commits] [PATCH] D13754: Split Socket class into Tcp/Udp/DomainSocket subclasses.

2015-10-14 Thread Zachary Turner via lldb-commits
zturner added a comment.

Can you compile on Windows and make sure it works?  Also should you add a 
unittest for Udp Sockets?


http://reviews.llvm.org/D13754



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


[Lldb-commits] [lldb] r250364 - In r240466, when Greg added the jThreadsInfo packet, he accidentally

2015-10-14 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Oct 14 23:20:42 2015
New Revision: 250364

URL: http://llvm.org/viewvc/llvm-project?rev=250364&view=rev
Log:
In r240466, when Greg added the jThreadsInfo packet, he accidentally
disabled the use of the jThreadGetExtendedInfo packet which is used
to retrieve additional information about a thread, such as the QoS
setting for that thread on darwin systems.  

Re-enable the use of the jThreadGetExtendedInfo packet, and add 
some quick tests to the TestQueues mac test case which will verify
that we can retrieve the QoS names for these test threads.

 

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/test/macosx/queues/TestQueues.py
lldb/trunk/test/macosx/queues/main.c

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=250364&r1=250363&r2=250364&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Wed Oct 14 23:20:42 2015
@@ -619,7 +619,6 @@ GDBRemoteCommunicationClient::GetThreads
 if (m_supports_jThreadsInfo)
 {
 StringExtractorGDBRemote response;
-m_supports_jThreadExtendedInfo = eLazyBoolNo;
 if (SendPacketAndWaitForResponse("jThreadsInfo", response, false) == 
PacketResult::Success)
 {
 if (response.IsUnsupportedResponse())

Modified: lldb/trunk/test/macosx/queues/TestQueues.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/queues/TestQueues.py?rev=250364&r1=250363&r2=250364&view=diff
==
--- lldb/trunk/test/macosx/queues/TestQueues.py (original)
+++ lldb/trunk/test/macosx/queues/TestQueues.py Wed Oct 14 23:20:42 2015
@@ -108,6 +108,51 @@ class TestQueues(TestBase):
 self.check_queues_threads_match_queue (queue_performer_2)
 self.check_queues_threads_match_queue (queue_performer_3)
 
+
+
+# We have threads running with all the different dispatch QoS service
+# levels - find those threads and check that we can get the correct
+# QoS name for each of them.
+
+user_initiated_thread = lldb.SBThread()
+user_interactive_thread = lldb.SBThread()
+utility_thread = lldb.SBThread()
+unspecified_thread = lldb.SBThread()
+background_thread = lldb.SBThread()
+for th in process.threads:
+if th.GetName() == "user initiated QoS":
+user_initiated_thread = th
+if th.GetName() == "user interactive QoS":
+user_interactive_thread = th
+if th.GetName() == "utility QoS":
+utility_thread = th
+if th.GetName() == "unspecified QoS":
+unspecified_thread = th
+if th.GetName() == "background QoS":
+background_thread = th
+
+self.assertTrue(user_initiated_thread.IsValid(), "Found user initiated 
QoS thread")
+self.assertTrue(user_interactive_thread.IsValid(), "Found user 
interactive QoS thread")
+self.assertTrue(utility_thread.IsValid(), "Found utility QoS thread")
+self.assertTrue(unspecified_thread.IsValid(), "Found unspecified QoS 
thread")
+self.assertTrue(background_thread.IsValid(), "Found background QoS 
thread")
+
+stream = lldb.SBStream()
+
self.assertTrue(user_initiated_thread.GetInfoItemByPathAsString("requested_qos.printable_name",
 stream), "Get QoS printable string for user initiated QoS thread")
+self.assertTrue(stream.GetData() == "User Initiated", "user initiated 
QoS thread name is valid")
+stream.Clear()
+
self.assertTrue(user_interactive_thread.GetInfoItemByPathAsString("requested_qos.printable_name",
 stream), "Get QoS printable string for user interactive QoS thread")
+self.assertTrue(stream.GetData() == "User Interactive", "user 
interactive QoS thread name is valid")
+stream.Clear()
+
self.assertTrue(utility_thread.GetInfoItemByPathAsString("requested_qos.printable_name",
 stream), "Get QoS printable string for utility QoS thread")
+self.assertTrue(stream.GetData() == "Utility", "utility QoS thread 
name is valid")
+stream.Clear()
+
self.assertTrue(unspecified_thread.GetInfoItemByPathAsString("requested_qos.printable_name",
 stream), "Get QoS printable string for unspecified QoS thread")
+self.assertTrue(stream.GetData() == "User Initiated", "unspecified QoS 
thread name is valid")
+stream.Clear()
+
self.assertTrue(background_thread.GetInfoItemByPathAsString("requested_qos.printable_name",
 stream), "Get QoS printable string for backgrou