I am facing a odd behavior of Breakpoints in Visual Studio 2010 Express. Below is the code with breakpoints.
I am able to break at the first breakpoint (Line 159), but stepping after line 160, the cursor vanishes, i.e after this image of code pressing F10/F11 the application is displayed.
The problem is,
Why isn't line 162 executing (Without this statement, asserts fail elsewhere) or breaking at it?
Note : The line 166 Refresh(); is being executed, because the application displayed is updated.
EDIT : On suggestions in comments, I stepped through disassembly, and I found this line (from wxWidgets library) is causing the debug to fail 00D5AF7C call wxCharBuffer::~wxCharBuffer (0D207AAh)
Have you tried stepping through disassembly? With combined assembly-source view you can tell what exactly is going on.
To do that once you hit a breakpoint go to Debug->Windows->Disassembly. Or just click RMB and then "Go to disassembly".
Related
As the pic I show here.
I set a breakpoint at the line
w.show();
However, when I press F5 to debug. It doesn't stop at this line directly.
It stop to other lines in other files which I haven't set breakpoint many times. After that it stop at the line which I have set breakpoint. It is a waste of time. Why debug doesn't stop at breakpoint directly?
I solve my question. Just clear all the breakpoints in all project. Although there is just one breakpoint in my testing project
I'm debugging C++ program compiled with MSVC under Windows.
I want to investigate issue linked with multi threading. So I put ASSERT in my code and when program reaches ASSERT it displays window about ASSERT (Standart [Abort], [Retry], [Ignore] window) with proposal to pause program in debugger. I press [Retry] button and program pauses. BUT while I was pressing the button other threads continue to execute.
So the question is how to immediately stop the program when it reaches some point to see what other threads was doing at that time?
You might want to set a conditional breakpoint instead of using an assert:
In case you want to do it programmatically, use DebugBreak. (C# has an equivalent api System.Diagnostics.Debugger.Break)
In case you want to do it from ide, from the msdn page you can put a breakpoint (or break all the application, ctrl+alt+B) from visual studio and then control the thread execution using "freeze" and "thaw" in the thread window.
I am a beginner with Visual Studio and I am encounting a problem when I am in the Debug Mode.
I did not have this problem at first, and now it happens more and more.
This is what happens :
I am debugging my project and I hit a breakpoint. So I press F5 to continue debugging, and then a new line is inserted just before the line with the breakpoint, and the program continues debugging. Problem is it modifies my code...
The problem does not occur when I press F10 or F11 (but it still happens later when I press F5). And it does not occur everywhere in the code, just with some lines, especially the new ones.
I have tried many things like :
restart VS, clean solution, delete .pdb, make sure I have the good type of linefeed.
Please help me !
:)
Check your Keyboard settings at Tools -> Options -> Environment -> Keyboard.
Try press F5 in Press shortcut keys input and see at "Shortcut currently used by".
In my case there is only "Debug.Start (F5 (Global))".
If you have other commands, try to remove it.
While debugging, if (and only if) i have a break point in my node destructor i get this screen saying:
Source Not Available
Source information is missing from the debug information for this module.
You can view disassembly in the Disassembly window. To always view disassembly for missing source files, change the setting in the Options dialog.
(Here is a picture of the whole screen)
I've looked everywhere on the net and the only "solution" i've found is moving the breakpoint which is not a real solution,
What can i do to fix the issue? Thanks.
(Windows 8.1, Visual Studio 2013)
Here is the code of the destructor which is one step before the screen appears:
MatchmakingAgency::Node::~Node(){
cout << "Deleting: ";
getClient()->printName();
cout << endl;
if (next){
delete next;
}
}
As written in the comments you're stepping into the scalar helping destructor (a helper function set up by Visual Studio for the destructor). You can also see this from the call stack.
Stepping out with Shift+F11 should bring you directly into the destructor's code.
Regarding why this is happening it could be that Visual Studio is breaking into the helper function (glitch?) or that you're entering that function by stepping into it before the actual destructor code gets executed.
If that bothers you you might also take a look at breakpoint macros and see if that helps (try stepping out of the scalar deleting destructor if putting a breakpoint on the first line of the destructor doesn't help)
You can show the stack window (Debug -> Windows -> Call Stack or Ctrl+Alt+C in Visual Studio 2013) and then double-click on a stack frame that is in your code to see where in your code the break is happening.
When I am debugging my program, I often want to make it run from where it is paused to a specific line.
In Xcode 3, I was able to do that by clicking on the button appearing next to the line number when hovering it.
In Xcode 4, it seems to be possible to do that either by right clicking on the line number and select Continue to here, either by using the Debug menu and choose Continue To Current Line item.
However these options are always grayed out when I want to use them.
Note, I don't know if this is relevant but I am using c++
Is there something I am doing wrong?
Thanks in advance,
Kevin
It seems that this is because you are using the LLDB debugger. As the same thing happens to me, whilst using the LLDB debugger and debugging C++ code, as you can see here:
I tested this with Objective-C code, and this feature works perfectly fine whilst debugging Objective-C.
The green button you mentioned, for Xcode 3, also pops-up with Objective-C code (using Xcode 4). As you can see here:
Perhaps it's a bug in Xcode, or Apple just wants you to program in Objective-C. It seems to be only an issue whilst using LLDB, and debugging C++ code (I am unsure of C code). On the other hand, debugging with GDB works fine with both: C++ and Obj-C code.
The only real options you have at the current time is:
Option 1:
Use the GDB debugger instead, as the GDB debugger with Xcode supports this.
To change the debugger:
Step 1:
Click your project name under the Scheme Menu, in the top left.
Step 2:
Click "Edit Scheme..."
Step 3:
Once the Edit Scheme menu comes up, click the pop-up menu next to the "Debugger" option.
Step 4:
Click the option "GDB" to use the GDB debugger.
NOTE:
Once you click GDB, the "Debug Process As" option will be greyed out.
Step 5:
Click OK.
NOTE:
I'm not sure about the limitations whilst using the GDB debugger, over LLDB (I think Xcode does not support any recent versions of GDB, as they have switched to LLDB and clang).
Option 2:
Create a breakpoint to where you wish to continue, and then continue to it. It really isn't that hard compared to right clicking and pressing "Continue Here" or the green button. This also provides the same functionality. With the use of keyboard shortcuts it could be just as fast (see below).
For example:
Say you want to continue until you hit line 39.
Set a breakpoint at line 39.
Click "Continue program execution" button, which is the button that likes some-what like a media-play button. Alternatively you can continue using the keyboard shortcut: Command + Ctrl + Y, or use the Menu (Product->Debug->Continue)
NOTE:
You need the Debug area shown (Shift-Command-Y), in order to see the "Continue program execution" button.