0.Creat your dll or mexw32 file using the option make -g or mex -g
filename.c
1.Close every thing(to make it fast .. not mandatory though
2.Open MSVC 2008 Express Edition
3.Open Matlab
4.From MS VC 2008 Go To Tools->Attach To Process (If this option does
n't show up repeat step 1 and it will :)
5.In Attach to process, select MATLAB.exe (Native code option is
selected by default. If it is not select it manually)
6.From VC IDE, go to File->Open->File and select the file having
mexFunction(testmex.c in my case)
7.Put Breakpoints ar required lines(it will show warning that the code
may not hit the breakpint as the symbols for this are not loaded)
Ignore the warning.
8.Run your simulation (It will be good to put a breakpoint in Matlab
code line in which we call the mex func.
9.Run the code and it will hit the breakpoint...now we can step
execute it.