Problem VS 2013 debugger problem

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,883
Reaction score
2,135
Points
203
Location
between the planets
This really has nothing to do with Orbiter per se, but I'm kind of afraid they'd just put me in a looney bin on stack overflow. I'm close to puting myself there, to be honest.

I have a completely baffling problem where my debuger takes very wierd and frankly impossible path through the program when I break into it and then walk step by step.

Specifically, if I do a step by step debugging, at a certain point (always the same point, mind you) the debugger arrives at the head of a constructor, then jumps over the whole constructor (while still executing the constructor in the base class), then jumps over the destructor, and then just goes on walk through the lines "between the code" until it arrives at the next function, starts to execute it, but jumps back to the first line of the constructor when passing the first line of that function (the line is NOT executed, it even does that if there's a comment or nothing there).

I'm completely baffled as to what could cause such behavior. I've never seen anything like it. Here's some code just to show you that it's not completely screwed up:

Code:
IMS_Animation_Tracking::IMS_Animation_Tracking(ANIMATIONDATA *_data) : IMS_Animation_Base(_data)        //<-- the debugger arrives here when I step into the function from where it's called. The constructor of the base class is executed, but the next line in this class executed is two lines after the closing bracket
{
	//debug
	Helpers::writeToLog(string("DEBUG: TrackingAnimation Constructor called"));
	//take the type name appart and extract the facing
	vector<string> typetokens;
	Helpers::Tokenize(data->type, typetokens, " ");
	facing = _V(atof(typetokens[1].data()), atof(typetokens[2].data()), atof(typetokens[3].data()));
}

//<-- after the head of the constructor the debugger jumps here, and then jumps again to after the destructor
IMS_Animation_Tracking::~IMS_Animation_Tracking()
{
}

//<-- The debugger jumps immediately here from the last line it's been, then continues linearly down the file, including the comments
// the tracking animation needs quite a bit of a different aproach, because technically, it's two animations, and they behave a bit differently
//from the usual and require additional data.
void IMS_Animation_Tracking::AddAnimationToVessel(IMS2 *_vessel, int _meshindex, MATRIX3 moduleorientation, VECTOR3 modulelocalpos)
{
//<-- The debugger jumps back to the first line of the constructor when stepping away from this line, no matter what is here
.
.
.
}

It's the first time I'm running the debugger after upgrading to Win10, but I don't expect that to have anything to do with anything. I have rebuilt the project to make sure there wasn't any corruption going on. For all intents and purposes, the VS debugger seems to be going insane on me. Anyone has ever experienced anything like this?
 
Last edited:

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,932
Reaction score
2,944
Points
188
Website
github.com
Are you using the debug configuration (without optimizations)?
Also, does the code do what you expect it to do?
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
Specifically, if I do a step by step debugging, at a certain point (always the same point, mind you) the debugger arrives at the head of a constructor, then jumps over the whole constructor (while still executing the constructor in the base class), then jumps over the destructor, and then just goes on walk through the lines "between the code" until it arrives at the next function, starts to execute it, but jumps back to the first line of the constructor when passing the first line of that function (the line is NOT executed, it even does that if there's a comment or nothing there).

I know such weird behavior only from version mismatches between source code and loaded binaries. I.e.: the binary you are debugging is not the same version as the code you are using, thus the PDB line points to a (now) completely different position, which could be quite easily "between the code".

Check if the DLLs you are loading correspond to the source files you get displayed.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,883
Reaction score
2,135
Points
203
Location
between the planets
Are you using the debug configuration (without optimizations)?

Yes.

Also, does the code do what you expect it to do?

Not 100% of course, otherwise I wouldn't need to debug it, now would I? :lol:
However, the bug I'm hunting is minuscle and hidden somewhere in some tiny detail, the overall structure is quite complex and works perfectly.


I know such weird behavior only from version mismatches between source code and loaded binaries.

Huh... I wasn't even aware that was possible. Usually in that case the breakpoints don't trigger at all, but it's worth checking into. It would certainly explain a thing or two...
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
Huh... I wasn't even aware that was possible. Usually in that case the breakpoints don't trigger at all, but it's worth checking into. It would certainly explain a thing or two...

You are right, that shouldn't be possible. However, I had it here and there, and one sure-fire sign to spot that is to see F10 steppings highlighting lines "between the code". After I had ensured that the binaries loaded (and the PDBs in the same directory!) are created from the source code at hand, everything worked as it should.

Found something about it on SO: http://stackoverflow.com/questions/...-the-wrong-source-file-or-multiple-files-simu
 
Last edited:

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,883
Reaction score
2,135
Points
203
Location
between the planets

Hmmm, none of those seem to apply... I also cleared out all built objects in the working and intermediate directory and rebuilt, behavior is still the same.

I've maped the thing with log messages, and it very much seems to be going the way it's supposed to. Lines that are walked over by the debugger that are not actually in the program flow don't seem to get executed either. I Even found and fixed the bug I was looking for when noticing this and everything works a ok.
It really looks as if just the debugger is bugging out on me. Go figure...
 
Top