From: Daniel Armyr on
Hi.
I commonly develop mex-files for my own use, and every now and then they cause segmentation violations. When this happens I attach my debugger and work out where, but I feel that is a wee bit waste of time. I allways compile my mex files with debugging info, and when I get a segmentation violation, Matlab hands me a nice stack-trace with lots of info in it.

The problem is that I have no idea what that info means.

As an example, this is a part of the latest stack trace I got:
[10] AS5216.DLL:0x0e62e8e8(0x00c2948c, 0x00c29310, 0x7ba0d360, 0xcccccccc)
[11] AS5216.DLL:0x0e622f91(0x00c2948c, 0x00c29310, 0x7ba0d360, 0x00c2966c)
[12] AS5216.DLL:0x0e6113ae(0, 0x0e372f30 "c:\documents and settings\daniel..", 0x0e372fb4 "AvantesSpec::Connect", 27)
[13] AvantesMex.mexw32:0x0e3642ad(0x0e372848 "c:\documents and settings\daniel..", 0x0e372ab0 "MexParse", 71, 0x0e372a6c "spec.Connect()")
[14] AvantesMex.mexw32:0x0e36275f(0x00c29ed0, 0, 0x00c29e40, 1)
[15] AvantesMex.mexw32:0x0e361d35(0, 0x00c29ed0, 1, 0x00c29e40)
[16] libmex.dll:_mexRunMexFile(0, 0x00c29ed0, 1, 0x00c29e40) + 132 bytes
[17] libmex.dll:private: void __thiscall Mfh_mex::runMexFileWithSignalProtection(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00c29ed0, 1, 0x00c29e40) + 73 bytes
[18] libmex.dll:public: virtual void __thiscall Mfh_mex::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00c29ed0, 1, 0x00c29e40) + 321 bytes

I can see going from bottom up that a mex file called AvantesMex.mexw32 was called by matlab (That is the file I wrote). Three functions in that file are then called before execution jumps to AS5216.dll (A file I did not write). Does anyone here know what the numbers and texts in parenthesis mean? I am, for obvious reasons, particularly interested in line 12 above.

Sincerely
Daniel Armyr M.Sc.
R&D Optics Design
Perimed AB
From: Rune Allnor on
On 28 apr, 11:42, "Daniel Armyr" <firstn...(a)lastname.se> wrote:
> Hi.
> I commonly develop mex-files for my own use, and every now and then they cause segmentation violations. When this happens I attach my debugger and work out where, but I feel that is a wee bit waste of time.

In that case you need to learn how to program whatever language
you are using for your MEX code. There is a reason why it takes
years to learn and master languages like C and C++.

> I can see going from bottom up that a mex file called AvantesMex.mexw32 was called by matlab (That is the file I wrote). Three functions in that file are then called before execution jumps to AS5216.dll (A file I did not write). Does anyone here know what the numbers and texts in parenthesis mean? I am, for obvious reasons, particularly interested in line 12 above.

Those are likely memory addresses of particular interest
to the program. It could (but does not need to) be stuff
like the address of the function entry point, addresses
of argument variables, and so on.

Rune