summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/API/functionalities')
-rw-r--r--lldb/test/API/functionalities/completion/TestCompletion.py15
-rw-r--r--lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py2
-rw-r--r--lldb/test/API/functionalities/data-formatter/bytecode-summary/Makefile2
-rw-r--r--lldb/test/API/functionalities/data-formatter/bytecode-summary/TestBytecodeSummary.py17
-rw-r--r--lldb/test/API/functionalities/data-formatter/bytecode-summary/main.cpp43
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py2
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py21
-rw-r--r--lldb/test/API/functionalities/data-formatter/embedded-summary/Makefile2
-rw-r--r--lldb/test/API/functionalities/data-formatter/embedded-summary/TestEmbeddedTypeSummary.py13
-rw-r--r--lldb/test/API/functionalities/data-formatter/embedded-summary/main.c43
-rw-r--r--lldb/test/API/functionalities/vtable/TestVTableValue.py8
11 files changed, 140 insertions, 28 deletions
diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index bf19a990cf6e..bf043c795fac 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -335,13 +335,22 @@ class CommandLineCompletionTestCase(TestBase):
)
def test_settings_show_term(self):
- self.complete_from_to("settings show term-", "settings show term-width")
+ self.complete_from_to("settings show term-w", "settings show term-width")
def test_settings_list_term(self):
- self.complete_from_to("settings list term-", "settings list term-width")
+ self.complete_from_to("settings list term-w", "settings list term-width")
+
+ def test_settings_show_term(self):
+ self.complete_from_to("settings show term-h", "settings show term-height")
+
+ def test_settings_list_term(self):
+ self.complete_from_to("settings list term-h", "settings list term-height")
+
+ def test_settings_remove_term(self):
+ self.complete_from_to("settings remove term-w", "settings remove term-width")
def test_settings_remove_term(self):
- self.complete_from_to("settings remove term-", "settings remove term-width")
+ self.complete_from_to("settings remove term-h", "settings remove term-height")
def test_settings_s(self):
"""Test that 'settings s' completes to ['set', 'show']."""
diff --git a/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py b/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
index 725e5d4722dd..9852df883ff2 100644
--- a/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
+++ b/lldb/test/API/functionalities/conditional_break/TestConditionalBreak.py
@@ -10,7 +10,7 @@ from lldbsuite.test import lldbutil
# rdar://problem/8532131
# lldb not able to digest the clang-generated debug info correctly with respect to function name
#
-# This class currently fails for clang as well as llvm-gcc.
+# This class currently fails for clang.
class ConditionalBreakTestCase(TestBase):
diff --git a/lldb/test/API/functionalities/data-formatter/bytecode-summary/Makefile b/lldb/test/API/functionalities/data-formatter/bytecode-summary/Makefile
new file mode 100644
index 000000000000..c9319d6e6888
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/bytecode-summary/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/bytecode-summary/TestBytecodeSummary.py b/lldb/test/API/functionalities/data-formatter/bytecode-summary/TestBytecodeSummary.py
new file mode 100644
index 000000000000..2b27bd3cdcda
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/bytecode-summary/TestBytecodeSummary.py
@@ -0,0 +1,17 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+ @skipUnlessDarwin
+ def test(self):
+ self.build()
+ if self.TraceOn():
+ self.expect("log enable -v lldb formatters")
+ lldbutil.run_to_source_breakpoint(
+ self, "break here", lldb.SBFileSpec("main.cpp")
+ )
+ self.expect("v x", substrs=["(MyOptional<int>) x = None"])
+ self.expect("v y", substrs=["(MyOptional<int>) y = 42"])
diff --git a/lldb/test/API/functionalities/data-formatter/bytecode-summary/main.cpp b/lldb/test/API/functionalities/data-formatter/bytecode-summary/main.cpp
new file mode 100644
index 000000000000..35406acd6d0c
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/bytecode-summary/main.cpp
@@ -0,0 +1,43 @@
+// A bare-bones llvm::Optional reimplementation.
+
+template <typename T> struct MyOptionalStorage {
+ MyOptionalStorage(T val) : value(val), hasVal(true) {}
+ MyOptionalStorage() {}
+ T value;
+ bool hasVal = false;
+};
+
+template <typename T> struct MyOptional {
+ MyOptionalStorage<T> Storage;
+ MyOptional(T val) : Storage(val) {}
+ MyOptional() {}
+ T &operator*() { return Storage.value; }
+};
+
+void stop() {}
+
+int main(int argc, char **argv) {
+ MyOptional<int> x, y = 42;
+ stop(); // break here
+ return *y;
+}
+
+// Produced from the assembler in
+// Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/formatter.py
+__attribute__((used, section("__DATA_CONST,__lldbformatters"))) unsigned char
+ _MyOptional_type_summary[] =
+ "\x01" // version
+ "\xa4" // record size
+ "\x01" // record size
+ "\x10" // type name size
+ "^MyOptional<.+>$" // type name
+ "\x00" // flags
+ "\x00" // sig_summary
+ "\x8d" // program size
+ "\x01" // program size
+ "\x1\x22\x7Storage#\x12\x60\x1,C\x10\x1\x5\x11\x2\x1\x22\x6hasVal#"
+ "\x12\x60\x1,\x10\x1e\x2\x22\x1b<could not read MyOptional>\x10G#!\x60 "
+ "\x0P\x10\x6\x22\x4None\x10\x36\x1#\x15\x60 "
+ "\x0#\x16\x60\x5\x22\x5value#\x12\x60\x5#\x17\x60\x1,"
+ "\x10\x6\x22\x4None\x10\x11\x1#\x0\x60\x1#R\x60\x10\x3# "
+ "\x60\x10\x1\x2\x12\x12\x12\x12"; // summary function
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
index 6fa15d9e5ee6..644529b1c451 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
@@ -67,7 +67,7 @@ class CppDataFormatterTestCase(TestBase):
)
# gcc4.2 on Mac OS X skips typedef chains in the DWARF output
- if self.getCompiler() in ["clang", "llvm-gcc"]:
+ if self.getCompiler() in ["clang"]:
self.expect(
"frame variable",
patterns=[
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py b/lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
index aac18e13bf54..2c0a89f98399 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
@@ -157,27 +157,6 @@ class SkipSummaryDataFormatterTestCase(TestBase):
],
)
- # Bad debugging info on SnowLeopard gcc (Apple Inc. build 5666).
- # Skip the following tests if the condition is met.
- if self.getCompiler().endswith("gcc") and not self.getCompiler().endswith(
- "llvm-gcc"
- ):
- import re
-
- gcc_version_output = system([[lldbutil.which(self.getCompiler()), "-v"]])
- self.trace("my output:", gcc_version_output)
- for line in gcc_version_output.split(os.linesep):
- m = re.search("\(Apple Inc\. build ([0-9]+)\)", line)
- self.trace("line:", line)
- if m:
- gcc_build = int(m.group(1))
- self.trace("gcc build:", gcc_build)
- if gcc_build >= 5666:
- # rdar://problem/9804600"
- self.skipTest(
- "rdar://problem/9804600 wrong namespace for std::string in debug info"
- )
-
# Expand same expression, skipping 3 layers of summaries
self.expect(
"frame variable data1.m_child1->m_child2 --show-types --no-summary-depth=3",
diff --git a/lldb/test/API/functionalities/data-formatter/embedded-summary/Makefile b/lldb/test/API/functionalities/data-formatter/embedded-summary/Makefile
new file mode 100644
index 000000000000..c9319d6e6888
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/embedded-summary/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/embedded-summary/TestEmbeddedTypeSummary.py b/lldb/test/API/functionalities/data-formatter/embedded-summary/TestEmbeddedTypeSummary.py
new file mode 100644
index 000000000000..21b21ea760e7
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/embedded-summary/TestEmbeddedTypeSummary.py
@@ -0,0 +1,13 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+ @skipUnlessDarwin
+ def test(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
+ self.expect("v player", substrs=['"Dirk" (41)'])
+ self.expect("v layer", substrs=['"crust" (3)'])
diff --git a/lldb/test/API/functionalities/data-formatter/embedded-summary/main.c b/lldb/test/API/functionalities/data-formatter/embedded-summary/main.c
new file mode 100644
index 000000000000..3273c1e38a2a
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/embedded-summary/main.c
@@ -0,0 +1,43 @@
+void puts(const char *);
+
+#define LLDBSUMMARY __attribute__((section("__TEXT,__lldbsummaries"), used))
+
+struct Player {
+ char *name;
+ int number;
+};
+
+LLDBSUMMARY unsigned char _Player_type_summary[] =
+ "\x01" // version
+ "\x25" // record size
+ "\x07" // type name size
+ "Player\0" // type name
+ "\x1c" // summary string size
+ "${var.name} (${var.number})"; // summary string
+
+struct Layer {
+ char *name;
+ int number;
+};
+
+LLDBSUMMARY unsigned char _padding[] = "\x00\x00";
+
+// Near copy of the record for `Player`, using a regex type name (`^Layer`).
+LLDBSUMMARY unsigned char _Layer_type_summary[] =
+ "\x01" // version
+ "\x25" // record size
+ "\x07" // type name size
+ "^Layer\0" // type name
+ "\x1c" // summary string size
+ "${var.name} (${var.number})"; // summary string
+
+int main() {
+ struct Player player;
+ player.name = "Dirk";
+ player.number = 41;
+ struct Layer layer;
+ layer.name = "crust";
+ layer.number = 3;
+ puts("break here");
+ return 0;
+}
diff --git a/lldb/test/API/functionalities/vtable/TestVTableValue.py b/lldb/test/API/functionalities/vtable/TestVTableValue.py
index bfc910614afa..f0076ea28f75 100644
--- a/lldb/test/API/functionalities/vtable/TestVTableValue.py
+++ b/lldb/test/API/functionalities/vtable/TestVTableValue.py
@@ -2,7 +2,6 @@
Make sure the getting a variable path works and doesn't crash.
"""
-
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.decorators import *
@@ -142,7 +141,12 @@ class TestVTableValue(TestBase):
"\x01\x01\x01\x01\x01\x01\x01\x01" if is_64bit else "\x01\x01\x01\x01"
)
error = lldb.SBError()
- process.WriteMemory(vtable_addr, data, error)
+ bytes_written = process.WriteMemory(vtable_addr, data, error)
+
+ self.assertSuccess(error)
+ self.assertGreater(
+ bytes_written, 0, "Failed to overwrite first entry in vtable"
+ )
scribbled_child = vtable.GetChildAtIndex(0)
self.assertEqual(