[Lldb-commits] [PATCH] D67083: [dotest] Avoid the need for LEVEL= makefile boilerplate

2019-09-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Thanks! LGTM, but Jonas probably should also sign this off.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67083/new/

https://reviews.llvm.org/D67083



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


[Lldb-commits] [lldb] r370702 - [lldb][NFC] Remove setup boilerplate from types/ tests

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 00:33:32 2019
New Revision: 370702

URL: http://llvm.org/viewvc/llvm-project?rev=370702&view=rev
Log:
[lldb][NFC] Remove setup boilerplate from types/ tests

This code doesn't seem to be necessary anymore.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypes.py
lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypesExpr.py
lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypes.py
lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py
lldb/trunk/packages/Python/lldbsuite/test/types/TestIntegerTypes.py
lldb/trunk/packages/Python/lldbsuite/test/types/TestIntegerTypesExpr.py
lldb/trunk/packages/Python/lldbsuite/test/types/TestRecursiveTypes.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypes.py?rev=370702&r1=370701&r2=370702&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypes.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypes.py Tue Sep  
3 00:33:32 2019
@@ -17,14 +17,6 @@ class DoubleTypesTestCase(AbstractBase.G
 
 mydir = AbstractBase.GenericTester.compute_mydir(__file__)
 
-def setUp(self):
-# Call super's setUp().
-AbstractBase.GenericTester.setUp(self)
-# disable "There is a running process, kill it and restart?" prompt
-self.runCmd("settings set auto-confirm true")
-self.addTearDownHook(
-lambda: self.runCmd("settings clear auto-confirm"))
-
 def test_double_type(self):
 """Test that double-type variables are displayed correctly."""
 self.build_and_run('double.cpp', set(['double']))

Modified: lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypesExpr.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypesExpr.py?rev=370702&r1=370701&r2=370702&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypesExpr.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/types/TestDoubleTypesExpr.py Tue 
Sep  3 00:33:32 2019
@@ -21,14 +21,6 @@ class DoubleTypesExprTestCase(AbstractBa
 # test/types failures for Test*TypesExpr.py: element offset computed wrong
 # and sign error?
 
-def setUp(self):
-# Call super's setUp().
-AbstractBase.GenericTester.setUp(self)
-# disable "There is a running process, kill it and restart?" prompt
-self.runCmd("settings set auto-confirm true")
-self.addTearDownHook(
-lambda: self.runCmd("settings clear auto-confirm"))
-
 def test_double_type(self):
 """Test that double-type variable expressions are evaluated 
correctly."""
 self.build_and_run_expr('double.cpp', set(['double']))

Modified: lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypes.py?rev=370702&r1=370701&r2=370702&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypes.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypes.py Tue Sep  
3 00:33:32 2019
@@ -17,14 +17,6 @@ class FloatTypesTestCase(AbstractBase.Ge
 
 mydir = AbstractBase.GenericTester.compute_mydir(__file__)
 
-def setUp(self):
-# Call super's setUp().
-AbstractBase.GenericTester.setUp(self)
-# disable "There is a running process, kill it and restart?" prompt
-self.runCmd("settings set auto-confirm true")
-self.addTearDownHook(
-lambda: self.runCmd("settings clear auto-confirm"))
-
 def test_float_type(self):
 """Test that float-type variables are displayed correctly."""
 self.build_and_run('float.cpp', set(['float']))

Modified: lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py?rev=370702&r1=370701&r2=370702&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py Tue 
Sep  3 00:33:32 2019
@@ -21,14 +21,6 @@ class FloatTypesExprTestCase(AbstractBas
 # test/types failures for Test*TypesExpr.py: element offset computed wrong
 # and sign error?
 
-def setUp(self):
-# Call super's setUp().
-AbstractBase.GenericTester.setUp(self)
-# disable "There is a running process, kill it and restart?" p

[Lldb-commits] [lldb] r370706 - [lldb][NFC] Unify log files in commands/log/basic

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 01:30:17 2019
New Revision: 370706

URL: http://llvm.org/viewvc/llvm-project?rev=370706&view=rev
Log:
[lldb][NFC] Unify log files in commands/log/basic

Modified:
lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py?rev=370706&r1=370705&r2=370706&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py 
Tue Sep  3 01:30:17 2019
@@ -21,21 +21,19 @@ class LogTestCase(TestBase):
 super(LogTestCase, self).setUp()
 self.log_file = self.getBuildArtifact("log-file.txt")
 
-def test(self):
+def test_file_writing(self):
 self.build()
 exe = self.getBuildArtifact("a.out")
 self.expect("file " + exe,
 patterns=["Current executable set to .*a.out"])
 
-log_file = os.path.join(self.getBuildDir(), "lldb-commands-log.txt")
-
-if (os.path.exists(log_file)):
-os.remove(log_file)
+if (os.path.exists(self.log_file)):
+os.remove(self.log_file)
 
 # By default, Debugger::EnableLog() will set log options to
 # PREPEND_THREAD_NAME + OPTION_THREADSAFE. We don't want the
 # threadnames here, so we enable just threadsafe (-t).
-self.runCmd("log enable -t -f '%s' lldb commands" % (log_file))
+self.runCmd("log enable -t -f '%s' lldb commands" % (self.log_file))
 
 self.runCmd("command alias bp breakpoint")
 
@@ -45,12 +43,12 @@ class LogTestCase(TestBase):
 
 self.runCmd("log disable lldb")
 
-self.assertTrue(os.path.isfile(log_file))
+self.assertTrue(os.path.isfile(self.log_file))
 
-f = open(log_file)
+f = open(self.log_file)
 log_lines = f.readlines()
 f.close()
-os.remove(log_file)
+os.remove(self.log_file)
 
 self.assertGreater(
 len(log_lines),


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


[Lldb-commits] [lldb] r370712 - [lldb] Test 'command' commands and fix the found crashes

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 02:06:12 2019
New Revision: 370712

URL: http://llvm.org/viewvc/llvm-project?rev=370712&view=rev
Log:
[lldb] Test 'command' commands and fix the found crashes

Added:
lldb/trunk/packages/Python/lldbsuite/test/commands/command/invalid-args/

lldb/trunk/packages/Python/lldbsuite/test/commands/command/invalid-args/TestInvalidArgsCommand.py
Modified:
lldb/trunk/source/Commands/CommandObjectCommands.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/invalid-args/TestInvalidArgsCommand.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/command/invalid-args/TestInvalidArgsCommand.py?rev=370712&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/invalid-args/TestInvalidArgsCommand.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/invalid-args/TestInvalidArgsCommand.py
 Tue Sep  3 02:06:12 2019
@@ -0,0 +1,58 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class InvalidArgsCommandTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test_script_add(self):
+self.expect("command script add 1 2", error=True,
+substrs=["'command script add' requires one argument"])
+
+self.expect("command script add", error=True,
+substrs=["'command script add' requires one argument"])
+
+@no_debug_info_test
+def test_script_clear(self):
+self.expect("command script clear f", error=True,
+substrs=["'command script clear' doesn't take any 
arguments"])
+
+@no_debug_info_test
+def test_script_list(self):
+self.expect("command script list f", error=True,
+substrs=["'command script list' doesn't take any 
arguments"])
+
+@no_debug_info_test
+def test_script_import(self):
+self.expect("command script import", error=True,
+substrs=["command script import needs one or more 
arguments"])
+
+@no_debug_info_test
+def test_alias(self):
+self.expect("command alias", error=True,
+substrs=["'command alias' requires at least two 
arguments"])
+
+self.expect("command alias blub foo", error=True,
+substrs=["error: invalid command given to 'command alias'. 
'foo' does not begin with a valid command.  No alias created."])
+
+@no_debug_info_test
+def test_unalias(self):
+self.expect("command unalias", error=True,
+substrs=["must call 'unalias' with a valid alias"])
+
+@no_debug_info_test
+def test_delete(self):
+self.expect("command delete", error=True,
+substrs=["must call 'command delete' with one or more 
valid user"])
+
+@no_debug_info_test
+def test_regex(self):
+self.expect("command regex", error=True,
+substrs=["usage: 'command regex  "])
+
+@no_debug_info_test
+def test_source(self):
+self.expect("command source", error=True,
+substrs=["'command source' takes exactly one executable 
filename argument."])

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=370712&r1=370711&r2=370712&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Tue Sep  3 02:06:12 
2019
@@ -859,6 +859,7 @@ protected:
"defined regular expression command names",
GetCommandName().str().c_str());
   result.SetStatus(eReturnStatusFailed);
+  return false;
 }
 
 auto command_name = args[0].ref;
@@ -1724,6 +1725,12 @@ public:
   ~CommandObjectCommandsScriptList() override = default;
 
   bool DoExecute(Args &command, CommandReturnObject &result) override {
+if (command.GetArgumentCount() != 0) {
+  result.AppendError("'command script list' doesn't take any arguments");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
 m_interpreter.GetHelp(result, CommandInterpreter::eCommandTypesUserDef);
 
 result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -1744,6 +1751,12 @@ public:
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
+if (command.GetArgumentCount() != 0) {
+  result.AppendError("'command script clear' doesn't take any arguments");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
 m_interpreter.RemoveAllUser();
 
 result.SetStatus(eReturnStatusSuccessFinishResult);


__

[Lldb-commits] [lldb] r370717 - [lldb][NFC] Also test unaliasing in nested_alias test

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 02:19:51 2019
New Revision: 370717

URL: http://llvm.org/viewvc/llvm-project?rev=370717&view=rev
Log:
[lldb][NFC] Also test unaliasing in nested_alias test

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py?rev=370717&r1=370716&r2=370717&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py
 Tue Sep  3 02:19:51 2019
@@ -88,3 +88,12 @@ class NestedAliasTestCase(TestBase):
 'Show variables for the current',
 'stack frame.'],
 matching=True)
+
+# Check that foself was resolved and is now independent of 'fo'.
+self.runCmd('command unalias fo')
+self.expect(
+'help foself',
+substrs=[
+'Show variables for the current',
+'stack frame.'],
+matching=True)


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


[Lldb-commits] [lldb] r370718 - [lldb][NFC] Simplify script_alias test

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 02:21:47 2019
New Revision: 370718

URL: http://llvm.org/viewvc/llvm-project?rev=370718&view=rev
Log:
[lldb][NFC] Simplify script_alias test

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py?rev=370718&r1=370717&r2=370718&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py
 Tue Sep  3 02:21:47 2019
@@ -13,10 +13,7 @@ class CommandScriptAliasTestCase(TestBas
 
 mydir = TestBase.compute_mydir(__file__)
 
-def test(self):
-self.pycmd_tests()
-
-def pycmd_tests(self):
+def test_pycmd(self):
 self.runCmd("command script import tcsacmd.py")
 self.runCmd("command script add -f tcsacmd.some_command_here attach")
 


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


[Lldb-commits] [lldb] r370719 - [lldb][NFC] Remove unnecessary constructors from invalid-args tests

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 02:25:02 2019
New Revision: 370719

URL: http://llvm.org/viewvc/llvm-project?rev=370719&view=rev
Log:
[lldb][NFC] Remove unnecessary constructors from invalid-args tests

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py

lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py

lldb/trunk/packages/Python/lldbsuite/test/commands/reproducer/invalid-args/TestInvalidArgsReproducer.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py?rev=370719&r1=370718&r2=370719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py
 Tue Sep  3 02:25:02 2019
@@ -6,9 +6,6 @@ class InvalidArgsExpressionTestCase(Test
 
 mydir = TestBase.compute_mydir(__file__)
 
-def setUp(self):
-TestBase.setUp(self)
-
 @no_debug_info_test
 def test_invalid_lang(self):
 self.expect("expression -l foo --", error=True,

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py?rev=370719&r1=370718&r2=370719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
 Tue Sep  3 02:25:02 2019
@@ -6,9 +6,6 @@ class InvalidArgsLogTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-def setUp(self):
-TestBase.setUp(self)
-
 @no_debug_info_test
 def test_enable_empty(self):
 self.expect("log enable", error=True,

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/reproducer/invalid-args/TestInvalidArgsReproducer.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/reproducer/invalid-args/TestInvalidArgsReproducer.py?rev=370719&r1=370718&r2=370719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/reproducer/invalid-args/TestInvalidArgsReproducer.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/reproducer/invalid-args/TestInvalidArgsReproducer.py
 Tue Sep  3 02:25:02 2019
@@ -6,9 +6,6 @@ class ReproducerTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-def setUp(self):
-TestBase.setUp(self)
-
 @no_debug_info_test
 def test_reproducer_generate_invalid_invocation(self):
 self.expect("reproducer generate f", error=True,


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


[Lldb-commits] [lldb] r370724 - [lldb][NFC] Test that enabling all log options doesn't crash anything

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 02:40:25 2019
New Revision: 370724

URL: http://llvm.org/viewvc/llvm-project?rev=370724&view=rev
Log:
[lldb][NFC] Test that enabling all log options doesn't crash anything

Modified:
lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py?rev=370724&r1=370723&r2=370724&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py 
Tue Sep  3 02:40:25 2019
@@ -89,3 +89,14 @@ class LogTestCase(TestBase):
 
 # check that it is still there
 self.assertEquals(contents.find("bacon"), 0)
+
+# Enable all log options and check that nothing crashes.
+def test_all_log_options(self):
+if (os.path.exists(self.log_file)):
+os.remove(self.log_file)
+
+self.runCmd("log enable -v -t -s -T -p -n -S -F -f '%s' lldb commands" 
% self.log_file)
+self.runCmd("help log")
+self.runCmd("log disable lldb")
+
+self.assertTrue(os.path.isfile(self.log_file))


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


[Lldb-commits] [lldb] r370733 - [lldb][NFC] Test 'command delete'

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 03:13:45 2019
New Revision: 370733

URL: http://llvm.org/viewvc/llvm-project?rev=370733&view=rev
Log:
[lldb][NFC] Test 'command delete'

Added:
lldb/trunk/packages/Python/lldbsuite/test/commands/command/delete/

lldb/trunk/packages/Python/lldbsuite/test/commands/command/delete/TestCommandDelete.py

Added: 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/delete/TestCommandDelete.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/command/delete/TestCommandDelete.py?rev=370733&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/delete/TestCommandDelete.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/command/delete/TestCommandDelete.py
 Tue Sep  3 03:13:45 2019
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class DeleteCommandTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test_delete_builtin(self):
+self.expect("command delete settings", error=True,
+substrs=["'settings' is a permanent debugger command and 
cannot be removed."])
+
+@no_debug_info_test
+def test_delete_alias(self):
+self.expect("command delete bt", error=True,
+substrs=["'bt' is not a known command."])


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


[Lldb-commits] [lldb] r370734 - [lldb] Test 'frame select -r' and fix that INT32_MIN breaks the option parser

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 03:15:45 2019
New Revision: 370734

URL: http://llvm.org/viewvc/llvm-project?rev=370734&view=rev
Log:
[lldb] Test 'frame select -r' and fix that INT32_MIN breaks the option parser

Added:
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/main.cpp
Modified:
lldb/trunk/source/Commands/CommandObjectFrame.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/Makefile?rev=370734&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/Makefile 
Tue Sep  3 03:15:45 2019
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py?rev=370734&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
 Tue Sep  3 03:15:45 2019
@@ -0,0 +1,37 @@
+"""
+Test 'frame select' command.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestFrameSelect(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test_relative(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self,
+"// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+
+self.expect("frame select -r 1", substrs=["nested2() at"])
+self.expect("frame select -r -1", substrs=["nested3() at"])
+
+self.expect("frame select -r -1", error=True, substrs=["Already at the 
bottom of the stack."])
+self.expect("frame select -r -2147483647", error=True, 
substrs=["Already at the bottom of the stack."])
+self.expect("frame select -r -2147483648", error=True, 
substrs=["error: invalid frame offset argument '-2147483648'"])
+self.expect("frame select -r -2147483649", error=True, 
substrs=["error: invalid frame offset argument '-2147483649'"])
+
+self.expect("frame select -r 1", substrs=["nested2() at"])
+self.expect("frame select -r -2", substrs=["nested3() at"])
+self.expect("frame select -r 1", substrs=["nested2() at"])
+self.expect("frame select -r -2147483647", substrs=["nested3() at"])
+self.expect("frame select -r 1", substrs=["nested2() at"])
+self.expect("frame select -r -2147483648", error=True, 
substrs=["error: invalid frame offset argument '-2147483648'"])
+self.expect("frame select -r -2147483649", error=True, 
substrs=["error: invalid frame offset argument '-2147483649'"])
+
+self.expect("frame select -r 100")
+self.expect("frame select -r 1", error=True, substrs=["Already at the 
top of the stack."])

Added: lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/main.cpp?rev=370734&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/main.cpp 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/main.cpp 
Tue Sep  3 03:15:45 2019
@@ -0,0 +1,16 @@
+int nested3() {
+  return 3; // Set break point at this line.
+}
+
+int nested2() {
+  return 2 + nested3();
+}
+
+int nested1() {
+  return 1 + nested2();
+}
+
+
+int main(int argc, char **argv) {
+  return nested1();
+}

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=370734&r1=370733&r2=370734&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Sep  3 03:15:45 2019
@@ -246,13 +246,15 @@ public:
   Status error;
   const int short_option = m_getopt_table[option_idx].val;
   switch (short_option) {
-  case 'r':
-if (option_arg.getAsInteger(0, relative_frame_offset)) {
-  relative_frame_offset = INT32_MIN;
+case 'r': {
+

[Lldb-commits] [PATCH] D66566: [lldb] Replace std::once_flag with llvm::once_flag.

2019-09-03 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

This breaks NetBSD as it shall be paired with `llvm::call_once`.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66566/new/

https://reviews.llvm.org/D66566



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


[Lldb-commits] [lldb] r370748 - [lldb] Replace std::call_once() with llvm::call_once()

2019-09-03 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Sep  3 05:31:24 2019
New Revision: 370748

URL: http://llvm.org/viewvc/llvm-project?rev=370748&view=rev
Log:
[lldb] Replace std::call_once() with llvm::call_once()

Remove the single instance of std::call_once() in lldbTarget library
with llvm::call_once().  The former fails to build on NetBSD when
combined with llvm::once_flag (which replaced std::once_flag
in r369618), and combining the two is probably generally incorrect
anyway.

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

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=370748&r1=370747&r2=370748&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Sep  3 05:31:24 2019
@@ -5965,7 +5965,7 @@ UtilityFunction *Process::GetLoadImageUt
 llvm::function_ref()> factory) {
   if (platform != GetTarget().GetPlatform().get())
 return nullptr;
-  std::call_once(m_dlopen_utility_func_flag_once,
- [&] { m_dlopen_utility_func_up = factory(); });
+  llvm::call_once(m_dlopen_utility_func_flag_once,
+  [&] { m_dlopen_utility_func_up = factory(); });
   return m_dlopen_utility_func_up.get();
 }


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


[Lldb-commits] [PATCH] D67022: Skip getting declarations for repeated DIEs (WIP)

2019-09-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D67022#1653248 , @guiandrade wrote:

> Hey guys,
>
> This change is more for me to get to know what you think. I've noticed that 
> the GetDeclForUIDFromDWARF() calls inside 
> SymbolFileDWARF::ParseDeclsForContext 
> (https://github.com/llvm/llvm-project/blob/ef82098a800178a1f973abb8af86eaa690a29734/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L1216)
>  often end up having no side effect besides generating a llvm::DenseMap::find 
> invocation 
> (https://github.com/llvm/llvm-project/blob/f07b4aff06d83c6ad25d95f456fbc12b2d2a0a0c/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L3322),
>  especially when we evaluate multiple expressions inside the same scope. So I 
> was wondering if there's a way to improve that. Do you guys think we could do 
> something like what this change proposes, or am I missing something 
> important? Thanks!


So this function gets called when clang wants to make sure that all decls 
inside of a function, class, struct, union are parsed. Parsed means DWARF has 
been converted into clang AST in the TypeSystem for the current DWARF file. 
This means if the DeclContext that is being used is something the clang 
expression parser wants to use and search, we can make sure all decls inside of 
a DeclContext are parsed so they will be visible. It will cause all DIEs to be 
parsed and all clang AST counterparts to be created for each DIE that gets 
returned. I really am not following what this patch does. The fact that you see:

  clang::Decl *DWARFASTParserClang::GetClangDeclForDIE(const DWARFDIE &die) 

seem like it is always just grabbing an entry from the cache 
(https://github.com/llvm/llvm-project/blob/f07b4aff06d83c6ad25d95f456fbc12b2d2a0a0c/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L3322)
 is only because this DWARFDIE has converted DWARF into a clang AST type 
already. The first time a decl gets parsed, it will fall through to the code 
below which converts the DWARF to clang AST types.

So, original code is doing what is intended. More comments below about how we 
can make this more efficient.

In D67022#1654754 , @labath wrote:

> I am not very familiar with this code, but I don't see a reason why what 
> you're doing could not work. However, it looks like the implementation of it 
> could be done in a better way. For instance, this function seems to be the 
> only caller of  `GetDIEForDeclContext`. So, we could replace it with 
> something like ast_parser->ParseAllDiesForContext(decl_ctx). This would avoid 
> materializing the std::vector, and the ast parser could store the list of 
> processed dies in a more intelligent (memory friendly) fashion.




> The thing that's not clear to me is under what circumstances (if any) can a 
> new DIE appear in a decl_context after ParseDeclsForContext has been called. 
> @clayborg, do you have any idea?

No new DIEs should appear in a decl context in the future.

Speaking to efficiency we can do a few things:
1 - keep a cache of CompilerDeclContext's that have already been expanded. This 
way we can avoid the need to get a list of DIE, just to iterate through them 
and do nothing.

We can declare a new ivar in SymbolFileDWARF:

  std::set m_parsed_decls_for_decl_ctx;

And then use this std::set. If the pair that is returned has "second" set to 
"false", then it has already been parsed, else it will set it and fall through 
and parse all decls one time:

  void SymbolFileDWARF::ParseDeclsForContext(CompilerDeclContext decl_ctx) {
if (!m_parsed_decls_for_decl_ctx.insert(decl_ctx).second)
  return;
// Fall through and do what we did before

2 - Change GetDIEForDeclContext to take a std::function or llvm::function that 
will get called with each DWARFDIE we need. This will avoid making a 
std::vector which we just iterate through. If we go this route we should rename 
this to ForEachDeclContextDIE(...).




Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1212-1213
   ast_parser->GetDIEForDeclContext(decl_ctx);
+  DeclContextToOffsetKey offset_key =
+  std::make_pair(decl_ctx.GetOpaqueDeclContext(), type_system);
+  uint32_t &offset = m_decl_context_to_offset_map[offset_key];

delete these two lines



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1214
+  std::make_pair(decl_ctx.GetOpaqueDeclContext(), type_system);
+  uint32_t &offset = m_decl_context_to_offset_map[offset_key];
 

Why the reference to 'offset'? Also we shouldn't need to make a key, just use 
decl_ctx:
```
uint32_t offset = m_decl_context_to_offset_map[decl_ctx];
```
Also, m_decl_context_to_offset_map is not populated anywhere. Not sure what 
this will return as this was never assigned. It will probably just return a 
default constructed "uint32_t"??



Comment at: lldb/source/Pl

[Lldb-commits] [lldb] r370776 - [lldb][NFC] Disable added frame select and all log option test on windows

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 09:21:57 2019
New Revision: 370776

URL: http://llvm.org/viewvc/llvm-project?rev=370776&view=rev
Log:
[lldb][NFC] Disable added frame select and all log option test on windows

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py?rev=370776&r1=370775&r2=370776&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
 Tue Sep  3 09:21:57 2019
@@ -11,6 +11,7 @@ class TestFrameSelect(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @no_debug_info_test
+@skipIfWindows
 def test_relative(self):
 self.build()
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py?rev=370776&r1=370775&r2=370776&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py 
Tue Sep  3 09:21:57 2019
@@ -91,6 +91,7 @@ class LogTestCase(TestBase):
 self.assertEquals(contents.find("bacon"), 0)
 
 # Enable all log options and check that nothing crashes.
+@skipIfWindows
 def test_all_log_options(self):
 if (os.path.exists(self.log_file)):
 os.remove(self.log_file)


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


[Lldb-commits] [lldb] r370777 - [test] Remove print statements and verify that the symbol exists

2019-09-03 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep  3 09:26:44 2019
New Revision: 370777

URL: http://llvm.org/viewvc/llvm-project?rev=370777&view=rev
Log:
[test] Remove print statements and verify that the symbol exists

This removes some (commented out) print statements and adds a line that
verifies that uses image list to check the symbol.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py?rev=370777&r1=370776&r2=370777&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
 Tue Sep  3 09:26:44 2019
@@ -2,9 +2,6 @@
 Test the lldb disassemble command on foundation framework.
 """
 
-from __future__ import print_function
-
-
 import unittest2
 import os
 import lldb
@@ -36,7 +33,6 @@ class FoundationDisassembleTestCase(Test
 
 foundation_framework = None
 for module in target.modules:
-print(module)
 if module.file.basename == "Foundation":
 foundation_framework = module.file.fullpath
 break
@@ -61,8 +57,7 @@ class FoundationDisassembleTestCase(Test
 match = codeRE.search(line)
 if match:
 func = match.group(1)
-#print("line:", line)
-#print("func:", func)
+self.runCmd('image lookup -s "%s"' % func)
 self.runCmd('disassemble -n "%s"' % func)
 
 def test_simple_disasm(self):
@@ -73,10 +68,6 @@ class FoundationDisassembleTestCase(Test
 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
 self.assertTrue(target, VALID_TARGET)
 
-print(target)
-for module in target.modules:
-print(module)
-
 # Stop at +[NSString stringWithFormat:].
 symbol_name = "+[NSString stringWithFormat:]"
 break_results = lldbutil.run_break_set_command(


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


[Lldb-commits] [PATCH] D67083: [dotest] Avoid the need for LEVEL= makefile boilerplate

2019-09-03 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

This looks like a very good idea!




Comment at: packages/Python/lldbsuite/test/lldbinline.py:116
 
-makefile.write("include $(LEVEL)/Makefile.rules\n")
+makefile.write("include Makefile.rules\n")
 makefile.write("\ncleanup:\n\trm -f Makefile *.d\n\n")

wait.. lldbinline can auto-generate a Makefile? Is that feature used by any 
tests?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67083/new/

https://reviews.llvm.org/D67083



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


[Lldb-commits] [PATCH] D67083: [dotest] Avoid the need for LEVEL= makefile boilerplate

2019-09-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

This has always bothered me, but never enough to look into. Thanks for doing 
this, Pavel!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67083/new/

https://reviews.llvm.org/D67083



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


Re: [Lldb-commits] [lldb] r370776 - [lldb][NFC] Disable added frame select and all log option test on windows

2019-09-03 Thread Adrian McCarthy via lldb-commits
Does disabling tests really quality a patch for the [NFC] label?

Are these buggy tests or is there something that makes the actually not
relevant on Windows?

On Tue, Sep 3, 2019 at 9:20 AM Raphael Isemann via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: teemperor
> Date: Tue Sep  3 09:21:57 2019
> New Revision: 370776
>
> URL: http://llvm.org/viewvc/llvm-project?rev=370776&view=rev
> Log:
> [lldb][NFC] Disable added frame select and all log option test on windows
>
> Modified:
>
> lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
>
> lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py?rev=370776&r1=370775&r2=370776&view=diff
>
> ==
> ---
> lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
> (original)
> +++
> lldb/trunk/packages/Python/lldbsuite/test/commands/frame/select/TestFrameSelect.py
> Tue Sep  3 09:21:57 2019
> @@ -11,6 +11,7 @@ class TestFrameSelect(TestBase):
>  mydir = TestBase.compute_mydir(__file__)
>
>  @no_debug_info_test
> +@skipIfWindows
>  def test_relative(self):
>  self.build()
>
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py?rev=370776&r1=370775&r2=370776&view=diff
>
> ==
> ---
> lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
> (original)
> +++
> lldb/trunk/packages/Python/lldbsuite/test/commands/log/basic/TestLogging.py
> Tue Sep  3 09:21:57 2019
> @@ -91,6 +91,7 @@ class LogTestCase(TestBase):
>  self.assertEquals(contents.find("bacon"), 0)
>
>  # Enable all log options and check that nothing crashes.
> +@skipIfWindows
>  def test_all_log_options(self):
>  if (os.path.exists(self.log_file)):
>  os.remove(self.log_file)
>
>
> ___
> 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] [PATCH] D67083: [dotest] Avoid the need for LEVEL= makefile boilerplate

2019-09-03 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: packages/Python/lldbsuite/test/lldbinline.py:116
 
-makefile.write("include $(LEVEL)/Makefile.rules\n")
+makefile.write("include Makefile.rules\n")
 makefile.write("\ncleanup:\n\trm -f Makefile *.d\n\n")

aprantl wrote:
> wait.. lldbinline can auto-generate a Makefile? Is that feature used by any 
> tests?
I would guess "all of them", because otherwise, how would the inline test 
executable get built?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67083/new/

https://reviews.llvm.org/D67083



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


[Lldb-commits] [lldb] r370785 - [test] Addres TestConcurrentMany*.py flakiness on macOS

2019-09-03 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep  3 10:04:04 2019
New Revision: 370785

URL: http://llvm.org/viewvc/llvm-project?rev=370785&view=rev
Log:
[test] Addres  TestConcurrentMany*.py flakiness on macOS

On "fast" macOS machines, the TestConcurrentMany*.py tests would fail
randomly with different numbers of breakpoints, watchpoints, etc. This
seems to be avoidable by giving the threads a little time to breath
after the passing the synchronization barrier. This is far from a
structural fix but it reduces the flakiness.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h?rev=370785&r1=370784&r2=370785&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/pseudo_barrier.h Tue Sep  3 
10:04:04 2019
@@ -1,20 +1,15 @@
 #include 
-
-// Note that although hogging the CPU while waiting for a variable to change
-// would be terrible in production code, it's great for testing since it
-// avoids a lot of messy context switching to get multiple threads 
synchronized.
+#include 
 
 typedef std::atomic pseudo_barrier_t;
-#define pseudo_barrier_wait(barrier)\
-do  \
-{   \
---(barrier);\
-while ((barrier).load() > 0)\
-;   \
-} while (0)
 
-#define pseudo_barrier_init(barrier, count) \
-do  \
-{   \
-(barrier) = (count);\
-} while (0)
+static inline void pseudo_barrier_wait(pseudo_barrier_t &barrier) {
+  --barrier;
+  while (barrier > 0)
+std::this_thread::yield();
+  std::this_thread::sleep_for(std::chrono::milliseconds(100));
+}
+
+static inline void pseudo_barrier_init(pseudo_barrier_t &barrier, int count) {
+  barrier = count;
+}


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


[Lldb-commits] [PATCH] D67064: [lldb][NFC] Remove lldbcurses.py

2019-09-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Yeah I removed the curses formatter last week. I wasn't sure if this was used 
by to test the curses GUI, so I wanted to check that before removing this too. 
Looks like you beat me to the punch. Thanks!


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67064/new/

https://reviews.llvm.org/D67064



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


[Lldb-commits] [PATCH] D67075: Pass -DLLDB_DISABLE_CURSES to the lldb-x86_64-debian bot

2019-09-03 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370787: Pass -DLLDB_DISABLE_CURSES to the lldb-x86_64-debian 
bot (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67075?vs=218338&id=218480#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67075/new/

https://reviews.llvm.org/D67075

Files:
  zorg/trunk/buildbot/osuosl/master/config/builders.py


Index: zorg/trunk/buildbot/osuosl/master/config/builders.py
===
--- zorg/trunk/buildbot/osuosl/master/config/builders.py
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py
@@ -821,6 +821,7 @@
 test=True,
 extra_cmake_args=['-DLLVM_ENABLE_ASSERTIONS=True',
   '-DLLVM_USE_LINKER=gold',
+  '-DLLDB_DISABLE_CURSES=True',
   '-DCMAKE_C_COMPILER=clang',
   '-DCMAKE_CXX_COMPILER=clang++'])},
 {'name': "lldb-aarch64-ubuntu",


Index: zorg/trunk/buildbot/osuosl/master/config/builders.py
===
--- zorg/trunk/buildbot/osuosl/master/config/builders.py
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py
@@ -821,6 +821,7 @@
 test=True,
 extra_cmake_args=['-DLLVM_ENABLE_ASSERTIONS=True',
   '-DLLVM_USE_LINKER=gold',
+  '-DLLDB_DISABLE_CURSES=True',
   '-DCMAKE_C_COMPILER=clang',
   '-DCMAKE_CXX_COMPILER=clang++'])},
 {'name': "lldb-aarch64-ubuntu",
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67083: [dotest] Avoid the need for LEVEL= makefile boilerplate

2019-09-03 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: packages/Python/lldbsuite/test/lldbinline.py:116
 
-makefile.write("include $(LEVEL)/Makefile.rules\n")
+makefile.write("include Makefile.rules\n")
 makefile.write("\ncleanup:\n\trm -f Makefile *.d\n\n")

labath wrote:
> aprantl wrote:
> > wait.. lldbinline can auto-generate a Makefile? Is that feature used by any 
> > tests?
> I would guess "all of them", because otherwise, how would the inline test 
> executable get built?
I see. My only exposure to inline test was in the Swift branch and there they 
all ship their own Makefile, but that is likely because they need to set 
SWIFT_SOURCES instead of the default CXX_SOURCES.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67083/new/

https://reviews.llvm.org/D67083



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


[Lldb-commits] [PATCH] D67111: Adding caching to libc++ std::function formatter for lookups that require scanning symbols

2019-09-03 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik created this revision.
shafik added reviewers: jingham, jasonmolenda, aprantl.
Herald added a reviewer: EricWF.
Herald added subscribers: ldionne, christof.

Performance issues lead to the libc++ `std::function` formatter to be disabled, 
see D65666 

This change is the first of two changes that should address the performance 
issues and allow us to enable the formatter again.

In some cases we end up scanning the symbol table for the callable wrapped by 
`std::function` for those cases we will now cache the results and used the 
cache in subsequent look-ups. This still leaves a large cost for the initial 
lookup which will be addressed in the next change.

We are also expanding the tests but they will remain disabled.


https://reviews.llvm.org/D67111

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
  source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h

Index: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
===
--- source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
+++ source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
@@ -9,7 +9,9 @@
 #ifndef liblldb_CPPLanguageRuntime_h_
 #define liblldb_CPPLanguageRuntime_h_
 
+#include 
 #include 
+
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
@@ -82,6 +84,12 @@
   CPPLanguageRuntime(Process *process);
 
 private:
+  using OperatorStringToCallableInfoMap =
+  std::unordered_map;
+
+  OperatorStringToCallableInfoMap CallableLookupCache;
+
   DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime);
 };
 
Index: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===
--- source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -193,13 +193,30 @@
 symbol = sc.symbol;
   }
 
+  // Case 4 or 5
+  // We eliminate these cases early because they don't need the potentially
+  // expensive lookup through the symbol table.
+  if (symbol && !symbol->GetName().GetStringRef().startswith("vtable for") &&
+  !first_template_parameter.contains("$_") &&
+  !first_template_parameter.contains("'lambda'") &&
+  !symbol->GetName().GetStringRef().contains("__invoke")) {
+optional_info.callable_case =
+LibCppStdFunctionCallableCase::FreeOrMemberFunction;
+optional_info.callable_address = function_address_resolved;
+optional_info.callable_symbol = *symbol;
+
+return optional_info;
+  }
+
   auto get_name = [&first_template_parameter, &symbol]() {
 // Given case 1:
 //
 //main::$_0
+//Bar::add_num2(int)::'lambda'(int)
 //
 // we want to append ::operator()()
-if (first_template_parameter.contains("$_"))
+if (first_template_parameter.contains("$_") ||
+first_template_parameter.contains("'lambda'"))
   return llvm::Regex::escape(first_template_parameter.str()) +
  R"(::operator\(\)\(.*\))";
 
@@ -228,6 +245,9 @@
 
   std::string func_to_match = get_name();
 
+  if (CallableLookupCache.count(func_to_match))
+return CallableLookupCache[func_to_match];
+
   SymbolContextList scl;
 
   target.GetImages().FindSymbolsMatchingRegExAndType(
@@ -249,6 +269,7 @@
   addr.CalculateSymbolContextLineEntry(line_entry);
 
   if (first_template_parameter.contains("$_") ||
+  first_template_parameter.contains("'lambda'") ||
   (symbol != nullptr &&
symbol->GetName().GetStringRef().contains("__invoke"))) {
 // Case 1 and 2
@@ -262,19 +283,10 @@
   optional_info.callable_symbol = *symbol;
   optional_info.callable_line_entry = line_entry;
   optional_info.callable_address = addr;
-  return optional_info;
 }
   }
 
-  // Case 4 or 5
-  if (symbol && !symbol->GetName().GetStringRef().startswith("vtable for")) {
-optional_info.callable_case =
-LibCppStdFunctionCallableCase::FreeOrMemberFunction;
-optional_info.callable_address = function_address_resolved;
-optional_info.callable_symbol = *symbol;
-
-return optional_info;
-  }
+  CallableLookupCache[func_to_match] = optional_info;
 
   return optional_info;
 }
Index: packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
===
--- packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
@@ -17,8 +17,2

[Lldb-commits] [PATCH] D67116: [lldb][NFC] Remove unused overload of File::Read

2019-09-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.

It's neither used or tested here and in swift-lldb, so let's get rid of it.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67116

Files:
  lldb/include/lldb/Host/File.h
  lldb/source/Host/common/File.cpp


Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -513,50 +513,6 @@
   return error;
 }
 
-Status File::Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  DataBufferSP &data_buffer_sp) {
-  Status error;
-
-  if (num_bytes > 0) {
-int fd = GetDescriptor();
-if (fd != kInvalidDescriptor) {
-  struct stat file_stats;
-  if (::fstat(fd, &file_stats) == 0) {
-if (file_stats.st_size > offset) {
-  const size_t bytes_left = file_stats.st_size - offset;
-  if (num_bytes > bytes_left)
-num_bytes = bytes_left;
-
-  size_t num_bytes_plus_nul_char = num_bytes + (null_terminate ? 1 : 
0);
-  std::unique_ptr data_heap_up;
-  data_heap_up.reset(new DataBufferHeap());
-  data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-
-  if (data_heap_up) {
-error = Read(data_heap_up->GetBytes(), num_bytes, offset);
-if (error.Success()) {
-  // Make sure we read exactly what we asked for and if we got
-  // less, adjust the array
-  if (num_bytes_plus_nul_char < data_heap_up->GetByteSize())
-data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-  data_buffer_sp.reset(data_heap_up.release());
-  return error;
-}
-  }
-} else
-  error.SetErrorString("file is empty");
-  } else
-error.SetErrorToErrno();
-} else
-  error.SetErrorString("invalid file handle");
-  } else
-error.SetErrorString("invalid file handle");
-
-  num_bytes = 0;
-  data_buffer_sp.reset();
-  return error;
-}
-
 Status File::Write(const void *buf, size_t &num_bytes, off_t &offset) {
   Status error;
 
Index: lldb/include/lldb/Host/File.h
===
--- lldb/include/lldb/Host/File.h
+++ lldb/include/lldb/Host/File.h
@@ -252,36 +252,6 @@
   /// failure.
   Status Read(void *dst, size_t &num_bytes, off_t &offset);
 
-  /// Read bytes from a file from the specified file offset.
-  ///
-  /// NOTE: This function is thread safe in that clients manager their
-  /// own file position markers and reads on other threads won't mess up the
-  /// current read.
-  ///
-  /// \param[in,out] num_bytes
-  /// The number of bytes to read form the current file position
-  /// which gets modified with the number of bytes that were read.
-  ///
-  /// \param[in,out] offset
-  /// The offset within the file from which to read \a num_bytes
-  /// bytes. This offset gets incremented by the number of bytes
-  /// that were read.
-  ///
-  /// \param[in] null_terminate
-  /// Ensure that the data that is read is terminated with a NULL
-  /// character so that the data can be used as a C string.
-  ///
-  /// \param[out] data_buffer_sp
-  /// A data buffer to create and fill in that will contain any
-  /// data that is read from the file. This buffer will be reset
-  /// if an error occurs.
-  ///
-  /// \return
-  /// An error object that indicates success or the reason for
-  /// failure.
-  Status Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  lldb::DataBufferSP &data_buffer_sp);
-
   /// Write bytes to a file at the specified file offset.
   ///
   /// NOTE: This function is thread safe in that clients manager their


Index: lldb/source/Host/common/File.cpp
===
--- lldb/source/Host/common/File.cpp
+++ lldb/source/Host/common/File.cpp
@@ -513,50 +513,6 @@
   return error;
 }
 
-Status File::Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  DataBufferSP &data_buffer_sp) {
-  Status error;
-
-  if (num_bytes > 0) {
-int fd = GetDescriptor();
-if (fd != kInvalidDescriptor) {
-  struct stat file_stats;
-  if (::fstat(fd, &file_stats) == 0) {
-if (file_stats.st_size > offset) {
-  const size_t bytes_left = file_stats.st_size - offset;
-  if (num_bytes > bytes_left)
-num_bytes = bytes_left;
-
-  size_t num_bytes_plus_nul_char = num_bytes + (null_terminate ? 1 : 0);
-  std::unique_ptr data_heap_up;
-  data_heap_up.reset(new DataBufferHeap());
-  data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-
-  if (data_heap_up) {
-error = Read(data_heap_up->GetBytes(), num_bytes, offset);
-if (error

[Lldb-commits] [PATCH] D67111: Adding caching to libc++ std::function formatter for lookups that require scanning symbols

2019-09-03 Thread Frederic Riss via Phabricator via lldb-commits
friss added inline comments.



Comment at: 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py:44-46
+# We are running the lookups twice in some cases because now we are
+# caching the results for some cases mainly lambdas and callable 
objects.
+# We want to validate that subsequent lookups obtain the same result.

Can we find a better way to test the cache lookups?

Ideally, we'd test that the result actually come from the cache. Maybe we can 
add some logging to FindSymbolsMatchingRegExAndType and check that it doesn't 
appear on the second search? Also, to make this look like less of a copy-pasto, 
I would put the test in a helper function and run that function twice, the 
second time in a mode that checks that the lookups use the caching. 



Comment at: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h:87-89
+  using OperatorStringToCallableInfoMap =
+  std::unordered_map;

llvm::StringMap?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67111/new/

https://reviews.llvm.org/D67111



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


[Lldb-commits] [PATCH] D67116: [lldb][NFC] Remove unused overload of File::Read

2019-09-03 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

You can just go ahead with patches like this one.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67116/new/

https://reviews.llvm.org/D67116



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


[Lldb-commits] [lldb] r370802 - [lldb][NFC] Remove unused overload of File::Read

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 11:11:14 2019
New Revision: 370802

URL: http://llvm.org/viewvc/llvm-project?rev=370802&view=rev
Log:
[lldb][NFC] Remove unused overload of File::Read

Summary: It's neither used or tested here and in swift-lldb, so let's get rid 
of it.

Reviewers: #lldb, davide

Reviewed By: #lldb, davide

Subscribers: davide, JDevlieghere, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/include/lldb/Host/File.h
lldb/trunk/source/Host/common/File.cpp

Modified: lldb/trunk/include/lldb/Host/File.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=370802&r1=370801&r2=370802&view=diff
==
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Tue Sep  3 11:11:14 2019
@@ -252,36 +252,6 @@ public:
   /// failure.
   Status Read(void *dst, size_t &num_bytes, off_t &offset);
 
-  /// Read bytes from a file from the specified file offset.
-  ///
-  /// NOTE: This function is thread safe in that clients manager their
-  /// own file position markers and reads on other threads won't mess up the
-  /// current read.
-  ///
-  /// \param[in,out] num_bytes
-  /// The number of bytes to read form the current file position
-  /// which gets modified with the number of bytes that were read.
-  ///
-  /// \param[in,out] offset
-  /// The offset within the file from which to read \a num_bytes
-  /// bytes. This offset gets incremented by the number of bytes
-  /// that were read.
-  ///
-  /// \param[in] null_terminate
-  /// Ensure that the data that is read is terminated with a NULL
-  /// character so that the data can be used as a C string.
-  ///
-  /// \param[out] data_buffer_sp
-  /// A data buffer to create and fill in that will contain any
-  /// data that is read from the file. This buffer will be reset
-  /// if an error occurs.
-  ///
-  /// \return
-  /// An error object that indicates success or the reason for
-  /// failure.
-  Status Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  lldb::DataBufferSP &data_buffer_sp);
-
   /// Write bytes to a file at the specified file offset.
   ///
   /// NOTE: This function is thread safe in that clients manager their

Modified: lldb/trunk/source/Host/common/File.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=370802&r1=370801&r2=370802&view=diff
==
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Tue Sep  3 11:11:14 2019
@@ -513,50 +513,6 @@ Status File::Read(void *buf, size_t &num
   return error;
 }
 
-Status File::Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  DataBufferSP &data_buffer_sp) {
-  Status error;
-
-  if (num_bytes > 0) {
-int fd = GetDescriptor();
-if (fd != kInvalidDescriptor) {
-  struct stat file_stats;
-  if (::fstat(fd, &file_stats) == 0) {
-if (file_stats.st_size > offset) {
-  const size_t bytes_left = file_stats.st_size - offset;
-  if (num_bytes > bytes_left)
-num_bytes = bytes_left;
-
-  size_t num_bytes_plus_nul_char = num_bytes + (null_terminate ? 1 : 
0);
-  std::unique_ptr data_heap_up;
-  data_heap_up.reset(new DataBufferHeap());
-  data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-
-  if (data_heap_up) {
-error = Read(data_heap_up->GetBytes(), num_bytes, offset);
-if (error.Success()) {
-  // Make sure we read exactly what we asked for and if we got
-  // less, adjust the array
-  if (num_bytes_plus_nul_char < data_heap_up->GetByteSize())
-data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-  data_buffer_sp.reset(data_heap_up.release());
-  return error;
-}
-  }
-} else
-  error.SetErrorString("file is empty");
-  } else
-error.SetErrorToErrno();
-} else
-  error.SetErrorString("invalid file handle");
-  } else
-error.SetErrorString("invalid file handle");
-
-  num_bytes = 0;
-  data_buffer_sp.reset();
-  return error;
-}
-
 Status File::Write(const void *buf, size_t &num_bytes, off_t &offset) {
   Status error;
 


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


[Lldb-commits] [lldb] r370804 - [lldb][NFC] Remove lldbcurses.py

2019-09-03 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Sep  3 11:11:54 2019
New Revision: 370804

URL: http://llvm.org/viewvc/llvm-project?rev=370804&view=rev
Log:
[lldb][NFC] Remove lldbcurses.py

Summary: This doesn't seem to be used anymore (at least I can't find any 
reference to this in the LLDB repo and it doesn't seem to be a standalone 
script). Git says this was once some new curses mode for viewing test results.

Reviewers: clayborg, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

Removed:
lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py

Removed: lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py?rev=370803&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py (removed)
@@ -1,1306 +0,0 @@
-from __future__ import absolute_import
-
-# System modules
-import curses
-import curses.panel
-import sys
-
-# Third-party modules
-import six
-
-# LLDB modules
-
-
-class Point(object):
-
-def __init__(self, x, y):
-self.x = x
-self.y = y
-
-def __repr__(self):
-return str(self)
-
-def __str__(self):
-return "(x=%u, y=%u)" % (self.x, self.y)
-
-def __eq__(self, rhs):
-return self.x == rhs.x and self.y == rhs.y
-
-def __ne__(self, rhs):
-return self.x != rhs.x or self.y != rhs.y
-
-def is_valid_coordinate(self):
-return self.x >= 0 and self.y >= 0
-
-
-class Size(object):
-
-def __init__(self, w, h):
-self.w = w
-self.h = h
-
-def __repr__(self):
-return str(self)
-
-def __str__(self):
-return "(w=%u, h=%u)" % (self.w, self.h)
-
-def __eq__(self, rhs):
-return self.w == rhs.w and self.h == rhs.h
-
-def __ne__(self, rhs):
-return self.w != rhs.w or self.h != rhs.h
-
-
-class Rect(object):
-
-def __init__(self, x=0, y=0, w=0, h=0):
-self.origin = Point(x, y)
-self.size = Size(w, h)
-
-def __repr__(self):
-return str(self)
-
-def __str__(self):
-return "{ %s, %s }" % (str(self.origin), str(self.size))
-
-def get_min_x(self):
-return self.origin.x
-
-def get_max_x(self):
-return self.origin.x + self.size.w
-
-def get_min_y(self):
-return self.origin.y
-
-def get_max_y(self):
-return self.origin.y + self.size.h
-
-def contains_point(self, pt):
-if pt.x < self.get_max_x():
-if pt.y < self.get_max_y():
-if pt.x >= self.get_min_y():
-return pt.y >= self.get_min_y()
-return False
-
-def __eq__(self, rhs):
-return self.origin == rhs.origin and self.size == rhs.size
-
-def __ne__(self, rhs):
-return self.origin != rhs.origin or self.size != rhs.size
-
-
-class QuitException(Exception):
-
-def __init__(self):
-super(QuitException, self).__init__('QuitException')
-
-
-class Window(object):
-
-def __init__(self, window, delegate=None, can_become_first_responder=True):
-self.window = window
-self.parent = None
-self.delegate = delegate
-self.children = list()
-self.first_responders = list()
-self.can_become_first_responder = can_become_first_responder
-self.key_actions = dict()
-
-def add_child(self, window):
-self.children.append(window)
-window.parent = self
-
-def resize(self, size):
-self.window.resize(size.h, size.w)
-
-def resize_child(self, child, delta_size, adjust_neighbors):
-if child in self.children:
-frame = self.get_frame()
-orig_frame = child.get_frame()
-new_frame = Rect(
-x=orig_frame.origin.x,
-y=orig_frame.origin.y,
-w=orig_frame.size.w +
-delta_size.w,
-h=orig_frame.size.h +
-delta_size.h)
-old_child_max_x = orig_frame.get_max_x()
-new_child_max_x = new_frame.get_max_x()
-window_max_x = frame.get_max_x()
-if new_child_max_x < window_max_x:
-child.resize(new_frame.size)
-if old_child_max_x == window_max_x:
-new_frame.origin.x += window_max_x - new_child_max_x
-child.set_position(new_frame.origin)
-elif new_child_max_x > window_max_x:
-new_frame.origin.x -= new_child_max_x - window_max_x
-child.set_position(new_frame.origin)
-child.resize(new_frame.size)
-
-if adjust_neighbors:
-#print('orig_frame = %s\r\n' % (str(orig_frame)), end='')
-for curr_child in self.children:

[Lldb-commits] [PATCH] D67116: [lldb][NFC] Remove unused overload of File::Read

2019-09-03 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370802: [lldb][NFC] Remove unused overload of File::Read 
(authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67116?vs=218491&id=218496#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67116/new/

https://reviews.llvm.org/D67116

Files:
  lldb/trunk/include/lldb/Host/File.h
  lldb/trunk/source/Host/common/File.cpp


Index: lldb/trunk/source/Host/common/File.cpp
===
--- lldb/trunk/source/Host/common/File.cpp
+++ lldb/trunk/source/Host/common/File.cpp
@@ -513,50 +513,6 @@
   return error;
 }
 
-Status File::Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  DataBufferSP &data_buffer_sp) {
-  Status error;
-
-  if (num_bytes > 0) {
-int fd = GetDescriptor();
-if (fd != kInvalidDescriptor) {
-  struct stat file_stats;
-  if (::fstat(fd, &file_stats) == 0) {
-if (file_stats.st_size > offset) {
-  const size_t bytes_left = file_stats.st_size - offset;
-  if (num_bytes > bytes_left)
-num_bytes = bytes_left;
-
-  size_t num_bytes_plus_nul_char = num_bytes + (null_terminate ? 1 : 
0);
-  std::unique_ptr data_heap_up;
-  data_heap_up.reset(new DataBufferHeap());
-  data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-
-  if (data_heap_up) {
-error = Read(data_heap_up->GetBytes(), num_bytes, offset);
-if (error.Success()) {
-  // Make sure we read exactly what we asked for and if we got
-  // less, adjust the array
-  if (num_bytes_plus_nul_char < data_heap_up->GetByteSize())
-data_heap_up->SetByteSize(num_bytes_plus_nul_char);
-  data_buffer_sp.reset(data_heap_up.release());
-  return error;
-}
-  }
-} else
-  error.SetErrorString("file is empty");
-  } else
-error.SetErrorToErrno();
-} else
-  error.SetErrorString("invalid file handle");
-  } else
-error.SetErrorString("invalid file handle");
-
-  num_bytes = 0;
-  data_buffer_sp.reset();
-  return error;
-}
-
 Status File::Write(const void *buf, size_t &num_bytes, off_t &offset) {
   Status error;
 
Index: lldb/trunk/include/lldb/Host/File.h
===
--- lldb/trunk/include/lldb/Host/File.h
+++ lldb/trunk/include/lldb/Host/File.h
@@ -252,36 +252,6 @@
   /// failure.
   Status Read(void *dst, size_t &num_bytes, off_t &offset);
 
-  /// Read bytes from a file from the specified file offset.
-  ///
-  /// NOTE: This function is thread safe in that clients manager their
-  /// own file position markers and reads on other threads won't mess up the
-  /// current read.
-  ///
-  /// \param[in,out] num_bytes
-  /// The number of bytes to read form the current file position
-  /// which gets modified with the number of bytes that were read.
-  ///
-  /// \param[in,out] offset
-  /// The offset within the file from which to read \a num_bytes
-  /// bytes. This offset gets incremented by the number of bytes
-  /// that were read.
-  ///
-  /// \param[in] null_terminate
-  /// Ensure that the data that is read is terminated with a NULL
-  /// character so that the data can be used as a C string.
-  ///
-  /// \param[out] data_buffer_sp
-  /// A data buffer to create and fill in that will contain any
-  /// data that is read from the file. This buffer will be reset
-  /// if an error occurs.
-  ///
-  /// \return
-  /// An error object that indicates success or the reason for
-  /// failure.
-  Status Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  lldb::DataBufferSP &data_buffer_sp);
-
   /// Write bytes to a file at the specified file offset.
   ///
   /// NOTE: This function is thread safe in that clients manager their


Index: lldb/trunk/source/Host/common/File.cpp
===
--- lldb/trunk/source/Host/common/File.cpp
+++ lldb/trunk/source/Host/common/File.cpp
@@ -513,50 +513,6 @@
   return error;
 }
 
-Status File::Read(size_t &num_bytes, off_t &offset, bool null_terminate,
-  DataBufferSP &data_buffer_sp) {
-  Status error;
-
-  if (num_bytes > 0) {
-int fd = GetDescriptor();
-if (fd != kInvalidDescriptor) {
-  struct stat file_stats;
-  if (::fstat(fd, &file_stats) == 0) {
-if (file_stats.st_size > offset) {
-  const size_t bytes_left = file_stats.st_size - offset;
-  if (num_bytes > bytes_left)
-num_bytes = bytes_left;
-
-  size_t num_bytes_plus_nul_char = num_bytes + (null_terminate ? 1 : 0);
-  std::unique_ptr data_heap_u

[Lldb-commits] [PATCH] D67064: [lldb][NFC] Remove lldbcurses.py

2019-09-03 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370804: [lldb][NFC] Remove lldbcurses.py (authored by 
teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67064?vs=218308&id=218498#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67064/new/

https://reviews.llvm.org/D67064

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py

Index: lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py
@@ -1,1306 +0,0 @@
-from __future__ import absolute_import
-
-# System modules
-import curses
-import curses.panel
-import sys
-
-# Third-party modules
-import six
-
-# LLDB modules
-
-
-class Point(object):
-
-def __init__(self, x, y):
-self.x = x
-self.y = y
-
-def __repr__(self):
-return str(self)
-
-def __str__(self):
-return "(x=%u, y=%u)" % (self.x, self.y)
-
-def __eq__(self, rhs):
-return self.x == rhs.x and self.y == rhs.y
-
-def __ne__(self, rhs):
-return self.x != rhs.x or self.y != rhs.y
-
-def is_valid_coordinate(self):
-return self.x >= 0 and self.y >= 0
-
-
-class Size(object):
-
-def __init__(self, w, h):
-self.w = w
-self.h = h
-
-def __repr__(self):
-return str(self)
-
-def __str__(self):
-return "(w=%u, h=%u)" % (self.w, self.h)
-
-def __eq__(self, rhs):
-return self.w == rhs.w and self.h == rhs.h
-
-def __ne__(self, rhs):
-return self.w != rhs.w or self.h != rhs.h
-
-
-class Rect(object):
-
-def __init__(self, x=0, y=0, w=0, h=0):
-self.origin = Point(x, y)
-self.size = Size(w, h)
-
-def __repr__(self):
-return str(self)
-
-def __str__(self):
-return "{ %s, %s }" % (str(self.origin), str(self.size))
-
-def get_min_x(self):
-return self.origin.x
-
-def get_max_x(self):
-return self.origin.x + self.size.w
-
-def get_min_y(self):
-return self.origin.y
-
-def get_max_y(self):
-return self.origin.y + self.size.h
-
-def contains_point(self, pt):
-if pt.x < self.get_max_x():
-if pt.y < self.get_max_y():
-if pt.x >= self.get_min_y():
-return pt.y >= self.get_min_y()
-return False
-
-def __eq__(self, rhs):
-return self.origin == rhs.origin and self.size == rhs.size
-
-def __ne__(self, rhs):
-return self.origin != rhs.origin or self.size != rhs.size
-
-
-class QuitException(Exception):
-
-def __init__(self):
-super(QuitException, self).__init__('QuitException')
-
-
-class Window(object):
-
-def __init__(self, window, delegate=None, can_become_first_responder=True):
-self.window = window
-self.parent = None
-self.delegate = delegate
-self.children = list()
-self.first_responders = list()
-self.can_become_first_responder = can_become_first_responder
-self.key_actions = dict()
-
-def add_child(self, window):
-self.children.append(window)
-window.parent = self
-
-def resize(self, size):
-self.window.resize(size.h, size.w)
-
-def resize_child(self, child, delta_size, adjust_neighbors):
-if child in self.children:
-frame = self.get_frame()
-orig_frame = child.get_frame()
-new_frame = Rect(
-x=orig_frame.origin.x,
-y=orig_frame.origin.y,
-w=orig_frame.size.w +
-delta_size.w,
-h=orig_frame.size.h +
-delta_size.h)
-old_child_max_x = orig_frame.get_max_x()
-new_child_max_x = new_frame.get_max_x()
-window_max_x = frame.get_max_x()
-if new_child_max_x < window_max_x:
-child.resize(new_frame.size)
-if old_child_max_x == window_max_x:
-new_frame.origin.x += window_max_x - new_child_max_x
-child.set_position(new_frame.origin)
-elif new_child_max_x > window_max_x:
-new_frame.origin.x -= new_child_max_x - window_max_x
-child.set_position(new_frame.origin)
-child.resize(new_frame.size)
-
-if adjust_neighbors:
-#print('orig_frame = %s\r\n' % (str(orig_frame)), end='')
-for curr_child in self.children:
-if curr_child is child:
-continue
-curr_child_frame = curr_child.get_frame()
-if delta_size.w != 0:
-#print('curr_child_frame = %s\r\n' % (str(curr_child_frame)), end

[Lldb-commits] [PATCH] D67123: [lldb] Use binary search in RangeDataVector:FindEntryIndexesThatContain

2019-09-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: labath.
Herald added subscribers: lldb-commits, JDevlieghere, arphaman.
Herald added a project: LLDB.

We currently spend a lot of time in this function (around 27% of the 
br-by-regex benchmark in lldb-bench)
by just iterating over all the ranges. We already sorted these ranges by their 
base address, we we can actually
just binary search to find what ranges we actually have to check and skip over 
all the other ranges.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67123

Files:
  lldb/include/lldb/Utility/RangeMap.h


Index: lldb/include/lldb/Utility/RangeMap.h
===
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -712,6 +712,10 @@
 return lhs.GetRangeBase() < rhs.GetRangeBase();
   }
 
+  static bool BaseLessEqual(const Entry &lhs, const Entry &rhs) {
+return lhs.GetRangeBase() <= rhs.GetRangeBase();
+  }
+
   uint32_t FindEntryIndexThatContains(B addr) const {
 const Entry *entry = FindEntryThatContains(addr);
 if (entry)
@@ -724,12 +728,18 @@
 #ifdef ASSERT_RANGEMAP_ARE_SORTED
 assert(IsSorted());
 #endif
-
-if (!m_entries.empty()) {
-  for (const auto &entry : m_entries) {
-if (entry.Contains(addr))
-  indexes.push_back(entry.data);
-  }
+if (m_entries.empty())
+  return indexes.size();
+
+// Find the first range which base address is higher than the address
+// we are looking for. This address can't contain the address we are
+// looking for. All addresses after also can't contain our address as
+// we sorted our ranges by base address.
+auto end = std::lower_bound(m_entries.begin(), m_entries.end(),
+Entry(addr, 1), BaseLessEqual);
+for (auto I = m_entries.begin(); I != end; ++I) {
+  if (I->Contains(addr))
+indexes.push_back(I->data);
 }
 return indexes.size();
   }


Index: lldb/include/lldb/Utility/RangeMap.h
===
--- lldb/include/lldb/Utility/RangeMap.h
+++ lldb/include/lldb/Utility/RangeMap.h
@@ -712,6 +712,10 @@
 return lhs.GetRangeBase() < rhs.GetRangeBase();
   }
 
+  static bool BaseLessEqual(const Entry &lhs, const Entry &rhs) {
+return lhs.GetRangeBase() <= rhs.GetRangeBase();
+  }
+
   uint32_t FindEntryIndexThatContains(B addr) const {
 const Entry *entry = FindEntryThatContains(addr);
 if (entry)
@@ -724,12 +728,18 @@
 #ifdef ASSERT_RANGEMAP_ARE_SORTED
 assert(IsSorted());
 #endif
-
-if (!m_entries.empty()) {
-  for (const auto &entry : m_entries) {
-if (entry.Contains(addr))
-  indexes.push_back(entry.data);
-  }
+if (m_entries.empty())
+  return indexes.size();
+
+// Find the first range which base address is higher than the address
+// we are looking for. This address can't contain the address we are
+// looking for. All addresses after also can't contain our address as
+// we sorted our ranges by base address.
+auto end = std::lower_bound(m_entries.begin(), m_entries.end(),
+Entry(addr, 1), BaseLessEqual);
+for (auto I = m_entries.begin(); I != end; ++I) {
+  if (I->Contains(addr))
+indexes.push_back(I->data);
 }
 return indexes.size();
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66994: [lldb][CMake] Fix windows-x86-debug compilation with python enabled using multi-target generator

2019-09-03 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

I'm open to this if we can reduce the code duplication.

One of my concerns is that changes in July and August completely broke the 
build for me for many days.  I had to remove all but one version of Python to 
ensure that it always found the right one.

I, too, would appreciate being able to run tests under the debugger, but I find 
that's impossible with python_d because it detects and halts virtually every 
test (like using the Python allocator without holding the GIL and leaked 
resource warnings).


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66994/new/

https://reviews.llvm.org/D66994



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


[Lldb-commits] [PATCH] D67123: [lldb] Use binary search in RangeDataVector:FindEntryIndexesThatContain

2019-09-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

See the br-by-regex flamegraph: F9913466: br-by-regex.svg 



Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67123/new/

https://reviews.llvm.org/D67123



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


[Lldb-commits] [PATCH] D67123: [lldb] Use binary search in RangeDataVector:FindEntryIndexesThatContain

2019-09-03 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

This feels very familiar.  I think I've reviewed a similar change back when we 
first implemented minidumps.




Comment at: lldb/include/lldb/Utility/RangeMap.h:739
+auto end = std::lower_bound(m_entries.begin(), m_entries.end(),
+Entry(addr, 1), BaseLessEqual);
+for (auto I = m_entries.begin(); I != end; ++I) {

You're trying to find an upper bound, so `std::upper_bound` seems more natural 
than `std::lower_bound`.  Understanding how `std::lower_bound` works with a 
comparator that implements `<=` requires some mental gymnastics.  With 
`std::upper_bound`, you'd just need `<` that compares only the base addresses.

You could even avoid the custom comparison function by using the maximum value 
for the size:

```
auto end = std::upper_bound(m_entries.begin(), m_entries.end(),
Entry(addr, 
std::numeric_limits::max()));
```



Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67123/new/

https://reviews.llvm.org/D67123



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


[Lldb-commits] [PATCH] D67083: [dotest] Avoid the need for LEVEL= makefile boilerplate

2019-09-03 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth accepted this revision.
amccarth added a comment.

Nice!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67083/new/

https://reviews.llvm.org/D67083



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


[Lldb-commits] [lldb] r370814 - [Driver] Remove duplicate option parsing (NFC)

2019-09-03 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Sep  3 13:18:19 2019
New Revision: 370814

URL: http://llvm.org/viewvc/llvm-project?rev=370814&view=rev
Log:
[Driver] Remove duplicate option parsing (NFC)

We were checking OPT_no_use_colors three times, twice to disable colors
and once to enable debug mode. This simplifies things and now the option
is only checked once.

Modified:
lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=370814&r1=370813&r2=370814&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Tue Sep  3 13:18:19 2019
@@ -229,6 +229,7 @@ SBError Driver::ProcessArgs(const opt::I
 
   if (args.hasArg(OPT_no_use_colors)) {
 m_debugger.SetUseColor(false);
+m_option_data.m_debug_mode = true;
   }
 
   if (auto *arg = args.getLastArg(OPT_file)) {
@@ -262,14 +263,6 @@ SBError Driver::ProcessArgs(const opt::I
 m_debugger.SetScriptLanguage(m_debugger.GetScriptingLanguage(arg_value));
   }
 
-  if (args.hasArg(OPT_no_use_colors)) {
-m_option_data.m_debug_mode = true;
-  }
-
-  if (args.hasArg(OPT_no_use_colors)) {
-m_debugger.SetUseColor(false);
-  }
-
   if (args.hasArg(OPT_source_quietly)) {
 m_option_data.m_source_quietly = true;
   }


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


[Lldb-commits] [PATCH] D67067: Breakpad: Basic support for STACK WIN unwinding

2019-09-03 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

This is looking pretty good.

I'm wondering whether it needs some "negative" tests.




Comment at: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:549
+  llvm::Optional record = StackWinRecord::parse(*It);
+  assert(record.hasValue());
+

Should we log and bail out rather than just assert?  A corrupt symbol file 
shouldn't kill the debugger, right?

Also, it's Optional rather than Expected, so it seems even more plausible to 
hit this.



Comment at: source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:586
+  // We assume the first value will be the CFA. It is usually called T0, but
+  // clang will use T1, if it needs to realing the stack.
+  if (!postfix::ResolveSymbols(it->second, symbol_resolver)) {

Typo: realign


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67067/new/

https://reviews.llvm.org/D67067



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


[Lldb-commits] [PATCH] D65677: [VirtualFileSystem] Support encoding working directories in a VFS mapping.

2019-09-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Ping


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65677/new/

https://reviews.llvm.org/D65677



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


[Lldb-commits] [PATCH] D67022: Cache expanded CompilerDeclContext's to avoid parsing them multiple times

2019-09-03 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade updated this revision to Diff 218564.
guiandrade marked 6 inline comments as done.
guiandrade retitled this revision from "Skip getting declarations for repeated 
DIEs (WIP)" to "Cache expanded CompilerDeclContext's to avoid parsing them 
multiple times".
guiandrade edited the summary of this revision.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67022/new/

https://reviews.llvm.org/D67022

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
===
--- lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -39,9 +39,12 @@
   ast_parser.LinkDeclContextToDIE((clang::DeclContext *)2LL, die3);
   ast_parser.LinkDeclContextToDIE((clang::DeclContext *)3LL, die4);
 
-  auto die_list = ast_parser.GetDIEForDeclContext(
-  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL));
+  std::vector die_list;
+  ast_parser.ForEachDIEInDeclContext(
+  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL),
+  [&die_list](DWARFDIE die) { die_list.push_back(die); });
+
   ASSERT_EQ(2u, die_list.size());
-  ASSERT_EQ(die2, die_list[0]);
-  ASSERT_EQ(die3, die_list[1]);
+  ASSERT_NE(die_list.end(), std::find(die_list.begin(), die_list.end(), die2));
+  ASSERT_NE(die_list.end(), std::find(die_list.begin(), die_list.end(), die3));
 }
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -489,6 +489,8 @@
   llvm::DenseMap
   m_type_unit_support_files;
   std::vector m_lldb_cu_to_dwarf_unit;
+
+  std::set m_parsed_decls_for_decl_ctx;
 };
 
 #endif // SymbolFileDWARF_SymbolFileDWARF_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1206,14 +1206,14 @@
   auto *type_system = decl_ctx.GetTypeSystem();
   if (!type_system)
 return;
-  DWARFASTParser *ast_parser = type_system->GetDWARFParser();
-  std::vector decl_ctx_die_list =
-  ast_parser->GetDIEForDeclContext(decl_ctx);
+  if (!m_parsed_decls_for_decl_ctx.insert(decl_ctx).second)
+return;
 
-  for (DWARFDIE decl_ctx_die : decl_ctx_die_list)
-for (DWARFDIE decl = decl_ctx_die.GetFirstChild(); decl;
- decl = decl.GetSibling())
+  DWARFASTParser *ast_parser = type_system->GetDWARFParser();
+  ast_parser->ForEachDIEInDeclContext(decl_ctx, [ast_parser](DWARFDIE die) {
+for (DWARFDIE decl = die.GetFirstChild(); decl; decl = decl.GetSibling())
   ast_parser->GetDeclForUIDFromDWARF(decl);
+  });
 }
 
 user_id_t SymbolFileDWARF::GetUID(DIERef ref) {
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -51,8 +51,9 @@
   lldb_private::CompilerDecl
   GetDeclForUIDFromDWARF(const DWARFDIE &die) override;
 
-  std::vector
-  GetDIEForDeclContext(lldb_private::CompilerDeclContext decl_context) override;
+  void ForEachDIEInDeclContext(
+  lldb_private::CompilerDeclContext decl_context,
+  std::function const &callback) override;
 
   lldb_private::CompilerDeclContext
   GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2183,15 +2183,14 @@
   return false;
 }
 
-std::vector DWARFASTParserClang::GetDIEForDeclContext(
-lldb_private::CompilerDeclContext decl_context) {
-  std::vector result;
+void DWARFASTParserClang::ForEachDIEInDeclContext(
+lldb_private::CompilerDeclContext decl_context,
+std::function const &callback) {
   auto opaque_decl_ctx =
   (clang::DeclContext *)decl_context.GetOpaqueDeclContext();
   for (auto it = m_decl_ctx_to_die.find(opaque_decl_ctx);
it != m_decl_ctx_to_die.end() && it->first == opaque_decl_ctx; it++)
-result.push_back(it->second);
-  return result;
+callback(it->second);
 }
 
 CompilerDecl DWARFASTParserClang::GetDeclForUIDFro

[Lldb-commits] [PATCH] D67022: Cache expanded CompilerDeclContext's to avoid parsing them multiple times

2019-09-03 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

Thank you so much for the thorough explanation and ideas, @labath and @clayborg.

I forgot to mention that the initial motivation behind this change was to 
reduce those find calls as I saw they add up to a lot (10^5 calls debugging a 
Unreal engine sample at certain breakpoints).




Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1214
+  std::make_pair(decl_ctx.GetOpaqueDeclContext(), type_system);
+  uint32_t &offset = m_decl_context_to_offset_map[offset_key];
 

clayborg wrote:
> Why the reference to 'offset'? Also we shouldn't need to make a key, just use 
> decl_ctx:
> ```
> uint32_t offset = m_decl_context_to_offset_map[decl_ctx];
> ```
> Also, m_decl_context_to_offset_map is not populated anywhere. Not sure what 
> this will return as this was never assigned. It will probably just return a 
> default constructed "uint32_t"??
The idea was to use that reference to populate the map at line 1222. However, I 
was  only using this offset map because I thought DIEs could appear in a decl 
context. Given that this is not the case, I agree that using a set as you 
suggested is much better. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67022/new/

https://reviews.llvm.org/D67022



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


[Lldb-commits] [PATCH] D67022: Enhance SymbolFileDWARF::ParseDeclsForContext performance

2019-09-03 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade updated this revision to Diff 218581.
guiandrade retitled this revision from "Cache expanded CompilerDeclContext's to 
avoid parsing them multiple times" to "Enhance 
SymbolFileDWARF::ParseDeclsForContext performance".
guiandrade added a comment.

Renaming the test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67022/new/

https://reviews.llvm.org/D67022

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
===
--- lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -25,7 +25,7 @@
 // If your implementation needs to dereference the dummy pointers we are
 // defining here, causing this test to fail, feel free to delete it.
 TEST(DWARFASTParserClangTests,
- TestGetDIEForDeclContextReturnsOnlyMatchingEntries) {
+ TestForEachDIEInDeclContextReturnsOnlyMatchingEntries) {
   ClangASTContext ast_ctx;
   DWARFASTParserClangStub ast_parser(ast_ctx);
 
@@ -39,9 +39,12 @@
   ast_parser.LinkDeclContextToDIE((clang::DeclContext *)2LL, die3);
   ast_parser.LinkDeclContextToDIE((clang::DeclContext *)3LL, die4);
 
-  auto die_list = ast_parser.GetDIEForDeclContext(
-  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL));
+  std::vector die_list;
+  ast_parser.ForEachDIEInDeclContext(
+  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL),
+  [&die_list](DWARFDIE die) { die_list.push_back(die); });
+
   ASSERT_EQ(2u, die_list.size());
-  ASSERT_EQ(die2, die_list[0]);
-  ASSERT_EQ(die3, die_list[1]);
+  ASSERT_NE(die_list.end(), std::find(die_list.begin(), die_list.end(), die2));
+  ASSERT_NE(die_list.end(), std::find(die_list.begin(), die_list.end(), die3));
 }
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -489,6 +489,8 @@
   llvm::DenseMap
   m_type_unit_support_files;
   std::vector m_lldb_cu_to_dwarf_unit;
+
+  std::set m_parsed_decls_for_decl_ctx;
 };
 
 #endif // SymbolFileDWARF_SymbolFileDWARF_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1206,14 +1206,14 @@
   auto *type_system = decl_ctx.GetTypeSystem();
   if (!type_system)
 return;
-  DWARFASTParser *ast_parser = type_system->GetDWARFParser();
-  std::vector decl_ctx_die_list =
-  ast_parser->GetDIEForDeclContext(decl_ctx);
+  if (!m_parsed_decls_for_decl_ctx.insert(decl_ctx).second)
+return;
 
-  for (DWARFDIE decl_ctx_die : decl_ctx_die_list)
-for (DWARFDIE decl = decl_ctx_die.GetFirstChild(); decl;
- decl = decl.GetSibling())
+  DWARFASTParser *ast_parser = type_system->GetDWARFParser();
+  ast_parser->ForEachDIEInDeclContext(decl_ctx, [ast_parser](DWARFDIE die) {
+for (DWARFDIE decl = die.GetFirstChild(); decl; decl = decl.GetSibling())
   ast_parser->GetDeclForUIDFromDWARF(decl);
+  });
 }
 
 user_id_t SymbolFileDWARF::GetUID(DIERef ref) {
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -51,8 +51,9 @@
   lldb_private::CompilerDecl
   GetDeclForUIDFromDWARF(const DWARFDIE &die) override;
 
-  std::vector
-  GetDIEForDeclContext(lldb_private::CompilerDeclContext decl_context) override;
+  void ForEachDIEInDeclContext(
+  lldb_private::CompilerDeclContext decl_context,
+  std::function const &callback) override;
 
   lldb_private::CompilerDeclContext
   GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2183,15 +2183,14 @@
   return false;
 }
 
-std::vector DWARFASTParserClang::GetDIEForDeclContext(
-lldb_private::CompilerDeclContext decl_context) {
-  std::vector result;
+void DWARFASTParserClang::ForEachDIEInDeclContext(
+lldb_private::CompilerDeclContext decl_context,
+std::function const &callback) {
   aut

[Lldb-commits] [PATCH] D67022: Enhance SymbolFileDWARF::ParseDeclsForContext performance

2019-09-03 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added inline comments.



Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:48
   ASSERT_EQ(2u, die_list.size());
-  ASSERT_EQ(die2, die_list[0]);
-  ASSERT_EQ(die3, die_list[1]);
+  ASSERT_NE(die_list.end(), std::find(die_list.begin(), die_list.end(), die2));
+  ASSERT_NE(die_list.end(), std::find(die_list.begin(), die_list.end(), die3));

I think we should not expect any particular order, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67022/new/

https://reviews.llvm.org/D67022



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


[Lldb-commits] [lldb] r370840 - [lldb] [test] Un-mark two commands/register tests XFAIL

2019-09-03 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Sep  3 23:10:02 2019
New Revision: 370840

URL: http://llvm.org/viewvc/llvm-project?rev=370840&view=rev
Log:
[lldb] [test] Un-mark two commands/register tests XFAIL

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py?rev=370840&r1=370839&r2=370840&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/register/register/register_command/TestRegisters.py
 Tue Sep  3 23:10:02 2019
@@ -478,7 +478,6 @@ class RegisterCommandsTestCase(TestBase)
 
 @skipIfiOSSimulator
 @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
-@expectedFailureNetBSD
 def test_invalid_invocation(self):
 self.build()
 self.common_setup()
@@ -496,7 +495,6 @@ class RegisterCommandsTestCase(TestBase)
 
 @skipIfiOSSimulator
 @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
-@expectedFailureNetBSD
 def test_write_unknown_register(self):
 self.build()
 self.common_setup()


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


[Lldb-commits] [lldb] r370842 - [lldb] [test] Mark 'reenabled' tests XFAIL on NetBSD

2019-09-03 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue Sep  3 23:36:53 2019
New Revision: 370842

URL: http://llvm.org/viewvc/llvm-project?rev=370842&view=rev
Log:
[lldb] [test] Mark 'reenabled' tests XFAIL on NetBSD

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py?rev=370842&r1=370841&r2=370842&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
 Tue Sep  3 23:36:53 2019
@@ -14,6 +14,7 @@ class ConcurrentManyBreakpoints(Concurre
 
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
+@expectedFailureNetBSD
 def test(self):
 """Test 100 breakpoints from 100 threads."""
 self.build(dictionary=self.getBuildFlags())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py?rev=370842&r1=370841&r2=370842&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
 Tue Sep  3 23:36:53 2019
@@ -14,6 +14,7 @@ class ConcurrentManyCrash(ConcurrentEven
 
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
+@expectedFailureNetBSD
 def test(self):
 """Test 100 threads that cause a segfault."""
 self.build(dictionary=self.getBuildFlags())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py?rev=370842&r1=370841&r2=370842&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManySignals.py
 Tue Sep  3 23:36:53 2019
@@ -16,6 +16,7 @@ class ConcurrentManySignals(ConcurrentEv
 @skipIf(triple='^mips')
 # This test is flaky on Darwin.
 @skipIfDarwin
+@expectedFailureNetBSD
 def test(self):
 """Test 100 signals from 100 threads."""
 self.build(dictionary=self.getBuildFlags())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py?rev=370842&r1=370841&r2=370842&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
 Tue Sep  3 23:36:53 2019
@@ -14,6 +14,7 @@ class ConcurrentManyWatchpoints(Concurre
 
 # Atomic sequences are not supported yet for MIPS in LLDB.
 @skipIf(triple='^mips')
+@expectedFailureNetBSD
 @add_test_categories(["watchpoint"])
 def test(self):
 """Test 100 watchpoints from 100 threads."""

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py?rev=370842&r1=370841&r2=370842&view=diff
===

[Lldb-commits] [PATCH] D67123: [lldb] Use binary search in RangeDataVector:FindEntryIndexesThatContain

2019-09-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I remember seeing this inefficiency when looking at this class some time ago, 
but it was not clear to me what should be done about that. This is still an 
improvement, as it will reduce the time by 50% on average, but it is still 
going to be O(n). If this is really a performance bottleneck, then we will need 
to come up with some better data structure for storing this, or put some 
restrictions on the kind of entries that we can have in the map...




Comment at: lldb/include/lldb/Utility/RangeMap.h:739
+auto end = std::lower_bound(m_entries.begin(), m_entries.end(),
+Entry(addr, 1), BaseLessEqual);
+for (auto I = m_entries.begin(); I != end; ++I) {

amccarth wrote:
> You're trying to find an upper bound, so `std::upper_bound` seems more 
> natural than `std::lower_bound`.  Understanding how `std::lower_bound` works 
> with a comparator that implements `<=` requires some mental gymnastics.  With 
> `std::upper_bound`, you'd just need `<` that compares only the base addresses.
> 
> You could even avoid the custom comparison function by using the maximum 
> value for the size:
> 
> ```
> auto end = std::upper_bound(m_entries.begin(), m_entries.end(),
> Entry(addr, 
> std::numeric_limits::max()));
> ```
> 
Actually, If I understand this correctly, there is no need for either lower or 
upper bound here. Since you're going to be iterating through the list anyway. 
It should be sufficient to add a early exit from the loop once you encounter an 
element whose base address is >= the address you search for.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67123/new/

https://reviews.llvm.org/D67123



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