Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 590
Mick Avatar asked Apr 19 '10 12:04

Mick


People also ask

How do I debug a macro in Visual Studio?

Open up a source file from your manage project in Visual Studio and set a breakpoint on a line. Start debugging in Visual Studio by pressing F5. In Excel, open up your worksheet and start debugging your VBA code using Excel's debugger.

How to View Disassembly in Visual Studio?

To enable the Disassembly window, under Tools > Options > Debugging, select Enable address-level debugging. To open the Disassembly window during debugging, select Windows > Disassembly or press Alt+8.

How to View Disassembly in Visual Studio code?

To open Disassembly View while debugging, right click your source code and select Open Disassembly View. In the Disassembly View, the yellow hollow marker represents the current instruction.

What are GDB macros?

In addition to source files, macros can be defined on the compilation command line using the -D name = value syntax. For macros defined in such a way, gdb displays the location of their definition as line zero of the source file submitted to the compiler.


1 Answers

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.

like image 144
sharptooth Avatar answered Sep 30 '22 19:09

sharptooth