Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: 7000kg on August 24, 2010, 01:56:15 pm

Title: C MEX S-function debug
Post by: 7000kg on August 24, 2010, 01:56:15 pm
Hello,

Is it possible to debug C MEX S-function in C::B during the simulation model in MATLAB?

Thanks.
Title: Re: C MEX S-function debug
Post by: MortenMacFly on August 24, 2010, 06:04:26 pm
Is it possible to debug C MEX S-function in C::B during the simulation model in MATLAB?
This is very hard. You can try to attach the debugger to the s-function thread if you figure out the handle of your S-function DLL. However, for GDB to use you'll need to compile your S-function using GCC (which is not supported under Windows, natively - hence possible).

I'd suggest you either use something like IceBox (http://www.zeroc.com/download.html, http://www.zeroc.com/doc/) to do some kind of "remote debugging" or do it the old "fashion" way by putting a lot of printf's into your code or debug into a file. That's how I do it as it is fast, reliable and can be turned of e.g. via hash defines for releases.