<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 13/02/2014 15:42, Xiangrong Fang
wrote:<br>
</div>
<blockquote
cite="mid:CAP93jB08_JNcvFxUCr4Uv2YTnhGcnqNcFK42Zt+fvhM3E0jq9w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-family:'courier
new',monospace">Hi All,</div>
<div class="gmail_default" style="font-family:'courier
new',monospace"><br>
</div>
<div class="gmail_default" style="font-family:'courier
new',monospace">
I encountered a very strange problem. The code looks like
this:</div>
<div class="gmail_default" style="font-family:'courier
new',monospace"><br>
</div>
<div class="gmail_default" style="font-family:'courier
new',monospace">
//In Unit1.pas:</div>
<div class="gmail_default" style="font-family:'courier
new',monospace"><br>
</div>
<div class="gmail_default" style="font-family:'courier
new',monospace">//sel is an object of TIntVector and</div>
<div class="gmail_default" style="font-family:'courier
new',monospace">//TIntVector = specialize
TVector<Integer></div>
<div class="gmail_default" style="font-family:'courier
new',monospace"><b>sel.Sort([soEliminateNA, soReversed]);<br>
</b></div>
<div class="gmail_default">
<div style="font-family:'courier new',monospace"><br>
</div>
<div style="font-family:'courier new',monospace">//In
vector.pas:</div>
<div style="font-family:'courier new',monospace">
<br>
</div>
<div>
<div><font face="courier new, monospace">procedure
TVector.Sort(Options: SortOptions);</font></div>
<div><font face="courier new, monospace">var</font></div>
<div><font face="courier new, monospace"> i, gap, order,
first, last, pos: Integer;</font></div>
<div><font face="courier new, monospace"> Temp: T;</font></div>
<div><font face="courier new, monospace">begin</font></div>
<div><font face="courier new, monospace"> <b>if FCount <
2 then</b></font><span style="font-family:'courier
new',monospace"><b> Exit; <font color="#ff0000"> <--
problem here</font></b></span><br>
</div>
<div><font face="courier new, monospace"> if soReversed in
Options then order := 1 else order := -1;</font></div>
<div><font face="courier new, monospace"> ... ...</font></div>
</div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">My purpose is to skip
sorting if the vector's element count is less than 2.</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">Now the problem is
that this statement does not have any effect (see attached
screenshot). The debugger refuse to stop on the
breakpoint, but goes directly to the line below it!</font></div>
<br>
</div>
</div>
</blockquote>
<br>
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 class="moz-txt-link-freetext" href="http://wiki.lazarus.freepascal.org/Debugger_Setup">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>
</body>
</html>