summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorJaroslav Sevcik <jarin@google.com>2020-01-10 11:44:14 +0100
committerRaphael Isemann <teemperor@gmail.com>2020-01-10 11:45:24 +0100
commit902974277d507a149e33487d32e4ba58c41451b6 (patch)
tree6c0a515cb60bdd1e63ce038b2a36bcd35d84777d /lldb/packages/Python/lldbsuite
parentf3849f739e52510871d11361125f0ef239f11603 (diff)
downloadbcm5719-llvm-902974277d507a149e33487d32e4ba58c41451b6.tar.gz
bcm5719-llvm-902974277d507a149e33487d32e4ba58c41451b6.zip
Data formatters: Look through array element typedefs
Summary: Motivation: When formatting an array of typedefed chars, we would like to display the array as a string. The string formatter currently does not trigger because the formatter lookup does not resolve typedefs for array elements (this behavior is inconsistent with pointers, for those we do look through pointee typedefs). This patch tries to make the array formatter lookup somewhat consistent with the pointer formatter lookup. Reviewers: teemperor, clayborg Reviewed By: teemperor, clayborg Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72133
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/Makefile3
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/TestArrayTypedef.py15
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/main.cpp7
3 files changed, 25 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/Makefile
new file mode 100644
index 00000000000..99998b20bcb
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/TestArrayTypedef.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/TestArrayTypedef.py
new file mode 100644
index 00000000000..1f2914ad633
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/TestArrayTypedef.py
@@ -0,0 +1,15 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class ArrayTypedefTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test_array_typedef(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here",
+ lldb.SBFileSpec("main.cpp", False))
+ self.expect("expr str", substrs=['"abcd"'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/main.cpp
new file mode 100644
index 00000000000..5c581b07ace
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/array_typedef/main.cpp
@@ -0,0 +1,7 @@
+typedef char MCHAR;
+
+int main() {
+ MCHAR str[5] = "abcd";
+ return 0; // break here
+}
+
OpenPOWER on IntegriCloud