RajV
RajV

Reputation: 7160

Can not view variable values in debugger after Swift 3 migration

We have migrated our iOS project to Swift 3 and Xcode 8. Since then the debugger can not show any value of variables. If I try to print a variable:

p someVar

I get this error message. SchemaManager.h is a bridging header. (The actual project name has been replaced with yyy below):

warning: Swift error in module yyy.
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module 'yyy' from AST context:
/Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: note: while building module 'SQLiteMacOSX' imported from /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:
#import <sqlite3.h>
        ^

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:10: note: while building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:
#include <stdarg.h>     /* Needed for the definition of va_list */
         ^

<module-includes>:33:9: note: in file included from <module-includes>:33:
#import "util.h"
        ^

error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/util.h:107:10: error: 'utmp.h' file not found with <angled> include; use "quotes" instead
#include <utmp.h>
         ^

/Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: note: while building module 'SQLiteMacOSX' imported from /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:
#import <sqlite3.h>
        ^

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h"
        ^

error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:10: error: could not build module 'Darwin'
#include <stdarg.h>     /* Needed for the definition of va_list */
         ^

/Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h:12:9: note: in file included from /Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h:12:
#import "SchemaManager.h"
        ^

error: /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: error: could not build module 'SQLiteMacOSX'
#import <sqlite3.h>
        ^

error: failed to import bridging header '/Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h'

The core error boils down to this:

error: 'utmp.h' file not found

I have read elsewhere that problems in bridging header can stop the debugger from showing variable values. But I am not sure how I go about fixing this particular issue.

Upvotes: 6

Views: 1123

Answers (1)

Troy
Troy

Reputation: 5399

TLDR; Clean out your bridging header and make sure you have only what you need.

I was having the same problem, but with no output after the failed to get module 'yyy' from AST context. I removed everything from my bridging header and added items back one-by-one to be sure I needed everything.

I found that adding #import <UIKit/UIKit.h> at the top was necessary (but originally missing) and found a few that I didn't need as I changed my project structure and forgot to remove some of the includes. After all that, it started working. Hopefully this helps.

Upvotes: 1

Related Questions