views:

28

answers:

1

Hi,

I've a visual C++ project I'd like to debug. However, several functions are actually generated by macro expansion ( like set##Name for a particular property). So, while debugging I can't follow the execution flow inside these generated functions.

Do I have to use the /P flag and then debug the preprocessed code ?

thanks for the help...

+2  A: 

You would have to preprocess the code using the /P flag in some other project (or on the command line, if you fancy spelling out all the include and library folders), and then compile this preprocessed code instead of the source file in your real project. Then you can debug through it.

That said, once you're at it, can't you eliminate the macros? With const, inline, and templates, I rarely ever feel the need to resort to macros, and if I do, it's usually very small, isolated pieces of code. These are either too trivial to need debugging, or I manually replace one instance of the macro with the code it generates and debug that. (However, this might have happened to me thrice in the last decade.)

sbi
ok, i'm going to try this option. I didn't want to but it seems that i have no choice. I can't eliminate the macros, I've access to the code but i don't have the credentials to modify it.
LB