5

I am developing an OpenCV application and I need to debug my code (Visual studio 2010, opencv with cmake).

I would like to debug line by line to see where exactly my app crashes. I am trying to use F11 the problem is that F11 shows me external code (opencv libraries, std libraries etc).

Is there any other way to don't put lots of breakpoint all over my code?

 int main(void) {
    vector<int> myVec;
    myVec.push_back(1);
    //> Do other stuff
 }

If I try F11 with this code, visual studio will debug the vector library files too, and I want to avoid that. I just want to follow the flow of the code inside my main();

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
dynamic
  • 46,985
  • 55
  • 154
  • 231
  • 1
    Why don't you just let it crash and then look at the call stack? – Bart Aug 16 '12 at 15:51
  • 1
    I understand what you're asking, but maybe a small code snippet that illustrates it would help others? I would be interested in this if it were possible, but I doubt it is. (though to add it, the debugger would just ignore stepping into header files included with `<>` (and only step into ones included with `""`)... doubt a debugger does this though) – Cornstalks Aug 16 '12 at 15:56
  • @Cornstalks: i have added a snippet, but I think the question is clear enough now – dynamic Aug 16 '12 at 16:01
  • 1
    the following post describes how to avoid stepping into STL code. Maybe this is what you want: http://stackoverflow.com/questions/5334414/auto-skip-stl-functions-during-step-by-step-debugging-in-msvc2010 – codencandy Aug 16 '12 at 16:41
  • @HolgerKretzschmar: that's interesting... But I can't believe that for such basic feature we need to edit registry – dynamic Aug 17 '12 at 09:14

2 Answers2

2

Hi as already mentioned in my comment in VS2010 the only way to avoid stepping into STL code is to modify a registry key, as described in this post.

With VS2012 there is another way by using Visualizers.

Community
  • 1
  • 1
codencandy
  • 1,701
  • 1
  • 10
  • 20
0

You cannot go into external code (unless maybe showing it as assembly).

You should use F10 to step to the next instead of going inside such a function. You also can use Shift + F11 to return to the next line (after the current function), if you are inside such external function code.

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
Michel Keijzers
  • 15,025
  • 28
  • 93
  • 119
  • 1
    external code I meant file like: vector, xmemory, new.cpp, dbgmalloc.c and others that are showing up – dynamic Aug 16 '12 at 15:54
  • 2
    I think his problem is doing something like trying to step into `myFunc("string")`. Hitting F11 will first take you into the `std::string` constructor (assuming that's what `myFunc()` takes). – Cornstalks Aug 16 '12 at 15:54
  • @Cornstalks: yea you got the point, I would avoid to debug up to that files – dynamic Aug 16 '12 at 15:56