diff --git a/kdevplatform/debugger/interfaces/idebugsession.h b/kdevplatform/debugger/interfaces/idebugsession.h index 5a94e431fe..af54a8c75e 100644 --- a/kdevplatform/debugger/interfaces/idebugsession.h +++ b/kdevplatform/debugger/interfaces/idebugsession.h @@ -1,196 +1,196 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright 2009 Niko Sams * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library 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 Library 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. * ***************************************************************************/ #ifndef KDEVPLATFORM_IDEBUGSESSION_H #define KDEVPLATFORM_IDEBUGSESSION_H #include #include #include namespace KDevelop { class IVariableController; class IBreakpointController; class IFrameStackModel; class Breakpoint; class StackModel; class KDEVPLATFORMDEBUGGER_EXPORT IDebugSession : public QObject { Q_OBJECT - Q_ENUMS(DebuggerState) public: IDebugSession(); ~IDebugSession() override; enum DebuggerState { NotStartedState, StartingState, ActiveState, PausedState, StoppingState, StoppedState, EndedState }; + Q_ENUM(DebuggerState) enum event_t { program_state_changed = 1, program_exited, debugger_exited, // Emitted when the thread or frame that is selected in UI // changes. thread_or_frame_changed, debugger_busy, debugger_ready, // Raised when debugger believe that program start running. // Can be used to hide current line indicator. // Don't count on this being raise in all cases where // program is running. program_running, // Raise when the debugger is in touch with the program, // and should have access to its debug symbols. The program // is not necessary running yet, or might already exited, // or be otherwise dead. connected_to_program }; public: /** * Current state of the debug session */ virtual DebuggerState state() const = 0; /** * Should return if restart is currently available */ virtual bool restartAvaliable() const = 0; /** * Returns if the debugee is currently running. This includes paused. */ bool isRunning() const; /** * Returns the local Url for a source file used in the current debug session. * * The default implementation just returns the url and is sufficient for * local debuggers. Remote debuggers can implement a path mapping mechanism. */ virtual QPair convertToLocalUrl(const QPair &remoteUrl) const; /** * Returns the remote Url for a source file used in the current debug session. * * The default implementation just returns the url and is sufficient for * local debuggers. Remote debuggers can implement a path mapping mechanism. */ virtual QPair convertToRemoteUrl(const QPair &localUrl) const; /** * @return the breakpoint controller of this session * * @note Implementations must ensure that a breakpoint controller always exists (even if it * is a dummy stub implementation that does nothing), and that it does not change during * the lifetime of a session. */ virtual IBreakpointController* breakpointController() const = 0; /** * @return the variable controller of this session * * @note Implementations must ensure that a variable controller always exists (even if it * is a dummy stub implementation that does nothing), and that it does not change during * the lifetime of a session. */ virtual IVariableController* variableController() const = 0; /** * @return the frame stack model of this session * * @note Implementations must ensure that a frame stack model always exists (even if it * is a dummy stub implementation that does nothing), and that it does not change during * the lifetime of a session. */ virtual IFrameStackModel* frameStackModel() const = 0; public Q_SLOTS: virtual void restartDebugger() = 0; virtual void stopDebugger() = 0; virtual void interruptDebugger() = 0; virtual void run() = 0; virtual void runToCursor() = 0; virtual void jumpToCursor() = 0; virtual void stepOver() = 0; virtual void stepIntoInstruction() = 0; virtual void stepInto() = 0; virtual void stepOverInstruction() = 0; virtual void stepOut() = 0; Q_SIGNALS: void stateChanged(KDevelop::IDebugSession::DebuggerState state); void showStepInSource(const QUrl& file, int line, const QString &addr); void showStepInDisassemble(const QString &addr); void clearExecutionPoint(); void finished(); void raiseFramestackViews(); /** This signal is emitted whenever the given event in a program happens. See DESIGN.txt for expected handled of each event. NOTE: this signal should never be emitted directly. Instead, use raiseEvent. */ void event(IDebugSession::event_t e); public: using QObject::event; // prevent hiding of base method. QUrl currentUrl() const; int currentLine() const; QString currentAddr() const; protected: // Clear the position before running code void clearCurrentPosition(); /// Sets new position and emits showStepInSource or showStepInDisassemble (if source file is unavailable) signal void setCurrentPosition(const QUrl& url, int line, const QString& addr); /** Raises the specified event. Should be used instead of emitting 'event' directly, since this method can perform additional book-keeping for events. FIXME: it might make sense to automatically route events to all debugger components, as opposed to requiring that they connect to any signal. */ virtual void raiseEvent(event_t e); friend class FrameStackModel; private: friend class IDebugSessionPrivate; const QScopedPointer d; }; } #endif diff --git a/kdevplatform/interfaces/iruncontroller.h b/kdevplatform/interfaces/iruncontroller.h index 53441ae587..18dbe9bb74 100644 --- a/kdevplatform/interfaces/iruncontroller.h +++ b/kdevplatform/interfaces/iruncontroller.h @@ -1,168 +1,169 @@ /* This file is part of KDevelop Copyright 2007-2008 Hamish Rodda This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDEVPLATFORM_IRUNCONTROLLER_H #define KDEVPLATFORM_IRUNCONTROLLER_H #include #include "interfacesexport.h" class KJob; namespace KDevelop { class IProject; class ILaunchMode; class ILaunchConfiguration; class LaunchConfigurationType; /** * The main controller for running processes. */ class KDEVPLATFORMINTERFACES_EXPORT IRunController : public KJobTrackerInterface { Q_OBJECT - Q_ENUMS(State) + public: ///Constructor. explicit IRunController(QObject *parent); /** * Interrogate the current managed jobs */ virtual QList currentJobs() const = 0; /** * An enumeration of the possible states for the run controller. */ enum State { Idle /**< No processes are currently running */, Running /**< processes are currently running */ }; + Q_ENUM(State) /** * Get a list of all launch modes that the app knows * @returns a list of registered launch modes */ virtual QList launchModes() const = 0; /** * Get a list of all available launch configurations */ virtual QList launchConfigurations() const = 0; /** * Get a specific launch mode based using its \a id * @param id the identifier of the launchmode to get * @returns launch mode for the given id or 0 if no such mode is known */ virtual ILaunchMode* launchModeForId( const QString& id ) const = 0; /** * add @p mode to the list of registered launch modes * @param mode the mode to be registered */ virtual void addLaunchMode( ILaunchMode* mode ) = 0; /** * remove @p mode from the list of registered launch modes * @param mode the mode to be unregistered */ virtual void removeLaunchMode( ILaunchMode* mode ) = 0; /** * Get a list of all configuration types that are registered * @returns a list of run configuration types */ virtual QList launchConfigurationTypes() const = 0; /** * Adds @p type to the list of known run config types * @param type the new run configuration type */ virtual void addConfigurationType( LaunchConfigurationType* type ) = 0; /** * Removes @p type from the list of known run config types * @param type run configuration type that should be removed */ virtual void removeConfigurationType( LaunchConfigurationType* type ) = 0; /** * Executes the default launch in the given mode * @param runMode the launch mode to start with */ virtual void executeDefaultLaunch( const QString& runMode ) = 0; virtual KJob* execute(const QString& launchMode, ILaunchConfiguration* launch) = 0; /** * tries to find a launch config type for the given @p id * @param id the id of the launch configuration type to search * @returns the launch configuration type if found, or 0 otherwise */ virtual LaunchConfigurationType* launchConfigurationTypeForId( const QString& id ) = 0; /** * Creates a new launch configuration in the given project or in the session if no project * was provided using the given launch configuration type and launcher. The configuration * is also added to the list of configurations in the runcontroller. * * @param type the launch configuration type to be used for the new config * @param launcher the mode and id of the launcher to be used in the config * @param project the project in which the launch configuration should be stored * @param name the name of the new launch configuration, if this is empty a new default name will be generated * @returns a new launch configuration */ virtual ILaunchConfiguration* createLaunchConfiguration( LaunchConfigurationType* type, const QPair& launcher, KDevelop::IProject* project = nullptr, const QString& name = QString() ) = 0; /// Opens a dialog to setup new launch configurations, or to change the existing ones. virtual void showConfigurationDialog() const = 0; public Q_SLOTS: /** * Request for all running processes to be killed. */ virtual void stopAllProcesses() = 0; Q_SIGNALS: /** * Notify that the state of the run controller has changed to \a {state}. */ void runStateChanged(State state); /** * Notify that a new job has been registered. */ void jobRegistered(KJob* job); /** * Notify that a job has been unregistered. */ void jobUnregistered(KJob* job); }; } #endif // KDEVPLATFORM_IRUNCONTROLLER_H