Qt Creator debug doesn't stop at breakpoint directly - c++

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

Related

Force C++ program to pause in Visual Studio debugger

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.

VS 2012: Debugger: "Break all in 5 seconds"

My program is using too much CPU power when I select text. And I don't know why. Normally I'd just press "Break all" to see what the program is currently doing. But in this case I'm busy selecting text with the mouse.
Is there any trick to delay the "Break all" command for a few seconds?
you can start a separate thread with Sleep(5000); DebugBreak();
Press CTRL-Break while selecting. This should bring the debugger up immediately.
You can sprinkle all your suspicious code with special kind of breakpoints that do not stop execution, but print a message in Output window.
Add a breakpoint, go to Breakpoints window, find the breakpoint that was just added, right-click, select "When Hit...", in new window select "Print a message". Make sure check box "Continue execution" is checked (it should be by default). Breakpoint icon will change from circle to diamond. Repeat this for several breakpoints.
You can adjust the text that breakpoint will display to whatever you need.

Win32 console disapears after a second

I have created a Win32 Console Application in Visual Studio but when I start the program the console apears just for a second and then disapears again. What should I do that the console remains on the screen ?
Well, the program has finished running, so it closes.
Either make the program wait for input (e.g. with getchar()), or press Ctrl-F5 to run the program without debugging (but then you won't be able to set breakpoints and stuff).
You can set breakpoints anywhere in your code to make it stop. If you just want to see the output of the program when it's done, try setting a breakpoint on the last line of main().
This is happening because the program has nothing to wait for before exiting.
Try running std::cin.get(); before main() returns to make the console wait for keyboard input.

Unable to reach breakpoint in Visual Studio

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".

using nsight to debug

I am using NSight to debug my CUDA code and I have question:
how can I place a breakpoint for a specific thread and block?
When I place a breakpoint on the kernel the debugger always stops at thread 0 of block 0.
As discussed in the online help in Nsight, you can set a breakpoint and make it conditional on block and thread id like this:
To set a block or thread condition on a CUDA C breakpoint:
Set a breakpoint on a line of source code.
Right-click on the breakpoint.
From the drop-down menu, select Condition...
Type:
#blockIdx(0,2,0) && #threadIdx(5,0,0)
Click OK. The breakpoint glyph shows a plus sign.
try to use CUDA Debug Focus. you can debug any thread in any block you want...