API Guide > Setting up your build environment >

# 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:

- set breakpoints in the plug-in code
- single step through the plug-in
- perform any of the operations supported by the debugger

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:

- MAYA_LOCATION
- LD_LIBRARY_PATH

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/maya2014-x64
    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/maya2014-x64}
    export MAYA_LOCATION
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH:=whatEver}
    export LD_LIBRARY_PATH