0

I am trying to step through a C project (fossil-scm) that has a 2-phase pre-processing stage.

First there is a custom built pre-processing program, that goes through the files and fixes certain project-specific macros, creates the include headers, and a few other things. It creates a bunch of .c and .h files. The result is then compiled as usual, passing through the "regular" pre-processor.

I took the result from the first part and created a visual-studio project from it. When I tried to debug it, it was skipping my breakpoints. I found that every file begins with a

#line 1 "src/original_filename.c"

I can comment out this line and get debugging to work, but I would rather use this line to get debugging in the original context.

So...
How can I set it up so that it compiles the processed files, but uses the #line directives to give me debugging capabilities in the original files?
I tried just placing the src directory next to the files, and it works if I start the program by pressing F10, but I don't know how to get the original files into the project explorer so that I can easily open them and place breakpoints without the compiler trying to compile them.

4

1 回答 1

1

From my experiments with Visual Studio 2012 (2010 might behave similarly), setting breakpoints in the "original" source files (source files referenced by #line directives in the "real" source files) only works correctly if:

1) I add the "original" source files to the project. (E.g. Add -> Existing Item...)

2) I exclude the "original" source files from build. (E.g. Right-Click -> Properties -> Exclude from Build = Yes)

A bit of a late answer, but I hope this helps someone.

于 2013-05-17T20:12:50.300 回答