Xcode does not break into # include'd CPP files

If you include a CPP file from another CPP file, Xcode refuses to break at any breakpoints in the included CPP file. I'm going to raise an error with Apple, but just wanted to mention it here if others have come across this and may have found ways around this.

There are very good reasons why you can include CPP files from CPP files, which I will not include. Suffice it to say that I cannot just rebuild the project to compile the included files directly.

Example: a very simple iPhone project

main.mm

extern void FunctionInSource1( int a ); int main(int argc, char * argv[]) { FunctionInSource1( 1 ); return 0; } 

source1.cpp

 #include "source2.cpp" void FunctionInSource1( int a ) { int b = a; FunctionInSource2( b ); return; } 

source2.cpp

 void FunctionInSource2( int b ) { int c = b; c = c + 1; return; } 

main.mm and source1.cpp are members of the target, that is, they are configured for assembly. source2.cpp is NOT a member of the target and is NOT compiled, except through its inclusion in source1.cpp

Setting a breakpoint anywhere in source2.cpp does not start. Breakpoints elsewhere work fine. Notabene, you can still enter source2.cpp from source1.cpp, for example, just not break directly into source2.cpp

If anyone came up with a solution, I would be very happy to hear about it.

Max

+6
source share
1 answer

Thanks to the answer on the Apple developer forums, I solved this problem.

The compiler embeds these files, and by default LLDB does not split into files with the extension. To make it break, you need to add a parameter to your .lldbinit file.

Modify (or create) the ~ / .lldbinit file and add the following line:

 settings set target.inline-breakpoint-strategy always 

It is so simple!

+14
source

Source: https://habr.com/ru/post/949571/


All Articles