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/modules/TestCModules.py14
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c4
2 files changed, 16 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py b/lldb/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
index 455704280d1..857223b5ed1 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
@@ -47,6 +47,10 @@ class CModulesTestCase(TestBase):
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
substrs=[' resolved, hit count = 1'])
+ # Enable logging of the imported AST.
+ log_file = os.path.join(self.getBuildDir(), "lldb-ast-log.txt")
+ self.runCmd("log enable lldb ast -f '%s'" % log_file)
+
self.expect(
"expr -l objc++ -- @import Darwin; 3",
VARIABLES_DISPLAYED_CORRECTLY,
@@ -54,6 +58,8 @@ class CModulesTestCase(TestBase):
"int",
"3"])
+ # This expr command imports __sFILE with definition
+ # (FILE is a typedef to __sFILE.)
self.expect(
"expr *fopen(\"/dev/zero\", \"w\")",
VARIABLES_DISPLAYED_CORRECTLY,
@@ -61,6 +67,14 @@ class CModulesTestCase(TestBase):
"FILE",
"_close"])
+ # Check that the AST log contains exactly one definition of __sFILE.
+ f = open(log_file)
+ log_lines = f.readlines()
+ f.close()
+ os.remove(log_file)
+ self.assertEqual(" ".join(log_lines).count("struct __sFILE definition"),
+ 1)
+
self.expect("expr *myFile", VARIABLES_DISPLAYED_CORRECTLY,
substrs=["a", "5", "b", "9"])
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c b/lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
index 2b244bc38d0..df321a75faa 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/modules/main.c
@@ -5,11 +5,11 @@ int printf(const char * __restrict format, ...);
typedef struct {
int a;
int b;
-} FILE;
+} MYFILE;
int main()
{
- FILE *myFile = malloc(sizeof(FILE));
+ MYFILE *myFile = malloc(sizeof(MYFILE));
myFile->a = 5;
myFile->b = 9;
OpenPOWER on IntegriCloud