diff --git a/debuggers/gdb/debuggerplugin.cpp b/debuggers/gdb/debuggerplugin.cpp index 3de93f400d..9532e967c2 100644 --- a/debuggers/gdb/debuggerplugin.cpp +++ b/debuggers/gdb/debuggerplugin.cpp @@ -1,125 +1,132 @@ // /* // * GDB Debugger Support // * // * Copyright 1999-2001 John Birch // * Copyright 2001 by Bernd Gehrmann // * Copyright 2006 Vladimir Prus // * Copyright 2007 Hamish Rodda // * // * This program is free software; you can redistribute it and/or modify // * it under the terms of the GNU General Public License as // * published by the Free Software Foundation; either version 2 of the // * License, or (at your option) any later version. // * // * This program is distributed in the hope that it will be useful, // * but WITHOUT ANY WARRANTY; without even the implied warranty of // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // * GNU General Public License for more details. // * // * You should have received a copy of the GNU General Public // * License along with this program; if not, write to the // * Free Software Foundation, Inc., // * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // */ #include "debuggerplugin.h" #include "widgets/disassemblewidget.h" #include "memviewdlg.h" #include "gdboutputwidget.h" #include "gdbconfigpage.h" #include "debugsession.h" #include #include #include #include #include #include #include +// explicit init of resources needed, because all files +// are first compiled into a static library which is also used for unit testing +// for some reason the respective resource init methods are not triggered or registered then +inline void initMyResource() { Q_INIT_RESOURCE(kdevgdb); } + using namespace KDevMI::GDB; K_PLUGIN_FACTORY_WITH_JSON(CppDebuggerFactory, "kdevgdb.json", registerPlugin(); ) CppDebuggerPlugin::CppDebuggerPlugin(QObject *parent, const QVariantList &) : MIDebuggerPlugin("kdevgdb", i18n("GDB"), parent) , disassemblefactory(nullptr) , gdbfactory(nullptr) , memoryviewerfactory(nullptr) { + initMyResource(); + setXMLFile("kdevgdbui.rc"); QList plugins = KDevelop::ICore::self()->pluginController()->allPluginsForExtension("org.kdevelop.IExecutePlugin"); foreach(IPlugin* plugin, plugins) { IExecutePlugin* iface = plugin->extension(); Q_ASSERT(iface); KDevelop::LaunchConfigurationType* type = core()->runController()->launchConfigurationTypeForId( iface->nativeAppConfigTypeId() ); Q_ASSERT(type); type->addLauncher( new GdbLauncher( this, iface ) ); } } void CppDebuggerPlugin::setupToolviews() { disassemblefactory = new DebuggerToolFactory( this, "org.kdevelop.debugger.DisassemblerView", Qt::BottomDockWidgetArea); gdbfactory = new DebuggerToolFactory( this, "org.kdevelop.debugger.ConsoleView",Qt::BottomDockWidgetArea); core()->uiController()->addToolView( i18n("Disassemble/Registers"), disassemblefactory); core()->uiController()->addToolView( i18n("GDB"), gdbfactory); #ifndef WITH_OKTETA memoryviewerfactory = nullptr; #else memoryviewerfactory = new DebuggerToolFactory( this, "org.kdevelop.debugger.MemoryView", Qt::BottomDockWidgetArea); core()->uiController()->addToolView( i18n("Memory"), memoryviewerfactory); #endif } void CppDebuggerPlugin::unloadToolviews() { if (disassemblefactory) { core()->uiController()->removeToolView(disassemblefactory); disassemblefactory = nullptr; } if (gdbfactory) { core()->uiController()->removeToolView(gdbfactory); gdbfactory = nullptr; } if (memoryviewerfactory) { core()->uiController()->removeToolView(memoryviewerfactory); memoryviewerfactory = nullptr; } } CppDebuggerPlugin::~CppDebuggerPlugin() { } DebugSession* CppDebuggerPlugin::createSession() { DebugSession *session = new DebugSession(this); KDevelop::ICore::self()->debugController()->addSession(session); connect(session, &DebugSession::showMessage, this, &CppDebuggerPlugin::showStatusMessage); connect(session, &DebugSession::reset, this, &CppDebuggerPlugin::reset); connect(session, &DebugSession::raiseDebuggerConsoleViews, this, &CppDebuggerPlugin::raiseDebuggerConsoleViews); return session; } #include "debuggerplugin.moc"