[Lldb-commits] [lldb] r343718 - Adding skipIf to std::variant libc++ data-formatter test since get is not available before macOS 10.14

2018-10-03 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Oct  3 13:52:56 2018
New Revision: 343718

URL: http://llvm.org/viewvc/llvm-project?rev=343718&view=rev
Log:
Adding skipIf to std::variant libc++ data-formatter test since get is not 
available before macOS 10.14

Patch by Shafik Yaghmour

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py?rev=343718&r1=343717&r2=343718&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
 Wed Oct  3 13:52:56 2018
@@ -21,6 +21,8 @@ class LibcxxOptionalDataFormatterTestCas
 @skipIf(oslist=no_match(["macosx"]), compiler="clang", 
compiler_version=['<', '5.0'])
 ## We are skipping gcc version less that 5.1 since this test requires 
-std=c++17
 @skipIf(compiler="gcc", compiler_version=['<', '5.1'])
+## std::get is unavailable for std::variant before macOS 10.14
+@skipIf(macos_version=["<", "10.14"])
 
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""


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


[Lldb-commits] [lldb] r344371 - Adding support to step into the callable wrapped by libc++ std::function

2018-10-12 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Oct 12 10:20:39 2018
New Revision: 344371

URL: http://llvm.org/viewvc/llvm-project?rev=344371&view=rev
Log:
Adding support to step into the callable wrapped by libc++ std::function

rdar://problem/14365983

Differential Revision: https://reviews.llvm.org/D52851

Added:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp
Modified:
lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
lldb/trunk/source/Target/CPPLanguageRuntime.cpp
lldb/trunk/source/Target/ThreadPlanStepThrough.cpp

Modified: lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h?rev=344371&r1=344370&r2=344371&view=diff
==
--- lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h Fri Oct 12 10:20:39 2018
@@ -56,6 +56,19 @@ public:
   bool GetObjectDescription(Stream &str, Value &value,
 ExecutionContextScope *exe_scope) override;
 
+  /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
+  ///
+  /// @param[in] thread
+  /// Curent thrad of execution.
+  ///
+  /// @param[in] stop_others
+  /// True if other threads should pause during execution.
+  ///
+  /// @return
+  ///  A ThreadPlan Shared pointer
+  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+  bool stop_others);
+
 protected:
   //--
   // Classes that inherit from CPPLanguageRuntime can see and modify these

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/Makefile?rev=344371&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/Makefile
 Fri Oct 12 10:20:39 2018
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+CXXFLAGS += -std=c++11
+USE_LIBCPP := 1
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py?rev=344371&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
 Fri Oct 12 10:20:39 2018
@@ -0,0 +1,71 @@
+"""
+Test stepping into std::function
+"""
+
+from __future__ import print_function
+
+
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LibCxxFunctionTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+@add_test_categories(["libc++"])
+def test(self):
+"""Test that std::function as defined by libc++ is correctly printed 
by LLDB"""
+self.build()
+
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+self.source_foo_line = line_number(
+self.main_source, '// Source foo start line')
+self.source_lambda_f2_line = line_number(
+self.main_source, '// Source lambda used by f2 start line')
+self.source_lambda_f3_line = line_number(
+self.main_source, '// Source lambda used by f3 start line')
+self.source_bar_operator_line = line_number(
+self.main_source, '// Source Bar::operator()() start line')
+self.source_bar_add_num_line = line_number(
+self.main_source, '// Source Bar::add_num start line')
+self.source_main_invoking_f1 = line_number(
+self.main_source, '// Source main invoking f1')
+
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+self, "// Set break point at this line.", self.main_source_spec)
+
+thread.StepIn

[Lldb-commits] [lldb] r344407 - Changing test names in TestDataFormatterLibcxxVariant.py and TestStdFunctionStepIntoCallable.py to be unique, NFC

2018-10-12 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Oct 12 12:46:17 2018
New Revision: 344407

URL: http://llvm.org/viewvc/llvm-project?rev=344407&view=rev
Log:
Changing test names in TestDataFormatterLibcxxVariant.py and 
TestStdFunctionStepIntoCallable.py to be unique, NFC

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py?rev=344407&r1=344406&r2=344407&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
 Fri Oct 12 12:46:17 2018
@@ -12,7 +12,7 @@ from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-class LibcxxOptionalDataFormatterTestCase(TestBase):
+class LibcxxVariantDataFormatterTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py?rev=344407&r1=344406&r2=344407&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
 Fri Oct 12 12:46:17 2018
@@ -12,7 +12,7 @@ from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class LibCxxFunctionTestCase(TestBase):
+class LibCxxFunctionSteppingIntoCallableTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 


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


[Lldb-commits] [lldb] r345402 - [DataFormatters] Adding formatters for libc++ std::u16string and std::u32string

2018-10-26 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Oct 26 10:00:48 2018
New Revision: 345402

URL: http://llvm.org/viewvc/llvm-project?rev=345402&view=rev
Log:
[DataFormatters] Adding formatters for libc++ std::u16string and std::u32string

rdar://problem/41302849

Differential Revision: https://reviews.llvm.org/D53656

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile?rev=345402&r1=345401&r2=345402&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
 Fri Oct 26 10:00:48 2018
@@ -4,4 +4,4 @@ CXX_SOURCES := main.cpp
 
 USE_LIBCPP := 1
 include $(LEVEL)/Makefile.rules
-CXXFLAGS += -O0
+CXXFLAGS += -std=c++11 -O0

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py?rev=345402&r1=345401&r2=345402&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
 Fri Oct 26 10:00:48 2018
@@ -68,7 +68,9 @@ class LibcxxStringDataFormatterTestCase(
 '(%s::string) q = "hello world"'%ns,
 '(%s::string) Q = "quite a long std::strin with lots of info 
inside it"'%ns,
 '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns,
-'(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ 
ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns])
+'(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ 
ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns,
+'(%s::u16string) u16_string = u"ß水氶"'%ns,
+'(%s::u32string) u32_string = U"🍄🍅🍆🍌"'%ns])
 
 self.runCmd("n")
 
@@ -98,4 +100,6 @@ class LibcxxStringDataFormatterTestCase(
 '(%s::string) q = "hello world"'%ns,
 '(%s::string) Q = "quite a long std::strin with lots of info 
inside it"'%ns,
 '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns,
-'(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ 
ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns])
+'(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ 
ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns,
+'(%s::u16string) u16_string = u"ß水氶"'%ns,
+'(%s::u32string) u32_string = U"🍄🍅🍆🍌"'%ns])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp?rev=345402&r1=345401&r2=345402&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
 Fri Oct 26 10:00:48 2018
@@ -10,6 +10,8 @@ int main()
 std::string 
TheVeryLongOne("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567

[Lldb-commits] [lldb] r346428 - Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter.

2018-11-08 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Nov  8 10:42:00 2018
New Revision: 346428

URL: http://llvm.org/viewvc/llvm-project?rev=346428&view=rev
Log:
Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove 
redundant parameter which can be calculated from other parameter.

rdar://problem/43822994

Differential Revision: https://reviews.llvm.org/D54003

Added:
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=346428&r1=346427&r2=346428&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Nov  8 10:42:00 2018
@@ -903,9 +903,8 @@ public:
   // Modifying Enumeration types
   //--
   clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
-  lldb::opaque_compiler_type_t type,
-  const CompilerType &enumerator_qual_type, const Declaration &decl,
-  const char *name, int64_t enum_value, uint32_t enum_value_bit_size);
+  const CompilerType &enum_type, const Declaration &decl, const char *name,
+  int64_t enum_value, uint32_t enum_value_bit_size);
 
   CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type);
 

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile?rev=346428&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
 Thu Nov  8 10:42:00 2018
@@ -0,0 +1,6 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+CXXFLAGS += -std=c++11
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py?rev=346428&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 Thu Nov  8 10:42:00 2018
@@ -0,0 +1,44 @@
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ExprXValuePrintingTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+  '// Set break point at this line.', 
self.main_source_spec)
+frame = thread.GetFrameAtIndex(0)
+
+self.expect("expr f == Foo::FooBar",
+substrs=['(bool) $0 = true'])
+
+value = frame.EvaluateExpression("f == Foo::FooBar")
+self.assertTrue(value.IsValid())
+self.assertTrue(value.GetError().Success())
+self.assertEqual(value.GetValueAsUnsigned(), 1)
+
+value = frame.EvaluateExpression("b == BarBar")
+self.assertTrue(value.IsValid())
+self.assertTrue(value.GetError().Success())
+self.assertEqual(value.GetValueAsUnsigned(), 1)
+
+## b is not a Foo
+value = frame.EvaluateExpression("b == Foo::FooBar")
+self.assertTrue(value.IsValid())
+self.assertFalse(value.GetError().Success())
+
+## integral is not implicitly convertible to a scoped enum
+value = frame.EvaluateExpression("1 == Foo::FooBar")
+self.assertTrue(value.IsValid())
+self.assertFalse(value.GetError().Success())

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_comman

[Lldb-commits] [lldb] r348629 - Revert "Introduce ObjectFileBreakpad"

2018-12-07 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Dec  7 10:59:00 2018
New Revision: 348629

URL: http://llvm.org/viewvc/llvm-project?rev=348629&view=rev
Log:
Revert "Introduce ObjectFileBreakpad"

This reverts commit 5e056e624cc57bb22a4c29a70b522783c6242293.

Reverting because this lldb cmake bot: 
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/13712/

Removed:
lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms
lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms
lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms
lldb/trunk/lit/Modules/Breakpad/Inputs/identification-linux.syms
lldb/trunk/lit/Modules/Breakpad/Inputs/identification-macosx.syms
lldb/trunk/lit/Modules/Breakpad/Inputs/identification-windows.syms
lldb/trunk/lit/Modules/Breakpad/breakpad-identification.test
lldb/trunk/lit/Modules/Breakpad/lit.local.cfg
lldb/trunk/source/Plugins/ObjectFile/Breakpad/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
lldb/trunk/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
Modified:
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Plugins/ObjectFile/CMakeLists.txt
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=348629&r1=348628&r2=348629&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Fri Dec  7 10:59:00 2018
@@ -817,16 +817,4 @@ private:
 
 } // namespace lldb_private
 
-namespace llvm {
-template <> struct format_provider {
-  static void format(const lldb_private::ObjectFile::Type &type,
- raw_ostream &OS, StringRef Style);
-};
-
-template <> struct format_provider {
-  static void format(const lldb_private::ObjectFile::Strata &strata,
- raw_ostream &OS, StringRef Style);
-};
-} // namespace llvm
-
 #endif // liblldb_ObjectFile_h_

Removed: lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms?rev=348628&view=auto
==
--- lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms (original)
+++ lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms (removed)
@@ -1,2 +0,0 @@
-MODULE Linux x86_64 E5894855+C35D+0 linux.out
-PUBLIC 1000 0 _start

Removed: lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms?rev=348628&view=auto
==
--- lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms (original)
+++ lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms (removed)
@@ -1,2 +0,0 @@
-MODULE Linux x86_64 E5894855C35DC linux.out
-PUBLIC 1000 0 _start

Removed: lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms?rev=348628&view=auto
==
--- lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms (original)
+++ lldb/trunk/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms (removed)
@@ -1,2 +0,0 @@
-MODULE Linux x86_64 E58X4855C35DXCCC0 linux.out
-PUBLIC 1000 0 _start

Removed: lldb/trunk/lit/Modules/Breakpad/Inputs/identification-linux.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/Breakpad/Inputs/identification-linux.syms?rev=348628&view=auto
==
--- lldb/trunk/lit/Modules/Breakpad/Inputs/identification-linux.syms (original)
+++ lldb/trunk/lit/Modules/Breakpad/Inputs/identification-linux.syms (removed)
@@ -1,6 +0,0 @@
-MODULE Linux x86_64 E5894855C35D0 linux.out
-INFO CODE_ID 554889E55DC3
-PUBLIC 1000 0 _start
-STACK CFI INIT 1000 6 .cfa: $rsp 8 + .ra: .cfa -8 + ^
-STACK CFI 1001 $rbp: .cfa -16 + ^ .cfa: $rsp 16 +
-STACK CFI 1004 .cfa: $rbp 16 +

Removed: lldb/trunk/lit/Modules/Breakpad/Inputs/identification-macosx.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/Breakpad/Inputs/identification-macosx.syms?rev=348628&view=auto
==
--- lldb/trunk/lit/Modules/Breakpad/Inputs/identification-macosx.syms (original)
+++ lldb/trunk/lit/Modules/Breakpad/Inputs/identification-macosx.syms (removed)
@@

Re: [Lldb-commits] [lldb] r348592 - Introduce ObjectFileBreakpad

2018-12-07 Thread Shafik Yaghmour via lldb-commits
Pavel,

I just reverted it.

-Shafik

> On Dec 7, 2018, at 10:46 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> On 07/12/2018 19:39, Davide Italiano wrote:
>> Pavel, this broke the MacOS lldb cmake bot.
>> In particular, this test started failing.
>> lldb-Suite.macosx/function-starts.TestFunctionStarts.py
>> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/
>> May I ask you to take a look?
> 
> That's interesting. I can't look at it right now. Could you please revert 
> that for me, and I'll check it out later?
> ___
> 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] [lldb] r348810 - [DataFormatters] Fixes to libc++ std::function formatter to deal with ABI change see

2018-12-10 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Dec 10 15:26:38 2018
New Revision: 348810

URL: http://llvm.org/viewvc/llvm-project?rev=348810&view=rev
Log:
[DataFormatters] Fixes to libc++ std::function formatter to deal with ABI 
change see

https://reviews.llvm.org/D55045

Modified:
lldb/trunk/source/Target/CPPLanguageRuntime.cpp

Modified: lldb/trunk/source/Target/CPPLanguageRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/CPPLanguageRuntime.cpp?rev=348810&r1=348809&r2=348810&view=diff
==
--- lldb/trunk/source/Target/CPPLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/CPPLanguageRuntime.cpp Mon Dec 10 15:26:38 2018
@@ -93,6 +93,15 @@ CPPLanguageRuntime::FindLibCppStdFunctio
   //we will obtain the name from this pointer.
   ValueObjectSP member__f_(
   valobj_sp->GetChildMemberWithName(ConstString("__f_"), true));
+
+  if (member__f_) {
+ValueObjectSP sub_member__f_(
+   member__f_->GetChildMemberWithName(ConstString("__f_"), true));
+
+if (sub_member__f_)
+member__f_ = sub_member__f_;
+  }
+
   lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
 
   optional_info.member__f_pointer_value = member__f_pointer_value;


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


[Lldb-commits] [lldb] r341879 - First test commit into svn, adding space to comment

2018-09-10 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Sep 10 16:12:29 2018
New Revision: 341879

URL: http://llvm.org/viewvc/llvm-project?rev=341879&view=rev
Log:
First test commit into svn, adding space to comment

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

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp?rev=341879&r1=341878&r2=341879&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp Mon Sep 10 
16:12:29 2018
@@ -45,7 +45,7 @@ bool OptionalFrontEnd::Update() {
 
   // __engaged_ is a bool flag and is true if the optional contains a value.
   // Converting it to unsigned gives us a size of 1 if it contains a value
-  // and 0 if not.
+  // and 0 if not .
   m_size = engaged_sp->GetValueAsUnsigned(0);
 
   return false;


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


[Lldb-commits] [lldb] r341881 - Undoing first commit which added a space to a comment

2018-09-10 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Sep 10 16:18:32 2018
New Revision: 341881

URL: http://llvm.org/viewvc/llvm-project?rev=341881&view=rev
Log:
Undoing first commit which added a space to a comment

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

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp?rev=341881&r1=341880&r2=341881&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp Mon Sep 10 
16:18:32 2018
@@ -45,7 +45,7 @@ bool OptionalFrontEnd::Update() {
 
   // __engaged_ is a bool flag and is true if the optional contains a value.
   // Converting it to unsigned gives us a size of 1 if it contains a value
-  // and 0 if not .
+  // and 0 if not.
   m_size = engaged_sp->GetValueAsUnsigned(0);
 
   return false;


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


[Lldb-commits] [lldb] r341957 - Remove undefined behavior around the use of StateType

2018-09-11 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Tue Sep 11 09:08:05 2018
New Revision: 341957

URL: http://llvm.org/viewvc/llvm-project?rev=341957&view=rev
Log:
Remove undefined behavior around the use of StateType

rdar://problem/43530233

Patch by Shafik Yaghmour.

Differential Revision: https://reviews.llvm.org/D51445

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/scripts/Python/python-typemaps.swig
lldb/trunk/unittests/Utility/StateTest.cpp

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=341957&r1=341956&r2=341957&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Sep 11 09:08:05 2018
@@ -54,9 +54,10 @@ enum StateType {
   eStateCrashed,   ///< Process or thread has crashed and can be examined.
   eStateDetached,  ///< Process has been detached and can't be examined.
   eStateExited,///< Process has exited and can't be examined.
-  eStateSuspended  ///< Process or thread is in a suspended state as far
+  eStateSuspended, ///< Process or thread is in a suspended state as far
///< as the debugger is concerned while other processes
///< or threads get the chance to run.
+  kLastStateType = eStateSuspended  
 };
 
 //--

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=341957&r1=341956&r2=341957&view=diff
==
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Tue Sep 11 09:08:05 2018
@@ -77,6 +77,26 @@
   }
 }
 
+%typemap(in) lldb::StateType {
+  using namespace lldb_private;
+  if (PythonInteger::Check($input))
+  {
+PythonInteger py_int(PyRefType::Borrowed, $input);
+int64_t state_type_value = py_int.GetInteger() ;
+
+if (state_type_value > lldb::StateType::kLastStateType) {
+  PyErr_SetString(PyExc_ValueError, "Not a valid StateType value");
+  return nullptr;
+}
+$1 = static_cast(state_type_value);
+  }
+  else
+  {
+PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+return nullptr;
+  }
+}
+
 /* Typemap definitions to allow SWIG to properly handle char buffer. */
 
 // typemap for a char buffer

Modified: lldb/trunk/unittests/Utility/StateTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/StateTest.cpp?rev=341957&r1=341956&r2=341957&view=diff
==
--- lldb/trunk/unittests/Utility/StateTest.cpp (original)
+++ lldb/trunk/unittests/Utility/StateTest.cpp Tue Sep 11 09:08:05 2018
@@ -15,7 +15,17 @@ using namespace lldb;
 using namespace lldb_private;
 
 TEST(StateTest, Formatv) {
-  EXPECT_EQ("exited", llvm::formatv("{0}", eStateExited).str());
+  EXPECT_EQ("invalid", llvm::formatv("{0}", eStateInvalid).str());
+  EXPECT_EQ("unloaded", llvm::formatv("{0}", eStateUnloaded).str());
+  EXPECT_EQ("connected", llvm::formatv("{0}", eStateConnected).str());
+  EXPECT_EQ("attaching", llvm::formatv("{0}", eStateAttaching).str());
+  EXPECT_EQ("launching", llvm::formatv("{0}", eStateLaunching).str());
   EXPECT_EQ("stopped", llvm::formatv("{0}", eStateStopped).str());
-  EXPECT_EQ("unknown", llvm::formatv("{0}", StateType(-1)).str());
+  EXPECT_EQ("running", llvm::formatv("{0}", eStateRunning).str());
+  EXPECT_EQ("stepping", llvm::formatv("{0}", eStateStepping).str());
+  EXPECT_EQ("crashed", llvm::formatv("{0}", eStateCrashed).str());
+  EXPECT_EQ("detached", llvm::formatv("{0}", eStateDetached).str());
+  EXPECT_EQ("exited", llvm::formatv("{0}", eStateExited).str());
+  EXPECT_EQ("suspended", llvm::formatv("{0}", eStateSuspended).str());
+  
 }


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


[Lldb-commits] [lldb] r341991 - Refactoring std::function formatter to move core functionality into CPPLanguageRuntime

2018-09-11 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Tue Sep 11 13:58:28 2018
New Revision: 341991

URL: http://llvm.org/viewvc/llvm-project?rev=341991&view=rev
Log:
Refactoring std::function formatter to move core functionality into 
CPPLanguageRuntime

Patch by Shafik Yaghmour.

Differential Revision: https://reviews.llvm.org/D51896

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

Modified: lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h?rev=341991&r1=341990&r2=341991&view=diff
==
--- lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h Tue Sep 11 13:58:28 2018
@@ -24,6 +24,25 @@ namespace lldb_private {
 
 class CPPLanguageRuntime : public LanguageRuntime {
 public:
+  enum class LibCppStdFunctionCallableCase {
+Lambda = 0,
+CallableObject,
+FreeOrMemberFunction,
+Invalid
+  };
+
+  struct LibCppStdFunctionCallableInfo {
+Symbol callable_symbol;
+Address callable_address;
+LineEntry callable_line_entry;
+lldb::addr_t member__f_pointer_value = 0u;
+LibCppStdFunctionCallableCase callable_case =
+LibCppStdFunctionCallableCase::Invalid;
+  };
+
+  LibCppStdFunctionCallableInfo
+  FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);
+
   ~CPPLanguageRuntime() override;
 
   lldb::LanguageType GetLanguageType() const override {

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp?rev=341991&r1=341990&r2=341991&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp Tue Sep 11 13:58:28 
2018
@@ -23,6 +23,7 @@
 #include "lldb/DataFormatters/TypeSummary.h"
 #include "lldb/DataFormatters/VectorIterator.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ProcessStructReader.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
@@ -65,216 +66,44 @@ bool lldb_private::formatters::LibcxxFun
   if (!valobj_sp)
 return false;
 
-  // Member __f_ has type __base*, the contents of which will hold:
-  // 1) a vtable entry which may hold type information needed to discover the
-  //lambda being called
-  // 2) possibly hold a pointer to the callable object
-  // e.g.
-  //
-  // (lldb) frame var -R  f_display
-  // (std::__1::function) f_display = {
-  //  __buf_ = {
-  //  …
-  // }
-  //  __f_ = 0x7ffeefbffa00
-  // }
-  // (lldb) memory read -fA 0x7ffeefbffa00
-  // 0x7ffeefbffa00: ... `vtable for std::__1::__function::__funcGetChildMemberWithName(ConstString("__f_"), true));
-  lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
-
   ExecutionContext exe_ctx(valobj_sp->GetExecutionContextRef());
   Process *process = exe_ctx.GetProcessPtr();
 
   if (process == nullptr)
 return false;
 
-  uint32_t address_size = process->GetAddressByteSize();
-  Status status;
-
-  // First item pointed to by __f_ should be the pointer to the vtable for
-  // a __base object.
-  lldb::addr_t vtable_address =
-  process->ReadPointerFromMemory(member__f_pointer_value, status);
-
-  if (status.Fail())
-return false;
-
-  bool found_wrapped_function = false;
-
-  // Using scoped exit so we can use early return and still execute the default
-  // action in case we don't find the wrapper function. Otherwise we can't use
-  // early exit without duplicating code.
-  auto default_print_on_exit = llvm::make_scope_exit(
-  [&found_wrapped_function, &stream, &member__f_pointer_value]() {
-if (!found_wrapped_function)
-  stream.Printf(" __f_ = %" PRIu64, member__f_pointer_value);
-  });
-
-  lldb::addr_t address_after_vtable = member__f_pointer_value + address_size;
-  // As commened above we may not have a function pointer but if we do we will
-  // need it.
-  lldb::addr_t possible_function_address =
-  process->ReadPointerFromMemory(address_after_vtable, status);
-
-  if (status.Fail())
-return false;
-
-  Target &target = process->GetTarget();
-
-  if (target.GetSectionLoadList().IsEmpty())
-return false;
-
-  Address vtable_addr_resolved;
-  SymbolContext sc;
-  Symbol *symbol;
+  CPPLanguageRuntime *cpp_runtime = process->GetCPPLanguageRuntime();
 
-  if (!target.GetSectionLoadList().ResolveLoadAddress(vtable_address,
-  vtable_addr_resolved))
+  if (!cpp_runtime)
 return false;
 
-  target.GetImages().ResolveSymbolContextForAddress(
-  vtable_addr_res

[Lldb-commits] [lldb] r342421 - [DataFormatters] Add formatter for C++17 std::variant

2018-09-17 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Sep 17 15:10:44 2018
New Revision: 342421

URL: http://llvm.org/viewvc/llvm-project?rev=342421&view=rev
Log:
[DataFormatters] Add formatter for C++17 std::variant

rdar://problem/43691454

Patch by Shafik Yaghmour.

Differential Revision: https://reviews.llvm.org/D51520

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=342421&r1=342420&r2=342421&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Sep 17 15:10:44 2018
@@ -401,6 +401,8 @@
AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; 
};
AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; 
};
945261C41B9A11FC00BF138D /* LibCxxUnorderedMap.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */; };
+   E414F6F121388F6C00C50BC6 /* LibCxxVariant.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp 
*/; };
+   E414F6EE21388F0300C50BC6 /* LibCxxVariant.h in Headers */ = 
{isa = PBXBuildFile; fileRef = E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */; 
};
945261C51B9A11FC00BF138D /* LibCxxVector.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 945261BB1B9A11E800BF138D /* LibCxxVector.cpp */; 
};
945261C61B9A11FC00BF138D /* LibStdcpp.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261BC1B9A11E800BF138D /* LibStdcpp.cpp */; };
4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
@@ -2056,6 +2058,8 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = 
""; };
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = 
""; };
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxUnorderedMap.cpp; path = Language/CPlusPlus/LibCxxUnorderedMap.cpp; 
sourceTree = ""; };
+   E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxVariant.cpp; path = Language/CPlusPlus/LibCxxVariant.cpp; 
sourceTree = ""; };
+   E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
LibCxxVariant.h; path = Language/CPlusPlus/LibCxxVariant.h; sourceTree = 
""; };
945261BB1B9A11E800BF138D /* LibCxxVector.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxVector.cpp; path = Language/CPlusPlus/LibCxxVector.cpp; sourceTree = 
""; };
945261BC1B9A11E800BF138D /* LibStdcpp.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibStdcpp.cpp; 
path = Language/CPlusPlus/LibStdcpp.cpp; sourceTree = ""; };
945261BD1B9A11E800BF138D /* LibStdcpp.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibStdcpp.h; path 
= Language/CPlusPlus/LibStdcpp.h; sourceTree = ""; };
@@ -6475,6 +6479,8 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9A11E800BF138D /* 
LibCxxUn

[Lldb-commits] [lldb] r342424 - Revert "[DataFormatters] Add formatter for C++17 std::variant"

2018-09-17 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Sep 17 16:15:35 2018
New Revision: 342424

URL: http://llvm.org/viewvc/llvm-project?rev=342424&view=rev
Log:
Revert "[DataFormatters] Add formatter for C++17 std::variant"

This reverts commit r342421.

Because it breaks build bot 
http://green.lab.llvm.org/green/job/lldb-cmake-clang-5.0.2//418/console

Removed:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=342424&r1=342423&r2=342424&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Sep 17 16:15:35 2018
@@ -401,8 +401,6 @@
AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; 
};
AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; 
};
945261C41B9A11FC00BF138D /* LibCxxUnorderedMap.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */; };
-   E414F6F121388F6C00C50BC6 /* LibCxxVariant.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp 
*/; };
-   E414F6EE21388F0300C50BC6 /* LibCxxVariant.h in Headers */ = 
{isa = PBXBuildFile; fileRef = E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */; 
};
945261C51B9A11FC00BF138D /* LibCxxVector.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 945261BB1B9A11E800BF138D /* LibCxxVector.cpp */; 
};
945261C61B9A11FC00BF138D /* LibStdcpp.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261BC1B9A11E800BF138D /* LibStdcpp.cpp */; };
4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
@@ -2058,8 +2056,6 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = 
""; };
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = 
""; };
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxUnorderedMap.cpp; path = Language/CPlusPlus/LibCxxUnorderedMap.cpp; 
sourceTree = ""; };
-   E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxVariant.cpp; path = Language/CPlusPlus/LibCxxVariant.cpp; 
sourceTree = ""; };
-   E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
LibCxxVariant.h; path = Language/CPlusPlus/LibCxxVariant.h; sourceTree = 
""; };
945261BB1B9A11E800BF138D /* LibCxxVector.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxVector.cpp; path = Language/CPlusPlus/LibCxxVector.cpp; sourceTree = 
""; };
945261BC1B9A11E800BF138D /* LibStdcpp.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibStdcpp.cpp; 
path = Language/CPlusPlus/LibStdcpp.cpp; sourceTree = ""; };
945261BD1B9A11E800BF138D /* LibStdcpp.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibStdcpp.h; path 
= Language/CPlusPlus/LibStdcpp.h; sourceTree = ""; };
@@ -6479,8 +6475,6 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */,
-   E414F6ED21388F0200C50BC6 /*

[Lldb-commits] [lldb] r342563 - [DataFormatters] Add formatter for C++17 std::variant

2018-09-19 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Sep 19 11:07:05 2018
New Revision: 342563

URL: http://llvm.org/viewvc/llvm-project?rev=342563&view=rev
Log:
[DataFormatters] Add formatter for C++17 std::variant

rdar://problem/43691454

Patch by Shafik Yaghmour.

Differential Revision: https://reviews.llvm.org/D51520

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVariant.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=342563&r1=342562&r2=342563&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Sep 19 11:07:05 2018
@@ -401,6 +401,8 @@
AF9FF1F71FAA79FE00474976 /* LibCxxQueue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */; 
};
AF9FF1F51FAA79A400474976 /* LibCxxTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */; 
};
945261C41B9A11FC00BF138D /* LibCxxUnorderedMap.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */; };
+   E414F6F121388F6C00C50BC6 /* LibCxxVariant.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp 
*/; };
+   E414F6EE21388F0300C50BC6 /* LibCxxVariant.h in Headers */ = 
{isa = PBXBuildFile; fileRef = E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */; 
};
945261C51B9A11FC00BF138D /* LibCxxVector.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 945261BB1B9A11E800BF138D /* LibCxxVector.cpp */; 
};
945261C61B9A11FC00BF138D /* LibStdcpp.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 945261BC1B9A11E800BF138D /* LibStdcpp.cpp */; };
4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
@@ -2056,6 +2058,8 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxQueue.cpp; path = Language/CPlusPlus/LibCxxQueue.cpp; sourceTree = 
""; };
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxTuple.cpp; path = Language/CPlusPlus/LibCxxTuple.cpp; sourceTree = 
""; };
945261BA1B9A11E800BF138D /* LibCxxUnorderedMap.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxUnorderedMap.cpp; path = Language/CPlusPlus/LibCxxUnorderedMap.cpp; 
sourceTree = ""; };
+   E414F6F021388F6B00C50BC6 /* LibCxxVariant.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibCxxVariant.cpp; path = Language/CPlusPlus/LibCxxVariant.cpp; 
sourceTree = ""; };
+   E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
LibCxxVariant.h; path = Language/CPlusPlus/LibCxxVariant.h; sourceTree = 
""; };
945261BB1B9A11E800BF138D /* LibCxxVector.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
LibCxxVector.cpp; path = Language/CPlusPlus/LibCxxVector.cpp; sourceTree = 
""; };
945261BC1B9A11E800BF138D /* LibStdcpp.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibStdcpp.cpp; 
path = Language/CPlusPlus/LibStdcpp.cpp; sourceTree = ""; };
945261BD1B9A11E800BF138D /* LibStdcpp.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibStdcpp.h; path 
= Language/CPlusPlus/LibStdcpp.h; sourceTree = ""; };
@@ -6475,6 +6479,8 @@
AF9FF1F61FAA79FE00474976 /* LibCxxQueue.cpp */,
AF9FF1F41FAA79A400474976 /* LibCxxTuple.cpp */,
945261BA1B9A11E800BF138D /* 
LibCxxUnorderedMap.cpp */,
+   E414F6ED21388F0200C50BC6 /* LibCxxVariant.h */,
+ 

[Lldb-commits] [lldb] r342663 - Refactor FindVariable() core functionality into StackFrame out of SBFrame

2018-09-20 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Sep 20 10:06:34 2018
New Revision: 342663

URL: http://llvm.org/viewvc/llvm-project?rev=342663&view=rev
Log:
Refactor FindVariable() core functionality into StackFrame out of SBFrame

rdar://problem/14365983

Patch by Shafik Yaghmour

Differential Revision: https://reviews.llvm.org/D52247

Modified:
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=342663&r1=342662&r2=342663&view=diff
==
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Thu Sep 20 10:06:34 2018
@@ -504,6 +504,21 @@ public:
  int64_t offset);
 
   //--
+  /// Attempt to reconstruct the ValueObject for a variable with a given \a 
name
+  /// from within the current StackFrame, within the current block. The search
+  /// for the variable starts in the deepest block corresponding to the current
+  /// PC in the stack frame and traverse through all parent blocks stopping at
+  /// inlined function boundaries.
+  ///
+  /// @params [in] name
+  ///   The name of the variable.
+  ///
+  /// @return
+  ///   The ValueObject if found.
+  //--
+  lldb::ValueObjectSP FindVariable(ConstString name);
+
+  //--
   // lldb::ExecutionContextScope pure virtual functions
   //--
   lldb::TargetSP CalculateTarget() override;

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=342663&r1=342662&r2=342663&view=diff
==
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu Sep 20 10:06:34 2018
@@ -666,28 +666,10 @@ SBValue SBFrame::FindVariable(const char
 if (stop_locker.TryLock(&process->GetRunLock())) {
   frame = exe_ctx.GetFramePtr();
   if (frame) {
-VariableList variable_list;
-SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
+value_sp = frame->FindVariable(ConstString(name));
 
-if (sc.block) {
-  const bool can_create = true;
-  const bool get_parent_variables = true;
-  const bool stop_if_block_is_inlined_function = true;
-
-  if (sc.block->AppendVariables(
-  can_create, get_parent_variables,
-  stop_if_block_is_inlined_function,
-  [frame](Variable *v) { return v->IsInScope(frame); },
-  &variable_list)) {
-var_sp = variable_list.FindVariable(ConstString(name));
-  }
-}
-
-if (var_sp) {
-  value_sp =
-  frame->GetValueObjectForFrameVariable(var_sp, eNoDynamicValues);
+if (value_sp)
   sb_value.SetSP(value_sp, use_dynamic);
-}
   } else {
 if (log)
   log->Printf("SBFrame::FindVariable () => error: could not "

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=342663&r1=342662&r2=342663&view=diff
==
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Thu Sep 20 10:06:34 2018
@@ -1709,6 +1709,41 @@ lldb::ValueObjectSP StackFrame::GuessVal
 GetFrameCodeAddress());
 }
 
+lldb::ValueObjectSP StackFrame::FindVariable(ConstString name) {
+  ValueObjectSP value_sp;
+
+  if (!name)
+return value_sp;
+
+  TargetSP target_sp = CalculateTarget();
+  ProcessSP process_sp = CalculateProcess();
+
+  if (!target_sp && !process_sp)
+return value_sp;
+
+  VariableList variable_list;
+  VariableSP var_sp;
+  SymbolContext sc(GetSymbolContext(eSymbolContextBlock));
+
+  if (sc.block) {
+const bool can_create = true;
+const bool get_parent_variables = true;
+const bool stop_if_block_is_inlined_function = true;
+
+if (sc.block->AppendVariables(
+can_create, get_parent_variables, 
stop_if_block_is_inlined_function,
+[this](Variable *v) { return v->IsInScope(this); },
+&variable_list)) {
+  var_sp = variable_list.FindVariable(name);
+}
+
+if (var_sp)
+  value_sp = GetValueObjectForFrameVariable(var_sp, eNoDynamicValues);
+  }
+
+  return value_sp;
+}
+
 TargetSP StackFrame::CalculateTarget() {
   TargetSP target_sp;
   ThreadSP thread_sp(GetThread());



[Lldb-commits] [lldb] r352677 - Fix handling of CreateTemplateParameterList when there is an empty pack

2019-01-30 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Jan 30 13:48:56 2019
New Revision: 352677

URL: http://llvm.org/viewvc/llvm-project?rev=352677&view=rev
Log:
Fix handling of CreateTemplateParameterList when there is an empty pack

Summary:
When we are creating a ClassTemplateSpecializationDecl in 
ParseTypeFromDWARF(...) we are not handling the case where variadic pack is 
empty in the specialization. This patch handles that case and adds a test to 
prevent future regressions.

Differential Revision: https://reviews.llvm.org/D57363

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp
Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile?rev=352677&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/Makefile
 Wed Jan 30 13:48:56 2019
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py?rev=352677&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py
 Wed Jan 30 13:48:56 2019
@@ -0,0 +1,23 @@
+"""
+Test Expression Parser code gen for ClassTemplateSpecializationDecl to insure
+that we generate a TemplateTypeParmDecl in the TemplateParameterList for empty
+variadic packs.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestClassTemplateSpecializationParametersHandling(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_class_template_specialization(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp", False))
+
+self.expect("expr -u 0 -- b.foo()", substrs=['$0 = 1'])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp?rev=352677&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/class_template_specialization_empty_pack/main.cpp
 Wed Jan 30 13:48:56 2019
@@ -0,0 +1,9 @@
+template 
+struct A {
+int foo() { return 1;}
+};
+
+int main() {
+  A b;
+  return b.foo(); // break here
+}

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=352677&r1=352676&r2=352677&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Jan 30 13:48:56 2019
@@ -1549,25 +1549,24 @@ static TemplateParameterList *CreateTemp
 }
   }
 
-  if (template_param_infos.packed_args &&
-  template_param_infos.packed_args->args.size()) {
+  if (template_param_infos.packed_args) {
 IdentifierInfo *identifier_info = nullptr;
 if (template_param_infos.pack_name && template_param_infos.pack_name[0])
   identifier_info = &ast->Idents.get(template_param_infos.pack_name);
 const bool parameter_pack_true = true;
-if (IsV

[Lldb-commits] [lldb] r352772 - Fix use of non-existing variable in crashlog.py

2019-01-31 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Jan 31 09:33:17 2019
New Revision: 352772

URL: http://llvm.org/viewvc/llvm-project?rev=352772&view=rev
Log:
Fix use of non-existing variable in crashlog.py

Summary:
The method find_matching_slice(self) uses uuid_str on one of the paths but the 
variable does not exist and so this results in a NameError exception if we take 
that path.

Differential Revision: https://reviews.llvm.org/D57467

Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=352772&r1=352771&r2=352772&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Thu Jan 31 09:33:17 2019
@@ -260,7 +260,7 @@ class CrashLog(symbolication.Symbolicato
 if not self.resolved_path:
 self.unavailable = True
 print("error\nerror: unable to locate '%s' with UUID %s"
-  % (self.path, uuid_str))
+  % (self.path, self.get_normalized_uuid_string()))
 return False
 
 def locate_module_and_debug_symbols(self):


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


[Lldb-commits] [lldb] r355351 - [DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913

2019-03-04 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Mar  4 16:17:18 2019
New Revision: 355351

URL: http://llvm.org/viewvc/llvm-project?rev=355351&view=rev
Log:
[DataFormatters] Fix regression in libc++ std::atomic formatter caused by 
https://reviews.llvm.org/D56913

rdar://problem/48568543

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

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp?rev=355351&r1=355350&r2=355351&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp Mon Mar  4 
16:17:18 2019
@@ -15,11 +15,25 @@ using namespace lldb_private::formatters
 
 bool lldb_private::formatters::LibCxxAtomicSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
-  static ConstString g___a_("__a_");
 
-  if (ValueObjectSP child = valobj.GetChildMemberWithName(g___a_, true)) {
+  ValueObjectSP non_sythetic = valobj.GetNonSyntheticValue();
+  if (!non_sythetic)
+return false;
+
+  ValueObjectSP index_zero = non_sythetic->GetChildAtIndex(0, true);
+  if (!index_zero)
+return false;
+
+  ValueObjectSP member__a_ =
+  index_zero->GetChildMemberWithName(ConstString("__a_"), true);
+  if (!member__a_)
+return false;
+
+  if (ValueObjectSP member__a_value =
+  member__a_->GetChildMemberWithName(ConstString("__a_value"), true)) {
 std::string summary;
-if (child->GetSummaryAsCString(summary, options) && summary.size() > 0) {
+if (member__a_value->GetSummaryAsCString(summary, options) &&
+summary.size() > 0) {
   stream.Printf("%s", summary.c_str());
   return true;
 }
@@ -59,9 +73,17 @@ lldb_private::formatters::LibcxxStdAtomi
 : SyntheticChildrenFrontEnd(*valobj_sp), m_real_child(nullptr) {}
 
 bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() {
-  static ConstString g___a_("__a_");
+  ValueObjectSP index_zero = m_backend.GetChildAtIndex(0, true);
+  if (!index_zero)
+return false;
+
+  ValueObjectSP member__a_ =
+  index_zero->GetChildMemberWithName(ConstString("__a_"), true);
+  if (!member__a_)
+return false;
 
-  m_real_child = m_backend.GetChildMemberWithName(g___a_, true).get();
+  m_real_child =
+  member__a_->GetChildMemberWithName(ConstString("__a_value"), true).get();
 
   return false;
 }


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


[Lldb-commits] [lldb] r355352 - Revert "[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913"

2019-03-04 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Mar  4 16:29:58 2019
New Revision: 355352

URL: http://llvm.org/viewvc/llvm-project?rev=355352&view=rev
Log:
Revert "[DataFormatters] Fix regression in libc++ std::atomic formatter caused 
by https://reviews.llvm.org/D56913";

This reverts commit r355351.

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

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp?rev=355352&r1=355351&r2=355352&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp Mon Mar  4 
16:29:58 2019
@@ -15,25 +15,11 @@ using namespace lldb_private::formatters
 
 bool lldb_private::formatters::LibCxxAtomicSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  static ConstString g___a_("__a_");
 
-  ValueObjectSP non_sythetic = valobj.GetNonSyntheticValue();
-  if (!non_sythetic)
-return false;
-
-  ValueObjectSP index_zero = non_sythetic->GetChildAtIndex(0, true);
-  if (!index_zero)
-return false;
-
-  ValueObjectSP member__a_ =
-  index_zero->GetChildMemberWithName(ConstString("__a_"), true);
-  if (!member__a_)
-return false;
-
-  if (ValueObjectSP member__a_value =
-  member__a_->GetChildMemberWithName(ConstString("__a_value"), true)) {
+  if (ValueObjectSP child = valobj.GetChildMemberWithName(g___a_, true)) {
 std::string summary;
-if (member__a_value->GetSummaryAsCString(summary, options) &&
-summary.size() > 0) {
+if (child->GetSummaryAsCString(summary, options) && summary.size() > 0) {
   stream.Printf("%s", summary.c_str());
   return true;
 }
@@ -73,17 +59,9 @@ lldb_private::formatters::LibcxxStdAtomi
 : SyntheticChildrenFrontEnd(*valobj_sp), m_real_child(nullptr) {}
 
 bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() {
-  ValueObjectSP index_zero = m_backend.GetChildAtIndex(0, true);
-  if (!index_zero)
-return false;
-
-  ValueObjectSP member__a_ =
-  index_zero->GetChildMemberWithName(ConstString("__a_"), true);
-  if (!member__a_)
-return false;
+  static ConstString g___a_("__a_");
 
-  m_real_child =
-  member__a_->GetChildMemberWithName(ConstString("__a_value"), true).get();
+  m_real_child = m_backend.GetChildMemberWithName(g___a_, true).get();
 
   return false;
 }


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


[Lldb-commits] [lldb] r355422 - [DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913

2019-03-05 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Tue Mar  5 10:34:35 2019
New Revision: 355422

URL: http://llvm.org/viewvc/llvm-project?rev=355422&view=rev
Log:
[DataFormatters] Fix regression in libc++ std::atomic formatter caused by 
https://reviews.llvm.org/D56913

rdar://problem/48568543

Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.h

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp?rev=355422&r1=355421&r2=355422&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp Tue Mar  5 
10:34:35 2019
@@ -13,13 +13,68 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+//
+// We are supporting two versions of libc++ std::atomic
+//
+// Given std::atomic i;
+//
+// The previous version of std::atomic was laid out like this
+//
+// (lldb) frame var -L -R i
+// 0x7ffeefbff9a0: (std::__1::atomic) i = {
+// 0x7ffeefbff9a0:   std::__1::__atomic_base = {
+// 0x7ffeefbff9a0: std::__1::__atomic_base = {
+// 0x7ffeefbff9a0:   __a_ = 5
+//}
+//}
+// }
+//
+// In this case we need to obtain __a_ and the current version is laid out as 
so
+//
+// (lldb) frame var -L -R i
+// 0x7ffeefbff9b0: (std::__1::atomic) i = {
+// 0x7ffeefbff9b0:   std::__1::__atomic_base = {
+// 0x7ffeefbff9b0: std::__1::__atomic_base = {
+// 0x7ffeefbff9b0:   __a_ = {
+// 0x7ffeefbff9b0: std::__1::__cxx_atomic_base_impl = {
+// 0x7ffeefbff9b0:   __a_value = 5
+//}
+//  }
+//   }
+//}
+//}
+//
+// In this case we need to obtain __a_value
+//
+// The below method covers both cases and returns the relevant member as a
+// ValueObjectSP
+//
+ValueObjectSP
+lldb_private::formatters::GetLibCxxAtomicValue(ValueObject &valobj) {
+  ValueObjectSP non_sythetic = valobj.GetNonSyntheticValue();
+  if (!non_sythetic)
+return {};
+
+  ValueObjectSP member__a_ =
+  non_sythetic->GetChildMemberWithName(ConstString("__a_"), true);
+  if (!member__a_)
+return {};
+
+  ValueObjectSP member__a_value =
+  member__a_->GetChildMemberWithName(ConstString("__a_value"), true);
+  if (!member__a_value)
+return member__a_;
+
+  return member__a_value;
+}
+
 bool lldb_private::formatters::LibCxxAtomicSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
-  static ConstString g___a_("__a_");
 
-  if (ValueObjectSP child = valobj.GetChildMemberWithName(g___a_, true)) {
+  if (ValueObjectSP atomic_value = GetLibCxxAtomicValue(valobj)) {
 std::string summary;
-if (child->GetSummaryAsCString(summary, options) && summary.size() > 0) {
+if (atomic_value->GetSummaryAsCString(summary, options) &&
+summary.size() > 0) {
   stream.Printf("%s", summary.c_str());
   return true;
 }
@@ -59,9 +114,9 @@ lldb_private::formatters::LibcxxStdAtomi
 : SyntheticChildrenFrontEnd(*valobj_sp), m_real_child(nullptr) {}
 
 bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() {
-  static ConstString g___a_("__a_");
-
-  m_real_child = m_backend.GetChildMemberWithName(g___a_, true).get();
+  ValueObjectSP atomic_value = GetLibCxxAtomicValue(m_backend);
+  if (atomic_value)
+m_real_child = GetLibCxxAtomicValue(m_backend).get();
 
   return false;
 }

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.h?rev=355422&r1=355421&r2=355422&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.h (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxAtomic.h Tue Mar  5 
10:34:35 2019
@@ -17,6 +17,9 @@
 
 namespace lldb_private {
 namespace formatters {
+
+lldb::ValueObjectSP GetLibCxxAtomicValue(ValueObject &valobj);
+
 bool LibCxxAtomicSummaryProvider(ValueObject &valobj, Stream &stream,
  const TypeSummaryOptions &options);
 


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


[Lldb-commits] [lldb] r355525 - Adding test to cover the correct import of SourceLocation pertaining to a built-in during expression parsing

2019-03-06 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Mar  6 10:03:54 2019
New Revision: 355525

URL: http://llvm.org/viewvc/llvm-project?rev=355525&view=rev
Log:
Adding test to cover the correct import of SourceLocation pertaining to a 
built-in during expression parsing

Summary: This tests a fix in the ASTImpoter.cpp to ensure that we import 
built-in correctly,
see differential: https://reviews.llvm.org/D58743
Once this change is merged this test should pass and should catch regressions 
in this feature.

Differential Revision: https://reviews.llvm.org/D58790

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile?rev=355525&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile
 Wed Mar  6 10:03:54 2019
@@ -0,0 +1,6 @@
+LEVEL = ../../make
+
+OBJC_SOURCES := main.m
+
+include $(LEVEL)/Makefile.rules
+LDFLAGS += -framework Cocoa

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py?rev=355525&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py
 Wed Mar  6 10:03:54 2019
@@ -0,0 +1,27 @@
+"""
+They may be cases where an expression will import SourceLocation and if the
+SourceLocation ends up with a FileID that is a built-in we need to copy that
+buffer over correctly.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestImportBuiltinFileID(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+@skipIfDarwinEmbedded
+@add_test_categories(["gmodules"])
+def test_import_builtin_fileid(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.m", False))
+
+self.expect("expr int (*DBG_CGImageGetRenderingIntent)(void *) = ((int 
(*)(void *))CGImageGetRenderingIntent); DBG_CGImageGetRenderingIntent((void 
*)0x00);", 
+substrs=['$0 = 0'])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m?rev=355525&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m
 Wed Mar  6 10:03:54 2019
@@ -0,0 +1,6 @@
+#import 
+
+int main(int argc, const char * argv[]) {
+
+return 0; // break here
+}


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


[Lldb-commits] [lldb] r357188 - Regression test to ensure that we handling importing of std::vector of enums correctly

2019-03-28 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Mar 28 10:22:13 2019
New Revision: 357188

URL: http://llvm.org/viewvc/llvm-project?rev=357188&view=rev
Log:
Regression test to ensure that we handling importing of std::vector of enums 
correctly

Summary:
https://reviews.llvm.org/D59845 added a fix for the IsStructuralMatch(...) 
specialization for EnumDecl this test should pass once this fix is committed.

Differential Revision: https://reviews.llvm.org/D59847

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/main.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/Makefile?rev=357188&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/Makefile
 Thu Mar 28 10:22:13 2019
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py?rev=357188&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py
 Thu Mar 28 10:22:13 2019
@@ -0,0 +1,28 @@
+"""
+Test Expression Parser regression test to ensure that we handle enums
+correctly, in this case specifically std::vector of enums.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestVectorOfEnums(TestBase):
+
+  mydir = TestBase.compute_mydir(__file__)
+
+  def test_vector_of_enums(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp", False))
+
+self.expect("expr v", substrs=[
+ 'size=3',
+ '[0] = a',
+ '[1] = b',
+ '[2] = c',
+ '}'
+])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/main.cpp?rev=357188&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/main.cpp
 Thu Mar 28 10:22:13 2019
@@ -0,0 +1,14 @@
+#include 
+
+enum E {
+a,
+b,
+c,
+d
+} ;
+
+int main() {
+  std::vector v = {E::a, E::b, E::c};
+
+  return v.size(); // break here
+}


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


[Lldb-commits] [lldb] r357210 - Fix for regression test, since we rely on the formatter for std::vector in the test we need a libc++ category.

2019-03-28 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Mar 28 13:25:57 2019
New Revision: 357210

URL: http://llvm.org/viewvc/llvm-project?rev=357210&view=rev
Log:
Fix for regression test, since we rely on the formatter for std::vector in the 
test we need a libc++ category.

See differential https://reviews.llvm.org/D59847 for initial change that this 
fixes

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py?rev=357210&r1=357209&r2=357210&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/vector_of_enums/TestVectorOfEnums.py
 Thu Mar 28 13:25:57 2019
@@ -13,6 +13,7 @@ class TestVectorOfEnums(TestBase):
 
   mydir = TestBase.compute_mydir(__file__)
 
+  @add_test_categories(["libc++"])
   def test_vector_of_enums(self):
 self.build()
 


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


[Lldb-commits] [lldb] r358462 - [ASTImporter] Regression test to ensure that we handling importing of anonymous enums correctly

2019-04-15 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Apr 15 16:05:45 2019
New Revision: 358462

URL: http://llvm.org/viewvc/llvm-project?rev=358462&view=rev
Log:
[ASTImporter] Regression test to ensure that we handling importing of anonymous 
enums correctly

Summary:
https://reviews.llvm.org/D51633 added error handling in the ASTImporter.cpp 
which uncovered an underlying bug in which we used the wrong name when handling 
naming conflicts. This could cause a segmentation fault when attempting to cast 
an int to an enum during expression parsing.

This test should pass once https://reviews.llvm.org/D59665 is committed.

Differential Revision: https://reviews.llvm.org/D59667

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/main.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/Makefile?rev=358462&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/Makefile
 Mon Apr 15 16:05:45 2019
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py?rev=358462&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 Mon Apr 15 16:05:45 2019
@@ -0,0 +1,22 @@
+"""
+Test Expression Parser regression text to ensure that we handle anonymous
+enums importing correctly.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCastIntToAnonymousEnum(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_cast_int_to_anonymous_enum(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp", False))
+
+self.expect("expr (flow_e)0", substrs=['(flow_e) $0 = A'])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/main.cpp?rev=358462&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/main.cpp
 Mon Apr 15 16:05:45 2019
@@ -0,0 +1,9 @@
+typedef enum {
+A=0,
+} flow_e;
+
+int main() {
+   flow_e f;
+
+   return 0; // break here
+}


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


[Lldb-commits] [flang] [clang] [lld] [mlir] [compiler-rt] [libcxxabi] [libcxx] [clang-tools-extra] [lldb] [libunwind] [libc] [llvm] [openmp] [clang] static operators should evaluate object argument (P

2024-01-11 Thread Shafik Yaghmour via lldb-commits


@@ -5678,10 +5678,15 @@ static ImplicitConversionSequence 
TryObjectArgumentInitialization(
   assert(FromType->isRecordType());
 
   QualType ClassType = S.Context.getTypeDeclType(ActingContext);
-  // [class.dtor]p2: A destructor can be invoked for a const, volatile or
-  // const volatile object.
+  // C++98 [class.dtor]p2:
+  //   A destructor can be invoked for a const, volatile or const volatile
+  //   object.
+  // C++98 [over.match.funcs]p4:
+  //   For static member functions, the implicit object parameter is considered
+  //   to match any object (since if the function is selected, the object is
+  //   discarded).
   Qualifiers Quals = Method->getMethodQualifiers();
-  if (isa(Method)) {
+  if (isa(Method) || Method->isStatic()) {

shafik wrote:

Does this change have a functional change wrt this change or is this just a 
correctness fix?

https://github.com/llvm/llvm-project/pull/68485
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-27 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik updated 
https://github.com/llvm/llvm-project/pull/67514

>From e2e0e10e13748ba9369b73c7547c035ee75dfffa Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour 
Date: Tue, 26 Sep 2023 18:55:44 -0700
Subject: [PATCH] [Clang] Fix crash when visting a fold expression in a default
 argument

CheckDefaultArgumentVisitor::Visit(...) assumes that the children of Expr will
not be NULL. This is not a valid assumption and when we have a CXXFoldExpr
the children can be NULL and this causes a crash.

Fixes: https://github.com/llvm/llvm-project/issues/67395
---
 clang/docs/ReleaseNotes.rst| 4 
 clang/lib/Sema/SemaDeclCXX.cpp | 3 ++-
 clang/test/SemaTemplate/cxx1z-fold-expressions.cpp | 8 
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8a136aae5489a8c..3a65e40b7274f5f 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -357,6 +357,10 @@ Bug Fixes to C++ Support
   reference. Fixes:
   (`#64162 `_)
 
+- Fix crash when fold expression was used in the initialization of default
+  argument. Fixes:
+  (`#67395 `_)
+
 Bug Fixes to AST Handling
 ^
 - Fixed an import failure of recursive friend class template.
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 0091e0ecf6f3986..302e944d5d74f1c 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -86,7 +86,8 @@ class CheckDefaultArgumentVisitor
 bool CheckDefaultArgumentVisitor::VisitExpr(const Expr *Node) {
   bool IsInvalid = false;
   for (const Stmt *SubStmt : Node->children())
-IsInvalid |= Visit(SubStmt);
+if (SubStmt)
+  IsInvalid |= Visit(SubStmt);
   return IsInvalid;
 }
 
diff --git a/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp 
b/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
index 518eaf0e05239e0..47a252eb335f6e5 100644
--- a/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
+++ b/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
@@ -124,3 +124,11 @@ namespace PR30738 {
   int test_h3 = h(1, 2, 3);
   N::S test_h4 = h(N::S(), N::S(), N::S()); // expected-note 
{{instantiation of}}
 }
+
+namespace GH67395 {
+template 
+bool f();
+
+template 
+void g(bool = (f() || ...));
+}

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


[Lldb-commits] [lldb] [Clang] Fix crash when visting a fold expression in a default argument (PR #67514)

2023-09-28 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/67514
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] ee4b462 - [lldb] Fix a warning

2021-12-06 Thread Shafik Yaghmour via lldb-commits
I am wondering if you also need to check if token != LLDB_INVALID_ADDRESS

> On Dec 4, 2021, at 6:34 PM, Kazu Hirata via lldb-commits 
>  wrote:
> 
> 
> Author: Kazu Hirata
> Date: 2021-12-04T18:34:29-08:00
> New Revision: ee4b462693b1ffeccfe1b8fcf0a0c12896ac6e6a
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/ee4b462693b1ffeccfe1b8fcf0a0c12896ac6e6a
> DIFF: 
> https://github.com/llvm/llvm-project/commit/ee4b462693b1ffeccfe1b8fcf0a0c12896ac6e6a.diff
> 
> LOG: [lldb] Fix a warning
> 
> This patch fixes:
> 
>  lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp:386:13:
>  error: comparison between NULL and non-pointer ('lldb::addr_t' (aka
>  'unsigned long') and NULL) [-Werror,-Wnull-arithmetic]
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
> b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> index 0e25e9a8199bd..d41d422576a9f 100644
> --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> @@ -383,7 +383,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
> return LLDB_INVALID_IMAGE_TOKEN;
>   }
> 
> -  if (token == NULL) {
> +  if (!token) {
> // XXX(compnerd) should we use the compiler to get the sizeof(unsigned)?
> uint64_t error_code =
> process->ReadUnsignedIntegerFromMemory(injected_result + 2 * 
> word_size + sizeof(unsigned),
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] 4f6d3a3 - [LLDB] Fix setting of success in Socket::Close()

2022-01-07 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-01-07T12:42:58-08:00
New Revision: 4f6d3a376c9faba93bbdf105966cea7585b0b8e9

URL: 
https://github.com/llvm/llvm-project/commit/4f6d3a376c9faba93bbdf105966cea7585b0b8e9
DIFF: 
https://github.com/llvm/llvm-project/commit/4f6d3a376c9faba93bbdf105966cea7585b0b8e9.diff

LOG: [LLDB] Fix setting of success in Socket::Close()

Both close and closesocket should return 0 on success so using !! looks 
incorrect. I replaced this will a more readable == 0 check.

Differential Revision: https://reviews.llvm.org/D116768

Added: 


Modified: 
lldb/source/Host/common/Socket.cpp

Removed: 




diff  --git a/lldb/source/Host/common/Socket.cpp 
b/lldb/source/Host/common/Socket.cpp
index cc06597975300..1c74a8fb59029 100644
--- a/lldb/source/Host/common/Socket.cpp
+++ b/lldb/source/Host/common/Socket.cpp
@@ -281,9 +281,9 @@ Status Socket::Close() {
 static_cast(this), static_cast(m_socket));
 
 #if defined(_WIN32)
-  bool success = !!closesocket(m_socket);
+  bool success = closesocket(m_socket) == 0;
 #else
-  bool success = !!::close(m_socket);
+  bool success = ::close(m_socket) == 0;
 #endif
   // A reference to a FD was passed in, set it to an invalid value
   m_socket = kInvalidSocketValue;



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


[Lldb-commits] [lldb] c0e4154 - Fix clang-tidy bugprone-argument-comment that was mixed up

2022-01-11 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-01-11T11:12:28-08:00
New Revision: c0e415471136a16cc98c9ce57392efd62db51c1f

URL: 
https://github.com/llvm/llvm-project/commit/c0e415471136a16cc98c9ce57392efd62db51c1f
DIFF: 
https://github.com/llvm/llvm-project/commit/c0e415471136a16cc98c9ce57392efd62db51c1f.diff

LOG: Fix clang-tidy bugprone-argument-comment that was mixed up

Several of the comments were annotating the wrong argument.

I caught this while reviewing this clean-up: 
https://github.com/llvm/llvm-project/commit/8afcfbfb8fc1e53023ffac9d9bdc424248d6d2ff

which was changing booleans to use true and false and in the this case the 
comment and the type looked mismatched.

Differential Revision: https://reviews.llvm.org/D116982

Added: 


Modified: 
lldb/source/Target/TraceInstructionDumper.cpp

Removed: 




diff  --git a/lldb/source/Target/TraceInstructionDumper.cpp 
b/lldb/source/Target/TraceInstructionDumper.cpp
index f0947d8f88b82..d58d2dff7383a 100644
--- a/lldb/source/Target/TraceInstructionDumper.cpp
+++ b/lldb/source/Target/TraceInstructionDumper.cpp
@@ -148,9 +148,8 @@ static void DumpInstructionDisassembly(Stream &s, 
InstructionSymbolInfo &insn) {
   if (!insn.instruction)
 return;
   s.Printf("");
-  insn.instruction->Dump(&s, /*show_address=*/false, /*show_bytes=*/false,
- /*max_opcode_byte_size=*/false, &insn.exe_ctx,
- &insn.sc,
+  insn.instruction->Dump(&s, /*max_opcode_byte_size=*/0, 
/*show_address=*/false,
+ /*show_bytes=*/false, &insn.exe_ctx, &insn.sc,
  /*prev_sym_ctx=*/nullptr,
  /*disassembly_addr_format=*/nullptr,
  /*max_address_text_size=*/0);



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


[Lldb-commits] [lldb] 80a11e0 - [LLDB] Replace use of double underscore in identifiers

2022-02-16 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-02-16T11:54:45-08:00
New Revision: 80a11e0803585556804274fc374b208901aa7a94

URL: 
https://github.com/llvm/llvm-project/commit/80a11e0803585556804274fc374b208901aa7a94
DIFF: 
https://github.com/llvm/llvm-project/commit/80a11e0803585556804274fc374b208901aa7a94.diff

LOG: [LLDB] Replace use of double underscore in identifiers

Identifiers with __ anywhere are reserved. I picked this up via the
bugprone-reserved-identifier clang-tidy check but -Wreserved-identifier will
also flag these uses as well.

Differential Revision: https://reviews.llvm.org/D119915

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/ObjC/CF.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSError.cpp
lldb/source/Plugins/Language/ObjC/NSException.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h

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

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 21196393371ea..129e10f3a8dc7 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -79,7 +79,7 @@ bool lldb_private::formatters::LibcxxFunctionSummaryProvider(
 
   switch (callable_info.callable_case) {
   case CPPLanguageRuntime::LibCppStdFunctionCallableCase::Invalid:
-stream.Printf(" __f_ = %" PRIu64, callable_info.member__f_pointer_value);
+stream.Printf(" __f_ = %" PRIu64, callable_info.member_f_pointer_value);
 return false;
 break;
   case CPPLanguageRuntime::LibCppStdFunctionCallableCase::Lambda:
@@ -228,7 +228,7 @@ bool 
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
   if (!valobj_sp)
 return false;
 
-  static ConstString g___i_("__i_");
+  static ConstString g_i_("__i_");
 
   // this must be a ValueObject* because it is a child of the ValueObject we
   // are producing children for it if were a ValueObjectSP, we would end up
@@ -258,7 +258,7 @@ bool 
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
  nullptr)
  .get();
 if (m_pair_ptr) {
-  auto __i_(valobj_sp->GetChildMemberWithName(g___i_, true));
+  auto __i_(valobj_sp->GetChildMemberWithName(g_i_, true));
   if (!__i_) {
 m_pair_ptr = nullptr;
 return false;

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
index 65e88d114fcc2..94ab014a5eb01 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
@@ -61,9 +61,9 @@ 
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
 
 size_t lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
 CalculateNumChildren() {
-  static ConstString g___size_("__size_");
+  static ConstString g_size_("__size_");
   m_num_elements = 0;
-  ValueObjectSP size_sp(m_backend.GetChildMemberWithName(g___size_, true));
+  ValueObjectSP size_sp(m_backend.GetChildMemberWithName(g_size_, true));
   if (size_sp)
 m_num_elements = size_sp->GetValueAsUnsigned(0);
   return m_num_elements;
@@ -85,7 +85,7 @@ lldb::ValueObjectSP lldb_private::formatters::
 
 bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
 Update() {
-  static ConstString g___begin_("__begin_");
+  static ConstString g_begin_("__begin_");
 
   m_start = nullptr;
   m_num_elements = 0;
@@ -96,7 +96,7 @@ bool 
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
   if (llvm::Optional size = m_element_type.GetByteSize(nullptr)) {
 m_element_size = *size;
 // Store raw pointers or end up with a circular dependency.
-m_start = m_backend.GetChildMemberWithName(g___begin_, true).get();
+m_start = m_backend.GetChildMemberWithName(g_begin_, true).get();
   }
 
   return false;

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index 25c2bfd9387bb..d3c0bd2e9ec3a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -213,27 +213,27 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
 
 size_t lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
 CalculateNumChildren() {
-  static ConstString g___pair3_("__pair3_");
-  static ConstString g___first_

[Lldb-commits] [lldb] f56cb52 - [DEBUGINFO] [LLDB] Add support for generating debug-info for structured bindings of structs and arrays

2022-02-17 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-02-17T11:14:14-08:00
New Revision: f56cb520d8554ca42a215e82ecfa58d0b6c178e4

URL: 
https://github.com/llvm/llvm-project/commit/f56cb520d8554ca42a215e82ecfa58d0b6c178e4
DIFF: 
https://github.com/llvm/llvm-project/commit/f56cb520d8554ca42a215e82ecfa58d0b6c178e4.diff

LOG: [DEBUGINFO] [LLDB] Add support for generating debug-info for structured 
bindings of structs and arrays

Currently we are not emitting debug-info for all cases of structured bindings a
C++17 feature which allows us to bind names to subobjects in an initializer.

A structured binding is represented by a DecompositionDecl AST node and the
binding are represented by a BindingDecl. It looks the original implementation
only covered the tuple like case which be represented by a DeclRefExpr which
contains a VarDecl.

If the binding is to a subobject of the struct the binding will contain a
MemberExpr and in the case of arrays it will contain an ArraySubscriptExpr.
This PR adds support emitting debug-info for the MemberExpr and 
ArraySubscriptExpr
cases as well as llvm and lldb tests for these cases as well as the tuple case.

Differential Revision: https://reviews.llvm.org/D119178

Added: 
clang/test/CodeGenCXX/debug-info-structured-binding.cpp
lldb/test/API/lang/cpp/structured-binding/Makefile
lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
lldb/test/API/lang/cpp/structured-binding/main.cpp

Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h

Removed: 




diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index d75b5a1a9d125..2203f0aec5c7c 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -4635,11 +4635,103 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const 
VarDecl *VD,
   return D;
 }
 
+llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const BindingDecl *BD,
+llvm::Value *Storage,
+llvm::Optional ArgNo,
+CGBuilderTy &Builder,
+const bool UsePointerValue) {
+  assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
+  assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
+  if (BD->hasAttr())
+return nullptr;
+
+  // Skip the tuple like case, we don't handle that here
+  if (isa(BD->getBinding()))
+return nullptr;
+
+  llvm::DIFile *Unit = getOrCreateFile(BD->getLocation());
+  llvm::DIType *Ty = getOrCreateType(BD->getType(), Unit);
+
+  // If there is no debug info for this type then do not emit debug info
+  // for this variable.
+  if (!Ty)
+return nullptr;
+
+  auto Align = getDeclAlignIfRequired(BD, CGM.getContext());
+  unsigned AddressSpace = 
CGM.getContext().getTargetAddressSpace(BD->getType());
+
+  SmallVector Expr;
+  AppendAddressSpaceXDeref(AddressSpace, Expr);
+
+  // Clang stores the sret pointer provided by the caller in a static alloca.
+  // Use DW_OP_deref to tell the debugger to load the pointer and treat it as
+  // the address of the variable.
+  if (UsePointerValue) {
+assert(!llvm::is_contained(Expr, llvm::dwarf::DW_OP_deref) &&
+   "Debug info already contains DW_OP_deref.");
+Expr.push_back(llvm::dwarf::DW_OP_deref);
+  }
+
+  unsigned Line = getLineNumber(BD->getLocation());
+  unsigned Column = getColumnNumber(BD->getLocation());
+  StringRef Name = BD->getName();
+  auto *Scope = cast(LexicalBlockStack.back());
+  // Create the descriptor for the variable.
+  llvm::DILocalVariable *D = DBuilder.createAutoVariable(
+  Scope, Name, Unit, Line, Ty, CGM.getLangOpts().Optimize,
+  llvm::DINode::FlagZero, Align);
+
+  if (const MemberExpr *ME = dyn_cast(BD->getBinding())) {
+if (const FieldDecl *FD = dyn_cast(ME->getMemberDecl())) {
+  const unsigned fieldIndex = FD->getFieldIndex();
+  const clang::CXXRecordDecl *parent =
+  (const CXXRecordDecl *)FD->getParent();
+  const ASTRecordLayout &layout =
+  CGM.getContext().getASTRecordLayout(parent);
+  const uint64_t fieldOffset = layout.getFieldOffset(fieldIndex);
+
+  if (fieldOffset != 0) {
+Expr.push_back(llvm::dwarf::DW_OP_plus_uconst);
+Expr.push_back(
+CGM.getContext().toCharUnitsFromBits(fieldOffset).getQuantity());
+  }
+}
+  } else if (const ArraySubscriptExpr *ASE =
+ dyn_cast(BD->getBinding())) {
+if (const IntegerLiteral *IL = dyn_cast(ASE->getIdx())) {
+  const uint64_t value = IL->getValue().getZExtValue();
+  const uint64_t typeSize = CGM.getContext().getTypeSize(BD->getType());
+
+  if (value != 0) {
+Expr.push_back(llvm::dwarf::DW_OP_plus_uconst);
+Expr.push_back(CGM.getContext()
+   .toCharUnitsFromBits(

[Lldb-commits] [lldb] f6d3901 - [LLDB] Fix TestStructuredBinding.py for libstdc++

2022-02-17 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-02-17T11:30:07-08:00
New Revision: f6d390193cbcc3b9a0e900202023bd80bd5ac4a4

URL: 
https://github.com/llvm/llvm-project/commit/f6d390193cbcc3b9a0e900202023bd80bd5ac4a4
DIFF: 
https://github.com/llvm/llvm-project/commit/f6d390193cbcc3b9a0e900202023bd80bd5ac4a4.diff

LOG: [LLDB] Fix TestStructuredBinding.py for libstdc++

For the tuple case for the TestStructuredBinding.py the result type is different
between libc++ and libstdc++.

Added: 


Modified: 
lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py 
b/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
index 694377341a03c..9f57d45dd9fc1 100644
--- a/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
+++ b/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
@@ -75,10 +75,10 @@ def test(self):
 self.expect_expr("iarr_copy2", result_type="int", result_value="33")
 self.expect_expr("iarr_copy3", result_type="int", result_value="44")
 
-self.expect_expr("tx1", result_type="float", result_value="4")
-self.expect_expr("ty1", result_type="char", result_value="'z'")
-self.expect_expr("tz1", result_type="int", result_value="10")
+self.expect_expr("tx1", result_value="4")
+self.expect_expr("ty1", result_value="'z'")
+self.expect_expr("tz1", result_value="10")
 
-self.expect_expr("tx2", result_type="float", result_value="4")
-self.expect_expr("ty2", result_type="char", result_value="'z'")
-self.expect_expr("tz2", result_type="int", result_value="10")
+self.expect_expr("tx2", result_value="4")
+self.expect_expr("ty2", result_value="'z'")
+self.expect_expr("tz2", result_value="10")



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


[Lldb-commits] [lldb] 08a6229 - [LLDB] Adding skipif for arm linux for TestStructuredBinding.py

2022-02-17 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-02-17T14:30:54-08:00
New Revision: 08a6229e214bd75aed975c610aaff6026c5d2880

URL: 
https://github.com/llvm/llvm-project/commit/08a6229e214bd75aed975c610aaff6026c5d2880
DIFF: 
https://github.com/llvm/llvm-project/commit/08a6229e214bd75aed975c610aaff6026c5d2880.diff

LOG: [LLDB] Adding skipif for arm linux for TestStructuredBinding.py

Added: 


Modified: 
lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py 
b/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
index 9f57d45dd9fc..603c2df7163e 100644
--- a/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
+++ b/lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
@@ -7,6 +7,7 @@ class TestStructuredBinding(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIf(oslist=["linux"], archs=["arm"])
 @skipIf(compiler="clang", compiler_version=['<', '14.0'])
 def test(self):
 self.build()



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


[Lldb-commits] [lldb] 14101f4 - [LLDB] Remove recursive include of GDBRemoteCommunicationServerCommon.h

2022-02-21 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-02-21T18:46:12-08:00
New Revision: 14101f48d205b6cbf65b28c469d898e90e3995d2

URL: 
https://github.com/llvm/llvm-project/commit/14101f48d205b6cbf65b28c469d898e90e3995d2
DIFF: 
https://github.com/llvm/llvm-project/commit/14101f48d205b6cbf65b28c469d898e90e3995d2.diff

LOG: [LLDB] Remove recursive include of GDBRemoteCommunicationServerCommon.h

GDBRemoteCommunicationServerCommon.h includes itself, removing this include.

Differential Revision: https://reviews.llvm.org/D120105

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
index 029972348ef01..f696cb5c61c66 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
@@ -15,7 +15,6 @@
 #include "lldb/lldb-private-forward.h"
 
 #include "GDBRemoteCommunicationServer.h"
-#include "GDBRemoteCommunicationServerCommon.h"
 
 class StringExtractorGDBRemote;
 



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


[Lldb-commits] [lldb] ae869d4 - [LLDB] Remove cases of using namespace llvm:: from header file

2022-03-03 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-03T10:39:06-08:00
New Revision: ae869d448499327a2e6435fafb0ac6ed0f205e66

URL: 
https://github.com/llvm/llvm-project/commit/ae869d448499327a2e6435fafb0ac6ed0f205e66
DIFF: 
https://github.com/llvm/llvm-project/commit/ae869d448499327a2e6435fafb0ac6ed0f205e66.diff

LOG: [LLDB] Remove cases of using namespace llvm:: from header file

We have using namespace llvm::dwarf in dwarf.h header globally. Replacing that
with a using namespace within lldb_private::dwarf and moving to a
using namespace lldb_private::dwarf in .cpp files and fully qualified names
in the few header files.

Differential Revision: https://reviews.llvm.org/D120836

Added: 


Modified: 
lldb/include/lldb/Core/dwarf.h
lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Symbol/DWARFCallFrameInfo.cpp
lldb/source/Symbol/PostfixExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/dwarf.h b/lldb/include/lldb/Core/dwarf.h
index 968418e71c2f3..60fbdec40beed 100644
--- a/lldb/include/lldb/Core/dwarf.h
+++ b/lldb/include/lldb/Core/dwarf.h
@@ -15,8 +15,11 @@
 // Get the DWARF constant definitions from llvm
 #include "llvm/BinaryFormat/Dwarf.h"
 
-// and stuff them in our default namespace
-using namespace llvm::dwarf;
+namespace lldb_private {
+namespace dwarf {
+  using namespace llvm::dwarf;
+}
+}
 
 typedef uint32_t dw_uleb128_t;
 typedef int32_t dw_sleb128_t;

diff  --git a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h 
b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
index 43baf4dd39a1d..199d23eff9b60 100644
--- a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
+++ b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
@@ -106,7 +106,8 @@ class DWARFCallFrameInfo {
 CIE(dw_offset_t offset)
 : cie_offset(offset), version(-1), code_align(0), data_align(0),
   return_addr_reg_num(LLDB_INVALID_REGNUM), inst_offset(0),
-  inst_length(0), ptr_encoding(0), lsda_addr_encoding(DW_EH_PE_omit),
+  inst_length(0), ptr_encoding(0),
+  lsda_addr_encoding(llvm::dwarf::DW_EH_PE_omit),
   personality_loc(LLDB_INVALID_ADDRESS) {}
   };
 

diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 572c3488311c7..7c99743b260ba 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -43,6 +43,7 @@
 
 using namespace lldb;
 using namespace lldb_private;
+using namespace lldb_private::dwarf;
 
 static lldb::addr_t
 ReadAddressFromDebugAddrSection(const DWARFUnit *dwarf_cu,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index ec4057efbbc54..4877169b32132 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -16,6 +16,7 @@
 
 using namespace lldb_private;
 using namespace lldb;
+using namespace lldb_private::dwarf;
 
 std::unique_ptr AppleDWARFIndex::Create(
 Module &module, DWARFDataExtractor apple_names,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 2daffecee58e9..07842ce01593f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -57,6 +57,7 @@
 
 using namespace lldb;
 using namespace lldb_private;
+using namespace lldb_private::dwarf;
 DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)

[Lldb-commits] [lldb] 9bd72b5 - [LLDB] Remove cases of using namespace std

2022-03-04 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-04T12:50:25-08:00
New Revision: 9bd72b5c258549b8743557a79c7929de38f05a6d

URL: 
https://github.com/llvm/llvm-project/commit/9bd72b5c258549b8743557a79c7929de38f05a6d
DIFF: 
https://github.com/llvm/llvm-project/commit/9bd72b5c258549b8743557a79c7929de38f05a6d.diff

LOG: [LLDB] Remove cases of using namespace std

We had using namespace std; sprinkled around several source files and tests.

Differential Revision: https://reviews.llvm.org/D120966

Added: 


Modified: 
lldb/source/Core/FileSpecList.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/test/API/api/multithreaded/inferior.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp
lldb/test/API/functionalities/process_save_core_minidump/main.cpp
lldb/test/API/functionalities/thread/concurrent_events/main.cpp
lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp

Removed: 




diff  --git a/lldb/source/Core/FileSpecList.cpp 
b/lldb/source/Core/FileSpecList.cpp
index 1a1cf284ea07c..8eec8f499352c 100644
--- a/lldb/source/Core/FileSpecList.cpp
+++ b/lldb/source/Core/FileSpecList.cpp
@@ -16,7 +16,6 @@
 #include 
 
 using namespace lldb_private;
-using namespace std;
 
 FileSpecList::FileSpecList() : m_files() {}
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
index 0f0f50a645db3..d890288cdf567 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
@@ -12,7 +12,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 // DWARFAbbreviationDeclarationSet::Clear()
 void DWARFAbbreviationDeclarationSet::Clear() {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index b72c7406ece13..8933b0804a01c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -27,7 +27,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace std;
 
 // Constructor
 DWARFDebugInfo::DWARFDebugInfo(SymbolFileDWARF &dwarf,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 01046fb68b9d3..95c0cb6472c59 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -32,7 +32,6 @@
 
 using namespace lldb_private;
 using namespace lldb_private::dwarf;
-using namespace std;
 extern int g_verbose;
 
 // Extract a debug info entry for a given DWARFUnit from the data

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 812a8086f4875..085c9e9ce1a6e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -26,7 +26,6 @@
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::dwarf;
-using namespace std;
 
 extern int g_verbose;
 
@@ -449,7 +448,7 @@ ParseListTableHeader(const llvm::DWARFDataExtractor &data, 
uint64_t offset,
 
   uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
   if (offset < HeaderSize)
-return llvm::createStringError(errc::invalid_argument,
+return llvm::createStringError(std::errc::invalid_argument,
"did not detect a valid"
" list table with base = 0x%" PRIx64 "\n",
offset);
@@ -559,10 +558,10 @@ DWARFUnit::GetRnglistTable() {
 // This function is called only for DW_FORM_rnglistx.
 llvm::Expected DWARFUnit::GetRnglistOffset(uint32_t Index) {
   if (!GetRnglistTable())
-return llvm::createStringError(errc::invalid_argument,
+return llvm::createStringError(std::errc::invalid_argument,
"missing or invalid range list table");
   if (!m_ranges_base)
-return llvm::createStringError(errc::invalid_argument,
+return llvm::createStringError(std::errc::invalid_argument,
"DW_FORM_rnglistx cannot be used without "
"DW_AT_rnglists_base for CU at 0x%8.8x",
GetOffset());
@@ -570,7 +569,7 @@ llvm::Expected 
DWARFUnit::GetRnglistOffset(uint32_t Index) {
   GetRnglistData().GetAsLLVM(), Index))
 return *off + m_ranges_

[Lldb-commits] [lldb] 28c878a - [LLDB] Applying clang-tidy modernize-use-default-member-init over LLDB

2022-03-14 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-14T13:32:03-07:00
New Revision: 28c878aeb29a7e7a9ae8f748de6a3c41482b97be

URL: 
https://github.com/llvm/llvm-project/commit/28c878aeb29a7e7a9ae8f748de6a3c41482b97be
DIFF: 
https://github.com/llvm/llvm-project/commit/28c878aeb29a7e7a9ae8f748de6a3c41482b97be.diff

LOG: [LLDB] Applying clang-tidy modernize-use-default-member-init over LLDB

Applied modernize-use-default-member-init clang-tidy check over LLDB.
It appears in many files we had already switched to in class member init but
never updated the constructors to reflect that. This check is already present in
the lldb/.clang-tidy config.

Differential Revision: https://reviews.llvm.org/D121481

Added: 


Modified: 
lldb/source/API/SBBroadcaster.cpp
lldb/source/API/SBListener.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/API/SBQueue.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Core/Address.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/Value.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/DataFormatters/VectorType.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Expression/IRInterpreter.cpp
lldb/source/Expression/Materializer.cpp
lldb/source/Host/common/HostNativeThreadBase.cpp
lldb/source/Host/common/ProcessLaunchInfo.cpp
lldb/source/Interpreter/OptionValueFileColonLine.cpp
lldb/source/Interpreter/OptionValueFileSpec.cpp
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
lldb/source/Plugins/Language/ObjC/NSSet.cpp

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

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
lldb/source/Symbol/Symbol.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Symbol/Type.cpp
lldb/source/Target/ExecutionContext.cpp
lldb/source/Target/LanguageRuntime.cpp
lldb/source/Target/PathMappingList.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/StopInfo.cpp
lldb/source/Utility/DataExtractor.cpp
lldb/source/Utility/Instrumentation.cpp
lldb/source/Utility/ProcessInfo.cpp
lldb/source/Utility/Status.cpp
lldb/source/Utility/Stream.cpp
lldb/source/Utility/StringExtractor.cpp
lldb/unittests/Editline/EditlineTest.cpp
lldb/unittests/Host/FileSystemTest.cpp
lldb/unittests/Process/ProcessEventDataTest.cpp

Removed: 




diff  --git a/lldb/source/API/SBBroadcaster.cpp 
b/lldb/source/API/SBBroadcaster.cpp
index f145bc6e99d8e..58920931bc5fc 100644
--- a/lldb/source/API/SBBroadcaster.cpp
+++ b/lldb/source/API/SBBroadcaster.cpp
@@ -19,7 +19,7 @@ using namespace lldb_private;
 SBBroadcaster::SBBroadcaster() { LLDB_INSTRUMENT_VA(this); }
 
 SBBroadcaster::SBBroadcaster(const char *name)
-: m_opaque_sp(new Broadcaster(nullptr, name)), m_opaque_ptr(nullptr) {
+: m_opaque_sp(new Broadcaster(nullptr, name)) {
   LLDB_INSTRUMENT_VA(this, name);
 
   m_opaque_ptr = m_opaque_sp.get();

diff  --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp
index 2ce17a5f521d7..a7008dc5224e0 100644
--- a/lldb/source/API/SBListener.cpp
+++ b/lldb/source/API/SBListener.cpp
@@ -23,12 +23,11 @@ using namespace lldb_private;
 SBListener::SBListener() { LLDB_INSTRUMENT_VA(this); }
 
 SBListener::SBListener(const char *name)
-: m_opaque_sp(Listener::MakeListener(name)), m_unused_ptr(nullptr) {
+: m_opaque_sp(Listener::MakeListener(name)) {
   LLDB_INSTRUMENT_VA(this, name);
 }
 
-SBListener::SBListener(const SBListener &rhs)
-: m_opaque_sp(rhs.m_opaque_sp), m_unused_ptr(nullptr) {
+SBListener::SBListener(const SBListener &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
   LLDB_INSTRUMENT_VA(this, r

[Lldb-commits] [lldb] 1438639 - [LLDB] Remove undefined behavior in TestConstStaticIntegralMember.py

2022-08-08 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-08-08T19:23:53-07:00
New Revision: 1438639a2f7eb9e9cba01454d3a9b1b16d179c9a

URL: 
https://github.com/llvm/llvm-project/commit/1438639a2f7eb9e9cba01454d3a9b1b16d179c9a
DIFF: 
https://github.com/llvm/llvm-project/commit/1438639a2f7eb9e9cba01454d3a9b1b16d179c9a.diff

LOG: [LLDB] Remove undefined behavior in TestConstStaticIntegralMember.py

Setting an enum without a fixed underlying type to a value which is outside the
value range is undefined behavior.

The initializer needs to be a constant expression and therefore this was always
ill-formed we just were not diagnosing it before.

See D130058 and D131307 for more details.

Differential Revision: https://reviews.llvm.org/D131460

Added: 


Modified: 

lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
lldb/test/API/lang/cpp/const_static_integral_member/main.cpp

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 09345b98b16bc..794f382b8b68f 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -53,8 +53,6 @@ def test(self):
 
 # Test an unscoped enum.
 self.expect_expr("A::enum_val", result_value="enum_case2")
-# Test an unscoped enum with an invalid enum case.
-self.expect_expr("A::invalid_enum_val", result_value="enum_case1 | 
enum_case2 | 0x4")
 
 # Test a scoped enum.
 self.expect_expr("A::scoped_enum_val", 
result_value="scoped_enum_case2")

diff  --git a/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp 
b/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
index b26251336371c..17b14da864a97 100644
--- a/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
+++ b/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
@@ -47,7 +47,6 @@ struct A {
   std::numeric_limits::min();
 
   const static Enum enum_val = enum_case2;
-  const static Enum invalid_enum_val = static_cast(enum_case2 + 5);
   const static ScopedEnum scoped_enum_val = ScopedEnum::scoped_enum_case2;
   const static ScopedEnum invalid_scoped_enum_val = static_cast(5);
   const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
@@ -102,7 +101,6 @@ int main() {
   int member_copy = ClassWithOnlyConstStatic::member;
 
   Enum e = A::enum_val;
-  e = A::invalid_enum_val;
   ScopedEnum se = A::scoped_enum_val;
   se = A::invalid_scoped_enum_val;
   ScopedCharEnum sce = A::scoped_char_enum_val;



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


[Lldb-commits] [libcxx] [libunwind] [libc] [flang] [lld] [lldb] [compiler-rt] [llvm] [clang-tools-extra] [clang] [libclc] [clang] Add tests for DRs about complete-class context (PR #77444)

2024-01-13 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik commented:

LGTM

https://github.com/llvm/llvm-project/pull/77444
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [libcxxabi] [flang] [libc] [compiler-rt] [openmp] [lld] [clang] [libunwind] [mlir] [lldb] [libcxx] [clang-tools-extra] [clang] static operators should evaluate object argument (P

2024-01-25 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik approved this pull request.


https://github.com/llvm/llvm-project/pull/68485
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 6583f01 - [LLDB] Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size

2022-03-15 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-15T09:36:20-07:00
New Revision: 6583f01707211ed14d8e35f2183a8805a301b6f9

URL: 
https://github.com/llvm/llvm-project/commit/6583f01707211ed14d8e35f2183a8805a301b6f9
DIFF: 
https://github.com/llvm/llvm-project/commit/6583f01707211ed14d8e35f2183a8805a301b6f9.diff

LOG: [LLDB] Fixing DWARFExpression handling of ValueType::FileAddress case for 
DW_OP_deref_size

Currently DW_OP_deref_size just drops the ValueType::FileAddress case and does
not attempt to handle it. This adds support for this case and a test that
verifies this support.

I did a little refactoring since DW_OP_deref and DW_OP_deref_size have some
overlap in code.

Also see: rdar://66870821

Differential Revision: https://reviews.llvm.org/D121408

Added: 
lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s

Modified: 
lldb/source/Expression/DWARFExpression.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 8fa8248d796d1..0f6c380fe0357 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -943,6 +943,80 @@ void UpdateValueTypeFromLocationDescription(Log *log, 
const DWARFUnit *dwarf_cu,
 }
 } // namespace
 
+/// Helper function to move common code used to resolve a file address and turn
+/// into a load address.
+///
+/// \param exe_ctx Pointer to the execution context
+/// \param module_sp shared_ptr contains the module if we have one
+/// \param error_ptr pointer to Status object if we have one
+/// \param dw_op_type C-style string used to vary the error output
+/// \param file_addr the file address we are trying to resolve and turn into a
+///  load address
+/// \param so_addr out parameter, will be set to load addresss or section 
offset
+/// \param check_sectionoffset bool which determines if having a section offset
+///but not a load address is considerd a success
+/// \returns llvm::Optional containing the load address if resolving and 
getting
+///  the load address succeed or an empty Optinal otherwise. If
+///  check_sectionoffset is true we consider LLDB_INVALID_ADDRESS a
+///  success if so_addr.IsSectionOffset() is true.
+static llvm::Optional
+ResolveAndLoadFileAddress(ExecutionContext *exe_ctx, lldb::ModuleSP module_sp,
+  Status *error_ptr, const char *dw_op_type,
+  lldb::addr_t file_addr, Address &so_addr,
+  bool check_sectionoffset = false) {
+  if (!module_sp) {
+if (error_ptr)
+  error_ptr->SetErrorStringWithFormat(
+  "need module to resolve file address for %s", dw_op_type);
+return {};
+  }
+
+  if (!module_sp->ResolveFileAddress(file_addr, so_addr)) {
+if (error_ptr)
+  error_ptr->SetErrorString("failed to resolve file address in module");
+return {};
+  }
+
+  addr_t load_addr = so_addr.GetLoadAddress(exe_ctx->GetTargetPtr());
+
+  if (load_addr == LLDB_INVALID_ADDRESS &&
+  (check_sectionoffset && !so_addr.IsSectionOffset())) {
+if (error_ptr)
+  error_ptr->SetErrorString("failed to resolve load address");
+return {};
+  }
+
+  return load_addr;
+}
+
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  switch (size) {
+  case 1:
+return addr_data.GetU8(&addr_data_offset);
+  case 2:
+return addr_data.GetU16(&addr_data_offset);
+  case 4:
+return addr_data.GetU32(&addr_data_offset);
+  case 8:
+return addr_data.GetU64(&addr_data_offset);
+  default:
+return addr_data.GetAddress(&addr_data_offset);
+  }
+}
+
 bool DWARFExpression::Evaluate(
 ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
 lldb::ModuleSP module_sp, const DataExtractor &opcodes,
@@ -1025,6 +1099,7 @@ bool DWARFExpression::Evaluate(
   if (frame)
 stack.back().ConvertToLoadAddress(module_sp.get(),
   frame->CalculateTarget().get());
+
   break;
 
 // The DW_OP_addr_sect_offset4 is used for any location expressions in
@@ -1088,26 +1163,15 @@ bool DWARFExpression::Evaluate(
   case Value::ValueType::FileAddress: {
 auto file_addr 

[Lldb-commits] [lldb] 37400dd - [LLDB][NFC] Remove dead code from Section.cpp

2022-03-15 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-15T18:11:30-07:00
New Revision: 37400dd3e817ea43ed9c32d545211dd93b5e7c59

URL: 
https://github.com/llvm/llvm-project/commit/37400dd3e817ea43ed9c32d545211dd93b5e7c59
DIFF: 
https://github.com/llvm/llvm-project/commit/37400dd3e817ea43ed9c32d545211dd93b5e7c59.diff

LOG: [LLDB][NFC] Remove dead code from Section.cpp

Removing comment out code, looks like debugging code left over from a while ago.

Added: 


Modified: 
lldb/source/Core/Section.cpp

Removed: 




diff  --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index cb9d41f19b507..acad3a2b8cf3d 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -164,12 +164,6 @@ Section::Section(const ModuleSP &module_sp, ObjectFile 
*obj_file,
   m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
   m_thread_specific(false), m_readable(false), m_writable(false),
   m_executable(false), m_relocated(false), 
m_target_byte_size(target_byte_size) {
-  //printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ",
-  //addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 
"
-  //- 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s\n",
-  //this, module_sp.get(), sect_id, file_addr, file_addr +
-  //byte_size, file_offset, file_offset + file_size, flags,
-  //name.GetCString());
 }
 
 Section::Section(const lldb::SectionSP &parent_section_sp,
@@ -186,19 +180,11 @@ Section::Section(const lldb::SectionSP &parent_section_sp,
   m_log2align(log2align), m_children(), m_fake(false), m_encrypted(false),
   m_thread_specific(false), m_readable(false), m_writable(false),
   m_executable(false), m_relocated(false), 
m_target_byte_size(target_byte_size) {
-  //printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ",
-  //addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 
"
-  //- 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s.%s\n",
-  //this, module_sp.get(), sect_id, file_addr, file_addr +
-  //byte_size, file_offset, file_offset + file_size, flags,
-  //parent_section_sp->GetName().GetCString(), name.GetCString());
   if (parent_section_sp)
 m_parent_wp = parent_section_sp;
 }
 
-Section::~Section() {
-  //printf ("Section::~Section(%p)\n", this);
-}
+Section::~Section() {}
 
 addr_t Section::GetFileAddress() const {
   SectionSP parent_sp(GetParent());



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


[Lldb-commits] [lldb] 33d7417 - [LLDB] Modifying expression code in MakeLoadImageUtilityFunction to be more consistent

2022-03-17 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-17T08:52:56-07:00
New Revision: 33d74170a36e3b801e93152effa59f19d9abb3a0

URL: 
https://github.com/llvm/llvm-project/commit/33d74170a36e3b801e93152effa59f19d9abb3a0
DIFF: 
https://github.com/llvm/llvm-project/commit/33d74170a36e3b801e93152effa59f19d9abb3a0.diff

LOG: [LLDB] Modifying expression code in MakeLoadImageUtilityFunction to be 
more consistent

MakeLoadImageUtilityFunction() is not using extern "C" for external C functions
and it is not using eLanguageTypeC_plus_plus. So I am modifying it to be 
consistent.

Also see: rdar://87544782

Differential Revision: https://reviews.llvm.org/D121831

Added: 


Modified: 
lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp 
b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index a25fd1f2678eb..42de703e8ed07 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -560,8 +560,8 @@ 
PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
 const char *error_str;
   };
   
-  extern void *memcpy(void *, const void *, size_t size);
-  extern size_t strlen(const char *);
+  extern "C" void *memcpy(void *, const void *, size_t size);
+  extern "C" size_t strlen(const char *);
   
 
   void * __lldb_dlopen_wrapper (const char *name, 
@@ -608,7 +608,7 @@ 
PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
   DiagnosticManager diagnostics;
 
   auto utility_fn_or_error = process->GetTarget().CreateUtilityFunction(
-  std::move(expr), dlopen_wrapper_name, eLanguageTypeObjC, exe_ctx);
+  std::move(expr), dlopen_wrapper_name, eLanguageTypeC_plus_plus, exe_ctx);
   if (!utility_fn_or_error) {
 std::string error_str = llvm::toString(utility_fn_or_error.takeError());
 error.SetErrorStringWithFormat("dlopen error: could not create utility"



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


[Lldb-commits] [lldb] aca9648 - [LLDB] Cleanup for Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size

2022-03-24 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-24T10:00:26-07:00
New Revision: aca96480784b5373ad7229816b00297690354208

URL: 
https://github.com/llvm/llvm-project/commit/aca96480784b5373ad7229816b00297690354208
DIFF: 
https://github.com/llvm/llvm-project/commit/aca96480784b5373ad7229816b00297690354208.diff

LOG: [LLDB] Cleanup for Fixing DWARFExpression handling of 
ValueType::FileAddress case for DW_OP_deref_size

Late review on https://reviews.llvm.org/D121408 spotted some nice quick 
clean-ups on this code.

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 5ee62fb4376b8..717cbe76450eb 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -960,7 +960,7 @@ void UpdateValueTypeFromLocationDescription(Log *log, const 
DWARFUnit *dwarf_cu,
 ///  check_sectionoffset is true we consider LLDB_INVALID_ADDRESS a
 ///  success if so_addr.IsSectionOffset() is true.
 static llvm::Optional
-ResolveAndLoadFileAddress(ExecutionContext *exe_ctx, lldb::ModuleSP module_sp,
+ResolveLoadAddress(ExecutionContext *exe_ctx, lldb::ModuleSP &module_sp,
   Status *error_ptr, const char *dw_op_type,
   lldb::addr_t file_addr, Address &so_addr,
   bool check_sectionoffset = false) {
@@ -1003,18 +1003,10 @@ static Scalar DerefSizeExtractDataHelper(uint8_t 
*addr_bytes,
   DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
 
   lldb::offset_t addr_data_offset = 0;
-  switch (size) {
-  case 1:
-return addr_data.GetU8(&addr_data_offset);
-  case 2:
-return addr_data.GetU16(&addr_data_offset);
-  case 4:
-return addr_data.GetU32(&addr_data_offset);
-  case 8:
-return addr_data.GetU64(&addr_data_offset);
-  default:
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
 return addr_data.GetAddress(&addr_data_offset);
-  }
 }
 
 bool DWARFExpression::Evaluate(
@@ -1099,7 +1091,6 @@ bool DWARFExpression::Evaluate(
   if (frame)
 stack.back().ConvertToLoadAddress(module_sp.get(),
   frame->CalculateTarget().get());
-
   break;
 
 // The DW_OP_addr_sect_offset4 is used for any location expressions in
@@ -1165,7 +1156,7 @@ bool DWARFExpression::Evaluate(
 LLDB_INVALID_ADDRESS);
 
 Address so_addr;
-auto maybe_load_addr = ResolveAndLoadFileAddress(
+auto maybe_load_addr = ResolveLoadAddress(
 exe_ctx, module_sp, error_ptr, "DW_OP_deref", file_addr, so_addr);
 
 if (!maybe_load_addr)
@@ -1287,7 +1278,7 @@ bool DWARFExpression::Evaluate(
 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
 Address so_addr;
 auto maybe_load_addr =
-ResolveAndLoadFileAddress(exe_ctx, module_sp, error_ptr,
+ResolveLoadAddress(exe_ctx, module_sp, error_ptr,
   "DW_OP_deref_size", file_addr, so_addr,
   /*check_sectionoffset=*/true);
 



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


[Lldb-commits] [lldb] 14cad95 - [LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union member

2022-03-30 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-30T18:00:37-07:00
New Revision: 14cad95d38235df6c5fd5dd3da84b91fa69e7e74

URL: 
https://github.com/llvm/llvm-project/commit/14cad95d38235df6c5fd5dd3da84b91fa69e7e74
DIFF: 
https://github.com/llvm/llvm-project/commit/14cad95d38235df6c5fd5dd3da84b91fa69e7e74.diff

LOG: [LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the 
active union member

NSIndexPathSyntheticFrontEnd::Impl::Clear() currently calls Clear() on both
unions members regardless of which one is active. I modified it to only call
Clear() on the active member.

Differential Revision: https://reviews.llvm.org/D122753

Added: 


Modified: 
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp 
b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
index 8db75716e1862..429633e5e6b87 100644
--- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -282,9 +282,17 @@ class NSIndexPathSyntheticFrontEnd : public 
SyntheticChildrenFrontEnd {
 };
 
 void Clear() {
+  switch (m_mode) {
+  case Mode::Inlined:
+m_inlined.Clear();
+break;
+  case Mode::Outsourced:
+m_outsourced.Clear();
+break;
+  case Mode::Invalid:
+break;
+  }
   m_mode = Mode::Invalid;
-  m_inlined.Clear();
-  m_outsourced.Clear();
 }
 
 Impl() {}



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


[Lldb-commits] [lldb] 24f9a2f - [LLDB] Applying clang-tidy modernize-use-equals-default over LLDB

2022-03-31 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-03-31T13:21:49-07:00
New Revision: 24f9a2f53db78df59761f46ceed3bb5e7aa0d331

URL: 
https://github.com/llvm/llvm-project/commit/24f9a2f53db78df59761f46ceed3bb5e7aa0d331
DIFF: 
https://github.com/llvm/llvm-project/commit/24f9a2f53db78df59761f46ceed3bb5e7aa0d331.diff

LOG: [LLDB] Applying clang-tidy modernize-use-equals-default over LLDB

Applied modernize-use-equals-default clang-tidy check over LLDB.

This check is already present in the lldb/.clang-tidy config.

Differential Revision: https://reviews.llvm.org/D121844

Added: 


Modified: 
lldb/source/API/SBMemoryRegionInfoList.cpp
lldb/source/API/SBQueue.cpp
lldb/source/API/SBValue.cpp
lldb/source/API/SBValueList.cpp
lldb/source/Commands/CommandObjectBreakpoint.cpp
lldb/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/CommandObjectLog.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Commands/CommandObjectSettings.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Host/macosx/cfcpp/CFCData.cpp
lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp
lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp
lldb/source/Host/macosx/cfcpp/CFCMutableSet.cpp
lldb/source/Host/macosx/cfcpp/CFCString.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
lldb/source/Target/ExecutionContext.cpp
lldb/source/Utility/XcodeSDK.cpp
lldb/tools/debugserver/source/DNBBreakpoint.cpp
lldb/tools/debugserver/source/DNBDataRef.cpp
lldb/tools/debugserver/source/MacOSX/CFBundle.cpp
lldb/tools/debugserver/source/MacOSX/CFString.cpp
lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp
lldb/tools/debugserver/source/StdStringExtractor.cpp
lldb/tools/debugserver/source/TTYState.cpp
lldb/tools/lldb-vscode/IOStream.cpp
lldb/tools/lldb-vscode/VSCode.cpp

Removed: 




diff  --git a/lldb/source/API/SBMemoryRegionInfoList.cpp 
b/lldb/source/API/SBMemoryRegionInfoList.cpp
index 39dee86dc3007..f8381d1098a0f 100644
--- a/lldb/source/API/SBMemoryRegionInfoList.cpp
+++ b/lldb/source/API/SBMemoryRegionInfoList.cpp
@@ -21,8 +21,7 @@ class MemoryRegionInfoListImpl {
 public:
   MemoryRegionInfoListImpl() : m_regions() {}
 
-  MemoryRegionInfoListImpl(const MemoryRegionInfoListImpl &rhs)
-  : m_regions(rhs.m_regions) {}
+  MemoryRegionInfoListImpl(const MemoryRegionInfoListImpl &rhs) = default;
 
   MemoryRegionInfoListImpl &operator=(const MemoryRegionInfoListImpl &rhs) {
 if (this == &rhs)

diff  --git a/lldb/source/API/SBQueue.cpp b/lldb/source/API/SBQueue.cpp
index 1aeede4b1da6f..b97da3ef02edd 100644
--- a/lldb/source/API/SBQueue.cpp
+++ b/lldb/source/API/SBQueue.cpp
@@ -27,7 +27,7 @@ namespace lldb_private {
 
 class QueueImpl {
 public:
-  QueueImpl() {}
+  QueueImpl() = default;
 
   QueueImpl(const lldb::QueueSP &queue_sp) { m_queue_wp = queue_sp; }
 

diff  --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 20581cfabdd66..c39e00d645e27 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -69,9 +69,7 @@ class ValueImpl {
 }
   }
 
-  ValueImpl(const ValueImpl &rhs)
-  : m_valobj_sp(rhs.m_valobj_sp), m_use_dynamic(rhs.m_use_dynamic),
-m_use_synthetic(rhs.m_use_synthetic), m_name(rhs.m_name) {}
+  ValueImpl(const ValueImpl &rhs) = default;
 
   ValueImpl &operator=(const ValueImpl &rhs) {
 if (this != &rhs) {

diff  --git a/lldb/source/API/SBValueList.cpp b/lldb/source/API/SBValueList.cpp
index a67030c506f41..4b36b04c8d350 100644
--- a/lldb/source/API/SBValueList.cpp
+++ b/lldb/source/API/SBValueList.cpp
@@ -19,9 +19,9 @@ using namespace lldb_private;
 
 class ValueListImpl {
 public:
-  ValueListImpl() {}
+  ValueListImpl() = default;
 
-  ValueListImpl(const ValueListImpl &rhs) : m_values(rhs.m_values) {}
+  ValueListImpl(const ValueListImpl &rhs) = default;
 
   ValueListImpl &operator=(const ValueListImpl &rhs) {
 if (this == &rhs)

diff  --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp 
b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index c4e55fdb3b9c0..4515c7ee58eee 100644
--- a/lldb/source/Commands/CommandObjectBreak

[Lldb-commits] [lldb] fd14646 - [LLDB] Applying clang-tidy modernize-use-override over LLDB

2022-04-22 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2022-04-22T13:29:47-07:00
New Revision: fd1464604367f2259614b66c886db16598b5be6b

URL: 
https://github.com/llvm/llvm-project/commit/fd1464604367f2259614b66c886db16598b5be6b
DIFF: 
https://github.com/llvm/llvm-project/commit/fd1464604367f2259614b66c886db16598b5be6b.diff

LOG: [LLDB] Applying clang-tidy modernize-use-override over LLDB

Applied clang-tidy modernize-use-override over LLDB and added it to the LLDB 
.clang-tidy config.

Differential Revision: https://reviews.llvm.org/D123340

Added: 


Modified: 
lldb/.clang-tidy
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/unittests/API/SBCommandInterpreterTest.cpp
lldb/unittests/Interpreter/TestCommandPaths.cpp
lldb/unittests/Interpreter/TestOptionValue.cpp
lldb/unittests/Target/RemoteAwarePlatformTest.cpp

Removed: 




diff  --git a/lldb/.clang-tidy b/lldb/.clang-tidy
index 2cde63668d048..499170a49c07a 100644
--- a/lldb/.clang-tidy
+++ b/lldb/.clang-tidy
@@ -1,4 +1,4 @@
-Checks: 
'-readability-identifier-naming,modernize-use-default-member-init,modernize-use-equals-default'
+Checks: 
'-readability-identifier-naming,modernize-use-default-member-init,modernize-use-equals-default,modernize-use-override'
 InheritParentConfig: true
 CheckOptions:
   - key: modernize-use-default-member-init.IgnoreMacros

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
index 160740da31b4f..9ef3c3671abf6 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
@@ -240,7 +240,7 @@ class CompleteTagDeclsScope : public 
ClangASTImporter::NewDeclListener {
 m_delegate->SetImportListener(this);
   }
 
-  virtual ~CompleteTagDeclsScope() {
+  ~CompleteTagDeclsScope() override {
 ClangASTImporter::ASTContextMetadataSP to_context_md =
 importer.GetContextMetadata(m_dst_ctx);
 

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 180ac3ea7f1b2..b3eafecedd76e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -193,7 +193,7 @@ class PlatformDarwinKernelProperties : public Properties {
 m_collection_sp->Initialize(g_platformdarwinkernel_properties);
   }
 
-  virtual ~PlatformDarwinKernelProperties() = default;
+  ~PlatformDarwinKernelProperties() override = default;
 
   FileSpecList GetKextDirectories() const {
 const uint32_t idx = ePropertyKextDirectories;

diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp 
b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index f58adcafcd018..b77cf8012b5ea 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -74,7 +74,7 @@ class PluginProperties : public Properties {
 m_collection_sp->Initialize(g_processkdp_properties);
   }
 
-  virtual ~PluginProperties() = default;
+  ~PluginProperties() override = default;
 
   uint64_t GetPacketTimeout() {
 const uint32_t idx = ePropertyKDPPacketTimeout;
@@ -880,7 +880,7 @@ class CommandObjectProcessKDPPacketSend : public 
CommandObjectParsed {
 m_option_group.Finalize();
   }
 
-  ~CommandObjectProcessKDPPacketSend() = default;
+  ~CommandObjectProcessKDPPacketSend() override = default;
 
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 const size_t argc = command.GetArgumentCount();
@@ -981,7 +981,7 @@ class CommandObjectProcessKDPPacket : public 
CommandObjectMultiword {
 CommandObjectSP(new CommandObjectProcessKDPPacketSend(interpreter)));
   }
 
-  ~CommandObjectProcessKDPPacket() = default;
+  ~CommandObjectProcessKDPPacket() override = default;
 };
 
 class CommandObjectMultiwordProcessKDP : public CommandObjectMultiword {
@@ -995,7 +995,7 @@ class CommandObjectMultiwordProcessKDP : public 
CommandObjectMultiword {
  interpreter)));
   }
 
-  ~CommandObjectMultiwordProcessKDP() = default;
+  ~CommandObjectMultiwordProcessKDP() override = default;
 };
 
 CommandObject *ProcessKDP::GetPluginCommandObject() {

diff  --git a/lldb/unittests/API/SBCommandInterpreterTest.cpp 
b/lldb/unittests/API/SBCommandInterpreterTest.cpp
index d117c08c0bf46..0ddfa51fb6a70 100644
--- a/lldb/unittests/API/SBCommandInterpreterTest.cpp
+++ b/lldb/unittests/API/SBCommandInterpreterTest.cpp
@@ -34,7 +34,7 @@ class DummyCommand : public SBCommandPluginInterface {
   DummyCommand(const char *message) : m_message(message) {}
 
   bool DoExecute(SBDebugger dbg

Re: [Lldb-commits] [lldb] 5f6f33d - [lldb/Plugins] Move member template specialization out of class

2021-09-07 Thread Shafik Yaghmour via lldb-commits
This may actually be a gcc bug: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282 


Not much we can do now but worth knowing in case it is fixed.

> On Sep 3, 2021, at 3:19 PM, Med Ismail Bennani via lldb-commits 
>  wrote:
> 
> 
> Author: Med Ismail Bennani
> Date: 2021-09-03T22:18:55Z
> New Revision: 5f6f33da9ee6cbaef5f10b4a7be34a91d5185b2b
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/5f6f33da9ee6cbaef5f10b4a7be34a91d5185b2b
> DIFF: 
> https://github.com/llvm/llvm-project/commit/5f6f33da9ee6cbaef5f10b4a7be34a91d5185b2b.diff
> 
> LOG: [lldb/Plugins] Move member template specialization out of class
> 
> This patch should fix the build failure that surfaced when build llvm
> with GCC: https://lab.llvm.org/staging/#/builders/16/builds/10450
> 
> GCC complained that I explicitely specialized
> `ScriptedPythonInterface::ExtractValueFromPythonObject` in a
> in non-namespace scope, which is tolerated by Clang.
> 
> To solve this issue, the specialization were declared out of the class
> and implemented in the source file.
> 
> Signed-off-by: Med Ismail Bennani 
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
>lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
> 
> Removed: 
> 
> 
> 
> 
> diff  --git 
> a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp 
> b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
> index 097cbbdb6fc7e..a38cb104c0c63 100644
> --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
> +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
> @@ -35,4 +35,31 @@ 
> ScriptedPythonInterface::GetStatusFromMethod(llvm::StringRef method_name) {
>   return error;
> }
> 
> +template <>
> +Status ScriptedPythonInterface::ExtractValueFromPythonObject(
> +python::PythonObject &p, Status &error) {
> +  if (lldb::SBError *sb_error = reinterpret_cast(
> +  LLDBSWIGPython_CastPyObjectToSBError(p.get(
> +error = m_interpreter.GetStatusFromSBError(*sb_error);
> +  else
> +error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
> +
> +  return error;
> +}
> +
> +template <>
> +lldb::DataExtractorSP
> +ScriptedPythonInterface::ExtractValueFromPythonObject(
> +python::PythonObject &p, Status &error) {
> +  lldb::SBData *sb_data = reinterpret_cast(
> +  LLDBSWIGPython_CastPyObjectToSBData(p.get()));
> +
> +  if (!sb_data) {
> +error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
> +return nullptr;
> +  }
> +
> +  return m_interpreter.GetDataExtractorFromSBData(*sb_data);
> +}
> +
> #endif
> 
> diff  --git 
> a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h 
> b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
> index 85ec167e1463f..bac4efbe76d8d 100644
> --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
> +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
> @@ -33,33 +33,6 @@ class ScriptedPythonInterface : virtual public 
> ScriptedInterface {
> return p.CreateStructuredObject();
>   }
> 
> -  template <>
> -  Status ExtractValueFromPythonObject(python::PythonObject &p,
> -  Status &error) {
> -if (lldb::SBError *sb_error = reinterpret_cast(
> -LLDBSWIGPython_CastPyObjectToSBError(p.get(
> -  error = m_interpreter.GetStatusFromSBError(*sb_error);
> -else
> -  error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
> -
> -return error;
> -  }
> -
> -  template <>
> -  lldb::DataExtractorSP
> -  ExtractValueFromPythonObject(python::PythonObject 
> &p,
> -  Status &error) {
> -lldb::SBData *sb_data = reinterpret_cast(
> -LLDBSWIGPython_CastPyObjectToSBData(p.get()));
> -
> -if (!sb_data) {
> -  error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
> -  return nullptr;
> -}
> -
> -return m_interpreter.GetDataExtractorFromSBData(*sb_data);
> -  }
> -
>   template 
>   T Dispatch(llvm::StringRef method_name, Status &error, Args... args) {
> using namespace python;
> @@ -149,6 +122,16 @@ class ScriptedPythonInterface : virtual public 
> ScriptedInterface {
>   // The lifetime is managed by the ScriptInterpreter
>   ScriptInterpreterPythonImpl &m_interpreter;
> };
> +
> +template <>
> +Status ScriptedPythonInterface::ExtractValueFromPythonObject(
> +python::PythonObject &p, Status &error);
> +
> +template <>
> +lldb::DataExtractorSP
> +ScriptedPythonInterface::ExtractValueFromPythonObject(
> +python::PythonObject &p, Status &error);
> +
> } // namespace lldb_private
> 
> #endif // LLDB_ENABLE_PYTHON
> 
> 
> 
> __

[Lldb-commits] [lldb] 320f65e - [LLDB][NFC] Remove parameter names from forward declarations from hand written expressions used in heap.py part 2

2021-10-19 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-10-19T16:52:36-07:00
New Revision: 320f65ee65f40fadbd2016036e538e28ae28614c

URL: 
https://github.com/llvm/llvm-project/commit/320f65ee65f40fadbd2016036e538e28ae28614c
DIFF: 
https://github.com/llvm/llvm-project/commit/320f65ee65f40fadbd2016036e538e28ae28614c.diff

LOG: [LLDB][NFC] Remove parameter names from forward declarations from hand 
written expressions used in heap.py part 2

heap.py has a lot of large hand written expressions and each name in the
expression will be looked up by clang during expression parsing. For
function parameters this will be in Sema::ActOnParamDeclarator(...) in order to
catch redeclarations of parameters. The names are not needed and we have seen
some rare cases where since we don't have symbols we end up in
SymbolContext::FindBestGlobalDataSymbol(...) which may conflict with other 
global
symbols.

There may be a way to make this lookup smarter to avoid these cases but it is
not clear how well tested this path is and how much work it would be to fix it.
So we will go with this fix while we investigate more.

This is a second try at getting all the cases we care about.

Ref: rdar://78265641

Added: 


Modified: 
lldb/examples/darwin/heap_find/heap.py

Removed: 




diff  --git a/lldb/examples/darwin/heap_find/heap.py 
b/lldb/examples/darwin/heap_find/heap.py
index 8ee44ae25e446..75cb9225e72d6 100644
--- a/lldb/examples/darwin/heap_find/heap.py
+++ b/lldb/examples/darwin/heap_find/heap.py
@@ -129,7 +129,7 @@ def get_iterate_memory_expr(
 void *reserved1[12];
 struct malloc_introspection_t  *introspect;
 } malloc_zone_t;
-kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, 
vm_address_t **addresses, unsigned *count);
+kern_return_t malloc_get_all_zones(task_t, memory_reader_t, vm_address_t **, 
unsigned *);
 memory_reader_t task_peek = [](task_t, vm_address_t remote_address, vm_size_t, 
void **local_memory) -> kern_return_t {
 *local_memory = (void*) remote_address;
 return KERN_SUCCESS;



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


[Lldb-commits] [lldb] 0d62e31 - [LLDB][NFC] Fix test that broke due to libc++ std::vector changes

2021-11-10 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-11-10T12:29:08-08:00
New Revision: 0d62e31c458526e1db37d11da947e61768c7b522

URL: 
https://github.com/llvm/llvm-project/commit/0d62e31c458526e1db37d11da947e61768c7b522
DIFF: 
https://github.com/llvm/llvm-project/commit/0d62e31c458526e1db37d11da947e61768c7b522.diff

LOG: [LLDB][NFC] Fix test that broke due to libc++ std::vector changes

D112976 moved most of the guts of __vector_base into vector, this broke
some LLDB tests by changing the result types that LLDB sees. This updates
the test to reflect the new structure.

Added: 


Modified: 

lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py

lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
index e0b511c91bd0f..8c8dfe01a2deb 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
@@ -23,7 +23,7 @@ def test(self):
 vector_type = "std::vector"
 vector_of_vector_type = "std::vector<" + vector_type + " >"
 size_type = vector_of_vector_type + "::size_type"
-value_type = "std::__vector_base 
>::value_type"
+value_type = "std::vector::value_type"
 
 self.runCmd("settings set target.import-std-module true")
 

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
index a03c347a728fa..32a254ed218d7 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
@@ -24,7 +24,7 @@ def test(self):
 
 vector_type = "std::vector"
 size_type = vector_type + "::size_type"
-value_type = "std::__vector_base 
>::value_type"
+value_type = "std::vector::value_type"
 iterator = vector_type + "::iterator"
 # LLDB's formatter provides us with a artificial 'item' member.
 iterator_children = [ValueCheck(name="item")]



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


[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik updated 
https://github.com/llvm/llvm-project/pull/67373

>From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour 
Date: Mon, 25 Sep 2023 13:56:43 -0700
Subject: [PATCH] [Clang] Fix crash when ill-formed code is treated as a
 deduction guide

In some cases where ill-formed code could be interpreted as a deduction guide
we can crash because we reach an unreachable path. This fixes this issue by
introducing a diagnostic instead.

Fixes: https://github.com/llvm/llvm-project/issues/65522
---
 clang/include/clang/Basic/DiagnosticSemaKinds.td |  2 ++
 clang/lib/Sema/SemaTemplateInstantiate.cpp   |  4 +++-
 clang/test/SemaCXX/gh65522.cpp   | 11 +++
 3 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 clang/test/SemaCXX/gh65522.cpp

diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f4eb02fd9570c2f..c3c1810fd7934a2 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5414,6 +5414,8 @@ def note_constraint_normalization_here : Note<
 def note_parameter_mapping_substitution_here : Note<
   "while substituting into concept arguments here; substitution failures not "
   "allowed in concept arguments">;
+def note_building_deduction_guide_here : Note<
+  "while building implicit deduction guide first needed here">;
 def note_lambda_substitution_here : Note<
   "while substituting into a lambda expression here">;
 def note_instantiation_contexts_suppressed : Note<
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 00a36696cf90450..1ed3df5a011bcb6 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1075,7 +1075,9 @@ void Sema::PrintInstantiationStack() {
   << Active->InstantiationRange;
   break;
 case CodeSynthesisContext::BuildingDeductionGuides:
-  llvm_unreachable("unexpected deduction guide in instantiation stack");
+  Diags.Report(Active->PointOfInstantiation,
+   diag::note_building_deduction_guide_here);
+  break;
 }
   }
 }
diff --git a/clang/test/SemaCXX/gh65522.cpp b/clang/test/SemaCXX/gh65522.cpp
new file mode 100644
index 000..2d6331b0372a31d
--- /dev/null
+++ b/clang/test/SemaCXX/gh65522.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++20 -Wc++17-compat -verify -Wno-unused %s
+
+class X {};
+
+template
+class B3 { // expected-note {{candidate template ignored: could not match 
'B3' against 'int'}}
+  template B3(T); // expected-warning 2{{non-type template parameter of 
type 'X' is incompatible with C++ standards before C++20}} \
+   // expected-note {{candidate template ignored: couldn't 
infer template argument 'x'}}
+};
+B3 b3 = 0; // expected-error {{no viable constructor or deduction guide for 
deduction of template arguments of 'B3'}} \
+   // expected-note {{while building implicit deduction guide first 
needed here}}

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


[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-29 Thread Shafik Yaghmour via lldb-commits

shafik wrote:

ping

https://github.com/llvm/llvm-project/pull/67373
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-09-30 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik updated 
https://github.com/llvm/llvm-project/pull/67373

>From beab5db738483795ecb0bace2842acdbb1c9869a Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour 
Date: Mon, 25 Sep 2023 13:56:43 -0700
Subject: [PATCH 1/2] [Clang] Fix crash when ill-formed code is treated as a
 deduction guide

In some cases where ill-formed code could be interpreted as a deduction guide
we can crash because we reach an unreachable path. This fixes this issue by
introducing a diagnostic instead.

Fixes: https://github.com/llvm/llvm-project/issues/65522
---
 clang/include/clang/Basic/DiagnosticSemaKinds.td |  2 ++
 clang/lib/Sema/SemaTemplateInstantiate.cpp   |  4 +++-
 clang/test/SemaCXX/gh65522.cpp   | 11 +++
 3 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 clang/test/SemaCXX/gh65522.cpp

diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f4eb02fd9570c2f..c3c1810fd7934a2 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5414,6 +5414,8 @@ def note_constraint_normalization_here : Note<
 def note_parameter_mapping_substitution_here : Note<
   "while substituting into concept arguments here; substitution failures not "
   "allowed in concept arguments">;
+def note_building_deduction_guide_here : Note<
+  "while building implicit deduction guide first needed here">;
 def note_lambda_substitution_here : Note<
   "while substituting into a lambda expression here">;
 def note_instantiation_contexts_suppressed : Note<
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 00a36696cf90450..1ed3df5a011bcb6 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1075,7 +1075,9 @@ void Sema::PrintInstantiationStack() {
   << Active->InstantiationRange;
   break;
 case CodeSynthesisContext::BuildingDeductionGuides:
-  llvm_unreachable("unexpected deduction guide in instantiation stack");
+  Diags.Report(Active->PointOfInstantiation,
+   diag::note_building_deduction_guide_here);
+  break;
 }
   }
 }
diff --git a/clang/test/SemaCXX/gh65522.cpp b/clang/test/SemaCXX/gh65522.cpp
new file mode 100644
index 000..2d6331b0372a31d
--- /dev/null
+++ b/clang/test/SemaCXX/gh65522.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++20 -Wc++17-compat -verify -Wno-unused %s
+
+class X {};
+
+template
+class B3 { // expected-note {{candidate template ignored: could not match 
'B3' against 'int'}}
+  template B3(T); // expected-warning 2{{non-type template parameter of 
type 'X' is incompatible with C++ standards before C++20}} \
+   // expected-note {{candidate template ignored: couldn't 
infer template argument 'x'}}
+};
+B3 b3 = 0; // expected-error {{no viable constructor or deduction guide for 
deduction of template arguments of 'B3'}} \
+   // expected-note {{while building implicit deduction guide first 
needed here}}

>From 32d948f9cd73ef7fc7e6900ac4ccdb204ffd3298 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour 
Date: Sat, 30 Sep 2023 15:08:04 -0700
Subject: [PATCH 2/2] Fix release note

---
 clang/docs/ReleaseNotes.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 58753884ec0cc2e..79c495d072b2dd3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -377,7 +377,7 @@ Bug Fixes to C++ Support
 
 - Fix crash where ill-formed code was being treated as a deduction guide and
   we now produce a diagnostic. Fixes:
-  (`65522 `_)
+  (`#65522 `_)
 
 Bug Fixes to AST Handling
 ^

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


[Lldb-commits] [lldb] [Support] Add KnownBits::computeForSubBorrow (PR #67788)

2023-10-01 Thread Shafik Yaghmour via lldb-commits


@@ -85,6 +85,18 @@ KnownBits KnownBits::computeForAddSub(bool Add, bool NSW,
   return KnownOut;
 }
 
+KnownBits KnownBits::computeForSubBorrow(const KnownBits &LHS, KnownBits RHS,
+ const KnownBits &Borrow) {
+  assert(Borrow.getBitWidth() == 1 && "Borrow must be 1-bit");
+
+  // LHS - RHS = LHS + ~RHS + 1
+  // Carry 1 - Borrow in ::computeForAddCarry
+  std::swap(RHS.Zero, RHS.One);
+  return ::computeForAddCarry(LHS, RHS,
+  /*CarryZero*/ Borrow.One.getBoolValue(),
+  /*CarryOne*/ Borrow.Zero.getBoolValue());

shafik wrote:

To be consistent with 
[bugprone-argument-comment](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html)

https://github.com/llvm/llvm-project/pull/67788
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [Support] Add KnownBits::computeForSubBorrow (PR #67788)

2023-10-01 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/67788
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [Clang] Fix crash when ill-formed code is treated as a deduction guide (PR #67373)

2023-10-02 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/67373
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [libc++] Implement ranges::contains_subrange (PR #66963)

2023-10-02 Thread Shafik Yaghmour via lldb-commits

shafik wrote:

Please make sure you add a description to your PR. This is what usually goes 
into the git log and we want those entries to be as descriptive and helpful for 
folks who read the git logs, thank you.

https://github.com/llvm/llvm-project/pull/66963
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [Clang] Ensure zero-init is not overridden when initializing a base class in a constant expression context (PR #70150)

2023-10-25 Thread Shafik Yaghmour via lldb-commits

shafik wrote:

The clang-format error is a false positive.

https://github.com/llvm/llvm-project/pull/70150
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [Clang] Ensure zero-init is not overridden when initializing a base class in a constant expression context (PR #70150)

2023-10-25 Thread Shafik Yaghmour via lldb-commits

https://github.com/shafik closed https://github.com/llvm/llvm-project/pull/70150
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] 8dd1060 - [debugserver] Add platform cache support to improve performance.

2021-05-21 Thread Shafik Yaghmour via lldb-commits
So I guess we don’t use in class member initialization for m_platform b/c 
GetPlatform() can never be called before either Clear() or Detach()?

> On May 20, 2021, at 7:10 PM, Jonas Devlieghere via lldb-commits 
>  wrote:
> 
> 
> Author: kuperxu
> Date: 2021-05-20T19:10:46-07:00
> New Revision: 8dd106028b1533f0de03a1ffb4ea0dce40b5a2ff
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/8dd106028b1533f0de03a1ffb4ea0dce40b5a2ff
> DIFF: 
> https://github.com/llvm/llvm-project/commit/8dd106028b1533f0de03a1ffb4ea0dce40b5a2ff.diff
> 
> LOG: [debugserver] Add platform cache support to improve performance.
> 
> The dyld SPI used by debugserver (_dyld_process_info_create) has become
> much slower in macOS BigSur 11.3 causing a significant performance
> regression when attaching. This commit mitigates that by caching the
> result when calling the SPI to compute the platform.
> 
> Differential revision: https://reviews.llvm.org/D102833
> 
> Added: 
> 
> 
> Modified: 
>lldb/tools/debugserver/source/MacOSX/MachProcess.h
>lldb/tools/debugserver/source/MacOSX/MachProcess.mm
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h 
> b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
> index b295dfecec41..33c3d628a7a0 100644
> --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h
> +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
> @@ -252,6 +252,7 @@ class MachProcess {
>  struct mach_o_information &inf);
>   JSONGenerator::ObjectSP FormatDynamicLibrariesIntoJSON(
>   const std::vector &image_infos);
> +  uint32_t GetPlatform();
>   /// Get the runtime platform from DYLD via SPI.
>   uint32_t GetProcessPlatformViaDYLDSPI();
>   /// Use the dyld SPI present in macOS 10.12, iOS 10, tvOS 10,
> @@ -378,6 +379,7 @@ class MachProcess {
> 
>   pid_t m_pid;   // Process ID of child process
>   cpu_type_t m_cpu_type; // The CPU type of this process
> +  uint32_t m_platform;   // The platform of this process
>   int m_child_stdin;
>   int m_child_stdout;
>   int m_child_stderr;
> 
> diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm 
> b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
> index 0a6ef6161711..7eab2c6d185f 100644
> --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
> +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
> @@ -701,7 +701,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary 
> *options,
>   // DYLD_FORCE_PLATFORM=6. In that case, force the platform to
>   // macCatalyst and use the macCatalyst version of the host OS
>   // instead of the macOS deployment target.
> -  if (is_executable && GetProcessPlatformViaDYLDSPI() == 
> PLATFORM_MACCATALYST) {
> +  if (is_executable && GetPlatform() == PLATFORM_MACCATALYST) {
> info.platform = PLATFORM_MACCATALYST;
> std::string catalyst_version = GetMacCatalystVersionString();
> const char *major = catalyst_version.c_str();
> @@ -1094,6 +1094,12 @@ static bool 
> FBSAddEventDataToOptions(NSMutableDictionary *options,
>   bool privateCache;
> };
> 
> +uint32_t MachProcess::GetPlatform() {
> +  if (m_platform == 0)
> +m_platform = MachProcess::GetProcessPlatformViaDYLDSPI();
> +  return m_platform;
> +}
> +
> uint32_t MachProcess::GetProcessPlatformViaDYLDSPI() {
>   kern_return_t kern_ret;
>   uint32_t platform = 0;
> @@ -1140,7 +1146,7 @@ static bool 
> FBSAddEventDataToOptions(NSMutableDictionary *options,
>   int pointer_size = GetInferiorAddrSize(pid);
>   std::vector image_infos;
>   GetAllLoadedBinariesViaDYLDSPI(image_infos);
> -  uint32_t platform = GetProcessPlatformViaDYLDSPI();
> +  uint32_t platform = GetPlatform();
>   const size_t image_count = image_infos.size();
>   for (size_t i = 0; i < image_count; i++) {
> GetMachOInformationFromMemory(platform, image_infos[i].load_address,
> @@ -1160,7 +1166,7 @@ static bool 
> FBSAddEventDataToOptions(NSMutableDictionary *options,
> 
>   std::vector all_image_infos;
>   GetAllLoadedBinariesViaDYLDSPI(all_image_infos);
> -  uint32_t platform = GetProcessPlatformViaDYLDSPI();
> +  uint32_t platform = GetPlatform();
> 
>   std::vector image_infos;
>   const size_t macho_addresses_count = macho_addresses.size();
> @@ -1324,6 +1330,7 @@ static bool 
> FBSAddEventDataToOptions(NSMutableDictionary *options,
>   // Clear any cached thread list while the pid and task are still valid
> 
>   m_task.Clear();
> +  m_platform = 0;
>   // Now clear out all member variables
>   m_pid = INVALID_NUB_PROCESS;
>   if (!detaching)
> @@ -1615,6 +1622,7 @@ static bool 
> FBSAddEventDataToOptions(NSMutableDictionary *options,
> 
>   // NULL our task out as we have already restored all exception ports
>   m_task.Clear();
> +  m_platform = 0;
> 
>   // Clear out any notion of the process we once were
>   const bool detaching = true;
> 
> 
> 
> ___

[Lldb-commits] [lldb] ae1a699 - [LLDB][NFC] Remove parameter names from forward declarations from hand written expressions used in heap.py

2021-06-08 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-06-08T14:27:02-07:00
New Revision: ae1a699554cfa01d9fb307a964c3a9f71831a62e

URL: 
https://github.com/llvm/llvm-project/commit/ae1a699554cfa01d9fb307a964c3a9f71831a62e
DIFF: 
https://github.com/llvm/llvm-project/commit/ae1a699554cfa01d9fb307a964c3a9f71831a62e.diff

LOG: [LLDB][NFC] Remove parameter names from forward declarations from hand 
written expressions used in heap.py

heap.py has a lot of large hand written expressions and each name in the
expression will be looked up by clang during expression parsing. For
function parameters this will be in Sema::ActOnParamDeclarator(...) in order to
catch redeclarations of parameters. The names are not needed and we have seen
some rare cases where since we don't have symbols we end up in
SymbolContext::FindBestGlobalDataSymbol(...) which may conflict with other 
global
symbols.

There may be a way to make this lookup smarter to avoid these cases but it is
not clear how well tested this path is and how much work it would be to fix it.
So we will go with this fix while we investigate more.

Ref: rdar://78265641

Added: 


Modified: 
lldb/examples/darwin/heap_find/heap.py

Removed: 




diff  --git a/lldb/examples/darwin/heap_find/heap.py 
b/lldb/examples/darwin/heap_find/heap.py
index 4174d396feb6b..830e851e21056 100644
--- a/lldb/examples/darwin/heap_find/heap.py
+++ b/lldb/examples/darwin/heap_find/heap.py
@@ -36,7 +36,7 @@ def get_iterate_memory_expr(
 typedef natural_t task_t;
 typedef int kern_return_t;
 #define KERN_SUCCESS 0
-typedef void (*range_callback_t)(task_t task, void *baton, unsigned type, 
uintptr_t ptr_addr, uintptr_t ptr_size);
+typedef void (*range_callback_t)(task_t, void *, unsigned, uintptr_t, 
uintptr_t);
 '''
 if options.search_vm_regions:
 expr += '''
@@ -120,8 +120,8 @@ def get_iterate_memory_expr(
 vm_address_t   address;
 vm_size_t  size;
 } vm_range_t;
-typedef kern_return_t (*memory_reader_t)(task_t task, vm_address_t 
remote_address, vm_size_t size, void **local_memory);
-typedef void (*vm_range_recorder_t)(task_t task, void *baton, unsigned type, 
vm_range_t *range, unsigned size);
+typedef kern_return_t (*memory_reader_t)(task_t, vm_address_t, vm_size_t, void 
**);
+typedef void (*vm_range_recorder_t)(task_t, void *, unsigned, vm_range_t *, 
unsigned);
 typedef struct malloc_introspection_t {
 kern_return_t (*enumerator)(task_t task, void *, unsigned type_mask, 
vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t 
recorder); /* enumerates all the malloc pointers in use */
 } malloc_introspection_t;
@@ -130,7 +130,7 @@ def get_iterate_memory_expr(
 struct malloc_introspection_t  *introspect;
 } malloc_zone_t;
 kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, 
vm_address_t **addresses, unsigned *count);
-memory_reader_t task_peek = [](task_t task, vm_address_t remote_address, 
vm_size_t size, void **local_memory) -> kern_return_t {
+memory_reader_t task_peek = [](task_t, vm_address_t remote_address, vm_size_t, 
void **local_memory) -> kern_return_t {
 *local_memory = (void*) remote_address;
 return KERN_SUCCESS;
 };



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


Re: [Lldb-commits] [lldb] 172a55e - [lldb] Fix FunctionDecl::Create after D102343

2021-07-29 Thread Shafik Yaghmour via lldb-commits
Thanks for catching and fixing this!

> On Jul 29, 2021, at 9:57 AM, Fangrui Song via lldb-commits 
>  wrote:
> 
> 
> Author: Fangrui Song
> Date: 2021-07-29T09:57:10-07:00
> New Revision: 172a55e7a40d27c7882be2e86d515696d8e12427
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/172a55e7a40d27c7882be2e86d515696d8e12427
> DIFF: 
> https://github.com/llvm/llvm-project/commit/172a55e7a40d27c7882be2e86d515696d8e12427.diff
> 
> LOG: [lldb] Fix FunctionDecl::Create after D102343
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git 
> a/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp 
> b/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp
> index 829afa5ffcecc..d95b79a9b1f82 100644
> --- a/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp
> +++ b/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp
> @@ -77,7 +77,7 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const 
> CompilerType &type,
> 
>   clang::FunctionDecl *func_decl = FunctionDecl::Create(
>   ast, context, SourceLocation(), SourceLocation(), decl_name, qual_type,
> -  nullptr, SC_Extern, isInlineSpecified, hasWrittenPrototype,
> +  nullptr, SC_Extern, /*UsesFPIntrin=*/false, isInlineSpecified, 
> hasWrittenPrototype,
>   isConstexprSpecified ? ConstexprSpecKind::Constexpr
>: ConstexprSpecKind::Unspecified);
> 
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] 0479afb - [LLDB] Fix off by one logging placeholders in ClangASTSource::layoutRecordType()

2021-08-17 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-08-17T16:47:46-07:00
New Revision: 0479afb3d6a31668631464653f07154d6850e4a1

URL: 
https://github.com/llvm/llvm-project/commit/0479afb3d6a31668631464653f07154d6850e4a1
DIFF: 
https://github.com/llvm/llvm-project/commit/0479afb3d6a31668631464653f07154d6850e4a1.diff

LOG: [LLDB] Fix off by one logging placeholders in 
ClangASTSource::layoutRecordType()

D72391 Added some additional information to the logging but in this case 
instead of using
placeholder 2 and 3 they used 3 and 4.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index fad2f3f1a8638..58b6b625bfeca 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -1495,7 +1495,7 @@ bool ClangASTSource::layoutRecordType(const RecordDecl 
*record, uint64_t &size,
 
   LLDB_LOG(log,
"LayoutRecordType on (ASTContext*){0} '{1}' for (RecordDecl*)"
-   "{3} [name = '{4}']",
+   "{2} [name = '{3}']",
m_ast_context, m_clang_ast_context->getDisplayName(), record,
record->getName());
 



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


[Lldb-commits] [lldb] 2a4a498 - [LLDB] Add type to the output for FieldDecl when logging in ClangASTSource::layoutRecordType

2021-08-26 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-08-26T11:17:47-07:00
New Revision: 2a4a498a884ad929dad5dc72e20c76adfecfc78c

URL: 
https://github.com/llvm/llvm-project/commit/2a4a498a884ad929dad5dc72e20c76adfecfc78c
DIFF: 
https://github.com/llvm/llvm-project/commit/2a4a498a884ad929dad5dc72e20c76adfecfc78c.diff

LOG: [LLDB] Add type to the output for FieldDecl when logging in 
ClangASTSource::layoutRecordType

I was debugging a problem and noticed that it would have been helpful to have
the type of each FieldDecl when looking at the output from
ClangASTSource::layoutRecordType.

Differential Revision: https://reviews.llvm.org/D108257

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 58b6b625bfeca..ae93252e55212 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -1571,8 +1571,10 @@ bool ClangASTSource::layoutRecordType(const RecordDecl 
*record, uint64_t &size,
 fe = record->field_end();
  fi != fe; ++fi) {
   LLDB_LOG(log,
-   "LRT (FieldDecl*){0}, Name = '{1}', Offset = {2} bits",
-   *fi, fi->getName(), field_offsets[*fi]);
+   "LRT (FieldDecl*){0}, Name = '{1}', Type = '{2}', Offset = "
+   "{3} bits",
+   *fi, fi->getName(), fi->getType().getAsString(),
+   field_offsets[*fi]);
 }
 DeclFromParser parser_cxx_record =
 DynCast(parser_record);



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


Re: [Lldb-commits] [lldb] 2ce889f - [lldb][NFC] Add size tests for empty records with alignment and with empty members

2021-08-30 Thread Shafik Yaghmour via lldb-commits
Interesting to note that zero sized arrays are an extension, so are empty 
structs which require a diagnostic in C but are well-formed C++. It is 
unfortunate that we have divergence in that extension. 

> On Aug 30, 2021, at 7:38 AM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> 
> Author: Raphael Isemann
> Date: 2021-08-30T16:38:13+02:00
> New Revision: 2ce889fa4e5cab75fc65d03a4dfae52784d57db9
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/2ce889fa4e5cab75fc65d03a4dfae52784d57db9
> DIFF: 
> https://github.com/llvm/llvm-project/commit/2ce889fa4e5cab75fc65d03a4dfae52784d57db9.diff
> 
> LOG: [lldb][NFC] Add size tests for empty records with alignment and with 
> empty members
> 
> This came up during the Windows bot failure discussing after D105471 . See
> also 3d9a9fa6911a5228ce799a7c639e94d322678934 .
> 
> Added: 
> 
> 
> Modified: 
>lldb/test/API/lang/c/sizeof/TestCSizeof.py
>lldb/test/API/lang/c/sizeof/main.c
>lldb/test/API/lang/cpp/sizeof/TestCPPSizeof.py
>lldb/test/API/lang/cpp/sizeof/main.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/test/API/lang/c/sizeof/TestCSizeof.py 
> b/lldb/test/API/lang/c/sizeof/TestCSizeof.py
> index 5bcbc42e3dfcf..67766833623db 100644
> --- a/lldb/test/API/lang/c/sizeof/TestCSizeof.py
> +++ b/lldb/test/API/lang/c/sizeof/TestCSizeof.py
> @@ -14,5 +14,6 @@ def test(self):
> # Empty structs are not allowed in C, but Clang/GCC allow them and
> # give them a size of 0.
> self.expect_expr("sizeof(Empty) == sizeof_empty", result_value="true")
> +self.expect_expr("sizeof(EmptyMember) == sizeof_empty_member", 
> result_value="true")
> self.expect_expr("sizeof(SingleMember) == sizeof_single", 
> result_value="true")
> self.expect_expr("sizeof(PaddingMember) == sizeof_padding", 
> result_value="true")
> 
> diff  --git a/lldb/test/API/lang/c/sizeof/main.c 
> b/lldb/test/API/lang/c/sizeof/main.c
> index 08bf906edb4af..fa7bd2d46b1a9 100644
> --- a/lldb/test/API/lang/c/sizeof/main.c
> +++ b/lldb/test/API/lang/c/sizeof/main.c
> @@ -1,4 +1,7 @@
> struct Empty {};
> +struct EmptyMember {
> +  char i[0];
> +};
> struct SingleMember {
>   int i;
> };
> @@ -9,13 +12,15 @@ struct PaddingMember {
> };
> 
> const unsigned sizeof_empty = sizeof(struct Empty);
> +const unsigned sizeof_empty_member = sizeof(struct EmptyMember);
> const unsigned sizeof_single = sizeof(struct SingleMember);
> const unsigned sizeof_padding = sizeof(struct PaddingMember);
> 
> int main() {
>   struct Empty empty;
> +  struct EmptyMember empty_member;
>   struct SingleMember single;
>   struct PaddingMember padding;
>   // Make sure globals are used.
> -  return sizeof_empty + sizeof_single + sizeof_padding;
> +  return sizeof_empty + sizeof_empty_member + sizeof_single + sizeof_padding;
> }
> 
> diff  --git a/lldb/test/API/lang/cpp/sizeof/TestCPPSizeof.py 
> b/lldb/test/API/lang/cpp/sizeof/TestCPPSizeof.py
> index c6b54de349470..e7f4623ee91f2 100644
> --- a/lldb/test/API/lang/cpp/sizeof/TestCPPSizeof.py
> +++ b/lldb/test/API/lang/cpp/sizeof/TestCPPSizeof.py
> @@ -14,6 +14,10 @@ def test(self):
> # Empty structs/classes have size 1 in C++.
> self.expect_expr("sizeof(Empty) == sizeof_empty", result_value="true")
> self.expect_expr("sizeof(EmptyClass) == sizeof_empty_class", 
> result_value="true")
> +self.expect_expr("sizeof(EmptyClassAligned) == 
> sizeof_empty_class_aligned",
> + result_value="true")
> +self.expect_expr("sizeof(ClassEmptyMember) == 
> sizeof_class_empty_member",
> + result_value="true")
> self.expect_expr("sizeof(SingleMember) == sizeof_single", 
> result_value="true")
> self.expect_expr("sizeof(SingleMemberClass) == sizeof_single_class", 
> result_value="true")
> self.expect_expr("sizeof(PaddingMember) == sizeof_padding", 
> result_value="true")
> 
> diff  --git a/lldb/test/API/lang/cpp/sizeof/main.cpp 
> b/lldb/test/API/lang/cpp/sizeof/main.cpp
> index 6c4da06cbef85..4a7a89a1307fd 100644
> --- a/lldb/test/API/lang/cpp/sizeof/main.cpp
> +++ b/lldb/test/API/lang/cpp/sizeof/main.cpp
> @@ -1,5 +1,9 @@
> struct Empty {};
> class EmptyClass {};
> +class alignas(4) EmptyClassAligned {};
> +class ClassEmptyMember {
> +  int i[0];
> +};
> 
> struct SingleMember {
>   int i;
> @@ -19,6 +23,8 @@ class PaddingMemberClass {
> 
> const unsigned sizeof_empty = sizeof(Empty);
> const unsigned sizeof_empty_class = sizeof(EmptyClass);
> +const unsigned sizeof_empty_class_aligned = sizeof(EmptyClassAligned);
> +const unsigned sizeof_class_empty_member = sizeof(ClassEmptyMember);
> const unsigned sizeof_single = sizeof(SingleMember);
> const unsigned sizeof_single_class = sizeof(SingleMemberClass);
> const unsigned sizeof_padding = sizeof(PaddingMember);
> @@ -27,11 +33,14 @@ const unsigned sizeof_padding_class = 
> sizeof(PaddingMemberClass);
> int ma

Re: [Lldb-commits] [lldb] b6b3fcd - [lldb] Don't iterate over a std::set in SymbolFileDWARF::GetTypes to make it deterministic

2020-03-03 Thread Shafik Yaghmour via lldb-commits


> On Mar 2, 2020, at 3:47 PM, Davide Italiano via lldb-commits 
>  wrote:
> 
> 
> 
>> On Mar 2, 2020, at 15:44, Raphael “Teemperor” Isemann  
>> wrote:
>> 
>> I was just grepping for unordered data structures (e.g. ’std::set<‘) that 
>> use pointers/pointer-like objects (e.g. CompilerType with its operator<) and 
>> then reading the related code. Not sure if there is a good way to detect 
>> this stuff automatically. I guess we could have had a Clang plugin that 
>> creates a warning when code iterates over an unordered data structure that 
>> has a pointer-like type as a key (probably would cause a bunch of 
>> false-positives but if someone ran this on his own machine from time to time 
>> that would be enough I think).
> 


It came up when we chatted on Monday and I had some non-determinism when 
dealing with one of the bug recently. It was like 1 in 10 thing so I was able 
to work around it but we spent a little bit of time looking at all the places 
we used std::set and std::map and there are a several of them.

He felt it was a good build czar side project and I agreed.

> 
> I don’t think there’s a great way to detect this automatically, but I’m happy 
> to hear because I was bitten by the problem several times.
> I guess my question was more motivated by the curiosity than anything else. 
> Good work.
> 
> —
> D
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] e98ef0a - [lldb] Fix several LLDB_LOGs with wrong indices in ClangASTSource.cpp

2020-03-04 Thread Shafik Yaghmour via lldb-commits
This is a lot of errors, did it the index use to start at one before? 

There is a type below, noted inline

> On Mar 4, 2020, at 10:33 AM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> 
> Author: Raphael Isemann
> Date: 2020-03-04T10:32:50-08:00
> New Revision: e98ef0af2c725f12dc60556a039e947ddeeb9f42
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/e98ef0af2c725f12dc60556a039e947ddeeb9f42
> DIFF: 
> https://github.com/llvm/llvm-project/commit/e98ef0af2c725f12dc60556a039e947ddeeb9f42.diff
> 
> LOG: [lldb] Fix several LLDB_LOGs with wrong indices in ClangASTSource.cpp
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
> b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
> index 4d98d9cbdda3..6a8c7bd46559 100644
> --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
> +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
> @@ -190,8 +190,8 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
> 
>   if (log) {
> LLDB_LOG(log,
> - "CompleteTagDecl on (ASTContext*){1} Completing "
> - "(TagDecl*){2} named {3}",
> + "CompleteTagDecl on (ASTContext*){0} Completing "
> + "(TagDecl*){1} named {2}",
>  m_clang_ast_context->getDisplayName(), tag_decl,
>  tag_decl->getName());
> 
> @@ -220,7 +220,7 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
>   ClangASTImporter::NamespaceMapSP namespace_map =
>   m_ast_importer_sp->GetNamespaceMap(namespace_context);
> 
> -  LLDB_LOGV(log, "  CTD Inspecting namespace map{1} ({2} entries)",
> +  LLDB_LOGV(log, "  CTD Inspecting namespace map{0} ({1} entries)",
> namespace_map.get(), namespace_map->size());
> 
>   if (!namespace_map)
> @@ -229,7 +229,7 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
>   for (ClangASTImporter::NamespaceMap::iterator i = 
> namespace_map->begin(),
> e = namespace_map->end();
>i != e && !found; ++i) {
> -LLDB_LOG(log, "  CTD Searching namespace {1} in module {2}",
> +LLDB_LOG(log, "  CTD Searching namespace {0} in module {1}",
>  i->second.GetName(), i->first->GetFileSpec().GetFilename());
> 
> TypeList types;
> @@ -478,12 +478,12 @@ void ClangASTSource::FindExternalLexicalDecls(
> std::string ast_dump = ClangUtil::DumpDecl(decl);
> if (const NamedDecl *context_named_decl =
> dyn_cast(context_decl))
> -  LLDB_LOG(log, "  FELD Adding [to {1}Decl {2}] lexical {3}Decl {4}",
> +  LLDB_LOG(log, "  FELD Adding [to {0}Decl {1}] lexical {2}Decl 34}”,


Typo should be {3} not 34}


>context_named_decl->getDeclKindName(),
>context_named_decl->getName(), decl->getDeclKindName(),
>ast_dump);
> else
> -  LLDB_LOG(log, "  FELD Adding lexical {1}Decl {2}",
> +  LLDB_LOG(log, "  FELD Adding lexical {0}Decl {1}",
>decl->getDeclKindName(), ast_dump);
>   }
> 
> @@ -527,19 +527,19 @@ void 
> ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) {
> if (!context.m_decl_context)
>   LLDB_LOG(log,
>"ClangASTSource::FindExternalVisibleDecls on "
> -   "(ASTContext*){1} '{2}' for '{3}' in a NULL DeclContext",
> +   "(ASTContext*){0} '{1}' for '{2}' in a NULL DeclContext",
>m_ast_context, m_clang_ast_context->getDisplayName(), name);
> else if (const NamedDecl *context_named_decl =
>  dyn_cast(context.m_decl_context))
>   LLDB_LOG(log,
>"ClangASTSource::FindExternalVisibleDecls on "
> -   "(ASTContext*){1} '{2}' for '{3}' in '{4}'",
> +   "(ASTContext*){0} '{1}' for '{2}' in '{3}'",
>m_ast_context, m_clang_ast_context->getDisplayName(), name,
>context_named_decl->getName());
> else
>   LLDB_LOG(log,
>"ClangASTSource::FindExternalVisibleDecls on "
> -   "(ASTContext*){1} '{2}' for '{3}' in a '{4}'",
> +   "(ASTContext*){0} '{1}' for '{2}' in a '{3}'",
>m_ast_context, m_clang_ast_context->getDisplayName(), name,
>context.m_decl_context->getDeclKindName());
>   }
> @@ -631,7 +631,7 @@ void ClangASTSource::FindExternalVisibleDecls(
>   if (log) {
> const char *name_string = type_sp->GetName().GetCString();
> 
> -LLDB_LOG(log, "  CAS::FEVD Matching type found for \"{1}\": {2}", 
> name,
> +LLDB_LOG(log, "  CAS::FEVD Matching type found for \"{0}\": {1}", 
> name,
>  (name_string ? nam

Re: [Lldb-commits] [lldb] 3806b38 - [LLDB] Initialize temporary token

2020-03-30 Thread Shafik Yaghmour via lldb-commits
Thank you for catching this and fixing it!

> On Mar 30, 2020, at 7:13 AM, Benjamin Kramer via lldb-commits 
>  wrote:
> 
> 
> Author: Benjamin Kramer
> Date: 2020-03-30T16:12:50+02:00
> New Revision: 3806b38045c08c674dc5db65bb06cf3dc34b9cc7
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/3806b38045c08c674dc5db65bb06cf3dc34b9cc7
> DIFF: 
> https://github.com/llvm/llvm-project/commit/3806b38045c08c674dc5db65bb06cf3dc34b9cc7.diff
> 
> LOG: [LLDB] Initialize temporary token
> 
> Found by msan.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp 
> b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
> index a834be96444d..eca36fff18f8 100644
> --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
> +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
> @@ -347,7 +347,7 @@ bool CPlusPlusNameParser::ConsumeOperator() {
>   // If we find ( or < then this is indeed operator<< no need for fix.
>   if (n_token.getKind() != tok::l_paren && n_token.getKind() != 
> tok::less) {
> clang::Token tmp_tok;
> -
> +tmp_tok.startToken();
> tmp_tok.setLength(1);
> tmp_tok.setLocation(token.getLocation().getLocWithOffset(1));
> tmp_tok.setKind(tok::less);
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] 3775be2 - Target: correct the return value for `GetImageAddrFromToken`

2020-04-06 Thread Shafik Yaghmour via lldb-commits
Hello Saleem,

I am not familiar with this part of the code but is there an easy way to test 
this failure? We should add a test to make sure we don’t break this 
accidentally in the future.

Thank you!

> On Apr 6, 2020, at 5:38 PM, Saleem Abdulrasool via lldb-commits 
>  wrote:
> 
> 
> Author: Saleem Abdulrasool
> Date: 2020-04-06T17:37:57-07:00
> New Revision: 3775be2d8e17aaeae62ab83ded005867f4bf70ac
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/3775be2d8e17aaeae62ab83ded005867f4bf70ac
> DIFF: 
> https://github.com/llvm/llvm-project/commit/3775be2d8e17aaeae62ab83ded005867f4bf70ac.diff
> 
> LOG: Target: correct the return value for `GetImageAddrFromToken`
> 
> We would return `LLDB_INVALID_IMAGE_TOKEN` for the address rather than
> the correct value of `LLDB_IMAGE_ADDRESS`.  This would result in the
> check for the return value to silently pass on x64 as the invalid
> address and invalid token are of different sizes (`size_t` vs
> `uintprr_t`).  This corrects the return value to `LLDB_INVALID_ADDRESS`
> and addresses the rest to reset the mapped address to the invalid value.
> 
> This was found by inspection when trying to implement module support for
> Windows.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Target/Process.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
> index a3776f95..7797a4c60964 100644
> --- a/lldb/source/Target/Process.cpp
> +++ b/lldb/source/Target/Process.cpp
> @@ -5796,12 +5796,12 @@ size_t Process::AddImageToken(lldb::addr_t image_ptr) 
> {
> lldb::addr_t Process::GetImagePtrFromToken(size_t token) const {
>   if (token < m_image_tokens.size())
> return m_image_tokens[token];
> -  return LLDB_INVALID_IMAGE_TOKEN;
> +  return LLDB_INVALID_ADDRESS;
> }
> 
> void Process::ResetImageToken(size_t token) {
>   if (token < m_image_tokens.size())
> -m_image_tokens[token] = LLDB_INVALID_IMAGE_TOKEN;
> +m_image_tokens[token] = LLDB_INVALID_ADDRESS;
> }
> 
> Address
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] 9f17599 - [LLDB] Fix LLDB_LOG calls to use correct formatting

2021-02-12 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-02-12T11:09:39-08:00
New Revision: 9f175998debcbb14e95d7e94ca5fee26f4acc63b

URL: 
https://github.com/llvm/llvm-project/commit/9f175998debcbb14e95d7e94ca5fee26f4acc63b
DIFF: 
https://github.com/llvm/llvm-project/commit/9f175998debcbb14e95d7e94ca5fee26f4acc63b.diff

LOG: [LLDB] Fix LLDB_LOG calls to use correct formatting

It looks like a previous change switched these from LLDB_LOGF but did not 
update the format strings.

Differential Revision: https://reviews.llvm.org/D96550

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 0f34c48c7e82..19031af400ea 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -1570,10 +1570,10 @@ bool ClangASTSource::layoutRecordType(const RecordDecl 
*record, uint64_t &size,
 
   if (log) {
 LLDB_LOG(log, "LRT returned:");
-LLDB_LOG(log, "LRT   Original = (RecordDecl*)%p",
+LLDB_LOG(log, "LRT   Original = (RecordDecl*){0}",
  static_cast(origin_record.decl));
-LLDB_LOG(log, "LRT   Size = %" PRId64, size);
-LLDB_LOG(log, "LRT   Alignment = %" PRId64, alignment);
+LLDB_LOG(log, "LRT   Size = {0}", size);
+LLDB_LOG(log, "LRT   Alignment = {0}", alignment);
 LLDB_LOG(log, "LRT   Fields:");
 for (RecordDecl::field_iterator fi = record->field_begin(),
 fe = record->field_end();

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 852ce3bbd3db..04d72ce4f021 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -350,7 +350,7 @@ bool ClangExpressionDeclMap::AddValueToStruct(const 
NamedDecl *decl,
   if (!var)
 return false;
 
-  LLDB_LOG(log, "Adding value for (NamedDecl*)%p [%s - %s] to the structure",
+  LLDB_LOG(log, "Adding value for (NamedDecl*){0} [{1} - {2}] to the 
structure",
decl, name, var->GetName());
 
   // We know entity->m_parser_vars is valid because we used a parser variable
@@ -752,7 +752,7 @@ void 
ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context,
 MaybeRegisterFunctionBody(parser_function_decl);
   }
 
-  LLDB_LOG(log, "  CEDM::FEVD Found persistent decl %s", name);
+  LLDB_LOG(log, "  CEDM::FEVD Found persistent decl {0}", name);
 
   context.AddNamedDecl(parser_named_decl);
 }



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


[Lldb-commits] [lldb] 1e08193 - Fix for Modify TypePrinter to differentiate between anonymous struct and unnamed struct

2021-02-18 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-02-18T17:57:40-08:00
New Revision: 1e0819395657a9306f609849dcd3be9d7fb0c894

URL: 
https://github.com/llvm/llvm-project/commit/1e0819395657a9306f609849dcd3be9d7fb0c894
DIFF: 
https://github.com/llvm/llvm-project/commit/1e0819395657a9306f609849dcd3be9d7fb0c894.diff

LOG: Fix for Modify TypePrinter to differentiate between anonymous struct and 
unnamed struct

One of the lldb tests needed additional fixes.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test

Removed: 




diff  --git 
a/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test 
b/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
index 8dddea063578..8bdc2219cc1c 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
@@ -22,5 +22,5 @@ PRINTEC: use of undeclared identifier 'EC'
 
 RUN: %lldb %t -b -o "target variable a e ec" | FileCheck --check-prefix=VARS %s
 VARS: (const (unnamed struct)) a = {}
-VARS: (const (anonymous enum)) e = 0x1
-VARS: (const (anonymous enum)) ec = 0x1
+VARS: (const (unnamed enum)) e = 0x1
+VARS: (const (unnamed enum)) ec = 0x1



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


[Lldb-commits] [lldb] 080ba85 - Revert "Fix for Modify TypePrinter to differentiate between anonymous struct and unnamed struct"

2021-02-18 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-02-18T18:17:24-08:00
New Revision: 080ba851c61604f9c00117b584191c67cfc468cd

URL: 
https://github.com/llvm/llvm-project/commit/080ba851c61604f9c00117b584191c67cfc468cd
DIFF: 
https://github.com/llvm/llvm-project/commit/080ba851c61604f9c00117b584191c67cfc468cd.diff

LOG: Revert "Fix for Modify TypePrinter to differentiate between anonymous 
struct and unnamed struct"

I missed clangd test suite and may need some time to get those working, so 
reverting for now.

This reverts commit 1e0819395657a9306f609849dcd3be9d7fb0c894.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test

Removed: 




diff  --git 
a/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test 
b/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
index 8bdc2219cc1c..8dddea063578 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/debug-types-missing-signature.test
@@ -22,5 +22,5 @@ PRINTEC: use of undeclared identifier 'EC'
 
 RUN: %lldb %t -b -o "target variable a e ec" | FileCheck --check-prefix=VARS %s
 VARS: (const (unnamed struct)) a = {}
-VARS: (const (unnamed enum)) e = 0x1
-VARS: (const (unnamed enum)) ec = 0x1
+VARS: (const (anonymous enum)) e = 0x1
+VARS: (const (anonymous enum)) ec = 0x1



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


[Lldb-commits] [lldb] ec00502 - [NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi diagnostics

2021-03-23 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-03-23T14:32:36-07:00
New Revision: ec00502b9f4021112c22b87ff849ecb5505763dd

URL: 
https://github.com/llvm/llvm-project/commit/ec00502b9f4021112c22b87ff849ecb5505763dd
DIFF: 
https://github.com/llvm/llvm-project/commit/ec00502b9f4021112c22b87ff849ecb5505763dd.diff

LOG: [NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi 
diagnostics

Added: 


Modified: 
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
lldb/tools/debugserver/source/MacOSX/ThreadInfo.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp 
b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index 72be0f9d7831..b4ec4c7124d2 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -123,7 +123,7 @@ Status ScriptedProcess::DoLaunch(Module *exe_module,
   }
 
   return status;
-};
+}
 
 void ScriptedProcess::DidLaunch() {
   if (m_interpreter)

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
index 1843d9237d82..1ef792bcf303 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -50,7 +50,7 @@ extern "C" void *LLDBSWIGPython_CastPyObjectToSBData(void 
*data);
 extern "C" void *LLDBSWIGPython_CastPyObjectToSBError(void *data);
 extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
 
-}; // namespace lldb_private
+} // namespace lldb_private
 
 #endif // LLDB_ENABLE_PYTHON
 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H

diff  --git a/lldb/tools/debugserver/source/MacOSX/ThreadInfo.h 
b/lldb/tools/debugserver/source/MacOSX/ThreadInfo.h
index a114a47eaab8..592d50fd4284 100644
--- a/lldb/tools/debugserver/source/MacOSX/ThreadInfo.h
+++ b/lldb/tools/debugserver/source/MacOSX/ThreadInfo.h
@@ -20,6 +20,6 @@ class QoS {
   std::string printable_name;
   uint32_t enum_value;
 };
-};
+}
 
 #endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_THREADINFO_H



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


[Lldb-commits] [lldb] 79ac5bb - [LLDB] Clarifying the documentation for variable formatting wrt to qualifiers and adding a test that demonstrates this

2021-04-07 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-04-07T14:29:12-07:00
New Revision: 79ac5bbb96c46e3c6c3568a441c13aa10c087b25

URL: 
https://github.com/llvm/llvm-project/commit/79ac5bbb96c46e3c6c3568a441c13aa10c087b25
DIFF: 
https://github.com/llvm/llvm-project/commit/79ac5bbb96c46e3c6c3568a441c13aa10c087b25.diff

LOG: [LLDB] Clarifying the documentation for variable formatting wrt to 
qualifiers and adding a test that demonstrates this

When looking up user specified formatters qualifiers are removed from types 
before matching,
I have added a clarifying example to the document and added an example to a 
relevant test to demonstrate this behavior.

Differential Revision: https://reviews.llvm.org/D99827

Added: 


Modified: 
lldb/docs/use/variable.rst

lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py

lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp

Removed: 




diff  --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst
index b9bcdf57cdde..b3e4de588d5e 100644
--- a/lldb/docs/use/variable.rst
+++ b/lldb/docs/use/variable.rst
@@ -131,6 +131,20 @@ which provides the desired output:
(C) c = {0x03 0x00 0x00 0x00}
(D) d = 4
 
+Note, that qualifiers such as const and volatile will be stripped when 
matching types for example:
+
+::
+
+   (lldb) frame var x y z
+   (int) x = 1
+   (const int) y = 2
+   (volatile int) z = 4
+   (lldb) type format add -f hex int
+   (lldb) frame var x y z
+   (int) x = 0x0001
+   (const int) y = 0x0002
+   (volatile int) z = 0x0004
+
 Two additional options that you will want to look at are --skip-pointers (-p)
 and --skip-references (-r). These two options prevent LLDB from applying a
 format for type T to values of type T* and T& respectively.

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
index d29547bb6050..42b31a10fb2c 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
@@ -244,6 +244,12 @@ def cleanup():
 self.expect("frame variable a_simple_object", matching=True,
 substrs=['x=0x0003'])
 
+self.expect_var_path("constInt", value='0x002a')
+
+self.expect_var_path("volatileInt", value='0x002b')
+
+self.expect_var_path("constVolatileInt", value='0x002c')
+
 # check that we can correctly cap the number of children shown
 self.runCmd("settings set target.max-children-count 5")
 

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp 
b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
index ac13113da427..857e2493e1a2 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
@@ -128,6 +128,9 @@ int main (int argc, const char * argv[])
 {
 
 int iAmInt = 9;
+const int constInt = 42;
+volatile int volatileInt = 43;
+const volatile int constVolatileInt = 44;
 
 i_am_cool cool_boy(1,0.5,3);
 i_am_cooler cooler_boy(1,2,0.1,0.2,'A','B');



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


[Lldb-commits] [lldb] d9c9c0b - [LLDB][NFC] Add clarifying comments for AddCXXSummary and AddCXXSynthetic

2021-04-09 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-04-09T12:07:24-07:00
New Revision: d9c9c0b2db0dc4ddf407edcafba0a5a806850ddc

URL: 
https://github.com/llvm/llvm-project/commit/d9c9c0b2db0dc4ddf407edcafba0a5a806850ddc
DIFF: 
https://github.com/llvm/llvm-project/commit/d9c9c0b2db0dc4ddf407edcafba0a5a806850ddc.diff

LOG: [LLDB][NFC] Add clarifying comments for AddCXXSummary and AddCXXSynthetic

Adding comments to AddCXXSynthetic and AddCXXSummary to better explain what 
they are doing.

Added: 


Modified: 
lldb/include/lldb/DataFormatters/FormattersHelpers.h

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/FormattersHelpers.h 
b/lldb/include/lldb/DataFormatters/FormattersHelpers.h
index a5b0da57e5d8b..892807063b9ce 100644
--- a/lldb/include/lldb/DataFormatters/FormattersHelpers.h
+++ b/lldb/include/lldb/DataFormatters/FormattersHelpers.h
@@ -36,11 +36,13 @@ void AddOneLineSummary(TypeCategoryImpl::SharedPointer 
category_sp,
ConstString type_name, TypeSummaryImpl::Flags flags,
bool regex = false);
 
+/// Add a summary that is implemented by a C++ callback.
 void AddCXXSummary(TypeCategoryImpl::SharedPointer category_sp,
CXXFunctionSummaryFormat::Callback funct,
const char *description, ConstString type_name,
TypeSummaryImpl::Flags flags, bool regex = false);
 
+/// Add a synthetic that is implemented by a C++ callback.
 void AddCXXSynthetic(TypeCategoryImpl::SharedPointer category_sp,
  CXXSyntheticChildren::CreateFrontEndCallback generator,
  const char *description, ConstString type_name,



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


Re: [Lldb-commits] [lldb] 8a5af9e - [debugserver] Fix unintialized member variable

2021-04-13 Thread Shafik Yaghmour via lldb-commits
I might be missing something here but I think 

m_launch_flavor

Is also uninitialized. 

It looks like using in class member initialization would be a better fix for 
any case where the constructor is just a member initialization list with an 
empty body.

> On Apr 13, 2021, at 9:47 AM, Jonas Devlieghere via lldb-commits 
>  wrote:
> 
> 
> Author: Jonas Devlieghere
> Date: 2021-04-13T09:46:59-07:00
> New Revision: 8a5af9e28443ce8290388439f9e36cf2727d7761
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/8a5af9e28443ce8290388439f9e36cf2727d7761
> DIFF: 
> https://github.com/llvm/llvm-project/commit/8a5af9e28443ce8290388439f9e36cf2727d7761.diff
> 
> LOG: [debugserver] Fix unintialized member variable
> 
> Caught by ubsan (__ubsan_handle_load_invalid_value_abort) when running
> the unit tests.
> 
> Added: 
> 
> 
> Modified: 
>lldb/tools/debugserver/source/RNBContext.h
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/tools/debugserver/source/RNBContext.h 
> b/lldb/tools/debugserver/source/RNBContext.h
> index 0b46151e47857..03cd7f350e63b 100644
> --- a/lldb/tools/debugserver/source/RNBContext.h
> +++ b/lldb/tools/debugserver/source/RNBContext.h
> @@ -46,7 +46,8 @@ class RNBContext {
>   RNBContext()
>   : m_pid(INVALID_NUB_PROCESS), m_pid_stop_count(0),
> m_events(0, all_event_bits), m_pid_pthread(), m_launch_status(),
> -m_arg_vec(), m_env_vec(), m_detach_on_error(false) {}
> +m_arg_vec(), m_env_vec(), m_detach_on_error(false),
> +m_unmask_signals(false) {}
> 
>   virtual ~RNBContext();
> 
> @@ -148,11 +149,11 @@ class RNBContext {
>   std::string m_working_directory;
>   std::string m_process_event;
>   bool m_detach_on_error;
> +  bool m_unmask_signals;
> 
>   void StartProcessStatusThread();
>   void StopProcessStatusThread();
>   static void *ThreadFunctionProcessStatus(void *arg);
> -  bool m_unmask_signals;
> 
> private:
>   RNBContext(const RNBContext &rhs) = delete;
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] ebee457 - [LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on crash reports

2021-04-14 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-04-14T16:28:38-07:00
New Revision: ebee45713190d9844ef860bf491035e3dcf3a538

URL: 
https://github.com/llvm/llvm-project/commit/ebee45713190d9844ef860bf491035e3dcf3a538
DIFF: 
https://github.com/llvm/llvm-project/commit/ebee45713190d9844ef860bf491035e3dcf3a538.diff

LOG: [LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on 
crash reports

We have seen several crashes in LibCppStdFunctionCallableInfo(...) but we don't 
have a
reproducer. The last crash pointed to last call to line_entry_helper(...) and 
symbol
was a nullptr. So adding a check for this case.

Added: 


Modified: 
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index 02d9bff9eee3..ff2c064ee388 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -322,6 +322,9 @@ CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(
 }
   }
 
+  if (symbol == nullptr)
+return optional_info;
+
   // Case 1 or 3
   if (scl.GetSize() >= 1) {
 optional_info = line_entry_helper(target, scl[0], symbol,



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


Re: [Lldb-commits] [lldb] cd64273 - [lldb/ELF] Fix IDs of synthetic eh_frame symbols

2021-04-21 Thread Shafik Yaghmour via lldb-commits
Having side effects in the argument to a function call just feels like a bad 
idea in general even if it seems obviously correct here e.g. 

  ++last_symbol_id,

Can’t we just do:

  uint64_t last_symbol_id =
  num_symbols ? symbol_table->SymbolAtIndex(num_symbols - 1)->GetID() + 1: 
1;

Thank you

> On Apr 21, 2021, at 2:25 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> 
> Author: Pavel Labath
> Date: 2021-04-21T11:24:43+02:00
> New Revision: cd64273f5ed39ec697ff1e20a1fe25ebd3502629
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/cd64273f5ed39ec697ff1e20a1fe25ebd3502629
> DIFF: 
> https://github.com/llvm/llvm-project/commit/cd64273f5ed39ec697ff1e20a1fe25ebd3502629.diff
> 
> LOG: [lldb/ELF] Fix IDs of synthetic eh_frame symbols
> 
> The code used the total number of symbols to create a symbol ID for the
> synthetic symbols. This is not correct because the IDs of real symbols
> can be higher than their total number, as we do not add all symbols (and
> in particular, we never add symbol zero, which is not a real symbol).
> 
> This meant we could have symbols with duplicate IDs, which caused
> problems if some relocations were referring to the duplicated IDs. This
> was the cause of the failure of the test D97786.
> 
> This patch fixes the code to use the ID of the highest (last) symbol
> instead.
> 
> Added: 
>lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
> 
> Modified: 
>lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
> b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> index f30ed427f8535..6e94ab97992a1 100644
> --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> @@ -2901,8 +2901,11 @@ void ObjectFileELF::ParseUnwindSymbols(Symtab 
> *symbol_table,
>   // recalculate the index first.
>   std::vector new_symbols;
> 
> -  eh_frame->ForEachFDEEntries([this, symbol_table, section_list, 
> &new_symbols](
> -  lldb::addr_t file_addr, uint32_t size, dw_offset_t) {
> +  size_t num_symbols = symbol_table->GetNumSymbols();
> +  uint64_t last_symbol_id =
> +  num_symbols ? symbol_table->SymbolAtIndex(num_symbols - 1)->GetID() : 
> 0;
> +  eh_frame->ForEachFDEEntries([&](lldb::addr_t file_addr, uint32_t size,
> +  dw_offset_t) {
> Symbol *symbol = symbol_table->FindSymbolAtFileAddress(file_addr);
> if (symbol) {
>   if (!symbol->GetByteSizeIsValid()) {
> @@ -2915,21 +2918,20 @@ void ObjectFileELF::ParseUnwindSymbols(Symtab 
> *symbol_table,
>   if (section_sp) {
> addr_t offset = file_addr - section_sp->GetFileAddress();
> const char *symbol_name = GetNextSyntheticSymbolName().GetCString();
> -uint64_t symbol_id = symbol_table->GetNumSymbols();
> Symbol eh_symbol(
> -symbol_id,   // Symbol table index.
> -symbol_name, // Symbol name.
> -eSymbolTypeCode, // Type of this symbol.
> -true,// Is this globally visible?
> -false,   // Is this symbol debug info?
> -false,   // Is this symbol a trampoline?
> -true,// Is this symbol artificial?
> -section_sp,  // Section in which this symbol is defined or 
> null.
> -offset,  // Offset in section or symbol value.
> -0, // Size:  Don't specify the size as an FDE can
> -false, // Size is valid: cover multiple symbols.
> -false, // Contains linker annotations?
> -0);// Symbol flags.
> +++last_symbol_id, // Symbol table index.
> +symbol_name,  // Symbol name.
> +eSymbolTypeCode,  // Type of this symbol.
> +true, // Is this globally visible?
> +false,// Is this symbol debug info?
> +false,// Is this symbol a trampoline?
> +true, // Is this symbol artificial?
> +section_sp, // Section in which this symbol is defined or null.
> +offset, // Offset in section or symbol value.
> +0,  // Size:  Don't specify the size as an FDE 
> can
> +false,  // Size is valid: cover multiple symbols.
> +false,  // Contains linker annotations?
> +0); // Symbol flags.
> new_symbols.push_back(eh_symbol);
>   }
> }
> 
> diff  --git a/lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml 
> b/lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
> new file mode 100644
> index 0..6178a45de1b59
> --- /dev/null
> +++ b/lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
> @@ -0,0 +1,32 @@
> +# RUN: yaml2obj %s >%t
> +# RUN: %lldb %t -o "image dump 

Re: [Lldb-commits] [lldb] 30fcdf0 - [lldb/Symbol] Update SymbolFilePDB unitest with SourceLocationSpec

2021-05-05 Thread Shafik Yaghmour via lldb-commits
The last 

location_spec

On line 341 does not seem to be used.

> On May 4, 2021, at 5:34 PM, Med Ismail Bennani via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> 
> 
> Author: Med Ismail Bennani
> Date: 2021-05-05T00:34:44Z
> New Revision: 30fcdf0b19661ca77767bd41ceba03f5dd33
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/30fcdf0b19661ca77767bd41ceba03f5dd33
>  
> 
> DIFF: 
> https://github.com/llvm/llvm-project/commit/30fcdf0b19661ca77767bd41ceba03f5dd33.diff
>  
> 
> 
> LOG: [lldb/Symbol] Update SymbolFilePDB unitest with SourceLocationSpec
> 
> This patch should fix the windows test failure following `3e2ed7440569`.
> 
> It makes use of a `SourceLocationSpec` object  when resolving a symbol
> context from `SymbolFilePDB` file.
> 
> Signed-off-by: Med Ismail Bennani  >
> 
> Added: 
> 
> 
> Modified: 
>lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp 
> b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> index 63bb6b7c40436..f9df3ced747d4 100644
> --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
> @@ -171,8 +171,9 @@ TEST_F(SymbolFilePDBTests, 
> TestResolveSymbolContextBasename) {
> 
>   FileSpec header_spec("test-pdb.cpp");
>   SymbolContextList sc_list;
> +  SourceLocationSpec location_spec(header_spec, /*line=*/0);
>   uint32_t result_count = symfile->ResolveSymbolContext(
> -  header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
> +  location_spec, lldb::eSymbolContextCompUnit, sc_list);
>   EXPECT_EQ(1u, result_count);
>   EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
> }
> @@ -190,8 +191,9 @@ TEST_F(SymbolFilePDBTests, 
> TestResolveSymbolContextFullPath) {
>   FileSpec header_spec(
>   
> R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec");
>   SymbolContextList sc_list;
> +  SourceLocationSpec location_spec(header_spec, /*line=*/0);
>   uint32_t result_count = symfile->ResolveSymbolContext(
> -  header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
> +  location_spec, lldb::eSymbolContextCompUnit, sc_list);
>   EXPECT_GE(1u, result_count);
>   EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
> }
> @@ -214,8 +216,10 @@ TEST_F(SymbolFilePDBTests, 
> TestLookupOfHeaderFileWithInlines) {
>   FileSpec alt_cpp_spec("test-pdb-alt.cpp");
>   for (const auto &hspec : header_specs) {
> SymbolContextList sc_list;
> +SourceLocationSpec location_spec(hspec, /*line=*/0, 
> /*column=*/llvm::None,
> + /*check_inlines=*/true);
> uint32_t result_count = symfile->ResolveSymbolContext(
> -hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list);
> +location_spec, lldb::eSymbolContextCompUnit, sc_list);
> EXPECT_EQ(2u, result_count);
> EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec));
> EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec));
> @@ -238,8 +242,9 @@ TEST_F(SymbolFilePDBTests, 
> TestLookupOfHeaderFileWithNoInlines) {
>  FileSpec("test-pdb-nested.h")};
>   for (const auto &hspec : header_specs) {
> SymbolContextList sc_list;
> +SourceLocationSpec location_spec(hspec, /*line=*/0);
> uint32_t result_count = symfile->ResolveSymbolContext(
> -hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
> +location_spec, lldb::eSymbolContextCompUnit, sc_list);
> EXPECT_EQ(0u, result_count);
>   }
> }
> @@ -264,8 +269,9 @@ TEST_F(SymbolFilePDBTests, TestLineTablesMatchAll) {
>   lldb::SymbolContextItem scope =
>   lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
> 
> -  uint32_t count =
> -  symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list);
> +  SourceLocationSpec location_spec(
> +  source_file, /*line=*/0, /*column=*/llvm::None, 
> /*check_inlines=*/true);
> +  uint32_t count = symfile->ResolveSymbolContext(location_spec, scope, 
> sc_list);
>   EXPECT_EQ(1u, count);
>   SymbolContext sc;
>   EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
> @@ -314,8 +320,9 @@ TEST_F(SymbolFilePDBTests, TestLineTablesMatchSpecific) {
>   lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
> 
>   // First test with line 7, and verify that only line 7 entries are added.
> -  uint32_t count =
> -  symfile->ResolveSymbolContext(source_file, 7, true, scope, sc_list);
> +  SourceLocationSpec location_spec(
> +  source_file, /*line=*/7, /*column=*/llvm::None, 
> /*check_inlines=*/true);
> +  uint32_t count = symfile->ResolveSymbolContext(locat

Re: [Lldb-commits] [lldb] 30fcdf0 - [lldb/Symbol] Update SymbolFilePDB unitest with SourceLocationSpec

2021-05-05 Thread Shafik Yaghmour via lldb-commits
Apologies, I see now you fixed it in a separate commit.

> On May 5, 2021, at 10:19 AM, Shafik Yaghmour via lldb-commits 
>  wrote:
> 
> The last 
> 
> location_spec
> 
> On line 341 does not seem to be used.
> 
>> On May 4, 2021, at 5:34 PM, Med Ismail Bennani via lldb-commits 
>> mailto:lldb-commits@lists.llvm.org>> wrote:
>> 
>> 
>> Author: Med Ismail Bennani
>> Date: 2021-05-05T00:34:44Z
>> New Revision: 30fcdf0b19661ca77767bd41ceba03f5dd33
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/30fcdf0b19661ca77767bd41ceba03f5dd33
>>  
>> <https://github.com/llvm/llvm-project/commit/30fcdf0b19661ca77767bd41ceba03f5dd33>
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/30fcdf0b19661ca77767bd41ceba03f5dd33.diff
>>  
>> <https://github.com/llvm/llvm-project/commit/30fcdf0b19661ca77767bd41ceba03f5dd33.diff>
>> 
>> LOG: [lldb/Symbol] Update SymbolFilePDB unitest with SourceLocationSpec
>> 
>> This patch should fix the windows test failure following `3e2ed7440569`.
>> 
>> It makes use of a `SourceLocationSpec` object  when resolving a symbol
>> context from `SymbolFilePDB` file.
>> 
>> Signed-off-by: Med Ismail Bennani > <mailto:medismail.benn...@gmail.com>>
>> 
>> Added: 
>> 
>> 
>> Modified: 
>>lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>> 
>> Removed: 
>> 
>> 
>> 
>> 
>> diff  --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp 
>> b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>> index 63bb6b7c40436..f9df3ced747d4 100644
>> --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>> +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
>> @@ -171,8 +171,9 @@ TEST_F(SymbolFilePDBTests, 
>> TestResolveSymbolContextBasename) {
>> 
>>   FileSpec header_spec("test-pdb.cpp");
>>   SymbolContextList sc_list;
>> +  SourceLocationSpec location_spec(header_spec, /*line=*/0);
>>   uint32_t result_count = symfile->ResolveSymbolContext(
>> -  header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
>> +  location_spec, lldb::eSymbolContextCompUnit, sc_list);
>>   EXPECT_EQ(1u, result_count);
>>   EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
>> }
>> @@ -190,8 +191,9 @@ TEST_F(SymbolFilePDBTests, 
>> TestResolveSymbolContextFullPath) {
>>   FileSpec header_spec(
>>   
>> R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec");
>>   SymbolContextList sc_list;
>> +  SourceLocationSpec location_spec(header_spec, /*line=*/0);
>>   uint32_t result_count = symfile->ResolveSymbolContext(
>> -  header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
>> +  location_spec, lldb::eSymbolContextCompUnit, sc_list);
>>   EXPECT_GE(1u, result_count);
>>   EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
>> }
>> @@ -214,8 +216,10 @@ TEST_F(SymbolFilePDBTests, 
>> TestLookupOfHeaderFileWithInlines) {
>>   FileSpec alt_cpp_spec("test-pdb-alt.cpp");
>>   for (const auto &hspec : header_specs) {
>> SymbolContextList sc_list;
>> +SourceLocationSpec location_spec(hspec, /*line=*/0, 
>> /*column=*/llvm::None,
>> + /*check_inlines=*/true);
>> uint32_t result_count = symfile->ResolveSymbolContext(
>> -hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list);
>> +location_spec, lldb::eSymbolContextCompUnit, sc_list);
>> EXPECT_EQ(2u, result_count);
>> EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec));
>> EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec));
>> @@ -238,8 +242,9 @@ TEST_F(SymbolFilePDBTests, 
>> TestLookupOfHeaderFileWithNoInlines) {
>>  FileSpec("test-pdb-nested.h")};
>>   for (const auto &hspec : header_specs) {
>> SymbolContextList sc_list;
>> +SourceLocationSpec location_spec(hspec, /*line=*/0);
>> uint32_t result_count = symfile->ResolveSymbolContext(
>> -hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
>> +location_spec, lldb::eSymbolContextCompUnit, sc_list);
>> EXPECT_EQ(0u, result_count);
>>   }
>> }
>> @@ -264,8 +269,9 @@ TEST_F(SymbolFilePDBTests, TestLineTablesMatchAll) {
>>   lldb::SymbolContextItem scope =
>>   lldb::eSymbolContextCompUnit | lldb::eSymbolCont

[Lldb-commits] [lldb] 2182eda - [LLDB] Switch from using member_clang_type.GetByteSize() to member_type->GetByteSize() in ParseSingleMember

2021-05-17 Thread Shafik Yaghmour via lldb-commits

Author: Shafik Yaghmour
Date: 2021-05-17T10:36:35-07:00
New Revision: 2182eda3062471e2e6994307c46ffcca7e39ecff

URL: 
https://github.com/llvm/llvm-project/commit/2182eda3062471e2e6994307c46ffcca7e39ecff
DIFF: 
https://github.com/llvm/llvm-project/commit/2182eda3062471e2e6994307c46ffcca7e39ecff.diff

LOG: [LLDB] Switch from using member_clang_type.GetByteSize() to 
member_type->GetByteSize() in ParseSingleMember

We have a bug in which using member_clang_type.GetByteSize() triggers record
layout and during this process since the record was not yet complete we ended
up reaching a record that had not been layed out yet.
Using member_type->GetByteSize() avoids this situation since it relies on size
from DWARF and will not trigger record layout.

For reference: rdar://77293040

Differential Revision: https://reviews.llvm.org/D102445

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 55fd5897c370..744be00a9992 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2671,7 +2671,7 @@ void DWARFASTParserClang::ParseSingleMember(
   last_field_info.bit_offset = field_bit_offset;
 
   if (llvm::Optional clang_type_size =
-  member_clang_type.GetByteSize(nullptr)) {
+  member_type->GetByteSize(nullptr)) {
 last_field_info.bit_size = *clang_type_size * character_width;
   }
 



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


Re: [Lldb-commits] [lldb] d017d12 - [lldb][NFC] Cleanup IRForTarget member initializers

2021-05-18 Thread Shafik Yaghmour via lldb-commits
If you are doing further clean-up here, it almost looks like those two 
reference members could actually be owned by IRForTarget i.e.

  m_execution_unit
  m_error_stream

Which would be cleaner. 

> On May 18, 2021, at 1:49 AM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> 
> Author: Raphael Isemann
> Date: 2021-05-18T10:49:11+02:00
> New Revision: d017d12f126ee9045f58f9300078d805e3bcc763
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/d017d12f126ee9045f58f9300078d805e3bcc763
> DIFF: 
> https://github.com/llvm/llvm-project/commit/d017d12f126ee9045f58f9300078d805e3bcc763.diff
> 
> LOG: [lldb][NFC] Cleanup IRForTarget member initializers
> 
> Note that the FunctionCallee members aren't pointer, so the nullptr was just
> an alternative way to call the default constructor.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
>lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp 
> b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
> index b35bf07034bdc..0173c8f263a5b 100644
> --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
> +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
> @@ -73,12 +73,8 @@ 
> IRForTarget::IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map,
>  lldb_private::Stream &error_stream,
>  const char *func_name)
> : ModulePass(ID), m_resolve_vars(resolve_vars), m_func_name(func_name),
> -  m_module(nullptr), m_decl_map(decl_map),
> -  m_CFStringCreateWithBytes(nullptr), m_sel_registerName(nullptr),
> -  m_objc_getClass(nullptr), m_intptr_ty(nullptr),
> -  m_error_stream(error_stream), m_execution_unit(execution_unit),
> -  m_result_store(nullptr), m_result_is_pointer(false),
> -  m_reloc_placeholder(nullptr),
> +  m_decl_map(decl_map), m_error_stream(error_stream),
> +  m_execution_unit(execution_unit),
>   m_entry_instruction_finder(FindEntryInstruction) {}
> 
> /* Handy utility functions used at several places in the code */
> 
> diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h 
> b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
> index ebfc0cae626cb..6ff50ec5f645c 100644
> --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
> +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
> @@ -419,51 +419,46 @@ class IRForTarget : public llvm::ModulePass {
>   /// True on success; false otherwise
>   bool ReplaceVariables(llvm::Function &llvm_function);
> 
> -  /// Flags
> -  bool m_resolve_vars; ///< True if external variable references and 
> persistent
> -   ///variable references should be resolved
> -  lldb_private::ConstString
> -  m_func_name; ///< The name of the function to translate
> -  lldb_private::ConstString
> -  m_result_name; ///< The name of the result variable ($0, $1, ...)
> -  lldb_private::TypeFromParser
> -  m_result_type;  ///< The type of the result variable.
> -  llvm::Module *m_module; ///< The module being processed, or NULL if that 
> has
> -  ///not been determined yet.
> -  std::unique_ptr m_target_data; ///< The target data for 
> the
> -   ///module being 
> processed, or
> -   ///NULL if there is no
> -   ///module.
> -  lldb_private::ClangExpressionDeclMap
> -  *m_decl_map; ///< The DeclMap containing the Decls
> -  llvm::FunctionCallee
> -  m_CFStringCreateWithBytes; ///< The address of the function
> - /// CFStringCreateWithBytes, cast to the
> - /// appropriate function pointer type
> -  llvm::FunctionCallee m_sel_registerName; ///< The address of the function
> -   /// sel_registerName, cast to the
> -   /// appropriate function pointer 
> type
> -  llvm::FunctionCallee m_objc_getClass; ///< The address of the function
> -/// objc_getClass, cast to the
> -/// appropriate function pointer type
> -  llvm::IntegerType
> -  *m_intptr_ty; ///< The type of an integer large enough to hold a 
> pointer.
> -  lldb_private::Stream
> -  &m_error_stream; ///< The stream on which errors should be printed
> -  lldb_private::IRExecutionUnit &
> -  m_execution_unit; ///< The execution unit containing the IR being 
> created.
> -
> -  llvm::StoreInst *m_result_store; ///< If non-NULL, the store instruction 
> that
> -   ///writes to the result variable.  If
> -   

Re: [Lldb-commits] [lldb] 4b074b4 - [lldb] Fix UB in half2float and add some more tests.

2021-05-19 Thread Shafik Yaghmour via lldb-commits
*sigh*I wish we had std::bit_cast instead of using union based type punning, we 
do have __builtin_bit_cast but it is different enough that replacing it later 
on w/ std::bit_cast wouldn’t just be search/replace.

> On May 19, 2021, at 12:37 PM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> 
> Author: Raphael Isemann
> Date: 2021-05-19T21:37:10+02:00
> New Revision: 4b074b49be206306330076b9fa40632ef1960823
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/4b074b49be206306330076b9fa40632ef1960823
> DIFF: 
> https://github.com/llvm/llvm-project/commit/4b074b49be206306330076b9fa40632ef1960823.diff
> 
> LOG: [lldb] Fix UB in half2float and add some more tests.
> 
> The added DumpDataExtractorTest uncovered that this is lshifting a negative
> integer which upsets ubsan and breaks the sanitizer bot. This patch just
> changes the variable we shift to be unsigned and adds a bunch of tests to make
> sure this function does what it promises.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Core/DumpDataExtractor.cpp
>lldb/unittests/Core/DumpDataExtractorTest.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Core/DumpDataExtractor.cpp 
> b/lldb/source/Core/DumpDataExtractor.cpp
> index ec44e3481c1e5..34c9353c9feaa 100644
> --- a/lldb/source/Core/DumpDataExtractor.cpp
> +++ b/lldb/source/Core/DumpDataExtractor.cpp
> @@ -52,7 +52,9 @@ static float half2float(uint16_t half) {
> float f;
> uint32_t u;
>   } u;
> -  int32_t v = (int16_t)half;
> +  // Sign extend to 4 byte.
> +  int32_t sign_extended = static_cast(half);
> +  uint32_t v = static_cast(sign_extended);
> 
>   if (0 == (v & 0x7c00)) {
> u.u = v & 0x80007FFFU;
> 
> diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp 
> b/lldb/unittests/Core/DumpDataExtractorTest.cpp
> index c4ec5f2e9a35b..05cd13add1e99 100644
> --- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
> +++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
> @@ -174,8 +174,30 @@ TEST(DumpDataExtractorTest, Formats) {
>"{0x 0x}");
> 
>   // See half2float for format details.
> +  // Test zeroes.
> +  TestDump(std::vector{0x, 0x8000},
> +   lldb::Format::eFormatVectorOfFloat16, "{0 -0}");
> +  // Some subnormal numbers.
> +  TestDump(std::vector{0x0001, 0x8001},
> +   lldb::Format::eFormatVectorOfFloat16, "{5.96046e-08 
> -5.96046e-08}");
> +  // A full mantisse and empty expontent.
> +  TestDump(std::vector{0x83ff, 0x03ff},
> +   lldb::Format::eFormatVectorOfFloat16, "{-6.09756e-05 
> 6.09756e-05}");
> +  // Some normal numbers.
> +  TestDump(std::vector{0b011001001000},
> +   lldb::Format::eFormatVectorOfFloat16, "{3.14062}");
>   TestDump(std::vector{0xabcd, 0x1234},
>lldb::Format::eFormatVectorOfFloat16, "{-0.0609436 0.000757217}");
> +  // Largest and smallest normal number.
> +  TestDump(std::vector{0x0400, 0x7bff},
> +   lldb::Format::eFormatVectorOfFloat16, "{6.10352e-05 65504}");
> +  // quiet/signaling NaNs.
> +  TestDump(std::vector{0x, 0xffc0, 0x7fff, 0x7fc0},
> +   lldb::Format::eFormatVectorOfFloat16, "{nan nan nan nan}");
> +  // +/-Inf.
> +  TestDump(std::vector{0xfc00, 0x7c00},
> +   lldb::Format::eFormatVectorOfFloat16, "{-inf inf}");
> +
>   TestDump(std::vector{std::numeric_limits::min(),
>   std::numeric_limits::max()},
>lldb::Format::eFormatVectorOfFloat32, "{1.17549e-38 3.40282e+38}");
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] r373229 - [lldb][NFC] Updating test to reflect made by D67966

2019-09-30 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Mon Sep 30 09:57:35 2019
New Revision: 373229

URL: http://llvm.org/viewvc/llvm-project?rev=373229&view=rev
Log:
[lldb][NFC] Updating test to reflect made by D67966

Summary:
D67966 changes the output when dumping DWARF expressions and this updates 
basic_entry_values_x86_64 test to reflect this change.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp?rev=373229&r1=373228&r2=373229&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
 Mon Sep 30 09:57:35 2019
@@ -31,7 +31,7 @@ void func1(int &sink, int x) {
   DESTROY_RSI;
 
   //% self.filecheck("image lookup -va $pc", "main.cpp", 
"-check-prefix=FUNC1-DESC")
-  // FUNC1-DESC: name = "x", type = "int", location = DW_OP_entry_value( rsi)
+  // FUNC1-DESC: name = "x", type = "int", location = 
DW_OP_entry_value(DW_OP_reg4 RSI)
 
   ++sink;
 }


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


Re: [Lldb-commits] [lldb] r373925 - ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested

2019-10-07 Thread Shafik Yaghmour via lldb-commits
Pavel,

It looks like this change breaks a couple of tests:

   http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/2315/ 


Reverting it fixes those on my end.

-Shafik

> On Oct 7, 2019, at 10:17 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> Author: labath
> Date: Mon Oct  7 10:17:53 2019
> New Revision: 373925
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=373925&view=rev
> Log:
> ProcessInstanceInfoMatch: Don't match processes with no name if a name match 
> was requested
> 
> Since D68289, a couple of tests on linux started being extremely flaky.
> All of them were doing name-based attaching and were failing because
> they couldn't find an unambiguous process to attach to.
> 
> The patch above changed the process finding logic, so that failure to
> find a process name does not constitute an error. This meant that a lot
> more transient processes showed up in the process list during the test
> suite run. Previously, these processes would not appear as they would be
> gone by the time we went to read their executable name, arguments, etc.
> 
> Now, this alone should not cause an issue were it not for the fact that
> we were considering a process with no name as if it matched by default
> (even if we were explicitly searching for a process with a specified
> name). This meant that any of the "transient" processes with no name
> would make the name match ambiguous. That clearly seems like a bug to me
> so I fix that.
> 
> Modified:
>lldb/trunk/source/Utility/ProcessInfo.cpp
>lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp
> 
> Modified: lldb/trunk/source/Utility/ProcessInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ProcessInfo.cpp?rev=373925&r1=373924&r2=373925&view=diff
> ==
> --- lldb/trunk/source/Utility/ProcessInfo.cpp (original)
> +++ lldb/trunk/source/Utility/ProcessInfo.cpp Mon Oct  7 10:17:53 2019
> @@ -244,7 +244,7 @@ void ProcessInstanceInfo::DumpAsTableRow
> }
> 
> bool ProcessInstanceInfoMatch::NameMatches(const char *process_name) const {
> -  if (m_name_match_type == NameMatch::Ignore || process_name == nullptr)
> +  if (m_name_match_type == NameMatch::Ignore)
> return true;
>   const char *match_name = m_match_info.GetName();
>   if (!match_name)
> 
> Modified: lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp?rev=373925&r1=373924&r2=373925&view=diff
> ==
> --- lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp (original)
> +++ lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp Mon Oct  7 
> 10:17:53 2019
> @@ -91,3 +91,20 @@ TEST(ProcessInstanceInfo, DumpTable_inva
> )",
>   s.GetData());
> }
> +
> +TEST(ProcessInstanceInfoMatch, Name) {
> +  ProcessInstanceInfo info_bar, info_empty;
> +  info_bar.GetExecutableFile().SetFile("/foo/bar", FileSpec::Style::posix);
> +
> +  ProcessInstanceInfoMatch match;
> +  match.SetNameMatchType(NameMatch::Equals);
> +  match.GetProcessInfo().GetExecutableFile().SetFile("bar",
> + FileSpec::Style::posix);
> +
> +  EXPECT_TRUE(match.Matches(info_bar));
> +  EXPECT_FALSE(match.Matches(info_empty));
> +
> +  match.GetProcessInfo().GetExecutableFile() = FileSpec();
> +  EXPECT_TRUE(match.Matches(info_bar));
> +  EXPECT_TRUE(match.Matches(info_empty));
> +}
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] r374077 - Revert "[platform process list] add a flag for showing the processes of all users"

2019-10-08 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Tue Oct  8 09:24:28 2019
New Revision: 374077

URL: http://llvm.org/viewvc/llvm-project?rev=374077&view=rev
Log:
Revert "[platform process list] add a flag for showing the processes of all 
users"

This reverts commit 080f35fb875f52c924ee37ed4d56a51fe7056afa.

 Conflicts:

packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py

Removed:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/Options.td

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

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py?rev=374076&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py
 (removed)
@@ -1,38 +0,0 @@
-import lldb
-import binascii
-import os
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test.decorators import *
-from gdbclientutils import *
-
-
-class TestPlatformClient(GDBRemoteTestBase):
-
-def test_process_list(self):
-"""Test connecting to a remote linux platform"""
-
-class MyResponder(MockGDBServerResponder):
-def qfProcessInfo(self, packet):
-if "all_users:1" in packet:
-return "pid:10;ppid:1;uid:2;gid:3;euid:4;egid:5;name:" + 
binascii.hexlify("/a/process") + ";args:"
-else:
-return "E04"
-
-self.server.responder = MyResponder()
-
-self.runCmd("platform select remote-linux")
-
-try:
-self.runCmd("platform connect connect://localhost:%d" %
-self.server.port)
-self.assertTrue(self.dbg.GetSelectedPlatform().IsConnected())
-self.expect("platform process list -x",
-startstr="1 matching process was found", 
endstr="process" + os.linesep)
-self.expect("platform process list -xv",
-substrs=[
-"PIDPARENT USER   GROUP  EFF USER   
EFF GROUP",
-"10 1  2  3  4  
5"])
-self.expect("platform process list",
-error="error: no processes were found on the 
\"remote-linux\" platform")
-finally:
-self.runCmd("platform disconnect")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py?rev=374077&r1=374076&r2=374077&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
 Tue Oct  8 09:24:28 2019
@@ -160,34 +160,9 @@ class MockGDBServerResponder:
 return self.QListThreadsInStopReply()
 if packet.startswith("qMemoryRegionInfo:"):
 return self.qMemoryRegionInfo()
-if packet == "qQueryGDBServer":
-return self.qQueryGDBServer()
-if packet == "qHostInfo":
-return self.qHostInfo()
-if packet == "qGetWorkingDir":
-return self.qGetWorkingDir()
-if packet == "qsProcessInfo":
-return self.qsProcessInfo()
-if packet.startswith("qfProcessInfo"):
-return self.qfProcessInfo(packet)
 
 return self.other(packet)
 
-def qsProcessInfo(self):
-return "E04"
-
-def qfProcessInfo(self, packet):
-raise "E04"
-
-def qGetWorkingDir(self):
-return "2f"
-
-def qHostInfo(self):
-return "ptrsize:8;endian:little;"
-
-def qQueryGDBServer(self):
-return "E04"
-
 def interrupt(self):
 raise self.UnexpectedPacketException()
 
@@ -196,7 +171,7 @@ class MockGDBServerResponder:
 
 def vCont(self, packet):
 raise self.UnexpectedPacketException()
-
+
 def readRegisters(self):
 return "" * self.registerCount
 
@@ -450,6 +425,7 @@ class MockGDBServer:
 class InvalidPacketException(Exception):
 pass
 
+
 class GDBRemoteTestBase(TestBase):
 """
 Base class for GDB client tests.

Modified: lldb/trunk/source/

[Lldb-commits] [lldb] r374570 - [lldb-test] Modify lldb-test to print out ASTs from symbol file

2019-10-11 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Oct 11 09:36:20 2019
New Revision: 374570

URL: http://llvm.org/viewvc/llvm-project?rev=374570&view=rev
Log:
[lldb-test] Modify lldb-test to print out ASTs from symbol file

Summary:
Currently when invoking lldb-test symbols -dump-ast it parses all the debug 
symbols and calls print(...) on the TranslationUnitDecl.
While useful the TranslationUnitDecl::print(...) method gives us a higher level 
view then the dump from ASTDumper which is what we get when we invoke dump() on 
a specific AST node.
The main motivation for this change is allow us to verify that the AST nodes we 
create when we parse DWARF. For example in order to verify we are correctly 
using DIFlagExportSymbols added by D7

Differential Revision: https://reviews.llvm.org/D67994

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=374570&r1=374569&r2=374570&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Oct 11 09:36:20 2019
@@ -886,6 +886,14 @@ public:
 
   void Dump(Stream &s);
 
+  /// Dump clang AST types from the symbol file.
+  ///
+  /// \param[in] s
+  ///   A stream to send the dumped AST node(s) to
+  /// \param[in] symbol_name
+  ///   The name of the symbol to dump, if it is empty dump all the symbols
+  void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name);
+
   void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
  Stream *s, lldb::Format format, const DataExtractor &data,
  lldb::offset_t data_offset, size_t data_byte_size,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=374570&r1=374569&r2=374570&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 11 
09:36:20 2019
@@ -3024,12 +3024,21 @@ size_t SymbolFileDWARF::ParseTypes(const
bool parse_siblings, bool parse_children) {
   size_t types_added = 0;
   DWARFDIE die = orig_die;
+
   while (die) {
+const dw_tag_t tag = die.Tag();
 bool type_is_new = false;
-if (ParseType(sc, die, &type_is_new).get()) {
-  if (type_is_new)
-++types_added;
-}
+
+Tag dwarf_tag = static_cast(tag);
+
+// TODO: Currently ParseTypeFromDWARF(...) which is called by 
ParseType(...)
+// does not handle DW_TAG_subrange_type. It is not clear if this is a bug 
or
+// not.
+if (isType(dwarf_tag) && tag != DW_TAG_subrange_type)
+  ParseType(sc, die, &type_is_new);
+
+if (type_is_new)
+  ++types_added;
 
 if (parse_children && die.HasChildren()) {
   if (die.Tag() == DW_TAG_subprogram) {

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=374570&r1=374569&r2=374570&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 11 09:36:20 2019
@@ -8973,6 +8973,39 @@ void ClangASTContext::Dump(Stream &s) {
   tu->dump(s.AsRawOstream());
 }
 
+void ClangASTContext::DumpFromSymbolFile(Stream &s,
+ llvm::StringRef symbol_name) {
+  SymbolFile *symfile = GetSymbolFile();
+
+  if (!symfile)
+return;
+
+  lldb_private::TypeList type_list;
+  symfile->GetTypes(nullptr, eTypeClassAny, type_list);
+  size_t ntypes = type_list.GetSize();
+
+  for (size_t i = 0; i < ntypes; ++i) {
+TypeSP type = type_list.GetTypeAtIndex(i);
+
+if (!symbol_name.empty())
+  if (symbol_name.compare(type->GetName().GetStringRef()) != 0)
+continue;
+
+s << type->GetName().AsCString() << "\n";
+
+if (clang::TagDecl *tag_decl =
+ GetAsTagDecl(type->GetFullCompilerType()))
+  tag_decl->dump(s.AsRawOstream());
+else if (clang::TypedefNameDecl *typedef_decl =
+ GetAsTypedefDecl(type->GetFullCompilerType()))
+  typedef_decl->dump(s.AsRawOstream());
+else {
+  GetCanonicalQualType(type->GetFullCompilerType().GetOpaqueQualType())
+  .dump(s.AsRawOstream());
+}
+  }
+}
+
 void ClangASTContext::DumpValue(
 lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s,
 l

Re: [Lldb-commits] [PATCH] D68961: Add support for DW_AT_export_symbols for anonymous structs

2019-10-29 Thread Shafik Yaghmour via lldb-commits
Stella,

Thank you for the heads up, I am looking at it now.

-Shafik

> On Oct 29, 2019, at 11:04 AM, Stella Stamenova via Phabricator 
>  wrote:
> 
> stella.stamenova added a comment.
> 
> This is broken on Windows. I moved the Buildbot to staging to resolve some of 
> the issues with the move to the monorepo, so you can see the failures here:
> 
> http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/0/steps/test/logs/stdio
> 
> 
> Repository:
>  rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D68961/new/
> 
> https://reviews.llvm.org/D68961
> 
> 
> 

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


Re: [Lldb-commits] [lldb] 6e3ecd1 - [lldb] Fix dwo variant of TestLibCxxFunction

2019-11-14 Thread Shafik Yaghmour via lldb-commits
Pavel,

Thank you for fixing this! 

> On Nov 14, 2019, at 7:30 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> 
> Author: Pavel Labath
> Date: 2019-11-14T16:29:36+01:00
> New Revision: 6e3ecd18847cb5c5bbe41d23428e1aa57ed1b339
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/6e3ecd18847cb5c5bbe41d23428e1aa57ed1b339
> DIFF: 
> https://github.com/llvm/llvm-project/commit/6e3ecd18847cb5c5bbe41d23428e1aa57ed1b339.diff
> 
> LOG: [lldb] Fix dwo variant of TestLibCxxFunction
> 
> The test was failing due to a bug in SymbolFileDWARF::FindFunctions --
> the function was searching the main dwarf unit for DW_TAG_subprograms,
> but the main unit is empty in case of split dwarf.  The fix is simple --
> search the non-skeleton unit instead.
> 
> This bug went unnoticed because this function is expensive, and so one
> generally avoids calling it.
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
> b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
> index c0c10b21a747..10296527a114 100644
> --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
> +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
> @@ -839,7 +839,8 @@ size_t SymbolFileDWARF::ParseFunctions(CompileUnit 
> &comp_unit) {
> 
>   size_t functions_added = 0;
>   std::vector function_dies;
> -  dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies);
> +  dwarf_cu->GetNonSkeletonUnit().AppendDIEsWithTag(DW_TAG_subprogram,
> +function_dies);
>   for (const DWARFDIE &die : function_dies) {
> if (comp_unit.FindFunctionByUID(die.GetID()))
>   continue;
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] r367701 - [Formatters] Temporarily disable libc++ std::function formatter due to performance issue

2019-08-02 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Aug  2 11:16:04 2019
New Revision: 367701

URL: http://llvm.org/viewvc/llvm-project?rev=367701&view=rev
Log:
[Formatters] Temporarily disable libc++ std::function formatter due to 
performance issue

Summary: We have been seeing increased reports of performance issue around 
large project and formatting std::function variables especially in functions 
signatures in back traces. There are some possible fixes but exploring those 
fixes may take time and it is better to temporarily disable the formatter due 
to its impact and re-enable it once we have a fix.

Differential Revision: https://reviews.llvm.org/D65666

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py?rev=367701&r1=367700&r2=367701&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
 Fri Aug  2 11:16:04 2019
@@ -21,6 +21,9 @@ class LibCxxFunctionTestCase(TestBase):
 var.SetPreferSyntheticValue(True)
 return var
 
+# Temporarily skipping for everywhere b/c we are disabling the 
std::function formatter
+# due to performance issues but plan on turning it back on once they are 
addressed.
+@skipIf
 @add_test_categories(["libc++"])
 def test(self):
 """Test that std::function as defined by libc++ is correctly printed 
by LLDB"""

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=367701&r1=367700&r2=367701&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Fri Aug  
2 11:16:04 2019
@@ -566,12 +566,6 @@ static void LoadLibCxxFormatters(lldb::T
   ConstString("^(std::__[[:alnum:]]+::)weak_ptr<.+>(( )?&)?$"),
   stl_synth_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::LibcxxFunctionSummaryProvider,
-  "libc++ std::function summary provider",
-  ConstString("^std::__[[:alnum:]]+::function<.+>$"), stl_summary_flags,
-  true);
-
   stl_summary_flags.SetDontShowChildren(false);
   stl_summary_flags.SetSkipPointers(false);
   AddCXXSummary(cpp_category_sp,


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


[Lldb-commits] [lldb] r367726 - Fix ClangASTContext::CreateParameterDeclaration to not call addDecl

2019-08-02 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri Aug  2 14:41:50 2019
New Revision: 367726

URL: http://llvm.org/viewvc/llvm-project?rev=367726&view=rev
Log:
Fix ClangASTContext::CreateParameterDeclaration to not call addDecl

Summary:
The change https://reviews.llvm.org/D55575 modified 
ClangASTContext::CreateParameterDeclaration to call decl_ctx->addDecl(decl); 
this caused a regression since the existing code in 
DWARFASTParserClang::ParseChildParameters is called with the containing 
DeclContext. So when end up with cases where we are parsing a parameter for a 
member function and the parameter is added to the CXXRecordDecl as opposed to 
the CXXMethodDecl. This example is given in the regression test 
TestBreakpointInMemberFuncWNonPrimitiveParams.py which without this fix in a 
modules build leads to assert on setting a breakpoint in a member function with 
non primitive parameters. This scenario would be common when debugging LLDB or 
clang.

Differential Revision: https://reviews.llvm.org/D65414

Added:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/a.cpp

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/a.h

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/module.modulemap
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=367726&r1=367725&r2=367726&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Aug  2 14:41:50 2019
@@ -395,7 +395,8 @@ public:
   clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
  const char *name,
  const CompilerType 
¶m_type,
- int storage);
+ int storage,
+ bool add_decl=false);
 
   void SetFunctionParameters(clang::FunctionDecl *function_decl,
  clang::ParmVarDecl **params, unsigned num_params);

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/Makefile?rev=367726&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/Makefile
 Fri Aug  2 14:41:50 2019
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+CXX_SOURCES = main.cpp a.cpp
+CFLAGS_EXTRAS = $(MANDATORY_CXXMODULE_BUILD_CFLAGS)
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py?rev=367726&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
 Fri Aug  2 14:41:50 2019
@@ -0,0 +1,26 @@
+"""
+This is a regression test for an assert that happens while setting a 
breakpoint.
+The root cause of the assert was attempting to add a ParmVarDecl to a 
CXXRecordDecl
+when it should have been added to a CXXMethodDecl.
+
+We can reproduce with a module build and setting a breakpoint in a member 
func

[Lldb-commits] [lldb] r368937 - Improve anonymous class heuristic in ClangASTContext::CreateRecordType

2019-08-14 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Aug 14 15:30:29 2019
New Revision: 368937

URL: http://llvm.org/viewvc/llvm-project?rev=368937&view=rev
Log:
Improve anonymous class heuristic in ClangASTContext::CreateRecordType

Summary:
Currently the heuristic used in ClangASTContext::CreateRecordType to identify 
an anonymous class is that there is that name is a nullptr or simply a null 
terminator. This heuristic is not accurate since it will also sweep up unnamed 
classes and lambdas. The improved heuristic relies on the requirement that an 
anonymous class must be contained within a class.

Differential Revision: https://reviews.llvm.org/D66175

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/main.cpp
Removed:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/main.cpp
Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py?rev=368936&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/TestCompletionCrashInLambda.py
 (removed)
@@ -1,4 +0,0 @@
-from lldbsuite.test import lldbinline
-from lldbsuite.test import decorators
-
-lldbinline.MakeInlineTest(__file__, globals(), 
[decorators.skipIf(bugnumber="rdar://53755023")])

Removed: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/main.cpp?rev=368936&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-crash-lambda/main.cpp
 (removed)
@@ -1,6 +0,0 @@
-int main() {
-  []()
-  { //%self.dbg.GetCommandInterpreter().HandleCompletion("e ", len("e "), 0, 
-1, lldb.SBStringList())
-  }
-  ();
-}

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py?rev=368937&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py
 Wed Aug 14 15:30:29 2019
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(),)

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/main.cpp?rev=368937&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion-in-lambda-and-unnnamed-class/main.cpp
 Wed Aug 14 15:30:29 2019
@@ -0,0 +1,11 @@
+int main() {
+  []()
+  { //%self.dbg.GetCommandInterpreter().HandleCompletion("e ", len("e "), 0, 
-1, lldb.SBStringList())
+  }
+  ();
+  struct {
+  void f()
+  { //%self.dbg.GetCommandInterpreter().HandleCompletion("e ", len("e "), 
0, -1, lldb.SBStringList())
+  }
+  } A;
+}

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=368937&r1=368936&r2=368937&view=diff
==
--- lldb/trunk/

Re: [Lldb-commits] [lldb] r370199 - [lldb][NFC] Test named operators like new and function names that might confuse LLDB

2019-08-28 Thread Shafik Yaghmour via lldb-commits
This test seems to be missing at least the address-of, delete and the comma 
operator in this test. Probably should cover array delete and new as well.

> On Aug 28, 2019, at 6:33 AM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> Author: teemperor
> Date: Wed Aug 28 06:33:52 2019
> New Revision: 370199
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=370199&view=rev
> Log:
> [lldb][NFC] Test named operators like new and function names that might 
> confuse LLDB
> 
> Modified:
>lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp
> 
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp?rev=370199&r1=370198&r2=370199&view=diff
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp 
> (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/operators/main.cpp Wed 
> Aug 28 06:33:52 2019
> @@ -1,5 +1,10 @@
> +#include 
> +
> struct B { int dummy = 2324; };
> struct C {
> +  void *operator new(size_t size) { C* r = ::new C; r->custom_new = true; 
> return r; }
> +
> +  bool custom_new = false;
>   B b;
>   B* operator->() { return &b; }
>   int operator->*(int) { return 2; }
> @@ -48,6 +53,11 @@ struct C {
> 
>   operator int() { return 11; }
>   operator long() { return 12; }
> +
> +  // Make sure this doesn't collide with
> +  // the real operator int.
> +  int operatorint() { return 13; }
> +  int operatornew() { return 14; }
> };
> 
> int main(int argc, char **argv) {
> @@ -99,6 +109,10 @@ int main(int argc, char **argv) {
> 
>   result += static_cast(c);
>   result += static_cast(c);
> +  result += c.operatorint();
> +  result += c.operatornew();
> +
> +  C *c2 = new C();
> 
>   //% self.expect("expr c->dummy", endstr=" 2324\n")
>   //% self.expect("expr c->*2", endstr=" 2\n")
> @@ -141,5 +155,9 @@ int main(int argc, char **argv) {
>   //% self.expect("expr c[1]", endstr=" 92\n")
>   //% self.expect("expr static_cast(c)", endstr=" 11\n")
>   //% self.expect("expr static_cast(c)", endstr=" 12\n")
> +  //% self.expect("expr c.operatorint()", endstr=" 13\n")
> +  //% self.expect("expr c.operatornew()", endstr=" 14\n")
> +  //% self.expect("expr (new C)->custom_new", endstr=" true\n")
> +  delete c2;
>   return 0;
> }
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] r370848 - [lldb][NFC] Add a simple test for thread_local storage.

2019-09-04 Thread Shafik Yaghmour via lldb-commits
It seems like it would also be useful to test that threads actually see their 
own copy as well.

> On Sep 4, 2019, at 1:02 AM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> Author: teemperor
> Date: Wed Sep  4 01:02:52 2019
> New Revision: 370848
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=370848&view=rev
> Log:
> [lldb][NFC] Add a simple test for thread_local storage.
> 
> Seems we fail to read TLS data on Linux, so the test only runs on
> macOS for now. We will see how this test runs on the BSD bots.
> 
> Added:
>lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/
>lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile
>
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
>lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp
> 
> Added: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile?rev=370848&view=auto
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile 
> (added)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/Makefile 
> Wed Sep  4 01:02:52 2019
> @@ -0,0 +1,3 @@
> +LEVEL = ../../../make
> +CXX_SOURCES := main.cpp
> +include $(LEVEL)/Makefile.rules
> 
> Added: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py?rev=370848&view=auto
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
>  (added)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py
>  Wed Sep  4 01:02:52 2019
> @@ -0,0 +1,5 @@
> +from lldbsuite.test import lldbinline
> +from lldbsuite.test import decorators
> +
> +lldbinline.MakeInlineTest(__file__, globals(),
> +  lldbinline.expectedFailureAll(oslist=["windows", 
> "linux"]))
> 
> Added: 
> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp?rev=370848&view=auto
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp 
> (added)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/thread_local/main.cpp 
> Wed Sep  4 01:02:52 2019
> @@ -0,0 +1,17 @@
> +int storage = 45;
> +thread_local int tl_global_int = 123;
> +thread_local int *tl_global_ptr = &storage;
> +
> +int main(int argc, char **argv) {
> +  //% self.expect("expr tl_local_int", error=True, substrs=["couldn't get 
> the value of variable tl_local_int"])
> +  //% self.expect("expr *tl_local_ptr", error=True, substrs=["couldn't get 
> the value of variable tl_local_ptr"])
> +  thread_local int tl_local_int = 321;
> +  thread_local int *tl_local_ptr = nullptr;
> +  tl_local_ptr = &tl_local_int;
> +  tl_local_int++;
> +  //% self.expect("expr tl_local_int + 1", substrs=["int", "= 323"])
> +  //% self.expect("expr *tl_local_ptr + 2", substrs=["int", "= 324"])
> +  //% self.expect("expr tl_global_int", substrs=["int", "= 123"])
> +  //% self.expect("expr *tl_global_ptr", substrs=["int", "= 45"])
> +  return 0;
> +}
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] r359118 - [DataFormatters] Adjusting libc++ std::list formatter to act better with pointers and references and adding a test to cover a previous related fix

2019-04-24 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed Apr 24 10:38:40 2019
New Revision: 359118

URL: http://llvm.org/viewvc/llvm-project?rev=359118&view=rev
Log:
[DataFormatters] Adjusting libc++ std::list formatter to act better with 
pointers and references and adding a test to cover a previous related fix

Summary:
This previous fix 
https://github.com/llvm-mirror/lldb/commit/5469bda296c183d1b6bf74597c88c9ed667b3145
 did not have a test since we did not have a reproducer.

This is related to how formatters deal with pointers and references. The added 
tests both the new behavior and covers the previous bug fix as well.

Differential Revision: https://reviews.llvm.org/D60588

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py?rev=359118&r1=359117&r2=359118&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
 Wed Apr 24 10:38:40 2019
@@ -162,6 +162,10 @@ class LibcxxListDataFormatterTestCase(Te
  '[2] = ', '3',
  '[3] = ', '4'])
 
+ListPtr = self.frame().FindVariable("list_ptr")
+self.assertTrue(ListPtr.GetChildAtIndex(
+0).GetValueAsUnsigned(0) == 1, "[0] = 1")
+
 # check that MightHaveChildren() gets it right
 self.assertTrue(
 self.frame().FindVariable("numbers_list").MightHaveChildren(),

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp?rev=359118&r1=359117&r2=359118&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp
 Wed Apr 24 10:38:40 2019
@@ -8,7 +8,8 @@ typedef std::list string_li
 int main()
 {
 int_list numbers_list;
-
+std::list* list_ptr = &numbers_list;
+
 printf("// Set break point at this line.");
 (numbers_list.push_back(0x12345678));
 (numbers_list.push_back(0x11223344));

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=359118&r1=359117&r2=359118&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Wed Apr 
24 10:38:40 2019
@@ -486,7 +486,7 @@ static void LoadLibCxxFormatters(lldb::T
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
   "libc++ std::list synthetic children",
-  ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_synth_flags,
+  ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_deref_flags,
   true);
   AddCXXSynthetic(
   cpp_category_sp,


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


[Lldb-commits] [lldb] r359699 - Disabling test in TestClassTemplateParameterPack.py until we do template lookup correctly

2019-05-01 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed May  1 09:39:31 2019
New Revision: 359699

URL: http://llvm.org/viewvc/llvm-project?rev=359699&view=rev
Log:
Disabling test in TestClassTemplateParameterPack.py until we do template lookup 
correctly

Summary:
Some tests currently only work because we are pulling all the local variables 
when we are evaluating an expression. This will soon
change and these test are working but for the wrong reasons. The details can be 
found in the discussion here:
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html

Differential Review:  https://reviews.llvm.org/D61266

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py?rev=359699&r1=359698&r2=359699&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
 Wed May  1 09:39:31 2019
@@ -4,6 +4,4 @@ from lldbsuite.test import decorators
 lldbinline.MakeInlineTest(
 __file__, globals(), [
 decorators.expectedFailureAll(
-compiler="gcc"),
-# rdar://problem/48128064
-decorators.skipIfDarwin])
+compiler="gcc")])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp?rev=359699&r1=359698&r2=359699&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
 Wed May  1 09:39:31 2019
@@ -42,10 +42,12 @@ int main (int argc, char const *argv[])
 (void)C().isSixteenThirtyTwo();
 (void)C().isSixteenThirtyTwo();
 (void)(myC.member != 64);   //% self.expect("expression -- myC", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
-//% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
["false"])
-//% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 //% self.expect("expression -- 
myLesserC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
["false"])
 //% self.expect("expression -- 
myC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+
+// Disabling until we do template lookup 
correctly: 
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
+//#% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = 
["false"])
+//#% self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])

 D myD;
 D myLesserD;
@@ -53,8 +55,10 @@ int main (int argc, char const *argv[])
 (void)D().isIntBool();
 (void)D().isIntBool();
 return myD.member != 64;   //% self.expect("expression -- myD", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
-//% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
-//% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 //% self.expect("expression -- 
myLesserD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
 //% self.expect("expression -- 
myD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+
+// See comment above.
+//#% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+//#% self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
 }


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


[Lldb-commits] [lldb] r359732 - Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference when loading from DWARF

2019-05-01 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Wed May  1 15:23:06 2019
New Revision: 359732

URL: http://llvm.org/viewvc/llvm-project?rev=359732&view=rev
Log:
Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference 
when loading from DWARF

Summary:
This will fix a bug where during expression parsing we are not setting a 
CXXRecordDecl to not be passed in registers and the resulting code generation 
is wrong.
The DWARF attribute DW_CC_pass_by_reference tells us that we should not be 
passing in registers i.e. RAA_Indirect.
This change depends this clang change which fixes the fact that the ASTImporter 
does not copy RecordDeclBits for CXXRecordDecl: https://reviews.llvm.org/D61140

Differential Revision: https://reviews.llvm.org/D61146

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/TestArgumentPassingRestrictions.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/Makefile?rev=359732&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/Makefile
 Wed May  1 15:23:06 2019
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/TestArgumentPassingRestrictions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/TestArgumentPassingRestrictions.py?rev=359732&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/TestArgumentPassingRestrictions.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/TestArgumentPassingRestrictions.py
 Wed May  1 15:23:06 2019
@@ -0,0 +1,32 @@
+"""
+This is a test to ensure that both lldb is reconstructing the right
+calling convention for a CXXRecordDecl as represented by:
+
+   DW_CC_pass_by_reference
+   DW_CC_pass_by_value
+
+and to also make sure that the ASTImporter is copying over this
+setting when importing the CXXRecordDecl via setArgPassingRestrictions.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestArgumentPassingRestrictions(TestBase):
+
+  mydir = TestBase.compute_mydir(__file__)
+
+  def test_argument_passing_restrictions(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp"))
+
+self.expect("expr returnPassByRef()",
+substrs=['(PassByRef)', '= 11223344'])
+
+self.expect("expr takePassByRef(p)",
+substrs=['(int)', '= 42'])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp?rev=359732&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/argument_passing_restrictions/main.cpp
 Wed May  1 15:23:06 2019
@@ -0,0 +1,19 @@
+// This structure has a non-trivial copy constructor so
+// it needs to be passed by reference.
+struct PassByRef {
+  PassByRef() = default;
+  PassByRef(const PassByRef &p){x = p.x;};
+
+  int x = 11223344;
+};
+
+PassByRef returnPassByRef() { return PassByRef(); }
+int takePassByRef(PassByRef p) {
+return p.x;
+}
+
+int main() {
+PassByRef p = returnPassByRef();
+p.x = 42;
+return takePassByRef(p); // break here
+}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=359732&r1=359731&r2=359732&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile

[Lldb-commits] [lldb] r359921 - Fix for ambiguous lookup in expressions between local variable and namespace

2019-05-03 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Fri May  3 12:59:22 2019
New Revision: 359921

URL: http://llvm.org/viewvc/llvm-project?rev=359921&view=rev
Log:
Fix for ambiguous lookup in expressions between local variable and namespace

Summary:
In an Objective-C context a local variable and namespace can cause an ambiguous 
name lookup when used in an expression. The solution involves mimicking the 
existing C++ solution which is to add local using declarations for local 
variables. This causes a different type of lookup to be used which eliminates 
the namespace during acceptable results filtering.

Differential Revision: https://reviews.llvm.org/D59960

Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/TestNamespaceLocalVarSameNameCppAndC.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_obj_c/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_obj_c/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_obj_c/TestNamespaceLocalVarSameNameObjC.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_obj_c/main.mm

lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_obj_c/util.mm
Modified:

lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/Makefile?rev=359921&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/Makefile
 Fri May  3 12:59:22 2019
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/TestNamespaceLocalVarSameNameCppAndC.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/TestNamespaceLocalVarSameNameCppAndC.py?rev=359921&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/TestNamespaceLocalVarSameNameCppAndC.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/TestNamespaceLocalVarSameNameCppAndC.py
 Fri May  3 12:59:22 2019
@@ -0,0 +1,24 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestNamespaceLocalVarSameNameCppAndC(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+@add_test_categories(["gmodules"])
+def test_namespace_local_var_same_name_cpp_and_c(self):
+self.build()
+
+(self.target, self.process, _, bkpt) = 
lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp", False))
+
+self.expect("expr error",
+substrs=['(int) $0 = 1'])
+
+lldbutil.continue_to_breakpoint(self.process, bkpt)
+
+self.expect("expr error",
+substrs=['(int) $1 = 1'])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/main.cpp?rev=359921&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/namespace_local_var_same_name_cpp_and_c/main.cpp
 Fri May  3 12:59:22 2019
@@ -0,0 +1,21 @@
+namespace error {
+  int x;
+}
+
+struct A {
+  void foo() {
+int error=1;
+
+return; // break here
+  }
+};
+
+int main() {
+ int error=1;
+
+ A a;
+
+ a.foo();
+
+ return 0; // break here
+}

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command

  1   2   >