Here's an example as best as I can describe it. If I set a breakpoint on line 2 the debugger actually stops there - no problem. If I then click on Next Line in the debugger menu, you would expect it to go to Line 3, right? But the file stl_iterator.h opens and I'm on line 603:
__normal_iterator(const _Iterator& __i) : _M_current(__i) { }
Next line then goes to line 666 in this file. Next Line then opens stl_vector.h at line 375. Next Line then ends up in my code corresponding to the call from line 194. Next Line then goes to line 195. I then make excursions through stl_iterator.h, stl_vector.h, new_allocator.h, basic_string.h.
If I then put a breakpoint on line 241, it is ignored. Also, a breakpoint on line 245 is ignored despite the fact that the conditional on line 241 is guaranteed to succeeed.
To get the debugger to stop on line 245, I have to stop the debugger, clear higher breakpoints, put a breakpoint on line 245, and restart in Debug mode. Next Line then follows this sequence of lines: 245, 246, 251, 245, 251, 252, another .h file of mine UNRELATED to Line 252 and not having any breakpoints set, 251, yet another file of mine with no breakpoints set, 252, a long excursion thorugh other files of mine unrelated to line 252, and eventually settling on line 81.
What is going on here???
1 PowerUpControllers = *(m_pWorld->GetPowerUpControllers());
2 for (index = 0; index < PowerUpControllers.size(); index++)
3 {
4 if ( Params.GetLongParam("PowerUpXY") == 1 )
5 {
6 PowerUpControllers.at(index)->GetPosition(X,Y);
7 inputs.push_back(X/16);
8 inputs.push_back(Y/16);
9 }
10 if ( Params.GetLongParam("PowerUpState") == 1 )
11 {
12 PowerUpControllers.at(index)->GetState(state);
13 inputs.push_back(state);
14 }
15 }
16
17 m_pWorld->GetPacManController()->GetPosition(X,Y);
18 if ( Params.GetLongParam("PacManXY") == 1 )
19 {
20 inputs.push_back(X/16);
21 inputs.push_back(Y/16);
22 }
23
24 if ( Params.GetLongParam("CheckForWalls") == 1 )
25 {
26 if ( m_pWorld->GetMazeController()->CheckMapByPixels(X,X+31,Y-8,(Y-8)+31) )
27 inputs.push_back(0); //nothing in the up direction
28 else
29 inputs.push_back(1); //a wall is in the way
30
31 if ( m_pWorld->GetMazeController()->CheckMapByPixels(X,X+31,Y+8,(Y+8)+31) )
32 inputs.push_back(0); //nothing in the down direction
33 else
34 inputs.push_back(1); //a wall is in the way
35
36 if ( m_pWorld->GetMazeController()->CheckMapByPixels(X-8,(X-8)+31,Y,Y+31) )
37 inputs.push_back(0); //nothing in the left direction
38 else
39 inputs.push_back(1); //a wall is in the way
40
41 if ( m_pWorld->GetMazeController()->CheckMapByPixels(X+8,(X+8)+31,Y,Y+31) )
42 inputs.push_back(0); //nothing in the right direction
43 else
44 inputs.push_back(1); //a wall is in the way
45 }
46
47 //use the starting variables to limit the number of times we check the dot content
48 if ( Params.GetLongParam("CheckDots") == 1 )
49 {
50 if ( abs(StartingX - X) > 32 || abs(StartingY - Y) > 32 )
51 {
52 StartingX = X;
53 StartingY = Y;
54
55 //only update the number of dots every 8 steps
56 //profiling suggested this would be a good place to save computation time
57 rct.top = 0;
58 rct.bottom = (Y+31)/16;
59 rct.left = 0;
60 rct.right = m_pWorld->GetDotController()->GetWidth()-1;
61 DotsUp = m_pWorld->GetDotController()->CountTilesOfType(rct, 1);
62
63 rct.top = (Y/16);
64 rct.bottom = m_pWorld->GetDotController()->GetHeight()-1;
65 DotsDown = m_pWorld->GetDotController()->CountTilesOfType(rct, 1);
66
67 rct.top = 0;
68 rct.right = (X+31)/16;
69 DotsLeft = m_pWorld->GetDotController()->CountTilesOfType(rct, 1);
70
71 rct.left = (X/16);
72 rct.right = m_pWorld->GetDotController()->GetWidth()-1;
73 DotsRight = m_pWorld->GetDotController()->CountTilesOfType(rct, 1);
74 }
75
76 //push the number of dots in
77 inputs.push_back( DotsUp );
78 inputs.push_back( DotsDown );
79 inputs.push_back( DotsLeft );
80 inputs.push_back( DotsRight );
81 }