summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py9
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/enum_types/main.c11
2 files changed, 19 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py b/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
index b0c5c882f6a..3e0f7422674 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
@@ -63,7 +63,14 @@ class EnumTypesTestCase(TestBase):
'Sunday',
'kNumDays',
'5'];
-
+
+ # Make sure a pointer to an anonymous enum type does crash LLDB and displays correctly using
+ # frame variable and expression commands
+ self.expect('frame variable f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', 'f.op', '0x0000000000000000'])
+ self.expect('frame variable *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops', '*f.op', '<parent is NULL>'])
+ self.expect('expr f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', '$', '0x0000000000000000'])
+ self.expect('expr *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['error:'], error = True)
+
bkpt = self.target().FindBreakpointByID(bkpt_id)
for enum_value in enum_values:
self.expect("frame variable day", 'check for valid enumeration value',
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/main.c b/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
index 3d59654eff6..be0fa57d0b7 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/enum_types/main.c
@@ -8,6 +8,15 @@
//===----------------------------------------------------------------------===//
#include <stdio.h>
+#include <stdio.h>
+
+// Forward declare an enumeration (only works in C, not C++)
+typedef enum ops ops;
+
+struct foo {
+ ops *op;
+};
+
int main (int argc, char const *argv[])
{
enum days {
@@ -21,6 +30,8 @@ int main (int argc, char const *argv[])
kNumDays
};
enum days day;
+ struct foo f;
+ f.op = NULL;
for (day = Monday - 1; day <= kNumDays + 1; day++)
{
printf("day as int is %i\n", (int)day); // Set break point at this line.
OpenPOWER on IntegriCloud