Hi Eric, all, Thanks for replying.
It is non-trivial to attach the matlab process to gdb. Matlab provides a command line option -Dgdb to associate the Matlab process for gdb debugging. Would it be easier to launch "matlab-shell" with -Dgdb as option? Maybe your or someone else could put lights on this approach? Thanks, Dong On Wed, Jul 19, 2017 at 09:01:56PM +0000, Eric Ludlam wrote: > Hi Dong, > > You can fire up GDB from within Emacs and "attach" to a process. Using this > to attach to a process running MATLAB inside Emacs' matlab-shell will let you > debug through MATLAB code and into your C++ code. > > I haven't done this in a few years, and not with Mex (I was debugging MATLAB > directly) but I'm guessing the principle is the same. > > Eric > > -----Original Message----- > From: Dong Tian [mailto:t...@merl.com] > Sent: Wednesday, July 19, 2017 1:56 PM > To: matlab-emacs-discuss@lists.sourceforge.net > Subject: [Matlab-emacs-discuss] How to debug MEX files (C code) from Emacs? > > Hello, > > Could anyone provide a pointer on how to debug MEX files from Emacs? > E.g. using gdb? > > I am familiar with the procedure of debugging pure c/c++ code or .m code from > Emacs using gdb, but I don't know a good way to debug MEX file coded in C > from Emacs. > > Thanks in advance, > Dong > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most engaging tech > sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Matlab-emacs-discuss mailing list > Matlab-emacs-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss