Alex Rivera | Logout

How to put breakpoint in every function of .cpp file?

Asked 2008-10-01T22:20:37.750
14

Is there a macro that does it? Which DTE objects to use?

Edit
Report

2 Answers

18

(This is not quite what you're asking for, but almost:)

You can put a breakpoint on every member function of a class in Visual Studio by bringing up the New Breakpoint dialog and entering:

CMyClass::*

See Link for more details.

answered 2010-07-30T10:29:21.787
-1

Put this at the top of the file:

#define WANT_BREAK_IN_EVERY_FUNCTION

#ifdef WANT_BREAK_IN_EVERY_FUNCTION
#define DEBUG_BREAK DebugBreak();
#else
#define DEBUG_BREAK 
#endif

then insert DEBUG_BREAK in the beginning of every function, like this:

void function1()
{
    DEBUG_BREAK
    // the rest of the function
}

void function2()
{
    DEBUG_BREAK
    // the rest of the function
}

When you no longer want the debug breaks, comment the line

// #define WANT_BREAK_IN_EVERY_FUNCTION

at the top of the file.

answered 2008-10-02T03:59:37.593

Your Answer