Debugging C mex - jvm.pdb not loaded exception

Hi, I hope you can help.
I'm confused by the sporadic read access exceptions during debugging C mex code with Visual Studio 2019 (v16.9.1) and Matlab R2020b. I appear to be getting read access exceptions at different times during stepping through the code. At first I thought it was my code, but I'm getting the exceptions on one trial, but I can step over the same code on the next try sans error (no random numbers here, identical every time data and code wise). I get a No Symbols Loaded tab pop up in the VS window (see below) that informs me that the jvm.pdb is not loaded.
I think I might (correction, do, just found it) have an issued with the second loop in my code, but these sporadic read exceptions are making things really hard to debug.
I've attached a mat file and a notes m file. If you change the path to load the mat file and step through you can see my working. Matlab crashes each time I get an exception, so I typically load Matlab, run the first four sections, attach to matlab in VS2019, select the break point and then run the 5th section of the m file to jump in. Line 94 in the c code (in the zip) is a good place to jump in.
Any misc tips on my first c code and mex file much appreciated (Note this code is ported from https://www.osapublishing.org/oe/fulltext.cfm?uri=oe-23-25-32387&id=333299 who kindly sent me their code; while I love Igor Pro, it's too esoteric to be practical when sharing and it needed to be brought over to Matlab)
Thanks
Neil

댓글 수: 3

Here's an example of the Exception Thrown on a line in debugging that's well before any actual errors should be thrown:
Exception thrown at 0x00000000567E8598 (jvm.dll) in MATLAB.exe: 0xC0000005: Access violation writing location 0x0000011B8ED70780
This time it happened just entering the first for loop.
I have this same problem. Is there a solution?
Kinda...
I found that when I just kept on stepping on throught the code, these errors would occur, but not stop things. Sometimes I see them and sometimes I don't, but in retrospect, I think they can be ignored. Not really sure, but I managed to debug things that way.
Good luck with the code.
Neil

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2020b

태그

질문:

2021년 3월 14일

댓글:

2021년 5월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by