MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manuale Utente Pagina 107

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 408
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 106
Debugging C Language MEX-Files
2-47
Debugging C Language MEX-Files
On most platforms, it is now possible to debug MEX-files while they are
running within MATLAB. Complete source code debugging, including setting
breakpoints, examining variables, and stepping through the source code
line-by-line, is now available.
Note The section entitled, “Troubleshooting” on page 1-32, provides
additional information on isolating problems with MEX-files.
To debug a MEX-file from within MATLAB, you must first compile the
MEX-file with the
-g option to mex.
mex -g filename.c
Debugging on UNIX
You need to start MATLAB from within a debugger. To do this, specify the
name of the debugger you want to use with the
-D option when starting
MATLAB.
This example shows how to debug
yprime.c on Solaris using dbx, the UNIX
debugger.
unix> mex -g yprime.c
unix> matlab -Ddbx
<dbx> stop dlopen <matlab>/extern/examples/mex/yprime.mexsol
Once the debugger loads MATLAB into memory, you can start it by issuing a
run command.
<dbx> run
Now, run the MEX-file that you want to debug as you would ordinarily do
(either directly or by means of some other function or script). Before executing
the MEX-file, you will be returned to the debugger.
>> yprime(1,1:4)
<dbx> stop in ‘yprime.mexsol‘mexFunction
Vedere la pagina 106
1 2 ... 102 103 104 105 106 107 108 109 110 111 112 ... 407 408

Commenti su questo manuale

Nessun commento