debugging a crash (c++) - visual-c++

I am having a service which calls a C++ COM dll. The C++ COM dll causes some problem and the service crashes.
I couldn't figure it at what point the service crash. I used debugdiag. But it is not putting any crash dump.
Kindly let me know how I can debug a application crash. Or direct me to some good tutorials and tools.
Many thanks.

Attach the Visual Studio debugger to your service via Tools / Attach to process. You might need to check Show processes from all users in order to see your service in the list.

Related

VisualStudio 2019 Performance Profiler showing code as [Unwalkable]

I'm trying to profile an ASP.NET web service on my machine under IISExpress that has an execution stack of
c# for the entrance point to the web service, which calls
c++/cli middleware, which calls
native c++ for the bulk of the execution, which calls
c++/cli & c# for some extra plug-in services that provide a Data Access Layer to the native c++ layer
This is all written in Visual Studio 2019 (C# and C++)
I am trying to profile this in Visual Studio 2019 by running IISExpress and using the Analyze / Performance Profiler to attach to the running process.
I can run my program and execute a http request (exercising my execution stack) successfully, but the profiler will only show
iisexpress
[Unwalkable]
as the two function names that are executed.
Does anybody have experience with getting the Performance Profiler to provide good output in similar circumstances?
I'm also open to other profilers.
I experienced the same thing when trying to profile my desktop application. I had to run it in administrative mode. Then it worked as it should.
I'm getting a lot of value out of Microsoft's free PerfView https://github.com/microsoft/perfview/. Much more functional than any other profiler I tried.

How to get crash dump in Windows 8.1 without using WinDbg

I have a user who is running one of my apps, and he is seeing the app crash. How can I get a crash dump from his computer without asking him to use WinDbg?
I have read other questions, and this was easy to do in Windows XP using Dr. Watson, but it seems that option is not available in Windows 8.1 anymore.
Other answer points to c:\Users\[user]\AppData\Local\Microsoft\Windows\WER\ReportArchive directory, but I only see WER files there.
Any idea how to get crash dumps?
Thanks.
I wrote a program to trap WER crash dumps. I was able to use the keys mentioned in this article to trap the dump file locally. The only subtle requirement was that the program had to run with administrator rights. If you follow this methodology, make sure you run the program again to disable trapping crash reports because changing those keys could affect all future crash dumps for other applications.
ProcDump from SysInternals.
Register as the Just-in-Time (AeDebug) debugger. Makes full dumps in c:\dumps.
C:\>procdump -ma -i c:\dumps

Remote debugging a process that crashes on launch using Visual Studio 2012

I recently converted a mingw/cygwin build to a Visual C++ cl.exe build and upon initial testing found it crashes at launch. I then installed it in my developer environment to debug it, under which it runs just fine. My initial suspicion was that I was linking to a different DLL in that context, but examining both processes in both contexts with Process Explorer showed that they were using the same versions of the same DLLs.
Since I can't reproduce the issue with Visual C++ installed I installed the remote debugger on the client machine, but I can't manage to attach to the process quickly enough before it crashes. Is there a good way to go about doing this? This would be easy if I could launch the process under the debugger locally, but that doesn't look like a viable option here.
Any help would be greatly appreciated. Thanks for your time!
You should be letting the remote debugger start the debugee process on the remote machine.

Attaching Visual leak detector to a process running as windows service

How to use Visual Leak Detector to attach to a process running as a windows service.
If someone has used this tool to detect memory leaks for service, please let me know the procedure.
I am including "vld.h" in my source file as in the documentation nothing else.
Compile your service in debug with vld.h included.
Start your service from the Services Control Manager (no debugger involved yet)
Start Visual Studio - in the Debug Menu select attach to process
Select your process (your service) - make sure to enable native debugging
Stop your service with the debugger still attached and you should get output in the debug window.

Debugging release-mode binaries in VC++

I have an .exe that crashes in release mode. I want to debug where the crash occurs.
How can I use VC++ to debug a crash in a release-mode .exe?
You can run Visual Studio and attach it to a process to debug.
Also check through the Windows Event Viewer (an often overlooked source of information) for any exceptions that Windows may have caught.
Firstly if you have access to the code you can open the workspace in visual studion and debug it by pressing F5 button.
Secondly go through the steps that leads to the crash. At that point of time check the location pointed to by the call stack.
This will give you indication on the funciton or line where crash is occuring.
We are assuming this application was written in VC++. How often are you able to reproduce this issue. Is it like everytime you can reproduce it or how is it.

Resources