[Lldb-commits] [lldb] r268591 - Allow LanguageRuntimes to return an error if they fail in the course of dynamic type discovery

2016-05-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed May  4 20:47:44 2016
New Revision: 268591

URL: http://llvm.org/viewvc/llvm-project?rev=268591=rev
Log:
Allow LanguageRuntimes to return an error if they fail in the course of dynamic 
type discovery

This is not meant to report that a value doesn't have a dynamic type - it is 
only meant as a mechanism to propagate actual type discovery issues (e.g. 
malformed type metadata for languages that have such a notion)

This information is used by ValueObjectDynamic to set its own m_error, which is 
a fairly sharp and heavyweight tool to begin with

For the time being, this is an architectural improvement but a practical no-op 
as no existing runtimes are actually setting errors


Modified:
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h
lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h

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

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h

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

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h

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

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

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

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

Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=268591=268590=268591=diff
==
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Wed May  4 20:47:44 2016
@@ -54,7 +54,8 @@ public:
   lldb::DynamicValueType use_dynamic, 
   TypeAndOrName _type_or_name, 
   Address ,
-  Value::ValueType _type) = 0;
+  Value::ValueType _type,
+  Error ) = 0;
 
 // This call should return a CompilerType given a generic type name
 // and an ExecutionContextScope in which one can actually fetch

Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=268591=268590=268591=diff
==
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Wed May  4 20:47:44 2016
@@ -187,23 +187,41 @@ ValueObjectDynamicValue::UpdateValue ()
 LanguageRuntime *runtime = nullptr;
 
 lldb::LanguageType known_type = m_parent->GetObjectRuntimeLanguage();
+
+Error dynamic_type_discovery_error;
+
 if (known_type != lldb::eLanguageTypeUnknown && known_type != 
lldb::eLanguageTypeC)
 {
 runtime = process->GetLanguageRuntime (known_type);
 if (runtime)
-found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, 
m_use_dynamic, class_type_or_name, dynamic_address, value_type);
+found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent,
+
m_use_dynamic,
+
class_type_or_name,
+
dynamic_address,
+value_type,
+
dynamic_type_discovery_error);
 }
 else
 {
 runtime = process->GetLanguageRuntime (lldb::eLanguageTypeC_plus_plus);
 if (runtime)
-found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, 
m_use_dynamic, class_type_or_name, dynamic_address, value_type);
+found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent,
+
m_use_dynamic,
+
class_type_or_name,
+   

[Lldb-commits] [lldb] r268587 - Make the functions that fetch data from the ObjC runtime choose whether or not to log depending on whether the types log is enabled

2016-05-04 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Wed May  4 20:15:57 2016
New Revision: 268587

URL: http://llvm.org/viewvc/llvm-project?rev=268587=rev
Log:
Make the functions that fetch data from the ObjC runtime choose whether or not 
to log depending on whether the types log is enabled

This can prove helpful in debugging issues with that retrieval even if LLDB 
wasn't compiled with the magic macros defined


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=268587=268586=268587=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 Wed May  4 20:15:57 2016
@@ -80,12 +80,7 @@ extern "C"
 char *strncpy (char * s1, const char * s2, size_t n);
 int printf(const char * format, ...);
 }
-//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN
-#ifdef ENABLE_DEBUG_PRINTF
-#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DEBUG_PRINTF(fmt, ...)
-#endif
+#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
 
 typedef struct _NXMapTable {
 void *prototype;
@@ -111,7 +106,8 @@ struct ClassInfo
 uint32_t
 __lldb_apple_objc_v2_get_dynamic_class_info (void 
*gdb_objc_realized_classes_ptr,
  void *class_infos_ptr,
- uint32_t class_infos_byte_size)
+ uint32_t class_infos_byte_size,
+ uint32_t should_log)
 {
 DEBUG_PRINTF ("gdb_objc_realized_classes_ptr = %p\n", 
gdb_objc_realized_classes_ptr);
 DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
@@ -169,12 +165,7 @@ extern "C"
 int printf(const char * format, ...);
 }
 
-// #define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN
-#ifdef ENABLE_DEBUG_PRINTF
-#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DEBUG_PRINTF(fmt, ...)
-#endif
+#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
 
 
 struct objc_classheader_t {
@@ -223,7 +214,8 @@ struct ClassInfo
 uint32_t
 __lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,
   void *class_infos_ptr,
-  uint32_t 
class_infos_byte_size)
+  uint32_t 
class_infos_byte_size,
+  uint32_t should_log)
 {
 uint32_t idx = 0;
 DEBUG_PRINTF ("objc_opt_ro_ptr = %p\n", objc_opt_ro_ptr);
@@ -1451,6 +1443,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
 value.SetValueType (Value::eValueTypeScalar);
 value.SetCompilerType (clang_uint32_t_type);
 arguments.PushValue (value);
+arguments.PushValue (value);
 
 get_class_info_function = 
m_get_class_info_code->MakeFunctionCaller(clang_uint32_t_type,
 
arguments,
@@ -1492,12 +1485,14 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
 return false;
 
 Mutex::Locker locker(m_get_class_info_args_mutex);
-
+
 // Fill in our function argument values
 arguments.GetValueAtIndex(0)->GetScalar() = 
hash_table.GetTableLoadAddress();
 arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
 arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
+arguments.GetValueAtIndex(3)->GetScalar() = 
(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
 
+
 bool success = false;
 
 diagnostics.Clear();
@@ -1711,6 +1706,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
 //value.SetContext (Value::eContextTypeClangType, clang_uint32_t_type);
 value.SetCompilerType (clang_uint32_t_type);
 arguments.PushValue (value);
+arguments.PushValue (value);
 
 get_shared_cache_class_info_function = 
m_get_shared_cache_class_info_code->MakeFunctionCaller(clang_uint32_t_type,

   arguments,
@@ -1746,6 +1742,8 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
 arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
 arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
 arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
+arguments.GetValueAtIndex(3)->GetScalar() = 
(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
+
 
 bool 

Re: [Lldb-commits] [PATCH] D19943: XFail TestEnumTypes.py on Windows

2016-05-04 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268574: XFail TestEnumTypes.py on Windows (authored by 
amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D19943?vs=56216=56222#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19943

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
  lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c

Index: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
@@ -19,6 +19,7 @@
 # Find the line number to break inside main().
 self.line = line_number('main.c', '// Set break point at this line.')
 
+@expectedFailAll(oslist=['windows'])  // derefing the null pointer "works" 
on Windows
 def test(self):
 """Test 'image lookup -t days' and check for correct display and enum 
value printing."""
 self.build()
@@ -53,24 +54,24 @@
'kNumDays',
'}'])
 
-enum_values = [ '-4', 
-'Monday', 
-'Tuesday', 
-'Wednesday', 
+enum_values = [ '-4',
+'Monday',
+'Tuesday',
+'Wednesday',
 'Thursday',
 'Friday',
 'Saturday',
 'Sunday',
 'kNumDays',
 '5'];
-   
  
+
 # Make sure a pointer to an anonymous enum type does crash LLDB and 
displays correctly using
 # frame variable and expression commands
 self.expect('frame variable f.op', DATA_TYPES_DISPLAYED_CORRECTLY, 
substrs = ['ops *', 'f.op'], patterns = ['0x0+$'])
 self.expect('frame variable *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, 
substrs = ['ops', '*f.op', ''])
 self.expect('expr f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
['ops *', '$'], patterns = ['0x0+$'])
 self.expect('expr *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
['error:'], error = True)
-
+
 bkpt = self.target().FindBreakpointByID(bkpt_id)
 for enum_value in enum_values:
 self.expect("frame variable day", 'check for valid enumeration 
value',
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
@@ -31,7 +31,7 @@
 };
 enum days day;
 struct foo f;
-   f.op = NULL;
+f.op = NULL;
 for (day = Monday - 1; day <= kNumDays + 1; day++)
 {
 printf("day as int is %i\n", (int)day); // Set break point at this 
line.


Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
@@ -19,6 +19,7 @@
 # Find the line number to break inside main().
 self.line = line_number('main.c', '// Set break point at this line.')
 
+@expectedFailAll(oslist=['windows'])  // derefing the null pointer "works" on Windows
 def test(self):
 """Test 'image lookup -t days' and check for correct display and enum value printing."""
 self.build()
@@ -53,24 +54,24 @@
'kNumDays',
'}'])
 
-enum_values = [ '-4', 
-'Monday', 
-'Tuesday', 
-'Wednesday', 
+enum_values = [ '-4',
+'Monday',
+'Tuesday',
+'Wednesday',
 'Thursday',
 'Friday',
 'Saturday',
 'Sunday',
 'kNumDays',
 '5'];
- 
+
 # Make sure a pointer to an anonymous enum type does crash LLDB and displays correctly using
 # frame variable and expression commands
 self.expect('frame variable f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', 'f.op'], patterns = ['0x0+$'])
 self.expect('frame variable *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops', 

[Lldb-commits] [lldb] r268574 - XFail TestEnumTypes.py on Windows

2016-05-04 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Wed May  4 18:33:19 2016
New Revision: 268574

URL: http://llvm.org/viewvc/llvm-project?rev=268574=rev
Log:
XFail TestEnumTypes.py on Windows

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py?rev=268574=268573=268574=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py 
Wed May  4 18:33:19 2016
@@ -19,6 +19,7 @@ class EnumTypesTestCase(TestBase):
 # Find the line number to break inside main().
 self.line = line_number('main.c', '// Set break point at this line.')
 
+@expectedFailAll(oslist=['windows'])  // derefing the null pointer "works" 
on Windows
 def test(self):
 """Test 'image lookup -t days' and check for correct display and enum 
value printing."""
 self.build()
@@ -53,24 +54,24 @@ class EnumTypesTestCase(TestBase):
'kNumDays',
'}'])
 
-enum_values = [ '-4', 
-'Monday', 
-'Tuesday', 
-'Wednesday', 
+enum_values = [ '-4',
+'Monday',
+'Tuesday',
+'Wednesday',
 'Thursday',
 'Friday',
 'Saturday',
 'Sunday',
 'kNumDays',
 '5'];
-   
  
+
 # Make sure a pointer to an anonymous enum type does crash LLDB and 
displays correctly using
 # frame variable and expression commands
 self.expect('frame variable f.op', DATA_TYPES_DISPLAYED_CORRECTLY, 
substrs = ['ops *', 'f.op'], patterns = ['0x0+$'])
 self.expect('frame variable *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, 
substrs = ['ops', '*f.op', ''])
 self.expect('expr f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
['ops *', '$'], patterns = ['0x0+$'])
 self.expect('expr *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
['error:'], error = True)
-
+
 bkpt = self.target().FindBreakpointByID(bkpt_id)
 for enum_value in enum_values:
 self.expect("frame variable day", 'check for valid enumeration 
value',

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c?rev=268574=268573=268574=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/enum_types/main.c Wed May  
4 18:33:19 2016
@@ -31,7 +31,7 @@ int main (int argc, char const *argv[])
 };
 enum days day;
 struct foo f;
-   f.op = NULL;
+f.op = NULL;
 for (day = Monday - 1; day <= kNumDays + 1; day++)
 {
 printf("day as int is %i\n", (int)day); // Set break point at this 
line.


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


Re: [Lldb-commits] [PATCH] D19606: XFail TestLambdas.py on Windows after fixing some of the problems

2016-05-04 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268573: XFail TestLambdas.py on Windows after fixing some of 
the problems (authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D19606?vs=55263=56221#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19606

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
  lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
  lldb/trunk/source/Expression/IRInterpreter.cpp

Index: lldb/trunk/source/Expression/IRInterpreter.cpp
===
--- lldb/trunk/source/Expression/IRInterpreter.cpp
+++ lldb/trunk/source/Expression/IRInterpreter.cpp
@@ -477,6 +477,7 @@
 static const char *memory_read_error= "Interpreter couldn't read from memory";
 static const char *infinite_loop_error  = "Interpreter ran for too many cycles";
 //static const char *bad_result_error = "Result of expression is in bad memory";
+static const char *too_many_functions_error = "Interpreter doesn't handle modules with multiple function bodies.";
 
 static bool
 CanResolveConstant (llvm::Constant *constant)
@@ -506,7 +507,7 @@
 Constant *base = dyn_cast(*op_cursor);
 if (!base)
 return false;
-
+
 return CanResolveConstant(base);
 }
 }
@@ -535,7 +536,13 @@
 if (fi->begin() != fi->end())
 {
 if (saw_function_with_body)
+{
+if (log)
+log->Printf("More than one function in the module has a body");
+error.SetErrorToGenericError();
+error.SetErrorString(too_many_functions_error);
 return false;
+}
 saw_function_with_body = true;
 }
 }
@@ -664,7 +671,7 @@
 return false;
 }
 }
-
+
 if (Constant *constant = llvm::dyn_cast(operand))
 {
 if (!CanResolveConstant(constant))
@@ -680,7 +687,8 @@
 
 }
 
-return true;}
+return true;
+}
 
 bool
 IRInterpreter::Interpret (llvm::Module ,
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
@@ -186,7 +186,7 @@
 elif hasattr(decorators, '__call__'):
 tmp = decorators(tmp)
 return tmp
-
+
 
 def MakeInlineTest(__file, __globals, decorators=None):
 # Adjust the filename if it ends in .pyc.  We want filenames to
@@ -200,13 +200,17 @@
 InlineTest.mydir = TestBase.compute_mydir(__file)
 
 test_name, _ = os.path.splitext(file_basename)
-# Build the test case 
+# Build the test case
 test = type(test_name, (InlineTest,), {'using_dsym': None})
 test.name = test_name
 
-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)
+target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+if test_categories.is_supported_on_platform("dsym", target_platform):
+test.test_with_dsym = ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators)
+if test_categories.is_supported_on_platform("dwarf", target_platform):
+test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators)
+if test_categories.is_supported_on_platform("dwo", target_platform):
+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})
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
@@ -11,7 +11,7 @@
 
 int main (int argc, char const *argv[])
 {
-printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int a, int b) { return a + b };")
-   //% self.expect("expression $add(2,3)", substrs = ['= 5'])
-return 0; 
+printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int a, int b) { return a + b; }")
+   //% self.expect("expression $add(2,3)", substrs = ['= 5'])
+return 0;
 }
Index: 

[Lldb-commits] [lldb] r268573 - XFail TestLambdas.py on Windows after fixing some of the problems

2016-05-04 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Wed May  4 18:32:35 2016
New Revision: 268573

URL: http://llvm.org/viewvc/llvm-project?rev=268573=rev
Log:
XFail TestLambdas.py on Windows after fixing some of the problems

1. Fixed semicolon placement in the lambda in the test itself.

2. Fixed lldbinline tests in general so that we don't attempt tests on 
platforms that don't use the given type of debug info. (For example, no DWO 
tests on Windows.) This fixes one of the two failures on Windows. 
(TestLambdas.py was the only inline test that wasn't XFailed or skipped on 
Windows.)

3. Set the error string in IRInterpreter::CanInterpret so that the caller 
doesn't print (null) instead of an explanation. I don't entirely understand the 
error, so feel free to suggest a better wording.

4. XFailed the test on Windows. The interpreter won't evaluate the lambda 
because the module has multiple function bodies. I don't exactly understand why 
that's a problem for the interpreter nor why the problem arises only on Windows.

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
lldb/trunk/source/Expression/IRInterpreter.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py?rev=268573=268572=268573=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py 
Wed May  4 18:32:35 2016
@@ -1,4 +1,4 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(), [])
+lldbinline.MakeInlineTest(__file__, globals(), 
[lldbinline.expectedFailureAll(oslist=["windows"])])

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp?rev=268573=268572=268573=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp Wed May 
 4 18:32:35 2016
@@ -11,7 +11,7 @@
 
 int main (int argc, char const *argv[])
 {
-printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int 
a, int b) { return a + b };")
-   //% self.expect("expression $add(2,3)", substrs 
= ['= 5'])
-return 0; 
+printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int a, 
int b) { return a + b; }")
+   //% self.expect("expression $add(2,3)", substrs = 
['= 5'])
+return 0;
 }

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=268573=268572=268573=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Wed May  4 18:32:35 
2016
@@ -186,7 +186,7 @@ def ApplyDecoratorsToFunction(func, deco
 elif hasattr(decorators, '__call__'):
 tmp = decorators(tmp)
 return tmp
-
+
 
 def MakeInlineTest(__file, __globals, decorators=None):
 # Adjust the filename if it ends in .pyc.  We want filenames to
@@ -200,13 +200,17 @@ def MakeInlineTest(__file, __globals, de
 InlineTest.mydir = TestBase.compute_mydir(__file)
 
 test_name, _ = os.path.splitext(file_basename)
-# Build the test case 
+# Build the test case
 test = type(test_name, (InlineTest,), {'using_dsym': None})
 test.name = test_name
 
-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)
+target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+if test_categories.is_supported_on_platform("dsym", target_platform):
+test.test_with_dsym = 
ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators)
+if test_categories.is_supported_on_platform("dwarf", target_platform):
+test.test_with_dwarf = 
ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators)
+if test_categories.is_supported_on_platform("dwo", target_platform):
+test.test_with_dwo = 

[Lldb-commits] [lldb] r268566 - Unblock the windows buildbot.

2016-05-04 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed May  4 17:41:32 2016
New Revision: 268566

URL: http://llvm.org/viewvc/llvm-project?rev=268566=rev
Log:
Unblock the windows buildbot.


Modified:
lldb/trunk/include/lldb/Core/Debugger.h

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=268566=268565=268566=diff
==
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Wed May  4 17:41:32 2016
@@ -16,6 +16,7 @@
 // C++ Includes
 #include 
 #include 
+#include 
 #include 
 
 // Other libraries and framework includes


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


[Lldb-commits] [lldb] r268563 - Don't let two threads call Debugger::Clear simultaneously.

2016-05-04 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed May  4 17:26:42 2016
New Revision: 268563

URL: http://llvm.org/viewvc/llvm-project?rev=268563=rev
Log:
Don't let two threads call Debugger::Clear simultaneously.

We don't want a mutex in debugger as it will cause A/B locking issues with the 
lldb_private::Target's mutex, but we do need to stop two threads from doing 
Debugger::Clear at the same time. We have seen issues with this with the C++ 
global destructor chain where the global debugger list is being destroyed and 
the Debugger::~Debugger() is calling it while another thread was in the middle 
of running that function.



Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=268563=268562=268563=diff
==
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Wed May  4 17:26:42 2016
@@ -482,6 +482,7 @@ protected:
 HostThread m_io_handler_thread;
 Broadcaster m_sync_broadcaster;
 lldb::ListenerSP m_forward_listener_sp;
+std::once_flag m_clear_once;
 
 //--
 // Events for m_sync_broadcaster

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=268563=268562=268563=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed May  4 17:26:42 2016
@@ -715,7 +715,9 @@ Debugger::Debugger(lldb::LogOutputCallba
 m_loaded_plugins(),
 m_event_handler_thread(),
 m_io_handler_thread(),
-m_sync_broadcaster(nullptr, "lldb.debugger.sync")
+m_sync_broadcaster(nullptr, "lldb.debugger.sync"),
+m_forward_listener_sp(),
+m_clear_once()
 {
 char instance_cstr[256];
 snprintf(instance_cstr, sizeof(instance_cstr), "debugger_%d", 
(int)GetID());
@@ -762,31 +764,44 @@ Debugger::~Debugger ()
 void
 Debugger::Clear()
 {
-ClearIOHandlers();
-StopIOHandlerThread();
-StopEventHandlerThread();
-m_listener_sp->Clear();
-int num_targets = m_target_list.GetNumTargets();
-for (int i = 0; i < num_targets; i++)
-{
-TargetSP target_sp (m_target_list.GetTargetAtIndex (i));
-if (target_sp)
+//--
+// Make sure we call this function only once. With the C++ global
+// destructor chain having a list of debuggers and with code that can be
+// running on other threads, we need to ensure this doesn't happen
+// multiple times.
+//
+// The following functions call Debugger::Clear():
+// Debugger::~Debugger();
+// static void Debugger::Destroy(lldb::DebuggerSP _sp);
+// static void Debugger::Terminate();
+//--
+std::call_once(m_clear_once, [this]() {
+ClearIOHandlers();
+StopIOHandlerThread();
+StopEventHandlerThread();
+m_listener_sp->Clear();
+int num_targets = m_target_list.GetNumTargets();
+for (int i = 0; i < num_targets; i++)
 {
-ProcessSP process_sp (target_sp->GetProcessSP());
-if (process_sp)
-process_sp->Finalize();
-target_sp->Destroy();
+TargetSP target_sp (m_target_list.GetTargetAtIndex (i));
+if (target_sp)
+{
+ProcessSP process_sp (target_sp->GetProcessSP());
+if (process_sp)
+process_sp->Finalize();
+target_sp->Destroy();
+}
 }
-}
-m_broadcaster_manager_sp->Clear ();
-
-// Close the input file _before_ we close the input read communications 
class
-// as it does NOT own the input file, our m_input_file does.
-m_terminal_state.Clear();
-if (m_input_file_sp)
-m_input_file_sp->GetFile().Close ();
-
-m_command_interpreter_ap->Clear();
+m_broadcaster_manager_sp->Clear ();
+
+// Close the input file _before_ we close the input read 
communications class
+// as it does NOT own the input file, our m_input_file does.
+m_terminal_state.Clear();
+if (m_input_file_sp)
+m_input_file_sp->GetFile().Close ();
+
+m_command_interpreter_ap->Clear();
+});
 }
 
 bool


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


Re: [Lldb-commits] [PATCH] D19751: Fix TestEnumTypes.py for 32 bit platforms.

2016-05-04 Thread Adrian McCarthy via lldb-commits
amccarth added a comment.

The test expects `expr *f.op` to fail because f is a null pointer, but on 
Windows it yields `(ops) $2 = 0`.  I suspect this is a latent expression 
evaluation bug exposed by the new test, as it also happens for other types of 
pointers and not just pointers to enums.


Repository:
  rL LLVM

http://reviews.llvm.org/D19751



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


Re: [Lldb-commits] [PATCH] D19751: Fix TestEnumTypes.py for 32 bit platforms.

2016-05-04 Thread Chaoren Lin via lldb-commits
We don't test host-only Windows. It's passing Windows to Android though.
What's the reason that it fails on Windows?

On Wed, May 4, 2016 at 2:31 PM, Adrian McCarthy  wrote:

> amccarth added a subscriber: amccarth.
> amccarth added a comment.
>
> Chaoren:  Did this completely fix the test for you?  It's still failing
> for me on Windows, but for a reason not addressed here.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D19751
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r268559 - Intentionally leak the ASTSourceMap instead of destroying it when LLDB quits.

2016-05-04 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Wed May  4 16:42:55 2016
New Revision: 268559

URL: http://llvm.org/viewvc/llvm-project?rev=268559=rev
Log:
Intentionally leak the ASTSourceMap instead of destroying it when LLDB quits.



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

Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp?rev=268559=268558=268559=diff
==
--- lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp (original)
+++ lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp Wed May  4 
16:42:55 2016
@@ -19,8 +19,9 @@ typedef llvm::DenseMaphttp://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19751: Fix TestEnumTypes.py for 32 bit platforms.

2016-05-04 Thread Adrian McCarthy via lldb-commits
amccarth added a subscriber: amccarth.
amccarth added a comment.

Chaoren:  Did this completely fix the test for you?  It's still failing for me 
on Windows, but for a reason not addressed here.


Repository:
  rL LLVM

http://reviews.llvm.org/D19751



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


[Lldb-commits] [lldb] r268545 - Update for llvm change to add pdb namespace.

2016-05-04 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed May  4 15:33:53 2016
New Revision: 268545

URL: http://llvm.org/viewvc/llvm-project?rev=268545=rev
Log:
Update for llvm change to add pdb namespace.

r268544 moves all PDB reading code into a pdb namespace,
so LLDB needs to be updated to take this into account.

Modified:
lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h

Modified: lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp?rev=268545=268544=268545=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp Wed May  
4 15:33:53 2016
@@ -379,7 +379,7 @@ DebuggerThread::HandleExceptionEvent(con
 {
 WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_EXCEPTION | 
WINDOWS_LOG_PROCESS,
 "Breakpoint exception is cue to detach from 
process 0x%x",
-m_pid_to_detach);
+m_pid_to_detach.load());
 ::DebugActiveProcessStop(m_pid_to_detach);
 m_detached = true;
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=268545=268544=268545=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Wed May  4 
15:33:53 2016
@@ -32,6 +32,7 @@
 using namespace lldb;
 using namespace lldb_private;
 using namespace llvm;
+using namespace llvm::pdb;
 
 namespace
 {
@@ -85,7 +86,7 @@ PDBASTParser::~PDBASTParser()
 // DebugInfoASTParser interface
 
 lldb::TypeSP
-PDBASTParser::CreateLLDBTypeFromPDBType(const llvm::PDBSymbol )
+PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol )
 {
 // PDB doesn't maintain enough information to robustly rebuild the entire
 // tree, and this is most problematic when it comes to figure out the
@@ -194,7 +195,7 @@ PDBASTParser::CreateLLDBTypeFromPDBType(
 }
 
 bool
-PDBASTParser::AddEnumValue(CompilerType enum_type, const llvm::PDBSymbolData 
_value) const
+PDBASTParser::AddEnumValue(CompilerType enum_type, const PDBSymbolData 
_value) const
 {
 Declaration decl;
 Variant v = enum_value.getValue();

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h?rev=268545=268544=268545=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h Wed May  4 15:33:53 
2016
@@ -30,10 +30,13 @@ class CompilerType;
 
 namespace llvm
 {
+namespace pdb
+{
 class PDBSymbol;
 class PDBSymbolData;
 class PDBSymbolTypeBuiltin;
 }
+}
 
 class PDBASTParser
 {
@@ -42,11 +45,11 @@ public:
 ~PDBASTParser();
 
 lldb::TypeSP
-CreateLLDBTypeFromPDBType(const llvm::PDBSymbol );
+CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol );
 
 private:
 bool
-AddEnumValue(lldb_private::CompilerType enum_type, const 
llvm::PDBSymbolData ) const;
+AddEnumValue(lldb_private::CompilerType enum_type, const 
llvm::pdb::PDBSymbolData ) const;
 
 lldb_private::ClangASTContext _ast;
 lldb_private::ClangASTImporter m_ast_importer;

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=268545=268544=268545=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Wed May  4 
15:33:53 2016
@@ -39,16 +39,18 @@
 #include 
 
 using namespace lldb_private;
+using namespace llvm::pdb;
 
 namespace
 {
-lldb::LanguageType TranslateLanguage(llvm::PDB_Lang lang)
+lldb::LanguageType
+TranslateLanguage(PDB_Lang lang)
+{
+switch (lang)
 {
-switch (lang)
-{
-case llvm::PDB_Lang::Cpp:
+case PDB_Lang::Cpp:
 return lldb::LanguageType::eLanguageTypeC_plus_plus;
-case llvm::PDB_Lang::C:
+case PDB_Lang::C:
 return lldb::LanguageType::eLanguageTypeC;
 default:
 return lldb::LanguageType::eLanguageTypeUnknown;
@@ -115,8 +117,8 @@ 

Re: [Lldb-commits] [PATCH] D19927: Fix DW_AT_specification handling in DWO files

2016-05-04 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.

LGTM


http://reviews.llvm.org/D19927



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


[Lldb-commits] [PATCH] D19927: Fix DW_AT_specification handling in DWO files

2016-05-04 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, tberghammer.
labath added subscribers: ovyalov, lldb-commits.

We were trying to get a DWARFDIE from a CompileUnit belonging to a DWO file. 
However, this
function does not understand the die encoding used by the DWO files. Instead 
use GetDIE on the
SymbolFileDWARF, which is overriden in DWO to do the right thing.

http://reviews.llvm.org/D19927

Files:
  packages/Python/lldbsuite/test/python_api/symbol-context/two-files/Makefile
  
packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
  packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h
  packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp
  packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -610,7 +610,7 @@
 {
 if (die_ref.die_offset != DW_INVALID_OFFSET)
 {
-DWARFDIE die = dwarf2Data->DebugInfo()->GetDIE(die_ref);
+DWARFDIE die = dwarf2Data->GetDIE(die_ref);
 if (die)
 die.GetDIE()->GetDIENamesAndRanges(die.GetDWARF(), die.GetCU(), name, mangled, ranges, decl_file, decl_line, decl_column, call_file, call_line, call_column);
 }
Index: packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp
===
--- /dev/null
+++ packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp
@@ -0,0 +1,6 @@
+#include "decls.h"
+
+void
+struct2::f()
+{
+}
Index: packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp
===
--- /dev/null
+++ packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp
@@ -0,0 +1,13 @@
+#include "decls.h"
+
+void
+struct1::f()
+{
+}
+
+int main()
+{
+struct1::f();
+struct2::f();
+return 0;
+}
Index: packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h
===
--- /dev/null
+++ packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h
@@ -0,0 +1,11 @@
+struct struct1
+{
+static void
+f();
+};
+
+struct struct2
+{
+static void
+f();
+};
Index: packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
@@ -0,0 +1,35 @@
+"""
+Test SBSymbolContext APIs.
+"""
+
+from __future__ import print_function
+
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class SymbolContextTwoFilesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@add_test_categories(['pyapi'])
+def test_lookup_by_address(self):
+"""Test lookup by address in a module with multiple compilation units"""
+self.build()
+exe = os.path.join(os.getcwd(), "a.out")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+module = target.GetModuleAtIndex(0)
+self.assertTrue(module.IsValid())
+for symbol_name in ["struct1::f()", "struct2::f()"]:
+sc_list = module.FindFunctions(symbol_name, lldb.eSymbolTypeCode)
+self.assertTrue(1, sc_list.GetSize())
+symbol_address = sc_list.GetContextAtIndex(0).GetSymbol().GetStartAddress()
+self.assertTrue(symbol_address.IsValid())
+sc_by_address = module.ResolveSymbolContextForAddress(symbol_address, lldb.eSymbolContextFunction)
+self.assertEqual(symbol_name, sc_by_address.GetFunction().GetName())
Index: packages/Python/lldbsuite/test/python_api/symbol-context/two-files/Makefile
===
--- /dev/null
+++ packages/Python/lldbsuite/test/python_api/symbol-context/two-files/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := file1.cpp file2.cpp
+
+include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.

2016-05-04 Thread Renato Golin via lldb-commits
rengolin added a comment.

In http://reviews.llvm.org/D19604#421086, @omjavaid wrote:

> Right now we can distingusih between hard and soft float based on ABI 
> information in elf. But cant really tell if hard float is legacy VFP or neon.


If the object has build attributes, it could help. But you also can't rely on 
it being there.


http://reviews.llvm.org/D19604



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


Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.

2016-05-04 Thread Muhammad Omair Javaid via lldb-commits
omjavaid added a comment.

In case of ELF .arm attributes contains tags providing information on 
underlying CPU specification used. Thats only for the inferior being debugged 
but actually knowing which target we are running on, like for example if we 
want to figure out if we are running on a armv7 or armv8 hardware thats not 
decoded by LLDB right now.
For user space applications dont want to know that either.

So triple is just architecture-vendor-platform-* but for detailed information 
we have to populate arch specification structure after decoding the binary 
which is something we need to do in future.

Right now we can distingusih between hard and soft float based on ABI 
information in elf. But cant really tell if hard float is legacy VFP or neon.


http://reviews.llvm.org/D19604



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


[Lldb-commits] [PATCH] D19916: Fix EOF handling in AdbClient (take 2)

2016-05-04 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: ovyalov.
labath added a subscriber: lldb-commits.
Herald added subscribers: danalbert, tberghammer.

AdbClient would spin in a loop in ReadAllBytes in case the remote end was 
closed before reading
the requested number of bytes. Make sure we return an error in this case 
instead.

http://reviews.llvm.org/D19916

Files:
  source/Plugins/Platform/Android/AdbClient.cpp

Index: source/Plugins/Platform/Android/AdbClient.cpp
===
--- source/Plugins/Platform/Android/AdbClient.cpp
+++ source/Plugins/Platform/Android/AdbClient.cpp
@@ -34,7 +34,7 @@
 
 namespace {
 
-const uint32_t kReadTimeout = 100; // 1 second
+const std::chrono::seconds kReadTimeout(4);
 const char * kOKAY = "OKAY";
 const char * kFAIL = "FAIL";
 const char * kDATA = "DATA";
@@ -490,18 +490,29 @@
 Error
 AdbClient::ReadAllBytes (void *buffer, size_t size)
 {
+using namespace std::chrono;
+
 Error error;
 ConnectionStatus status;
 char *read_buffer = static_cast(buffer);
 
-size_t tota_read_bytes = 0;
-while (tota_read_bytes < size)
+auto now = steady_clock::now();
+const auto deadline = now + kReadTimeout;
+size_t total_read_bytes = 0;
+while (total_read_bytes < size && now < deadline)
 {
-auto read_bytes = m_conn.Read (read_buffer + tota_read_bytes, size - 
tota_read_bytes, kReadTimeout, status, );
+uint32_t timeout_usec = duration_cast(deadline - 
now).count();
+auto read_bytes =
+m_conn.Read(read_buffer + total_read_bytes, size - 
total_read_bytes, timeout_usec, status, );
 if (error.Fail ())
 return error;
-tota_read_bytes += read_bytes;
+total_read_bytes += read_bytes;
+if (status != eConnectionStatusSuccess)
+break;
+now = steady_clock::now();
 }
+if (total_read_bytes < size)
+error = Error("Unable to read requested number of bytes. Connection 
status: %d.", status);
 return error;
 }
 


Index: source/Plugins/Platform/Android/AdbClient.cpp
===
--- source/Plugins/Platform/Android/AdbClient.cpp
+++ source/Plugins/Platform/Android/AdbClient.cpp
@@ -34,7 +34,7 @@
 
 namespace {
 
-const uint32_t kReadTimeout = 100; // 1 second
+const std::chrono::seconds kReadTimeout(4);
 const char * kOKAY = "OKAY";
 const char * kFAIL = "FAIL";
 const char * kDATA = "DATA";
@@ -490,18 +490,29 @@
 Error
 AdbClient::ReadAllBytes (void *buffer, size_t size)
 {
+using namespace std::chrono;
+
 Error error;
 ConnectionStatus status;
 char *read_buffer = static_cast(buffer);
 
-size_t tota_read_bytes = 0;
-while (tota_read_bytes < size)
+auto now = steady_clock::now();
+const auto deadline = now + kReadTimeout;
+size_t total_read_bytes = 0;
+while (total_read_bytes < size && now < deadline)
 {
-auto read_bytes = m_conn.Read (read_buffer + tota_read_bytes, size - tota_read_bytes, kReadTimeout, status, );
+uint32_t timeout_usec = duration_cast(deadline - now).count();
+auto read_bytes =
+m_conn.Read(read_buffer + total_read_bytes, size - total_read_bytes, timeout_usec, status, );
 if (error.Fail ())
 return error;
-tota_read_bytes += read_bytes;
+total_read_bytes += read_bytes;
+if (status != eConnectionStatusSuccess)
+break;
+now = steady_clock::now();
 }
+if (total_read_bytes < size)
+error = Error("Unable to read requested number of bytes. Connection status: %d.", status);
 return error;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.

2016-05-04 Thread Renato Golin via lldb-commits
rengolin added a comment.

In http://reviews.llvm.org/D19604#420681, @jasonmolenda wrote:

> fwiw, there are ARM cores that only support thumb - the Cortex M series.


And they're still "armv7". :)

Remember, "armv7" is *not* the same as ARMv7A+NEON. If the only thing you have 
is "armv7" or even "armv7-a", you *cannot* assume NEON is present.

> The importance of the triple used will come in to play when you try to 
> evaluate an expression on the device -- lldb will call into llvm to parse/jit 
> the expression into machine code for the device.  For instance, if 
> "arm-windows" translates to a minimum arm target, llvm may not think it has 
> any fp/NEON instructions.


This is worrying. LLDB should *not* rely only on the triple, but all 
architectural options (mcpu/mtune/march/mfpu/mfloat-abi).

Without it, it can infer very little, and obscure bugs will crop up if the 
meaning of the triple changes slightly in the future.

> As for lldb disassembling as arm/thumb (or instruction emulation for 
> unwinding), today it doesn't use the CPSR/XPSR T bit to tell if the current 
> instruction is thumb or not, it depends on annotations in the symbol file to 
> do this correctly.  I don't think it uses the 0th bit of saved pc values up 
> the stack to tell this either -- it is a pretty fixed model of depending on 
> the symbols to indicate whether they're arm or thumb.


These are the easy cases. You still need both disassemblers to areas where you 
have no idea what it is (system binaries, etc.), where you have to try both and 
see which one has the least number of errors. :)

cheers,
--renato


http://reviews.llvm.org/D19604



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