Using a debugger to debug your plug-ins
 
 
 

To start Maya under the control of a debugger, you use the “-d” flag of the maya shell script. The syntax for this is:

maya -d debuggerName

or, for example:

maya -d ddd

This launches the debugger given as an argument to the -d, and then starts Maya under control of this debugger. Once you have started Maya and loaded your plug-in, you can:

By default, Maya catches several signals generated by programming faults, in particular: SIGSEGV, SIGILL, SIGBUS and SIGABRT. When debugging a plug-in with a debugger, it is likely that you will want to suppress this behavior of Maya, and instead let the debugger catch the signals. This can be accomplished by setting an environment variable, as shown below:

setenv MAYA_DEBUG_NO_SIGNAL_HANDLERS 1

This variable can be set either in the environment or the Maya.env file. If you use cvd as your debugger, beware of a potential conflict. The Maya shell script sets the values of two environment variables that tell the Maya binary where to find things. These variables are:

If you have set either of these in your shell’s start-up file (.cshrc or.profile), you must protect them so shells started by the debugger (after the Maya shell script has started that debugger) do not undo these modifications.

If you use csh or tcsh use the following construct:

if ( ! ${?MAYA_LOCATION} )
 setenv MAYA_LOCATION /usr/autodesk/maya
if ( ! ${?LD_LIBRARY_PATH} )
 setenv LD_LIBRARY_PATH whatEver

and if you use sh or ksh use this construct:

MAYA_LOCATION=${MAYA_LOCATION:=/usr/autodesk/maya}
export MAYA_LOCATION
LD_LIBRARY_PATH=${LD_LIBRARY_PATH:=whatEver}

export LD_LIBRARY_PATH