Debugging a project which has mex files associated with it
이전 댓글 표시
Hi All, I have a project which I need to run. It has a few (10s) .m files and a few (5ish) mex files. I am in ubuntu. I have to debug the code. I can seem to run .m debugging and 1 mex file at a time debugging using matlab and gdb respectively. But I can't get to run both of them together. I have spend considerable amount of time on this and been using terminal and emacs and matlab. I have tried everything that was told online but most of the things were either only for mex files or only for .m files. how on earth do i get a project to debug ???
~neeraj
답변 (2개)
Kaustubha Govind
2012년 6월 28일
0 개 추천
Could you explain more about what you mean by "can't get to run both of them together"? I have debugged MATLAB files and C-MEX files together - the MATLAB breakpoints are to be set in the MATLAB Editor and the MEX breakpoints in the gdb. I would also recommend that you start MATLAB with the -nodesktop option when attaching with gdb - I have found that this is faster because all the additional libraries required to render the desktop need not be loaded.
Also, could you try running gdb from the shell (instead of from emacs) to see if that makes a difference? I understand that it's harder to set C breakpoints, but this setup has worked well for me in the past.
PS: Please remember to compile your MEX function with the -g (debug) option.
Neeraj
2012년 6월 28일
0 개 추천
댓글 수: 1
Kaustubha Govind
2012년 7월 6일
Neeraj: It shouldn't matter whether you set the MEX breakpoint before starting MATLAB or after. Could you explain what you mean by "before i start running the jvm"? How do you start the JVM? I have found that running MATLAB with the -nojvm option is most reliable, because apparently JVM uses some signals like SIGSEGV during normal operation. A comment on this page suggests that you run "handle SIGSEGV pass noprint nostop" in gdb to avoid running into issues with SIGSEGV. I wonder if running "handle SIGUSR1 nostop" in gdb before "run -nojvm" might fix that?
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!