Xcode 4: debugging does not highlight current line in source code
I just reinstalled Xcode 4 from the App Store, but still the same issue:
When the debugger hits a break point the program stops and shows the stack trace. However, the line in the source code is not highlighted.
I tried clicking on various entries in the stack trace and stepped through the code - no highlighting.
EDIT:
I think I found the reason (but not solution yet): I have organized the source files into sub-directories. Each sub-directory is mapped to a group in Xcode. I bet Xcode checks only the project directory for source files not sub-directories.
My layout:
./Project Dir
Classes/
Group1/
Class.m
Group2/
AnotherClass.m
...
EDIT 2:
I just noticed that the debugger does highlight the line in main.m
, but not in any other source file.
You can click on the sign in order to hight the line:
click
Finally found it. Culprit was this line in the source file:
#line __LINE__ "MainController.m"
Turns out that this confuses Xcode and I assume because of that Xcode won't find the file anymore to highlight the current line of a breakpoint.
The purpose of the preprocessor definition was to shorten log statements, which would contain the full path to the file in log statements when using the __FILE__
macro.
精彩评论