3

Is there a Visual Studio macro (either for version 2008 or 2010) to set a breakpoint on the start of every method in a class?

I've seen hints of references, but I've not been able to dig an actual one out.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Tim Barrass
  • 4,813
  • 2
  • 29
  • 55
  • possible duplicate of [How do I set a breakpoint on every access to a class](http://stackoverflow.com/questions/3565694/how-do-i-set-a-breakpoint-on-every-access-to-a-class) – sloth Oct 02 '13 at 08:32

3 Answers3

2

A Visual Studio extension named OzCode does have a feature to set/unset breakpoints on all members of a class. I use this extension a lot, as it has some very nice debugging enhancements.

Admittedly though, I haven't used the set/unset breakpoint feature much, but it's an option for you.

Jason Evans
  • 28,906
  • 14
  • 90
  • 154
1

There are some good ideas here: How to put breakpoint in every function of .cpp file?

Community
  • 1
  • 1
David Airapetyan
  • 5,301
  • 4
  • 40
  • 62
  • Thanks :) That's actually the same link Corey shared above in his comments -- but ta. Welcome to StackOverflow! – Tim Barrass Jul 09 '11 at 14:37
0

Wouldn't you be better off just single-stepping through your source code?

I can't imagine why a breakpoint at the start of every method would be any better than single-stepping. You're going to end up breaking everywhere anyway, and single-stepping provides the additional advantage of showing you the logical flow of your code paths.

You'll probably definitely want to learn the keyboard shortcut keys, but they can depend on how you have your VS environment set up. Look in your "Debug" menu for the "Step Over" and "Step Into" items. (Normally, Step Over is F10 and Step Into is F11.) The only difference is that, if the currently highlighted line contains a function call, Step Into will allow you to single-step through the code in the called function (this is probably most like what you want to do), while Step Over will simply call the function and stop on the next line in the current function.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 1
    Not when you're dealing with a codebase of any significant size; even using the shortcut keys just wastes time when I know I want to drop into a certain class, but am not sure where it's going to be. – Tim Barrass Dec 09 '10 at 09:53
  • 1
    @Tim Barrass: Understood. You didn't specify what language you're using (I think whatever macro you use for this is probably going to be language dependent, given the need to search for a token indicating the start of a new method), but you might investigate the top-rated answer to [this](http://stackoverflow.com/questions/160030/how-to-put-breakpoint-in-every-function-of-cpp-file) question. – Cody Gray - on strike Dec 09 '10 at 10:00
  • By the way -- I jsut want to clarify that this is for a single class, not for the whole codebase -- your answer suggests that you read it as being for every method call in the codebase. – Tim Barrass Dec 09 '10 at 10:00
  • hey -- no complete joy getting that working, but the shape's right, cheers for the redirect. If I happen to get a C# specific macro up and running (it's not that hard, time just tight) will post here anyhow. – Tim Barrass Dec 12 '10 at 21:22
  • No you wouldn't. GDB has a feature to put a breakpoint on a file.GDB is free. Visual studio costs money and this feature doesn't seem to exist. Why is paid for software, useless? – Owl Jun 16 '17 at 13:34