Debug a plugin [Solved]



  • Hi all,
    I'm continuing in my tests with library and plugin.

    I'm working under Linux.
    Now I compiled a simple plugin (".so") but obviously it isn't impossible to execute it.

    In my main application I load the plugin this way:

    @
    QPluginLoader plugin_loader(dir_plugin.absoluteFilePath(nome_file));
    QObject *plugin = plugin_loader.instance();
    if (plugin)
    {
    PluginInterface *plugin_widget = qobject_cast<PluginInterface *>(plugin);
    if (plugin_widget)
    {
    QWidget *widget = plugin_widget->createWidget();
    widget->show();
    ....
    ....
    }
    }
    @

    It works fine but how can I debug (stepping between instruction) the plugin?



  • As far as I know, if you built the plug-in with -g (debug mode), you should be able to tell gdb to place breakpoints there without any trouble. I've never experienced any trouble using this approach.



  • [quote author="Franzk" date="1306938438"]As far as I know, if you built the plug-in with -g (debug mode), you should be able to tell gdb to place breakpoints there without any trouble. I've never experienced any trouble using this approach.[/quote]

    The problem is that in my main application I haven't included plugin source so how can I put breakpoints in it using Qt Creator?



  • You need access to the source for it to work. Maybe "specifying the source directory":http://inside.mines.edu/fs_home/lwiencke/elab/gdb/gdb_49.html of the plug-in could help you further.



  • [quote author="Franzk" date="1306938845"]You need access to the source for it to work. Maybe "specifying the source directory":http://inside.mines.edu/fs_home/lwiencke/elab/gdb/gdb_49.html of the plug-in could help you further.[/quote]

    Thanks Franzk,
    I solved navigating with Qt Creator (while opened main application project) in the source of the plugin, opening the .cpp an putting the breakpoints.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.