WinDbg: Problems attaching to process

Sometimes various problems prevent WinDbg from attaching to a process.

I experienced some recently, that I have described here.

 

Trying to attach 32-bit WinDbg (x86) to a 64-bit process

WinDbg_Could_not_attach_to_process_NTSTATUS_0xC00000BB

Could not attach to process 11576, NTSTATUS 0xC00000BB

The request is not supported.

 

If you get this error message, please check if the process is 32-bit or 64-bit.

Then try attaching again with the right version of WinDbg.

 

Attaching 64-bit WinDbg (x64) to a 32-bit process

Attaching 64-bit WinDbg (x64) to a 32-bit process is possible, but it’s usually not very useful. That’s because it shows a WOW64 view of the process, which limits the debugging options.

 

Trying to attach to process with insufficient user permissions

WinDbg_Could_not_attach_to_process_error_0n5

Could not attach to process 4160, Win32 error 0n5

Access is denied.

 

This error may occur if WinDbg has insufficient permissions.

Try running WinDbg “As Administrator” and try attaching to the process again.

 

Trying to attach to process when it is already being debugged

WinDbg_Could_not_attach_to_process_NTSTATUS_0xC0000048

Could not attach to process 6128, NTSTATUS 0xC0000048

An attempt to set a process's DebugPort or ExceptionPort was made, but a port already exists in the process or an attempt to set a file's CompletionPort made, but a port was already set in the file or an attempt to set an ALPC port's associated completion port was made, but it is already set.

 

This problem usually occurs if the process is already being debugged. The other debugger could be Visual Studio, ProcDump or another tool.

Check if other debuggers are attached, detach them and then try attaching to the process again with WinDbg.