summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/c
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/c')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c12
3 files changed, 18 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile b/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
new file mode 100644
index 00000000000..cd9ca5c86d8
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py b/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
new file mode 100644
index 00000000000..1311a149326
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c b/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
new file mode 100644
index 00000000000..cbb4a144418
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
@@ -0,0 +1,12 @@
+#include <stdint.h>
+
+struct Foo {
+ int8_t a;
+ int16_t b;
+};
+
+int main (int argc, char const *argv[]) {
+ struct Foo f;
+ return f.a; //% self.expect("expr offsetof(Foo, a)", substrs = ['= 0'])
+ //% self.expect("expr offsetof(Foo, b)", substrs = ['= 2'])
+}
OpenPOWER on IntegriCloud