<div dir='auto'><div>I'm not sure your familiarity with debuggers but you would set a breakpoint inside your code and step through until it crashes, perhaps watching a few variables to ensure their contents are correct.</div><div dir="auto"><br></div><div dir="auto">Since it would work similar to turbo pascal and by extension, more modern "clone"/work-alikes, the virtual pascal VP21USER.PDF debugging section might be useful for learning that stuff.<br><br><div data-smartmail="gmail_signature" dir="auto">--<br>Alexander Grotewohl<br>http://dcclost.com</div><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On May 21, 2019 7:34 AM, James Richters <james@productionautomation.net> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><p>I have this program that is confounding me.    It obtains a file name with GetOpenFileNameA then it processes the file and draws stuff on the screen, then loops back and gets another file name until GetOpenFileNameA returns a false… so as long as I keep giving it files it keeps running and if I cancel the file selection, it exits.    It will run in a loop like this various numbers of times… sometimes 4 times, sometimes 8 times, sometimes twice, sometimes 30 times and then I get this access violation like this:</p><p> </p><p>An unhandled exception occurred at $0040ED07:</p><p>EAccessViolation: Access violation</p><p>  $0040ED07</p><p>  $00411A6C</p><p>  $00411F25</p><p>  $00402255  PLOTDRAWPAX,  line 76 of i:/programming/gcode/mill/plotdraw.pax.pas</p><p>  $00402705  main,  line 119 of i:/programming/gcode/mill/plotdraw.pax.pas</p><p> </p><p>Line 76 is the a call to a procedure in another unit that’s very complicated and calls a lot of other functions and procedures.</p><p>I keep testing with the same 5 files over and over, and each file has processed fine many times so there isn’t a problem with the data in my files or the way I am processing it….  and there doesn’t seem to be a particular file that causes this.   I’m thinking I have some memory issue or something is not freeing or ? </p><p> </p><p>It’s also not always the same exact message.. sometimes I get </p><p> </p><p>An unhandled exception occurred at $0040ED07:</p><p>EAccessViolation: Access violation</p><p>  $0040ED07</p><p>  $004026DB  main,  line 118 of i:/programming/gcode/mill/plotdraw.pax.pas</p><p> </p><p>Line 118 is a call to a function that is in no way related to the procedure that is called on line 76… it’s actually a ridiculously simple function.  Exactly one line of code to it, and I have run that function millions of times with other programs that use the same unit.</p><p> </p><p>The FPC text IDE is reporting runtime error 217 which doesn’t tell me much.. just an unhandled exception occurred.</p><p> </p><p>My question is… how do I track these kinds of things down?    Is there a way I can use the hex addresses to see more precisely what caused the error?  </p><p>I’m confused why sometimes I get very detailed debug reports that get me to the exact command that caused the problem and other times I have some information but then it just stops and I have nothing following the hex addresses.</p><p> </p><p>James</p></div></div></blockquote></div><br></div></div></div>