Plugin debugging
The only information in MuseScore-en.pdf about Create/edit/run/debug plugins is only one line -"
It is possible to create new or edit existing plugins and run them via the Plugin Creator" and next - one picture.
There is https://musescore.org/nl/plugin-development - but, unfortunately for old version of MS.
It looks like new Plugin Creator is only editor+Score Elements help. But unfortunately this help have not any information about plugin structure and methods and tools for plugin dubugging (as it was in old documentation: "MuseScore is bundled with a plugin debugger. You can activate it from the Help menu..."). I believe that such section of the documentation required!
Yes, there is Qt help - http://doc.qt.io/qt-5/qmlapplications.html for c++ developers,
But can any body give some hints or links to documentatioin about how to debug MuseScore plugins in current version?
Comments
Plugin Creation Documentation is indeed very limited at this point.
The very minimal code structure for a Plugin can be found by pressing 'New' in the Plugin Creator.
The onRun method is the one that gets called when someone activates your plugin from the menu.
As shown in that minimal code example, you may use console.log() to aid you in basic debugging. Its not much, but it beats nothing..
Check out this link: http://doc.qt.io/qt-5/qtquick-debugging.html
By the way, I found that the plugin creator is very buggy and doesn't support such basic functions as importing another files. In my opinion it's better to use external editor. But then you get stuck with simple logs. In such case run MuseScore from terminal with -d flag. On OS X it looks like:
{syntaxhighlighter SH}
$ cd /Applications/MuseScore\ 2.app/MacOS
$ ./mscore -d
{/syntaxhighlighter}
Also you can open API docs in the browser instead of looking any time in the plugin creator. I don't know where it in the other platforms, but on OS X it's in the app's bundle Resources/Manual/plugins/plugins.html
In reply to Check out this link: by Ales Tsurko
Thank you Ales!
I've written useful plugin in more then 1000 lines and it works fine. I use now in Windows
- Qt Creator for source editing and Qt context help, but for now I don't understand how it possible to run plugin from external editor (I'll see your link, thank you!) so
- I use Plugin Creator for plugin running and for MuseScore specific objects help (Score and so on)
- I also prefer to log debug messages to console AND to dialog window of plugin such as
function traceStr (str, toScreen) {
console.log (str)
if (toScreen == 1)
infoText.append(str);
}
I also tried to use ./mscore -d but as I understand -d works only for debug build of MuseScore - am I right?
In reply to Thank you Ales! I've written by straannick
I use -d with the release build.
Here is another flags BTW: https://musescore.org/en/node/38301
In reply to I use -d with the release by Ales Tsurko
I too am running the latest Musescore release on Windows. I am interested in being able to debug as well using Qt Creator. I tried running the latest nightly build and then attaching to the nightly.exe process via the Debugger in Qt Creator (v3.1.1 for Qt 5.2.1 MSVC 2010, 32 bit).
I started MuseScore using 'nightly.exe -d'
From Qt Creator, I was able to attach ( via "Attach to Running Application..." and then searching for 'nightly.exe'.
I then opened the helloqml.qml file within Qt Creator and set a breakpoint on the first line within the onRun function.
Hit continue in the debugger.
Then started the Hello QML plugin form the MuseScore Plugins
For some reason, the Qt Creator Debugger is not stopping at the breakpoint as the plugin executes within MuseScore, but doesn't seem to interact with the Qt Creator in any way.
I was using MuseScoreNightly-2016-02-04-0930-master-5b20a4a.7z to try out this debugging method.
Any ideas if this might work and if this is the same procedure as described in this thread?
In reply to I too am running the latest by jazzspire
Sorry, I'm not familiar with Qt Creator.
In reply to I too am running the latest by jazzspire
Here is https://musescore.org/en/node/17359#comment-417836
some not very successful experience from jeetee and Miwarre.
In reply to Here is by straannick
If you are still looking into this, you might want to check http://stackoverflow.com/questions/13366495/how-to-qt-qml-debugging-and…
I didn't test any of this, but it recompiling MuseScore with an option gives us the ability to debug QML from Qt creator, I'm ready to include it in one of the next release.
In reply to If you are still looking into by [DELETED] 5
It would be very useful to add ability to use QtCreator for plugin debugging, but as I understand in stackoverflow discussion they are talking about remote debugging of standalone Qml/QtQuick application and how "to attach Qt Creator to a remotely running application"". Do you remember I've asked about not remote debugging MuseScore project in the QtCreator - how to get inside plugin source at the point p->runPlugin(); ? It would be great if stackoverflow's recomendation will help, but I doubt. I suppose it will also require to have a critical look at the interbal plugin management system. Is it so, Nicolas?
In reply to It would be very useful to by straannick
From what I gather from that post and the Qt documentation it would indeed only allow you to debug QML files that are part of your core/compiled application, not the ones that are dynamically loaded the way MuseScore handles its plugins. Therefor I'm also skeptical that this would work.
That being said: it can't hurt to try it out. I currently don't have the time to play with this, but I am curious to see where this path leads..
In reply to If you are still looking into by [DELETED] 5
Hers is a link to debugging in Qt5. //doc.qt.io/qt-5/qtquick-debugging.html
Note, there are two different compile flags Qt Quick 1 and Qt Quick 2. MuseScore uses Qt Quick 2, correct? I assume we would this need to use the qml_debug compile option. I assume this will be enough to enable everything when using Qt5. The documentation also mentions enabling debugging in C++ and QML at the same time. That's nice!
In reply to If you are still looking into by [DELETED] 5
I'm not setup to compile Musescore, but I do have a Qt5 environment setup and can test out QML debugging. Is there any one who could provide a test build with the #defines mentioned in the stack overflow article? I bet they would enable the Debug > Attach to Running Process as well. I do see the debugger attach, and I can advance thru the lines of machine code, but the symbol table is not available and the breakpoints do not work inside of QML. It's worth a test. Maybe you only need the #defines in the code that wraps QML.
While the Plugin Creator is a great start to enabling the development of plugins, I think that using a full featured IDE / debugger like Qt Creator will help newbies learn QML and assist in debugging Musescore plugins.
Cheers,
Paul
In reply to Check out this link: by Ales Tsurko
Oops... There is an error in path. It should be:
{syntaxhighlighter SH}
$ cd /Applications/MuseScore\ 2.app/Contents/MacOS
{/syntaxhighlighter}