Here is my solution which works in Ubuntu 12.04, Matlab R2012b, and Eclipse IDE for C/C++ Developers Kepler Release.
- In Eclipse open "Debug Configurations" from the run tab. Then make a new "C/C++ Application".
- In the "Main"-tab write the correct path to the matlab executable in the "C/C++ Application" (mine is "/usr/local/MATLAB/R2012b/bin/glnxa64/MATLAB" NOTE: not MATLABPATH/bin/matlab).

- In the "Arguments"-tab add "-nojvm" as program arguments.

- In the "Environment"-tab add variable "MATLAB_DEBUG" with value "gdb"

- Press "Apply" and "Debug"
- A "Matlab console" will open in the "Console" view.
- Write "dbmex on" in this console. This enables debugging.
- Run the mex file! (Matlab will stop at loading of each new mex file)
- Have fun debugging! :-)