Best way to debug algorithms of BFBs [message #1761382] |
Wed, 10 May 2017 08:00  |
Eclipse User |
|
|
|
Hi, it's me again!
I am trying out methods to debug the algorithms of BFBs. It currently doesn't seem to be possible using the FBTester.
I launched FORTE in debug mode using Visual Studio and set breakpoints in the class declaration of the exported BFB. This works (as long as I change the C/C++-->General-->Debug Information Format and the Linker-->Debugging-->Generate Debug Info settings in the forte Properties).
However, I cannot see the variable values due to the fact that the ST variables are wrapped by C++ methods. Is there a public method with which I can assign the numeric value of e.g. a CIEC_REAL to a double for the purpose of debugging?
Technically, it would be possible to create temporary data outputs in the FB interface. Internal and temporary variables can then be assigned to these temporary outputs within the respective algorithm. However, this seems more tedious, since the FBs need to be exported and FORTE needs to be rebuilt every time.
|
|
|
|
Re: Best way to debug algorithms of BFBs [message #1763293 is a reply to message #1761418] |
Fri, 12 May 2017 07:58   |
Eclipse User |
|
|
|
Thank you. That sounds like a good solution.
I have two more concerns about debugging BFBs.
1.
I noticed there is a simple unit test UI in the FBTester (with expected events, etc.). However, it doesn't seem to save any of the test cases (they are lost upon restart of 4diac-IDE). Is this intended behaviour? Also, I have a suggestion: Currently, output data can only be tested if it is linked to an expected event that is being tested. I believe it would be better to not force the WITH expression for unit tests. That way the user could create UT0 .. UTn output arrays that are not linked to any output events and assign internal variables to them in the ST algorithms which can be used in unit tests.
2.
(This one may require its own thread, but it is related to the FBTester, so I decided to post it here)
I have been experiencing strange behaviour when exporting BFBs to FORTE. When changing an algorithm or the interface and then exporting it (overwriting the old header and definition), sometimes the FBTester seems to stop working.
Normally, the input and output variables are all set to their initial values. But in the "bugged" state, this does not happen and the UI shows a "--" symbol next to them.
I initially thought it must have something to do with syntax errors that 4diac IDE and VS don't recognize (i.e. assignments of variables of conflicting types), but when undoing the changes by copying+pasting the old ST code (that worked initially), it still doesn't work. Re-starting the PC, re-building FORTE, etc. often don't fix the issue. And sometimes, it randomly works again.
Is this a known issue and if so, is there a fix?
Update: The second issue seems to be fixable by restarting FORTE a few times.
[Updated on: Fri, 12 May 2017 09:40] by Moderator
|
|
|
|
|
|
Re: Best way to debug algorithms of BFBs [message #1763740 is a reply to message #1763363] |
Fri, 19 May 2017 05:01  |
Eclipse User |
|
|
|
The FBTester issue still persists to some extent even if the FBTester is deactivated before building. But it is slightly better. To fix it, I have to click on the "Start Testing FB" button with FORTE closed. That will bring up an error message and change the red square (STOP) icon back to a green arrow (GO) icon. Usually, doing this once or twice before starting FORTE fixes the issue. Sometimes, I have to restart 4diac-IDE to get it to work.
EDIT: This behaviour seems to be limited to two of my most complex BFBs.
Strangely, the FBTester of a CFB that contains both of the affected BFBs (among others) seems to work just fine.
EDIT2: After further observation, I have come to the conclusion that the bug seems to occur when a BFB has an array input and/or output (that exceeds a certain length - mine have a length of 96), no matter how simple the algorithms or ECC.
[Updated on: Mon, 22 May 2017 05:32] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.23212 seconds