A dev tool to look inside a module and check stuff

Over in DC offset on VCO outputs is bad, part #137 - #33 by baconpaul I suggested that perhaps some of the common problems people identify with modules could be auto-detected or some such. And said if I did it I would open up a quick new thread in development. This thread is that.

As part of a return to some rack work, i’ve sort of revived the bacon plugs modules. These modules always kinda sucked. I wrote them at Rack 0.5 and the first commit was on Dec 11, 2017. They are ancient and were sort of my first foray into rack. But it’s kinda useful to have a set around so I recently fixed some up to do this and that you know.

But in the latest I’ve added a new module, useful for developers only, called LintBuddy. It’s a simple module. It has an input and an output. You hook that input or output up to an output or input of another module and then it traverses the engine graph and finds a reference to that module that it can then run tests on.

It has two tests. The first is are all your inputs, outputs, and params labeled. The second is do you have any bypasses configured. But it’s coded of course so we can add more.

Here’s the bypass probe hooked up to Clocked

And here’s the label check. You can see one parameter in Clocked doesn’t have a name. (I presume this is a deprecated one of some form since the tooltips all seem to be there).

Anyway this helped me clean up some edges on surge and on bacon plugs so figured I would share. If you want to add a test, it’s pretty easy code. If you want to run it, just build the plugs. I’ll push this to the library soon enough also.

And also all ears on other things you might want to check. The one I’m interested in is: does paramquantity.stringtovalue of paramquantity valuetostring result in a stable conversion, for instance.

11 Likes

So it’s not clear to me where to find LintBuddy. I’d love to give it a spin!

1 Like

OK, I tried it out on Elastika. Pretty cool start!

My module has a lot of controls, so it took me a second to figure out I could use the mouse to drag and scroll the list in LintBuddy. One slight oddity is the scrolling text moves vertically faster than my mouse does.

I connected LintBuddy’s output probe to Elastika’s TILT input CV. When I click on LintBuddy’s “Labels Check” button and select “Probe Bypass”, VCV Rack crashes:

[16.042 fatal adapters/standalone.cpp:49 fatalSignalHandler] Fatal signal 11. Stack trace:
12: /home/don/Rack2Free/Rack() [0x403c8d]
11: /lib/x86_64-linux-gnu/libc.so.6(+0x38d60)
10: /home/don/.Rack2/plugins/BaconMusic/plugin.so(ProbeBypass::run(rack::engine::Module*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)+0x13e)
9: /home/don/.Rack2/plugins/BaconMusic/plugin.so(LintBuddy::updateCurrentTarget(rack::engine::Module*)+0x13d)
8: ./libRack.so(rack::createMenuItem<rack::ui::MenuItem>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<void ()>, bool, bool)::Item::onAction(rack::widget::Widget::ActionEvent const&)+0x24)
7: ./libRack.so(rack::ui::MenuItem::doAction(bool)+0x57)
6: ./libRack.so(rack::widget::EventState::handleButton(rack::math::Vec, int, int, int)+0x315)
5: ./libRack.so(_glfwPlatformPollEvents+0xd2a)
4: ./libRack.so(rack::window::Window::step()+0x5c)
3: ./libRack.so(rack::window::Window::run()+0x28)
2: /home/don/Rack2Free/Rack(main+0xbe0)
1: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)
0: /home/don/Rack2Free/Rack() [0x403bb9]

I can confim lintbuddy crashes Rack2 Free when connected to and doing “probe bypass” on Elastica on Windows 11.

[188.831 fatal adapters/standalone.cpp:48 fatalSignalHandler] Fatal signal 11. Stack trace:
26:  0x0
25:  0x0
24: _C_specific_handler 0x7ff8f7fcb1b0
23: _chkstk 0x7ff8f9753d80
22: RtlFindCharInUnicodeString 0x7ff8f96ce050
21: KiUserExceptionDispatcher 0x7ff8f9752e70
20: ZN11ProbeBypass3runEPN4rack6engine6ModuleERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EESD_ 0x7ff825ee9b90
19: ZN9LintBuddy19updateCurrentTargetEPN4rack6engine6ModuleE 0x7ff825f0e990
18: ZZN4rack14createMenuItemINS_2ui8MenuItemEEEPT_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St8functionIFvvEEbbEN4Item8onActionERKNS_6widget6Widget11ActionEventE 0x7ff825f8b6b0
17: ZN4rack2ui8MenuItem8doActionEb 0x7ff826cfa890
16: ZN4rack6widget10EventState12handleButtonENS_4math3VecEiii 0x7ff826d032c0
15: ZN4rack6window3Svg4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 0x7ff826d054e0
14: glfwGetWin32Monitor 0x7ff826d48eb0
13: DispatchMessageW 0x7ff8f82f7a20
12: CallWindowProcW 0x7ff8f82f7920
11: wglSwapBuffers 0x7ff89c4d1930
10: DispatchMessageW 0x7ff8f82f7a20
9: DispatchMessageW 0x7ff8f82f7a20
8: glfwPollEventsWin32 0x7ff826d4cc70
7: ZN4rack6window6Window4stepEv 0x7ff826d06340
6: ZN4rack6window6Window3runEv 0x7ff826d06d30
5: ZN4rack6window6Window3runEv 0x7ff826d06d30
4: ZN4rack6window6Window3runEv 0x7ff826d06d30
3: ZN4rack6window6Window3runEv 0x7ff826d06d30
2: ZN4rack6window6Window3runEv 0x7ff826d06d30
1: BaseThreadInitThunk 0x7ff8f8672430
0: RtlUserThreadStart 0x7ff8f970df90

OK I just ran the probe bypass on elastic from the library and had no problems. Are you running the library version or a version at head?

I see no bypasses in the library version.

and yeah the UI (and everything else) needs work of course!

Ahh just built Elastika from source and get the crash. Stay tuned.

OK I have a fix to LintBuddy I just pushed. Now let me get the fix for Elastika together :slight_smile:

1 Like

Oh no the fault was entirely mine! Hold on.

If you build as of cd104b611c3d5 or wait for a binary in about 10 minutes you will get one which works with Elastika at head

Anyway that was a good find. Thanks and sorry! But also: Curious if folks have ideas for other things we could test?

3 Likes

I’d love to see the JSON. (I usually Ctrl-C & Ctrl-P into a notepad to take a look.)

And I miss scrolling in the window.

1 Like

click and drag to scroll. I gotta add scroll bars and pgup/pgdn/arrow scrolling. I should add a dump to stdout button also.

the json is a really good idea.

Just installed the daily build on my Windows system. Created a test patch with Meander and dropped LintBuddy in. Seems to work with no problems, but how do I scroll or tab to the right? Many of the Meander labels go out of view to the right in the LintBuddy module window.

I think this is a productive diagnostic module development effort. Thanks for working on this!

Yeah is there a widget in the rack library that already does scrollable text area? I banged that one together myself and it is obviously in need of work. I should have made that clearer :slight_smile:

Let me add a “dump to stdout” button also and a json test

2 Likes

At the risk of asking the obvious… What does the “lint” outport output?

none of the ports input or output anything they just are connectors

but to connect if you have an output only module you need an input. if you have an input only module you need an output.

so i added both

2 Likes

Ah, gotcha. Thanks.

So, one or the other has to be hooked up, I suppose. I hooked up both to Meander but the results are the same with both. (with two instances of LintBuddy)

1 Like

As a non dev it’s quite interesting that you can ‘interrogate’ a module through any of its ports in this way.

2 Likes

Well the engine knows the modules on both ends of a cable and will hand you a reference to a running module object. So all I have to do is traverse the engine cables and look for who is on the other end, then you get a pointer to a rack::Module which has the same API

3 Likes

OK so I just pushed a new version which

1: adds a “dump to stdout” button until i get that UI less crudulent 2: adds a “json extract” test which will pull the json and if there’s non-null json put it in the info panel. this is really good idea.

any hints on how to do scrollable text display area welcome. Otherwise I’ll just code them up some time.

What’s the module called that lets you enter code? Can’t remember…

Just wondering if that has a scroll function you could use.