Performance profiling during debug in Rider - profiling

Im starting to use Jetbrains IDE Rider and I want to use the performance profiling during debugging.
Basically I want to run in debug mode, set a breakpoint, start profiling, continue execution until next breakpoint and create a snapshot from that.
Is this possible?

To manually controll when the profiling starts and ends you can disable checkbox Collect profiling data from start in Run/Switch Profiling Configurations/Edit Configurations/ Profiling Configurations.
Once you have reached your breakpoint, click Start Recording. After you are done click Get Snapshot
Here is a detailed guide from JetBrains

Related

Visual Studio : hotkey similar to ctrl+F10 but also skip all breakpoints

Sometimes, when I press ctrl+F10 at line A, I just want the program to resume and halt when reach line A. However, if it reaches a breakpoint before reaches line A, it will halt at that breakpoint instead.
Is there any hotkey that acts similar to ctrl+F10, but ignores all breakpoints?
Disabling all breakpoints is not a viable choice for me, because :-
I just want one-time skip. Disabling them all and enabling back in the same debug session is not so convenient.
Disable breakpoints may also disrupt some of my workflow, because I reserved them to be used in some special cases.
ctrl+shift+F10 is not useful either, because it alters the program's behavior.
I don't mind to install a new plug-in.
Appendix :-
ctrl+F10 = Starts or resumes execution of your code and then halts execution when it reaches the selected statement. (but if it reach a breakpoint, it will halt immediately)
ctrl+shift+F10 = Sets the execution point to the line of code you choose
No direct answer for it, it would hit the breakpoint during debugging mode, it can't skip the breakpoint.
Actually I also check the VS2017 RC, it has the new feature called "Run to Click", you could run your app to the specific line during debugging mode. But it also hit the breakpoint during running time, but you could ignore this action and just click "Run execution to here" again. I know that it is not the direct answer, but I think it is convenient for you to debug your app to the specific line.
Other community members also submitted a feature request which could skip over the breakpoint here:
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2221315-implement-a-new-skip-over-breakpoint-type
A extension tool:
https://marketplace.visualstudio.com/items?itemName=CodeMelee.CodeMelee-FlexPoints
Which could skip/replace the specific code line, maybe it is also a workaround for this issue.
Since no direct solution for it, I also help you submit a feature request here:
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/17545741-visual-studio-hotkey-similar-to-ctrl-f10-but-als
You could also vote it:)

How to dump the whole procees, raise it and start debugging?

I have an application, which is running for a long time and then crash. I need to debug it several times to fix it and don't want to wait every time for an hour to reach the state, in which an error is occurred.
So, I want some tool to clone the whole process on a disk, then raise it, attach to it and debug.
I use Visual Studio 2012/2013 on (surprise) Windows.
For example:
for (int i = 0; i < 10000; ++i)
{
if (i == 9999)
throw MyExcept();
}
And I want to have a saved state of application (process) at 9998-th iteration to start debugging from it.
UPD 1: Visual Studio dump files are not admirable, because I can't get all functionality of debugger after opening it it VS. For example: I can't set breakpoints and even old ones don't work.
UPD 2: Also I need to have a possibility of duplicating this saves session of the app.
If I understood correctly, you want to accomplish two tasks:
1) Break the execution on a specific condition
You need to set a watchpoint with a condition to achieve this, or Data Breakpoint in Visual Studio terms. Have a look at this question: Can I set a breakpoint when variable is getting a specific value in .NET?
2) Dump a core file
Once you have set the watchpoint and your program reached that point, you can dump a core file. From that you can continue with the execution later on. There is an official FAQ entry entry on how to dump and load cores.
You need procdump from here
Register as the Just-in-Time (AeDebug) debugger.
Perhaps you should enable full local dumps.
Crash you program
Launch a process with procdump from full dump
But I think it is better to use DebugBreak API in your example without a crash.
Usually crash will not allow you to start further - only postmortem analysis.

Getting debug output from a crashed VS2010 application

Question: Can I set up VS2010 so it automatically writes debug output to a file?
Motivation: I have a DirectX 9 application that I'm trying to debug. I've noticed that when my application is fullscreen, it may crash under certain conditions. Normally I would just check my logs or DirectX debug output. However, the way my program crashes prevents that. It freezes and does not respond to any my attempts to end it (including "End Process" from task manager). Moreover, it also freezes my VS2010, and so VS doesn't respond to any commands either. The only way out of this whole thing that I've found is to End VS process. This, however, also destroys the output I'd very much like to read.
Now I see two ways out of this. First is to write all the debug info to a file but I have no idea how to do it. Second is to make my application crash in a more friendly way, but this seems like a difficult task.
Probably MiniDumpWriteMiniDump(..) helps on this. You can at any time dump the current state of the process to a file. After that, you can open the dumps with Visual Studio and analyze the state of the process - this includes callstacks of every thread, variable values...
Try to identify conditions in which your process crashes and write one or more dumps.
Another try is to install the Windows Debugging Tools and use WinDbg to debug your application. This is not as comfortable as Visual Studio, but allows a deeper insight.
Edit:
If there are debug statements made with OutputDebugString(..), you can use DebugView (from Microsoft, earlier Sysinternals) to display it.

Program hangs in Xcode debugger, but not in Instruments

I'm working on debugging a game written in C++ and it recently started hanging on the splash screen when I try to run it in Xcode (in Debug mode). I can't identify any changes in my code that could have caused this, and there aren't any log messages being printed while this hang is happening (something that I know can severely slow down a program). I then opened Instruments and used the time profiler to try and find the source of the problem, but when I ran my program on the time profiler it progressed past the part where it hangs, and ran as expected. Both running and profiling are set to use Debug mode so the build is the same, does anyone know what could possibly cause an issue like this?
More info: I'm using LLVM/Clang as the compiler and LLDB as the debugger. Looking at Activity Monitor during the hang I can see the game is shown as 'not responding' and Xcode is using a lot of CPU activity, despite not printing any log messages etc.. In 'Edit Schemes' the Profile scheme is set to use the Run action's arguments and environment variables.

Visual Studio 2008: how to pause the running program to see a variable value?

I have started a long loop, and i dont want to start it over (been running 3 hours now, i calculated it to run only 1 hour instead), and i am afraid that my program is working incorrectly because its taking so long. I was too stupid to actually output any state values for myself (i didnt think it would take 3 damn hours).
So, is there some way to spy one specific variable value while the program was launched from visual studio in "Release" mode?
What you want to do is attach to the running process
Load the solution which represents the project
Tools -> Attach to Process
Select the running process and hit attach
Hit the Pause Button on the IDE to stop the process or set a break point
At this point you will be broken in the debugger and able to inspect the running program
Attach the debugger to the running program. Set a breakpoint. Bask in the glory.
Of course, this all assumes you built PDBs. If you didn't, you're pretty much out of luck.
If the program was launched from Visual Studio it is possible that it already has a debugger (Visual Studio) attached to the process.
Visual Studio will have VCR/DVD looking buttons on the toolbar for Go, Stop, Pause, etc. Press the Stop button, or go into the Debug menu and choose Break All.