Segmentation violation while returning from Matlab function

2 次查看(过去 30 天)
I have a c shared library built from a matlab function. The function executes properly till end but segmentation violation occurs on returning.
Abnormal termination:
Segmentation violation
Register State (from fault):
EAX = 00000004 EBX = 0026ac14
ECX = b4400010 EDX = bff83428
ESP = bff810f0 EBP = bff81108
ESI = 00000000 EDI = 00000004
EIP = 0020355e EFL = 00210202
CS = 00000073 DS = 0000007b SS = 0000007b
ES = ffff007b FS = c05c0000 GS = 00000033
Stack Trace (from fault):
[ 0] 0x06610099 /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwfl.so+00450713 fl::sysdep::linux::unwind_stack(void const**, unsigned int, unsigned int, fl::diag::thread_context const&)+000036
[ 1] 0x065c124a /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwfl.so+00127562 fl::diag::stacktrace_base::capture(fl::diag::thread_context const&, unsigned int)+000180
[ 2] 0x065cb473 /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwfl.so+00169075
[ 3] 0x065cb845 /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwfl.so+00170053 fl::diag::terminate_log(char const*, fl::diag::thread_context const&, bool)+000115
[ 4] 0x095bca0f /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwmcr.so+00375311 fl::diag::terminate_log(char const*, ucontext const*, bool)+000096
[ 5] 0x095b98a6 /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwmcr.so+00362662
[ 6] 0x095bb56e /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwmcr.so+00370030
[ 7] 0x095bc154 /home/ashish/MATLABR2011a/bin/glnx86/../../bin/glnx86/libmwmcr.so+00373076
[ 8] 0x00fef40c __kernel_rt_sigreturn+000000
[ 9] 0x0020355e /home/ashish/MATLABR2011a/bin/glnx86/libmx.so+00111966 mxDestroyArray+000027
[ 10] 0x01f68d31 /home/ashish/MATLABR2011a/bin/glnx86/libmwmclmcr.so+00564529 mclMlfVFeval+000889
[ 11] 0x00d33dea /home/ashish/MATLABR2011a/runtime/glnx86/libmwmclmcrrt.so.7.15+00060906 mclMlfVFevalInternal_proxy+000071
[ 12] 0x00d33e4f /home/ashish/MATLABR2011a/runtime/glnx86/libmwmclmcrrt.so.7.15+00061007 mclMlfFeval_proxy+000070
[ 13] 0x00148a00 ./libtraining.so+00002560 mlfRecognizeface+000184
[ 14] 0x0804e020 ./z+00024608
[ 15] 0x08056a19 ./z+00059929
[ 16] 0x08051b12 ./z+00039698
[ 17] 0x080512b5 ./z+00037557
[ 18] 0x0074ace7 /lib/libc.so.6+00093415 __libc_start_main+000231
[ 19] 0x0804a081 ./z+00008321
I'm calling this in c as :
mlfRecognizeface(1, *&Recognized*, mat1, LeftEyeFilterAverage, RightEyeFilterAverage, NormImgSize, BunchGraph, BunchGraphPolar, GaborMask, Masks, DatabaseFaceGraphFront, DatabaseFaceGraphPolarFront, SimilarityThreshold, DatabaseFaceGraphRight, DatabaseFaceGraphPolarRight, DatabaseFaceGraphLeft, DatabaseFaceGraphPolarLeft, Edges);
where Recognized is the only output and all of these are of type mxArray

回答(3 个)

Vikash Anand
Vikash Anand 2011-5-15
any solution ??

Laila
Laila 2011-7-14
Hi
I am having this problem too, have you managed to resolve it?

Friedrich
Friedrich 2011-7-14
Hi,
seems like you are running your application out of a folder where you dont have read permissions. Please try to run your program from a folder with read permission.

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by