| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | /**************************************************************************
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-03-05 11:25:49 +01:00
										 |  |  | ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-06-17 00:01:27 +10:00
										 |  |  | ** Contact: Nokia Corporation (qt-info@nokia.com) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** Commercial Usage | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** Licensees holding valid Qt Commercial licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the Qt Commercial License Agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and Nokia. | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
					
						
							|  |  |  | ** General Public License version 2.1 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
					
						
							|  |  |  | ** packaging of this file.  Please review the following information to | 
					
						
							|  |  |  | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
					
						
							|  |  |  | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							| 
									
										
										
										
											2008-12-02 14:17:16 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | ** If you are unsure which license is appropriate for your use, please | 
					
						
							| 
									
										
										
										
											2009-08-14 09:30:56 +02:00
										 |  |  | ** contact the sales department at http://qt.nokia.com/contact.
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2009-02-25 09:15:00 +01:00
										 |  |  | **************************************************************************/ | 
					
						
							| 
									
										
										
										
											2008-12-02 15:08:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include "debuggerplugin.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  | #include "breakhandler.h"
 | 
					
						
							| 
									
										
										
										
											2009-03-17 17:00:06 +01:00
										 |  |  | #include "debuggeractions.h"
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | #include "debuggerdialogs.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include "debuggerconstants.h"
 | 
					
						
							|  |  |  | #include "debuggermanager.h"
 | 
					
						
							|  |  |  | #include "debuggerrunner.h"
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  | #include "debuggerstringutils.h"
 | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | #include "debuggeruiswitcher.h"
 | 
					
						
							|  |  |  | #include "debuggermainwindow.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  | #include "ui_commonoptionspage.h"
 | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | #include "ui_dumperoptionpage.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 13:39:31 +01:00
										 |  |  | #include <coreplugin/actionmanager/actionmanager.h>
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:59:06 +01:00
										 |  |  | #include <coreplugin/actionmanager/actioncontainer.h>
 | 
					
						
							|  |  |  | #include <coreplugin/actionmanager/command.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | #include <coreplugin/basemode.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/coreconstants.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | #include <coreplugin/dialogs/ioptionspage.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/editormanager/editormanager.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | #include <coreplugin/findplaceholder.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/icore.h>
 | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  | #include <coreplugin/icorelistener.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/messagemanager.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | #include <coreplugin/minisplitter.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/modemanager.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | #include <coreplugin/navigationwidget.h>
 | 
					
						
							|  |  |  | #include <coreplugin/outputpane.h>
 | 
					
						
							|  |  |  | #include <coreplugin/rightpane.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <coreplugin/uniqueidmanager.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-09 16:18:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <cplusplus/ExpressionUnderCursor.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-09 16:18:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <cppeditor/cppeditorconstants.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-09 16:18:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 11:52:04 +01:00
										 |  |  | #include <extensionsystem/pluginmanager.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  | #include <coreplugin/manhattanstyle.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-28 14:29:54 +01:00
										 |  |  | #include <projectexplorer/projectexplorer.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <projectexplorer/projectexplorerconstants.h>
 | 
					
						
							|  |  |  | #include <projectexplorer/session.h>
 | 
					
						
							| 
									
										
										
										
											2009-09-29 11:39:55 +02:00
										 |  |  | #include <projectexplorer/project.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-09 16:18:28 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <texteditor/basetexteditor.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <texteditor/basetextmark.h>
 | 
					
						
							|  |  |  | #include <texteditor/itexteditor.h>
 | 
					
						
							|  |  |  | #include <texteditor/texteditorconstants.h>
 | 
					
						
							| 
									
										
										
										
											2010-04-19 16:42:02 +02:00
										 |  |  | #include <texteditor/texteditorsettings.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-09 16:18:28 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <utils/qtcassert.h>
 | 
					
						
							| 
									
										
										
										
											2009-07-16 15:57:59 +02:00
										 |  |  | #include <utils/styledbar.h>
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:59:06 +01:00
										 |  |  | #include <utils/savedaction.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QtCore/QDebug>
 | 
					
						
							|  |  |  | #include <QtCore/QObject>
 | 
					
						
							|  |  |  | #include <QtCore/QPoint>
 | 
					
						
							|  |  |  | #include <QtCore/QSettings>
 | 
					
						
							| 
									
										
										
										
											2009-01-05 12:54:52 +01:00
										 |  |  | #include <QtCore/QtPlugin>
 | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  | #include <QtCore/QCoreApplication>
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | #include <QtCore/QTimer>
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | #include <QtCore/QVariant>
 | 
					
						
							| 
									
										
										
										
											2008-12-09 16:18:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | #include <QtGui/QLineEdit>
 | 
					
						
							| 
									
										
										
										
											2009-01-13 17:41:23 +01:00
										 |  |  | #include <QtGui/QDockWidget>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include <QtGui/QPlainTextEdit>
 | 
					
						
							|  |  |  | #include <QtGui/QTextBlock>
 | 
					
						
							|  |  |  | #include <QtGui/QTextCursor>
 | 
					
						
							| 
									
										
										
										
											2009-10-01 16:38:08 +02:00
										 |  |  | #include <QtGui/QToolButton>
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | #include <QtGui/QMessageBox>
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:59:06 +01:00
										 |  |  | #include <QtGui/QAction>
 | 
					
						
							|  |  |  | #include <QtGui/QMenu>
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-12 10:51:25 +02:00
										 |  |  | #include <climits>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | using namespace Core; | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | using namespace Debugger; | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | using namespace Debugger::Constants; | 
					
						
							|  |  |  | using namespace Debugger::Internal; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | using namespace ProjectExplorer; | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | using namespace TextEditor; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  | namespace CC = Core::Constants; | 
					
						
							|  |  |  | namespace PE = ProjectExplorer::Constants; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Debugger { | 
					
						
							|  |  |  | namespace Constants { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-08 19:28:28 +02:00
										 |  |  | const char * const M_DEBUG_START_DEBUGGING = "QtCreator.Menu.Debug.StartDebugging"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | const char * const STARTEXTERNAL        = "Debugger.StartExternal"; | 
					
						
							|  |  |  | const char * const ATTACHEXTERNAL       = "Debugger.AttachExternal"; | 
					
						
							| 
									
										
										
										
											2009-03-02 15:14:12 +01:00
										 |  |  | const char * const ATTACHCORE           = "Debugger.AttachCore"; | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  | const char * const ATTACHTCF            = "Debugger.AttachTcf"; | 
					
						
							| 
									
										
										
										
											2009-05-04 14:47:45 +02:00
										 |  |  | const char * const ATTACHREMOTE         = "Debugger.AttachRemote"; | 
					
						
							| 
									
										
										
										
											2009-05-07 15:20:44 +02:00
										 |  |  | const char * const DETACH               = "Debugger.Detach"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  | const char * const RUN_TO_LINE1         = "Debugger.RunToLine1"; | 
					
						
							|  |  |  | const char * const RUN_TO_LINE2         = "Debugger.RunToLine2"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | const char * const RUN_TO_FUNCTION      = "Debugger.RunToFunction"; | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  | const char * const JUMP_TO_LINE1        = "Debugger.JumpToLine1"; | 
					
						
							|  |  |  | const char * const JUMP_TO_LINE2        = "Debugger.JumpToLine2"; | 
					
						
							| 
									
										
										
										
											2010-02-15 16:02:41 +01:00
										 |  |  | const char * const RETURN_FROM_FUNCTION = "Debugger.ReturnFromFunction"; | 
					
						
							| 
									
										
										
										
											2010-02-02 17:25:14 +01:00
										 |  |  | const char * const SNAPSHOT             = "Debugger.Snapshot"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | const char * const TOGGLE_BREAK         = "Debugger.ToggleBreak"; | 
					
						
							|  |  |  | const char * const BREAK_BY_FUNCTION    = "Debugger.BreakByFunction"; | 
					
						
							|  |  |  | const char * const BREAK_AT_MAIN        = "Debugger.BreakAtMain"; | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  | const char * const ADD_TO_WATCH1        = "Debugger.AddToWatch1"; | 
					
						
							|  |  |  | const char * const ADD_TO_WATCH2        = "Debugger.AddToWatch2"; | 
					
						
							| 
									
										
										
										
											2009-09-29 11:13:19 +02:00
										 |  |  | const char * const OPERATE_BY_INSTRUCTION  = "Debugger.OperateByInstruction"; | 
					
						
							| 
									
										
										
										
											2010-06-07 13:17:19 +02:00
										 |  |  | const char * const FRAME_UP             = "Debugger.FrameUp"; | 
					
						
							|  |  |  | const char * const FRAME_DOWN           = "Debugger.FrameDown"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 20:45:49 +02:00
										 |  |  | #ifdef Q_WS_MAC
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | const char * const INTERRUPT_KEY            = "Shift+F5"; | 
					
						
							|  |  |  | const char * const RESET_KEY                = "Ctrl+Shift+F5"; | 
					
						
							|  |  |  | const char * const STEP_KEY                 = "F7"; | 
					
						
							|  |  |  | const char * const STEPOUT_KEY              = "Shift+F7"; | 
					
						
							|  |  |  | const char * const NEXT_KEY                 = "F6"; | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  | const char * const REVERSE_KEY              = ""; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | const char * const RUN_TO_LINE_KEY          = "Shift+F8"; | 
					
						
							|  |  |  | const char * const RUN_TO_FUNCTION_KEY      = "Ctrl+F6"; | 
					
						
							|  |  |  | const char * const JUMP_TO_LINE_KEY         = "Alt+D,Alt+L"; | 
					
						
							|  |  |  | const char * const TOGGLE_BREAK_KEY         = "F8"; | 
					
						
							|  |  |  | const char * const BREAK_BY_FUNCTION_KEY    = "Alt+D,Alt+F"; | 
					
						
							|  |  |  | const char * const BREAK_AT_MAIN_KEY        = "Alt+D,Alt+M"; | 
					
						
							|  |  |  | const char * const ADD_TO_WATCH_KEY         = "Alt+D,Alt+W"; | 
					
						
							| 
									
										
										
										
											2010-02-02 17:25:14 +01:00
										 |  |  | const char * const SNAPSHOT_KEY             = "Alt+D,Alt+S"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #else
 | 
					
						
							|  |  |  | const char * const INTERRUPT_KEY            = "Shift+F5"; | 
					
						
							|  |  |  | const char * const RESET_KEY                = "Ctrl+Shift+F5"; | 
					
						
							|  |  |  | const char * const STEP_KEY                 = "F11"; | 
					
						
							|  |  |  | const char * const STEPOUT_KEY              = "Shift+F11"; | 
					
						
							|  |  |  | const char * const NEXT_KEY                 = "F10"; | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  | const char * const REVERSE_KEY              = "F12"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | const char * const RUN_TO_LINE_KEY          = ""; | 
					
						
							|  |  |  | const char * const RUN_TO_FUNCTION_KEY      = ""; | 
					
						
							|  |  |  | const char * const JUMP_TO_LINE_KEY         = ""; | 
					
						
							|  |  |  | const char * const TOGGLE_BREAK_KEY         = "F9"; | 
					
						
							|  |  |  | const char * const BREAK_BY_FUNCTION_KEY    = ""; | 
					
						
							|  |  |  | const char * const BREAK_AT_MAIN_KEY        = ""; | 
					
						
							|  |  |  | const char * const ADD_TO_WATCH_KEY         = "Ctrl+Alt+Q"; | 
					
						
							| 
									
										
										
										
											2010-02-02 17:25:14 +01:00
										 |  |  | const char * const SNAPSHOT_KEY             = "Alt+D,Alt+S"; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace Constants
 | 
					
						
							|  |  |  | } // namespace Debugger
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-28 14:29:54 +01:00
										 |  |  | static ProjectExplorer::SessionManager *sessionManager() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return ProjectExplorer::ProjectExplorerPlugin::instance()->session(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  | static QSettings *settings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return ICore::instance()->settings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 15:57:59 +02:00
										 |  |  | static QToolButton *toolButton(QAction *action) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QToolButton *button = new QToolButton; | 
					
						
							|  |  |  |     button->setDefaultAction(action); | 
					
						
							|  |  |  |     return button; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // DebugMode
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | namespace Debugger { | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DebugMode : public Core::BaseMode | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     DebugMode(QObject *parent = 0); | 
					
						
							|  |  |  |     ~DebugMode(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DebugMode::DebugMode(QObject *parent) | 
					
						
							| 
									
										
										
										
											2009-01-14 12:00:22 +01:00
										 |  |  |   : BaseMode(parent) | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     setDisplayName(tr("Debug")); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     setId(MODE_DEBUG); | 
					
						
							| 
									
										
										
										
											2009-01-14 12:00:22 +01:00
										 |  |  |     setIcon(QIcon(":/fancyactionbar/images/mode_Debug.png")); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     setPriority(P_MODE_DEBUG); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DebugMode::~DebugMode() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // Make sure the editor manager does not get deleted
 | 
					
						
							|  |  |  |     EditorManager::instance()->setParent(0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // DebuggerListener: Close the debugging session if running.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  | class DebuggerListener : public Core::ICoreListener | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |     Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     DebuggerListener() {} | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |     virtual bool coreAboutToClose(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DebuggerListener::coreAboutToClose() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     DebuggerManager *mgr = DebuggerManager::instance(); | 
					
						
							|  |  |  |     if (!mgr) | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     // Ask to terminate the session.
 | 
					
						
							|  |  |  |     bool cleanTermination = false; | 
					
						
							|  |  |  |     switch (mgr->state()) { | 
					
						
							|  |  |  |     case DebuggerNotReady: | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     case AdapterStarted:     // Most importantly, terminating a running
 | 
					
						
							|  |  |  |     case AdapterStartFailed: // debuggee can cause problems.
 | 
					
						
							|  |  |  |     case InferiorUnrunnable: | 
					
						
							|  |  |  |     case InferiorStartFailed: | 
					
						
							|  |  |  |     case InferiorStopped: | 
					
						
							|  |  |  |     case InferiorShutDown: | 
					
						
							|  |  |  |         cleanTermination = true; | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |     const QString question = cleanTermination ? | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         tr("A debugging session is still in progress.\n" | 
					
						
							|  |  |  |            "Would you like to terminate it?") : | 
					
						
							|  |  |  |         tr("A debugging session is still in progress. " | 
					
						
							|  |  |  |            "Terminating the session in the current" | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |            " state (%1) can leave the target in an inconsistent state." | 
					
						
							| 
									
										
										
										
											2009-10-27 19:34:40 +01:00
										 |  |  |            " Would you still like to terminate it?") | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         .arg(_(DebuggerManager::stateName(mgr->state()))); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QMessageBox::StandardButton answer = | 
					
						
							|  |  |  |         QMessageBox::question(DebuggerUISwitcher::instance()->mainWindow(), | 
					
						
							|  |  |  |             tr("Close Debugging Session"), question, | 
					
						
							|  |  |  |             QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-27 19:34:40 +01:00
										 |  |  |     if (answer != QMessageBox::Yes) | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |         return false; | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |     mgr->exitDebugger(); | 
					
						
							| 
									
										
										
										
											2009-10-27 09:51:14 +01:00
										 |  |  |     QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |     return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace Debugger
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // LocationMark
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | namespace Debugger { | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-14 13:04:05 +02:00
										 |  |  | // Used in "real" editors
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | class LocationMark : public TextEditor::BaseTextMark | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     LocationMark(const QString &fileName, int linenumber) | 
					
						
							|  |  |  |         : BaseTextMark(fileName, linenumber) | 
					
						
							| 
									
										
										
										
											2008-12-12 17:49:52 +01:00
										 |  |  |     {} | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-10 10:47:34 +01:00
										 |  |  |     QIcon icon() const { return DebuggerManager::instance()->locationMarkIcon(); } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     void updateLineNumber(int /*lineNumber*/) {} | 
					
						
							|  |  |  |     void updateBlock(const QTextBlock & /*block*/) {} | 
					
						
							| 
									
										
										
										
											2008-12-12 17:49:52 +01:00
										 |  |  |     void removedFromEditor() {} | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace Debugger
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  | // CommonOptionsPage
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Debugger { | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  | class CommonOptionsPage : public Core::IOptionsPage | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  |     CommonOptionsPage() {} | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // IOptionsPage
 | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  |     QString id() const | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         { return _(DEBUGGER_COMMON_SETTINGS_ID); } | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     QString displayName() const | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         { return QCoreApplication::translate("Debugger", DEBUGGER_COMMON_SETTINGS_NAME); } | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  |     QString category() const | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         { return _(DEBUGGER_SETTINGS_CATEGORY);  } | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     QString displayCategory() const | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         { return QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY); } | 
					
						
							| 
									
										
										
										
											2010-03-26 17:34:10 +01:00
										 |  |  |     QIcon categoryIcon() const | 
					
						
							|  |  |  |         { return QIcon(QLatin1String(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); } | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QWidget *createPage(QWidget *parent); | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  |     void apply() { m_group.apply(settings()); } | 
					
						
							| 
									
										
										
										
											2009-03-26 15:56:16 +01:00
										 |  |  |     void finish() { m_group.finish(); } | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     virtual bool matches(const QString &s) const; | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  |     Ui::CommonOptionsPage m_ui; | 
					
						
							| 
									
										
										
										
											2009-10-05 11:06:05 +02:00
										 |  |  |     Utils::SavedActionSet m_group; | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     QString m_searchKeywords; | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  | QWidget *CommonOptionsPage::createPage(QWidget *parent) | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QWidget *w = new QWidget(parent); | 
					
						
							|  |  |  |     m_ui.setupUi(w); | 
					
						
							| 
									
										
										
										
											2009-03-26 17:27:44 +01:00
										 |  |  |     m_group.clear(); | 
					
						
							| 
									
										
										
										
											2009-03-26 15:56:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(SwitchLanguageAutomatically), | 
					
						
							|  |  |  |         m_ui.checkBoxChangeLanguageAutomatically); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(ListSourceFiles), | 
					
						
							| 
									
										
										
										
											2009-03-26 17:27:44 +01:00
										 |  |  |         m_ui.checkBoxListSourceFiles); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(UseAlternatingRowColors), | 
					
						
							| 
									
										
										
										
											2009-05-05 10:14:35 +02:00
										 |  |  |         m_ui.checkBoxUseAlternatingRowColors); | 
					
						
							| 
									
										
										
										
											2010-01-29 21:33:57 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), | 
					
						
							| 
									
										
										
										
											2009-10-01 18:01:23 +02:00
										 |  |  |         m_ui.checkBoxUseToolTipsInMainEditor); | 
					
						
							| 
									
										
										
										
											2009-10-06 10:54:08 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(AutoDerefPointers), 0); | 
					
						
							| 
									
										
										
										
											2009-10-01 11:22:44 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0); | 
					
						
							|  |  |  |     m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0); | 
					
						
							|  |  |  |     m_group.insert(theDebuggerAction(UseAddressInBreakpointsView), 0); | 
					
						
							|  |  |  |     m_group.insert(theDebuggerAction(UseAddressInStackView), 0); | 
					
						
							| 
									
										
										
										
											2010-01-29 21:33:57 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(MaximalStackDepth), | 
					
						
							| 
									
										
										
										
											2009-04-02 15:06:24 +02:00
										 |  |  |         m_ui.spinBoxMaximalStackDepth); | 
					
						
							| 
									
										
										
										
											2009-11-25 08:35:02 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(ShowStdNamespace), 0); | 
					
						
							|  |  |  |     m_group.insert(theDebuggerAction(ShowQtNamespace), 0); | 
					
						
							| 
									
										
										
										
											2009-12-07 12:10:07 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(LogTimeStamps), 0); | 
					
						
							| 
									
										
										
										
											2010-01-15 12:01:26 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(VerboseLog), 0); | 
					
						
							| 
									
										
										
										
											2009-12-09 11:13:20 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(UsePreciseBreakpoints), 0); | 
					
						
							| 
									
										
										
										
											2010-02-11 17:29:10 +01:00
										 |  |  |     m_group.insert(theDebuggerAction(BreakOnThrow), 0); | 
					
						
							|  |  |  |     m_group.insert(theDebuggerAction(BreakOnCatch), 0); | 
					
						
							| 
									
										
										
										
											2010-03-25 16:54:23 +01:00
										 |  |  | #ifdef Q_OS_WIN
 | 
					
						
							|  |  |  |     Utils::SavedAction *registerAction = theDebuggerAction(RegisterForPostMortem); | 
					
						
							|  |  |  |     m_group.insert(registerAction, | 
					
						
							|  |  |  |         m_ui.checkBoxRegisterForPostMortem); | 
					
						
							|  |  |  |     connect(registerAction, SIGNAL(toggled(bool)), | 
					
						
							|  |  |  |             m_ui.checkBoxRegisterForPostMortem, SLOT(setChecked(bool))); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     if (m_searchKeywords.isEmpty()) { | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |         QTextStream(&m_searchKeywords) << ' ' | 
					
						
							|  |  |  |                 << m_ui.checkBoxChangeLanguageAutomatically->text() | 
					
						
							|  |  |  |                 << m_ui.checkBoxListSourceFiles->text() | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |                 << ' ' << m_ui.checkBoxUseAlternatingRowColors->text() | 
					
						
							|  |  |  |                 << ' ' << m_ui.checkBoxUseToolTipsInMainEditor->text() | 
					
						
							| 
									
										
										
										
											2010-03-25 16:54:23 +01:00
										 |  |  | #ifdef Q_OS_WIN
 | 
					
						
							|  |  |  |                 << ' ' << m_ui.checkBoxRegisterForPostMortem->text() | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |                 << ' ' << m_ui.labelMaximalStackDepth->text(); | 
					
						
							|  |  |  |         m_searchKeywords.remove(QLatin1Char('&')); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-25 16:54:23 +01:00
										 |  |  | #ifndef Q_OS_WIN
 | 
					
						
							|  |  |  |     m_ui.checkBoxRegisterForPostMortem->setVisible(false); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  |     return w; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  | bool CommonOptionsPage::matches(const QString &s) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_searchKeywords.contains(s, Qt::CaseInsensitive); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace Debugger
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  | // DebuggingHelperOptionPage
 | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  | static inline bool oxygenStyle() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (const ManhattanStyle *ms = qobject_cast<const ManhattanStyle *>(qApp->style())) | 
					
						
							| 
									
										
										
										
											2010-02-23 12:42:04 +01:00
										 |  |  |         return !qstrcmp("OxygenStyle", ms->baseStyle()->metaObject()->className()); | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     return false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | namespace Debugger { | 
					
						
							|  |  |  | namespace Internal { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  | class DebuggingHelperOptionPage : public Core::IOptionsPage | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     DebuggingHelperOptionPage() {} | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // IOptionsPage
 | 
					
						
							| 
									
										
										
										
											2010-04-06 16:42:24 +02:00
										 |  |  |     QString id() const { return _("Z.DebuggingHelper"); } | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     QString displayName() const { return tr("Debugging Helper"); } | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     QString category() const { return _(DEBUGGER_SETTINGS_CATEGORY); } | 
					
						
							|  |  |  |     QString displayCategory() const { return QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY); } | 
					
						
							| 
									
										
										
										
											2010-03-26 17:34:10 +01:00
										 |  |  |     QIcon categoryIcon() const { return QIcon(QLatin1String(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); } | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QWidget *createPage(QWidget *parent); | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  |     void apply() { m_group.apply(settings()); } | 
					
						
							| 
									
										
										
										
											2009-03-26 15:56:16 +01:00
										 |  |  |     void finish() { m_group.finish(); } | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     virtual bool matches(const QString &s) const; | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     Ui::DebuggingHelperOptionPage m_ui; | 
					
						
							| 
									
										
										
										
											2009-10-05 11:06:05 +02:00
										 |  |  |     Utils::SavedActionSet m_group; | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     QString m_searchKeywords; | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  | QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent) | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QWidget *w = new QWidget(parent); | 
					
						
							|  |  |  |     m_ui.setupUi(w); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-05 11:06:05 +02:00
										 |  |  |     m_ui.dumperLocationChooser->setExpectedKind(Utils::PathChooser::Command); | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose DebuggingHelper Location")); | 
					
						
							| 
									
										
										
										
											2009-03-23 13:02:50 +01:00
										 |  |  |     m_ui.dumperLocationChooser->setInitialBrowsePathBackup( | 
					
						
							|  |  |  |         Core::ICore::instance()->resourcePath() + "../../lib"); | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-26 17:27:44 +01:00
										 |  |  |     m_group.clear(); | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(UseDebuggingHelpers), | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |         m_ui.debuggingHelperGroupBox); | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(UseCustomDebuggingHelperLocation), | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |         m_ui.customLocationGroupBox); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     // Suppress Oxygen style's giving flat group boxes bold titles.
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     if (oxygenStyle()) | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         m_ui.customLocationGroupBox->setStyleSheet(_("QGroupBox::title { font: ; }")); | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(CustomDebuggingHelperLocation), | 
					
						
							| 
									
										
										
										
											2009-03-26 15:56:16 +01:00
										 |  |  |         m_ui.dumperLocationChooser); | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-16 16:26:28 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(UseCodeModel), | 
					
						
							|  |  |  |         m_ui.checkBoxUseCodeModel); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-10 14:38:36 +02:00
										 |  |  | #ifdef QT_DEBUG
 | 
					
						
							| 
									
										
										
										
											2009-04-07 16:39:17 +02:00
										 |  |  |     m_group.insert(theDebuggerAction(DebugDebuggingHelpers), | 
					
						
							|  |  |  |         m_ui.checkBoxDebugDebuggingHelpers); | 
					
						
							| 
									
										
										
										
											2009-07-10 14:38:36 +02:00
										 |  |  | #else
 | 
					
						
							|  |  |  |     m_ui.checkBoxDebugDebuggingHelpers->hide(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef QT_DEBUG
 | 
					
						
							|  |  |  | #if 0
 | 
					
						
							|  |  |  |     cmd = am->registerAction(m_manager->m_dumpLogAction, | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         DUMP_LOG, globalcontext); | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  |     //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
 | 
					
						
							|  |  |  |     cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11"))); | 
					
						
							|  |  |  |     mdebug->addAction(cmd); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     if (m_searchKeywords.isEmpty()) { | 
					
						
							|  |  |  |         QTextStream(&m_searchKeywords) | 
					
						
							|  |  |  |                 << ' ' << m_ui.debuggingHelperGroupBox->title() | 
					
						
							|  |  |  |                 << ' ' << m_ui.customLocationGroupBox->title() | 
					
						
							|  |  |  |                 << ' ' << m_ui.dumperLocationLabel->text() | 
					
						
							|  |  |  |                 << ' ' << m_ui.checkBoxUseCodeModel->text() | 
					
						
							|  |  |  |                 << ' ' << m_ui.checkBoxDebugDebuggingHelpers->text(); | 
					
						
							|  |  |  |         m_searchKeywords.remove(QLatin1Char('&')); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  |     return w; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  | bool DebuggingHelperOptionPage::matches(const QString &s) const | 
					
						
							| 
									
										
										
										
											2009-03-27 13:04:23 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-24 15:05:02 +01:00
										 |  |  |     return m_searchKeywords.contains(s, Qt::CaseInsensitive); | 
					
						
							| 
									
										
										
										
											2009-03-27 13:04:23 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-23 12:28:02 +01:00
										 |  |  | } // namespace Internal
 | 
					
						
							|  |  |  | } // namespace Debugger
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-12 10:51:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // DebuggerPlugin
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | DebuggerPlugin::AttachRemoteParameters::AttachRemoteParameters() : | 
					
						
							|  |  |  |     attachPid(0), | 
					
						
							|  |  |  |     winCrashEvent(0) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  | DebuggerPlugin::DebuggerPlugin() | 
					
						
							|  |  |  |   : m_manager(0), | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  |     m_debugMode(0), | 
					
						
							|  |  |  |     m_locationMark(0), | 
					
						
							|  |  |  |     m_gdbRunningContext(0), | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     m_cmdLineEnabledEngines(AllEngineTypes) | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  | {} | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | DebuggerPlugin::~DebuggerPlugin() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-06-03 13:53:45 +02:00
										 |  |  |     delete DebuggerSettings::instance(); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     removeObject(m_debugMode); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     delete m_debugMode; | 
					
						
							|  |  |  |     m_debugMode = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     delete m_locationMark; | 
					
						
							|  |  |  |     m_locationMark = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-16 17:33:12 +02:00
										 |  |  |     removeObject(m_manager); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     delete m_manager; | 
					
						
							|  |  |  |     m_manager = 0; | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     removeObject(m_uiSwitcher); | 
					
						
							|  |  |  |     delete m_uiSwitcher; | 
					
						
							|  |  |  |     m_uiSwitcher = 0; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-28 16:59:03 +02:00
										 |  |  | void DebuggerPlugin::aboutToShutdown() | 
					
						
							| 
									
										
										
										
											2010-04-28 15:38:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     QTC_ASSERT(m_manager, /**/); | 
					
						
							|  |  |  |     if (m_manager) | 
					
						
							| 
									
										
										
										
											2010-04-28 16:59:03 +02:00
										 |  |  |         m_manager->aboutToShutdown(); | 
					
						
							| 
									
										
										
										
											2010-04-28 15:38:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     writeSettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_uiSwitcher) | 
					
						
							| 
									
										
										
										
											2010-04-28 16:59:03 +02:00
										 |  |  |         m_uiSwitcher->aboutToShutdown(); | 
					
						
							| 
									
										
										
										
											2010-04-28 15:38:25 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  | static QString msgParameterMissing(const QString &a) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     return DebuggerPlugin::tr("Option '%1' is missing the parameter.").arg(a); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  | static QString msgInvalidNumericParameter(const QString &a, const QString &number) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     return DebuggerPlugin::tr("The parameter '%1' of option '%2' is not a number.").arg(number, a); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Parse arguments
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  | static bool parseArgument(QStringList::const_iterator &it, | 
					
						
							|  |  |  |                           const QStringList::const_iterator &cend, | 
					
						
							|  |  |  |                           DebuggerPlugin::AttachRemoteParameters *attachRemoteParameters, | 
					
						
							|  |  |  |                           unsigned *enabledEngines, QString *errorMessage) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     const QString &option = *it; | 
					
						
							|  |  |  |     // '-debug <pid>'
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     if (*it == _("-debug")) { | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         ++it; | 
					
						
							|  |  |  |         if (it == cend) { | 
					
						
							|  |  |  |             *errorMessage = msgParameterMissing(*it); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         bool ok; | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         attachRemoteParameters->attachPid = it->toULongLong(&ok); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         if (!ok) { | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |             attachRemoteParameters->attachPid = 0; | 
					
						
							|  |  |  |             attachRemoteParameters->attachCore = *it; | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 16:27:24 +02:00
										 |  |  |     // -wincrashevent <event-handle>. A handle used for
 | 
					
						
							|  |  |  |     // a handshake when attaching to a crashed Windows process.
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     if (*it == _("-wincrashevent")) { | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         ++it; | 
					
						
							|  |  |  |         if (it == cend) { | 
					
						
							|  |  |  |             *errorMessage = msgParameterMissing(*it); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         bool ok; | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         attachRemoteParameters->winCrashEvent = it->toULongLong(&ok); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         if (!ok) { | 
					
						
							|  |  |  |             *errorMessage = msgInvalidNumericParameter(option, *it); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  |     // Engine disabling.
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     if (option == _("-disable-cdb")) { | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         *enabledEngines &= ~Debugger::CdbEngineType; | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     if (option == _("-disable-gdb")) { | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         *enabledEngines &= ~Debugger::GdbEngineType; | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     if (option == _("-disable-sdb")) { | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         *enabledEngines &= ~Debugger::ScriptEngineType; | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  |     if (option == QLatin1String("-disable-tcf")) { | 
					
						
							|  |  |  |         *enabledEngines &= ~TcfEngineType; | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |     *errorMessage = DebuggerPlugin::tr("Invalid debugger option: %1").arg(option); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     return false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  | static bool parseArguments(const QStringList &args, | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  |    DebuggerPlugin::AttachRemoteParameters *attachRemoteParameters, | 
					
						
							|  |  |  |    unsigned *enabledEngines, QString *errorMessage) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     const QStringList::const_iterator cend = args.constEnd(); | 
					
						
							|  |  |  |     for (QStringList::const_iterator it = args.constBegin(); it != cend; ++it) | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         if (!parseArgument(it, cend, attachRemoteParameters, enabledEngines, errorMessage)) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |             return false; | 
					
						
							|  |  |  |     if (Debugger::Constants::Internal::debug) | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  |         qDebug().nospace() << args << "engines=0x" | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |             << QString::number(*enabledEngines, 16) | 
					
						
							|  |  |  |             << " pid" << attachRemoteParameters->attachPid | 
					
						
							|  |  |  |             << " core" << attachRemoteParameters->attachCore << '\n'; | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  | void DebuggerPlugin::remoteCommand(const QStringList &options, const QStringList &) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString errorMessage; | 
					
						
							|  |  |  |     AttachRemoteParameters parameters; | 
					
						
							|  |  |  |     unsigned dummy = 0; | 
					
						
							|  |  |  |     // Did we receive a request for debugging (unless it is ourselves)?
 | 
					
						
							|  |  |  |     if (parseArguments(options, ¶meters, &dummy, &errorMessage) | 
					
						
							|  |  |  |         && parameters.attachPid != quint64(QCoreApplication::applicationPid())) { | 
					
						
							|  |  |  |         m_attachRemoteParameters = parameters; | 
					
						
							|  |  |  |         attachCmdLine(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-16 14:22:13 +01:00
										 |  |  | bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     // Do not fail the whole plugin if something goes wrong here.
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |     if (!parseArguments(arguments, &m_attachRemoteParameters, &m_cmdLineEnabledEngines, errorMessage)) { | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  |         *errorMessage = tr("Error evaluating command line arguments: %1") | 
					
						
							|  |  |  |             .arg(*errorMessage); | 
					
						
							| 
									
										
										
										
											2009-05-26 16:27:24 +02:00
										 |  |  |         qWarning("%s\n", qPrintable(*errorMessage)); | 
					
						
							|  |  |  |         errorMessage->clear(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     // Debug mode setup.
 | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     m_debugMode = new DebugMode(this); | 
					
						
							|  |  |  |     m_uiSwitcher = new DebuggerUISwitcher(m_debugMode, this); | 
					
						
							|  |  |  |     ExtensionSystem::PluginManager::instance()->addObject(m_uiSwitcher); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-20 11:52:04 +01:00
										 |  |  |     ICore *core = ICore::instance(); | 
					
						
							| 
									
										
										
										
											2008-12-09 12:08:56 +01:00
										 |  |  |     QTC_ASSERT(core, return false); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 17:41:23 +01:00
										 |  |  |     Core::ActionManager *am = core->actionManager(); | 
					
						
							|  |  |  |     QTC_ASSERT(am, return false); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Core::UniqueIDManager *uidm = core->uniqueIDManager(); | 
					
						
							| 
									
										
										
										
											2008-12-09 12:08:56 +01:00
										 |  |  |     QTC_ASSERT(uidm, return false); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<int> globalcontext; | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     globalcontext << CC::C_GLOBAL_ID; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<int> cppcontext; | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     cppcontext << uidm->uniqueIdentifier(PE::LANG_CXX); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |     QList<int> cppDebuggercontext; | 
					
						
							|  |  |  |     cppDebuggercontext << uidm->uniqueIdentifier(C_CPPDEBUGGER); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<int> cppeditorcontext; | 
					
						
							| 
									
										
										
										
											2010-01-11 16:52:38 +01:00
										 |  |  |     cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<int> texteditorcontext; | 
					
						
							|  |  |  |     texteditorcontext << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_gdbRunningContext = uidm->uniqueIdentifier(Constants::GDBRUNNING); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |     m_uiSwitcher->addLanguage(LANG_CPP, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     DebuggerManager *manager = new DebuggerManager(this); | 
					
						
							|  |  |  |     ExtensionSystem::PluginManager::instance()->addObject(manager); | 
					
						
							|  |  |  |     const QList<Core::IOptionsPage *> engineOptionPages = | 
					
						
							|  |  |  |         manager->initializeEngines(m_cmdLineEnabledEngines); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  |     // Register factory of DebuggerRunControl.
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     m_debuggerRunControlFactory = new DebuggerRunControlFactory(manager); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     addAutoReleasedObject(m_debuggerRunControlFactory); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<int> context; | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     context.append(uidm->uniqueIdentifier(CC::C_EDITORMANAGER)); | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |     context.append(uidm->uniqueIdentifier(C_DEBUGMODE)); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     context.append(uidm->uniqueIdentifier(CC::C_NAVIGATION_PANE)); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     m_debugMode->setContext(context); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  |     m_reverseToolButton = 0; | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  |     // Handling of external applications.
 | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  |     m_startExternalAction = new QAction(this); | 
					
						
							|  |  |  |     m_startExternalAction->setText(tr("Start and Debug External Application...")); | 
					
						
							|  |  |  |     connect(m_startExternalAction, SIGNAL(triggered()), | 
					
						
							|  |  |  |         this, SLOT(startExternalApplication())); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_attachExternalAction = new QAction(this); | 
					
						
							|  |  |  |     m_attachExternalAction->setText(tr("Attach to Running External Application...")); | 
					
						
							|  |  |  |     connect(m_attachExternalAction, SIGNAL(triggered()), | 
					
						
							|  |  |  |         this, SLOT(attachExternalApplication())); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_attachCoreAction = new QAction(this); | 
					
						
							|  |  |  |     m_attachCoreAction->setText(tr("Attach to Core...")); | 
					
						
							|  |  |  |     connect(m_attachCoreAction, SIGNAL(triggered()), this, SLOT(attachCore())); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  |     m_attachTcfAction = new QAction(this); | 
					
						
							|  |  |  |     m_attachTcfAction->setText(tr("Attach to Running Tcf Agent...")); | 
					
						
							|  |  |  |     m_attachTcfAction->setToolTip(tr("This attaches to a running " | 
					
						
							|  |  |  |         "'Target Communication Framework' agent.")); | 
					
						
							|  |  |  |     connect(m_attachTcfAction, SIGNAL(triggered()), | 
					
						
							|  |  |  |         this, SLOT(attachRemoteTcf())); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-06 13:27:11 +02:00
										 |  |  |     m_startRemoteAction = new QAction(this); | 
					
						
							|  |  |  |     m_startRemoteAction->setText(tr("Start and Attach to Remote Application...")); | 
					
						
							|  |  |  |     connect(m_startRemoteAction, SIGNAL(triggered()), | 
					
						
							|  |  |  |         this, SLOT(startRemoteApplication())); | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-07 15:20:44 +02:00
										 |  |  |     m_detachAction = new QAction(this); | 
					
						
							| 
									
										
										
										
											2009-06-11 15:00:21 +02:00
										 |  |  |     m_detachAction->setText(tr("Detach Debugger")); | 
					
						
							| 
									
										
										
										
											2009-05-07 15:20:44 +02:00
										 |  |  |     connect(m_detachAction, SIGNAL(triggered()), | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |         manager, SLOT(detachDebugger())); | 
					
						
							| 
									
										
										
										
											2009-05-07 15:20:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     Core::Command *cmd = 0; | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     const DebuggerManagerActions actions = manager->debuggerManagerActions(); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-08 19:28:28 +02:00
										 |  |  |     Core::ActionContainer *mstart = | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         am->actionContainer(PE::M_DEBUG_STARTDEBUGGING); | 
					
						
							| 
									
										
										
										
											2009-06-08 19:28:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.continueAction, | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         PE::DEBUG, QList<int>() << m_gdbRunningContext); | 
					
						
							|  |  |  |     mstart->addAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2009-06-04 16:06:12 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  |     cmd = am->registerAction(m_startExternalAction, | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         Constants::STARTEXTERNAL, globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     mstart->addAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  |     cmd = am->registerAction(m_attachExternalAction, | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         Constants::ATTACHEXTERNAL, globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     mstart->addAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2009-03-02 15:14:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  |     cmd = am->registerAction(m_attachCoreAction, | 
					
						
							|  |  |  |         Constants::ATTACHCORE, globalcontext); | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     mstart->addAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2009-05-07 17:11:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  |     cmd = am->registerAction(m_attachTcfAction, | 
					
						
							|  |  |  |         Constants::ATTACHTCF, globalcontext); | 
					
						
							|  |  |  |     mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-06 13:27:11 +02:00
										 |  |  |     cmd = am->registerAction(m_startRemoteAction, | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  |         Constants::ATTACHREMOTE, globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     mstart->addAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2009-05-04 14:47:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-07 15:20:44 +02:00
										 |  |  |     cmd = am->registerAction(m_detachAction, | 
					
						
							|  |  |  |         Constants::DETACH, globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.stopAction, | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         Constants::INTERRUPT, globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_UpdateText); | 
					
						
							|  |  |  |     cmd->setAttribute(Command::CA_UpdateIcon); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::INTERRUPT_KEY)); | 
					
						
							|  |  |  |     cmd->setDefaultText(tr("Stop Debugger/Interrupt Debugger")); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.resetAction, | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         Constants::RESET, globalcontext); | 
					
						
							| 
									
										
										
										
											2009-01-14 13:17:53 +01:00
										 |  |  |     cmd->setAttribute(Core::Command::CA_UpdateText); | 
					
						
							| 
									
										
										
										
											2010-02-11 11:26:08 +01:00
										 |  |  |     //cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY));
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultText(tr("Reset Debugger")); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, CC::G_DEFAULT_ONE); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QAction *sep = new QAction(this); | 
					
						
							|  |  |  |     sep->setSeparator(true); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     cmd = am->registerAction(sep, _("Debugger.Sep.Step"), globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.nextAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::NEXT, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.stepAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::STEP, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.stepOutAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::STEPOUT, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  |     cmd = am->registerAction(actions.runToLineAction1, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::RUN_TO_LINE1, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.runToFunctionAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::RUN_TO_FUNCTION, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  |     cmd = am->registerAction(actions.jumpToLineAction1, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::JUMP_TO_LINE1, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-15 16:02:41 +01:00
										 |  |  |     cmd = am->registerAction(actions.returnFromFunctionAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::RETURN_FROM_FUNCTION, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-15 16:02:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.reverseDirectionAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::REVERSE, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 17:19:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     sep = new QAction(this); | 
					
						
							|  |  |  |     sep->setSeparator(true); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     cmd = am->registerAction(sep, _("Debugger.Sep.Break"), globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-02 17:25:14 +01:00
										 |  |  |     cmd = am->registerAction(actions.snapshotAction, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::SNAPSHOT, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-02-02 17:25:14 +01:00
										 |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-07 13:17:19 +02:00
										 |  |  |     cmd = am->registerAction(actions.frameDownAction, | 
					
						
							|  |  |  |         Constants::FRAME_DOWN, cppDebuggercontext); | 
					
						
							|  |  |  |     cmd = am->registerAction(actions.frameUpAction, | 
					
						
							|  |  |  |         Constants::FRAME_UP, cppDebuggercontext); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-02 17:25:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-29 11:13:19 +02:00
										 |  |  |     cmd = am->registerAction(theDebuggerAction(OperateByInstruction), | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-03-19 13:58:26 +01:00
										 |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-29 11:13:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 15:02:16 +02:00
										 |  |  |     cmd = am->registerAction(actions.breakAction, | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |         Constants::TOGGLE_BREAK, cppeditorcontext); | 
					
						
							|  |  |  |     cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY)); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							| 
									
										
										
										
											2010-04-09 15:37:47 +02:00
										 |  |  |     connect(actions.breakAction, SIGNAL(triggered()), | 
					
						
							|  |  |  |         this, SLOT(toggleBreakpoint())); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     //mcppcontext->addAction(cmd);
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sep = new QAction(this); | 
					
						
							|  |  |  |     sep->setSeparator(true); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     cmd = am->registerAction(sep, _("Debugger.Sep.Watch"), globalcontext); | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     cmd = am->registerAction(actions.watchAction1, | 
					
						
							|  |  |  |         Constants::ADD_TO_WATCH1, cppeditorcontext); | 
					
						
							| 
									
										
										
										
											2009-12-11 15:31:37 +01:00
										 |  |  |     cmd->action()->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     //cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  |     // Editor context menu
 | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     ActionContainer *editorContextMenu = | 
					
						
							|  |  |  |         am->actionContainer(CppEditor::Constants::M_CONTEXT); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     cmd = am->registerAction(sep, _("Debugger.Sep.Views"), | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     editorContextMenu->addAction(cmd); | 
					
						
							|  |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     cmd = am->registerAction(actions.watchAction2, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::ADD_TO_WATCH2, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     cmd->action()->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  |     editorContextMenu->addAction(cmd); | 
					
						
							|  |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     cmd = am->registerAction(actions.runToLineAction2, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::RUN_TO_LINE2, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  |     cmd->action()->setEnabled(true); | 
					
						
							|  |  |  |     editorContextMenu->addAction(cmd); | 
					
						
							|  |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     cmd = am->registerAction(actions.jumpToLineAction2, | 
					
						
							| 
									
										
										
										
											2010-03-23 18:12:03 +01:00
										 |  |  |         Constants::JUMP_TO_LINE2, cppDebuggercontext); | 
					
						
							| 
									
										
										
										
											2010-02-08 09:13:21 +01:00
										 |  |  |     cmd->action()->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2009-12-11 18:19:51 +01:00
										 |  |  |     editorContextMenu->addAction(cmd); | 
					
						
							|  |  |  |     cmd->setAttribute(Command::CA_Hide); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  |     addAutoReleasedObject(new CommonOptionsPage); | 
					
						
							| 
									
										
										
										
											2010-04-06 16:42:24 +02:00
										 |  |  |     foreach (Core::IOptionsPage *op, engineOptionPages) | 
					
						
							| 
									
										
										
										
											2009-04-17 09:03:32 +02:00
										 |  |  |         addAutoReleasedObject(op); | 
					
						
							| 
									
										
										
										
											2010-04-06 16:42:24 +02:00
										 |  |  |     addAutoReleasedObject(new DebuggingHelperOptionPage); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-26 18:05:11 +01:00
										 |  |  |     addAutoReleasedObject(new DebuggerListener); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     m_locationMark = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     manager->setSimpleDockWidgetArrangement(LANG_CPP); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  |     readSettings(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), | 
					
						
							| 
									
										
										
										
											2009-05-15 16:54:54 +02:00
										 |  |  |             this, SLOT(onModeChanged(Core::IMode*))); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  |     m_debugMode->widget()->setFocusProxy(EditorManager::instance()); | 
					
						
							|  |  |  |     addObject(m_debugMode); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     m_manager = manager; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  |     //
 | 
					
						
							|  |  |  |     //  Connections
 | 
					
						
							|  |  |  |     //
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-12 14:15:20 +01:00
										 |  |  |     // TextEditor
 | 
					
						
							| 
									
										
										
										
											2010-04-19 16:42:02 +02:00
										 |  |  |     connect(TextEditorSettings::instance(), | 
					
						
							| 
									
										
										
										
											2010-02-12 14:15:20 +01:00
										 |  |  |         SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |         manager, SLOT(fontSettingsChanged(TextEditor::FontSettings))); | 
					
						
							| 
									
										
										
										
											2010-02-12 14:15:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     // ProjectExplorer
 | 
					
						
							| 
									
										
										
										
											2009-01-28 14:29:54 +01:00
										 |  |  |     connect(sessionManager(), SIGNAL(sessionLoaded()), | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |        manager, SLOT(sessionLoaded())); | 
					
						
							| 
									
										
										
										
											2009-01-28 14:29:54 +01:00
										 |  |  |     connect(sessionManager(), SIGNAL(aboutToSaveSession()), | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |        manager, SLOT(aboutToSaveSession())); | 
					
						
							| 
									
										
										
										
											2009-08-13 17:10:53 +02:00
										 |  |  |     connect(sessionManager(), SIGNAL(aboutToUnloadSession()), | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |        manager, SLOT(aboutToUnloadSession())); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // EditorManager
 | 
					
						
							|  |  |  |     QObject *editorManager = core->editorManager(); | 
					
						
							|  |  |  |     connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), | 
					
						
							|  |  |  |         this, SLOT(editorAboutToClose(Core::IEditor*))); | 
					
						
							|  |  |  |     connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), | 
					
						
							|  |  |  |         this, SLOT(editorOpened(Core::IEditor*))); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Application interaction
 | 
					
						
							| 
									
										
										
										
											2009-03-19 15:54:52 +01:00
										 |  |  |     connect(theDebuggerAction(SettingsDialog), SIGNAL(triggered()), | 
					
						
							| 
									
										
										
										
											2009-02-27 11:41:19 +01:00
										 |  |  |         this, SLOT(showSettingsDialog())); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-30 13:07:14 +02:00
										 |  |  |     handleStateChanged(DebuggerNotReady); | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  |     // Toolbar
 | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     QWidget *toolbarContainer = new QWidget; | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QHBoxLayout *hbox = new QHBoxLayout(toolbarContainer); | 
					
						
							|  |  |  |     hbox->setMargin(0); | 
					
						
							|  |  |  |     hbox->setSpacing(0); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     hbox->addWidget(toolButton(am->command(PE::DEBUG)->action())); | 
					
						
							|  |  |  |     hbox->addWidget(toolButton(am->command(INTERRUPT)->action())); | 
					
						
							|  |  |  |     hbox->addWidget(toolButton(am->command(NEXT)->action())); | 
					
						
							|  |  |  |     hbox->addWidget(toolButton(am->command(STEP)->action())); | 
					
						
							|  |  |  |     hbox->addWidget(toolButton(am->command(STEPOUT)->action())); | 
					
						
							|  |  |  |     hbox->addWidget(toolButton(am->command(OPERATE_BY_INSTRUCTION)->action())); | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     //hbox->addWidget(new Utils::StyledSeparator);
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     m_reverseToolButton = toolButton(am->command(REVERSE)->action()); | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  |     hbox->addWidget(m_reverseToolButton); | 
					
						
							|  |  |  |     //m_reverseToolButton->hide();
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     hbox->addWidget(new Utils::StyledSeparator); | 
					
						
							|  |  |  |     hbox->addWidget(new QLabel(tr("Threads:"))); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QComboBox *threadBox = new QComboBox; | 
					
						
							|  |  |  |     threadBox->setModel(m_manager->threadsModel()); | 
					
						
							|  |  |  |     connect(threadBox, SIGNAL(activated(int)), | 
					
						
							|  |  |  |         m_manager->threadsWindow(), SIGNAL(threadSelected(int))); | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     hbox->addWidget(threadBox); | 
					
						
							| 
									
										
										
										
											2010-03-23 14:49:02 +01:00
										 |  |  |     hbox->addSpacerItem(new QSpacerItem(4, 0)); | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     hbox->addWidget(m_manager->statusLabel(), 10); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_uiSwitcher->setToolbar(LANG_CPP, toolbarContainer); | 
					
						
							|  |  |  |     connect(m_uiSwitcher, SIGNAL(dockArranged(QString)), manager, | 
					
						
							|  |  |  |             SLOT(setSimpleDockWidgetArrangement(QString))); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(theDebuggerAction(EnableReverseDebugging), SIGNAL(valueChanged(QVariant)), | 
					
						
							|  |  |  |         this, SLOT(enableReverseDebuggingTriggered(QVariant))); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  |     // UI Switcher
 | 
					
						
							|  |  |  |     connect(DebuggerUISwitcher::instance(), SIGNAL(languageChanged(QString)), | 
					
						
							|  |  |  |            this, SLOT(languageChanged(QString))); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  |     return true; | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void DebuggerPlugin::extensionsInitialized() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-04-06 10:58:48 +02:00
										 |  |  |     // time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     const QByteArray env = qgetenv("QTC_DEBUGGER_TEST"); | 
					
						
							| 
									
										
										
										
											2009-04-07 09:40:56 +02:00
										 |  |  |     //qDebug() << "EXTENSIONS INITIALIZED:" << env;
 | 
					
						
							| 
									
										
										
										
											2009-04-06 16:30:11 +02:00
										 |  |  |     if (!env.isEmpty()) | 
					
						
							|  |  |  |         m_manager->runTest(QString::fromLocal8Bit(env)); | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |     if (m_attachRemoteParameters.attachPid || !m_attachRemoteParameters.attachCore.isEmpty()) | 
					
						
							|  |  |  |         QTimer::singleShot(0, this, SLOT(attachCmdLine())); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     readSettings(); | 
					
						
							|  |  |  |     m_uiSwitcher->initialize(); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  | void DebuggerPlugin::attachCmdLine() | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |     if (m_manager->state() != DebuggerNotReady) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     if (m_attachRemoteParameters.attachPid) { | 
					
						
							|  |  |  |         m_manager->showStatusMessage(tr("Attaching to PID %1.").arg(m_attachRemoteParameters.attachPid)); | 
					
						
							|  |  |  |         const QString crashParameter = | 
					
						
							|  |  |  |                 m_attachRemoteParameters.winCrashEvent ? QString::number(m_attachRemoteParameters.winCrashEvent) : QString(); | 
					
						
							| 
									
										
										
										
											2010-03-17 10:57:19 +01:00
										 |  |  |         attachExternalApplication(m_attachRemoteParameters.attachPid, QString(), crashParameter); | 
					
						
							| 
									
										
										
										
											2009-12-14 18:01:39 +01:00
										 |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!m_attachRemoteParameters.attachCore.isEmpty()) { | 
					
						
							|  |  |  |         m_manager->showStatusMessage(tr("Attaching to core %1.").arg(m_attachRemoteParameters.attachCore)); | 
					
						
							|  |  |  |         attachCore(m_attachRemoteParameters.attachCore, QString()); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*! Activates the previous mode when the current mode is the debug mode. */ | 
					
						
							|  |  |  | void DebuggerPlugin::activatePreviousMode() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-20 11:52:04 +01:00
										 |  |  |     Core::ModeManager *const modeManager = ICore::instance()->modeManager(); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     if (modeManager->currentMode() == modeManager->mode(MODE_DEBUG) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |             && !m_previousMode.isEmpty()) { | 
					
						
							|  |  |  |         modeManager->activateMode(m_previousMode); | 
					
						
							|  |  |  |         m_previousMode.clear(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::activateDebugMode() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-21 15:52:34 +01:00
										 |  |  |     ModeManager *modeManager = ModeManager::instance(); | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     m_previousMode = modeManager->currentMode()->id(); | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |     modeManager->activateMode(_(MODE_DEBUG)); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  | static bool isDebuggable(Core::IEditor *editor) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-08 15:08:48 +02:00
										 |  |  |     // Only blacklist QML. Whitelisting would fail on C++ code in files
 | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  |     // with strange names, more harm would be done this way.
 | 
					
						
							|  |  |  |     Core::IFile *file = editor->file(); | 
					
						
							|  |  |  |     return !(file && file->mimeType() == "application/x-qml"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:58:20 +01:00
										 |  |  | TextEditor::ITextEditor *DebuggerPlugin::currentTextEditor() | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-21 15:52:34 +01:00
										 |  |  |     EditorManager *editorManager = EditorManager::instance(); | 
					
						
							|  |  |  |     if (!editorManager) | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |         return 0; | 
					
						
							| 
									
										
										
										
											2009-01-21 15:52:34 +01:00
										 |  |  |     Core::IEditor *editor = editorManager->currentEditor(); | 
					
						
							| 
									
										
										
										
											2010-03-10 13:58:20 +01:00
										 |  |  |     return qobject_cast<ITextEditor*>(editor); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::editorOpened(Core::IEditor *editor) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  |     if (!isDebuggable(editor)) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor); | 
					
						
							|  |  |  |     if (!textEditor) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     connect(textEditor, SIGNAL(markRequested(TextEditor::ITextEditor*,int)), | 
					
						
							|  |  |  |         this, SLOT(requestMark(TextEditor::ITextEditor*,int))); | 
					
						
							|  |  |  |     connect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)), | 
					
						
							|  |  |  |         this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int))); | 
					
						
							|  |  |  |     connect(textEditor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), | 
					
						
							|  |  |  |         this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::editorAboutToClose(Core::IEditor *editor) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  |     if (!isDebuggable(editor)) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor); | 
					
						
							|  |  |  |     if (!textEditor) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     disconnect(textEditor, SIGNAL(markRequested(TextEditor::ITextEditor*,int)), | 
					
						
							|  |  |  |         this, SLOT(requestMark(TextEditor::ITextEditor*,int))); | 
					
						
							|  |  |  |     disconnect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)), | 
					
						
							|  |  |  |         this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int))); | 
					
						
							|  |  |  |     disconnect(textEditor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), | 
					
						
							|  |  |  |         this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-05 16:39:33 +01:00
										 |  |  | void DebuggerPlugin::requestContextMenu(TextEditor::ITextEditor *editor, | 
					
						
							|  |  |  |     int lineNumber, QMenu *menu) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  |     if (!isDebuggable(editor)) | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2010-04-09 14:55:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |     BreakHandler *handler = m_manager->breakHandler(); | 
					
						
							|  |  |  |     QTC_ASSERT(handler, return); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     BreakpointData *data = 0; | 
					
						
							|  |  |  |     QString position; | 
					
						
							| 
									
										
										
										
											2010-04-09 14:55:09 +02:00
										 |  |  |     if (editor->property("DisassemblerView").toBool()) { | 
					
						
							|  |  |  |         QString fileName = editor->file()->fileName(); | 
					
						
							|  |  |  |         QString line = editor->contents() | 
					
						
							|  |  |  |             .section('\n', lineNumber - 1, lineNumber - 1); | 
					
						
							|  |  |  |         position = _("*") + fileName; | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |         BreakpointData needle; | 
					
						
							|  |  |  |         needle.bpAddress = line.left(line.indexOf(QLatin1Char(' '))).toLatin1(); | 
					
						
							|  |  |  |         needle.bpLineNumber = "-1"; | 
					
						
							|  |  |  |         data = handler->findSimilarBreakpoint(needle); | 
					
						
							| 
									
										
										
										
											2010-04-09 14:55:09 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |         QString fileName = editor->file()->fileName(); | 
					
						
							| 
									
										
										
										
											2010-04-09 14:55:09 +02:00
										 |  |  |         position = fileName + QString(":%1").arg(lineNumber); | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |         BreakpointData needle; | 
					
						
							|  |  |  |         needle.bpFileName = fileName; | 
					
						
							|  |  |  |         needle.bpLineNumber = QByteArray::number(lineNumber); | 
					
						
							|  |  |  |         data = handler->findSimilarBreakpoint(needle); | 
					
						
							| 
									
										
										
										
											2010-04-09 14:55:09 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (data) { | 
					
						
							|  |  |  |         // existing breakpoint
 | 
					
						
							|  |  |  |         QAction *act = new QAction(tr("Remove Breakpoint"), menu); | 
					
						
							|  |  |  |         act->setData(position); | 
					
						
							|  |  |  |         connect(act, SIGNAL(triggered()), | 
					
						
							|  |  |  |             this, SLOT(breakpointSetRemoveMarginActionTriggered())); | 
					
						
							|  |  |  |         menu->addAction(act); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QAction *act2; | 
					
						
							|  |  |  |         if (data->enabled) | 
					
						
							|  |  |  |             act2 = new QAction(tr("Disable Breakpoint"), menu); | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |             act2 = new QAction(tr("Enable Breakpoint"), menu); | 
					
						
							|  |  |  |         act2->setData(position); | 
					
						
							|  |  |  |         connect(act2, SIGNAL(triggered()), | 
					
						
							|  |  |  |             this, SLOT(breakpointEnableDisableMarginActionTriggered())); | 
					
						
							|  |  |  |         menu->addAction(act2); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         // non-existing
 | 
					
						
							|  |  |  |         QAction *act = new QAction(tr("Set Breakpoint"), menu); | 
					
						
							|  |  |  |         act->setData(position); | 
					
						
							|  |  |  |         connect(act, SIGNAL(triggered()), | 
					
						
							|  |  |  |             this, SLOT(breakpointSetRemoveMarginActionTriggered())); | 
					
						
							|  |  |  |         menu->addAction(act); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::breakpointSetRemoveMarginActionTriggered() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-09 16:10:06 +02:00
										 |  |  |     QAction *act = qobject_cast<QAction *>(sender()); | 
					
						
							|  |  |  |     QTC_ASSERT(act, return); | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |     BreakHandler *handler = m_manager->breakHandler(); | 
					
						
							|  |  |  |     QTC_ASSERT(handler, return); | 
					
						
							| 
									
										
										
										
											2010-04-09 16:10:06 +02:00
										 |  |  |     QString str = act->data().toString(); | 
					
						
							|  |  |  |     int pos = str.lastIndexOf(':'); | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |     toggleBreakpoint(str, pos); | 
					
						
							| 
									
										
										
										
											2008-12-05 16:39:33 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  | void DebuggerPlugin::breakpointEnableDisableMarginActionTriggered() | 
					
						
							| 
									
										
										
										
											2008-12-05 16:39:33 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-09 15:37:47 +02:00
										 |  |  |     QAction *act = qobject_cast<QAction *>(sender()); | 
					
						
							|  |  |  |     QTC_ASSERT(act, return); | 
					
						
							|  |  |  |     BreakHandler *handler = m_manager->breakHandler(); | 
					
						
							|  |  |  |     QTC_ASSERT(handler, return); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QString str = act->data().toString(); | 
					
						
							|  |  |  |     int pos = str.lastIndexOf(':'); | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |     BreakpointData needle; | 
					
						
							|  |  |  |     needle.bpFileName = str.left(pos); | 
					
						
							|  |  |  |     needle.bpLineNumber = str.mid(pos + 1).toLatin1(); | 
					
						
							|  |  |  |     BreakpointData *data = handler->findSimilarBreakpoint(needle); | 
					
						
							|  |  |  |     QTC_ASSERT(data, return); | 
					
						
							| 
									
										
										
										
											2010-04-09 15:37:47 +02:00
										 |  |  |     handler->toggleBreakpointEnabled(data); | 
					
						
							|  |  |  |     m_manager->attemptBreakpointSynchronization(); | 
					
						
							| 
									
										
										
										
											2008-12-05 16:39:33 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | void DebuggerPlugin::requestMark(ITextEditor *editor, int lineNumber) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  |     if (!isDebuggable(editor)) | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |     toggleBreakpoint(editor->file()->fileName(), lineNumber); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | void DebuggerPlugin::showToolTip(ITextEditor *editor, const QPoint &point, int pos) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-06 17:58:11 +02:00
										 |  |  |     if (!isDebuggable(editor)) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     if (!theDebuggerBoolSetting(UseToolTipsInMainEditor)) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     if (m_manager->state() == DebuggerNotReady) | 
					
						
							| 
									
										
										
										
											2008-12-08 19:26:00 +01:00
										 |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-14 14:29:37 +02:00
										 |  |  |     m_manager->setToolTipExpression(point, editor, pos); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-28 14:29:54 +01:00
										 |  |  |     QTC_ASSERT(sessionManager(), return); | 
					
						
							|  |  |  |     sessionManager()->setValue(name, value); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  | QVariant DebuggerPlugin::sessionValue(const QString &name) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     QTC_ASSERT(sessionManager(), return QVariant()); | 
					
						
							|  |  |  |     return sessionManager()->value(name); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-09 12:08:56 +01:00
										 |  |  |     QTC_ASSERT(m_debugMode, return); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  |     settings()->setValue(name, value); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | QVariant DebuggerPlugin::configValue(const QString &name) const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QTC_ASSERT(m_debugMode, return QVariant()); | 
					
						
							|  |  |  |     return settings()->value(name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | void DebuggerPlugin::resetLocation() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     //qDebug() << "RESET_LOCATION: current:"  << currentTextEditor();
 | 
					
						
							|  |  |  |     //qDebug() << "RESET_LOCATION: locations:"  << m_locationMark;
 | 
					
						
							|  |  |  |     //qDebug() << "RESET_LOCATION: stored:"  << m_locationMark->editor();
 | 
					
						
							|  |  |  |     delete m_locationMark; | 
					
						
							|  |  |  |     m_locationMark = 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-29 15:21:28 +02:00
										 |  |  | void DebuggerPlugin::gotoLocation(const QString &file, int line, bool setMarker) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-10 12:48:53 +01:00
										 |  |  |     bool newEditor = false; | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     ITextEditor *editor = | 
					
						
							|  |  |  |         BaseTextEditor::openEditorAt(file, line, 0, QString(), &newEditor); | 
					
						
							|  |  |  |     if (!editor) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     if (newEditor) | 
					
						
							|  |  |  |         editor->setProperty("OpenedByDebugger", true); | 
					
						
							| 
									
										
										
										
											2009-09-29 15:21:28 +02:00
										 |  |  |     if (setMarker) { | 
					
						
							|  |  |  |         resetLocation(); | 
					
						
							|  |  |  |         m_locationMark = new LocationMark(file, line); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-29 18:44:02 +02:00
										 |  |  | void DebuggerPlugin::openTextEditor(const QString &titlePattern0, | 
					
						
							|  |  |  |     const QString &contents) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString titlePattern = titlePattern0; | 
					
						
							|  |  |  |     EditorManager *editorManager = EditorManager::instance(); | 
					
						
							|  |  |  |     QTC_ASSERT(editorManager, return); | 
					
						
							|  |  |  |     Core::IEditor *editor = editorManager->openEditorWithContents( | 
					
						
							|  |  |  |         Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents); | 
					
						
							|  |  |  |     QTC_ASSERT(editor, return); | 
					
						
							|  |  |  |     editorManager->activateEditor(editor); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 08:35:31 +02:00
										 |  |  | void DebuggerPlugin::handleStateChanged(int state) | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-10 13:46:05 +01:00
										 |  |  |     // Prevent it from beeing triggered on setup.
 | 
					
						
							|  |  |  |     if (!m_manager) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 08:35:31 +02:00
										 |  |  |     const bool startIsContinue = (state == InferiorStopped); | 
					
						
							| 
									
										
										
										
											2009-01-20 11:52:04 +01:00
										 |  |  |     ICore *core = ICore::instance(); | 
					
						
							| 
									
										
										
										
											2010-03-22 18:05:22 +01:00
										 |  |  |     if (startIsContinue) | 
					
						
							|  |  |  |         core->updateAdditionalContexts(QList<int>(), QList<int>() << m_gdbRunningContext); | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |         core->updateAdditionalContexts(QList<int>() << m_gdbRunningContext, QList<int>()); | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 08:35:31 +02:00
										 |  |  |     const bool started = state == InferiorRunning | 
					
						
							|  |  |  |         || state == InferiorRunningRequested | 
					
						
							|  |  |  |         || state == InferiorStopping | 
					
						
							|  |  |  |         || state == InferiorStopped; | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-25 08:35:31 +02:00
										 |  |  |     const bool starting = state == EngineStarting; | 
					
						
							|  |  |  |     //const bool running = state == InferiorRunning;
 | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-30 13:07:14 +02:00
										 |  |  |     const bool detachable = state == InferiorStopped | 
					
						
							|  |  |  |         && m_manager->startParameters()->startMode != AttachCore; | 
					
						
							| 
									
										
										
										
											2009-09-24 10:08:17 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_startExternalAction->setEnabled(!started && !starting); | 
					
						
							|  |  |  |     m_attachExternalAction->setEnabled(!started && !starting); | 
					
						
							|  |  |  | #ifdef Q_OS_WIN
 | 
					
						
							|  |  |  |     m_attachCoreAction->setEnabled(false); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  |     m_attachCoreAction->setEnabled(!started && !starting); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  |     m_startRemoteAction->setEnabled(!started && !starting); | 
					
						
							| 
									
										
										
										
											2009-09-30 13:07:14 +02:00
										 |  |  |     m_detachAction->setEnabled(detachable); | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  | void DebuggerPlugin::languageChanged(const QString &language) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (!m_manager) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const bool debuggerIsCPP = (language == Constants::LANG_CPP); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_startExternalAction->setVisible(debuggerIsCPP); | 
					
						
							|  |  |  |     m_attachExternalAction->setVisible(debuggerIsCPP); | 
					
						
							|  |  |  |     m_attachCoreAction->setVisible(debuggerIsCPP); | 
					
						
							|  |  |  |     m_startRemoteAction->setVisible(debuggerIsCPP); | 
					
						
							|  |  |  |     m_detachAction->setVisible(debuggerIsCPP); | 
					
						
							| 
									
										
										
										
											2010-03-18 16:55:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 10:56:25 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | void DebuggerPlugin::writeSettings() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-14 18:09:02 +01:00
										 |  |  |     QSettings *s = settings(); | 
					
						
							| 
									
										
										
										
											2009-04-08 12:11:30 +02:00
										 |  |  |     DebuggerSettings::instance()->writeSettings(s); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::readSettings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QSettings *s = settings(); | 
					
						
							| 
									
										
										
										
											2009-04-08 12:11:30 +02:00
										 |  |  |     DebuggerSettings::instance()->readSettings(s); | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-13 15:15:02 +02:00
										 |  |  | static bool isCurrentProjectCppBased() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); | 
					
						
							|  |  |  |     Project *startupProject = projectExplorer->startupProject(); | 
					
						
							|  |  |  |     const QStringList cppProjectIds = QStringList() << QLatin1String("GenericProjectManager.GenericProject") | 
					
						
							|  |  |  |                                                     << QLatin1String("CMakeProjectManager.CMakeProject") | 
					
						
							|  |  |  |                                                     << QLatin1String("Qt4ProjectManager.Qt4Project"); | 
					
						
							|  |  |  |     return (startupProject && cppProjectIds.contains(startupProject->id())); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-15 16:54:54 +02:00
										 |  |  | void DebuggerPlugin::onModeChanged(IMode *mode) | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-05-25 18:21:31 +02:00
										 |  |  |      // FIXME: This one gets always called, even if switching between modes
 | 
					
						
							|  |  |  |      //        different then the debugger mode. E.g. Welcome and Help mode and
 | 
					
						
							|  |  |  |      //        also on shutdown.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-14 13:04:05 +02:00
										 |  |  |     if (mode != m_debugMode) | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     EditorManager *editorManager = EditorManager::instance(); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     if (editorManager->currentEditor()) { | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  |         editorManager->currentEditor()->widget()->setFocus(); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-13 15:15:02 +02:00
										 |  |  |         if (isCurrentProjectCppBased()) | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |             m_uiSwitcher->setActiveLanguage(LANG_CPP); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-01-13 18:15:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-13 15:15:02 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-27 11:41:19 +01:00
										 |  |  | void DebuggerPlugin::showSettingsDialog() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-04-28 15:08:52 +02:00
										 |  |  |     Core::ICore::instance()->showOptionsDialog( | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         _(DEBUGGER_SETTINGS_CATEGORY), | 
					
						
							|  |  |  |         _(DEBUGGER_COMMON_SETTINGS_ID)); | 
					
						
							| 
									
										
										
										
											2009-02-27 11:41:19 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | void DebuggerPlugin::startExternalApplication() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-09-17 14:30:28 +02:00
										 |  |  |     const DebuggerStartParametersPtr sp(new DebuggerStartParameters); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     StartExternalDialog dlg(m_uiSwitcher->mainWindow()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     dlg.setExecutableFile( | 
					
						
							|  |  |  |             configValue(_("LastExternalExecutableFile")).toString()); | 
					
						
							|  |  |  |     dlg.setExecutableArguments( | 
					
						
							|  |  |  |             configValue(_("LastExternalExecutableArguments")).toString()); | 
					
						
							| 
									
										
										
										
											2010-05-12 11:48:00 +02:00
										 |  |  |     dlg.setWorkingDirectory( | 
					
						
							|  |  |  |             configValue(_("LastExternalWorkingDirectory")).toString()); | 
					
						
							| 
									
										
										
										
											2009-06-12 12:57:22 +02:00
										 |  |  |     if (dlg.exec() != QDialog::Accepted) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2009-06-12 12:57:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     setConfigValue(_("LastExternalExecutableFile"), | 
					
						
							|  |  |  |                    dlg.executableFile()); | 
					
						
							|  |  |  |     setConfigValue(_("LastExternalExecutableArguments"), | 
					
						
							|  |  |  |                    dlg.executableArguments()); | 
					
						
							| 
									
										
										
										
											2010-05-12 11:48:00 +02:00
										 |  |  |     setConfigValue(_("LastExternalWorkingDirectory"), | 
					
						
							|  |  |  |                    dlg.workingDirectory()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     sp->executable = dlg.executableFile(); | 
					
						
							| 
									
										
										
										
											2009-09-17 14:30:28 +02:00
										 |  |  |     sp->startMode = StartExternal; | 
					
						
							| 
									
										
										
										
											2010-05-12 11:48:00 +02:00
										 |  |  |     sp->workingDirectory = dlg.workingDirectory(); | 
					
						
							| 
									
										
										
										
											2009-06-16 13:44:45 +02:00
										 |  |  |     if (!dlg.executableArguments().isEmpty()) | 
					
						
							|  |  |  |         sp->processArgs = dlg.executableArguments().split(QLatin1Char(' ')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-12 12:57:22 +02:00
										 |  |  |     if (dlg.breakAtMain()) | 
					
						
							|  |  |  |         m_manager->breakByFunctionMain(); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-08 18:37:18 +02:00
										 |  |  |     if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         ProjectExplorerPlugin::instance()->startRunControl(runControl, PE::DEBUGMODE); | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::attachExternalApplication() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     AttachExternalDialog dlg(m_uiSwitcher->mainWindow()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     if (dlg.exec() == QDialog::Accepted) | 
					
						
							| 
									
										
										
										
											2010-03-17 10:57:19 +01:00
										 |  |  |         attachExternalApplication(dlg.attachPID(), dlg.executable(), QString()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-17 10:57:19 +01:00
										 |  |  | void DebuggerPlugin::attachExternalApplication(qint64 pid, | 
					
						
							|  |  |  |                                                const QString &binary, | 
					
						
							|  |  |  |                                                const QString &crashParameter) | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     if (pid == 0) { | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         QMessageBox::warning(m_uiSwitcher->mainWindow(), tr("Warning"), | 
					
						
							|  |  |  |             tr("Cannot attach to PID 0")); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-09-17 14:30:28 +02:00
										 |  |  |     const DebuggerStartParametersPtr sp(new DebuggerStartParameters); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     sp->attachPID = pid; | 
					
						
							| 
									
										
										
										
											2010-03-17 10:57:19 +01:00
										 |  |  |     sp->executable = binary; | 
					
						
							| 
									
										
										
										
											2009-05-26 16:27:24 +02:00
										 |  |  |     sp->crashParameter = crashParameter; | 
					
						
							| 
									
										
										
										
											2009-09-23 15:28:50 +02:00
										 |  |  |     sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal; | 
					
						
							| 
									
										
										
										
											2009-10-08 18:37:18 +02:00
										 |  |  |     if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |         ProjectExplorerPlugin::instance()->startRunControl(runControl, PE::DEBUGMODE); | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::attachCore() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     AttachCoreDialog dlg(m_uiSwitcher->mainWindow()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     dlg.setExecutableFile( | 
					
						
							|  |  |  |             configValue(_("LastExternalExecutableFile")).toString()); | 
					
						
							|  |  |  |     dlg.setCoreFile( | 
					
						
							|  |  |  |             configValue(_("LastExternalCoreFile")).toString()); | 
					
						
							|  |  |  |     if (dlg.exec() != QDialog::Accepted) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     setConfigValue(_("LastExternalExecutableFile"), | 
					
						
							|  |  |  |                    dlg.executableFile()); | 
					
						
							|  |  |  |     setConfigValue(_("LastExternalCoreFile"), | 
					
						
							|  |  |  |                    dlg.coreFile()); | 
					
						
							| 
									
										
										
										
											2009-09-30 12:27:03 +02:00
										 |  |  |     attachCore(dlg.coreFile(), dlg.executableFile()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::attachCore(const QString &core, const QString &exe) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const DebuggerStartParametersPtr sp(new DebuggerStartParameters); | 
					
						
							|  |  |  |     sp->executable = exe; | 
					
						
							|  |  |  |     sp->coreFile = core; | 
					
						
							| 
									
										
										
										
											2009-09-17 14:30:28 +02:00
										 |  |  |     sp->startMode = AttachCore; | 
					
						
							| 
									
										
										
										
											2009-10-08 18:37:18 +02:00
										 |  |  |     if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |         ProjectExplorerPlugin::instance()-> | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |             startRunControl(runControl, PE::DEBUGMODE); | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-06 13:27:11 +02:00
										 |  |  | void DebuggerPlugin::startRemoteApplication() | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-09-17 14:30:28 +02:00
										 |  |  |     const DebuggerStartParametersPtr sp(new DebuggerStartParameters); | 
					
						
							| 
									
										
										
										
											2010-02-09 20:44:40 +01:00
										 |  |  |     StartRemoteDialog dlg(m_uiSwitcher->mainWindow()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     QStringList arches; | 
					
						
							|  |  |  |     arches.append(_("i386:x86-64:intel")); | 
					
						
							| 
									
										
										
										
											2009-09-24 10:54:27 +02:00
										 |  |  |     arches.append(_("i386")); | 
					
						
							| 
									
										
										
										
											2009-12-10 15:56:10 +01:00
										 |  |  |     QString lastUsed = configValue(_("LastRemoteArchitecture")).toString(); | 
					
						
							|  |  |  |     if (!arches.contains(lastUsed)) | 
					
						
							|  |  |  |         arches.prepend(lastUsed); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     dlg.setRemoteArchitectures(arches); | 
					
						
							|  |  |  |     dlg.setRemoteChannel( | 
					
						
							|  |  |  |             configValue(_("LastRemoteChannel")).toString()); | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |     dlg.setLocalExecutable( | 
					
						
							|  |  |  |             configValue(_("LastLocalExecutable")).toString()); | 
					
						
							| 
									
										
										
										
											2009-12-11 11:49:32 +01:00
										 |  |  |     dlg.setDebugger(configValue(_("LastDebugger")).toString()); | 
					
						
							| 
									
										
										
										
											2009-12-10 15:56:10 +01:00
										 |  |  |     dlg.setRemoteArchitecture(lastUsed); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     dlg.setServerStartScript( | 
					
						
							|  |  |  |             configValue(_("LastServerStartScript")).toString()); | 
					
						
							|  |  |  |     dlg.setUseServerStartScript( | 
					
						
							|  |  |  |             configValue(_("LastUseServerStartScript")).toBool()); | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |     dlg.setSysRoot(configValue(_("LastSysroot")).toString()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     if (dlg.exec() != QDialog::Accepted) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel()); | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |     setConfigValue(_("LastLocalExecutable"), dlg.localExecutable()); | 
					
						
							| 
									
										
										
										
											2009-12-11 11:49:32 +01:00
										 |  |  |     setConfigValue(_("LastDebugger"), dlg.debugger()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture()); | 
					
						
							|  |  |  |     setConfigValue(_("LastServerStartScript"), dlg.serverStartScript()); | 
					
						
							|  |  |  |     setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript()); | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |     setConfigValue(_("LastSysroot"), dlg.sysRoot()); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     sp->remoteChannel = dlg.remoteChannel(); | 
					
						
							|  |  |  |     sp->remoteArchitecture = dlg.remoteArchitecture(); | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |     sp->executable = dlg.localExecutable(); | 
					
						
							| 
									
										
										
										
											2010-04-12 08:38:28 +02:00
										 |  |  |     sp->debuggerCommand = dlg.debugger(); // Override toolchain-detection.
 | 
					
						
							|  |  |  |     if (!sp->debuggerCommand.isEmpty()) | 
					
						
							|  |  |  |         sp->toolChainType = ProjectExplorer::ToolChain::INVALID; | 
					
						
							| 
									
										
										
										
											2010-05-05 12:49:08 +02:00
										 |  |  |     sp->startMode = AttachToRemote; | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  |     if (dlg.useServerStartScript()) | 
					
						
							|  |  |  |         sp->serverStartScript = dlg.serverStartScript(); | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |     sp->sysRoot = dlg.sysRoot(); | 
					
						
							| 
									
										
										
										
											2009-05-25 16:22:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-08 18:37:18 +02:00
										 |  |  |     if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) | 
					
						
							| 
									
										
										
										
											2009-12-10 16:57:45 +01:00
										 |  |  |         ProjectExplorerPlugin::instance() | 
					
						
							| 
									
										
										
										
											2010-03-11 12:22:24 +01:00
										 |  |  |             ->startRunControl(runControl, PE::DEBUGMODE); | 
					
						
							| 
									
										
										
										
											2009-05-05 17:48:54 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  | void DebuggerPlugin::enableReverseDebuggingTriggered(const QVariant &value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QTC_ASSERT(m_reverseToolButton, return); | 
					
						
							|  |  |  |     m_reverseToolButton->setVisible(value.toBool()); | 
					
						
							| 
									
										
										
										
											2010-06-01 13:12:03 +02:00
										 |  |  |     m_manager->debuggerManagerActions().reverseDirectionAction->setChecked(false); | 
					
						
							|  |  |  |     m_manager->debuggerManagerActions().reverseDirectionAction->setEnabled(value.toBool()); | 
					
						
							| 
									
										
										
										
											2010-03-11 11:07:16 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-09 15:37:47 +02:00
										 |  |  | void DebuggerPlugin::toggleBreakpoint() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ITextEditor *textEditor = currentTextEditor(); | 
					
						
							|  |  |  |     QTC_ASSERT(textEditor, return); | 
					
						
							|  |  |  |     int lineNumber = textEditor->currentLine(); | 
					
						
							|  |  |  |     if (lineNumber >= 0) | 
					
						
							| 
									
										
										
										
											2010-05-12 16:48:04 +02:00
										 |  |  |         toggleBreakpoint(textEditor->file()->fileName(), lineNumber); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DebuggerPlugin::toggleBreakpoint(const QString &fileName, int lineNumber) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     BreakHandler *handler = m_manager->breakHandler(); | 
					
						
							|  |  |  |     QTC_ASSERT(handler, return); | 
					
						
							|  |  |  |     BreakpointData needle; | 
					
						
							|  |  |  |     needle.bpFileName = fileName; | 
					
						
							|  |  |  |     needle.bpLineNumber.setNum(lineNumber); | 
					
						
							|  |  |  |     BreakpointData *data = handler->findSimilarBreakpoint(needle); | 
					
						
							|  |  |  |     if (data) { | 
					
						
							|  |  |  |         handler->removeBreakpoint(data); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         data = new BreakpointData; | 
					
						
							|  |  |  |         data->fileName = fileName; | 
					
						
							|  |  |  |         data->lineNumber = QByteArray::number(lineNumber); | 
					
						
							|  |  |  |         data->pending = true; | 
					
						
							|  |  |  |         data->setMarkerFileName(fileName); | 
					
						
							|  |  |  |         data->setMarkerLineNumber(lineNumber); | 
					
						
							|  |  |  |         handler->appendBreakpoint(data); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     m_manager->attemptBreakpointSynchronization(); | 
					
						
							| 
									
										
										
										
											2010-04-09 15:37:47 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 12:41:52 +02:00
										 |  |  | void DebuggerPlugin::attachRemoteTcf() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     const DebuggerStartParametersPtr sp(new DebuggerStartParameters); | 
					
						
							|  |  |  |     AttachTcfDialog dlg(m_uiSwitcher->mainWindow()); | 
					
						
							|  |  |  |     QStringList arches; | 
					
						
							|  |  |  |     arches.append(_("i386:x86-64:intel")); | 
					
						
							|  |  |  |     dlg.setRemoteArchitectures(arches); | 
					
						
							|  |  |  |     dlg.setRemoteChannel( | 
					
						
							|  |  |  |             configValue(_("LastTcfRemoteChannel")).toString()); | 
					
						
							|  |  |  |     dlg.setRemoteArchitecture( | 
					
						
							|  |  |  |             configValue(_("LastTcfRemoteArchitecture")).toString()); | 
					
						
							|  |  |  |     dlg.setServerStartScript( | 
					
						
							|  |  |  |             configValue(_("LastTcfServerStartScript")).toString()); | 
					
						
							|  |  |  |     dlg.setUseServerStartScript( | 
					
						
							|  |  |  |             configValue(_("LastTcfUseServerStartScript")).toBool()); | 
					
						
							|  |  |  |     if (dlg.exec() != QDialog::Accepted) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     setConfigValue(_("LastTcfRemoteChannel"), dlg.remoteChannel()); | 
					
						
							|  |  |  |     setConfigValue(_("LastTcfRemoteArchitecture"), dlg.remoteArchitecture()); | 
					
						
							|  |  |  |     setConfigValue(_("LastTcfServerStartScript"), dlg.serverStartScript()); | 
					
						
							|  |  |  |     setConfigValue(_("LastTcfUseServerStartScript"), dlg.useServerStartScript()); | 
					
						
							|  |  |  |     sp->remoteChannel = dlg.remoteChannel(); | 
					
						
							|  |  |  |     sp->remoteArchitecture = dlg.remoteArchitecture(); | 
					
						
							|  |  |  |     sp->serverStartScript = dlg.serverStartScript(); | 
					
						
							|  |  |  |     sp->startMode = AttachTcf; | 
					
						
							|  |  |  |     if (dlg.useServerStartScript()) | 
					
						
							|  |  |  |         sp->serverStartScript = dlg.serverStartScript(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) | 
					
						
							|  |  |  |         ProjectExplorerPlugin::instance() | 
					
						
							|  |  |  |             ->startRunControl(runControl, PE::DEBUGMODE); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-02 12:01:29 +01:00
										 |  |  | #include "debuggerplugin.moc"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Q_EXPORT_PLUGIN(DebuggerPlugin) |