Re: [Lldb-commits] [lldb] r283351 - Try to fix Android build.

2016-10-05 Thread Enrico Granata via lldb-commits
Alright, I'll bite and ask...

What is so special about the Android bot? Every so often, I'll see it reject a 
piece of syntax that other compilers gleefully handle

> On Oct 5, 2016, at 10:58 AM, Zachary Turner via lldb-commits 
>  wrote:
> 
> Author: zturner
> Date: Wed Oct  5 12:58:46 2016
> New Revision: 283351
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=283351&view=rev
> Log:
> Try to fix Android build.
> 
> Seems it doesn't like the implicit conversion from
> StringRef[] to ArrayRef.
> 
> Modified:
>lldb/trunk/source/Breakpoint/BreakpointID.cpp
> 
> Modified: lldb/trunk/source/Breakpoint/BreakpointID.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointID.cpp?rev=283351&r1=283350&r2=283351&view=diff
> ==
> --- lldb/trunk/source/Breakpoint/BreakpointID.cpp (original)
> +++ lldb/trunk/source/Breakpoint/BreakpointID.cpp Wed Oct  5 12:58:46 2016
> @@ -48,7 +48,7 @@ bool BreakpointID::IsValidIDExpression(l
> }
> 
> llvm::ArrayRef BreakpointID::GetRangeSpecifiers() {
> -  return g_range_specifiers;
> +  return llvm::makeArrayRef(g_range_specifiers);
> }
> 
> void BreakpointID::GetDescription(Stream *s, lldb::DescriptionLevel level) {
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Thanks,
- Enrico
šŸ“© egranata@.com ā˜Žļø 27683

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


[Lldb-commits] [lldb] r283396 - Fixes for libc++ std::unordered_map data formatter against trunk

2016-10-05 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct  5 17:04:43 2016
New Revision: 283396

URL: http://llvm.org/viewvc/llvm-project?rev=283396&view=rev
Log:
Fixes for libc++ std::unordered_map data formatter against trunk

Fixes rdar://28237467


Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp?rev=283396&r1=283395&r2=283396&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp Wed Oct 
 5 17:04:43 2016
@@ -47,6 +47,8 @@ public:
   size_t GetIndexOfChildWithName(const ConstString &name) override;
 
 private:
+  CompilerType m_element_type;
+  CompilerType m_node_type;
   ValueObject *m_tree;
   size_t m_num_elements;
   ValueObject *m_next_element;
@@ -57,8 +59,8 @@ private:
 
 lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
 LibcxxStdUnorderedMapSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
-: SyntheticChildrenFrontEnd(*valobj_sp), m_tree(nullptr), 
m_num_elements(0),
-  m_next_element(nullptr), m_elements_cache() {
+: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type(), m_tree(nullptr),
+  m_num_elements(0), m_next_element(nullptr), m_elements_cache() {
   if (valobj_sp)
 Update();
 }
@@ -90,8 +92,32 @@ lldb::ValueObjectSP lldb_private::format
 node_sp->GetChildMemberWithName(ConstString("__value_"), true);
 ValueObjectSP hash_sp =
 node_sp->GetChildMemberWithName(ConstString("__hash_"), true);
-if (!hash_sp || !value_sp)
-  return lldb::ValueObjectSP();
+if (!hash_sp || !value_sp) {
+  if (!m_element_type) {
+auto first_sp = m_backend.GetChildAtNamePath({ConstString("__table_"),
+  ConstString("__p1_"),
+  
ConstString("__first_")});
+if (!first_sp)
+  return nullptr;
+m_element_type = first_sp->GetCompilerType();
+lldb::TemplateArgumentKind kind;
+m_element_type = m_element_type.GetTemplateArgument(0, kind);
+m_element_type = m_element_type.GetPointeeType();
+m_node_type = m_element_type;
+m_element_type = m_element_type.GetTemplateArgument(0, kind);
+std::string name;
+m_element_type =
+m_element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
+m_element_type = m_element_type.GetTypedefedType();
+  }
+  if (!m_node_type)
+return nullptr;
+  node_sp = node_sp->Cast(m_node_type);
+  value_sp = node_sp->GetChildMemberWithName(ConstString("__value_"), 
true);
+  hash_sp = node_sp->GetChildMemberWithName(ConstString("__hash_"), true);
+  if (!value_sp || !hash_sp)
+return nullptr;
+}
 m_elements_cache.push_back(
 {value_sp.get(), hash_sp->GetValueAsUnsigned(0)});
 m_next_element =


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


[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-19 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

I see you already got a bunch of feedback on specific items. The overall idea 
looks good to me. I'll try to delve a little deeper in the code ASAP (I was out 
for a couple days and have some backlog...), but should be good to go assuming 
you address the feedback you already got + make sure tests work!


https://reviews.llvm.org/D25734



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


[Lldb-commits] [PATCH] D25726: Improve the libstdc++ smart pointer formatters

2016-10-19 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

I see you already got a bunch of feedback on specific items. The overall idea 
looks good to me. I'll try to delve a little deeper in the code ASAP (I was out 
for a couple days and have some backlog...), but should be good to go assuming 
you address the feedback you already got + make sure tests work!


https://reviews.llvm.org/D25726



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


[Lldb-commits] [lldb] r284787 - This debugging message has been left in the code for years, until one day it randomly hit on some corrupted memory

2016-10-20 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 20 17:05:21 2016
New Revision: 284787

URL: http://llvm.org/viewvc/llvm-project?rev=284787&view=rev
Log:
This debugging message has been left in the code for years, until one day it 
randomly hit on some corrupted memory

It is misleading to users in its current form, and only interesting to me - 
remove it

rdar://28812568


Modified:
lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp?rev=284787&r1=284786&r2=284787&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp Thu Oct 20 17:05:21 
2016
@@ -212,8 +212,7 @@ bool lldb_private::formatters::NSStringS
 uint64_t location = valobj_addr + 2 * ptr_size;
 if (is_inline) {
   if (!has_explicit_length) {
-stream.Printf("found new combo");
-return true;
+return false;
   } else
 location += ptr_size;
 } else {


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


[Lldb-commits] [lldb] r284788 - frame.script became script.frame a while ago; fix up the docs

2016-10-20 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 20 17:10:07 2016
New Revision: 284788

URL: http://llvm.org/viewvc/llvm-project?rev=284788&view=rev
Log:
frame.script became script.frame a while ago; fix up the docs

Modified:
lldb/trunk/www/formats.html

Modified: lldb/trunk/www/formats.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/formats.html?rev=284788&r1=284787&r2=284788&view=diff
==
--- lldb/trunk/www/formats.html (original)
+++ lldb/trunk/www/formats.html Thu Oct 20 17:10:07 2016
@@ -107,10 +107,10 @@
 thread.return-valueThe 
return value of the latest step operation (currently only for 
step-out.)
 thread.completed-expressionThe expression result 
for a thread that just finished an interrupted expression evaluation.
 target.archThe 
architecture of the current target
-target.script:python_funcUse a Python 
function to generate a piece of textual output
-process.script:python_funcUse a Python 
function to generate a piece of textual output
-thread.script:python_funcUse a Python 
function to generate a piece of textual output
-frame.script:python_funcUse a Python 
function to generate a piece of textual output
+script.target:python_funcUse a Python 
function to generate a piece of textual output
+script.process:python_funcUse a Python 
function to generate a piece of textual output
+script.thread:python_funcUse a Python 
function to generate a piece of textual output
+script.frame:python_funcUse a Python 
function to generate a piece of textual output
 current-pc-arrowPrints 
either '-> ' or '   ' if the current pc value is matched 
(used in disassembly-format)
 addr-file-or-loadFormats an address either as a 
load address, or if process has not yet been launched, as a load address (used 
in disassembly-format)
 


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


[Lldb-commits] [lldb] r284847 - I hadn't fixed all the instances of the old marker for scripted format strings; do so now

2016-10-21 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct 21 13:03:55 2016
New Revision: 284847

URL: http://llvm.org/viewvc/llvm-project?rev=284847&view=rev
Log:
I hadn't fixed all the instances of the old marker for scripted format strings; 
do so now


Modified:
lldb/trunk/www/formats.html

Modified: lldb/trunk/www/formats.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/formats.html?rev=284847&r1=284846&r2=284847&view=diff
==
--- lldb/trunk/www/formats.html (original)
+++ lldb/trunk/www/formats.html Fri Oct 21 13:03:55 2016
@@ -260,8 +260,8 @@
 that when the thread information is displayed in a 
context where
 we only want to show thread information, we can do so.
 
-   For both thread and frame formats, 
you can use ${target.script:python_func}, 
${process.script:python_func} and ${thread.script:python_func}
-   (and of course 
${frame.script:python_func} for frame formats)
+   For both thread and frame formats, 
you can use ${script.target:python_func}, 
${script.process:python_func} and ${script.thread:python_func}
+   (and of course 
${script.frame:python_func} for frame formats)
In all cases, the signature of 
python_func is expected to be:

def 
python_func(object,unused):
@@ -273,7 +273,7 @@
def thread_printer_func 
(thread,unused):
Ā Ā return "Thread %s 
has %d frames\n" % (thread.name, thread.num_frames)

-   And you set it up with 
(lldb) settings set thread-format 
"${thread.script:thread_printer_func}"
+   And you set it up with 
(lldb) settings set thread-format 
"${script.thread:thread_printer_func}"
you would see output like:

* Thread main has 21 
frames


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


[Lldb-commits] [lldb] r285216 - Actually use = delete to mark constructors and operators we want to not exist. Just declaring them as private works, but it can confuse certain tools as it doesn't actu

2016-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 26 13:12:52 2016
New Revision: 285216

URL: http://llvm.org/viewvc/llvm-project?rev=285216&view=rev
Log:
Actually use = delete to mark constructors and operators we want to not exist. 
Just declaring them as private works, but it can confuse certain tools as it 
doesn't actually declare intent, and the C++11 way is more expressive anyway, 
so this is pure win

rdar://28960209


Modified:
lldb/trunk/include/lldb/lldb-defines.h

Modified: lldb/trunk/include/lldb/lldb-defines.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-defines.h?rev=285216&r1=285215&r2=285216&view=diff
==
--- lldb/trunk/include/lldb/lldb-defines.h (original)
+++ lldb/trunk/include/lldb/lldb-defines.h Wed Oct 26 13:12:52 2016
@@ -157,8 +157,8 @@
 /// assignment operators in C++ classes.
 //--
 #define DISALLOW_COPY_AND_ASSIGN(TypeName) 
\
-  TypeName(const TypeName &);  
\
-  const TypeName &operator=(const TypeName &)
+  TypeName(const TypeName &) = delete; 
\
+  const TypeName &operator=(const TypeName &) = delete
 
 #endif // #if defined(__cplusplus)
 


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


[Lldb-commits] [lldb] r285226 - Fix an issue where frame variable -s would not show the scope even though the user asked for it

2016-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 26 14:17:49 2016
New Revision: 285226

URL: http://llvm.org/viewvc/llvm-project?rev=285226&view=rev
Log:
Fix an issue where frame variable -s  would not show the scope even 
though the user asked for it

Part of rdar://28434047


Added:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c
Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
lldb/trunk/source/Commands/CommandObjectFrame.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile?rev=285226&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile
 Wed Oct 26 14:17:49 2016
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py?rev=285226&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py
 Wed Oct 26 14:17:49 2016
@@ -0,0 +1,5 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(
+__file__, globals(), [])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c?rev=285226&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c
 Wed Oct 26 14:17:49 2016
@@ -0,0 +1,21 @@
+//===-- main.c --*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+int foo(int x, int y) {
+int z = 3 + x;
+return z + y; //% self.expect("frame variable -s", substrs=['ARG: (int) x 
= -3','ARG: (int) y = 0'])
+ //% self.expect("frame variable -s x", substrs=['ARG: (int) x = -3'])
+ //% self.expect("frame variable -s y", substrs=['ARG: (int) y = 0'])
+ //% self.expect("frame variable -s z", substrs=['LOCAL: (int) z = 0'])
+}
+
+int main (int argc, char const *argv[])
+{
+return foo(-3,0);  //% self.expect("frame variable -s argc argv", 
substrs=['ARG: (int) argc ='])
+}

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py?rev=285226&r1=285225&r2=285226&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
 Wed Oct 26 14:17:49 2016
@@ -55,9 +55,9 @@ class UnsignedTypesTestCase(TestBase):
 self.expect(
 "frame variable --show-types --no-args",
 VARIABLES_DISPLAYED_CORRECTLY,
-startstr="(unsigned char) the_unsigned_char = 'c'",
 patterns=["\((short unsigned int|unsigned short)\) 
the_unsigned_short = 99"],
 substrs=[
+"(unsigned char) the_unsigned_char = 'c'",
 "(unsigned int) the_unsigned_int = 99",
 "(unsigned long) the_unsigned_long = 99",
 "(unsigned long long) the_unsigned_long_long = 99",

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=285226&r1=285225&r2=285226&view=diff
=

[Lldb-commits] [lldb] r285332 - Add support for "type lookup" to find C and C++ types

2016-10-27 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 27 13:44:45 2016
New Revision: 285332

URL: http://llvm.org/viewvc/llvm-project?rev=285332&view=rev
Log:
Add support for "type lookup" to find C and C++ types

This is an important first step in closing the functionality gap between "type 
lookup" and "images lookup -t"

rdar://28971388


Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
  - copied, changed from r285331, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m
Removed:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile?rev=285332&r1=285331&r2=285332&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile 
Thu Oct 27 13:44:45 2016
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-OBJC_SOURCES := main.m
+OBJCXX_SOURCES := main.mm
 
 CFLAGS_EXTRAS += -w
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py?rev=285332&r1=285331&r2=285332&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
 Thu Oct 27 13:44:45 2016
@@ -22,7 +22,7 @@ class TypeLookupTestCase(TestBase):
 # Call super's setUp().
 TestBase.setUp(self)
 # Find the line number to break at.
-self.line = line_number('main.m', '// break here')
+self.line = line_number('main.mm', '// break here')
 
 @skipUnlessDarwin
 @skipIf(archs=['i386'])
@@ -32,7 +32,7 @@ class TypeLookupTestCase(TestBase):
 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
 lldbutil.run_break_set_by_file_and_line(
-self, "main.m", self.line, num_expected_locations=1, 
loc_exact=True)
+self, "main.mm", self.line, num_expected_locations=1, 
loc_exact=True)
 
 self.runCmd("run", RUN_SUCCEEDED)
 
@@ -50,3 +50,5 @@ class TypeLookupTestCase(TestBase):
 self.expect('type lookup NSObject', substrs=['NSObject', 'isa'])
 self.expect('type lookup PleaseDontBeARealTypeThatExists', substrs=[
 "no type was found matching 
'PleaseDontBeARealTypeThatExists'"])
+self.expect('type lookup MyCPPClass', substrs=['setF', 'float getF'])
+self.expect('type lookup MyClass', substrs=['setF', 'float getF'])

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m?rev=285331&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m 
(removed)
@@ -1,16 +0,0 @@
-//===-- main.m *- ObjC -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#import 
-
-int main (int argc, const char * argv[])
-{
-  return 0; // break here
-}
-

Copied: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm 
(from r285331, 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm?p2=lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm&p1=lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m&r1=285331&r2=285332&rev=285332&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m 
(original)
+++ 
lldb/trunk/packages/Python/lldbsui

[Lldb-commits] [lldb] r285596 - Add the new minidump plugin files to the Xcode project

2016-10-31 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 31 12:00:54 2016
New Revision: 285596

URL: http://llvm.org/viewvc/llvm-project?rev=285596&view=rev
Log:
Add the new minidump plugin files to the Xcode project


Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=285596&r1=285595&r2=285596&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Oct 31 12:00:54 2016
@@ -835,6 +835,9 @@
9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9475C18D14E5F834001BFC6D /* 
SBTypeNameSpecifier.cpp */; };
9475C18F14E5F858001BFC6D /* SBTypeNameSpecifier.h in Headers */ 
= {isa = PBXBuildFile; fileRef = 9475C18C14E5F826001BFC6D /* 
SBTypeNameSpecifier.h */; settings = {ATTRIBUTES = (Public, ); }; };
947A1D641616476B0017C8D1 /* CommandObjectPlugin.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 947A1D621616476A0017C8D1 /* 
CommandObjectPlugin.cpp */; };
+   947CF7711DC7B1EE00EF980B /* ProcessMinidump.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 947CF7701DC7B1EE00EF980B /* ProcessMinidump.cpp 
*/; };
+   947CF7761DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = 947CF7741DC7B20D00EF980B /* 
RegisterContextMinidump_x86_32.cpp */; };
+   947CF7771DC7B20D00EF980B /* ThreadMinidump.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp 
*/; };
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* 
ValueObjectConstResultImpl.cpp */; };
949EEDA01BA74B6D008C63CF /* CoreMedia.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 949EED9E1BA74B64008C63CF /* CoreMedia.cpp */; };
949EEDA31BA76577008C63CF /* Cocoa.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 949EEDA11BA76571008C63CF /* Cocoa.cpp */; };
@@ -2736,6 +2739,12 @@
9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBTypeNameSpecifier.cpp; path = source/API/SBTypeNameSpecifier.cpp; 
sourceTree = ""; };
947A1D621616476A0017C8D1 /* CommandObjectPlugin.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = CommandObjectPlugin.cpp; path = source/Commands/CommandObjectPlugin.cpp; 
sourceTree = ""; };
947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CommandObjectPlugin.h; path = source/Commands/CommandObjectPlugin.h; sourceTree 
= ""; };
+   947CF76F1DC7B1E300EF980B /* ProcessMinidump.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProcessMinidump.h; 
sourceTree = ""; };
+   947CF7701DC7B1EE00EF980B /* ProcessMinidump.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ProcessMinidump.cpp; sourceTree = ""; };
+   947CF7721DC7B20300EF980B /* RegisterContextMinidump_x86_32.h */ 
= {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
RegisterContextMinidump_x86_32.h; sourceTree = ""; };
+   947CF7731DC7B20300EF980B /* ThreadMinidump.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreadMinidump.h; 
sourceTree = ""; };
+   947CF7741DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RegisterContextMinidump_x86_32.cpp; sourceTree = 
""; };
+   947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ThreadMinidump.cpp; sourceTree = ""; };
9481FE6B1B5F2D9200DED357 /* Either.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Either.h; path = 
include/lldb/Utility/Either.h; sourceTree = ""; };
949ADF001406F62E004833E1 /* ValueObjectConstResultImpl.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
ValueObjectConstResultImpl.h; path = 
include/lldb/Core/ValueObjectConstResultImpl.h; sourceTree = ""; };
949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = 
source/Core/ValueObjectConstResultImpl.cpp; sourceTree = ""; };
@@ -3551,6 +3560,12 @@
23

[Lldb-commits] [lldb] r285599 - Remove a couple of old TODOs and don't make a new ConstString each time; none of this is super-critical since it applies to older versions of macOS (or OSX, I guess?) b

2016-10-31 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 31 12:12:16 2016
New Revision: 285599

URL: http://llvm.org/viewvc/llvm-project?rev=285599&view=rev
Log:
Remove a couple of old TODOs and don't make a new ConstString each time; none 
of this is super-critical since it applies to older versions of macOS (or OSX, 
I guess?) but still..


Modified:

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=285599&r1=285598&r2=285599&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 Mon Oct 31 12:12:16 2016
@@ -1911,8 +1911,6 @@ void AppleObjCRuntimeV2::WarnIfNoClasses
   }
 }
 
-// TODO: should we have a transparent_kvo parameter here to say if we
-// want to replace the KVO swizzled class with the actual user-level type?
 ConstString
 AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa) {
   if (isa == g_objc_Tagged_ISA) {
@@ -2166,23 +2164,28 @@ AppleObjCRuntimeV2::TaggedPointerVendorL
   uint64_t class_bits = (ptr & 0xE) >> 1;
   ConstString name;
 
-  // TODO: make a table
+  static ConstString g_NSAtom("NSAtom");
+  static ConstString g_NSNumber("NSNumber");
+  static ConstString g_NSDateTS("NSDateTS");
+  static ConstString g_NSManagedObject("NSManagedObject");
+  static ConstString g_NSDate("NSDate");
+
   if (foundation_version >= 900) {
 switch (class_bits) {
 case 0:
-  name = ConstString("NSAtom");
+  name = g_NSAtom;
   break;
 case 3:
-  name = ConstString("NSNumber");
+  name = g_NSNumber;
   break;
 case 4:
-  name = ConstString("NSDateTS");
+  name = g_NSDateTS;
   break;
 case 5:
-  name = ConstString("NSManagedObject");
+  name = g_NSManagedObject;
   break;
 case 6:
-  name = ConstString("NSDate");
+  name = g_NSDate;
   break;
 default:
   return ObjCLanguageRuntime::ClassDescriptorSP();
@@ -2190,16 +2193,16 @@ AppleObjCRuntimeV2::TaggedPointerVendorL
   } else {
 switch (class_bits) {
 case 1:
-  name = ConstString("NSNumber");
+  name = g_NSNumber;
   break;
 case 5:
-  name = ConstString("NSManagedObject");
+  name = g_NSManagedObject;
   break;
 case 6:
-  name = ConstString("NSDate");
+  name = g_NSDate;
   break;
 case 7:
-  name = ConstString("NSDateTS");
+  name = g_NSDateTS;
   break;
 default:
   return ObjCLanguageRuntime::ClassDescriptorSP();


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


[Lldb-commits] [lldb] r285727 - Implement a general type scavenger that can dig types from debug info + a filtering mechanism to accept/reject results thusly obtained

2016-11-01 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Nov  1 13:50:49 2016
New Revision: 285727

URL: http://llvm.org/viewvc/llvm-project?rev=285727&view=rev
Log:
Implement a general type scavenger that can dig types from debug info + a 
filtering mechanism to accept/reject results thusly obtained

Implement the C++ type lookup support in terms of this general scavenger

The idea is that we may want other languages to do debug info based search 
(exclusively, or as an add-on to runtime/module based searching) and it makes 
sense to avoid duplicating this functionality


Modified:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Target/Language.cpp

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=285727&r1=285726&r2=285727&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Tue Nov  1 13:50:49 2016
@@ -57,6 +57,44 @@ public:
ResultSet &results) = 0;
   };
 
+  class ImageListTypeScavenger : public TypeScavenger {
+class Result : public Language::TypeScavenger::Result {
+public:
+  Result(CompilerType type)
+  : Language::TypeScavenger::Result(), m_compiler_type(type) {}
+
+  bool IsValid() override { return m_compiler_type.IsValid(); }
+
+  bool DumpToStream(Stream &stream, bool print_help_if_available) override 
{
+if (IsValid()) {
+  m_compiler_type.DumpTypeDescription(&stream);
+  stream.EOL();
+  return true;
+}
+return false;
+  }
+
+  ~Result() override = default;
+
+private:
+  CompilerType m_compiler_type;
+};
+
+  protected:
+ImageListTypeScavenger() = default;
+
+~ImageListTypeScavenger() override = default;
+
+// is this type something we should accept? it's usually going to be a
+// filter by language + maybe some sugar tweaking
+// returning an empty type means rejecting this candidate entirely;
+// any other result will be accepted as a valid match
+virtual CompilerType AdjustForInclusion(CompilerType &candidate) = 0;
+
+bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+   ResultSet &results) override;
+  };
+
   enum class FunctionNameRepresentation {
 eName,
 eNameWithArgs,

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp?rev=285727&r1=285726&r2=285727&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Tue Nov  
1 13:50:49 2016
@@ -28,9 +28,6 @@
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/DataFormatters/VectorType.h"
-#include "lldb/Symbol/SymbolFile.h"
-#include "lldb/Symbol/TypeList.h"
-#include "lldb/Target/Target.h"
 
 #include "BlockPointer.h"
 #include "CxxStringTypes.h"
@@ -922,73 +919,17 @@ static void LoadSystemFormatters(lldb::T
 }
 
 std::unique_ptr CPlusPlusLanguage::GetTypeScavenger() 
{
-  class CPlusPlusTypeScavenger : public Language::TypeScavenger {
-  private:
-class CPlusPlusTypeScavengerResult : public 
Language::TypeScavenger::Result {
-public:
-  CPlusPlusTypeScavengerResult(CompilerType type)
-  : Language::TypeScavenger::Result(), m_compiler_type(type) {}
-  
-  bool IsValid() override { return m_compiler_type.IsValid(); }
-  
-  bool DumpToStream(Stream &stream, bool print_help_if_available) override 
{
-if (IsValid()) {
-  m_compiler_type.DumpTypeDescription(&stream);
-  stream.EOL();
-  return true;
-}
-return false;
-  }
-  
-  ~CPlusPlusTypeScavengerResult() override = default;
-  
-private:
-  CompilerType m_compiler_type;
-};
-
-  protected:
-CPlusPlusTypeScavenger() = default;
-
-~CPlusPlusTypeScavenger() override = default;
-
-bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
-   ResultSet &results) override {
-  bool result = false;
-  
-  Target *target = exe_scope->CalculateTarget().get();
-  if (target) {
-const auto &images(target->GetImages());
-SymbolContext null_sc;
-ConstString cs_key(key);
-llvm::DenseSet searched_sym_files;
-TypeList matches;
-images.FindTypes(null_sc,
- cs_key,
- false,
- UINT32_MAX,
- searched_sym_files,
- mat

[Lldb-commits] [lldb] r285736 - Add helpers for the notion of a type scavenger that is "either this or that" source, and one that is "both this and that" source

2016-11-01 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Nov  1 15:17:14 2016
New Revision: 285736

URL: http://llvm.org/viewvc/llvm-project?rev=285736&view=rev
Log:
Add helpers for the notion of a type scavenger that is "either this or that" 
source, and one that is "both this and that" source

Use the helper to rewrite the ObjC type lookup logic (first modules, then 
runtime) in terms of an either scavenger


Modified:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=285736&r1=285735&r2=285736&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Tue Nov  1 15:17:14 2016
@@ -95,6 +95,34 @@ public:
ResultSet &results) override;
   };
 
+  template 
+  class EitherTypeScavenger : public TypeScavenger {
+bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+   ResultSet &results) override {
+  const bool append = false;
+  auto ts1 = TypeScavenger1();
+  if (ts1.Find(exe_scope, key, results, append))
+return true;
+  auto ts2 = TypeScavenger2();
+  if (ts2.Find(exe_scope, key, results, append))
+return true;
+  return false;
+}
+  };
+
+  template 
+  class BothTypeScavenger : public TypeScavenger {
+bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+   ResultSet &results) override {
+  const bool append = true;
+  auto ts1 = TypeScavenger1();
+  bool success = ts1.Find(exe_scope, key, results, append);
+  auto ts2 = TypeScavenger2();
+  success = ts2.Find(exe_scope, key, results, append) || success;
+  return success;
+}
+  };
+
   enum class FunctionNameRepresentation {
 eName,
 eNameWithArgs,

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp?rev=285736&r1=285735&r2=285736&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Tue Nov  1 
15:17:14 2016
@@ -906,35 +906,65 @@ ObjCLanguage::GetPossibleFormattersMatch
 }
 
 std::unique_ptr ObjCLanguage::GetTypeScavenger() {
-  class ObjCTypeScavenger : public Language::TypeScavenger {
+  class ObjCScavengerResult : public Language::TypeScavenger::Result {
+  public:
+ObjCScavengerResult(CompilerType type)
+: Language::TypeScavenger::Result(), m_compiler_type(type) {}
+
+bool IsValid() override { return m_compiler_type.IsValid(); }
+
+bool DumpToStream(Stream &stream, bool print_help_if_available) override {
+  if (IsValid()) {
+m_compiler_type.DumpTypeDescription(&stream);
+stream.EOL();
+return true;
+  }
+  return false;
+}
+
   private:
-class ObjCScavengerResult : public Language::TypeScavenger::Result {
-public:
-  ObjCScavengerResult(CompilerType type)
-  : Language::TypeScavenger::Result(), m_compiler_type(type) {}
-
-  bool IsValid() override { return m_compiler_type.IsValid(); }
-
-  bool DumpToStream(Stream &stream, bool print_help_if_available) override 
{
-if (IsValid()) {
-  m_compiler_type.DumpTypeDescription(&stream);
-  stream.EOL();
-  return true;
+CompilerType m_compiler_type;
+  };
+
+  class ObjCRuntimeScavenger : public Language::TypeScavenger {
+  protected:
+bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+   ResultSet &results) override {
+  bool result = false;
+
+  Process *process = exe_scope->CalculateProcess().get();
+  if (process) {
+const bool create_on_demand = false;
+auto objc_runtime = process->GetObjCLanguageRuntime(create_on_demand);
+if (objc_runtime) {
+  auto decl_vendor = objc_runtime->GetDeclVendor();
+  if (decl_vendor) {
+std::vector decls;
+ConstString name(key);
+decl_vendor->FindDecls(name, true, UINT32_MAX, decls);
+for (auto decl : decls) {
+  if (decl) {
+if (CompilerType candidate =
+ClangASTContext::GetTypeForDecl(decl)) {
+  result = true;
+  std::unique_ptr result(
+  new ObjCScavengerResult(candidate));
+  results.insert(std::move(result));
+}
+  }
+}
+  }
 }
-return false;
   }
 
-  ~ObjCScavengerResult() override = default;
+  return result;
+}
 
-private:
-  CompilerType m_compiler_type;
-};

[Lldb-commits] [lldb] r285941 - Add support to the ObjC type scavenger for finding types via debug info

2016-11-03 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Nov  3 12:25:27 2016
New Revision: 285941

URL: http://llvm.org/viewvc/llvm-project?rev=285941&view=rev
Log:
Add support to the ObjC type scavenger for finding types via debug info


Modified:
lldb/trunk/include/lldb/Target/Language.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=285941&r1=285940&r2=285941&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Thu Nov  3 12:25:27 2016
@@ -95,32 +95,51 @@ public:
ResultSet &results) override;
   };
 
-  template 
+  template 
   class EitherTypeScavenger : public TypeScavenger {
+  public:
+EitherTypeScavenger() : TypeScavenger(), m_scavengers() {
+  for (std::shared_ptr scavenger : { 
std::shared_ptr(new ScavengerTypes())... }) {
+if (scavenger)
+  m_scavengers.push_back(scavenger);
+  }
+}
+  protected:
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
   const bool append = false;
-  auto ts1 = TypeScavenger1();
-  if (ts1.Find(exe_scope, key, results, append))
-return true;
-  auto ts2 = TypeScavenger2();
-  if (ts2.Find(exe_scope, key, results, append))
-return true;
+  for (auto& scavenger : m_scavengers) {
+if (scavenger && scavenger->Find(exe_scope, key, results, append))
+  return true;
+  }
   return false;
 }
+  private:
+std::vector> m_scavengers;
   };
 
-  template 
-  class BothTypeScavenger : public TypeScavenger {
+  template 
+  class UnionTypeScavenger : public TypeScavenger {
+  public:
+UnionTypeScavenger() : TypeScavenger(), m_scavengers() {
+  for (std::shared_ptr scavenger : { 
std::shared_ptr(new ScavengerTypes())... }) {
+if (scavenger)
+  m_scavengers.push_back(scavenger);
+  }
+}
+  protected:
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
   const bool append = true;
-  auto ts1 = TypeScavenger1();
-  bool success = ts1.Find(exe_scope, key, results, append);
-  auto ts2 = TypeScavenger2();
-  success = ts2.Find(exe_scope, key, results, append) || success;
+  bool success = false;
+  for (auto& scavenger : m_scavengers) {
+if (scavenger)
+  success = scavenger->Find(exe_scope, key, results, append) || 
success;
+  }
   return success;
 }
+  private:
+std::vector> m_scavengers;
   };
 
   enum class FunctionNameRepresentation {

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py?rev=285941&r1=285940&r2=285941&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
 Thu Nov  3 12:25:27 2016
@@ -52,3 +52,4 @@ class TypeLookupTestCase(TestBase):
 "no type was found matching 
'PleaseDontBeARealTypeThatExists'"])
 self.expect('type lookup MyCPPClass', substrs=['setF', 'float getF'])
 self.expect('type lookup MyClass', substrs=['setF', 'float getF'])
+self.expect('type lookup MyObjCClass', substrs=['@interface 
MyObjCClass', 'int x', 'int y'])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm?rev=285941&r1=285940&r2=285941&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm 
Thu Nov  3 12:25:27 2016
@@ -28,6 +28,28 @@ private:
 
 typedef MyCPPClass MyClass;
 
+@interface MyObjCClass : NSObject {
+  int x;
+}
+- (id)init;
+- (int)read;
+@end
+
+@implementation MyObjCClass {
+  int y;
+}
+- (id)init {
+  if (self = [super init]) {
+self->x = 12;
+self->y = 24;
+  }
+  return self;
+}
+- (int)read {
+  return self->x + self->y;
+}
+@end
+
 int main (int argc, const char * argv[])
 {
   MyClass my_cpp(3.1415);

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

[Lldb-commits] [lldb] r285943 - Add RenderScriptScriptGroup to the Xcode project

2016-11-03 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Nov  3 12:33:11 2016
New Revision: 285943

URL: http://llvm.org/viewvc/llvm-project?rev=285943&view=rev
Log:
Add RenderScriptScriptGroup to the Xcode project


Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=285943&r1=285942&r2=285943&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov  3 12:33:11 2016
@@ -836,6 +836,7 @@
947CF7711DC7B1EE00EF980B /* ProcessMinidump.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 947CF7701DC7B1EE00EF980B /* ProcessMinidump.cpp 
*/; };
947CF7761DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = 947CF7741DC7B20D00EF980B /* 
RegisterContextMinidump_x86_32.cpp */; };
947CF7771DC7B20D00EF980B /* ThreadMinidump.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp 
*/; };
+   9485545A1DCBAE3B00345FF5 /* RenderScriptScriptGroup.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 948554591DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp */; };
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* 
ValueObjectConstResultImpl.cpp */; };
949EEDA01BA74B6D008C63CF /* CoreMedia.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 949EED9E1BA74B64008C63CF /* CoreMedia.cpp */; };
949EEDA31BA76577008C63CF /* Cocoa.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 949EEDA11BA76571008C63CF /* Cocoa.cpp */; };
@@ -2740,6 +2741,8 @@
947CF7741DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RegisterContextMinidump_x86_32.cpp; sourceTree = 
""; };
947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ThreadMinidump.cpp; sourceTree = ""; };
9481FE6B1B5F2D9200DED357 /* Either.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Either.h; path = 
include/lldb/Utility/Either.h; sourceTree = ""; };
+   948554581DCBAE3200345FF5 /* RenderScriptScriptGroup.h */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
RenderScriptScriptGroup.h; sourceTree = ""; };
+   948554591DCBAE3B00345FF5 /* RenderScriptScriptGroup.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RenderScriptScriptGroup.cpp; sourceTree = ""; 
};
949ADF001406F62E004833E1 /* ValueObjectConstResultImpl.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
ValueObjectConstResultImpl.h; path = 
include/lldb/Core/ValueObjectConstResultImpl.h; sourceTree = ""; };
949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = 
source/Core/ValueObjectConstResultImpl.cpp; sourceTree = ""; };
949EED9E1BA74B64008C63CF /* CoreMedia.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CoreMedia.cpp; 
path = Language/ObjC/CoreMedia.cpp; sourceTree = ""; };
@@ -5722,6 +5725,8 @@
isa = PBXGroup;
children = (
23D065811D4A7BDA0008EDE6 /* CMakeLists.txt */,
+   948554591DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp */,
+   948554581DCBAE3200345FF5 /* 
RenderScriptScriptGroup.h */,
23D065831D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.h */,
23D065821D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.cpp */,
23D065851D4A7BDA0008EDE6 /* 
RenderScriptRuntime.h */,
@@ -7391,6 +7396,7 @@
4C56543119D1EFAA002E9C44 /* 
ThreadPlanPython.cpp in Sources */,
26AB92121819D74600E63F3E /* 
DWARFDataExtractor.cpp in Sources */,
268900E913353E6F00698AC0 /* 
CPPLanguageRuntime.cpp in Sources */,
+   9485545A1DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp in Sources */,
268900EA13353E6F00698AC0 /* DynamicLoader.cpp 
in Sources */,
945261BF1B9A11FC00BF138D /* CxxStringTypes.cpp 
in Sources */,
268900EB13353E6F00698AC0 /* 
ExecutionContext.cpp in Sources */,

[Lldb-commits] [lldb] r286003 - Preliminary plumbing work to make 'parray' able to take offset and stride options

2016-11-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Nov  4 13:15:39 2016
New Revision: 286003

URL: http://llvm.org/viewvc/llvm-project?rev=286003&view=rev
Log:
Preliminary plumbing work to make 'parray' able to take offset and stride 
options


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

Modified: lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h?rev=286003&r1=286002&r2=286003&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h Fri Nov  4 
13:15:39 2016
@@ -42,6 +42,22 @@ public:
ValueObject *valobj, const std::string &summary);
   };
 
+  struct PointerAsArraySettings {
+size_t m_element_count;
+size_t m_base_element;
+size_t m_stride;
+
+PointerAsArraySettings()
+: m_element_count(0), m_base_element(0), m_stride() {}
+
+PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
+   size_t stride = 1)
+: m_element_count(elem_count), m_base_element(base_elem),
+  m_stride(stride) {}
+
+operator bool() { return m_element_count > 0; }
+  };
+
   typedef std::function
   DeclPrintingHelper;
@@ -116,6 +132,9 @@ public:
 
   DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
 
+  DumpValueObjectOptions &
+  SetPointerAsArray(const PointerAsArraySettings &ptr_array);
+
 public:
   uint32_t m_max_depth = UINT32_MAX;
   lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
@@ -126,7 +145,7 @@ public:
   lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
   PointerDepth m_max_ptr_depth;
   DeclPrintingHelper m_decl_printing_helper;
-  uint32_t m_element_count = 0;
+  PointerAsArraySettings m_pointer_as_array;
   bool m_use_synthetic : 1;
   bool m_scope_already_checked : 1;
   bool m_flat_output : 1;

Modified: lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp?rev=286003&r1=286002&r2=286003&view=diff
==
--- lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp (original)
+++ lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp Fri Nov  4 
13:15:39 2016
@@ -22,7 +22,7 @@ using namespace lldb_private;
 DumpValueObjectOptions::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_decl_printing_helper(), m_pointer_as_array(), m_use_synthetic(true),
   m_scope_already_checked(false), m_flat_output(false), 
m_ignore_cap(false),
   m_show_types(false), m_show_location(false), m_use_objc(false),
   m_hide_root_type(false), m_hide_name(false), m_hide_value(false),
@@ -195,6 +195,12 @@ DumpValueObjectOptions::SetRevealEmptyAg
 
 DumpValueObjectOptions &
 DumpValueObjectOptions::SetElementCount(uint32_t element_count) {
-  m_element_count = element_count;
+  m_pointer_as_array = PointerAsArraySettings(element_count);
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetPointerAsArray(
+const PointerAsArraySettings &ptr_array) {
+  m_pointer_as_array = ptr_array;
   return *this;
 }

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=286003&r1=286002&r2=286003&view=diff
==
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Fri Nov  4 13:15:39 
2016
@@ -359,7 +359,7 @@ void ValueObjectPrinter::GetValueSummary
   lldb::Format format = m_options.m_format;
   // if I am printing synthetized elements, apply the format to those elements
   // only
-  if (m_options.m_element_count > 0)
+  if (m_options.m_pointer_as_array)
 m_valobj->GetValueAsCString(lldb::eFormatDefault, value);
   else if (format != eFormatDefault && format != m_valobj->GetFormat())
 m_valobj->GetValueAsCString(format, value);
@@ -449,7 +449,7 @@ bool ValueObjectPrinter::PrintObjectDesc
   if (ShouldPrintValueObject()) {
 // let's avoid the overly verbose no description error for a nil thing
 if (m_options.m_use_objc && !IsNil() && !IsUninitialized() &&
-(m_options.m_element_count == 0)) {
+(!m_options.m_pointer_as_array)) {
   if (!m_options.m_hide_value || !m_options.m_hide_name)
 m_stream-

[Lldb-commits] [lldb] r286116 - Fix an issue where LLDB would hang trying to launch tvOS simulator binaries

2016-11-07 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  7 10:25:01 2016
New Revision: 286116

URL: http://llvm.org/viewvc/llvm-project?rev=286116&view=rev
Log:
Fix an issue where LLDB would hang trying to launch tvOS simulator binaries


Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp?rev=286116&r1=286115&r2=286116&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp 
(original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp Mon 
Nov  7 10:25:01 2016
@@ -150,7 +150,7 @@ const char *PlatformAppleTVSimulator::Ge
 /// Default Constructor
 //--
 PlatformAppleTVSimulator::PlatformAppleTVSimulator()
-: PlatformDarwin(true), m_sdk_directory() {}
+: PlatformDarwin(true), m_sdk_dir_mutex(), m_sdk_directory() {}
 
 //--
 /// Destructor.
@@ -261,7 +261,7 @@ EnumerateDirectoryCallback(void *baton,
 }
 
 const char *PlatformAppleTVSimulator::GetSDKDirectoryAsCString() {
-  std::lock_guard guard(m_mutex);
+  std::lock_guard guard(m_sdk_dir_mutex);
   if (m_sdk_directory.empty()) {
 const char *developer_dir = GetDeveloperDirectory();
 if (developer_dir) {

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h?rev=286116&r1=286115&r2=286116&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h 
(original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h Mon 
Nov  7 10:25:01 2016
@@ -86,6 +86,7 @@ public:
   }
 
 protected:
+  std::mutex m_sdk_dir_mutex;
   std::string m_sdk_directory;
   std::string m_build_update;
 


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


[Lldb-commits] [lldb] r286176 - Simplify the PrintableRepresentationSpecialCases code; we never used the ePrintableRepresentationSpecialCasesOnly value and with enum classes the names doesn't need to

2016-11-07 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  7 17:32:20 2016
New Revision: 286176

URL: http://llvm.org/viewvc/llvm-project?rev=286176&view=rev
Log:
Simplify the PrintableRepresentationSpecialCases code; we never used the 
ePrintableRepresentationSpecialCasesOnly value and with enum classes the names 
doesn't need to be that long


Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=286176&r1=286175&r2=286176&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Mon Nov  7 17:32:20 2016
@@ -536,10 +536,9 @@ public:
   ValueObjectRepresentationStyle val_obj_display,
   lldb::Format custom_format);
 
-  enum PrintableRepresentationSpecialCases {
-ePrintableRepresentationSpecialCasesDisable = 0,
-ePrintableRepresentationSpecialCasesAllow = 1,
-ePrintableRepresentationSpecialCasesOnly = 3
+  enum class PrintableRepresentationSpecialCases : bool {
+eDisable = false,
+eAllow = true
   };
 
   bool
@@ -548,7 +547,7 @@ public:
   eValueObjectRepresentationStyleSummary,
   lldb::Format custom_format = 
lldb::eFormatInvalid,
   PrintableRepresentationSpecialCases special =
-  ePrintableRepresentationSpecialCasesAllow,
+  PrintableRepresentationSpecialCases::eAllow,
   bool do_dump_error = true);
   bool GetValueIsValid() const;
 

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=286176&r1=286175&r2=286176&view=diff
==
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Mon Nov  7 17:32:20 2016
@@ -874,7 +874,7 @@ static bool DumpValue(Stream &s, const S
   {
 target->DumpPrintableRepresentation(
 s, val_obj_display, custom_format,
-ValueObject::ePrintableRepresentationSpecialCasesDisable);
+ValueObject::PrintableRepresentationSpecialCases::eDisable);
   }
   return true;
 }
@@ -1676,8 +1676,7 @@ bool FormatEntity::Format(const Entry &e
   ss, ValueObject::ValueObjectRepresentationStyle::
   eValueObjectRepresentationStyleSummary,
   eFormatDefault,
-  ValueObject::PrintableRepresentationSpecialCases::
-  ePrintableRepresentationSpecialCasesAllow,
+  ValueObject::PrintableRepresentationSpecialCases::eAllow,
   false);
   }
 

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=286176&r1=286175&r2=286176&view=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Mon Nov  7 17:32:20 2016
@@ -1279,10 +1279,9 @@ bool ValueObject::DumpPrintableRepresent
 
   Flags flags(GetTypeInfo());
 
-  bool allow_special = ((special & ePrintableRepresentationSpecialCasesAllow) 
==
-ePrintableRepresentationSpecialCasesAllow);
-  bool only_special = ((special & ePrintableRepresentationSpecialCasesOnly) ==
-   ePrintableRepresentationSpecialCasesOnly);
+  bool allow_special =
+  (special == ValueObject::PrintableRepresentationSpecialCases::eAllow);
+  const bool only_special = false;
 
   if (allow_special) {
 if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=286176&r1=286175&r2=286176&view=diff
==
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Mon Nov  7 17:32:20 
2016
@@ -762,7 +762,7 @@ bool ValueObjectPrinter::PrintChildrenOn
 child_sp->DumpPrintableRepresentation(
 *m_stream, ValueObject::eValueObjectRepresentationStyleSummary,
 m_options.m_format,
-ValueObject::ePrintable

[Lldb-commits] [PATCH] D26403: Display the pointer value in the libstdc++ unique_ptr summary

2016-11-08 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

Make what you will of my suggestion above, but in general the reasoning looks 
good




Comment at: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:129
 
   if (m_ptr_obj->GetValueAsUnsigned(0) == 0) {
 stream.Printf("nullptr");

This is very nitpick-y but why not

lldb::addr_t ptr_value = m_ptr_obj->GetValueAsUnsigned(LLDB_INVALID_ADDRESS)
switch (ptr_value) {
  case 0: stream.Printf("nullptr"); break;
  case LLDB_INVALID_ADDRESS: return false;
  default: stream.Printf("0x%" PRIx64, ptr_value); break;
}

modulo clang-formatting the above, of course.



https://reviews.llvm.org/D26403



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


[Lldb-commits] [PATCH] D26403: Display the pointer value in the libstdc++ unique_ptr summary

2016-11-09 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

Makes sense. Feel free to commit.


Repository:
  rL LLVM

https://reviews.llvm.org/D26403



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


[Lldb-commits] [lldb] r286782 - I am leaving Apple in a few weeks; switch over to my personal email address

2016-11-13 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Sun Nov 13 15:30:54 2016
New Revision: 286782

URL: http://llvm.org/viewvc/llvm-project?rev=286782&view=rev
Log:
I am leaving Apple in a few weeks; switch over to my personal email address


Modified:
lldb/trunk/CODE_OWNERS.txt

Modified: lldb/trunk/CODE_OWNERS.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CODE_OWNERS.txt?rev=286782&r1=286781&r2=286782&view=diff
==
--- lldb/trunk/CODE_OWNERS.txt (original)
+++ lldb/trunk/CODE_OWNERS.txt Sun Nov 13 15:30:54 2016
@@ -20,7 +20,7 @@ D: DynamicLoader, ObjectFile, IOHandler,
 D: Build scripts, Test suite, Platform, gdb-remote, Anything not covered by 
this file
 
 N: Enrico Granata
-E: egran...@apple.com
+E: granata.enr...@gmail.com
 D: Data Formatters, Core/Value*, Objective C Language runtime, Test suite, 
Xcode build
 D: SWIG
 


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


Re: [Lldb-commits] [PATCH] D26618: Make some code not manipulate the underlying buffer of a StreamString

2016-11-14 Thread Enrico Granata via lldb-commits
I will gladly let Todd run tests on your diff, but I just thought I'd 
explain what is going on there


In Cocoa, some NSURL objects are represented as "sub-URLs", e.g. you can 
start from www.apple.com and represent www.apple.com/macos as 
NSURL(base="www.apple.com", next="/macos")


This can be recursively done, so you can have 
NSURL(base=NSURL(base="www.apple.com", next="/macos"), next="/sierra")


The data formatter is attempting to represent the URL as "%s --- %s" % 
(summary(base), summary(next))


On 11/14/16 10:00 AM, Zachary Turner via lldb-commits wrote:

zturner created this revision.
zturner added reviewers: tfiala, beanz.
zturner added a subscriber: lldb-commits.

I have locally a a very large patch which removes the method of `StreamString` 
that returns a reference to the underlying `std::string` buffer, and instead 
returns a `StringRef`.  There were 1 or 2 instances where someone was relying 
on this function to reach into the underlying buffer and do stuff like insert 
or erase from it.  This seems like a huge hack, and in the future as I move 
code towards `llvm::raw_ostream` this will be incompatible with LLVM's api 
anyway since it does not allow such things.  The only non-trivial fix to this 
was in something Cocoa related.  I don't really understand this code, and I 
can't test it, but the patch here is intended to be NFC and just re-writing the 
logic in terms of something that doesn't modify the internal Stream buffer.

If someone could test it for me I would appreciate.


https://reviews.llvm.org/D26618

Files:
   source/Plugins/Language/ObjC/Cocoa.cpp


Index: source/Plugins/Language/ObjC/Cocoa.cpp
===
--- source/Plugins/Language/ObjC/Cocoa.cpp
+++ source/Plugins/Language/ObjC/Cocoa.cpp
@@ -559,42 +559,44 @@
if (!valobj_addr)
  return false;
  
-  const char *class_name = descriptor->GetClassName().GetCString();

+  llvm::StringRef class_name = descriptor->GetClassName().GetStringRef();
  
-  if (!class_name || !*class_name)

+  if (!class_name.equals("NSURL"))
  return false;
  
-  if (strcmp(class_name, "NSURL") == 0) {

-uint64_t offset_text = ptr_size + ptr_size +
-   8; // ISA + pointer + 8 bytes of data (even on 
32bit)
-uint64_t offset_base = offset_text + ptr_size;
-CompilerType type(valobj.GetCompilerType());
-ValueObjectSP text(
-valobj.GetSyntheticChildAtOffset(offset_text, type, true));
-ValueObjectSP base(
-valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-if (!text)
-  return false;
-if (text->GetValueAsUnsigned(0) == 0)
-  return false;
-StreamString summary;
-if (!NSStringSummaryProvider(*text, summary, options))
-  return false;
-if (base && base->GetValueAsUnsigned(0)) {
-  if (summary.GetSize() > 0)
-summary.GetString().resize(summary.GetSize() - 1);
-  summary.Printf(" -- ");
-  StreamString base_summary;
-  if (NSURLSummaryProvider(*base, base_summary, options) &&
-  base_summary.GetSize() > 0)
-summary.Printf("%s", base_summary.GetSize() > 2
- ? base_summary.GetData() + 2
- : base_summary.GetData());
-}
-if (summary.GetSize()) {
-  stream.Printf("%s", summary.GetData());
-  return true;
+  uint64_t offset_text = ptr_size + ptr_size +
+ 8; // ISA + pointer + 8 bytes of data (even on 32bit)
+  uint64_t offset_base = offset_text + ptr_size;
+  CompilerType type(valobj.GetCompilerType());
+  ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, 
true));
+  ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, 
true));
+  if (!text)
+return false;
+  if (text->GetValueAsUnsigned(0) == 0)
+return false;
+  StreamString summary;
+  if (!NSStringSummaryProvider(*text, summary, options))
+return false;
+  if (base && base->GetValueAsUnsigned(0)) {
+std::string summary_str = summary.GetString();
+
+if (!summary_str.empty())
+  summary_str.pop_back();
+summary_str += " -- ";
+StreamString base_summary;
+if (NSURLSummaryProvider(*base, base_summary, options) &&
+!base_summary.Empty()) {
+  llvm::StringRef base_str = base_summary.GetString();
+  if (base_str.size() > 2)
+base_str = base_str.drop_front(2);
+  summary_str += base_str;
  }
+summary.Clear();
+summary.PutCString(summary_str);
+  }
+  if (!summary.Empty()) {
+stream.PutCString(summary.GetString());
+return true;
}
  
return false;





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


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


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-11-16 Thread Enrico Granata via lldb-commits
granata.enrico added a reviewer: beanz.
granata.enrico added a comment.

Chris, can you take a look at this? I am far from a CMake expert


https://reviews.llvm.org/D26757



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


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-11-16 Thread Enrico Granata via lldb-commits
granata.enrico added inline comments.



Comment at: scripts/Python/prepare_binding_Python.py:229
 stderr=subprocess.PIPE,
-shell=True)
+)
 # Wait for SWIG process to terminate

This worries me a little bit.. Are we sure we are not in any way relying on the 
shell in executing the command line?


https://reviews.llvm.org/D26757



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


Re: [Lldb-commits] [lldb] r287354 - Resubmit "Remove an output-parameter from Variable function".

2016-11-18 Thread Enrico Granata via lldb-commits
I tend to agree with Jim's point. I have sometimes put in things that 
look like "dead/vestigial code", which I am actually either planning to 
use later on, or actively using somewhere else. This is a quite 
realistic scenario due to Swift support for LLDB existing in an entirely 
separate universe. I have multiple times committed changes to llvm.org 
which are - on their face - glorified no-ops, but I actually end up 
using on the other side of the Swift fence. Removing that kind of change 
without asking first is A Bad Thing(TM).


Also, in the not-too-distant future, people who aren't the original 
authors of this area of the code will end up having to own and make 
calls about it. IMO, It becomes even more important to give everyone 
advance notice at that point.


With all of that said, in this case, I believe the change itself is 
fine. I have - admittedly - not delved deep into the mechanics of each 
diff, but I am just making the "judgment call" on the removal of 
first_unparsed. Removing that argument is fine.
As things stand, it is indeed unused. One day, we might decide we want 
to do better diagnostics for summary formatters and/or frame variable 
(e,g, be able to say things like "foo.bar->baz[3] not valid - reason: 
baz doesn't have a member named [3] as it's not of array or pointer 
type") - and then the combination of first_unparsed and reason_to_stop 
would be exactly the data to use. With that said, we don't do this now, 
and AFAIK there are no explicit plans around doing it.


tl;dr Thanks for asking, LGTM


On 11/18/16 12:32 PM, Zachary Turner wrote:
I admit I've been moving somewhat fast with these changes.  The 
parameter in question was only used in one logging statement, so the 
benefit did not seem worth the added cost of complexity.  But you're 
right, that involved a judgement call on my part that I didn't vet first.


+Enrico Granata  , who can hopefully do a 
post-commit review on this.  I can add it back without much effort if 
he feels it's important.


On Fri, Nov 18, 2016 at 12:02 PM Jim Ingham > wrote:


I didn’t see this patch go up for review.  The parameter you
removed might have been vestigial or might have been one that the
owner of this code was planning to do something with.  Anyway,
this seems to go beyond purely formal changes and so should have
been discussed.  My apologies if I just missed the review.

Jim

> On Nov 18, 2016, at 9:55 AM, Zachary Turner via lldb-commits
mailto:lldb-commits@lists.llvm.org>>
wrote:
>
> Author: zturner
> Date: Fri Nov 18 11:55:04 2016
> New Revision: 287354
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287354&view=rev
> Log:
> Resubmit "Remove an output-parameter from Variable function".
>
> The scanning algorithm had a few little subtleties that I
> overlooked, but this patch should fix everything.
>
> I still haven't changed the function to take a StringRef since
> that has some trickle down effect and is mostly mechanical,
> I just wanted to get the tricky part as isolated as possible.
>
> Modified:
>lldb/trunk/include/lldb/Core/ValueObject.h
>lldb/trunk/source/Core/FormatEntity.cpp
>lldb/trunk/source/Core/ValueObject.cpp
> lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
>lldb/trunk/source/Symbol/Variable.cpp
>
> Modified: lldb/trunk/include/lldb/Core/ValueObject.h
> URL:

http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=287354&r1=287353&r2=287354&view=diff
>

==
> --- lldb/trunk/include/lldb/Core/ValueObject.h (original)
> +++ lldb/trunk/include/lldb/Core/ValueObject.h Fri Nov 18
11:55:04 2016
> @@ -394,7 +394,7 @@ public:
>   GetExpressionPathFormat =
eGetExpressionPathFormatDereferencePointers);
>
>   lldb::ValueObjectSP GetValueForExpressionPath(
> -  const char *expression, const char **first_unparsed =
nullptr,
> +  const char *expression,
>   ExpressionPathScanEndReason *reason_to_stop = nullptr,
>   ExpressionPathEndResultType *final_value_type = nullptr,
>   const GetValueForExpressionPathOptions &options =
> @@ -1002,8 +1002,7 @@ private:
>   virtual CompilerType MaybeCalculateCompleteType();
>
>   lldb::ValueObjectSP GetValueForExpressionPath_Impl(
> -  const char *expression_cstr, const char **first_unparsed,
> -  ExpressionPathScanEndReason *reason_to_stop,
> +  const char *expression_cstr, ExpressionPathScanEndReason
*reason_to_stop,
>   ExpressionPathEndResultType *final_value_type,
>   const GetValueForExpressionPathOptions &options,
>   ExpressionPathAftermath *final_task_on_target);
>
> Modified: lldb/trunk/source/Core/FormatEn

[Lldb-commits] [lldb] r287397 - Removing myself from CODE_OWNERS, and distributing those duties among other members of the community

2016-11-18 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Nov 18 17:18:11 2016
New Revision: 287397

URL: http://llvm.org/viewvc/llvm-project?rev=287397&view=rev
Log:
Removing myself from CODE_OWNERS, and distributing those duties among other 
members of the community

That's All, Folks


Modified:
lldb/trunk/CODE_OWNERS.txt

Modified: lldb/trunk/CODE_OWNERS.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CODE_OWNERS.txt?rev=287397&r1=287396&r2=287397&view=diff
==
--- lldb/trunk/CODE_OWNERS.txt (original)
+++ lldb/trunk/CODE_OWNERS.txt Fri Nov 18 17:18:11 2016
@@ -16,18 +16,14 @@ N: Greg Clayton
 E: clayb...@gmail.com (Phabricator)
 E: gclay...@apple.com (Direct)
 D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, 
Mac-specific code, 
-D: DynamicLoader, ObjectFile, IOHandler, EditLine, ValueObject, Watchpoints, 
debugserver
+D: DynamicLoader, ObjectFile, IOHandler, EditLine, Core/Value*, Watchpoints, 
debugserver
 D: Build scripts, Test suite, Platform, gdb-remote, Anything not covered by 
this file
 
-N: Enrico Granata
-E: granata.enr...@gmail.com
-D: Data Formatters, Core/Value*, Objective C Language runtime, Test suite, 
Xcode build
-D: SWIG
-
 N: Jim Ingham
 E: jing...@apple.com
 D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, 
Breakpoints, ABI
 D: Watchpoints, Trampolines, Target, Command Interpreter, C++ / Objective C 
Language runtime
+D: Data Formatters
 
 N: Ilia K
 E: ki.s...@gmail.com
@@ -48,6 +44,7 @@ D: lldb-mi
 N: Zachary Turner
 E: ztur...@google.com
 D: CMake build, Host (common+windows), Plugins/Process/Windows, Anything 
Windows-specific
+D: Test suite
 
 N: Pavel Labath
 E: lab...@google.com
@@ -55,5 +52,5 @@ D: Linux, Android
 
 N: Todd Fiala
 E: todd.fi...@gmail.com
-D: Test Suite subsystems (concurrent test runners, test events, TestResults 
system), gdb-remote protocol tests
+D: Test Suite, esp. subsystems (concurrent test runners, test events, 
TestResults system), gdb-remote protocol tests
 


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


[Lldb-commits] [lldb] r248960 - Introudce a IsTopLevelFunction() API on Language and Function

2015-09-30 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Sep 30 18:12:22 2015
New Revision: 248960

URL: http://llvm.org/viewvc/llvm-project?rev=248960&view=rev
Log:
Introudce a IsTopLevelFunction() API on Language and Function

This is meant to support languages that have a scripting mode with top-level 
code that acts as global

For now, this flag only controls whether 'frame variable' will attempt to treat 
globals as locals when within such a function


Modified:
lldb/trunk/include/lldb/Symbol/Function.h
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Symbol/Function.cpp
lldb/trunk/source/Target/Language.cpp

Modified: lldb/trunk/include/lldb/Symbol/Function.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Function.h?rev=248960&r1=248959&r2=248960&view=diff
==
--- lldb/trunk/include/lldb/Symbol/Function.h (original)
+++ lldb/trunk/include/lldb/Symbol/Function.h Wed Sep 30 18:12:22 2015
@@ -631,6 +631,24 @@ public:
 //--
 bool
 GetIsOptimized ();
+
+//--
+/// Get whether this function represents a 'top-level' function
+///
+/// The concept of a top-level function is language-specific, mostly
+/// meant to represent the notion of scripting-style code that has
+/// global visibility of the variables/symbols/functions/...
+/// defined within the containing file/module
+///
+/// If stopped in a top-level function, LLDB will expose global variables
+/// as-if locals in the 'frame variable' command
+///
+/// @return
+/// Returns 'true' if this function is a top-level function,
+/// 'false' otherwise.
+//--
+bool
+IsTopLevelFunction ();
 
 lldb::DisassemblerSP
 GetInstructions (const ExecutionContext &exe_ctx,

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=248960&r1=248959&r2=248960&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Wed Sep 30 18:12:22 2015
@@ -41,6 +41,9 @@ public:
 virtual lldb::LanguageType
 GetLanguageType () const = 0;
 
+bool
+IsTopLevelFunction (Function& function);
+
 virtual lldb::TypeCategoryImplSP
 GetFormatters ();
 

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=248960&r1=248959&r2=248960&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Sep 30 18:12:22 2015
@@ -35,6 +35,7 @@
 #include "lldb/Interpreter/OptionGroupVariable.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/Type.h"
@@ -409,6 +410,10 @@ protected:
 
 DumpValueObjectOptions 
options(m_varobj_options.GetAsDumpOptions(eLanguageRuntimeDescriptionDisplayVerbosityFull,eFormatDefault,summary_format_sp));
 
+const SymbolContext& sym_ctx = 
frame->GetSymbolContext(eSymbolContextFunction);
+if (sym_ctx.function && sym_ctx.function->IsTopLevelFunction())
+m_option_variable.show_globals = true;
+
 if (variable_list)
 {
 const Format format = m_option_format.GetFormat();

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=248960&r1=248959&r2=248960&view=diff
==
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Wed Sep 30 18:12:22 2015
@@ -17,6 +17,7 @@
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Target/Language.h"
 #include "llvm/Support/Casting.h"
 
 using namespace lldb;
@@ -481,6 +482,17 @@ Function::GetIsOptimized ()
 return result;
 }
 
+bool
+Function::IsTopLevelFunction ()
+{
+bool result = false;
+
+if (Language* language = Language::FindPlugin(GetLanguage()))
+result = language->IsTopLevelFunction(*this);
+
+return result;
+}
+
 ConstString
 Function::GetDisplayName () const
 {

Modified: lldb/trunk/source/Target/Language.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Targ

[Lldb-commits] [lldb] r249047 - Add a 'type lookup' command. This command is meant to look up type information by name in a language-specific way.

2015-10-01 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct  1 13:16:18 2015
New Revision: 249047

URL: http://llvm.org/viewvc/llvm-project?rev=249047&view=rev
Log:
Add a 'type lookup' command. This command is meant to look up type information 
by name in a language-specific way.

Currently, it only supports Objective-C - C++ types can be looked up through 
debug info via 'image lookup -t', whereas ObjC types via this command are 
looked up by runtime introspection

This behavior is in line with type lookup's behavior in Xcode 7, but I am 
definitely open to feedback as to what makes the most sense here


Modified:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h
lldb/trunk/source/Target/Language.cpp

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=249047&r1=249046&r2=249047&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Thu Oct  1 13:16:18 2015
@@ -13,6 +13,8 @@
 // C Includes
 // C++ Includes
 #include 
+#include 
+#include 
 #include 
 
 // Other libraries and framework includes
@@ -29,6 +31,42 @@ class Language :
 public PluginInterface
 {
 public:
+
+class TypeScavenger
+{
+public:
+class Result
+{
+public:
+virtual bool
+IsValid () = 0;
+
+virtual bool
+DumpToStream (Stream& stream,
+  bool print_help_if_available) = 0;
+
+virtual ~Result() = default;
+};
+
+typedef std::set> ResultSet;
+
+virtual ~TypeScavenger () = default;
+
+size_t
+Find (ExecutionContextScope *exe_scope,
+  const char *key,
+  ResultSet &results,
+  bool append = true);
+
+protected:
+TypeScavenger () = default;
+
+virtual bool
+Find_Impl (ExecutionContextScope *exe_scope,
+   const char *key,
+   ResultSet &results) = 0;
+};
+
 ~Language() override;
 
 static Language*
@@ -65,6 +103,9 @@ public:
 virtual lldb_private::formatters::StringPrinter::EscapingHelper
 GetStringPrinterEscapingHelper 
(lldb_private::formatters::StringPrinter::GetPrintableElementType);
 
+virtual std::unique_ptr
+GetTypeScavenger ();
+
 // These are accessors for general information about the Languages lldb 
knows about:
 
 static lldb::LanguageType
@@ -91,7 +132,6 @@ public:
 
 static bool
 LanguageIsPascal (lldb::LanguageType language);
-
 
 protected:
 //--

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=249047&r1=249046&r2=249047&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Thu Oct  1 13:16:18 2015
@@ -4558,6 +4558,218 @@ CommandObjectTypeFilterAdd::CommandOptio
 { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
 };
 
+//--
+// "type lookup"
+//--
+class CommandObjectTypeLookup : public CommandObjectRaw
+{
+protected:
+
+class CommandOptions : public OptionGroup
+{
+public:
+
+CommandOptions () :
+OptionGroup(),
+m_show_help(false),
+m_language(eLanguageTypeUnknown)
+{}
+
+virtual
+~CommandOptions () {}
+
+virtual uint32_t
+GetNumDefinitions ()
+{
+return 3;
+}
+
+virtual const OptionDefinition*
+GetDefinitions ()
+{
+return g_option_table;
+}
+
+virtual Error
+SetOptionValue (CommandInterpreter &interpreter,
+uint32_t option_idx,
+const char *option_value)
+{
+Error error;
+
+const int short_option = g_option_table[option_idx].short_option;
+
+switch (short_option)
+{
+case 'h':
+m_show_help = true;
+break;
+
+case 'l':
+m_language = 
Language::GetLanguageTypeFromString(option_value);
+break;
+
+default:
+ 

Re: [Lldb-commits] [lldb] r248934 - Now persistent expression data no longer lives with the Target, but rather with

2015-10-01 Thread Enrico Granata via lldb-commits
The way I understand this from talking with Sean about it is that the 
persistent variables for each type system will need to generate non-conflicting 
names

In your example,

(lldb) expr -l c — 1
$1 = 1
(lldb) expr -l go — 2
$G1 = 2
(lldb) expr -l go — $1
Identifier ā€˜$1’ not recognized (or whatever equivalent error Go would produce, 
unless you had somehow gotten Go and Clang to interop with each other in a 
smart way)

But that is simply my understanding

> On Oct 1, 2015, at 11:15 AM, Ryan Brown via lldb-commits 
>  wrote:
> 
> Oh, now I see the search in 249027.
> But how does this work with multiple type systems?
> Target no longer manages persistent variable names so won't each type system 
> generate conflicting names? 
> e.g.
> (lldb) expr -l c -- 1
> $1 = 1
> (lldb) expr -l go -- 2
> $1 = 2
> (lldb) expr -l go -- $1
> 
> Which $1 do you get?
> 
> 
> On Thu, Oct 1, 2015 at 10:59 AM Ryan Brown  > wrote:
> Shouldn't Target::GetPersistentVariable take a language parameter instead of 
> assuming clang?
> 
> On Wed, Sep 30, 2015 at 12:59 PM Sean Callanan via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> Author: spyffe
> Date: Wed Sep 30 14:57:57 2015
> New Revision: 248934
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=248934&view=rev 
> 
> Log:
> Now persistent expression data no longer lives with the Target, but rather 
> with
> the corresponding TypeSystem.  This makes sense because what kind of data 
> there
> is -- and how it can be looked up -- depends on the language.
> 
> Functionality that is common to all type systems is factored out into
> PersistentExpressionState.
> 
> Modified:
> lldb/trunk/include/lldb/Expression/ExpressionVariable.h
> lldb/trunk/include/lldb/Symbol/ClangASTContext.h
> lldb/trunk/include/lldb/Symbol/TypeSystem.h
> lldb/trunk/include/lldb/Target/Target.h
> lldb/trunk/include/lldb/lldb-forward.h
> lldb/trunk/source/API/SBFrame.cpp
> lldb/trunk/source/Commands/CommandObjectMemory.cpp
> lldb/trunk/source/Core/ValueObject.cpp
> lldb/trunk/source/Expression/ExpressionSourceCode.cpp
> lldb/trunk/source/Expression/ExpressionVariable.cpp
> lldb/trunk/source/Expression/Materializer.cpp
> lldb/trunk/source/Expression/UserExpression.cpp
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
> 
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
> 
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
> 
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
> lldb/trunk/source/Symbol/ClangASTContext.cpp
> lldb/trunk/source/Target/ABI.cpp
> lldb/trunk/source/Target/Target.cpp
> 
> Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionVariable.h?rev=248934&r1=248933&r2=248934&view=diff
>  
> 
> ==
> --- lldb/trunk/include/lldb/Expression/ExpressionVariable.h (original)
> +++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h Wed Sep 30 
> 14:57:57 2015
> @@ -265,6 +265,36 @@ private:
>  std::vector  m_variables;
>  };
> 
> +class PersistentExpressionState : public ExpressionVariableList {
> +public:
> +//--
> +// See TypeSystem.h for how to add subclasses to this.
> +//--
> +enum LLVMCastKind {
> +eKindClang,
> +eKindSwift,
> +eKindGo,
> +kNumKinds
> +};
> +
> +LLVMCastKind getKind() const { return m_kind; }
> +
> +PersistentExpressionState(LLVMCastKind kind) :
> +m_kind(kind)
> +{
> +}
> +
> +virtual ~PersistentExpressionState ();
> +
> +virtual ConstString
> +GetNextPersistentVariableName () = 0;
> +
> +virtual void
> +RemovePersistentVariable (lldb::ExpressionVariableSP variable) = 0;
> +private:
> +LLVMCastKind m_kind;
> +};
> +
>  }
> 
>  #endif /* liblldb_ExpressionVariable_h_ */
> 
> Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=248934&r1=248933&r2=248934&view=diff
>  
> 
> ==
> --- lldb/trunk/in

Re: [Lldb-commits] [lldb] r249047 - Add a 'type lookup' command. This command is meant to look up type information by name in a language-specific way.

2015-10-01 Thread Enrico Granata via lldb-commits

> On Oct 1, 2015, at 12:49 PM, Zachary Turner  wrote:
> 
> Hi Enrico,
> 
> Could you add some tests for this?

Sure. I am still churning through a thing or two before declaring victory, but 
I can add tests as I make progress

>  python API tests and appropriate methods added to SBTarget

There currently is no SB API component to this. It is a purely command-line 
facility.
If you feel it would be useful to have SB API for this, it will need to be 
designed (e.g. ā€œtype lookupā€ is allowed to transact in things that are not 
strictly speaking compiler types - we have no API way to represent this kind of 
concept)

> would be ideal.
> 
> On Thu, Oct 1, 2015 at 11:17 AM Enrico Granata via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> Author: enrico
> Date: Thu Oct  1 13:16:18 2015
> New Revision: 249047
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=249047&view=rev 
> <http://llvm.org/viewvc/llvm-project?rev=249047&view=rev>
> Log:
> Add a 'type lookup' command. This command is meant to look up type 
> information by name in a language-specific way.
> 
> Currently, it only supports Objective-C - C++ types can be looked up through 
> debug info via 'image lookup -t', whereas ObjC types via this command are 
> looked up by runtime introspection
> 
> This behavior is in line with type lookup's behavior in Xcode 7, but I am 
> definitely open to feedback as to what makes the most sense here
> 
> 
> Modified:
> lldb/trunk/include/lldb/Target/Language.h
> lldb/trunk/source/Commands/CommandObjectType.cpp
> lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
> lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h
> lldb/trunk/source/Target/Language.cpp
> 
> Modified: lldb/trunk/include/lldb/Target/Language.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=249047&r1=249046&r2=249047&view=diff
>  
> <http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=249047&r1=249046&r2=249047&view=diff>
> ==
> --- lldb/trunk/include/lldb/Target/Language.h (original)
> +++ lldb/trunk/include/lldb/Target/Language.h Thu Oct  1 13:16:18 2015
> @@ -13,6 +13,8 @@
>  // C Includes
>  // C++ Includes
>  #include 
> +#include 
> +#include 
>  #include 
> 
>  // Other libraries and framework includes
> @@ -29,6 +31,42 @@ class Language :
>  public PluginInterface
>  {
>  public:
> +
> +class TypeScavenger
> +{
> +public:
> +class Result
> +{
> +public:
> +virtual bool
> +IsValid () = 0;
> +
> +virtual bool
> +DumpToStream (Stream& stream,
> +  bool print_help_if_available) = 0;
> +
> +virtual ~Result() = default;
> +};
> +
> +typedef std::set> ResultSet;
> +
> +virtual ~TypeScavenger () = default;
> +
> +size_t
> +Find (ExecutionContextScope *exe_scope,
> +  const char *key,
> +  ResultSet &results,
> +  bool append = true);
> +
> +protected:
> +TypeScavenger () = default;
> +
> +virtual bool
> +Find_Impl (ExecutionContextScope *exe_scope,
> +   const char *key,
> +   ResultSet &results) = 0;
> +};
> +
>  ~Language() override;
> 
>  static Language*
> @@ -65,6 +103,9 @@ public:
>  virtual lldb_private::formatters::StringPrinter::EscapingHelper
>  GetStringPrinterEscapingHelper 
> (lldb_private::formatters::StringPrinter::GetPrintableElementType);
> 
> +virtual std::unique_ptr
> +GetTypeScavenger ();
> +
>  // These are accessors for general information about the Languages lldb 
> knows about:
> 
>  static lldb::LanguageType
> @@ -91,7 +132,6 @@ public:
> 
>  static bool
>  LanguageIsPascal (lldb::LanguageType language);
> -
> 
>  protected:
>  //--
> 
> Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=249047&r1=249046&r2=249047&view=diff
>  
> <http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=249047&r1=249046&r2=249047&view=diff>
> ==
> --- lldb/trunk/source/Commands/CommandObjectTy

Re: [Lldb-commits] [lldb] r249047 - Add a 'type lookup' command. This command is meant to look up type information by name in a language-specific way.

2015-10-01 Thread Enrico Granata via lldb-commits

> On Oct 1, 2015, at 1:15 PM, Zachary Turner  wrote:
> 
> I see there's SBType, does this represent something different?

Yes, it represents types.
Type lookup does not necessarily always deal with types.
For instance, imagine a language that has function declarations such that

function foo(int x, int y) returns int

and

function bar(int x, int y) returns int

represents two different declarations - but they have the same type

function (int, int) returns int

We want type lookup to be able to maintain that distinction, such that one 
could say

(lldb) type lookup -l newlanguage — foo
function foo(int x, int y) returns int

vs.

(lldb) type lookup -l newlanguage — bar
function bar(int x, int y) returns int

Other similar cases are languages where a runtime introspection mechanism does 
not expose fully-baked types, but still provides useful introspection 
information that one could show the user. Those are useful things for type 
lookup to do, and forcing the results to be CompilerTypes would lose us that 
ability. We would need something like SBTypeOrDecl, or an opaque 
SBTypeLookupResult.

>   I was thinking you could make a method like 
> 
> SBType *
> SBTarget::LookupType(const char* type_name, eLanguage lang);
> 
> Even if it didn't support every possible usage of the "type lookup" command, 
> it would be a start.

I would like to avoid having a command that does the right thing always, and an 
API that does somewhat a good thing sometimes. Note that I don’t say this to 
oppose the notion of an API for ā€œtype lookupā€, but only to oppose the notion of 
an API that returns a list of types, when the output of ā€œtype lookupā€ is not 
necessarily always just types.

An API is a reasonable thing to ask for - I can’t promise I’ll have one done 
today or tomorrow, especially because I have given no thought to how to design 
one, but now that you mention it, it is in my queue of improvements for this 
functionality.

> 
> At one point on the list it was discussed whether tests which use runCmd and 
> then matching the output should be separated from the rest of the test suite, 
> so there's a more clearly enforced distinction about which tests use the 
> command API and which tests use the python API.  At least Jim thought that 
> was a good idea and supported the move, but nobody else really chimed in.  If 
> you agree, maybe you could be the first?  :)  Something like 
> lldb/test/commands/type-lookup.  Eventually the goal would just be to have 3 
> top level directories, 
> 
> lldb
> |__test
> |__commands
> |__python-api
> |__unit-tests

I have historically been putting this kind of things in ā€œtest/functionalitiesā€. 
I am not sure that - as a matter of convention - we have command-line only 
tests in ā€œfunctionalitiesā€ though.
Is there any objection to a refactor as-you-touch-things approach here? i.e. if 
I add a test for the command-line side, it goes in test/functionalities/* - but 
if at a later time I add SB API for type lookup, then the test for that goes in 
test/python-api/*
It seems a reasonable way forward to me - unless I am missing something

> 
> With the existing sub-trees divided up accordingly between the 3.   (This is 
> all assuming of course that making the SBTarget::LookupType method I 
> suggested earlier doesn't work for some reason)
> 
> On Thu, Oct 1, 2015 at 1:01 PM Enrico Granata  <mailto:egran...@apple.com>> wrote:
>> On Oct 1, 2015, at 12:49 PM, Zachary Turner > <mailto:ztur...@google.com>> wrote:
>> 
>> Hi Enrico,
>> 
>> Could you add some tests for this?
> 
> Sure. I am still churning through a thing or two before declaring victory, 
> but I can add tests as I make progress
> 
>>  python API tests and appropriate methods added to SBTarget
> 
> There currently is no SB API component to this. It is a purely command-line 
> facility.
> If you feel it would be useful to have SB API for this, it will need to be 
> designed (e.g. ā€œtype lookupā€ is allowed to transact in things that are not 
> strictly speaking compiler types - we have no API way to represent this kind 
> of concept)
> 
>> would be ideal.
>> 
>> On Thu, Oct 1, 2015 at 11:17 AM Enrico Granata via lldb-commits 
>> mailto:lldb-commits@lists.llvm.org>> wrote:
>> Author: enrico
>> Date: Thu Oct  1 13:16:18 2015
>> New Revision: 249047
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=249047&view=rev 
>> <http://llvm.org/viewvc/llvm-project?rev=249047&view=rev>
>> Log:
>> Add a 'type lookup' command. This command is meant to look up type 
>> information by name in a language-specific way.
>> 
>> Currently, it only supports Objective-C - C++ types can be looked up through 

Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-10-01 Thread Enrico Granata via lldb-commits
granata.enrico requested changes to this revision.
granata.enrico added a comment.
This revision now requires changes to proceed.

Sorry, I didn't realize you were still waiting on me to land this patch.

I have a few extra comments before this is ready to land.



Comment at: include/lldb/API/SBTypeSummary.h:125
@@ +124,3 @@
+
+bool DoesPrintValue(const lldb::SBValue &value) const;
+

Can you please change this to

bool
DoesPrintValue (lldb::SBValue value);

There is no need to pass the SBValue by reference since you're not actually 
altering it - and since SBValue wraps a (glorified) pointer to a ValueObject 
you're not really copying much data over. I don't see the need to classify the 
function as const (only IsValid() seems to be marked thusly in that file), and 
definitely no need for the SBValue to be a const


Comment at: source/API/SBTypeSummary.cpp:289
@@ -286,1 +288,3 @@
 
+bool
+SBTypeSummary::DoesPrintValue(const lldb::SBValue &value) const

Of course change this in the C++ file as well


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:372
@@ +371,3 @@
+CMIUtilString
+CMICmnLLDBUtilSBValue::GetValueSummary() const
+{

I might be missing something, but how is this going to work when an SBValue has 
a value but no summary (something as simple as int x = 1;)?

GetSummary() is free to return NULL, and I only see you fetching the value here 
when there is a summary. Your logic should be more like

GetSummary()
if (!summary || summary && DoesPrintValue())
 append value

A very long-term goal of mine is for all of this logic to exist in the 
ValueObjectPrinter and clients to simply be able to ask it to print a 
ValueObject according to some specification of theirs, in the middle of an 
existing stream. But that is way beyond the scope of your patch, so if you just 
clean up the logic here to do the right thing for values without summaries, I 
am happy.


http://reviews.llvm.org/D13058



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


[Lldb-commits] [lldb] r249117 - Teach 'type lookup' to pull types from clang modules; also add a test case

2015-10-01 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct  1 20:23:11 2015
New Revision: 249117

URL: http://llvm.org/viewvc/llvm-project?rev=249117&view=rev
Log:
Teach 'type lookup' to pull types from clang modules; also add a test case


Added:
lldb/trunk/test/functionalities/type_lookup/
lldb/trunk/test/functionalities/type_lookup/Makefile
lldb/trunk/test/functionalities/type_lookup/TestTypeLookup.py
lldb/trunk/test/functionalities/type_lookup/main.m
Modified:
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp?rev=249117&r1=249116&r2=249117&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Thu Oct  1 
20:23:11 2015
@@ -708,34 +708,57 @@ ObjCLanguage::GetTypeScavenger ()
 {
 bool result = false;
 
-Process* process = exe_scope->CalculateProcess().get();
-if (process)
+Target* target = exe_scope->CalculateTarget().get();
+if (target)
 {
-const bool create_on_demand = false;
-auto objc_runtime = 
process->GetObjCLanguageRuntime(create_on_demand);
-if (objc_runtime)
+if (auto clang_modules_decl_vendor = 
target->GetClangModulesDeclVendor())
 {
-auto decl_vendor = objc_runtime->GetDeclVendor();
-if (decl_vendor)
+std::vector  decls;
+ConstString key_cs(key);
+
+if (clang_modules_decl_vendor->FindDecls(key_cs, false, 
UINT32_MAX, decls) > 0 &&
+decls.size() > 0)
 {
-std::vector decls;
-ConstString name(key);
-decl_vendor->FindDecls(name, true, UINT32_MAX, decls);
-for (auto decl : decls)
+CompilerType module_type = 
ClangASTContext::GetTypeForDecl(decls.front());
+result = true;
+std::unique_ptr 
result(new ObjCScavengerResult(module_type));
+results.insert(std::move(result));
+}
+}
+}
+
+if (!result)
+{
+Process* process = exe_scope->CalculateProcess().get();
+if (process)
+{
+const bool create_on_demand = false;
+auto objc_runtime = 
process->GetObjCLanguageRuntime(create_on_demand);
+if (objc_runtime)
+{
+auto decl_vendor = objc_runtime->GetDeclVendor();
+if (decl_vendor)
 {
-if (decl)
+std::vector decls;
+ConstString name(key);
+decl_vendor->FindDecls(name, true, UINT32_MAX, 
decls);
+for (auto decl : decls)
 {
-if (CompilerType candidate = 
ClangASTContext::GetTypeForDecl(decl))
+if (decl)
 {
-result = true;
-
std::unique_ptr result(new 
ObjCScavengerResult(candidate));
-results.insert(std::move(result));
+if (CompilerType candidate = 
ClangASTContext::GetTypeForDecl(decl))
+{
+result = true;
+
std::unique_ptr result(new 
ObjCScavengerResult(candidate));
+results.insert(std::move(result));
+}
 }
 }
 }
 }
 }
 }
+
 return result;
 }
 

Added: lldb/trunk/test/functionalities/type_lookup/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/type_lookup/Makefile?rev=249117&view=auto
==
--- lldb/trunk/test/functionalities/type_lookup/Makefile (added)
+++ lldb/trunk/test/functionalities/type_lookup/Makefile Thu Oct  1 20:23:11 
2015
@@ -0,0 +1,9 @@
+LEVEL = ../../make
+
+OBJC_SOURCES := main.m
+
+CFLAGS_EXTRAS += -w
+
+include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation

Added: lldb/trunk/test/functionalities/type_lookup/TestType

Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-10-02 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.

I am not deeply involved in MI internals, so I am going to assume you ran the 
test suite, and that you actually verified that types without summaries still 
work

In general, once you opt into data formatters, you get a lot more than simply 
UTF handling. I understand that this is your rationale for the change, but you 
may want to make sure that MI still does the right thing if users define 
formatters for types that have nothing to do with strings (e.g. what if 
somebody does define a summary for int or float?)

With that said, this looks reasonable, and an MI refactoring would be outside 
of my realm anyway.


http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

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

I Thought I had marked it as good to go.
My bad if I have not.

- Enrico


http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-10-02 Thread Enrico Granata via lldb-commits
I Thought I had marked it as good to go.
My bad if I have not. 

- Enrico
Sent from my iPhone

> On Oct 2, 2015, at 1:12 PM, Dawn Perchik  wrote:
> 
> dawn added a comment.
> 
> This patch is good to commit now right?  It's not marked "accepted" for some 
> reason.
> 
> 
> http://reviews.llvm.org/D13058
> 
> 
> 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r249185 - Add hooks that enable NSSet, NSDictionary and NSString formatting to apply to other types beyond the well-known ones

2015-10-02 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct  2 15:59:58 2015
New Revision: 249185

URL: http://llvm.org/viewvc/llvm-project?rev=249185&view=rev
Log:
Add hooks that enable NSSet, NSDictionary and NSString formatting to apply to 
other types beyond the well-known ones

This is meant to support languages that can do some sort of bridging from<-->to 
these ObjC types via types that statically vend themselves as Cocoa types, but 
dynamically have an implementation that does not match any of our well-known 
types, but where an introspecting formatter can be vended by the bridged 
language


Added:
lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.h
lldb/trunk/source/Plugins/Language/ObjC/NSSet.h
lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSString.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.h
lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=249185&r1=249184&r2=249185&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Oct  2 15:59:58 2015
@@ -780,6 +780,7 @@
94B6385D1B8FB178004FE1E4 /* CPlusPlusLanguage.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 94B6385B1B8FB174004FE1E4 /* 
CPlusPlusLanguage.cpp */; };
94B638631B8FB7F1004FE1E4 /* ObjCPlusPlusLanguage.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 94B638621B8FB7F1004FE1E4 /* 
ObjCPlusPlusLanguage.cpp */; };
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* 
ValueObjectSyntheticFilter.cpp */; };
+   94B9E5121BBF20F4000A48DC /* NSString.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 94B9E5111BBF20F4000A48DC /* NSString.cpp */; };
94BA8B6D176F8C9B005A91B5 /* Range.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 94BA8B6C176F8C9B005A91B5 /* Range.cpp */; };
94BA8B70176F97CE005A91B5 /* CommandHistory.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 94BA8B6F176F97CE005A91B5 /* CommandHistory.cpp 
*/; };
94CB255C16B069770059775D /* DataVisualization.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 94CB255816B069770059775D /* 
DataVisualization.cpp */; };
@@ -2523,6 +2524,10 @@
94B638621B8FB7F1004FE1E4 /* ObjCPlusPlusLanguage.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = ObjCPlusPlusLanguage.cpp; path = 
Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp; sourceTree = ""; };
94B6E76013D8833C005F417F /* ValueObjectSyntheticFilter.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
ValueObjectSyntheticFilter.h; path = 
include/lldb/Core/ValueObjectSyntheticFilter.h; sourceTree = ""; };
94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ValueObjectSyntheticFilter.cpp; path = 
source/Core/ValueObjectSyntheticFilter.cpp; sourceTree = ""; };
+   94B9E50E1BBEFDFE000A48DC /* NSDictionary.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NSDictionary.h; 
path = Language/ObjC/NSDictionary.h; sourceTree = ""; };
+   94B9E50F1BBF0069000A48DC /* NSSet.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NSSet.h; path = 
Language/ObjC/NSSet.h; sourceTree = ""; };
+   94B9E5101BBF20B7000A48DC /* NSString.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NSString.h; path = 
Language/ObjC/NSString.h; sourceTree = ""; };
+   94B9E5111BBF20F4000A48DC /* NSString.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = NSString.cpp; path = Language/ObjC/NSString.cpp; sourceTree = ""; 
};
94BA8B6C176F8C9B005A91B5 /* Range.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = Range.cpp; path = source/Utility/Range.cpp; sourceTree = ""; };
94BA8B6E176F8CA0005A91B5 /* Range.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Range.h; path = 
include/lldb/Utility/Range.h; sourceTree = ""; };
94BA8B6F176F97CE005A91B5 /* CommandHistory.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = CommandHistory.cpp; path = source/Interpreter/CommandHistory.cpp; 
sou

[Lldb-commits] [lldb] r249189 - Fix the CMake build

2015-10-02 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct  2 16:14:38 2015
New Revision: 249189

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

Modified:
lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt?rev=249189&r1=249188&r2=249189&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt Fri Oct  2 16:14:38 
2015
@@ -7,4 +7,5 @@ add_lldb_library(lldbPluginObjCLanguage
   NSDictionary.cpp
   NSIndexPath.cpp
   NSSet.cpp
+  NSString.cpp
 )


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


[Lldb-commits] [lldb] r249210 - Do not attempt to join the remote paths if none exist

2015-10-02 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct  2 17:53:32 2015
New Revision: 249210

URL: http://llvm.org/viewvc/llvm-project?rev=249210&view=rev
Log:
Do not attempt to join the remote paths if none exist

Modified:
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=249210&r1=249209&r2=249210&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Oct  2 17:53:32 2015
@@ -2407,7 +2407,7 @@ class TestBase(Base):
 if lldb.pre_flight:
 lldb.pre_flight(self)
 
-if lldb.remote_platform:
+if lldb.remote_platform and lldb.remote_platform_working_dir:
 remote_test_dir = lldbutil.join_remote_paths(
 lldb.remote_platform_working_dir,
 self.getArchitecture(),


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


[Lldb-commits] [lldb] r249366 - Introduce a FormattersMatchData class which contains all the information that data formatters need in one place, and also allows for lazy computation of expensive chunk

2015-10-05 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct  5 20:02:47 2015
New Revision: 249366

URL: http://llvm.org/viewvc/llvm-project?rev=249366&view=rev
Log:
Introduce a FormattersMatchData class which contains all the information that 
data formatters need in one place, and also allows for lazy computation of 
expensive chunks of information if need be

This is a NFC commit that is essentially plumbing the new currency through the 
system


Modified:
lldb/trunk/include/lldb/DataFormatters/FormatClasses.h
lldb/trunk/include/lldb/DataFormatters/FormatManager.h
lldb/trunk/include/lldb/DataFormatters/LanguageCategory.h
lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
lldb/trunk/source/DataFormatters/FormatClasses.cpp
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/DataFormatters/LanguageCategory.cpp
lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/FormatClasses.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatClasses.h?rev=249366&r1=249365&r2=249366&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormatClasses.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatClasses.h Mon Oct  5 20:02:47 
2015
@@ -118,6 +118,36 @@ private:
 };
 
 typedef std::vector FormattersMatchVector;
+typedef std::vector CandidateLanguagesVector;
+
+class FormattersMatchData
+{
+public:
+FormattersMatchData (ValueObject&,
+ lldb::DynamicValueType);
+
+FormattersMatchVector
+GetMatchesVector ();
+
+ConstString
+GetTypeForCache ();
+
+CandidateLanguagesVector
+GetCandidateLanguages ();
+
+ValueObject&
+GetValueObject ();
+
+lldb::DynamicValueType
+GetDynamicValueType ();
+
+private:
+ValueObject& m_valobj;
+lldb::DynamicValueType m_dynamic_value_type;
+std::pair m_formatters_match_vector;
+ConstString m_type_for_cache;
+CandidateLanguagesVector m_candidate_languages;
+};
 
 class TypeNameSpecifierImpl
 {

Modified: lldb/trunk/include/lldb/DataFormatters/FormatManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatManager.h?rev=249366&r1=249365&r2=249366&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormatManager.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatManager.h Mon Oct  5 20:02:47 
2015
@@ -311,16 +311,16 @@ private:
 ConstString m_vectortypes_category_name;
 
 lldb::TypeFormatImplSP
-GetHardcodedFormat (ValueObject&,lldb::DynamicValueType);
+GetHardcodedFormat (FormattersMatchData&);
 
 lldb::TypeSummaryImplSP
-GetHardcodedSummaryFormat (ValueObject&,lldb::DynamicValueType);
+GetHardcodedSummaryFormat (FormattersMatchData&);
 
 lldb::SyntheticChildrenSP
-GetHardcodedSyntheticChildren (ValueObject&,lldb::DynamicValueType);
+GetHardcodedSyntheticChildren (FormattersMatchData&);
 
 lldb::TypeValidatorImplSP
-GetHardcodedValidator (ValueObject&,lldb::DynamicValueType);
+GetHardcodedValidator (FormattersMatchData&);
 
 TypeCategoryMap&
 GetCategories ()
@@ -338,6 +338,8 @@ private:
 
 void
 LoadVectorFormatters ();
+
+friend class FormattersMatchData;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/DataFormatters/LanguageCategory.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/LanguageCategory.h?rev=249366&r1=249365&r2=249366&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/LanguageCategory.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/LanguageCategory.h Mon Oct  5 
20:02:47 2015
@@ -31,51 +31,39 @@ public:
 LanguageCategory (lldb::LanguageType lang_type);
 
 bool
-Get (ValueObject& valobj,
- lldb::DynamicValueType dynamic,
- FormattersMatchVector matches,
+Get (FormattersMatchData& match_data,
  lldb::TypeFormatImplSP& format_sp);
 
 bool
-Get (ValueObject& valobj,
- lldb::DynamicValueType dynamic,
- FormattersMatchVector matches,
+Get (FormattersMatchData& match_data,
  lldb::TypeSummaryImplSP& format_sp);
 
 bool
-Get (ValueObject& valobj,
- lldb::DynamicValueType dynamic,
- FormattersMatchVector matches,
+Get (FormattersMatchData& match_data,
  lldb::SyntheticChildrenSP& format_sp);
 
 bool
-Get (ValueObject& valobj,
- lldb::DynamicValueType dynamic,
- FormattersMatchVector matches,
+Get (FormattersMatchData& match_data,
  lldb::TypeValidatorImplSP& format_sp);
 
 bool
-GetHardcoded

[Lldb-commits] [lldb] r249433 - Create a logging category that is specific to data formatters activity

2015-10-06 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Oct  6 12:55:14 2015
New Revision: 249433

URL: http://llvm.org/viewvc/llvm-project?rev=249433&view=rev
Log:
Create a logging category that is specific to data formatters activity


Modified:
lldb/trunk/include/lldb/Core/Logging.h
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/Logging.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp

Modified: lldb/trunk/include/lldb/Core/Logging.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Logging.h?rev=249433&r1=249432&r2=249433&view=diff
==
--- lldb/trunk/include/lldb/Core/Logging.h (original)
+++ lldb/trunk/include/lldb/Core/Logging.h Tue Oct  6 12:55:14 2015
@@ -48,6 +48,7 @@
 #define LIBLLDB_LOG_SYSTEM_RUNTIME  (1u << 26)
 #define LIBLLDB_LOG_JIT_LOADER  (1u << 27)
 #define LIBLLDB_LOG_LANGUAGE(1u << 28)
+#define LIBLLDB_LOG_DATAFORMATTERS  (1u << 29)
 #define LIBLLDB_LOG_ALL (UINT32_MAX)
 #define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS  |\
  LIBLLDB_LOG_THREAD   |\

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=249433&r1=249432&r2=249433&view=diff
==
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue Oct  6 12:55:14 2015
@@ -533,7 +533,7 @@ ScanBracketedRange (llvm::StringRef subp
 int64_t& index_lower,
 int64_t& index_higher)
 {
-Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+Log *log(lldb_private::GetLogIfAllCategoriesSet 
(LIBLLDB_LOG_DATAFORMATTERS));
 close_bracket_index = llvm::StringRef::npos;
 const size_t open_bracket_index = subpath.find('[');
 if (open_bracket_index == llvm::StringRef::npos)
@@ -670,7 +670,7 @@ ExpandIndexedExpression (ValueObject* va
  StackFrame* frame,
  bool deref_pointer)
 {
-Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+Log *log(lldb_private::GetLogIfAllCategoriesSet 
(LIBLLDB_LOG_DATAFORMATTERS));
 const char* ptr_deref_format = "[%d]";
 std::string ptr_deref_buffer(10,0);
 ::sprintf(&ptr_deref_buffer[0], ptr_deref_format, index);
@@ -731,7 +731,7 @@ DumpValue (Stream &s,
 if (valobj == NULL)
 return false;
 
-Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+Log *log(lldb_private::GetLogIfAllCategoriesSet 
(LIBLLDB_LOG_DATAFORMATTERS));
 Format custom_format = eFormatInvalid;
 ValueObject::ValueObjectRepresentationStyle val_obj_display = 
entry.string.empty() ? ValueObject::eValueObjectRepresentationStyleValue : 
ValueObject::eValueObjectRepresentationStyleSummary;
 

Modified: lldb/trunk/source/Core/Logging.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Logging.cpp?rev=249433&r1=249432&r2=249433&view=diff
==
--- lldb/trunk/source/Core/Logging.cpp (original)
+++ lldb/trunk/source/Core/Logging.cpp Tue Oct  6 12:55:14 2015
@@ -148,6 +148,7 @@ lldb_private::DisableLog (const char **c
 else if (0 == ::strcasecmp(arg, "os"))  flag_bits &= 
~LIBLLDB_LOG_OS;
 else if (0 == ::strcasecmp(arg, "jit")) flag_bits &= 
~LIBLLDB_LOG_JIT_LOADER;
 else if (0 == ::strcasecmp(arg, "language"))flag_bits &= 
~LIBLLDB_LOG_LANGUAGE;
+else if (0 == ::strncasecmp(arg, "formatters", 10))   
flag_bits &= ~LIBLLDB_LOG_DATAFORMATTERS;
 else
 {
 feedback_strm->Printf ("error:  unrecognized log category 
'%s'\n", arg);
@@ -224,6 +225,7 @@ lldb_private::EnableLog (StreamSP &log_s
 else if (0 == ::strncasecmp(arg, "watch", 5))   flag_bits |= 
LIBLLDB_LOG_WATCHPOINTS;
 else if (0 == ::strcasecmp(arg, "jit")) flag_bits |= 
LIBLLDB_LOG_JIT_LOADER;
 else if (0 == ::strcasecmp(arg, "language"))flag_bits |= 
LIBLLDB_LOG_LANGUAGE;
+else if (0 == ::strncasecmp(arg, "formatters", 10))   flag_bits |= 
LIBLLDB_LOG_DATAFORMATTERS;
 else
 {
 feedback_strm->Printf("error: unrecognized log category 
'%s'\n", arg);
@@ -254,6 +256,7 @@ lldb_private::ListLogCategories (Stream
  "  dyld - log shared library related activities\n"
  "  events - log broadcaster, listener and event queue 
activities\n"
  "  expr - log expressions\n"
+ "  formatters - log data formatters related a

[Lldb-commits] [lldb] r249503 - Introduce a variant of GetSummaryAsCString() that takes a LanguageType argument, and use it when crafting summaries by running selectors

2015-10-06 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Oct  6 20:41:23 2015
New Revision: 249503

URL: http://llvm.org/viewvc/llvm-project?rev=249503&view=rev
Log:
Introduce a variant of GetSummaryAsCString() that takes a LanguageType 
argument, and use it when crafting summaries by running selectors

This is the first in a series of commits that are meant to teach LLDB how to 
properly handle multi-language formatting of values


Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/DataFormatters/FormattersHelpers.cpp
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=249503&r1=249502&r2=249503&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Oct  6 20:41:23 2015
@@ -610,11 +610,12 @@ public:
 GetLocationAsCString ();
 
 const char *
-GetSummaryAsCString ();
+GetSummaryAsCString (lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
 
 bool
 GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
- std::string& destination);
+ std::string& destination,
+ lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
 
 bool
 GetSummaryAsCString (std::string& destination,

Modified: lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h?rev=249503&r1=249502&r2=249503&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersHelpers.h Tue Oct  6 
20:41:23 2015
@@ -89,7 +89,8 @@ namespace lldb_private {
 ExtractSummaryFromObjCExpression (ValueObject &valobj,
   const char* target_type,
   const char* selector,
-  Stream &stream);
+  Stream &stream,
+  lldb::LanguageType lang_type);
 
 lldb::ValueObjectSP
 CallSelectorOnObject (ValueObject &valobj,

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=249503&r1=249502&r2=249503&view=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Oct  6 20:41:23 2015
@@ -874,9 +874,10 @@ ValueObject::CreateChildAtIndex (size_t
 
 bool
 ValueObject::GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
-  std::string& destination)
+  std::string& destination,
+  lldb::LanguageType lang)
 {
-return GetSummaryAsCString(summary_ptr, destination, TypeSummaryOptions());
+return GetSummaryAsCString(summary_ptr, destination, 
TypeSummaryOptions().SetLanguage(lang));
 }
 
 bool
@@ -885,7 +886,7 @@ ValueObject::GetSummaryAsCString (TypeSu
   const TypeSummaryOptions& options)
 {
 destination.clear();
-
+
 // ideally we would like to bail out if passing NULL, but if we do so
 // we end up not providing the summary for function pointers anymore
 if (/*summary_ptr == NULL ||*/ m_is_getting_summary)
@@ -893,31 +894,38 @@ ValueObject::GetSummaryAsCString (TypeSu
 
 m_is_getting_summary = true;
 
+TypeSummaryOptions actual_options(options);
+
+if (actual_options.GetLanguage() == lldb::eLanguageTypeUnknown)
+actual_options.SetLanguage(GetPreferredDisplayLanguage());
+
 // this is a hot path in code and we prefer to avoid setting this string 
all too often also clearing out other
 // information that we might care to see in a crash log. might be useful 
in very specific situations though.
 /*Host::SetCrashDescriptionWithFormat("Trying to fetch a summary for %s 
%s. Summary provider's description is %s",
-GetTypeName().GetCString(),
-GetName().GetCString(),
-
summary_ptr->GetDescription().c_str());*/
+ GetTypeName().GetCString(),
+ GetName().GetCString(),
+ summary_ptr->GetDescription().c_str());*/
 
 if (UpdateValueIfNeeded (false) && summary_ptr)
 {
 if (HasSyntheticValue())
 m_synthetic_value->UpdateValueIfNeeded(); // the summary might 
depend on

[Lldb-commits] [lldb] r249506 - Enable the StringPrinter to have prefixes that are strings instead of just a single character; and also introduce a comparable suffix mechanism

2015-10-06 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Oct  6 21:06:48 2015
New Revision: 249506

URL: http://llvm.org/viewvc/llvm-project?rev=249506&view=rev
Log:
Enable the StringPrinter to have prefixes that are strings instead of just a 
single character; and also introduce a comparable suffix mechanism


Modified:
lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
lldb/trunk/source/DataFormatters/StringPrinter.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/StringPrinter.h?rev=249506&r1=249505&r2=249506&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/StringPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/StringPrinter.h Tue Oct  6 21:06:48 
2015
@@ -15,6 +15,7 @@
 #include "lldb/Core/DataExtractor.h"
 
 #include 
+#include 
 
 namespace lldb_private {
 namespace formatters
@@ -45,7 +46,8 @@ namespace lldb_private {
 m_location(0),
 m_process_sp(),
 m_stream(NULL),
-m_prefix_token(0),
+m_prefix_token(),
+m_suffix_token(),
 m_quote('"'),
 m_source_size(0),
 m_needs_zero_termination(true),
@@ -98,16 +100,43 @@ namespace lldb_private {
 }
 
 ReadStringAndDumpToStreamOptions&
-SetPrefixToken (char p)
+SetPrefixToken (const std::string& p)
 {
 m_prefix_token = p;
 return *this;
 }
 
-char
+ReadStringAndDumpToStreamOptions&
+SetPrefixToken (std::nullptr_t)
+{
+m_prefix_token.clear();
+return *this;
+}
+
+const char*
 GetPrefixToken () const
 {
-return m_prefix_token;
+return m_prefix_token.c_str();
+}
+
+ReadStringAndDumpToStreamOptions&
+SetSuffixToken (const std::string& p)
+{
+m_suffix_token = p;
+return *this;
+}
+
+ReadStringAndDumpToStreamOptions&
+SetSuffixToken (std::nullptr_t)
+{
+m_suffix_token.clear();
+return *this;
+}
+
+const char*
+GetSuffixToken () const
+{
+return m_suffix_token.c_str();
 }
 
 ReadStringAndDumpToStreamOptions&
@@ -206,7 +235,8 @@ namespace lldb_private {
 uint64_t m_location;
 lldb::ProcessSP m_process_sp;
 Stream* m_stream;
-char m_prefix_token;
+std::string m_prefix_token;
+std::string m_suffix_token;
 char m_quote;
 uint32_t m_source_size;
 bool m_needs_zero_termination;
@@ -223,7 +253,8 @@ namespace lldb_private {
 ReadBufferAndDumpToStreamOptions () :
 m_data(),
 m_stream(NULL),
-m_prefix_token(0),
+m_prefix_token(),
+m_suffix_token(),
 m_quote('"'),
 m_source_size(0),
 m_escape_non_printables(true),
@@ -263,16 +294,43 @@ namespace lldb_private {
 }
 
 ReadBufferAndDumpToStreamOptions&
-SetPrefixToken (char p)
+SetPrefixToken (const std::string& p)
 {
 m_prefix_token = p;
 return *this;
 }
 
-char
+ReadBufferAndDumpToStreamOptions&
+SetPrefixToken (std::nullptr_t)
+{
+m_prefix_token.clear();
+return *this;
+}
+
+const char*
 GetPrefixToken () const
 {
-return m_prefix_token;
+return m_prefix_token.c_str();
+}
+
+ReadBufferAndDumpToStreamOptions&
+SetSuffixToken (const std::string& p)
+{
+m_suffix_token = p;
+return *this;
+}
+
+ReadBufferAndDumpToStreamOptions&
+SetS

[Lldb-commits] [lldb] r249507 - Route the preferred-display-language mechanism to the ValueObjectPrinter and actually fill in a few gaps for dynamic and synthetic values to be able to adopt this in us

2015-10-06 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Tue Oct  6 21:36:35 2015
New Revision: 249507

URL: http://llvm.org/viewvc/llvm-project?rev=249507&view=rev
Log:
Route the preferred-display-language mechanism to the ValueObjectPrinter and 
actually fill in a few gaps for dynamic and synthetic values to be able to 
adopt this in useful ways


Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectConstResult.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp

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

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=249507&r1=249506&r2=249507&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Oct  6 21:36:35 2015
@@ -1242,6 +1242,9 @@ protected:
 bool
 IsChecksumEmpty ();
 
+void
+SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType);
+
 private:
 //--
 // For ValueObject only

Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=249507&r1=249506&r2=249507&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Tue Oct  6 21:36:35 
2015
@@ -105,6 +105,12 @@ public:
 virtual TypeImpl
 GetTypeImpl ();
 
+virtual lldb::LanguageType
+GetPreferredDisplayLanguage ();
+
+void
+SetPreferredDisplayLanguage (lldb::LanguageType);
+
 virtual bool
 GetDeclaration (Declaration &decl);
 

Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=249507&r1=249506&r2=249507&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Tue Oct  6 
21:36:35 2015
@@ -152,6 +152,12 @@ public:
 virtual void
 SetFormat (lldb::Format format);
 
+virtual lldb::LanguageType
+GetPreferredDisplayLanguage ();
+
+void
+SetPreferredDisplayLanguage (lldb::LanguageType);
+
 virtual bool
 GetDeclaration (Declaration &decl);
 

Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h?rev=249507&r1=249506&r2=249507&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h Tue Oct  6 
21:36:35 2015
@@ -61,6 +61,7 @@ struct DumpValueObjectOptions
 lldb::Format m_format = lldb::eFormatDefault;
 lldb::TypeSummaryImplSP m_summary_sp;
 std::string m_root_valobj_name;
+lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
 PointerDepth m_max_ptr_depth;
 bool m_use_synthetic : 1;
 bool m_scope_already_checked : 1;
@@ -252,6 +253,13 @@ struct DumpValueObjectOptions
 return *this;
 }
 
+DumpValueObjectOptions&
+SetVariableFormatDisplayLanguage (lldb::LanguageType lang = 
lldb::eLanguageTypeUnknown)
+{
+m_varformat_language = lang;
+return *this;
+}
+
 DumpValueObjectOptions&
 SetRunValidator (bool run = true)
 {

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=249507&r1=249506&r2=249507&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Oct  6 21:36:35 
2015
@@ -335,6 +335,7 @@ CommandObjectExpression::EvaluateExpress
 result_valobj_sp->SetFormat (format);
 
 DumpValueObjectOptions 
options(m_varobj_options.GetAsDumpOptions(m

Re: [Lldb-commits] [lldb] r249507 - Route the preferred-display-language mechanism to the ValueObjectPrinter and actually fill in a few gaps for dynamic and synthetic values to be able to adopt this i

2015-10-06 Thread Enrico Granata via lldb-commits
I am not done here.
Also, even once I am done, all that you will be able to see here is no 
regressions in existing functionality.

I am plumbing through a set of facilities that I need in order to make certain 
parts of data formatting logic Language-plugin based.

That is required to make it easier to support new source languages in a clean 
fashion.

Since the C++ and ObjC support is already there, there will be no (unintended) 
change in functionality. What you want to see here testing-wise is the lack of 
any regression for existing languages.

The benefits are to be reaped if you were to add support for a new source 
language, which then would require its own testing, ..., but I plan to do no 
such thing at the moment.

tl;dr existing tests cover this already; this is refactoring work

Sent from my iPhone

> On Oct 6, 2015, at 9:20 PM, Zachary Turner  wrote:
> 
> Actually upon further inspection it looks like the test that was updated was 
> not really anything new, but an update of an existing test to pass a new 
> argument through.
> 
> Can you add some tests that test this specific functionality?
> 
>> On Tue, Oct 6, 2015 at 9:09 PM Zachary Turner  wrote:
>> It looks like there's only 1 test added for all of this functionality from 
>> this and the last few commits, and that the test is specific to Objective C. 
>>  The functionality itself seems language agnostic though.  Is there any way 
>> to write a test that does not rely on a particular language?  That would 
>> improve the test coverage of this functionality.
>> 
>>> On Tue, Oct 6, 2015 at 7:38 PM Enrico Granata via lldb-commits 
>>>  wrote:
>>> Author: enrico
>>> Date: Tue Oct  6 21:36:35 2015
>>> New Revision: 249507
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=249507&view=rev
>>> Log:
>>> Route the preferred-display-language mechanism to the ValueObjectPrinter 
>>> and actually fill in a few gaps for dynamic and synthetic values to be able 
>>> to adopt this in useful ways
>>> 
>>> 
>>> Modified:
>>> lldb/trunk/include/lldb/Core/ValueObject.h
>>> lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
>>> lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
>>> lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
>>> lldb/trunk/source/Commands/CommandObjectExpression.cpp
>>> lldb/trunk/source/Commands/CommandObjectFrame.cpp
>>> lldb/trunk/source/Core/ValueObject.cpp
>>> lldb/trunk/source/Core/ValueObjectConstResult.cpp
>>> lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
>>> lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
>>> lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
>>> 
>>> lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
>>> 
>>> Modified: lldb/trunk/include/lldb/Core/ValueObject.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=249507&r1=249506&r2=249507&view=diff
>>> ==
>>> --- lldb/trunk/include/lldb/Core/ValueObject.h (original)
>>> +++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Oct  6 21:36:35 2015
>>> @@ -1242,6 +1242,9 @@ protected:
>>>  bool
>>>  IsChecksumEmpty ();
>>> 
>>> +void
>>> +SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType);
>>> +
>>>  private:
>>>  //--
>>>  // For ValueObject only
>>> 
>>> Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=249507&r1=249506&r2=249507&view=diff
>>> ==
>>> --- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
>>> +++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -105,6 +105,12 @@ public:
>>>  virtual TypeImpl
>>>  GetTypeImpl ();
>>> 
>>> +virtual lldb::LanguageType
>>> +GetPreferredDisplayLanguage ();
>>> +
>>> +void
>>> +SetPreferredDisplayLanguage (lldb::LanguageType);
>>> +
>>>  virtual bool
>>>  GetDeclaration (Declaration &decl);
>>> 
>>> 
>>> Mo

[Lldb-commits] [lldb] r249587 - This is the work I was building up to with my patches yesterday

2015-10-07 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct  7 13:36:53 2015
New Revision: 249587

URL: http://llvm.org/viewvc/llvm-project?rev=249587&view=rev
Log:
This is the work I was building up to with my patches yesterday

Introduce the notion of Language-based formatter prefix/suffix
This is meant for languages that share certain data types but present them in 
syntatically different ways, such that LLDB can now have language-based 
awareness of which of the syntax variations it has to present to the user when 
formatting those values

This is goodness for new languages and interoperability, but is NFC for 
existing languages. As such, existing tests cover this


Modified:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSString.h
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h
lldb/trunk/source/Target/Language.cpp

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

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

lldb/trunk/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py

lldb/trunk/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py
lldb/trunk/test/functionalities/data-formatter/nsdictionarysynth/main.m

lldb/trunk/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py

lldb/trunk/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=249587&r1=249586&r2=249587&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Wed Oct  7 13:36:53 2015
@@ -79,7 +79,7 @@ public:
 virtual lldb::LanguageType
 GetLanguageType () const = 0;
 
-bool
+virtual bool
 IsTopLevelFunction (Function& function);
 
 virtual lldb::TypeCategoryImplSP
@@ -106,6 +106,13 @@ public:
 virtual std::unique_ptr
 GetTypeScavenger ();
 
+// if an individual data formatter can apply to several types and cross a 
language boundary
+// it makes sense for individual languages to want to customize the 
printing of values of that
+// type by appending proper prefix/suffix information in language-specific 
ways
+virtual bool
+GetFormatterPrefixSuffix (ValueObject& valobj, ConstString type_hint,
+  std::string& prefix, std::string& suffix);
+
 // These are accessors for general information about the Languages lldb 
knows about:
 
 static lldb::LanguageType

Modified: lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CF.cpp?rev=249587&r1=249586&r2=249587&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/CF.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CF.cpp Wed Oct  7 13:36:53 2015
@@ -17,6 +17,7 @@
 #include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/Host/Endian.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Target.h"
 
@@ -42,6 +43,8 @@ lldb_private::formatters::CFAbsoluteTime
 bool
 lldb_private::formatters::CFBagSummaryProvider (ValueObject& valobj, Stream& 
stream, const TypeSummaryOptions& options)
 {
+static ConstString g_TypeHint("CFBag");
+
 ProcessSP process_sp = valobj.GetProcessSP();
 if (!process_sp)
 return false;
@@ -84,7 +87,9 @@ lldb_private::formatters::CFBagSummaryPr
 ValueObjectSP count_sp;
 StreamString expr;
 expr.Printf("(int)CFBagGetCount((void*)0x%" PRIx64 
")",valobj.GetPointerValue());
-if (process_sp->GetTarget().EvaluateExpression(expr.GetData(), 
frame_sp.get(), count_sp) != eExpressionCompleted)
+EvaluateExpressionOptions options;
+options.SetResultIsInternal(true);
+if (process_sp->GetTarget().EvaluateExpression(expr.GetData(), 
frame_sp.get(), count_sp, options) != eExpressionCompleted)
 return false;
 if (!count_sp)
 return false;
@@ -98,8 +103,21 @@ lldb_private::formatters::CFBagSummaryPr
 if (error.Fail())
 return false;
 }
-stream.Printf("@\"%u value%s\"",
-  

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

2015-10-12 Thread Enrico Granata via lldb-commits
granata.enrico requested changes to this revision.
granata.enrico added a comment.
This revision now requires changes to proceed.

Truth be told, I find this notation (numeric value + printable character) to be 
heavy and somewhat redundant

I would be happier with a model where printable characters print as the 
character, and non-printable ones print as the numeric value

With that said, if the MI really needs to do this for whatever reason, a 
solution would be for the MI to create its own formatters category and insert 
this formatter there. Since the char formatter is in the 'system' category, any 
other category you create should have higher priority and thus win the match 
and get to be the formatter of choice.
I am not sure whether the SB API allows CXXFormatterFunctions to be created, 
but this would be easy to add, so please feel free to do so and submit that 
change for review. I will gladly look at it!


http://reviews.llvm.org/D13657



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


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

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

The consistency argument is not entirely unfair.

I would claim that Unicode is a more complex beast than plain ASCII, so it 
makes sense to go the extra mile in giving you details in that case, compared 
to the simpler char case.

If the only reason you're pursuing the patch is to appease the test case, I say 
"no" to the change.
If you think this is actually worthwhile on its own merits, I would rather much 
have either a separate "MI" formatters category.


http://reviews.llvm.org/D13657



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


Re: [Lldb-commits] [lldb] r250081 - Fix test for change in a summary string (objects -> elements).

2015-10-12 Thread Enrico Granata via lldb-commits

> On Oct 12, 2015, at 12:00 PM, Jim Ingham via lldb-commits 
>  wrote:
> 
> Author: jingham
> Date: Mon Oct 12 14:00:28 2015
> New Revision: 250081
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=250081&view=rev
> Log:
> Fix test for change in a summary string (objects -> elements).
> 
> Modified:
>lldb/trunk/test/lang/objc/hidden-ivars/TestHiddenIvars.py
> 
> Modified: lldb/trunk/test/lang/objc/hidden-ivars/TestHiddenIvars.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/hidden-ivars/TestHiddenIvars.py?rev=250081&r1=250080&r2=250081&view=diff
> ==
> --- lldb/trunk/test/lang/objc/hidden-ivars/TestHiddenIvars.py (original)
> +++ lldb/trunk/test/lang/objc/hidden-ivars/TestHiddenIvars.py Mon Oct 12 
> 14:00:28 2015
> @@ -129,14 +129,14 @@ class HiddenIvarsTestCase(TestBase):
> substrs = ["= 3"])
> 
> self.expect("expression k.filteredDataSource", 
> VARIABLES_DISPLAYED_CORRECTLY,
> -substrs = [' = 0x', '"2 objects"'])
> +substrs = [' = 0x', '"2 elements"'])
> 
> if strip:
> self.expect("expression *(k)", VARIABLES_DISPLAYED_CORRECTLY,
> -substrs = ["foo = 2", ' = 0x', '"2 objects"'])
> +substrs = ["foo = 2", ' = 0x', '"2 elements"'])
> else:
> self.expect("expression *(k)", VARIABLES_DISPLAYED_CORRECTLY,
> -substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', 
> '"2 objects"'])
> +substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', 
> '"2 elements"'])
> 
> def frame_var(self, strip):
> self.common_setup(strip)
> @@ -160,14 +160,14 @@ class HiddenIvarsTestCase(TestBase):
> substrs = ["= 2"])
> 
> self.expect("frame variable k->_filteredDataSource", 
> VARIABLES_DISPLAYED_CORRECTLY,
> -substrs = [' = 0x', '"2 objects"'])
> +substrs = [' = 0x', '"2 elements"'])
> 
> if strip:
> self.expect("frame variable *k", VARIABLES_DISPLAYED_CORRECTLY,
> -substrs = ["foo = 2", '_filteredDataSource = 0x', '"2 
> objects"'])
> +substrs = ["foo = 2", '_filteredDataSource = 0x', '"2 
> elements"'])
> else:
> self.expect("frame variable *k", VARIABLES_DISPLAYED_CORRECTLY,
> -substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', 
> '"2 objects"'])
> +substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', 
> '"2 elements"'])
> 
> 
> if __name__ == '__main__':
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Ops… Thanks for fixing this!

Thanks,
- Enrico
šŸ“© egranata@.com ā˜Žļø 27683

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


Re: [Lldb-commits] [PATCH] D13678: [libstdc++ data-formatters] Remove size limits and loop detector.

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

Why are you removing the loop detection?

As for the size capping, yes, if you remove the loop detection it will be less 
of a problem because downstream commands (e.g. frame variable) will actually 
cap how many elements get fetched unless the user overrides that determination 
(or the API is used directly to retrieve values)


http://reviews.llvm.org/D13678



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


Re: [Lldb-commits] [PATCH] D13678: [libstdc++ data-formatters] Remove size limits and loop detector.

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

Possibility number 3 (and the true reason why the check is there): if you stop 
at a place where the variable is not fully initialized/being torn down, and as 
a result, something is pointing back inside the list. For a list traversal, 
that is a deadly outcome.

This is (partially) the same reason why there's a cap on string summaries. It's 
fairly unlikely that a user will truly have a 3GB string (if they did, we might 
still want to cap it, but it's unlikely to begin with): an uninitialized string 
that claims to have a 3GB buffer.

I think there are ways to make this code smarter. For instance, if you have to 
get node #10, you could only check for a loop up until node #10, and so on..
If you store the state of the loop-checker as you get out, you might get away 
without having to check the same nodes multiple times as you progress deeper 
into the list

Drawback is that you would have already handed out at least some data by the 
time you find out the list is flawed. You can decide for yourself if that is a 
problem or not (the list might be partially valid, and returning some of the 
data is actually a good thing, maybe?)


http://reviews.llvm.org/D13678



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


Re: [Lldb-commits] [PATCH] D13678: [libstdc++ data-formatters] Remove size limits and loop detector.

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

Removing the size limit would be acceptable, yes

It is a remnant of a time when LLDB lacked ways to actually cap data at the 
command-line level and the Xcode UI did not do lazy fetching of values

Given that these things now work properly, the ability to generate *all* 
children for large lists should be safe


http://reviews.llvm.org/D13678



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


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

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

Currently I don't think SBTypeSummary allows for defining formatters backed by 
a CXXFunctionSummaryFormat
It would, however, be a great addition to our API. Is it a change you're 
interested in working on?

If so, the easy part is going to be introducing LLVM-style RTTI for 
TypeSummaryImpl such that one can replace the ->IsScripted() calls with a 
proper switch over all kinds of summaries (there's three, you're gonna want to 
introduce a fourth - read below).
The slightly more interesting part is that currently CXXFunctionSummaryFormat 
expects to transact in ValueObjects and std::strings. These are things we 
cannot expose at the SB layer. So we might need to add yet another kind of 
summary that instead takes an SBValue, an SBSummaryOptions and fills in an 
SBStream. Once we have that, the MI could actually use the functionality to 
register its own summaries (and if we find SBValue to be lackluster in any way 
as a result, we should fill in those gaps).


http://reviews.llvm.org/D13657



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


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

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

We are not supposed to be inheriting from SB classes, much less introduce 
virtual-ness to them (Greg can go in detail about the reasons, the tl;dr is 
that it has the potential to be ABI-breaking)

The way one would do that is to have a typedef akin to (and after fixing up any 
syntax errors and choosing a nice name)

typedef bool (*SBSummaryFormatterCallback)(SBValue, SBTypeSummaryOptions, 
SBStream&)

Unfortunately it has to be a C-style function pointer, and not an 
std::function, again because the SB API can't use the STL

Then you would have a creating function of the sort of:

SBTypeSummary::CreateCxxFunctionSummary(const char* name, const char* 
description, SBSummaryFormatterCallback callback)
(CxxFunctionSummary is definitely not great as a name, but I have no better 
suggestion right now - let's worry about that once we have some code up and 
running)

You might need to make yourself a subclass of TypeSummaryImpl in the .cpp file 
to store these formatters. It will essentially be very similar to 
CXXFunctionSummaryFormat except it would end up using the 
SBSummaryFormatterCallback typedef - and also it has to live in the 
SBTypeSummary.cpp because we can't put things that reference the SB API in 
lldb_private. Notice that, if you're so inclined, your helper class *can* 
actually use an std::function, and have virtual functions, and all such 
niceties, because it is an implementation-only detail not exposed to API clients


http://reviews.llvm.org/D13657



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


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

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

Admittedly way simpler than my original idea. +1

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



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

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


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

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


http://reviews.llvm.org/D13657



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


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

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


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

Should we check for cb != null here?


http://reviews.llvm.org/D13657



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


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

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

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

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


Repository:
  rL LLVM

http://reviews.llvm.org/D13699



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


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

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


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

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


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

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


http://reviews.llvm.org/D13657



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


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

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

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



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

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

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


http://reviews.llvm.org/D13657



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


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

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

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


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

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

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

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

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


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


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

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

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


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

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


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


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

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

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

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

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

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

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

Re: [Lldb-commits] [PATCH] D13577: Fix build with python disabled after r249597

2015-10-15 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.

Looks fine to me


Repository:
  rL LLVM

http://reviews.llvm.org/D13577



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


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

2015-10-15 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

Fine to get it in


http://reviews.llvm.org/D13657



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


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

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

What do you plan to use this has_child_at_index call for?

My concern is that it adds complication to the synthetic child provider 
interface. Yes, I understand it is optional, but it seems like yet another 
thing in the "any children?" realm that I would rather much avoid if possible. 
Which is why my question. Let's start from the use case and see if we can come 
up with anything else that could cover it.


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] D13778: [SBValue] Add a method HasChildAtIndex.

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

Is it possible to ask for concrete examples?

As in, for example, do you plan to change ValueObjectPrinter to use this API in 
some way?
Or do you have any specific synthetic providers that you would like to use this 
API in?


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] D13778: [SBValue] Add a method HasChildAtIndex.

2015-10-15 Thread Enrico Granata via lldb-commits
granata.enrico requested changes to this revision.
granata.enrico added a comment.
This revision now requires changes to proceed.

If so, why do you need this to be exposed as a call that LLDB knows about?

You are free to provide any methods you want in your synthetic child providers. 
Adding them to the interface as this patch does is only necessary if you want 
LLDB to use the new methods as part of its interaction with the child provider.


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] D13778: [SBValue] Add a method HasChildAtIndex.

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

So, if I understand this correctly, this HasChildAtIndex() API returns a 
three-state int:

1 == yes I do
0 == no I do not
-1 == maybe, can't tell

When would you ever run into the -1 case? It seems you're mostly using it as an 
invalid marker. Would 0 not be a better choice for those invalid cases? Then 
you could just use a boolean which seems a better answer for an inherently 
yes/no question (invalid objects do not have a child at index for any index, do 
they?)

Also, if you're only using this from inside a synthetic child provider, why 
does it need to be in SBValue? Or is your argument that you want to write 
scripts against LLDB that use this feature?

Truth be told, I am not particularly excited about this feature, and the fact 
that this seems to be introduced in a vacuum does nothing to assuage my 
original concern that is is a potentially avoidable complication to the model.


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] D13778: [SBValue] Add a method HasChildAtIndex.

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

One alternative would be to have the num_children method on the synthetic 
provider itself be able to take an optional argument that is the max_count. 
That is, instead of defining

  def num_children(self):
..

You would instead define

  def num_children(self, max_count):
..

Of course, you would need to continue supporting both possible signatures in 
order to maintain compatibility with existing formatters. But we do have some 
support for that. If you look at LLDBSwigPythonCallCommand:

  PyCallable::argc argc = pfunc.GetNumArguments();
  if (argc.num_args == 5 || argc.varargs == true)
  pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb, 
session_dict = FindSessionDictionary(session_dictionary_name));
  else
  pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = 
FindSessionDictionary(session_dictionary_name));

num_children could start doing something similar for 1 vs. 2 arguments


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] 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&view=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&r1=250566&r2=250567&view=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&r1=250566&r2=250567&view=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 = scri

[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&view=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&r1=250580&r2=250581&view=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] [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&view=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&r1=250598&r2=250599&view=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&r1=250598&r2=250599&view=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 && 
!options.m_flat_output);
 
+StreamString typeName;
+
+// always show the type at the root level if it is invalid
 if (show_ty

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

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


Comment at: include/lldb/API/SBValue.h:372
@@ +371,3 @@
+bool
+IsIntegerType(bool& is_signed);
+

Greg pointed me to SBType::GetBasicType() - this will return to you one of

```
eBasicTypeSignedChar,
eBasicTypeUnsignedChar,

```

such that you don't need to add new API to get this information

Also, even if this were necessary, it would go on SBType, definitely not SBValue


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] r250734 - Teach the lldbinline test cases to run in DWO mode

2015-10-19 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 19 15:40:50 2015
New Revision: 250734

URL: http://llvm.org/viewvc/llvm-project?rev=250734&view=rev
Log:
Teach the lldbinline test cases to run in DWO mode


Modified:
lldb/trunk/test/lldbinline.py

Modified: lldb/trunk/test/lldbinline.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbinline.py?rev=250734&r1=250733&r2=250734&view=diff
==
--- lldb/trunk/test/lldbinline.py (original)
+++ lldb/trunk/test/lldbinline.py Mon Oct 19 15:40:50 2015
@@ -127,6 +127,12 @@ class InlineTest(TestBase):
 self.buildDwarf()
 self.do_test()
 
+def __test_with_dwo(self):
+self.using_dsym = False
+self.BuildMakefile()
+self.buildDwo()
+self.do_test()
+
 def execute_user_command(self, __command):
 exec __command in globals(), locals()
 
@@ -186,6 +192,7 @@ def MakeInlineTest(__file, __globals, de
 
 test.test_with_dsym = 
ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators)
 test.test_with_dwarf = 
ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators)
+test.test_with_dwo = 
ApplyDecoratorsToFunction(test._InlineTest__test_with_dwo, decorators)
 
 # Add the test case to the globals, and hide InlineTest
 __globals.update({test_name : test})


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


[Lldb-commits] [lldb] r250744 - Let Language plugins vend a default DeclPrintingHelper in case a custom one is not specified for the specific invocation

2015-10-19 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 19 17:04:25 2015
New Revision: 250744

URL: http://llvm.org/viewvc/llvm-project?rev=250744&view=rev
Log:
Let Language plugins vend a default DeclPrintingHelper in case a custom one is 
not specified for the specific invocation


Added:
lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h
lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp
Modified:
lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/DataFormatters/CMakeLists.txt
lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
lldb/trunk/source/Target/Language.cpp

Added: lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h?rev=250744&view=auto
==
--- lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h (added)
+++ lldb/trunk/include/lldb/DataFormatters/DumpValueObjectOptions.h Mon Oct 19 
17:04:25 2015
@@ -0,0 +1,181 @@
+//===-- DumpValueObjectOptions.h ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef lldb_DumpValueObjectOptions_h_
+#define lldb_DumpValueObjectOptions_h_
+
+// C Includes
+// C++ Includes
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include 
+#include 
+
+namespace lldb_private {
+
+class DumpValueObjectOptions
+{
+public:
+struct PointerDepth
+{
+enum class Mode
+{
+Always,
+Formatters,
+Default,
+Never
+} m_mode;
+uint32_t m_count;
+
+PointerDepth
+operator --() const
+{
+if (m_count > 0)
+return PointerDepth {m_mode,m_count-1};
+return PointerDepth {m_mode,m_count};
+}
+
+bool
+CanAllowExpansion () const;
+
+bool
+CanAllowExpansion (bool is_root,
+   TypeSummaryImpl* entry,
+   ValueObject *valobj,
+   const std::string& summary);
+};
+
+typedef std::function DeclPrintingHelper;
+
+public:
+static const DumpValueObjectOptions
+DefaultOptions()
+{
+static DumpValueObjectOptions g_default_options;
+
+return g_default_options;
+}
+
+DumpValueObjectOptions();
+
+DumpValueObjectOptions (const DumpValueObjectOptions& rhs) = default;
+
+DumpValueObjectOptions (ValueObject& valobj);
+
+DumpValueObjectOptions&
+SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never,0});
+
+DumpValueObjectOptions&
+SetMaximumDepth(uint32_t depth = 0);
+
+DumpValueObjectOptions&
+SetDeclPrintingHelper(DeclPrintingHelper helper);
+
+DumpValueObjectOptions&
+SetShowTypes(bool show = false);
+
+DumpValueObjectOptions&
+SetShowLocation(bool show = false);
+
+DumpValueObjectOptions&
+SetUseObjectiveC(bool use = false);
+
+DumpValueObjectOptions&
+SetShowSummary(bool show = true);
+
+DumpValueObjectOptions&
+SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
+
+DumpValueObjectOptions&
+SetUseSyntheticValue(bool use_synthetic = true);
+
+DumpValueObjectOptions&
+SetScopeChecked(bool check = true);
+
+DumpValueObjectOptions&
+SetFlatOutput(bool flat = false);
+
+DumpValueObjectOptions&
+SetOmitSummaryDepth(uint32_t depth = 0);
+
+DumpValueObjectOptions&
+SetIgnoreCap(bool ignore = false);
+
+DumpValueObjectOptions&
+SetRawDisplay();
+
+DumpValueObjectOptions&
+SetFormat (lldb::Format format = lldb::eFormatDefault);
+
+DumpValueObjectOptions&
+SetSummary (lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
+
+DumpValueObjectOptions&
+SetRootValueObjectName (const char* name = NULL);
+
+DumpValueObjectOptions&
+SetHideRootType (bool hide_root_type = false);
+
+DumpValueObjectOptions&
+SetHideName (bool hide_name = false);
+
+DumpValueObjectOptions&
+SetHideValue (bool hide_value = false);
+
+DumpValueObjectOptions&
+SetHidePointerValue (bool hide = false);
+
+DumpValueObjectOptions&
+SetVariableFormatDisplayLanguage (lldb::LanguageType lang = 
lldb::eLanguageTypeUnknown);
+
+DumpValueObjectOptions&
+SetRunValidator (bool run = true);

[Lldb-commits] [lldb] r250750 - Add a flakey category for flakey tests

2015-10-19 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 19 17:53:34 2015
New Revision: 250750

URL: http://llvm.org/viewvc/llvm-project?rev=250750&view=rev
Log:
Add a flakey category for flakey tests

Modified:
lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=250750&r1=250749&r2=250750&view=diff
==
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Mon Oct 19 17:53:34 2015
@@ -87,7 +87,8 @@ validCategories = {
 'basic_process': 'Basic process execution sniff tests.',
 'cmdline' : 'Tests related to the LLDB command-line interface',
 'dyntype' : 'Tests related to dynamic type support',
-'stresstest' : 'Tests related to stressing lldb limits'
+'stresstest' : 'Tests related to stressing lldb limits',
+'flakey' : 'Flakey test cases, i.e. tests that do not reliably pass at each 
execution'
 }
 
 # The test suite.


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


Re: [Lldb-commits] [PATCH] D13878: Add data formatters for go strings and slices.

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


Comment at: source/Plugins/Language/Go/GoFormatterFunctions.cpp:104
@@ +103,3 @@
+size_t m_len;
+std::vector m_children;
+};

This worries me a little bit

Imagine I have one of these slices with a million elements, and the user gets 
in and the first thing they do is GetChildAtIndex(75); then 
GetChildAtIndex(134621); then GetChildAtIndex(99)

Now I have allocated one million shared pointers, even though only three are in 
use

How about std::map?


Comment at: source/Plugins/Language/Go/GoFormatterFunctions.cpp:145
@@ +144,3 @@
+
+StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+options.SetLocation(valobj_addr);

I would also do options.SetLanguage(eLanguageTypeGo) here - in case you ever 
want to do custom escaping, or the StringPrinter gains any further 
language-specific abilities


Comment at: source/Plugins/Language/Go/GoLanguage.cpp:79
@@ +78,3 @@
+HardcodedFormatters::HardcodedSummaryFinder
+GoLanguage::GetHardcodedSummaries ()
+{

Any reason why you need to use hardcoded formatters here?

Do strings and slices not have simple type names to match against in Go?

If at all possible, I would prefer to see you add formatters by name instead of 
hardcoded matches. Hardcoded matches are really meant for cases where the 
predicate you're trying to express is something a type name or regular 
expression on type names can't capture.


Repository:
  rL LLVM

http://reviews.llvm.org/D13878



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


[Lldb-commits] [lldb] r250767 - Introduce the concept of a type that is meaningless without dynamic resolution, which are essentially placeholder types meant to appease a language's type system but do

2015-10-19 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 19 19:13:19 2015
New Revision: 250767

URL: http://llvm.org/viewvc/llvm-project?rev=250767&view=rev
Log:
Introduce the concept of a type that is meaningless without dynamic resolution, 
which are essentially placeholder types meant to appease a language's type 
system but do not offer any actual information to the debugger, unless further 
resolved

This is currently meant for data formatters to know to ignore such types in 
caching and lookup


Modified:
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=250767&r1=250766&r2=250767&view=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Mon Oct 19 19:13:19 2015
@@ -462,6 +462,9 @@ public:
 LazyBool
 ShouldPrintAsOneLiner () const;
 
+bool
+IsMeaninglessWithoutDynamicResolution () const;
+
 //--
 // Pointers & References
 //--

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=250767&r1=250766&r2=250767&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Mon Oct 19 19:13:19 2015
@@ -528,6 +528,18 @@ public:
 virtual LazyBool
 ShouldPrintAsOneLiner (void* type);
 
+// Type systems can have types that are placeholder types, which are meant 
to indicate
+// the presence of a type, but offer no actual information about said 
types, and leave
+// the burden of actually figuring type information out to dynamic type 
resolution. For instance
+// a language with a generics system, can use placeholder types to 
indicate "type argument goes here",
+// without promising uniqueness of the placeholder, nor attaching any 
actually idenfiable information
+// to said placeholder. This API allows type systems to tell LLDB when 
such a type has been encountered
+// In response, the debugger can react by not using this type as a cache 
entry in any type-specific way
+// For instance, LLDB will currently not cache any formatters that are 
discovered on such a type as
+// attributable to the meaningless type itself, instead preferring to use 
the dynamic type
+virtual bool
+IsMeaninglessWithoutDynamicResolution (void* type);
+
 protected:
 const LLVMCastKind m_kind; // Support for llvm casting
 SymbolFile *m_sym_file;

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=250767&r1=250766&r2=250767&view=diff
==
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Mon Oct 19 19:13:19 2015
@@ -210,11 +210,15 @@ FormatManager::GetPossibleMatches (Value
 
entries.push_back({bitfieldname,0,did_strip_ptr,did_strip_ref,did_strip_typedef});
 reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
 }
-
entries.push_back({type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
 
-ConstString display_type_name(compiler_type.GetDisplayTypeName());
-if (display_type_name != type_name)
-
entries.push_back({display_type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
+if (!compiler_type.IsMeaninglessWithoutDynamicResolution())
+{
+
entries.push_back({type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
+
+ConstString display_type_name(compiler_type.GetDisplayTypeName());
+if (display_type_name != type_name)
+
entries.push_back({display_type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
+}
 
 for (bool is_rvalue_ref = true, j = true; j && 
compiler_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false)
 {
@@ -641,22 +645,12 @@ ConstString
 FormatManager::GetTypeForCache (ValueObject& valobj,
 lldb::DynamicValueType use_dynamic)
 {
-if (use_dynamic == lldb::eNoDynamicValues)
+ValueObjectSP valobj_sp = 
valobj.GetQualifiedRepresentationIfAvailable(use_dynamic, valobj.IsSynthetic());
+if (valobj_sp && valobj_sp->GetCompilerType().IsValid())
 {
-if (valobj.IsDynamic())
-  

[Lldb-commits] [lldb] r250798 - Rationalization of includes in the data formatters code

2015-10-19 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 19 23:50:09 2015
New Revision: 250798

URL: http://llvm.org/viewvc/llvm-project?rev=250798&view=rev
Log:
Rationalization of includes in the data formatters code

Modified:
lldb/trunk/include/lldb/DataFormatters/CXXFunctionPointer.h
lldb/trunk/include/lldb/DataFormatters/FormatManager.h
lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
lldb/trunk/include/lldb/DataFormatters/VectorIterator.h
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/DataFormatters/CXXFunctionPointer.cpp
lldb/trunk/source/DataFormatters/DataVisualization.cpp
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/DataFormatters/FormattersHelpers.cpp
lldb/trunk/source/DataFormatters/StringPrinter.cpp
lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
lldb/trunk/source/DataFormatters/TypeFormat.cpp
lldb/trunk/source/DataFormatters/TypeSummary.cpp
lldb/trunk/source/DataFormatters/TypeSynthetic.cpp
lldb/trunk/source/DataFormatters/VectorType.cpp
lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/CXXFunctionPointer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/CXXFunctionPointer.h?rev=250798&r1=250797&r2=250798&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/CXXFunctionPointer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/CXXFunctionPointer.h Mon Oct 19 
23:50:09 2015
@@ -10,9 +10,7 @@
 #ifndef liblldb_CXXFunctionPointer_h_
 #define liblldb_CXXFunctionPointer_h_
 
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb-forward.h"
 
 namespace lldb_private {
 namespace formatters

Modified: lldb/trunk/include/lldb/DataFormatters/FormatManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatManager.h?rev=250798&r1=250797&r2=250798&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormatManager.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatManager.h Mon Oct 19 23:50:09 
2015
@@ -18,8 +18,6 @@
 #include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
 
-#include "lldb/Core/ThreadSafeDenseMap.h"
-
 #include "lldb/DataFormatters/FormatCache.h"
 #include "lldb/DataFormatters/FormatClasses.h"
 #include "lldb/DataFormatters/FormattersContainer.h"

Modified: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h?rev=250798&r1=250797&r2=250798&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h Mon Oct 19 
23:50:09 2015
@@ -19,24 +19,14 @@
 // Project includes
 #include "lldb/lldb-public.h"
 
-#include "lldb/Core/Log.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/ValueObject.h"
-
 #include "lldb/DataFormatters/FormatClasses.h"
 #include "lldb/DataFormatters/TypeFormat.h"
 #include "lldb/DataFormatters/TypeSummary.h"
 #include "lldb/DataFormatters/TypeSynthetic.h"
 #include "lldb/DataFormatters/TypeValidator.h"
-
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompilerType.h"
-
-#include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/StackFrame.h"
-#include "lldb/Target/TargetList.h"
-
 #include "lldb/Utility/StringLexer.h"
 
 namespace lldb_private {

Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=250798&r1=250797&r2=250798&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Mon Oct 19 23:50:09 
2015
@@ -27,8 +27,6 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/StructuredData.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Symbol/Type.h"
 
 namespace lldb_private {
 class TypeSummaryOptions

Modified: lldb/trunk/include/lldb/DataFormatters/VectorIterator.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/VectorIterator.h?rev=250798&r1=250797&r2=250798&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/VectorIterator.h (original)
+++ lldb/trunk/include/lldb/DataFormatt

Re: [Lldb-commits] [PATCH] D13902: [DataFormatters] Make libc++ list loop detection linear

2015-10-20 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

That looks reasonable. Of course, I assume you ran the test suite on OS X, 
including your new evil test!


http://reviews.llvm.org/D13902



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


Re: [Lldb-commits] [PATCH] D13836: Fix write-after-close of file descriptor in ScriptInterpreterPython

2015-10-20 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.

Looks reasonable


http://reviews.llvm.org/D13836



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


Re: [Lldb-commits] [lldb] r248028 - Make libc++ tests skip themselves if libc++ is not actually loaded in the target

2015-10-20 Thread Enrico Granata via lldb-commits

> On Oct 20, 2015, at 10:43 AM, Pavel Labath  wrote:
> 
> Hi Enrico,
> 
> Could you explain what was the motivation behind this change?
> 

As per title of the commit, in a process that is using a standard c++ library 
other than libc++, these tests are noise - of course the libc++ tests aren’t 
gonna pass if you don’t have libc++

> I am asking because, I have just learned that this commit has caused
> all libc++ tests to be skipped on linux*, silently decreasing test
> coverage on linux. I would like to replace this with some other
> mechanism, which is not prone to accidental silent skips, like a
> dotest flag to skip libc++ or something, but I'd like to understand
> the original motivation first.
> 
> pl
> 
> * the problem seems to be that on linux, we do not have the list of
> modules until we actually start the process, so this code will not
> find the library, as it runs before that.

The solution might then be to run the process, and then skip_if_library_missing
I think we avoid trying to compile the test inferior entirely if we can’t find 
libc++ however, so you might first want to check if a.out exists at all, and 
only then proceed all the way to the first breakpoint being hit

> If is considered a bug then
> we can look into that separately, but I'd still like to avoid these
> kinds of skips.
> 

What I am trying to avoid here is getting useless noise in build automation 
where test cases proclaim their failure, which however tells us nothing of 
value as the issue is simply ā€œlibc++ not availableā€ vs. ā€œdata formatters brokenā€
That is an ability I would strongly like to preserve

> 
> On 18 September 2015 at 21:12, Enrico Granata via lldb-commits
>  wrote:
>> Author: enrico
>> Date: Fri Sep 18 15:12:52 2015
>> New Revision: 248028
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=248028&view=rev
>> Log:
>> Make libc++ tests skip themselves if libc++ is not actually loaded in the 
>> target
>> 
>> 
>> Modified:
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
>>
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
>>lldb/trunk/test/lldbutil.py
>> 
>> Modified: 
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py?rev=248028&r1=248027&r2=248028&view=diff
>> ==
>> --- 
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
>>  (original)
>> +++ 
>> lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
>>  Fri Sep 18 15:12:52 2015
>> @@ -36,6 +36,8 @@ class InitializerListTestCase(TestBase):
>> """Test that that file and class static variables display 
>> correctly."""
>> self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
>> 
>> +lldbutil.skip_if_library_missing(self, self.target(), 
>> lldbutil.PrintableRegex("libc\+\+"))
>> +
>> bkpt = 
>> self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp 
>> (self, "Set break point at this

Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method GetNumChildren(uint32_t max)

2015-10-20 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

Looks fine


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] D13964: Fix libstdc++ data formatters on Ubuntu 15.10 x86_64

2015-10-21 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

Looks good to me


http://reviews.llvm.org/D13964



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


[Lldb-commits] [lldb] r251161 - Lower the depth of the recursion in this test since it would on occasion timeout and add noise to test runs

2015-10-23 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct 23 19:15:57 2015
New Revision: 251161

URL: http://llvm.org/viewvc/llvm-project?rev=251161&view=rev
Log:
Lower the depth of the recursion in this test since it would on occasion 
timeout and add noise to test runs

Modified:
lldb/trunk/test/functionalities/recursion/TestValueObjectRecursion.py

Modified: lldb/trunk/test/functionalities/recursion/TestValueObjectRecursion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/recursion/TestValueObjectRecursion.py?rev=251161&r1=251160&r2=251161&view=diff
==
--- lldb/trunk/test/functionalities/recursion/TestValueObjectRecursion.py 
(original)
+++ lldb/trunk/test/functionalities/recursion/TestValueObjectRecursion.py Fri 
Oct 23 19:15:57 2015
@@ -49,7 +49,7 @@ class ValueObjectRecursionTestCase(TestB
 if self.TraceOn():
  print(root)
  print(child)
-for i in range(0,24500):
+for i in range(0,15000):
  child = child.GetChildAtIndex(1)
 if self.TraceOn():
  print(child)


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


[Lldb-commits] [lldb] r251368 - Change TestTypeCompletion to not rely on std::string

2015-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 26 18:39:12 2015
New Revision: 251368

URL: http://llvm.org/viewvc/llvm-project?rev=251368&view=rev
Log:
Change TestTypeCompletion to not rely on std::string

On some combination of platform and c++ library, this dependency was causing 
the test to fail for reasons tangential to its real objective


Modified:
lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py
lldb/trunk/test/functionalities/type_completion/main.cpp

Modified: lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py?rev=251368&r1=251367&r2=251368&view=diff
==
--- lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py 
(original)
+++ lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py Mon 
Oct 26 18:39:12 2015
@@ -73,14 +73,10 @@ class TypeCompletionTestCase(TestBase):
 self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be 
valid')
 self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress 
should now be complete')
 field0 = name_address_type.GetFieldAtIndex(0)
-if self.TraceOn():
- print('field0: ' + str(field0))
 self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be 
valid')
 string = field0.GetType().GetPointeeType()
-if self.TraceOn():
- print('string: ' + str(string))
-self.assertTrue(string.IsValid(), 'std::string should be valid')
-self.assertFalse(string.IsTypeComplete(), 'std::string complete but it 
should not be')
+self.assertTrue(string.IsValid(), 'CustomString should be valid')
+self.assertFalse(string.IsTypeComplete(), 'CustomString complete but 
it should not be')
 
 self.runCmd("continue")
 
@@ -91,17 +87,13 @@ class TypeCompletionTestCase(TestBase):
 self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be 
valid')
 self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress 
should now be complete')
 field0 = name_address_type.GetFieldAtIndex(0)
-if self.TraceOn():
- print('field0: ' + str(field0))
 self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be 
valid')
 string = field0.GetType().GetPointeeType()
-if self.TraceOn():
- print('string: ' + str(string))
-self.assertTrue(string.IsValid(), 'std::string should be valid')
-self.assertFalse(string.IsTypeComplete(), 'std::string complete but it 
should not be')
+self.assertTrue(string.IsValid(), 'CustomString should be valid')
+self.assertFalse(string.IsTypeComplete(), 'CustomString complete but 
it should not be')
 
 self.runCmd('type category enable -l c++', check=False)
-self.runCmd('frame variable guy --show-types')
+self.runCmd('frame variable guy --show-types --ptr-depth=1')
 
 p_vector = 
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
 p_type = p_vector.GetType()
@@ -112,5 +104,5 @@ class TypeCompletionTestCase(TestBase):
 field0 = name_address_type.GetFieldAtIndex(0)
 self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be 
valid')
 string = field0.GetType().GetPointeeType()
-self.assertTrue(string.IsValid(), 'std::string should be valid')
-self.assertTrue(string.IsTypeComplete(), 'std::string should now be 
complete')
+self.assertTrue(string.IsValid(), 'CustomString should be valid')
+self.assertTrue(string.IsTypeComplete(), 'CustomString should now be 
complete')

Modified: lldb/trunk/test/functionalities/type_completion/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/type_completion/main.cpp?rev=251368&r1=251367&r2=251368&view=diff
==
--- lldb/trunk/test/functionalities/type_completion/main.cpp (original)
+++ lldb/trunk/test/functionalities/type_completion/main.cpp Mon Oct 26 
18:39:12 2015
@@ -7,16 +7,45 @@
 //
 
//===--===//
 
-#include 
+#include 
 #include 
 #include 
 
+class CustomString
+{
+public:
+  CustomString (const char* buffer) :
+m_buffer(nullptr)
+  {
+if (buffer)
+{
+  auto l = strlen(buffer);
+  m_buffer = new char[1 + l];
+  strcpy(m_buffer, buffer);
+}
+  }
+  
+  ~CustomString ()
+  {
+delete[] m_buffer;
+  }
+  
+  const char*
+  GetBuffer ()
+  {
+return m_buffer;
+  }
+  
+private:
+  char *m_buffer;
+};
+
 class NameAndAddress
{
public:
-   std::string& GetName() { return *m_name; }
-   std::string& GetAddress() { return *m_address; }
-  

[Lldb-commits] [lldb] r251376 - Add calls to the SB API to access the multi-language formatter category feature

2015-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 26 20:10:35 2015
New Revision: 251376

URL: http://llvm.org/viewvc/llvm-project?rev=251376&view=rev
Log:
Add calls to the SB API to access the multi-language formatter category feature

Modified:
lldb/trunk/include/lldb/API/SBTypeCategory.h
lldb/trunk/scripts/interface/SBTypeCategory.i
lldb/trunk/source/API/SBTypeCategory.cpp

Modified: lldb/trunk/include/lldb/API/SBTypeCategory.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeCategory.h?rev=251376&r1=251375&r2=251376&view=diff
==
--- lldb/trunk/include/lldb/API/SBTypeCategory.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeCategory.h Mon Oct 26 20:10:35 2015
@@ -36,6 +36,15 @@ namespace lldb {
 const char*
 GetName();
 
+lldb::LanguageType
+GetLanguageAtIndex (uint32_t idx);
+
+uint32_t
+GetNumLanguages ();
+
+void
+AddLanguage (lldb::LanguageType language);
+
 bool
 GetDescription (lldb::SBStream &description, 
 lldb::DescriptionLevel description_level);

Modified: lldb/trunk/scripts/interface/SBTypeCategory.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTypeCategory.i?rev=251376&r1=251375&r2=251376&view=diff
==
--- lldb/trunk/scripts/interface/SBTypeCategory.i (original)
+++ lldb/trunk/scripts/interface/SBTypeCategory.i Mon Oct 26 20:10:35 2015
@@ -35,6 +35,15 @@ namespace lldb {
 const char*
 GetName();
 
+lldb::LanguageType
+GetLanguageAtIndex (uint32_t idx);
+
+uint32_t
+GetNumLanguages ();
+
+void
+AddLanguage (lldb::LanguageType language);
+
 bool
 GetDescription (lldb::SBStream &description, 
 lldb::DescriptionLevel description_level);

Modified: lldb/trunk/source/API/SBTypeCategory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeCategory.cpp?rev=251376&r1=251375&r2=251376&view=diff
==
--- lldb/trunk/source/API/SBTypeCategory.cpp (original)
+++ lldb/trunk/source/API/SBTypeCategory.cpp Mon Oct 26 20:10:35 2015
@@ -79,6 +79,29 @@ SBTypeCategory::GetName()
 return m_opaque_sp->GetName();
 }
 
+lldb::LanguageType
+SBTypeCategory::GetLanguageAtIndex (uint32_t idx)
+{
+if (IsValid())
+return m_opaque_sp->GetLanguageAtIndex(idx);
+return lldb::eLanguageTypeUnknown;
+}
+
+uint32_t
+SBTypeCategory::GetNumLanguages ()
+{
+if (IsValid())
+return m_opaque_sp->GetNumLanguages();
+return 0;
+}
+
+void
+SBTypeCategory::AddLanguage (lldb::LanguageType language)
+{
+if (IsValid())
+m_opaque_sp->AddLanguage(language);
+}
+
 uint32_t
 SBTypeCategory::GetNumFormats ()
 {


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


[Lldb-commits] [lldb] r251377 - Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional description argument

2015-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 26 20:17:28 2015
New Revision: 251377

URL: http://llvm.org/viewvc/llvm-project?rev=251377&view=rev
Log:
Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional 
description argument

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

Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=251377&r1=251376&r2=251377&view=diff
==
--- lldb/trunk/include/lldb/API/SBTypeSummary.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeSummary.h Mon Oct 26 20:17:28 2015
@@ -87,7 +87,8 @@ namespace lldb {
 
 static SBTypeSummary
 CreateWithCallback (FormatCallback cb, 
-uint32_t options = 0);
+uint32_t options = 0,
+const char* description = nullptr);
 
 SBTypeSummary (const lldb::SBTypeSummary &rhs);
 

Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=251377&r1=251376&r2=251377&view=diff
==
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Mon Oct 26 20:17:28 2015
@@ -147,22 +147,25 @@ SBTypeSummary::CreateWithScriptCode (con
 }
 
 SBTypeSummary
-SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
+SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options, const 
char* description)
 {
-return SBTypeSummary(
-   TypeSummaryImplSP(
-   cb ? new CXXFunctionSummaryFormat(options,
-   [cb] (ValueObject& valobj, Stream& stm, const 
TypeSummaryOptions& opt) -> bool {
-SBStream stream;
-if (!cb(SBValue(valobj.GetSP()), 
SBTypeSummaryOptions(&opt), stream))
-return false;
-stm.Write(stream.GetData(), stream.GetSize());
-return true;
-   },
-   "SBTypeSummary formatter callback"
-   ) : nullptr
-)
-);
+SBTypeSummary retval;
+if (cb)
+{
+retval.SetSP(TypeSummaryImplSP(new CXXFunctionSummaryFormat(options,
+[cb] 
(ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
+
SBStream stream;
+
SBValue sb_value(valobj.GetSP());
+
SBTypeSummaryOptions options(&opt);
+if 
(!cb(sb_value, options, stream))
+
return false;
+
stm.Write(stream.GetData(), stream.GetSize());
+return 
true;
+},
+
description ? description : "callback summary formatter")));
+}
+
+return retval;
 }
 
 SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :


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


[Lldb-commits] [lldb] r251559 - Skip this test is the test suite is running in a mode where it has no WindowServer access

2015-10-28 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 28 17:08:09 2015
New Revision: 251559

URL: http://llvm.org/viewvc/llvm-project?rev=251559&view=rev
Log:
Skip this test is the test suite is running in a mode where it has no 
WindowServer access

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py?rev=251559&r1=251558&r2=251559&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
 Wed Oct 28 17:08:09 2015
@@ -37,9 +37,12 @@ class Rdar12408181TestCase(TestBase):
 lldbutil.run_break_set_by_file_and_line (self, self.main_source, 
self.line, num_expected_locations=1, loc_exact=True)
 
 self.runCmd("run", RUN_SUCCEEDED)
-window = self.frame().FindVariable("window")
-window_dynamic = window.GetDynamicValue(lldb.eDynamicCanRunTarget)
-self.assertTrue(window.GetNumChildren() > 1, "NSWindow (static) only 
has 1 child!")
-self.assertTrue(window_dynamic.GetNumChildren() > 1, "NSWindow 
(dynamic) only has 1 child!")
-self.assertTrue(window.GetChildAtIndex(0).IsValid(), "NSWindow 
(static) has an invalid child")
-self.assertTrue(window_dynamic.GetChildAtIndex(0).IsValid(), "NSWindow 
(dynamic) has an invalid child")
+if 
self.frame().EvaluateExpression('(void*)_CGSDefaultConnection()').GetValueAsUnsigned()
 != 0:
+window = self.frame().FindVariable("window")
+window_dynamic = window.GetDynamicValue(lldb.eDynamicCanRunTarget)
+self.assertTrue(window.GetNumChildren() > 1, "NSWindow (static) 
only has 1 child!")
+self.assertTrue(window_dynamic.GetNumChildren() > 1, "NSWindow 
(dynamic) only has 1 child!")
+self.assertTrue(window.GetChildAtIndex(0).IsValid(), "NSWindow 
(static) has an invalid child")
+self.assertTrue(window_dynamic.GetChildAtIndex(0).IsValid(), 
"NSWindow (dynamic) has an invalid child")
+else:
+self.skipTest('no WindowServer connection')


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


[Lldb-commits] [lldb] r251581 - Remove an unused local variable

2015-10-28 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed Oct 28 18:36:44 2015
New Revision: 251581

URL: http://llvm.org/viewvc/llvm-project?rev=251581&view=rev
Log:
Remove an unused local variable

Modified:
lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp

Modified: lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp?rev=251581&r1=251580&r2=251581&view=diff
==
--- lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp Wed Oct 28 18:36:44 
2015
@@ -385,7 +385,6 @@ TypeCategoryMap::LoopThrough(CallbackTyp
 for (begin = m_active_categories.begin(); begin != end; begin++)
 {
 lldb::TypeCategoryImplSP category = *begin;
-ConstString type = ConstString(category->GetName());
 if (!callback(param, category))
 break;
 }


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


[Lldb-commits] [lldb] r251642 - Add an 'internal' kind of summary to support one-off subclasses of TypeSummaryImpl

2015-10-29 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 29 13:58:13 2015
New Revision: 251642

URL: http://llvm.org/viewvc/llvm-project?rev=251642&view=rev
Log:
Add an 'internal' kind of summary to support one-off subclasses of 
TypeSummaryImpl

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

Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=251642&r1=251641&r2=251642&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Thu Oct 29 13:58:13 
2015
@@ -63,7 +63,8 @@ namespace lldb_private {
 {
 eSummaryString,
 eScript,
-eCallback
+eCallback,
+eInternal
 };
 
 virtual

Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=251642&r1=251641&r2=251642&view=diff
==
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Thu Oct 29 13:58:13 2015
@@ -328,8 +328,21 @@ SBTypeSummary::operator == (lldb::SBType
 bool
 SBTypeSummary::IsEqualTo (lldb::SBTypeSummary &rhs)
 {
-if (IsValid() == false)
-return !rhs.IsValid();
+if (IsValid())
+{
+// valid and invalid are different
+if (!rhs.IsValid())
+return false;
+}
+else
+{
+// invalid and valid are different
+if (rhs.IsValid())
+return false;
+else
+// both invalid are the same
+return true;
+}
 
 if (m_opaque_sp->GetKind() != rhs.m_opaque_sp->GetKind())
 return false;
@@ -348,6 +361,8 @@ SBTypeSummary::IsEqualTo (lldb::SBTypeSu
 if (IsSummaryString() != rhs.IsSummaryString())
 return false;
 return GetOptions() == rhs.GetOptions();
+case TypeSummaryImpl::Kind::eInternal:
+return (m_opaque_sp.get() == rhs.m_opaque_sp.get());
 }
 
 return false;


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


Re: [Lldb-commits] [PATCH] D13878: Add data formatters for go strings and slices.

2015-10-29 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

I think it's OK to land this, yes

I would still like to think about ways that we can avoid using hardcoded 
formatters here, but it seems non-trivial and I don't know enough about Go to 
suggest an obvious solution


http://reviews.llvm.org/D13878



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


[Lldb-commits] [lldb] r251660 - Add a --language (-l) option to the formatter delete commands in order to allow removing formatters from language categories

2015-10-29 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 29 17:18:05 2015
New Revision: 251660

URL: http://llvm.org/viewvc/llvm-project?rev=251660&view=rev
Log:
Add a --language (-l) option to the formatter delete commands in order to allow 
removing formatters from language categories

This is slightly harder to test because formatters cannot be added to language 
categories, so deletions are irreversible (in a debugger run)
I plan to add a test case soon, but I need to think about the right approach to 
obtain one


Modified:
lldb/trunk/include/lldb/DataFormatters/DataVisualization.h
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/DataFormatters/DataVisualization.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/DataVisualization.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/DataVisualization.h?rev=251660&r1=251659&r2=251660&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/DataVisualization.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/DataVisualization.h Thu Oct 29 
17:18:05 2015
@@ -115,6 +115,10 @@ public:
  lldb::TypeCategoryImplSP &entry,
  bool allow_create = true);
 
+static bool
+GetCategory (lldb::LanguageType language,
+ lldb::TypeCategoryImplSP &entry);
+
 static void
 Add (const ConstString &category);
 

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=251660&r1=251659&r2=251660&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Thu Oct 29 17:18:05 2015
@@ -939,6 +939,9 @@ private:
 case 'w':
 m_category = std::string(option_arg);
 break;
+case 'l':
+m_language = 
Language::GetLanguageTypeFromString(option_arg);
+break;
 default:
 error.SetErrorStringWithFormat ("unrecognized option 
'%c'", short_option);
 break;
@@ -952,6 +955,7 @@ private:
 {
 m_delete_all = false;
 m_category = "default";
+m_language = lldb::eLanguageTypeUnknown;
 }
 
 const OptionDefinition*
@@ -968,7 +972,7 @@ private:
 
 bool m_delete_all;
 std::string m_category;
-
+lldb::LanguageType m_language;
 };
 
 CommandOptions m_options;
@@ -1042,11 +1046,22 @@ protected:
 return result.Succeeded();
 }
 
-lldb::TypeCategoryImplSP category;
-
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()),
 category);
+bool delete_category = false;
 
-bool delete_category = category->Delete(typeCS,
-eFormatCategoryItemValue | 
eFormatCategoryItemRegexValue);
+if (m_options.m_language != lldb::eLanguageTypeUnknown)
+{
+lldb::TypeCategoryImplSP category;
+DataVisualization::Categories::GetCategory(m_options.m_language, 
category);
+if (category)
+delete_category = category->Delete(typeCS, 
eFormatCategoryItemValue | eFormatCategoryItemRegexValue);
+}
+else
+{
+lldb::TypeCategoryImplSP category;
+
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()),
 category);
+if (category)
+delete_category = category->Delete(typeCS, 
eFormatCategoryItemValue | eFormatCategoryItemRegexValue);
+}
 
 if (delete_category)
 {
@@ -1069,6 +1084,7 @@ CommandObjectTypeFormatDelete::CommandOp
 {
 { LLDB_OPT_SET_1, false, "all", 'a', OptionParser::eNoArgument, NULL, 
NULL, 0, eArgTypeNone,  "Delete from every category."},
 { LLDB_OPT_SET_2, false, "category", 'w', OptionParser::eRequiredArgument, 
NULL, NULL, 0, eArgTypeName,  "Delete from given category."},
+{ LLDB_OPT_SET_3, false, "language", 'l', OptionParser::eRequiredArgument, 
NULL, NULL, 0, eArgTypeLanguage,  "Delete from given language's category."},
 { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
 };
 
@@ -1960,6 +1976,9 @@ private:
 case 'w':
 m_category = std::string(option_arg);
 break;
+case 'l':
+m_language = 
Language::GetLanguageTypeFromString(option_arg);
+break;
 default:
 error.SetErrorStringWithFormat ("unrecognized option 
'%c'", short_option);
 break;
@@ -1973,6 +1992,7 @

[Lldb-commits] [lldb] r251663 - Do not accept nullptr descriptions as valid summaries to be printed

2015-10-29 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 29 17:29:06 2015
New Revision: 251663

URL: http://llvm.org/viewvc/llvm-project?rev=251663&view=rev
Log:
Do not accept nullptr descriptions as valid summaries to be printed

Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=251663&r1=251662&r2=251663&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Thu Oct 29 17:29:06 2015
@@ -945,8 +945,13 @@ lldb_private::formatters::GetOSXEpoch ()
 bool
 lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider 
(ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
 {
-stream.Printf("%s",valobj.GetObjectDescription());
-return true;
+if (const char* description = valobj.GetObjectDescription())
+{
+stream.Printf("%s", description);
+return true;
+}
+else
+return false;
 }
 
 template bool


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


[Lldb-commits] [lldb] r251668 - Add a --offset option to memory read that allows one to specify, given a type, how many sizeof(type) bytes to speak before starting to read memory

2015-10-29 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 29 18:40:24 2015
New Revision: 251668

URL: http://llvm.org/viewvc/llvm-project?rev=251668&view=rev
Log:
Add a --offset option to memory read that allows one to specify, given a type, 
how many sizeof(type) bytes to speak before starting to read memory

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py?rev=251668&r1=251667&r2=251668&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
 Thu Oct 29 18:40:24 2015
@@ -89,3 +89,12 @@ class MemoryReadTestCase(TestBase):
 # 0x7fff5fbff598: error: unsupported byte size (20) for float format
 self.expect("memory read --format 'float' --count 1 --size 20 
`&my_double`",
 substrs = ['unsupported byte size (20) for float format'])
+
+self.expect('memory read --type int --count 5 `&my_ints[0]`',
+substrs=['(int) 0x', '2','4','6','8','10'])
+
+self.expect('memory read --type int --count 5 --format hex 
`&my_ints[0]`',
+substrs=['(int) 0x', '0x','0a'])
+
+self.expect('memory read --type int --count 5 --offset 5 
`&my_ints[0]`',
+substrs=['(int) 0x', '12', '14','16','18', '20'])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp?rev=251668&r1=251667&r2=251668&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp 
Thu Oct 29 18:40:24 2015
@@ -12,6 +12,7 @@ int main (int argc, char const *argv[])
 {
 char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0};
 double my_double = 1234.5678;
+int my_ints[] = {2,4,6,8,10,12,14,16,18,20,22};
 printf("my_string=%s\n", my_string); // Set break point at this line.
 printf("my_double=%g\n", my_double);
 return 0;

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=251668&r1=251667&r2=251668&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Thu Oct 29 18:40:24 2015
@@ -49,6 +49,7 @@ g_option_table[] =
 { LLDB_OPT_SET_1, false, "num-per-line" ,'l', 
OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNumberPerLine ,"The 
number of items per line to display."},
 { LLDB_OPT_SET_2, false, "binary"   ,'b', OptionParser::eNoArgument
  , NULL, NULL, 0, eArgTypeNone  ,"If true, memory will be saved as 
binary. If false, the memory is saved save as an ASCII dump that uses the 
format, size, count and number per line settings."},
 { LLDB_OPT_SET_3, true , "type" ,'t', 
OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNone  ,"The 
name of a type to view memory as."},
+{ LLDB_OPT_SET_3, false , "offset"  ,'o', 
OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount ,"How 
many elements of the specified type to skip before starting to display data."},
 { LLDB_OPT_SET_1|
   LLDB_OPT_SET_2|
   LLDB_OPT_SET_3, false, "force",'r', OptionParser::eNoArgument,   
NULL, NULL, 0, eArgTypeNone  ,"Necessary if reading over 
target.max-memory-read-size bytes."},
@@ -63,7 +64,8 @@ public:
 OptionGroupReadMemory () :
 m_num_per_line (1,1),
 m_output_as_binary (false),
-m_view_as_type()
+m_view_as_type(),
+m_offset(0,0)
 {
 }
 
@@ -112,6 +114,10 @@ public:
 m_force = true;
 break;
 
+case 'o':
+error = m_offset.SetValueFromString(option_arg);
+break;
+
 default:
 error.SetErrorStringWithFormat("unrecognized short option 
'%c'", short_option);
 break;
@@ -126,6 +132,7 @@ public:
 m_output_as_binary = false;
 m_view_as_type.Clear();
 m_force = false;
+m_offset.Clear();
 }
 
 Error
@@ -291,13 +298,15 

[Lldb-commits] [lldb] r251670 - Remove two #if0ed regions of code that we were using for an experiment but don't really want

2015-10-29 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 29 18:53:34 2015
New Revision: 251670

URL: http://llvm.org/viewvc/llvm-project?rev=251670&view=rev
Log:
Remove two #if0ed regions of code that we were using for an experiment but 
don't really want

Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp?rev=251670&r1=251669&r2=251670&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Thu Oct 
29 18:53:34 2015
@@ -620,14 +620,6 @@ LoadLibStdcppFormatters(lldb::TypeCatego
 
cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new 
RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$")),
 
SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,

   
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
-#if 0
-// With only this, I get std::list showing the content, all children on 
the same line.
-// With this and the section below, I see one child element per line.
-
cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new 
RegularExpression("^std::__cxx11::_List_base<.+>(( )?&)?$")),
-
SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
-   
   
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
-#endif
-
 
stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
 
cpp_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new 
RegularExpression("^std::vector<.+>(( )?&)?$")),

TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
@@ -638,12 +630,6 @@ LoadLibStdcppFormatters(lldb::TypeCatego
 
cpp_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new 
RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$")),

TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,

  "size=${svar%#}")));
-#if 0
-// With this, I get std::list showing one child per line.  Requires the 
change above to get anything, though.
-
cpp_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new 
RegularExpression("^std::__cxx11::_List_base<.+>(( )?&)?$")),
-   
TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
-   
  "size=${svar%#}")));
-#endif
 
 AddCXXSynthetic(cpp_category_sp, 
lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator, 
"std::vector iterator synthetic children", 
ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true);
 


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


[Lldb-commits] [lldb] r251678 - Some test cases that need the lldbExec path were failing because lldbExec was turning out to be None even though it was being validly set by dotest.py

2015-10-29 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Oct 29 20:09:54 2015
New Revision: 251678

URL: http://llvm.org/viewvc/llvm-project?rev=251678&view=rev
Log:
Some test cases that need the lldbExec path were failing because lldbExec was 
turning out to be None even though it was being validly set by dotest.py

It turns out that lldbtest_config was being imported locally to 
"lldbsuite.test" instead of globally, so when the test cases got individually 
brought by a global import via __import__ by unittest2, they did not see the 
lldbtest_config import, and ended up importing a new separate copy of it, with 
lldbExec unset

This is a simple hackaround that brings lldbtest_config to global visibility 
and makes sure the configuration data is correctly shared


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

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=251678&r1=251677&r2=251678&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Thu Oct 29 20:09:54 2015
@@ -21,6 +21,10 @@ for available options.
 """
 
 from __future__ import print_function
+# this module needs to have global visibility, otherwise test cases
+# will import it anew in their local namespace, essentially losing access
+# to all the configuration data
+globals()['lldbtest_config'] = __import__('lldbtest_config')
 
 import use_lldb_suite
 
@@ -42,7 +46,6 @@ import test_results
 from test_results import EventBuilder
 import inspect
 import unittest2
-import lldbtest_config
 import test_categories
 
 import six


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


  1   2   3   4   5   >