<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Debugger Problem in Critical Section</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/db89938281/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/db89938281/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Deutsch/thread/db89938281/</id><updated>2020-02-28T00:27:12.287000Z</updated><subtitle>Recent posts to Debugger Problem in Critical Section</subtitle><entry><title>Debugger Problem in Critical Section</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/db89938281/?limit=25#e105" rel="alternate"/><published>2020-02-28T00:27:12.287000Z</published><updated>2020-02-28T00:27:12.287000Z</updated><author><name>schnasseldag</name><uri>https://forge.codesys.com/u/schnasseldag/</uri></author><id>https://forge.codesys.com7722a2aa30593cb6f8a8bd5085434e772b895fa9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hallo,&lt;/p&gt;
&lt;p&gt;zwei Tasks greifen auf einen per SysSem geschützten Bereich zu. Dabei friert der Debugger ein, wenn ein Breakpoint innerhalb des durch Enter() und Leave() geschützten Bereichs gesetzt wird oder per Single-Step hineindebugged wird. Nach etwa 30s erfolgt dann ein Verbindungsabbruch zum Gerät (in dem Fall ein Raspi). Läuft nur eine Task, dann kann diese einwandfrei debugged werden. &lt;br/&gt;
Zunächst hatte ich meinen Code im Verdacht, durch das geänderte Laufzeitverhalten des Debuggers in ein Deadlock zu laufen (aber selbst dann sollte der Debugger noch reagieren). Nachdem ich den Code bis auf wenige Zeilen eingedampfte und nun noch nicht mal mehr als eine einzige Anweisung einer Funktions-Stackvariable im kritischen Bereich steht, glaube ich an ein Debuggerproblem in Codesys (3.5SP11 Patch2).&lt;/p&gt;
&lt;p&gt;Hier der Code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;METHOD&lt;/span&gt; &lt;span class="k"&gt;PUBLIC&lt;/span&gt; &lt;span class="n"&gt;GetInputPortB&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;bool&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Exklusiven&lt;/span&gt; &lt;span class="n"&gt;Zugriff&lt;/span&gt; &lt;span class="n"&gt;anfordern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;SysSemEnter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hSem&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hMutex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="o"&gt;**************************************************************************************************************&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Ein&lt;/span&gt; &lt;span class="n"&gt;Breakpoint&lt;/span&gt; &lt;span class="n"&gt;an&lt;/span&gt; &lt;span class="n"&gt;dieser&lt;/span&gt; &lt;span class="n"&gt;Stelle&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="err"&gt;ü&lt;/span&gt;&lt;span class="n"&gt;hrt&lt;/span&gt; &lt;span class="n"&gt;zum&lt;/span&gt; &lt;span class="n"&gt;Einfrieren&lt;/span&gt; &lt;span class="n"&gt;des&lt;/span&gt; &lt;span class="n"&gt;Debuggers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bis&lt;/span&gt; &lt;span class="n"&gt;die&lt;/span&gt; &lt;span class="n"&gt;Verbindung&lt;/span&gt; &lt;span class="n"&gt;zum&lt;/span&gt; &lt;span class="n"&gt;Raspi&lt;/span&gt; &lt;span class="n"&gt;verloren&lt;/span&gt; &lt;span class="n"&gt;ist&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="o"&gt;**************************************************************************************************************&lt;/span&gt;
&lt;span class="n"&gt;GetInputPortB&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Exklusiven&lt;/span&gt; &lt;span class="n"&gt;Zugriff&lt;/span&gt; &lt;span class="n"&gt;freigeben&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;SysSemLeave&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hSem&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hMutex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Im Anhang befindet sich das Miniprojekt.&lt;/p&gt;
&lt;p&gt;Kennt jemand dieses Verhalten? Ist das eine bekannte Einschränkung?&lt;/p&gt;
&lt;p&gt;Gruß&lt;/p&gt;
&lt;p&gt;schnasseldag&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum-de.codesys.com//download/file.php?id=1783" rel="nofollow"&gt;Debugproblem.zip &lt;span&gt;&lt;span&gt;[57.48 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>