Author Topic: C MEX S-function debug  (Read 3786 times)

7000kg

  • Guest
C MEX S-function debug
« 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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: C MEX S-function debug
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ