Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

How do I debug MEX files on Solaris using gcc/gdb?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-19DVQ
Product:   MATLAB
Reported in Release:   R12.1
Platform:   All Platforms
Operating System:   All OS
 

Subject:

How do I debug MEX files on Solaris using gcc/gdb?

Problem Description:

How do I debug MEX files on Solaris using gcc/gdb?

Solution:

This Solution is specific to the GDB debugger on Solaris. For other configurations, see the Debugging section of Tech Note 1605, MEX-files Guide:
http://www.mathworks.com/support/tech-notes/1600/1605.html

In R12.1 to debug MEX-files (and S-functions) using gcc and gdb, you need to compile it using the following code:

mex -g -f gccopts.sh mexfilename.c.

1. Start MATLAB with


matlab -Dgdb

2. At the gdb prompt type:

run -nojvm

3. At the MATLAB prompt type

dbmex on

4. Type the mexfilename.

5. At the gdb prompt type

shared mexfilename.mexsol

6. Type:

break mexFunction

7. Type

continue

You should then end up inside of the mexFunction

This was done using 2.95.2 gcc and 4.16 gdb.

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page