|
From: | walter |
Subject: | Re: Debugging Existing C++ Blocks with VS Code & GDB |
Date: | Tue, 23 Apr 2024 16:40:59 -0700 |
Hi Matt, I'm not sure if this is an apples-to-apples situation, but your issue sounds exactly like something I've run into while abusing Python snippets. It was easy to avoid after understanding order-of-events for block creation. I suspect this is language-independent, and you can quickly create a python flowgraph / review the code - it will illustrate the principles: 1. Create a python flowgraph 'FOO.grc' with minimal blocks (e.g. [signal source] --> [throttle2] --> [null sink]). 2. Add four [Python Snippet] blocks - one for each type of [Section of Flowgraph] param: 'Init - Before Blocks', 'Main - After Start', etc. 3. For each Python Snippet block, add a one-line snippet distinct to the [Section of Flowgraph], for example: print("Hello IAMA Init - Before Blocks") # NOTE: it's important to have a least one line of code or nothing will be generated for the snippet! 4. Set the Title param of the [Options] block (top block) to "FOO". 5. Press [F5] to generate the flowgraph code, which will be called FOO.py (in same directory as FOO.grc). 6. Examine the resulting FOO.py script in VSCode - in particular, where each of the snippets are invoked. The most obvious example is that in 'Init - Before Block' it's possible to reference a block or variable self.X before self.X has been instantiated. More subtle cases are possible, depending on how clever one tries to be when using this mechanism. - W Attached: screencap of example error (take my word that the block 'radio' exists). I can send a shot of the flowgraph, but it probably wouldn't shed further light.
|
[Prev in Thread] | Current Thread | [Next in Thread] |