TOC
Summary
Visual Studio can attach to running maya.exe process with Debug > Attach to Process
. This post describe using the debugger to debug Maya C++ plug-in.
Prerequisites
Software environments:
- Maya 2022 Update 2
- Visual Studio 2019
- Windows 10 Pro v21H1
Maya.env:
# %USERPROFILE%\Documents\maya\2022\Maya.env
MAYA_PLUG_IN_PATH=C:\devkit\Autodesk_Maya_2022_2_Update_DEVKIT_Windows\devkitBase\devkit\plug-ins\build\helloWorldCmd\Debug
Steps
Click Properties
in your project.

Click Configuration Properties > Debugging
.

Type your maya.exe
to Command
field. Change to Yes in Attach
field.

Getting full path of maya.exe by doing the following:
- Shift + Left Click
maya.exe
. - Click
Copy as path
.

The following figure shows the debugging in Visual Studio.

Visual Studio prints a log on the Output
tab. The following log is an excerpt of log when is attaching to Maya loading the plug-in helloWorldCmd.mll
.
'maya.exe' (Win32): Loaded 'C:\Program Files\Autodesk\Maya2022\bin\maya.exe'.
'maya.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'maya.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
...
...
'maya.exe' (Win32): Loaded 'C:\Program Files\Autodesk\Bifrost\Maya2022\2.3.0.0\bifrost\bin\aminomath_1_0.dll'.
'maya.exe' (Win32): Loaded 'C:\devkit\Autodesk_Maya_2022_2_Update_DEVKIT_Windows\devkitBase\devkit\plug-ins\build\helloWorldCmd\Debug\helloWorldCmd.mll'. Symbols loaded.
'maya.exe' (Win32): Loaded 'C:\Program Files\Autodesk\Maya2022\bin\plug-ins\GamePipeline.mll'....
...
The thread 0x8a08 has exited with code 0 (0x0).
References
- Maya Help | Appendix C: Frequently asked questions | Autodesk (It’s Maya 2022)
- Attach to running processes with the debugger – Visual Studio (Windows) | Microsoft Docs
- How to Debug a C++ Maya Plugin Using Visual Studio – Nick Cullen : Dev Blog
- デジタル・フロンティア-Digital Frontier | DF TALK | MayaとVisualStudioとデバッグ入門