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.
Related
I followed this tutorial to create a simple web job in Azure: https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started. The web job itself does its job, consumes the message in the queue and I see them appear in Application Insights.
However, I want to debug the function on my local machine by using the tools available in Visual Studio 2022.
I have published with following profile settings:
Next I've attached the debugger under het Hosting menu:
First thing I noticed is a message about no symbols being loaded when putting a breakpoint in the function:
When I add a message to my queue, it gets consumed by the web job but the breakpoint is never hit. I've been reading a lot of similar questions regarding a this issue but I'm not progressing any further.
In Azure Portal, I've enabled Remote debugging under Configuration > general settings
In Visual Studio 2022, I checked if the correct process is attached
Here I'm a bit confused thou, the connection target is connecting through port 4024, which is according to this document, the port for Visual Studio 2019. However, a connection target with port 4026 is not found.
What am I missing here? Am I forgetting another setting somewhere?
If have tried changing the stack setting .NET version from APS.NET V4.8 to NET 6 (LTS) but that didn't help.
Should the platform architecture match the architecture of my machine in order to get it to work? Or is this not linked in any way with the debugger?
Is there anything else that I should check or try? Because my hair is turning grey here :)
Apologies for the delay here!
It should be 4024 for both 32 and 64 bit.
See this Azure doc: Remote Debugger Ports on Microsoft Azure App Service
Typically, the error “The breakpoint will not currently be hit. No symbols have been loaded for this document.” -- This error message indicates we can start debug process and attach, but cannot set a breakpoint on any or some lines of code in the project.
Most, likely cause: Application is built without debug symbols or debug symbols are not available
Kindly try these steps:
Verify Debug Symbols are being used and published and in sync
Workaround the issue by disabling “Enable Just My Code” from the
Tools >> Options >> Debugging >> general menu in Visual Studio
Other things to narrow-down the issue:
Debug symbols must be available locally or deployed to the Azure App Service, and must match the local code you are trying to debug.
It is recommended to use Cloud Explorer over Server Explorer to
connect and debug which requires the Azure SDK.
You could optionally Manually Attach a Debugger to Azure Web Apps to troubleshoot this further or recommend this as a workaround.
(old blog, try similar steps)
Kindly verify the port (Visual Studio remote debugger port assignments ) required is open in the corporate firewall and on your local machine.
As a test, you may use tool like Wireshark/netmon, to see if the port successfully connects to the port (4024) needed by the process.
I am debugging an application in Eclipse Neon on Ubuntu 16.04. My project requires that I generate a core dump (which includes all memory (heap, stack, code segments, etc) for the process under debug) while simultaneously having a debug session for that application.
I tried to use "gcore" from a Terminal while debugging the same application in Eclipse. This gives me:
warning: process 32062 is already traced by process 32032
ptrace: Operation not permitted.
You can't do that without a process to debug.
The program is not being run.
gcore: failed to create core.32062
If I use "gcore" without debugging the application in Eclipse a core dump is produced.
I do not find the option to generate a core dump from within Eclipse ... does that exists? Where to find it? Can I add a plugin which allows me to "execute a gcore" (similar) command from within Eclipse while debugging the application?
Thanks! Hope you can help.
Meanwhile I figured it out. In Eclipse you can select the gdb console tab once you are debugging using the "Debug" perspective. This gdb console is an interactive console (like all other consoles in Eclipse Neon). Here you can just type the command "generate-core-file" which will core dump the memory of the process under debug.
Also good to note is that there is a "suspend" button which you can use to "pauze" your application at any moment in time. After "suspend" you can also create a core dump using "generate-core-file" in the gdb console.
I'm trying to debug a deployed Azure Worker Role. I have the service published from visual studio and confirmed it is running on my Azure dashboard. In visual studio I right click the Instance of the role (only 1 is there) and select debug. After 5+ minutes I get the process dialog box and I select the WaWorkerHost.exe process. After that nothing is happening - I have a visual studio dialog that says "A remote operation is taking longer than expected". It has been 25 minutes so far.
1) I need to be able to debug my service and I'd like to do it vs the Azure published version. How can I debug this hanging operation?
2) 30+ minutes is not reasonable to wait for a debugger to attach. Is there any way to improve the process?
To be able to debug your Azure cloud service, you first need to make sure it is built with the Debug configuration and that the remote debugger feature is enabled, then you'll be able to attach to the role from Visual Studio as if you were running it locally.
You can follow these steps to enable the debugger and attach to the service: https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-debug-cloud-services-virtual-machines/
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.
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.