<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace"><span style="font-family:arial">2014-02-14 0:16 GMT+08:00 Martin Frb </span><span dir="ltr" style="font-family:arial"><<a href="mailto:lazarus@mfriebe.de" target="_blank">lazarus@mfriebe.de</a>></span><span style="font-family:arial">:</span><br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><div class="">
<div><br></div></div>
Is it just the debugger does not stop? But the statement is executed
(stopping in the next line never happens with FCount >= 2)?<br>
<br>
Check your setup<br>
<a href="http://wiki.lazarus.freepascal.org/Debugger_Setup" target="_blank">http://wiki.lazarus.freepascal.org/Debugger_Setup</a><br>
- NO smartlinking<br>
- NO optimization <br>
-O1 is often, but not always ok, so if there is an issue, then use
-O-<br>
<br>
Your image does not show the "blue dots" in the gutter (where the
breakpoint ,and green arrow are). That indicates there is something
wrong with the debug info.<br>
<br>
Or maybe you have 2 units of the same name ,and use relative path (
../ )? This can cause problems in some cases. Because gdb does not
always deal with the .. , and then the IDE must specify the unit by
name only, which is ambiguous.<br>
</div>
</blockquote></div><br></div><div class="gmail_extra"><div class="gmail_default" style="font-family:'courier new',monospace">Debugger problem is minor. I know I am missing the blue dots here. But the MAJOR problem is that in the attached screenshot, FCount is 0, which is of course smaller than 2, but it does NOT Exit!</div>
<div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">This caused a SIGSEGV because in the code below I do this:</div>
<div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">last := FCount - 1;</div><div class="gmail_default" style="font-family:'courier new',monospace">
FItems[last] ... //<-- which results in FItems[-1];</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">
And smartlinking never turned on, switching off optimization in lazarus does not help either.</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">
Regards,</div><div class="gmail_default" style="font-family:'courier new',monospace">Xiangrong<br></div><br></div></div>