Mick
Mick

Reputation: 7947

View macro expanded version of source while debugging

I am attempting to debug some C code using the visual studio debugger. I seems my choices are to view the source code or view the the disassembly. But what I would really like to view is the source code with all the macro's expended. Is that also possible?

Upvotes: 6

Views: 1484

Answers (2)

Mark Wilkins
Mark Wilkins

Reputation: 41252

I don't think an option like that is available in Visual Studio. It would probably be necessary to run the preprocessor on the code first and then compile the pre-processed file and use that as the source.

Upvotes: 0

sharptooth
sharptooth

Reputation: 170509

In Visual C++ the best you can have is a preprocessed file (C++ ->Preprocessor->Generate preprocessed file). This will give you a huge file of C++ code with all macros expanded. Still macro expansions will be single lines - no line breaks.

This is one of the reasons why macros are very problematic to use for complicated code and should be avoided unless absolutely necessary.

Upvotes: 6

Related Questions