简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM