[Lldb-commits] [lldb] r250531 - Fix linkage of `init_lldb` SWIG method in Python 3.

2015-10-16 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 16 12:52:03 2015
New Revision: 250531

URL: http://llvm.org/viewvc/llvm-project?rev=250531=rev
Log:
Fix linkage of `init_lldb` SWIG method in Python 3.

Modified:
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=250531=250530=250531=diff
==
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Fri Oct 16 12:52:03 2015
@@ -89,9 +89,19 @@ using namespace lldb_private;
 #ifndef LLDB_DISABLE_PYTHON
 
 // Defined in the SWIG source file
+#if PY_MAJOR_VERSION >= 3
+extern "C" PyObject*
+PyInit__lldb(void);
+
+#define LLDBSwigPyInit PyInit__lldb
+
+#else
 extern "C" void 
 init_lldb(void);
 
+#define LLDBSwigPyInit init_lldb
+#endif
+
 // these are the Pythonic implementations of the required callbacks
 // these are scripting-language specific, which is why they belong here
 // we still need to use function pointers to them instead of relying
@@ -328,7 +338,7 @@ void SystemInitializerFull::InitializeSW
 {
 #if !defined(LLDB_DISABLE_PYTHON)
 ScriptInterpreterPython::InitializeInterpreter(
-init_lldb,
+LLDBSwigPyInit,
 LLDBSwigPythonBreakpointCallbackFunction,
 LLDBSwigPythonWatchpointCallbackFunction,
 LLDBSwigPythonCallTypeScript,

Modified: 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h?rev=250531=250530=250531=diff
==
--- 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h 
(original)
+++ 
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h 
Fri Oct 16 12:52:03 2015
@@ -32,7 +32,11 @@ class ScriptInterpreterPython :
 public IOHandlerDelegateMultiline
 {
 public:
-typedef void (*SWIGInitCallback) (void);
+#if PY_MAJOR_VERSION >= 3
+typedef PyObject*(*SWIGInitCallback) (void);
+#else
+typedef void(*SWIGInitCallback) (void);
+#endif
 
 typedef bool (*SWIGBreakpointCallbackFunction) (const char 
*python_function_name,
 const char 
*session_dictionary_name,


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


[Lldb-commits] [lldb] r250530 - Convert SWIG typemap string operations to PythonObjects.

2015-10-16 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 16 12:51:49 2015
New Revision: 250530

URL: http://llvm.org/viewvc/llvm-project?rev=250530=rev
Log:
Convert SWIG typemap string operations to PythonObjects.

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

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=250530=250529=250530=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Fri Oct 16 12:51:49 2015
@@ -63,34 +63,38 @@
   int i;
   len = 0;
   while ($1[len]) len++;
-  lldb_private::PythonList list(len);
+  using namespace lldb_private;
+  PythonList list(len);
   for (i = 0; i < len; i++)
-list.SetItemAtIndex(i, lldb_private::PythonString($1[i]));
+list.SetItemAtIndex(i, PythonString($1[i]));
   $result = list.release();
 }
 
 %typemap(in) char const ** {
   /* Check if is a list  */
-  if (PyList_Check($input)) {
-int size = PyList_Size($input);
-int i = 0;
-$1 = (char **) malloc((size+1) * sizeof(char*));
-for (i = 0; i < size; i++) {
-  PyObject *o = PyList_GetItem($input,i);
-  if (PyString_Check(o))
-$1[i] = PyString_AsString(o);
-  else {
+  using namespace lldb_private;
+  if (PythonList::Check($input)) {
+PythonList py_list(PyRefType::Borrowed, $input);
+int size = py_list.GetSize();
+
+$1 = (char**)malloc((size+1)*sizeof(char*));
+for (int i = 0; i < size; i++) {
+  PythonObject o = py_list.GetItemAtIndex(i);
+  if (!PythonString::Check(o.get())) {
 PyErr_SetString(PyExc_TypeError,"list must contain strings");
 free($1);
-return NULL;
+return nullptr;
   }
+  auto py_str = o.AsType();
+  $1[i] = const_cast(py_str.GetString().data());
 }
-$1[i] = 0;
+
+$1[size] = 0;
   } else if ($input == Py_None) {
-$1 =  NULL;
+$1 = nullptr;
   } else {
 PyErr_SetString(PyExc_TypeError,"not a list");
-return NULL;
+return nullptr;
   }
 }
 
@@ -501,12 +505,13 @@
 }
 
 %typemap(in) FILE * {
+   using namespace lldb_private;
if ($input == Py_None)
-  $1 = NULL;
+  $1 = nullptr;
else if (!lldb_private::PythonFile::Check($input)) {
   int fd = PyObject_AsFileDescriptor($input);
-  lldb_private::PythonString py_mode(lldb_private::PyRefType::Owned,
- PyObject_GetAttrString($input, "mode"));
+  PythonObject py_input(PyRefType::Borrowed, $input);
+  PythonString py_mode = 
py_input.GetAttributeValue("mode").AsType();
 
   if (-1 != fd && py_mode.IsValid()) {
  FILE *f;
@@ -521,10 +526,10 @@
}
else
{
-  lldb_private::File file;
-   lldb_private::PythonFile py_file(lldb_private::PyRefType::Borrowed, 
$input);
-   if (!py_file.GetUnderlyingFile(file))
- return nullptr;
+  PythonFile py_file(PyRefType::Borrowed, $input);
+  File file;
+  if (!py_file.GetUnderlyingFile(file))
+ return nullptr;
 
   $1 = file.GetStream();
}
@@ -543,26 +548,34 @@
else // if (flags & __SRW)
   mode[i++] = 'a';
 #endif
-   lldb_private::File file($1, false);
-   lldb_private::PythonFile py_file(file, mode);
+   using namespace lldb_private;
+   File file($1, false);
+   PythonFile py_file(file, mode);
$result = py_file.release();
 }
 
 %typemap(in) (const char* string, int len) {
+using namespace lldb_private;
 if ($input == Py_None)
 {
 $1 = NULL;
 $2 = 0;
 }
-else if (PyUnicode_Check($input))
-{
-$1 = PyString_AsString(PyUnicode_AsUTF8String($input));
-$2 = strlen($1);
-}
-else if (PyString_Check($input))
+else if (PythonString::Check($input))
 {
-$1 = PyString_AsString($input);
-$2 = PyString_Size($input);
+PythonString py_str(PyRefType::Borrowed, $input);
+llvm::StringRef str = py_str.GetString();
+$1 = const_cast(str.data());
+$2 = str.size();
+// In Python 2, if $input is a PyUnicode object then this
+// will trigger a Unicode -> String conversion, in which
+// case the `PythonString` will now own the PyString.  Thus
+// if it goes out of scope, the data will be deleted.  The
+// only way to avoid this is to leak the Python object in
+// that case.  Note that if there was no conversion, then
+// releasing the string will not leak anything, since we
+// created this as a borrowed reference.
+py_str.release();
 }
 else
 {

Modified: 

Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.

2015-10-16 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

When such an error occurs, it is unlikely to be an lldb bug, or data-formatter 
bug. One can come up with a data structure for which reading a child element 
would require complete debug info, but reading the # of child elements need not 
require complete debug info (there could be an instance variable storing the 
size). Another could be that a child is improperly initialized but the data 
structure itself is properly initialized.


http://reviews.llvm.org/D13778



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


Re: [Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)

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


Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:37
@@ +36,3 @@
+return false;
+stream.Printf("%d %s", (int)value.GetValueAsSigned(), value.GetValue());
+return true;

I would definitely not stop the revision for this but I wonder if it would make 
sense to try and discover whether "char" is signed or unsigned from the type 
itself?


Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835
@@ +834,3 @@
+
+if (!MI_add_summary(miCategory, "char", MI_char_summary_provider,
+lldb::eTypeOptionHideValue | 
lldb::eTypeOptionSkipPointers))

Should you also cover "signed char" and "unsigned char" here?


http://reviews.llvm.org/D13799



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


Re: [Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)

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


Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835
@@ +834,3 @@
+
+if (!MI_add_summary(miCategory, "char", MI_char_summary_provider,
+lldb::eTypeOptionHideValue | 
lldb::eTypeOptionSkipPointers))

evgeny777 wrote:
> granata.enrico wrote:
> > Should you also cover "signed char" and "unsigned char" here?
> Hmm. I thought that if regex is false, exact match will be done, won't it? If 
> yes than simple char type should be signed, right?
I think the signedness of char depends on the implementation. Which means that 
"char" will cover one of them, but not the other. Which is why I was suggesting 
adding "char", "signed char" and "unsigned char". Just to cover all bases.


Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835
@@ +834,3 @@
+
+if (!MI_add_summary(miCategory, "char", MI_char_summary_provider,
+lldb::eTypeOptionHideValue | 
lldb::eTypeOptionSkipPointers))

evgeny777 wrote:
> granata.enrico wrote:
> > evgeny777 wrote:
> > > granata.enrico wrote:
> > > > Should you also cover "signed char" and "unsigned char" here?
> > > Hmm. I thought that if regex is false, exact match will be done, won't 
> > > it? If yes than simple char type should be signed, right?
> > I think the signedness of char depends on the implementation. Which means 
> > that "char" will cover one of them, but not the other. Which is why I was 
> > suggesting adding "char", "signed char" and "unsigned char". Just to cover 
> > all bases.
> unsigned - not. signed -yes. One question: if I register summary for "char" - 
> it will not be called for "unsigned char" and "signed char", right?
> If so I will need adding "signed char" and no checks for signed/unsigned 
> inside summary provider are required, correct?
Correct. It will only be called for an exactly matching type name. We strip 
"useless" qualifiers like "volatile" and "restrict" before doing format 
matching. But, for obvious reasons, not signed and unsigned.

Well, if you add separate formatters for signed char vs. unsigned char, then 
they will know of course
The one for plain "char" might still need to figure it out though. Because 
given just "char", the signedness depends on the underlying compiler. I know 
internally we have support for this. If we don't in the SB API, we may need to 
add support. But that seems like it can be done in a subsequent revision.


http://reviews.llvm.org/D13799



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


[Lldb-commits] [lldb] r250533 - Make some more of the LLDB/SWIG/Python glue Python 3 aware.

2015-10-16 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 16 12:52:32 2015
New Revision: 250533

URL: http://llvm.org/viewvc/llvm-project?rev=250533=rev
Log:
Make some more of the LLDB/SWIG/Python glue Python 3 aware.

Mostly this is just converting some print statements to print
functions.

Modified:
lldb/trunk/scripts/interface/SBBlock.i
lldb/trunk/scripts/interface/SBBreakpoint.i
lldb/trunk/scripts/interface/SBCompileUnit.i
lldb/trunk/scripts/interface/SBDebugger.i
lldb/trunk/scripts/interface/SBEvent.i
lldb/trunk/scripts/interface/SBLineEntry.i
lldb/trunk/scripts/interface/SBModule.i
lldb/trunk/scripts/interface/SBProcess.i
lldb/trunk/scripts/interface/SBTarget.i
lldb/trunk/scripts/interface/SBTypeCategory.i
lldb/trunk/scripts/interface/SBValue.i
lldb/trunk/scripts/interface/SBValueList.i
lldb/trunk/source/Interpreter/embedded_interpreter.py

Modified: lldb/trunk/scripts/interface/SBBlock.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBBlock.i?rev=250533=250532=250533=diff
==
--- lldb/trunk/scripts/interface/SBBlock.i (original)
+++ lldb/trunk/scripts/interface/SBBlock.i Fri Oct 16 12:52:32 2015
@@ -128,7 +128,7 @@ public:
 if range_idx < len(self):
 return [self.sbblock.GetRangeStartAddress(range_idx), 
self.sbblock.GetRangeEndAddress(range_idx)]
 else:
-print "error: unsupported item type: %s" % type(key)
+print("error: unsupported item type: %s" % type(key))
 return None
 
 def get_ranges_access_object(self):

Modified: lldb/trunk/scripts/interface/SBBreakpoint.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBBreakpoint.i?rev=250533=250532=250533=diff
==
--- lldb/trunk/scripts/interface/SBBreakpoint.i (original)
+++ lldb/trunk/scripts/interface/SBBreakpoint.i Fri Oct 16 12:52:32 2015
@@ -67,8 +67,8 @@ TestBreakpointIgnoreCount.py),
 SBBreakpoint supports breakpoint location iteration, for example,
 
 for bl in breakpoint:
-print 'breakpoint location load addr: %s' % hex(bl.GetLoadAddress())
-print 'breakpoint location condition: %s' % hex(bl.GetCondition())
+print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress()))
+print('breakpoint location condition: %s' % hex(bl.GetCondition()))
 
 and rich comparion methods which allow the API program to use,
 

Modified: lldb/trunk/scripts/interface/SBCompileUnit.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBCompileUnit.i?rev=250533=250532=250533=diff
==
--- lldb/trunk/scripts/interface/SBCompileUnit.i (original)
+++ lldb/trunk/scripts/interface/SBCompileUnit.i Fri Oct 16 12:52:32 2015
@@ -21,10 +21,10 @@ SBCompileUnit supports line entry iterat
 compileUnit = context.GetCompileUnit()
 
 for lineEntry in compileUnit:
-print 'line entry: %s:%d' % (str(lineEntry.GetFileSpec()),
-lineEntry.GetLine())
-print 'start addr: %s' % str(lineEntry.GetStartAddress())
-print 'end   addr: %s' % str(lineEntry.GetEndAddress())
+print('line entry: %s:%d' % (str(lineEntry.GetFileSpec()),
+lineEntry.GetLine()))
+print('start addr: %s' % str(lineEntry.GetStartAddress()))
+print('end   addr: %s' % str(lineEntry.GetEndAddress()))
 
 produces:
 

Modified: lldb/trunk/scripts/interface/SBDebugger.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBDebugger.i?rev=250533=250532=250533=diff
==
--- lldb/trunk/scripts/interface/SBDebugger.i (original)
+++ lldb/trunk/scripts/interface/SBDebugger.i Fri Oct 16 12:52:32 2015
@@ -33,7 +33,7 @@ debugger = lldb.SBDebugger.Create()
 debugger.SetAsync (False)
 
 # Create a target from a file and arch
-print 'Creating a target for \'%s\'' % exe
+print('Creating a target for \'%s\'' % exe)
 
 target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT)
 
@@ -82,17 +82,17 @@ if target:
 disassemble_instructions (insts)
 
 registerList = frame.GetRegisters()
-print 'Frame registers (size of register set = %d):' % 
registerList.GetSize()
+print('Frame registers (size of register set = %d):' % 
registerList.GetSize())
 for value in registerList:
 #print value
-print '%s (number of children = %d):' % 
(value.GetName(), value.GetNumChildren())
+print('%s (number of children = %d):' % 
(value.GetName(), value.GetNumChildren()))
  

Re: [Lldb-commits] [PATCH] D13812: Increase default memory cache line size for android

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

I would rather you be able to ask the current platform for the default memory 
cache line size and have lldb_private::Process do this automatically on the 
first memory read if the process property wasn't manually set. So my inline 
comments will reflect this notion.



Comment at: include/lldb/Target/Process.h:70-72
@@ -69,2 +69,5 @@
 
+lldb::OptionValueSP
+GetMemoryCacheLineSizeOption ();
+
 Args

Remove


Comment at: 
source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp:148
@@ +147,3 @@
+lldb::ProcessSP process_sp = 
PlatformRemoteGDBServer::DebugProcess(launch_info, debugger, target, error);
+AdjustProcessProperties(process_sp);
+return process_sp;

Remove the call to AdjustProcessProperties(...) and let the process call 
platform_sp->GetDefaultMemoryCacheLineSize() when it needs to. If the only this 
this PlatformAndroidRemoteGDBServer::DebugProcess() was doing was to allow 
calling AdjustProcessProperties() then remove this whole function.


Comment at: 
source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp:159
@@ +158,3 @@
+lldb::ProcessSP process_sp = PlatformRemoteGDBServer::Attach(attach_info, 
debugger, target, error);
+AdjustProcessProperties(process_sp);
+return process_sp;

Remove the call to AdjustProcessProperties(...) and let the process call 
platform_sp->GetDefaultMemoryCacheLineSize() when it needs to. If the only this 
this PlatformAndroidRemoteGDBServer::Attach() was doing was to allow calling 
AdjustProcessProperties() then remove this whole function.


Comment at: 
source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp:163-174
@@ -139,1 +162,14 @@
+
+void
+PlatformAndroidRemoteGDBServer::AdjustProcessProperties(const lldb::ProcessSP 
_sp)
+{
+if (! process_sp)
+return;
+
+lldb::OptionValueSP value_sp = process_sp->GetMemoryCacheLineSizeOption();
+
+if (value_sp && ! value_sp->OptionWasSet())
+value_sp->SetUInt64Value(g_android_default_cache_size);
+}
+
 void

Change this to be:
```
uint32_t
PlatformAndroidRemoteGDBServer:: GetDefaultMemoryCacheLineSize()
{
return g_android_default_cache_size;
}
```

Add the following to Platform.h inside the lldb_private::Platform class 
definition:

```
virtual uint32_t GetDefaultMemoryCacheLineSize() { return 0; }
```



Comment at: 
source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h:39-49
@@ -38,1 +38,13 @@
 
+lldb::ProcessSP
+DebugProcess(ProcessLaunchInfo _info,
+ Debugger ,
+ Target *target,   // Can be NULL, if NULL create a new 
target, else use existing one
+ Error ) override;
+
+lldb::ProcessSP
+Attach(ProcessAttachInfo _info,
+   Debugger ,
+   Target *target,   // Can be NULL, if NULL create a new target, 
else use existing one
+   Error ) override;
+

If the only this these fucntions were added for was to allow calling 
AdjustProcessProperties() then remove these.


Comment at: 
source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h:55-56
@@ -42,1 +54,4 @@
 
+void
+AdjustProcessProperties(const lldb::ProcessSP _sp);
+

Change to be:

```
uint32_t GetDefaultMemoryCacheLineSize() override;
```


Comment at: source/Target/Process.cpp:183-189
@@ -182,1 +182,9 @@
 
+lldb::OptionValueSP
+ProcessProperties::GetMemoryCacheLineSizeOption()
+{
+const uint32_t idx = ePropertyMemCacheLineSize;
+lldb_private::ExecutionContext exe_ctx(m_process);
+return m_collection_sp->GetPropertyAtIndex(_ctx, true, 
idx)->GetValue();
+}
+

Remove this and modify Process to fetch this information on attach if the 
process option wasn't set. This means you don't need to expose this 
OptionValueSP and you can do it all within the process by grabbing the platform 
from the target and then calling platform_sp->GetDefaultMemoryCacheLineSize(). 
The default platform implementation should return 0 and if zero is returned 
(meaning no preference), then continue using the current setting that process 
was using from the setting, else override the current value. 




http://reviews.llvm.org/D13812



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


[Lldb-commits] [PATCH] D13830: [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes.

2015-10-16 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: brucem, labath, clayborg.
Eugene.Zelenko added a subscriber: lldb-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.
Herald added a subscriber: emaste.

I checked this patch on my own build on RHEL 6.

Repository:
  rL LLVM

http://reviews.llvm.org/D13830

Files:
  source/Plugins/Process/Utility/HistoryThread.h
  source/Plugins/Process/Utility/HistoryUnwind.h
  source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
  source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
  source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
  source/Plugins/Process/Utility/RegisterContextDummy.h
  source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h
  source/Plugins/Process/Utility/RegisterContextHistory.h
  source/Plugins/Process/Utility/RegisterContextLLDB.h
  source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h
  source/Plugins/Process/Utility/RegisterContextMemory.h
  source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
  source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
  source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h
  source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
  source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h

Index: source/Plugins/Process/Utility/RegisterContextLLDB.h
===
--- source/Plugins/Process/Utility/RegisterContextLLDB.h
+++ source/Plugins/Process/Utility/RegisterContextLLDB.h
@@ -10,8 +10,12 @@
 #ifndef lldb_RegisterContextLLDB_h_
 #define lldb_RegisterContextLLDB_h_
 
+// C Includes
+// C++ Includes
 #include 
 
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Symbol/UnwindPlan.h"
@@ -33,43 +37,40 @@
  lldb_private::SymbolContext& sym_ctx,
  uint32_t frame_number, lldb_private::UnwindLLDB& unwind_lldb);
 
-///
-// pure virtual functions from the base class that we must implement
-///
+~RegisterContextLLDB() override = default;
 
-virtual
-~RegisterContextLLDB () { }
+void
+InvalidateAllRegisters() override;
 
-virtual void
-InvalidateAllRegisters ();
+size_t
+GetRegisterCount() override;
 
-virtual size_t
-GetRegisterCount ();
+const lldb_private::RegisterInfo *
+GetRegisterInfoAtIndex(size_t reg) override;
 
-virtual const lldb_private::RegisterInfo *
-GetRegisterInfoAtIndex (size_t reg);
+size_t
+GetRegisterSetCount() override;
 
-virtual size_t
-GetRegisterSetCount ();
+const lldb_private::RegisterSet *
+GetRegisterSet(size_t reg_set) override;
 
-virtual const lldb_private::RegisterSet *
-GetRegisterSet (size_t reg_set);
+bool
+ReadRegister(const lldb_private::RegisterInfo *reg_info,
+ lldb_private::RegisterValue ) override;
 
-virtual bool
-ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue );
+bool
+WriteRegister(const lldb_private::RegisterInfo *reg_info,
+  const lldb_private::RegisterValue ) override;
 
-virtual bool
-WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue );
+bool
+ReadAllRegisterValues(lldb::DataBufferSP _sp) override;
 
-virtual bool
-ReadAllRegisterValues (lldb::DataBufferSP _sp);
+bool
+WriteAllRegisterValues(const lldb::DataBufferSP _sp) override;
 
-virtual bool
-WriteAllRegisterValues (const lldb::DataBufferSP _sp);
+uint32_t
+ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override;
 
-virtual uint32_t
-ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num);
-
 bool
 IsValid () const;
 
@@ -99,7 +100,6 @@
 // UnwindLLDB needs to pass around references to RegisterLocations
 friend class UnwindLLDB;
 
-
 // Returns true if we have an unwind loop -- the same stack frame unwinding 
 // multiple times.
 bool
@@ -130,7 +130,6 @@
 bool
 IsSkipFrame () const;
 
-
 //--
 /// Determines if a SymbolContext is a trap handler or not
 ///
@@ -221,7 +220,6 @@
 bool
 IsUnwindPlanValidForCurrentPC(lldb::UnwindPlanSP unwind_plan_sp, int _pc_offset);
 
-
 lldb_private::Thread& m_thread;
 
 ///
@@ -269,4 +267,4 @@
 
 } // namespace lldb_private
 
-#endif  // lldb_RegisterContextLLDB_h_
+#endif // lldb_RegisterContextLLDB_h_
Index: source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
===
--- source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
+++ 

Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.

2015-10-16 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 37630.
sivachandra added a comment.

Address comments.


http://reviews.llvm.org/D13778

Files:
  include/lldb/API/SBValue.h
  include/lldb/Core/ValueObject.h
  include/lldb/Core/ValueObjectCast.h
  include/lldb/Core/ValueObjectChild.h
  include/lldb/Core/ValueObjectConstResult.h
  include/lldb/Core/ValueObjectDynamicValue.h
  include/lldb/Core/ValueObjectMemory.h
  include/lldb/Core/ValueObjectRegister.h
  include/lldb/Core/ValueObjectSyntheticFilter.h
  include/lldb/Core/ValueObjectVariable.h
  include/lldb/DataFormatters/TypeSynthetic.h
  include/lldb/Interpreter/ScriptInterpreter.h
  scripts/Python/python-wrapper.swig
  scripts/interface/SBValue.i
  source/API/SBValue.cpp
  source/API/SystemInitializerFull.cpp
  source/Core/ValueObject.cpp
  source/Core/ValueObjectCast.cpp
  source/Core/ValueObjectChild.cpp
  source/Core/ValueObjectConstResult.cpp
  source/Core/ValueObjectDynamicValue.cpp
  source/Core/ValueObjectMemory.cpp
  source/Core/ValueObjectRegister.cpp
  source/Core/ValueObjectSyntheticFilter.cpp
  source/Core/ValueObjectVariable.cpp
  source/DataFormatters/TypeSynthetic.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -69,7 +69,7 @@
const char *session_dictionary_name,
const lldb::ProcessSP& process_sp);
 
-typedef size_t  (*SWIGPythonCalculateNumChildren)   (void *implementor);
+typedef size_t  (*SWIGPythonCalculateNumChildren)   (void *implementor, uint32_t max);
 typedef void*   (*SWIGPythonGetChildAtIndex)(void *implementor, uint32_t idx);
 typedef int (*SWIGPythonGetIndexOfChildWithName)(void *implementor, const char* child_name);
 typedef void*   (*SWIGPythonCastPyObjectToSBValue)  (void* data);
@@ -196,7 +196,7 @@
 StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name,
 lldb_private::Error ) override;
 
-size_t CalculateNumChildren(const StructuredData::ObjectSP ) override;
+size_t CalculateNumChildren(const StructuredData::ObjectSP , uint32_t max) override;
 
 lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP , uint32_t idx) override;
 
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2199,7 +2199,7 @@
 }
 
 size_t
-ScriptInterpreterPython::CalculateNumChildren(const StructuredData::ObjectSP _sp)
+ScriptInterpreterPython::CalculateNumChildren(const StructuredData::ObjectSP _sp, uint32_t max)
 {
 if (!implementor_sp)
 return 0;
@@ -2217,7 +2217,7 @@
 
 {
 Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
-ret_val = g_swig_calc_children (implementor);
+ret_val = g_swig_calc_children (implementor, max);
 }
 
 return ret_val;
Index: source/DataFormatters/TypeSynthetic.cpp
===
--- source/DataFormatters/TypeSynthetic.cpp
+++ source/DataFormatters/TypeSynthetic.cpp
@@ -201,7 +201,15 @@
 {
 if (!m_wrapper_sp || m_interpreter == NULL)
 return 0;
-return m_interpreter->CalculateNumChildren(m_wrapper_sp);
+return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX);
+}
+
+size_t
+ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren (uint32_t max)
+{
+if (!m_wrapper_sp || m_interpreter == NULL)
+return 0;
+return m_interpreter->CalculateNumChildren(m_wrapper_sp, max);
 }
 
 bool
Index: source/Core/ValueObjectVariable.cpp
===
--- source/Core/ValueObjectVariable.cpp
+++ source/Core/ValueObjectVariable.cpp
@@ -91,15 +91,16 @@
 }
 
 size_t
-ValueObjectVariable::CalculateNumChildren()
+ValueObjectVariable::CalculateNumChildren(uint32_t max)
 {
 CompilerType type(GetCompilerType());
 
 if (!type.IsValid())
 return 0;
 
 const bool omit_empty_base_classes = true;
-return type.GetNumChildren(omit_empty_base_classes);
+auto child_count = type.GetNumChildren(omit_empty_base_classes);
+return child_count <= max ? child_count : max;
 }
 
 

[Lldb-commits] [lldb] r250499 - Resubmit: RenderScript command for printing allocation contents

2015-10-16 Thread Ewan Crawford via lldb-commits
Author: ewancrawford
Date: Fri Oct 16 03:28:47 2015
New Revision: 250499

URL: http://llvm.org/viewvc/llvm-project?rev=250499=rev
Log:
Resubmit: RenderScript command for printing allocation contents 
 
Previous commit r250281 broke TestDataFormatterSmartArray.py
Resolved in in this patch by adding the new enum eFormatVectorOfFloat16 to 
FormatManager.

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

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/DataExtractor.cpp
lldb/trunk/source/DataFormatters/FormatManager.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=250499=250498=250499=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Oct 16 03:28:47 2015
@@ -146,6 +146,7 @@ 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=250499=250498=250499=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Oct 16 03:28:47 2015
@@ -271,6 +271,7 @@ public:
 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=250499=250498=250499=diff
==
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Fri Oct 16 03:28:47 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/DataFormatters/FormatManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=250499=250498=250499=diff
==
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Fri Oct 16 03:28:47 2015
@@ -67,6 +67,7 @@ g_format_infos[] =
 { eFormatVectorOfUInt32 , '\0'  , "uint32_t[]"  },
 { eFormatVectorOfSInt64 , '\0'  , "int64_t[]"   },
 { eFormatVectorOfUInt64 , '\0'  , "uint64_t[]"  },
+{ eFormatVectorOfFloat16, '\0'  , "float16[]"   },
 { eFormatVectorOfFloat32, '\0'  , "float32[]"   },
 { eFormatVectorOfFloat64, '\0'  , "float64[]"   },
 { eFormatVectorOfUInt128, '\0'  , "uint128_t[]" },
@@ -534,6 +535,7 @@ FormatManager::GetSingleItemFormat(lldb:
 case eFormatVectorOfUInt128:
 return eFormatHex;
 
+case eFormatVectorOfFloat16:
 case eFormatVectorOfFloat32:
 case eFormatVectorOfFloat64:
 return eFormatFloat;

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=250499=250498=250499=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Fri Oct 16 03:28:47 2015
@@ -14,6 +14,7 @@
 #include "lldb/Core/Error.h"
 #include 

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

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

Changed prior to commit:
  http://reviews.llvm.org/D13730?vs=37356=37562#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13730

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

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 ) const;
 
+bool DumpAllocation(Stream , StackFrame* frame_ptr, const uint32_t id);
+
 void ListAllocations(Stream , StackFrame* frame_ptr, bool recompute);
 
 void AttemptBreakpointAtKernelName(Stream , const char *name, 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 , 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 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, eFormatVectorOfUInt16, sizeof(uint16_t)}, // RS_TYPE_UNSIGNED_16
+{eFormatDecimal, eFormatVectorOfUInt32, 

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

2015-10-16 Thread Pavel Labath via lldb-commits
labath added inline comments.


Comment at: source/Host/posix/DomainSocket.cpp:74
@@ +73,3 @@
+FileSystem::Unlink(FileSpec{name, true});
+
+Error error;

If we're going to use unique names, then this won't be necessary (and I would 
much rather see a random error opening a socket than a random file 
disappearing). BTW, have you considered using abstract sockets for the 
lldb-server use case? Albeit linux-specific, I find them much nicer, as they 
have no connection to the file system whatsoever.


http://reviews.llvm.org/D13754



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


Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.

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

Not really my area, but couldn't the needed functionality be implemented on top 
of GetChildAtIndex(). I mean, if GetChildAtIndex(50) returns a valid SBValue, 
then the container has at least 50 elements, right?
Then `HasAtLeastNChildren(n) == GetChildAtIndex(n).IsValid()` and we don't need 
to add anything to the public API. Or am I missing something here... (?)


http://reviews.llvm.org/D13778



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


[Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)

2015-10-16 Thread Eugene Leviant via lldb-commits
evgeny777 created this revision.
evgeny777 added reviewers: granata.enrico, ki.stfu, abidh.
evgeny777 added subscribers: lldb-commits, KLapshin.

Current revision do not use lldb type summaries for simple types with no 
children (like function pointers). So this patch makes MI use lldb type 
summaries for evaluation of all types of objects, so MI own formatters are no 
longer needed.

http://reviews.llvm.org/D13799

Files:
  test/tools/lldb-mi/data/TestMiData.py
  test/tools/lldb-mi/symbol/TestMiSymbol.py
  tools/lldb-mi/MICmnLLDBDebugger.cpp
  tools/lldb-mi/MICmnLLDBDebugger.h
  tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
  tools/lldb-mi/MICmnLLDBUtilSBValue.h

Index: tools/lldb-mi/MICmnLLDBUtilSBValue.h
===
--- tools/lldb-mi/MICmnLLDBUtilSBValue.h
+++ tools/lldb-mi/MICmnLLDBUtilSBValue.h
@@ -51,11 +51,8 @@
   private:
 template  CMIUtilString ReadCStringFromHostMemory(lldb::SBValue , const MIuint vnMaxLen = UINT32_MAX) const;
 bool GetSimpleValue(const bool vbHandleArrayType, CMIUtilString ) const;
-CMIUtilString GetSimpleValueChar() const;
-CMIUtilString GetSimpleValueCStringPointer() const;
-CMIUtilString GetSimpleValueCStringArray() const;
 bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple , const MIuint vnDepth = 1) const;
-CMIUtilString GetValueSummary() const;
+CMIUtilString GetValueSummary(bool valueOnly, const CMIUtilString& failVal = CMIUtilString()) const;
 
 // Statics:
   private:
Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
===
--- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
+++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
@@ -123,31 +123,13 @@
 const MIuint nChildren = m_rValue.GetNumChildren();
 if (nChildren == 0)
 {
-if (m_bHandleCharType && IsCharType())
-{
-vwrValue = GetSimpleValueChar();
-return MIstatus::success;
-}
-else
-{
-const char *pValue = m_rValue.GetValue();
-vwrValue = pValue != nullptr ? pValue : m_pUnkwn;
-return MIstatus::success;
-}
+vwrValue = GetValueSummary(!m_bHandleCharType && IsCharType(), m_pUnkwn);
+return MIstatus::success;
 }
 else if (IsPointerType())
 {
-if (m_bHandleCharType && IsPointeeCharType())
-{
-vwrValue = GetSimpleValueCStringPointer();
-return MIstatus::success;
-}
-else
-{
-const char *pValue = m_rValue.GetValue();
-vwrValue = pValue != nullptr ? pValue : m_pUnkwn;
-return MIstatus::success;
-}
+vwrValue = GetValueSummary(!m_bHandleCharType && IsPointeeCharType(), m_pUnkwn);
+return MIstatus::success;
 }
 else if (IsArrayType())
 {
@@ -157,7 +139,7 @@
 bPrintCharArrayAsString) && bPrintCharArrayAsString;
 if (bPrintCharArrayAsString && m_bHandleCharType && IsFirstChildCharType())
 {
-vwrValue = GetSimpleValueCStringArray();
+vwrValue = GetValueSummary(false);
 return MIstatus::success;
 }
 else if (vbHandleArrayType)
@@ -170,152 +152,15 @@
 {
 // Treat composite value which has registered summary
 // (for example with AddCXXSummary) as simple value
-vwrValue = GetValueSummary();
+vwrValue = GetValueSummary(false);
 if (!vwrValue.empty())
 return MIstatus::success;
 }
 
 // Composite variable type i.e. struct
 return MIstatus::failure;
 }
 
-//++ 
-// Details: Retrieve from the LLDB SB Value object the char value of the variable.
-// Type:Method.
-// Args:None.
-// Return:  CMIUtilString   - The char value of the variable.
-// Throws:  None.
-//--
-CMIUtilString
-CMICmnLLDBUtilSBValue::GetSimpleValueChar() const
-{
-const CMIUtilString& summary = GetValueSummary();
-if (!summary.empty())
-return summary;
-
-const uint64_t value = m_rValue.GetValueAsUnsigned();
-if (value == 0)
-{
-const uint64_t nFailValue = 1;
-if (nFailValue == m_rValue.GetValueAsUnsigned(nFailValue))
-return m_pUnkwn;
-}
-
-const lldb::BasicType eType = m_rValue.GetType().GetBasicType();
-switch (eType)
-{
-default:
-assert(0 && "value must be a char type");
-case lldb::eBasicTypeChar:
-case lldb::eBasicTypeSignedChar:
-case lldb::eBasicTypeUnsignedChar:
-{
-const CMIUtilString prefix(CMIUtilString::ConvertToPrintableASCII((char)value));
-return CMIUtilString::Format("%" PRIu8 " '%s'", (uint8_t)value, prefix.c_str());
-}
-case lldb::eBasicTypeChar16:
-{
-

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

2015-10-16 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 37566.
tberghammer added a comment.

Create optional std::async based implementation


http://reviews.llvm.org/D13727

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

Index: unittests/Utility/TaskPoolTest.cpp
===
--- /dev/null
+++ unittests/Utility/TaskPoolTest.cpp
@@ -0,0 +1,62 @@
+#include "gtest/gtest.h"
+
+#include "lldb/Utility/TaskPool.h"
+
+TEST (TaskPoolTest, AddTask)
+{
+auto fn = [](int x) { return x * x + 1; };
+
+auto f1 = TaskPool::AddTask(fn, 1);
+auto f2 = TaskPool::AddTask(fn, 2);
+auto f3 = TaskPool::AddTask(fn, 3);
+auto f4 = TaskPool::AddTask(fn, 4);
+
+ASSERT_EQ (10, f3.get());
+ASSERT_EQ ( 2, f1.get());
+ASSERT_EQ (17, f4.get());
+ASSERT_EQ ( 5, f2.get());
+}
+
+TEST (TaskPoolTest, RunTasks)
+{
+std::vector r(4);
+
+auto fn = [](int x, int& y) { y = x * x + 1; };
+
+TaskPool::RunTasks(
+[fn, ]() { fn(1, r[0]); },
+[fn, ]() { fn(2, r[1]); },
+[fn, ]() { fn(3, r[2]); },
+[fn, ]() { fn(4, r[3]); }
+);
+
+ASSERT_EQ ( 2, r[0]);
+ASSERT_EQ ( 5, r[1]);
+ASSERT_EQ (10, r[2]);
+ASSERT_EQ (17, r[3]);
+}
+
+TEST (TaskPoolTest, TaskRunner)
+{
+auto fn = [](int x) { return std::make_pair(x, x * x); };
+
+TaskRunner> tr;
+tr.AddTask(fn, 1);
+tr.AddTask(fn, 2);
+tr.AddTask(fn, 3);
+tr.AddTask(fn, 4);
+
+int count = 0;
+while (true)
+{
+auto f = tr.WaitForNextCompletedTask();
+if (!f.valid())
+break;
+
+++count;
+std::pair v = f.get();
+ASSERT_EQ (v.first * v.first, v.second);
+}
+
+ASSERT_EQ(4, count);
+}
Index: unittests/Utility/CMakeLists.txt
===
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(UtilityTests
   StringExtractorTest.cpp
+  TaskPoolTest.cpp
   UriParserTest.cpp
   )
Index: source/Utility/TaskPool.cpp
===
--- /dev/null
+++ source/Utility/TaskPool.cpp
@@ -0,0 +1,92 @@
+//===- 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"
+
+#ifdef USE_HAND_WRITTEN_THREAD_POOL
+
+namespace
+{
+class TaskPoolImpl
+{
+public:
+static TaskPoolImpl&
+GetInstance();
+
+void
+AddTask(std::function&& task_fn);
+
+private:
+TaskPoolImpl(uint32_t num_threads);
+
+static void
+Worker(TaskPoolImpl* pool);
+
+std::queue> m_tasks;
+std::mutexm_tasks_mutex;
+uint32_t  m_thread_count;
+};
+
+} // end of anonymous namespace
+
+TaskPoolImpl&
+TaskPoolImpl::GetInstance()
+{
+static TaskPoolImpl g_task_pool_impl(std::thread::hardware_concurrency());
+return g_task_pool_impl;
+}
+
+void
+TaskPool::AddTaskImpl(std::function&& task_fn)
+{
+TaskPoolImpl::GetInstance().AddTask(std::move(task_fn));
+}
+
+TaskPoolImpl::TaskPoolImpl(uint32_t num_threads) :
+m_thread_count(0)
+{
+}
+
+void
+TaskPoolImpl::AddTask(std::function&& task_fn)
+{
+static const uint32_t max_threads = std::thread::hardware_concurrency();
+
+std::unique_lock lock(m_tasks_mutex);
+m_tasks.emplace(std::move(task_fn));
+if (m_thread_count < max_threads)
+{
+m_thread_count++;
+lock.unlock();
+
+std::thread (Worker, this).detach();
+}
+}
+
+void
+TaskPoolImpl::Worker(TaskPoolImpl* pool)
+{
+while (true)
+{
+std::unique_lock lock(pool->m_tasks_mutex);
+if (pool->m_tasks.empty())
+{
+pool->m_thread_count--;
+break;
+}
+
+std::function f = pool->m_tasks.front();
+pool->m_tasks.pop();
+lock.unlock();
+
+f();
+}
+}
+
+#endif // USE_HAND_WRITTEN_THREAD_POOL
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 

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

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

Zachary, I don't think using std::async is a good idea because it provides a 
very different threading model than the one we want here. Let me demonstrate 
that with an example:

  #include 
  #include 
  #include 
  #include 
  #include 
  
  using namespace std;
  
  
  unsigned X = 0;
  mutex m;
  condition_variable cv;
  
  int f()
  {
  unique_lock l(m);
  X++;
  printf("X = %d\n", X);
  cv.wait(l, [] { return X > 1000; });
  cv.notify_one();
  return X;
  }
  
  int main()
  {
  vector v;
  for(unsigned i = 0; i < 1000; ++i) 
  v.push_back(async(launch::async, f));
  
  v.push_back(async(launch::async, f)); // break here
  
  for(auto : v)
  printf("future = %d\n", f.get());
  
  return 0;
  }

This (convoluted) example starts 1000 (+1) asynchronous tasks and wires them up 
in a way that they can't complete until all of them are running. If the 
implementation was limiting the number of concurrently running tasks to n<1000, 
then this program would not complete. Nevertheless, it *does* complete.

When I run this program under linux, it completes instantly. That's because 
linux implementation of std::async just kicks off a new thread for each task 
let's them run freely. Windows (for better or for worse) does something 
different here. Initially, it only spawns a small number of tasks and then 
periodically checks if the tasks have finished, and if not, it starts a more of 
them. That's why it takes this program several minutes to complete, but it 
still completes, and if you check it with a debugger in the end, you will see 
that there were 1000 threads running (i.e. it was not doing anything clever, 
like multiplexing multiple tasks over the same OS thread, etc.). This is not 
the threading model we want here I think (in fact we should probably ban using 
any communication between the tasks in the pool). Our requirement seems to be 
"being able to limit the number of tasks running concurrently". Having the 
thread pool exhibit one behavior on windows and another elsewhere would be very 
confusing and error-prone.

Having said that, I do think there is one more thing that speaks against having 
hardware_concurrency() threads running constantly, that we haven't considered 
yet. It is our test suite. It already spawns a large number of LLDB processes 
in parallel, and having each process spawn a large number of threads might be 
dangerous. Tamas, if you're going to keep the threads alive, I think we should 
evaluate the impact of it on our test suite.

Considering all of this, I think it is a good idea to shut down threads when 
they are not used as an initial implementation. Later, we can evaluate 
potential improvements, like keeping some number of threads on stand-by.


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] r250502 - Fix temporary directory computation on linux (pr25147)

2015-10-16 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Oct 16 04:32:05 2015
New Revision: 250502

URL: http://llvm.org/viewvc/llvm-project?rev=250502=rev
Log:
Fix temporary directory computation on linux (pr25147)

Summary:
On linux, the environment variables for temp directories that lldb checks for 
are generally not
defined, and the temp directory computation failed. This caused expression 
evaluation to fall
back to creating "/tmp/lldb-*.expr" debugging files instead of the usual
"$TMP/lldb/pid/lldb-*.expr". Crucially, these files were not cleaned up on lldb 
exit, which
caused clutter in the /tmp folder, especially on long-running machines (e.g. 
builtbots). This
commit fixes lldb to use llvm::sys::path::system_temp_directory, which does the 
same environment
variable dance, but (!) also falls back to the P_tmpdir macro, which is how the 
temp directory is
defined on linux.

Since the linux temp path computation now succeeds, I needed to also modify 
Android path
computation to check for actual directory existence, rather then checking 
whether the operation
failed.

Reviewers: clayborg, tberghammer

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

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

Modified:
lldb/trunk/source/Host/android/HostInfoAndroid.cpp
lldb/trunk/source/Host/common/HostInfoBase.cpp

Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=250502=250501=250502=diff
==
--- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original)
+++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Fri Oct 16 04:32:05 2015
@@ -91,11 +91,14 @@ HostInfoAndroid::ResolveLibraryPath(cons
 bool
 HostInfoAndroid::ComputeTempFileBaseDirectory(FileSpec _spec)
 {
-if (HostInfoLinux::ComputeTempFileBaseDirectory(file_spec))
-return true;
+bool success = HostInfoLinux::ComputeTempFileBaseDirectory(file_spec);
 
-// If the default mechanism for computing the temp directory failed then
-// fall back to /data/local/tmp
-file_spec = FileSpec("/data/local/tmp", false);
-return true;
+// On Android, there is no path which is guaranteed to be writable. If the 
user has not
+// provided a path via an environment variable, the generic algorithm will 
deduce /tmp, which
+// is plain wrong. In that case we have an invalid directory, we 
substitute the path with
+// /data/local/tmp, which is correct at least in some cases (i.e., when 
running as shell user).
+if (!success || !file_spec.Exists())
+file_spec = FileSpec("/data/local/tmp", false);
+
+return file_spec.Exists();
 }

Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=250502=250501=250502=diff
==
--- lldb/trunk/source/Host/common/HostInfoBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostInfoBase.cpp Fri Oct 16 04:32:05 2015
@@ -20,6 +20,7 @@
 #include "llvm/ADT/Triple.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Host.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include 
@@ -344,19 +345,9 @@ HostInfoBase::ComputeProcessTempFileDire
 bool
 HostInfoBase::ComputeTempFileBaseDirectory(FileSpec _spec)
 {
-file_spec.Clear();
-
-const char *tmpdir_cstr = getenv("TMPDIR");
-if (tmpdir_cstr == nullptr)
-{
-tmpdir_cstr = getenv("TMP");
-if (tmpdir_cstr == nullptr)
-tmpdir_cstr = getenv("TEMP");
-}
-if (!tmpdir_cstr)
-return false;
-
-file_spec = FileSpec(tmpdir_cstr, false);
+llvm::SmallVector tmpdir;
+llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir);
+file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()), true);
 return true;
 }
 


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


Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.

2015-10-16 Thread Siva Chandra via lldb-commits
sivachandra added a comment.

There could be an error reading the k-th element for k < n.In which case, we 
will wrongly conclude that there are only k-1 elements.


http://reviews.llvm.org/D13778



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


[Lldb-commits] [PATCH] D13812: Increase default memory cache line size for android

2015-10-16 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, tberghammer.
labath added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

ADB packets have a fixed size of 4k. This means the size of memory reads does 
not affect speed
too much (as long as it fits in one packet). Therefore, I am increasing the 
default memory read
size for android to 2k. This value is used only if the user has not modified 
the default
memory-cache-line-size setting.

http://reviews.llvm.org/D13812

Files:
  include/lldb/Target/Process.h
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -180,6 +180,14 @@
 return m_collection_sp->GetPropertyAtIndexAsUInt64 (NULL, idx, g_properties[idx].default_uint_value);
 }
 
+lldb::OptionValueSP
+ProcessProperties::GetMemoryCacheLineSizeOption()
+{
+const uint32_t idx = ePropertyMemCacheLineSize;
+lldb_private::ExecutionContext exe_ctx(m_process);
+return m_collection_sp->GetPropertyAtIndex(_ctx, true, idx)->GetValue();
+}
+
 Args
 ProcessProperties::GetExtraStartupCommands () const
 {
Index: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
===
--- source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
+++ source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
@@ -36,10 +36,25 @@
 Error
 DisconnectRemote () override;
 
+lldb::ProcessSP
+DebugProcess(ProcessLaunchInfo _info,
+ Debugger ,
+ Target *target,   // Can be NULL, if NULL create a new target, else use existing one
+ Error ) override;
+
+lldb::ProcessSP
+Attach(ProcessAttachInfo _info,
+   Debugger ,
+   Target *target,   // Can be NULL, if NULL create a new target, else use existing one
+   Error ) override;
+
 protected:
 std::string m_device_id;
 std::map m_port_forwards;
 
+void
+AdjustProcessProperties(const lldb::ProcessSP _sp);
+
 uint16_t
 LaunchGDBserverAndGetPort (lldb::pid_t ) override;
 
Index: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -11,6 +11,7 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Host/common/TCPSocket.h"
+#include "lldb/Target/ExecutionContext.h"
 #include "AdbClient.h"
 #include "PlatformAndroidRemoteGDBServer.h"
 #include "Utility/UriParser.h"
@@ -22,6 +23,7 @@
 using namespace platform_android;
 
 static const lldb::pid_t g_remote_platform_pid = 0; // Alias for the process id of lldb-platform
+static const unsigned int g_android_default_cache_size = 2048; // Fits inside 4k adb packet.
 
 static Error
 ForwardPortWithAdb (const uint16_t local_port, const uint16_t remote_port, std::string& device_id)
@@ -136,6 +138,40 @@
 return PlatformRemoteGDBServer::DisconnectRemote ();
 }
 
+lldb::ProcessSP
+PlatformAndroidRemoteGDBServer::DebugProcess(ProcessLaunchInfo _info,
+  Debugger ,
+  Target *target,   // Can be NULL, if NULL create a new target, else use existing one
+  Error )
+{
+lldb::ProcessSP process_sp = PlatformRemoteGDBServer::DebugProcess(launch_info, debugger, target, error);
+AdjustProcessProperties(process_sp);
+return process_sp;
+}
+
+lldb::ProcessSP
+PlatformAndroidRemoteGDBServer::Attach(ProcessAttachInfo _info,
+Debugger ,
+Target *target,   // Can be NULL, if NULL create a new target, else use existing one
+Error )
+{
+lldb::ProcessSP process_sp = PlatformRemoteGDBServer::Attach(attach_info, debugger, target, error);
+AdjustProcessProperties(process_sp);
+return process_sp;
+}
+
+void
+PlatformAndroidRemoteGDBServer::AdjustProcessProperties(const lldb::ProcessSP _sp)
+{
+if (! process_sp)
+return;
+
+lldb::OptionValueSP value_sp = process_sp->GetMemoryCacheLineSizeOption();
+
+if (value_sp && ! value_sp->OptionWasSet())
+value_sp->SetUInt64Value(g_android_default_cache_size);
+}
+
 void
 PlatformAndroidRemoteGDBServer::DeleteForwardPort (lldb::pid_t pid)
 {
Index: include/lldb/Target/Process.h
===
--- include/lldb/Target/Process.h
+++ include/lldb/Target/Process.h
@@ -67,6 +67,9 @@
 uint64_t
 GetMemoryCacheLineSize () const;
 
+lldb::OptionValueSP
+GetMemoryCacheLineSizeOption ();
+
 Args
 GetExtraStartupCommands () const;
 

Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.

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

How big of an error does it have to be for that to happen? Is that something we 
would consider an "lldb bug"/"data formatter bug" or it can be caused by 
something out of our control, like missing debug info on one of the children?


http://reviews.llvm.org/D13778



___
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-16 Thread Zachary Turner via lldb-commits
zturner added a comment.

Sorry, should have mentioned that the lgtm is contingent on Todd's concerns.  I 
like the idea of having a setting in LLDB that controls the maximum number of 
threads to use for parallel work.  We should probably set this at a very h igh 
level in dotest so that all instances automatically get this value without 
having to remember to do it in each test.


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] r250576 - Skip hanging watchpoint test on Windows (rather than just xfailing).

2015-10-16 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Fri Oct 16 18:19:22 2015
New Revision: 250576

URL: http://llvm.org/viewvc/llvm-project?rev=250576=rev
Log:
Skip hanging watchpoint test on Windows (rather than just xfailing).

Modified:

lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py

Modified: 
lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py?rev=250576=250575=250576=diff
==
--- 
lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py 
(original)
+++ 
lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py 
Fri Oct 16 18:19:22 2015
@@ -26,7 +26,7 @@ class WatchpointConditionAPITestCase(Tes
 self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
 
 @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not 
supported
-@expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - 
Watchpoints not supported on Windows
+@skipIfWindows # Watchpoints not supported on Windows, and this test hangs
 def test_watchpoint_cond_api(self):
 """Test watchpoint condition API."""
 self.build(dictionary=self.d)


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


[Lldb-commits] [lldb] r250580 - Split getting the key from a window from the code that handles the key.

2015-10-16 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Oct 16 18:34:40 2015
New Revision: 250580

URL: http://llvm.org/viewvc/llvm-project?rev=250580=rev
Log:
Split getting the key from a window from the code that handles the key.


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=250580=250579=250580=diff
==
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py Fri Oct 16 18:34:40 2015
@@ -402,6 +402,22 @@ class Window(object):
 def quit_action(self):
 raise QuitException
 
+def get_key(self, timeout_msec=-1):
+self.timeout(timeout_msec)
+done = False
+c = self.window.getch()
+if c == 27:
+self.timeout(0)
+escape_key = 0
+while True:
+escape_key = self.window.getch()
+if escape_key == -1:
+break
+else:
+c = c << 8 | escape_key
+self.timeout(timeout_msec)
+return c
+
 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
responder chain.
@@ -412,20 +428,9 @@ class Window(object):
for timeout_msec milliseconds.

n is the number of times to go through the event loop before 
exiting'''
-self.timeout(timeout_msec)
 done = False
 while not done and n > 0:
-c = self.window.getch()
-if c == 27:
-self.timeout(0)
-escape_key = 0
-while True:
-escape_key = self.window.getch()
-if escape_key == -1:
-break
-else:
-c = c << 8 | escape_key
-self.timeout(timeout_msec)
+c = self.get_key(timeoue_msec)
 if c != -1:
 try:
 self.handle_key(c)


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


[Lldb-commits] [lldb] r250581 - Handle eFormatVectorOfFloat16

2015-10-16 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct 16 18:42:04 2015
New Revision: 250581

URL: http://llvm.org/viewvc/llvm-project?rev=250581=rev
Log:
Handle eFormatVectorOfFloat16


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=250581=250580=250581=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Oct 16 18:42:04 2015
@@ -1519,6 +1519,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] [PATCH] D13836: Fix write-after-close of file descriptor in ScriptInterpreterPython

2015-10-16 Thread Zachary Turner via lldb-commits
zturner created this revision.
zturner added reviewers: clayborg, granata.enrico.
zturner added a subscriber: lldb-commits.

When we acquire the GIL with `Locker`, we save off the current stdio handles, 
redirect them, and when we release the GIL we put the old handles back.  This 
triggers a potential write-after-close, as follows:

In `ScriptInterpreterPython::ExecuteOneLine`, we set up a pipe, lock the gil, 
kick off a thread to do some work, then close the write end of the pipe.  
However, the write end of the pipe in this case is the same thing that we set 
Python's stdout and stderr handles to, and we haven't yet restored them until 
`ExecuteOneLine` ends, due to the scope in which the RAII object is declared.

This has always been fine, but only as a coincidence.  In Python 3 it seems 
that when you set `stderr` to a new file, it writes to the *original* file 
first (probably to flush it).  In the case of `ExecuteOneLine`, that file 
descriptor has been intentionally closed by caller as a means to break the pipe 
and join the other thread it was communicating with, so we get an error.

The fix here is simple: Just acquire the GIL in a tighter scope so that stdin, 
stdout, and stderr are reset to their original values before trying to join the 
read thread.

It doesn't *seem* like we need to hold the GIL any longer than this since no 
Python calls are happening outside of the new smaller scope I've introduced, 
but let me know if you can think of anything wrong with this.

http://reviews.llvm.org/D13836

Files:
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -570,9 +570,9 @@
 bool
 GetEmbeddedInterpreterModuleObjects ();
 
-PythonObject m_saved_stdin;
-PythonObject m_saved_stdout;
-PythonObject m_saved_stderr;
+PythonFile m_saved_stdin;
+PythonFile m_saved_stdout;
+PythonFile m_saved_stderr;
 PythonObject m_main_module;
 PythonObject m_lldb_module;
 PythonDictionary m_session_dict;
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -612,7 +612,7 @@
 // Flush the file before giving it to python to avoid interleaved output.
 in_file.Flush();
 
-m_saved_stdin = sys_module_dict.GetItemForKey(PythonString("stdin"));
+m_saved_stdin = sys_module_dict.GetItemForKey(PythonString("stdin")).AsType();
 // This call can deadlock your process if the file is locked
 PythonFile new_file(in_file, "r");
 sys_module_dict.SetItemForKey (PythonString("stdin"), new_file);
@@ -626,7 +626,7 @@
 // Flush the file before giving it to python to avoid interleaved output.
 out_file.Flush();
 
-m_saved_stdout = sys_module_dict.GetItemForKey(PythonString("stdout"));
+m_saved_stdout = sys_module_dict.GetItemForKey(PythonString("stdout")).AsType();
 
 PythonFile new_file(out_file, "w");
 sys_module_dict.SetItemForKey (PythonString("stdout"), new_file);
@@ -641,7 +641,7 @@
 // Flush the file before giving it to python to avoid interleaved output.
 err_file.Flush();
 
-m_saved_stderr = sys_module_dict.GetItemForKey(PythonString("stderr"));
+m_saved_stderr = sys_module_dict.GetItemForKey(PythonString("stderr")).AsType();
 
 PythonFile new_file(err_file, "w");
 sys_module_dict.SetItemForKey (PythonString("stderr"), new_file);
@@ -812,48 +812,49 @@
 FILE *in_file = input_file_sp->GetFile().GetStream();
 FILE *out_file = output_file_sp->GetFile().GetStream();
 FILE *err_file = error_file_sp->GetFile().GetStream();
-Locker locker(this,
-  ScriptInterpreterPython::Locker::AcquireLock |
-  ScriptInterpreterPython::Locker::InitSession |
-  (options.GetSetLLDBGlobals() ? ScriptInterpreterPython::Locker::InitGlobals : 0) |
-  ((result && result->GetInteractive()) ? 0: Locker::NoSTDIN),
-  ScriptInterpreterPython::Locker::FreeAcquiredLock |
-  ScriptInterpreterPython::Locker::TearDownSession,
-  in_file,
-  out_file,
-   

[Lldb-commits] [lldb] r250593 - [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes.

2015-10-16 Thread Eugene Zelenko via lldb-commits
Author: eugenezelenko
Date: Fri Oct 16 19:19:57 2015
New Revision: 250593

URL: http://llvm.org/viewvc/llvm-project?rev=250593=rev
Log:
[LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in 
source/Plugins/Process/Utility; other minor fixes.

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

Modified:
lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h
lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDummy.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextHistory.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h

lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h?rev=250593=250592=250593=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h Fri Oct 16 
19:19:57 2015
@@ -10,6 +10,10 @@
 #ifndef liblldb_HistoryThread_h_
 #define liblldb_HistoryThread_h_
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Core/Broadcaster.h"
@@ -37,52 +41,55 @@ class HistoryThread : public lldb_privat
 public:
 HistoryThread (lldb_private::Process , lldb::tid_t tid, 
std::vector pcs, uint32_t stop_id, bool stop_id_is_valid);
 
-virtual ~HistoryThread ();
+~HistoryThread() override;
 
-virtual lldb::RegisterContextSP
-GetRegisterContext ();
+lldb::RegisterContextSP
+GetRegisterContext() override;
 
-virtual lldb::RegisterContextSP
-CreateRegisterContextForFrame (StackFrame *frame);
+lldb::RegisterContextSP
+CreateRegisterContextForFrame(StackFrame *frame) override;
 
-virtual void
-RefreshStateAfterStop() { }
+void
+RefreshStateAfterStop() override { }
 
 bool
-CalculateStopInfo () { return false; }
+CalculateStopInfo() override
+{
+return false;
+}
 
 void 
-SetExtendedBacktraceToken (uint64_t token)
+SetExtendedBacktraceToken(uint64_t token) override
 {
 m_extended_unwind_token = token;
 }
 
 uint64_t
-GetExtendedBacktraceToken ()
+GetExtendedBacktraceToken() override
 {
 return m_extended_unwind_token;
 }
 
 const char *
-GetQueueName ()
+GetQueueName() override
 {
 return m_queue_name.c_str();
 }
 
 void
-SetQueueName (const char *name)
+SetQueueName(const char *name) override
 {
 m_queue_name = name;
 }
 
 lldb::queue_id_t
-GetQueueID ()
+GetQueueID() override
 {
 return m_queue_id;
 }
 
 void
-SetQueueID (lldb::queue_id_t queue)
+SetQueueID(lldb::queue_id_t queue) override
 {
 m_queue_id = queue;
 }
@@ -94,7 +101,7 @@ public:
 }
 
 uint32_t
-GetExtendedBacktraceOriginatingIndexID ();
+GetExtendedBacktraceOriginatingIndexID() override;
 
 void
 SetThreadName (const char *name)
@@ -102,14 +109,14 @@ public:
 m_thread_name = name;
 }
 
-virtual const char *
-GetName ()
+const char *
+GetName() override
 {
 return m_thread_name.c_str();
 }
 
-virtual void
-SetName(const char *name)
+void
+SetName(const char *name) override
 {
 m_thread_name = name;
 }
@@ -133,4 +140,4 @@ protected:
 
 } // namespace lldb_private
 
-#endif  // liblldb_HistoryThread_h_
+#endif // liblldb_HistoryThread_h_

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h?rev=250593=250592=250593=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h (original)
+++ 

[Lldb-commits] [PATCH] D13840: [LLDB] Fix Clang-tidy modernize-use-override warnings in some files in source/Plugins; other minor fixes.

2015-10-16 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: brucem, labath, clayborg.
Eugene.Zelenko added a subscriber: lldb-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

I checked this patch on my own build on RHEL 6.

Repository:
  rL LLVM

http://reviews.llvm.org/D13840

Files:
  source/Plugins/Process/elf-core/ProcessElfCore.h
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
  source/Plugins/Process/elf-core/ThreadElfCore.h
  source/Plugins/Process/mach-core/ProcessMachCore.h
  source/Plugins/Process/mach-core/ThreadMachCore.h
  source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.h
  source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h

Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -1,4 +1,4 @@
-//===-- PythonDataObjects.h*- C++ -*-===//
+//===-- PythonDataObjects.h--*- C++ -*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -12,7 +12,6 @@
 
 // C Includes
 // C++ Includes
-
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-defines.h"
@@ -22,6 +21,7 @@
 #include "lldb/Interpreter/OptionValue.h"
 
 namespace lldb_private {
+
 class PythonString;
 class PythonList;
 class PythonDictionary;
@@ -29,7 +29,7 @@
 
 class StructuredPythonObject : public StructuredData::Generic
 {
-  public:
+public:
 StructuredPythonObject()
 : StructuredData::Generic()
 {
@@ -41,7 +41,7 @@
 Py_XINCREF(GetValue());
 }
 
-virtual ~StructuredPythonObject()
+~StructuredPythonObject() override
 {
 if (Py_IsInitialized())
 Py_XDECREF(GetValue());
@@ -56,7 +56,7 @@
 
 void Dump(Stream ) const override;
 
-  private:
+private:
 DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject);
 };
 
@@ -104,7 +104,10 @@
 Reset(rhs);
 }
 
-virtual ~PythonObject() { Reset(); }
+virtual ~PythonObject()
+{
+Reset();
+}
 
 void
 Reset()
@@ -304,6 +307,7 @@
 
 StructuredData::DictionarySP CreateStructuredDictionary() const;
 };
+
 } // namespace lldb_private
 
-#endif  // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
===
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-
 #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
 
@@ -17,6 +16,10 @@
 
 #else
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "PythonDataObjects.h"
 #include "lldb/Core/IOHandler.h"
@@ -70,12 +73,19 @@
const lldb::ProcessSP& process_sp);
 
 typedef size_t  (*SWIGPythonCalculateNumChildren)   (void *implementor);
+
 typedef void*   (*SWIGPythonGetChildAtIndex)(void *implementor, uint32_t idx);
+
 typedef int (*SWIGPythonGetIndexOfChildWithName)(void *implementor, const char* child_name);
+
 typedef void*   (*SWIGPythonCastPyObjectToSBValue)  (void* data);
+
 typedef lldb::ValueObjectSP  (*SWIGPythonGetValueObjectSPFromSBValue)   (void* data);
+
 typedef bool(*SWIGPythonUpdateSynthProviderInstance)(void* data);
+
 typedef bool(*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
+
 typedef void*   (*SWIGPythonGetValueSynthProviderInstance)  (void *implementor);
 
 typedef bool

[Lldb-commits] [lldb] r250599 - Teach an old pony a few new tricks.

2015-10-16 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct 16 20:05:50 2015
New Revision: 250599

URL: http://llvm.org/viewvc/llvm-project?rev=250599=rev
Log:
Teach an old pony a few new tricks.

ValueObjectPrinter can now mask out pointer values during a printout; also, it 
supports helper functions to print declarations in different formats if needed

Practically speaking however, this change is NFC as nothing yet uses it in the 
codebase


Modified:
lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h?rev=250599=250598=250599=diff
==
--- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h Fri Oct 16 
20:05:50 2015
@@ -22,6 +22,8 @@
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/TypeSummary.h"
 
+#include 
+
 namespace lldb_private {
 
 struct DumpValueObjectOptions
@@ -54,6 +56,11 @@ struct DumpValueObjectOptions
ValueObject *valobj,
const std::string& summary);
 };
+
+typedef std::function DeclPrintingHelper;
 
 uint32_t m_max_depth = UINT32_MAX;
 lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
@@ -63,6 +70,7 @@ struct DumpValueObjectOptions
 std::string m_root_valobj_name;
 lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
 PointerDepth m_max_ptr_depth;
+DeclPrintingHelper m_decl_printing_helper;
 bool m_use_synthetic : 1;
 bool m_scope_already_checked : 1;
 bool m_flat_output : 1;
@@ -76,11 +84,13 @@ struct DumpValueObjectOptions
 bool m_run_validator : 1;
 bool m_use_type_display_name : 1;
 bool m_allow_oneliner_mode : 1;
+bool m_hide_pointer_value : 1;
 
 DumpValueObjectOptions() :
 m_summary_sp(),
 m_root_valobj_name(),
 m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default,0}),
+m_decl_printing_helper(),
 m_use_synthetic(true),
 m_scope_already_checked(false),
 m_flat_output(false),
@@ -93,7 +103,8 @@ struct DumpValueObjectOptions
 m_hide_value(false),
 m_run_validator(false),
 m_use_type_display_name(true),
-m_allow_oneliner_mode(true)
+m_allow_oneliner_mode(true),
+m_hide_pointer_value(false)
 {}
 
 static const DumpValueObjectOptions
@@ -123,6 +134,13 @@ struct DumpValueObjectOptions
 }
 
 DumpValueObjectOptions&
+SetDeclPrintingHelper(DeclPrintingHelper helper)
+{
+m_decl_printing_helper = helper;
+return *this;
+}
+
+DumpValueObjectOptions&
 SetShowTypes(bool show = false)
 {
 m_show_types = show;
@@ -254,6 +272,13 @@ struct DumpValueObjectOptions
 }
 
 DumpValueObjectOptions&
+SetHidePointerValue (bool hide = false)
+{
+m_hide_pointer_value = hide;
+return *this;
+}
+
+DumpValueObjectOptions&
 SetVariableFormatDisplayLanguage (lldb::LanguageType lang = 
lldb::eLanguageTypeUnknown)
 {
 m_varformat_language = lang;
@@ -354,11 +379,8 @@ protected:
 bool
 PrintLocationIfNeeded ();
 
-bool
-PrintTypeIfNeeded ();
-
-bool
-PrintNameIfNeeded (bool show_type);
+void
+PrintDecl ();
 
 bool
 CheckScopeIfNeeded ();

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=250599=250598=250599=diff
==
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Fri Oct 16 20:05:50 
2015
@@ -99,9 +99,7 @@ ValueObjectPrinter::PrintValueObject ()
 PrintLocationIfNeeded();
 m_stream->Indent();
 
-bool show_type = PrintTypeIfNeeded();
-
-PrintNameIfNeeded(show_type);
+PrintDecl();
 }
 
 bool value_printed = false;
@@ -253,8 +251,8 @@ ValueObjectPrinter::PrintLocationIfNeede
 return false;
 }
 
-bool
-ValueObjectPrinter::PrintTypeIfNeeded ()
+void
+ValueObjectPrinter::PrintDecl ()
 {
 bool show_type = true;
 // if we are at the root-level and been asked to hide the root's type, 
then hide it
@@ -264,44 +262,89 @@ ValueObjectPrinter::PrintTypeIfNeeded ()
 // otherwise decide according to the usual rules (asked to show types 
- always at the root level)
 show_type = options.m_show_types || (m_curr_depth == 0 && 

[Lldb-commits] [lldb] r250567 - Move TypeSummaryImpl over to LLVM-style RTTI for subclassing

2015-10-16 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct 16 17:51:56 2015
New Revision: 250567

URL: http://llvm.org/viewvc/llvm-project?rev=250567=rev
Log:
Move TypeSummaryImpl over to LLVM-style RTTI for subclassing


Modified:
lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
lldb/trunk/source/API/SBTypeSummary.cpp
lldb/trunk/source/DataFormatters/TypeSummary.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=250567=250566=250567=diff
==
--- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Fri Oct 16 17:51:56 
2015
@@ -61,6 +61,19 @@ namespace lldb_private {
 class TypeSummaryImpl
 {
 public:
+enum class Kind
+{
+eSummaryString,
+eScript,
+eCallback
+};
+
+Kind
+GetKind () const
+{
+return m_kind;
+}
+
 class Flags
 {
 public:
@@ -260,16 +273,6 @@ namespace lldb_private {
 uint32_t m_flags;
 };
 
-typedef enum Type
-{
-eTypeUnknown,
-eTypeString,
-eTypeScript,
-eTypeCallback
-} Type;
-
-TypeSummaryImpl (const TypeSummaryImpl::Flags& flags);
-
 bool
 Cascades () const
 {
@@ -397,12 +400,6 @@ namespace lldb_private {
 virtual std::string
 GetDescription () = 0;
 
-virtual bool
-IsScripted () = 0;
-
-virtual Type
-GetType () = 0;
-
 uint32_t&
 GetRevision ()
 {
@@ -417,7 +414,11 @@ namespace lldb_private {
 uint32_t m_my_revision;
 Flags m_flags;
 
+TypeSummaryImpl (Kind kind,
+ const TypeSummaryImpl::Flags& flags);
+
 private:
+Kind m_kind;
 DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
 };
 
@@ -452,16 +453,9 @@ namespace lldb_private {
 std::string
 GetDescription() override;
 
-bool
-IsScripted() override
-{
-return false;
-}
-
-Type
-GetType() override
+static bool classof(const TypeSummaryImpl* S)
 {
-return TypeSummaryImpl::eTypeString;
+return S->GetKind() == Kind::eSummaryString;
 }
 
 private:
@@ -523,16 +517,9 @@ namespace lldb_private {
 std::string
 GetDescription() override;
 
-bool
-IsScripted() override
-{
-return false;
-}
-
-Type
-GetType() override
+static bool classof(const TypeSummaryImpl* S)
 {
-return TypeSummaryImpl::eTypeCallback;
+return S->GetKind() == Kind::eCallback;
 }
 
 typedef std::shared_ptr SharedPointer;
@@ -595,16 +582,9 @@ namespace lldb_private {
 std::string
 GetDescription() override;
 
-bool
-IsScripted() override
-{
-return true;
-}
-
-Type
-GetType() override
+static bool classof(const TypeSummaryImpl* S)
 {
-return TypeSummaryImpl::eTypeScript;
+return S->GetKind() == Kind::eScript;
 }
 
 typedef std::shared_ptr SharedPointer;

Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=250567=250566=250567=diff
==
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Fri Oct 16 17:51:56 2015
@@ -12,6 +12,8 @@
 #include "lldb/API/SBValue.h"
 #include "lldb/DataFormatters/DataVisualization.h"
 
+#include "llvm/Support/Casting.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -164,9 +166,8 @@ SBTypeSummary::IsFunctionCode()
 {
 if (!IsValid())
 return false;
-if (m_opaque_sp->IsScripted())
+if (ScriptSummaryFormat* script_summary_ptr = 
llvm::dyn_cast(m_opaque_sp.get()))
 {
-ScriptSummaryFormat* script_summary_ptr = 
(ScriptSummaryFormat*)m_opaque_sp.get();
 const char* ftext = script_summary_ptr->GetPythonScript();
 return (ftext && *ftext != 0);
 }
@@ -178,9 +179,8 @@ SBTypeSummary::IsFunctionName()
 {
 if (!IsValid())
 return false;
-if (m_opaque_sp->IsScripted())
+if (ScriptSummaryFormat* script_summary_ptr = 
llvm::dyn_cast(m_opaque_sp.get()))
 {
-ScriptSummaryFormat* script_summary_ptr = 
(ScriptSummaryFormat*)m_opaque_sp.get();
 const char* ftext = 

Re: [Lldb-commits] [PATCH] D13830: [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes.

2015-10-16 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250593: [LLDB] Fix Clang-tidy modernize-use-override 
warnings in some headers in… (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D13830?vs=37634=37662#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13830

Files:
  lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h
  lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextDummy.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextHistory.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
  
lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h

Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
@@ -1,15 +1,19 @@
-//===-- RegisterContextPOSIX_powerpc.h ---*- C++ -*-===//
+//===-- RegisterContextPOSIX_powerpc.h --*- C++ -*-===//
 //
 // The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===--===//
 
-#ifndef liblldb_RegisterContextPOSIX_powerpc_H_
-#define liblldb_RegisterContextPOSIX_powerpc_H_
+#ifndef liblldb_RegisterContextPOSIX_powerpc_h_
+#define liblldb_RegisterContextPOSIX_powerpc_h_
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/Core/Log.h"
 #include "lldb/Target/RegisterContext.h"
 #include "RegisterInfoInterface.h"
@@ -149,16 +153,16 @@
 uint32_t concrete_frame_idx,
 lldb_private::RegisterInfoInterface *register_info);
 
-~RegisterContextPOSIX_powerpc();
+~RegisterContextPOSIX_powerpc() override;
 
 void
 Invalidate();
 
 void
-InvalidateAllRegisters();
+InvalidateAllRegisters() override;
 
 size_t
-GetRegisterCount();
+GetRegisterCount() override;
 
 virtual size_t
 GetGPRSize();
@@ -170,19 +174,19 @@
 GetRegisterOffset(unsigned reg);
 
 const lldb_private::RegisterInfo *
-GetRegisterInfoAtIndex(size_t reg);
+GetRegisterInfoAtIndex(size_t reg) override;
 
 size_t
-GetRegisterSetCount();
+GetRegisterSetCount() override;
 
 const lldb_private::RegisterSet *
-GetRegisterSet(size_t set);
+GetRegisterSet(size_t set) override;
 
 const char *
 GetRegisterName(unsigned reg);
 
 uint32_t
-ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num);
+ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override;
 
 protected:
 uint64_t m_gpr_powerpc[k_num_gpr_registers_powerpc]; // general purpose registers.
@@ -216,4 +220,4 @@
 virtual bool WriteVMX() = 0;
 };
 
-#endif // #ifndef liblldb_RegisterContextPOSIX_powerpc_H_
+#endif // liblldb_RegisterContextPOSIX_powerpc_h_
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
===
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h
@@ -1,15 +1,19 @@
-//===-- RegisterContextPOSIX_arm.h *- C++ -*-===//
+//===-- RegisterContextPOSIX_arm.h --*- C++ -*-===//
 //
 // The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===--===//
 
-#ifndef liblldb_RegisterContextPOSIX_arm_H_
-#define liblldb_RegisterContextPOSIX_arm_H_
+#ifndef liblldb_RegisterContextPOSIX_arm_h_
+#define 

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

2015-10-16 Thread Oleksiy Vyalov via lldb-commits
ovyalov added inline comments.


Comment at: source/Host/posix/DomainSocket.cpp:74
@@ +73,3 @@
+FileSystem::Unlink(FileSpec{name, true});
+
+Error error;

labath wrote:
> If we're going to use unique names, then this won't be necessary (and I would 
> much rather see a random error opening a socket than a random file 
> disappearing). BTW, have you considered using abstract sockets for the 
> lldb-server use case? Albeit linux-specific, I find them much nicer, as they 
> have no connection to the file system whatsoever.
I was thinking about using abstract sockets but didn't try them in runtime on 
Android - will check.



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] r250525 - Update SWIG typemaps to use `PythonFile`.

2015-10-16 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct 16 11:39:18 2015
New Revision: 250525

URL: http://llvm.org/viewvc/llvm-project?rev=250525=rev
Log:
Update SWIG typemaps to use `PythonFile`.

Using the Python native C API is non-portable across Python versions,
so this patch changes them to use the `PythonFile` class which hides
the version specific differences behind a single interface.

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

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=250525=250524=250525=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Fri Oct 16 11:39:18 2015
@@ -503,27 +503,31 @@
 %typemap(in) FILE * {
if ($input == Py_None)
   $1 = NULL;
-   else if (!PyFile_Check($input)) {
+   else if (!lldb_private::PythonFile::Check($input)) {
   int fd = PyObject_AsFileDescriptor($input);
-  PyObject *py_mode = PyObject_GetAttrString($input, "mode");
-  if (!py_mode) {
- PyErr_SetString(PyExc_TypeError,"not a file-like object");
- return NULL;
-  }
-  const char *mode = PyString_AsString(py_mode);
-  if (-1 != fd && mode) {
+  lldb_private::PythonString py_mode(lldb_private::PyRefType::Owned,
+ PyObject_GetAttrString($input, "mode"));
+
+  if (-1 != fd && py_mode.IsValid()) {
  FILE *f;
- if ((f = fdopen(fd, mode)))
+ if ((f = fdopen(fd, py_mode.GetString().str().c_str(
 $1 = f;
  else
 PyErr_SetString(PyExc_TypeError, strerror(errno));
   } else {
  PyErr_SetString(PyExc_TypeError,"not a file-like object");
- return NULL;
+ return nullptr;
   }
}
else
-  $1 = PyFile_AsFile($input);
+   {
+  lldb_private::File file;
+   lldb_private::PythonFile py_file(lldb_private::PyRefType::Borrowed, 
$input);
+   if (!py_file.GetUnderlyingFile(file))
+ return nullptr;
+
+  $1 = file.GetStream();
+   }
 }
 
 %typemap(out) FILE * {
@@ -539,7 +543,9 @@
else // if (flags & __SRW)
   mode[i++] = 'a';
 #endif
-   $result = PyFile_FromFile($1, const_cast(""), mode, fflush);
+   lldb_private::File file($1, false);
+   lldb_private::PythonFile py_file(file, mode);
+   $result = py_file.release();
 }
 
 %typemap(in) (const char* string, int len) {

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=250525=250524=250525=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
Fri Oct 16 11:39:18 2015
@@ -582,6 +582,14 @@ PythonFile::PythonFile(File , const
 Reset(file, mode);
 }
 
+PythonFile::PythonFile(const char *path, const char *mode)
+{
+FILE *fp = nullptr;
+fp = fopen(path, mode);
+lldb_private::File file(fp, true);
+Reset(file, mode);
+}
+
 PythonFile::PythonFile(PyRefType type, PyObject *o)
 {
 Reset(type, o);
@@ -651,4 +659,18 @@ PythonFile::Reset(File , const char
 #endif
 }
 
+bool
+PythonFile::GetUnderlyingFile(File ) const
+{
+if (!IsValid())
+return false;
+
+file.Close();
+// We don't own the file descriptor returned by this function, make sure 
the
+// File object knows about that.
+file.SetDescriptor(PyObject_AsFileDescriptor(m_py_obj), false);
+return file.IsValid();
+}
+
+
 #endif

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=250525=250524=250525=diff
==
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h 
(original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h Fri 
Oct 16 11:39:18 2015
@@ -323,7 +323,8 @@ public:
 class PythonFile : public PythonObject
 {
   public:
-explicit PythonFile(File , const char *mode);
+PythonFile(File , const char *mode);
+PythonFile(const char *path, const char *mode);
 PythonFile(PyRefType type, PyObject *o);
 ~PythonFile() override;
 
@@ -333,6 +334,8 @@ class PythonFile : public PythonObject
 
 void Reset(PyRefType type, PyObject *py_obj) override;
 void Reset(File , const char *mode);
+
+bool GetUnderlyingFile(File ) const;
 };
 
 } // namespace 

[Lldb-commits] [PATCH] D13819: LLDBStandalone: Report nice errors on missing vars

2015-10-16 Thread Ramkumar Ramachandra via lldb-commits
artagnon created this revision.
artagnon added reviewers: chaoren, brucem.
artagnon added a subscriber: lldb-commits.

http://reviews.llvm.org/D13819

Files:
  cmake/modules/LLDBStandalone.cmake

Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -23,22 +23,35 @@
 else()
   get_filename_component(LLVM_MAIN_SRC_DIR ${LLDB_PATH_TO_LLVM_SOURCE}
  ABSOLUTE)
+  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
   list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
 endif()
   endif()
 
   if (LLDB_PATH_TO_CLANG_SOURCE)
   get_filename_component(CLANG_MAIN_SRC_DIR ${LLDB_PATH_TO_CLANG_SOURCE}
  ABSOLUTE)
+  set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include")
   endif()
 
   list(APPEND CMAKE_MODULE_PATH "${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake")
 
-  get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD}
- ABSOLUTE)
+  if (LLDB_PATH_TO_LLVM_BUILD)
+get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD}
+   ABSOLUTE)
+  else()
+message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_BUILD to the root "
+"directory of LLVM build or install site.")
+  endif()
+
+  if (LLDB_PATH_TO_CLANG_BUILD)
+get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD}
+   ABSOLUTE)
+  else()
+message(FATAL_ERROR "Please set LLDB_PATH_TO_CLANG_BUILD to the root "
+"directory of Clang build or install site.")
+  endif()
 
-  get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD}
- ABSOLUTE)
 
   # These variables are used by add_llvm_library.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
@@ -67,11 +80,8 @@
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
   set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
 
-  set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include")
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
   include_directories("${PATH_TO_LLVM_BUILD}/include"
   "${LLVM_MAIN_INCLUDE_DIR}"


Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -23,22 +23,35 @@
 else()
   get_filename_component(LLVM_MAIN_SRC_DIR ${LLDB_PATH_TO_LLVM_SOURCE}
  ABSOLUTE)
+  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
   list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
 endif()
   endif()
 
   if (LLDB_PATH_TO_CLANG_SOURCE)
   get_filename_component(CLANG_MAIN_SRC_DIR ${LLDB_PATH_TO_CLANG_SOURCE}
  ABSOLUTE)
+  set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include")
   endif()
 
   list(APPEND CMAKE_MODULE_PATH "${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake")
 
-  get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD}
- ABSOLUTE)
+  if (LLDB_PATH_TO_LLVM_BUILD)
+get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD}
+   ABSOLUTE)
+  else()
+message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_BUILD to the root "
+"directory of LLVM build or install site.")
+  endif()
+
+  if (LLDB_PATH_TO_CLANG_BUILD)
+get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD}
+   ABSOLUTE)
+  else()
+message(FATAL_ERROR "Please set LLDB_PATH_TO_CLANG_BUILD to the root "
+"directory of Clang build or install site.")
+  endif()
 
-  get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD}
- ABSOLUTE)
 
   # These variables are used by add_llvm_library.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
@@ -67,11 +80,8 @@
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
   set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
 
-  set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include")
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
   include_directories("${PATH_TO_LLVM_BUILD}/include"
   "${LLVM_MAIN_INCLUDE_DIR}"
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits