-
Debugging into functions
I've just successfully set up my debug enviroment and everything seems to work fine, except that I can't step into functions or set breakpoints inside functions called in another #included file. For example, in file.h, I have function doSomething() declared and defined. In main.cpp I #include "file.h" and set a breakpoint on doSomething(). When it gets bp'ed I try stepping into the function but it just steps over it!! I need to see what's going on with the variables, etc. that are initialized in the function!
Is there anything I'm doing wrong???
thanks in advance
p.s. I'm using Visual Studio 2005 Express
-
Is the function actually being called?
-
yeah, and when I set a breakpoint on it it stops there, i just want to be able to step in it and see what's going on each step.
-
Are you sure you're doing step into (F11) instead of step over (F10)?
-
yeah positive. Here's a code snippet of my program:
begin.cpp
Code:
#include "defs.h"
int begin()
{
doSomething(); //bp set
} //this calls all of my functions in defs.h
defs.h
Code:
void doSomething();
...
void doSomething()
{
...
}//declares and defines doSomething
Now, I can set a breakpoint in begin.cpp AT my function call, but not in defs.h INSIDE my function definition. Also when I reach my function call I cannot step into it with F11.
-
Perhaps off topic, but shouldn't you really define the function inside a .cpp file?
-
Maybe the compiler is inlining your function for some reason? Make sure all optimization is turned off, debugging is turned on, and move the function definition to a .cpp file instead of a header file, and see if that works.
-
Hey, I reorganized everything, hoping it was a stupid error. Unfortunately it's not, but I'm gonna upload the code if u guys wanna check it out. but now it's really organized and pretty :)
http://rapidshare.de/files/37999206/myProg.rar.html because my program is 7 files.
-
I've never seen Visual Studio fail to step into a function that was within it' scope (IE: not in a DLL, lib, etc). What service pack do you have? There were some early bugs related to this. I'm not sure if Express qualifies for service packs but I seem to remember there being one available for it. I could be wrong.
Sometimes when you mix mash DLL's Visual Studio will jump to the wrong function but it's not a Visual Studio problem it's a DLL problem.