Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
46795bff
Commit
46795bff
authored
Feb 26, 2010
by
hjk
Browse files
debugger: remove standalone version. unused and not compilable anymore.
parent
75b1c87d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/tools/qdebugger/lean.h
deleted
100644 → 0
View file @
75b1c87d
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** 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.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QDBIMPORTS_H
#define QDBIMPORTS_H
#include <QtCore/QFile>
#include <QtCore/QList>
#include <QtGui/QIcon>
#include <QtGui/QPlainTextEdit>
namespace
TextEditor
{
class
BaseTextMark
:
public
QObject
{
// Q_OBJECT
public:
BaseTextMark
(
const
QString
&
/*filename*/
,
int
/*line*/
)
{}
~
BaseTextMark
()
{}
// return your icon here
virtual
QIcon
icon
()
const
{
return
QIcon
();
}
// called if the linenumber changes
virtual
void
updateLineNumber
(
int
/*lineNumber*/
)
{}
// called whenever the text of the block for the marker changed
virtual
void
updateBlock
(
const
QTextBlock
&
/*block*/
)
{}
// called if the block containing this mark has been removed
// if this also removes your mark call this->deleteLater();
virtual
void
removedFromEditor
()
{}
// call this if the icon has changed.
void
updateMarker
()
{}
public:
QString
m_fileName
;
int
m_line
;
};
}
// namespace TextEditor
#ifdef USE_BASETEXTEDITOR
#define BASETEXTMARK_H
#include "../../plugins/texteditor/basetexteditor.h"
class
Editable
:
public
TextEditor
::
BaseTextEditorEditable
{
Q_OBJECT
public:
Editable
(
TextEditor
::
BaseTextEditor
*
editor
)
:
TextEditor
::
BaseTextEditorEditable
(
editor
)
{}
// Core::IContext
QList
<
int
>
context
()
const
{
return
m_context
;
}
// Core::IEditor
const
char
*
kind
()
const
{
return
"MYEDITOR"
;
}
bool
duplicateSupported
()
const
{
return
false
;
}
Core
::
IEditor
*
duplicate
(
QWidget
*
)
{
return
0
;
}
QList
<
int
>
m_context
;
};
class
TextViewer
:
public
TextEditor
::
BaseTextEditor
{
Q_OBJECT
public:
TextViewer
(
QWidget
*
parent
)
:
TextEditor
::
BaseTextEditor
(
parent
)
{
setCodeFoldingVisible
(
true
);
setMarksVisible
(
true
);
setHighlightCurrentLine
(
true
);
}
TextEditor
::
BaseTextEditorEditable
*
createEditableInterface
()
{
return
new
Editable
(
this
);
}
QString
fileName
()
{
return
file
()
->
fileName
();
}
int
currentLine
()
const
{
return
textCursor
().
blockNumber
()
+
1
;
}
};
#else // defined(USE_BASETEXTEDITOR)
class
TextViewer
:
public
QPlainTextEdit
{
Q_OBJECT
public:
TextViewer
(
QWidget
*
parent
)
:
QPlainTextEdit
(
parent
)
{}
QString
fileName
()
const
{
return
m_fileName
;
}
int
currentLine
()
const
{
return
textCursor
().
blockNumber
()
+
1
;
}
bool
open
(
const
QString
&
fileName
)
{
m_fileName
=
fileName
;
QFile
file
(
fileName
);
bool
result
=
file
.
open
(
QIODevice
::
ReadOnly
);
QString
contents
=
file
.
readAll
();
setPlainText
(
contents
);
return
result
;
}
public:
QString
m_fileName
;
};
#endif // defined(USE_BASETEXTEDITOR)
#endif // QDBIMPORTS
src/tools/qdebugger/main.cpp
deleted
100644 → 0
View file @
75b1c87d
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** 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.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "mainwindow.h"
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
app
(
argc
,
argv
);
MainWindow
mw
;
mw
.
show
();
QStringList
args
=
app
.
arguments
();
args
.
removeFirst
();
// program name..
mw
.
loadFiles
(
args
);
return
app
.
exec
();
}
src/tools/qdebugger/mainwindow.cpp
deleted
100644 → 0
View file @
75b1c87d
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** 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.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "mainwindow.h"
#include "gdbdebugger.h"
#include "gdboutputwindow.h"
#include "lean.h"
#include <QtCore/QDebug>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QPointer>
#include <QtCore/QSettings>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QComboBox>
#include <QtGui/QDockWidget>
#include <QtGui/QFileDialog>
#include <QtGui/QGridLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QMessageBox>
#include <QtGui/QStandardItemModel>
#include <QtGui/QStatusBar>
#include <QtGui/QTabWidget>
#include <QtGui/QTextBlock>
#include <QtGui/QToolBar>
#include <QtGui/QTreeView>
#include <QtGui/QWidget>
using
namespace
GdbDebugger
;
using
namespace
GdbDebugger
::
Internal
;
///////////////////////////////////////////////////////////////////////
//
// LocationMark
//
///////////////////////////////////////////////////////////////////////
#ifdef USE_BASETEXTEDITOR
class
LocationMark
:
public
TextEditor
::
ITextMark
{
public:
LocationMark
()
{
m_editor
=
0
;
}
~
LocationMark
()
{
qDebug
()
<<
"LOCATIONMARK DESTRUCTOR"
<<
m_editor
;
}
QIcon
icon
()
const
;
QColor
color
()
const
;
void
contextMenu
(
const
QPoint
&
/*position*/
)
{}
void
toggle
()
{}
void
updateLineNumber
(
int
/*line*/
)
{}
void
removedFromEditor
()
{
m_editor
=
0
;
}
TextViewer
*
editor
()
const
{
return
m_editor
.
data
();
}
void
setEditor
(
TextViewer
*
editor
);
void
updateBlock
(
const
QTextBlock
&
)
{}
void
documentClosing
()
{}
private:
QPointer
<
TextViewer
>
m_editor
;
};
void
LocationMark
::
setEditor
(
TextViewer
*
editor
)
{
if
(
m_editor
)
m_editor
->
markableInterface
()
->
removeMark
(
this
);
if
(
editor
)
m_editor
=
editor
;
else
m_editor
=
0
;
}
QIcon
LocationMark
::
icon
()
const
{
static
const
QIcon
icon
(
":/gdbdebugger/images/location.svg"
);
return
icon
;
}
QColor
LocationMark
::
color
()
const
{
return
QColor
(
255
,
255
,
0
,
20
);
}
LocationMark
*
theLocationMark
()
{
static
LocationMark
*
mark
=
new
LocationMark
;
return
mark
;
}
#endif
///////////////////////////////////////////////////////////////////////////
//
// MainWindow
//
///////////////////////////////////////////////////////////////////////////
MainWindow
::
MainWindow
()
{
m_manager
=
new
DebuggerManager
;
m_manager
->
initialize
();
m_manager
->
createDockWidgets
();
m_manager
->
setSimpleDockWidgetArrangement
();
setCentralWidget
(
m_manager
->
mainWindow
());
//
// Source code view
//
m_textViewers
=
new
QTabWidget
(
m_manager
->
mainWindow
());
m_textViewers
->
setObjectName
(
"Editors"
);
m_textViewers
->
setElideMode
(
Qt
::
ElideLeft
);
//setCentralWidget(m_textViewers);
m_manager
->
mainWindow
()
->
setCentralWidget
(
m_textViewers
);
setGeometry
(
QRect
(
0
,
0
,
800
,
600
));
//
// Actions
//
m_fileOpenAction
=
new
QAction
(
tr
(
"Open file"
),
this
);
m_fileOpenAction
->
setShortcut
(
QKeySequence
(
tr
(
"Ctrl+O"
)));
m_quitAction
=
new
QAction
(
tr
(
"Quit"
),
this
);
m_quitAction
->
setShortcut
(
QKeySequence
(
tr
(
"Ctrl+Q"
)));
#if 0
m_startDebuggerAction = new QAction(tr("Run to main()"), this);
m_startDebuggerAction->setShortcut(QKeySequence(tr("Ctrl+F5")));
connect(m_startDebuggerAction, SIGNAL(triggered()),
this, SLOT(startDebuggerRequest()));
connect(m_resetAction, SIGNAL(triggered()),
m_manager, SLOT(resetDebugger()));
connect(m_watchAction, SIGNAL(triggered()),
m_manager, SLOT(addToWatchWindow()));
connect(m_breakAction, SIGNAL(triggered()),
this, SLOT(toggleBreakpoint()));
#endif
m_manager
->
m_continueAction
->
setShortcut
(
QKeySequence
(
tr
(
"F5"
)));
m_manager
->
m_stopAction
->
setShortcut
(
QKeySequence
(
tr
(
"Shift+F5"
)));
//m_resetAction = new QAction(tr("Reset Debugger"), this);
//m_resetAction->setShortcut(QKeySequence(tr("Ctrl+Shift+F5")));
m_manager
->
m_nextAction
->
setShortcut
(
QKeySequence
(
tr
(
"F6"
)));
m_manager
->
m_stepAction
->
setShortcut
(
QKeySequence
(
tr
(
"F7"
)));
m_manager
->
m_nextIAction
->
setShortcut
(
QKeySequence
(
tr
(
"Shift+F6"
)));
m_manager
->
m_stepIAction
->
setShortcut
(
QKeySequence
(
tr
(
"Shift+F9"
)));
m_manager
->
m_stepOutAction
->
setShortcut
(
QKeySequence
(
tr
(
"Shift+F7"
)));
m_manager
->
m_runToLineAction
->
setShortcut
(
QKeySequence
(
tr
(
"Shift+F8"
)));
//m_manager->m_jumpToLineAction->setShortcut(QKeySequence(tr("Shift+F8")));
m_manager
->
m_breakAction
->
setShortcut
(
QKeySequence
(
tr
(
"F8"
)));
m_manager
->
m_watchAction
->
setShortcut
(
QKeySequence
(
tr
(
"ALT+D,ALT+W"
)));
//
// Files
//
QDockWidget
*
filesDock
=
new
QDockWidget
(
this
);
filesDock
->
setObjectName
(
"FilesDock"
);
filesDock
->
setGeometry
(
QRect
(
0
,
0
,
200
,
200
));
filesDock
->
setWindowTitle
(
tr
(
"Files"
));
filesDock
->
setAllowedAreas
(
Qt
::
AllDockWidgetAreas
);
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
filesDock
);
m_filesModel
=
new
QStandardItemModel
(
this
);
m_filesWindow
=
new
QTreeView
(
this
);
m_filesWindow
->
setModel
(
m_filesModel
);
m_filesWindow
->
header
()
->
hide
();
m_filesWindow
->
setRootIsDecorated
(
false
);
filesDock
->
setWidget
(
m_filesWindow
);
connect
(
m_filesWindow
,
SIGNAL
(
activated
(
QModelIndex
)),
this
,
SLOT
(
changeCurrentFile
(
QModelIndex
)));
connect
(
m_filesWindow
,
SIGNAL
(
clicked
(
QModelIndex
)),
this
,
SLOT
(
changeCurrentFile
(
QModelIndex
)));
//
// Menubar
//
QMenu
*
fileMenu
=
new
QMenu
(
menuBar
());
fileMenu
->
setTitle
(
tr
(
"File"
));
fileMenu
->
addAction
(
m_fileOpenAction
);
fileMenu
->
addSeparator
();
fileMenu
->
addAction
(
m_quitAction
);
menuBar
()
->
addMenu
(
fileMenu
);
QMenu
*
debugMenu
=
new
QMenu
(
menuBar
());
debugMenu
->
setTitle
(
tr
(
"Debug"
));
debugMenu
->
addAction
(
m_manager
->
m_continueAction
);
debugMenu
->
addAction
(
m_manager
->
m_stopAction
);
debugMenu
->
addSeparator
();
debugMenu
->
addAction
(
m_manager
->
m_nextAction
);
debugMenu
->
addAction
(
m_manager
->
m_stepAction
);
debugMenu
->
addAction
(
m_manager
->
m_nextIAction
);
debugMenu
->
addAction
(
m_manager
->
m_stepIAction
);
debugMenu
->
addAction
(
m_manager
->
m_stepOutAction
);
debugMenu
->
addAction
(
m_manager
->
m_runToLineAction
);
debugMenu
->
addAction
(
m_manager
->
m_runToFunctionAction
);
debugMenu
->
addAction
(
m_manager
->
m_jumpToLineAction
);
debugMenu
->
addSeparator
();
debugMenu
->
addAction
(
m_manager
->
m_breakAction
);
//debugMenu->addAction(m_startDebuggerAction);
menuBar
()
->
addMenu
(
debugMenu
);
//
// Toolbar
//
QToolBar
*
toolbar
=
m_manager
->
createToolBar
();
toolbar
->
setObjectName
(
"ToolBar"
);
addToolBar
(
Qt
::
TopToolBarArea
,
toolbar
);
//
// Statusbar
//
QStatusBar
*
statusbar
=
new
QStatusBar
(
this
);
statusbar
->
setObjectName
(
"StatusBar"
);
statusbar
->
setGeometry
(
QRect
(
0
,
578
,
800
,
22
));
setStatusBar
(
statusbar
);
show
();
restoreState
(
settings
().
value
(
"MainWindow/State"
).
toByteArray
());
setGeometry
(
settings
().
value
(
"MainWindow/Geometry"
).
toRect
());
connect
(
m_fileOpenAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
fileOpen
()));
connect
(
m_quitAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
quit
()));
connect
(
m_manager
,
SIGNAL
(
resetLocationRequested
()),
this
,
SLOT
(
resetLocation
()));
connect
(
m_manager
,
SIGNAL
(
gotoLocationRequested
(
QString
,
int
,
bool
)),
this
,
SLOT
(
gotoLocation
(
QString
,
int
,
bool
)));
connect
(
m_manager
,
SIGNAL
(
dataDumpersUnavailable
()),
this
,
SLOT
(
handleDataDumpersUnavailable
()));
// Application interaction
connect
(
m_manager
,
SIGNAL
(
currentTextEditorRequested
(
QString
*
,
int
*
,
QObject
**
)),
this
,
SLOT
(
queryCurrentTextEditor
(
QString
*
,
int
*
,
QObject
**
)));
}
MainWindow
::~
MainWindow
()
{
settings
().
setValue
(
"MainWindow/State"
,
saveState
());
settings
().
setValue
(
"MainWindow/Geometry"
,
geometry
());
settings
().
sync
();
}
QSettings
&
MainWindow
::
settings
()
{
static
QSettings
s
(
"Nokia"
,
"Qdb"
);
return
s
;
}
void
MainWindow
::
loadFile
(
const
QString
&
fileName
)
{
QFileInfo
fi
(
fileName
);
if
(
fi
.
isExecutable
()
&&
!
fileName
.
endsWith
(
".cpp"
)
&&
!
fileName
.
endsWith
(
".h"
))
{
m_executable
=
fileName
;
QStandardItem
*
item
=
new
QStandardItem
(
fileName
);
QStandardItem
*
childItem
=
new
QStandardItem
(
"<gdb not running>"
);
item
->
appendRow
(
childItem
);
// force [+] on item
item
->
setToolTip
(
fi
.
absoluteFilePath
());
//m_fileModel->appendRow(item);
}
else
{
(
void
)
findOrCreateTextViewer
(
fileName
);
}
}
void
MainWindow
::
loadFiles
(
const
QStringList
&
fileNames
)
{
if
(
fileNames
.
isEmpty
())
return
;
foreach
(
const
QString
&
fileName
,
fileNames
)
loadFile
(
fileName
);
startDebuggingRequest
();
}
void
MainWindow
::
startDebuggingRequest
()
{
if
(
m_manager
->
m_startIsContinue
)
{
m_manager
->
continueInferior
();
return
;
}
m_manager
->
settings
()
->
m_autoRun
=
true
;
m_manager
->
settings
()
->
m_autoQuit
=
true
;
m_manager
->
settings
()
->
m_gdbCmd
=
"gdb"
;
m_manager
->
settings
()
->
m_breakOnMain
=
"gdb"
;
qDebug
()
<<
"START REQUEST"
;
if
(
m_executable
.
isEmpty
())
{
QMessageBox
::
warning
(
0
,
tr
(
"Not a runnable project"
),
tr
(
"The current startup project can not be run."
));
return
;
}
StartData
sd
;
sd
.
outputFile
=
m_executable
;
//Project *pro = project();
//sd.outputFile = pro->executable(pro->activeConfiguration());
// NBS TODO pid
// pid = pe->configLanguage(
// ProjectExplorer::Constants::P_RUNNINGPID, langID).toString();
// sd.env = pro->environment(pro->activeConfiguration()).toStringList();
// sd.workingDir = pro->workingDirectory(pro->activeConfiguration());
// sd.processArgs = pro->executableArguments(pro->activeConfiguration());
// const QFileInfo editorFile(textViewer->file()->fileName());
// sd.currentEditorDir = editorFile.dir().absolutePath();
m_manager
->
startDebuggerAndRunInferior
(
sd
);
}
void
MainWindow
::
startDebuggerRequest
()
{
// FIXME: Ignored
StartData
sd
;
sd
.
outputFile
=
m_executable
;
//Project *pro = project();
//sd.outputFile = pro->executable(pro->activeConfiguration());
// NBS TODO pid
// pid = pe->configLanguage(
// ProjectExplorer::Constants::P_RUNNINGPID, langID).toString();
// sd.env = pro->environment(pro->activeConfiguration()).toStringList();
// sd.workingDir = pro->workingDirectory(pro->activeConfiguration());
// sd.processArgs = pro->executableArguments(pro->activeConfiguration());
// const QFileInfo editorFile(textViewer->file()->fileName());
// sd.currentEditorDir = editorFile.dir().absolutePath();
m_manager
->
m_settings
->
m_autoRun
=
false
;
m_manager
->
m_settings
->
m_autoQuit
=
true
;
m_manager
->
startDebuggerAndRunInferior
(
sd
);
}
void
MainWindow
::
jumpToExec
()
{
#if 0
TextViewer *editor = currentTextViewer();
if (!editor)
return;
int lineNumber = editor->currentLine();
QString fileName = editor->file()->fileName();
if (fileName.isEmpty())
return;
m_manager->jumpToLineExec(fileName, lineNumber);
#endif
}
void
MainWindow
::
runToExec
()
{
#if 0
TextViewer *editor = currentTextViewer();
if (!editor)
return;
int lineNumber = editor->currentLine();
QString fileName = editor->file()->fileName();
if (fileName.isEmpty())
return;
m_manager->runToLineExec(fileName, lineNumber);
#endif
}
void
MainWindow
::
showStatusMessage
(
const
QString
&
msg
,
int
timeout
)
{
statusBar
()
->
showMessage
(
msg
,
timeout
);
}
void
MainWindow
::
resetLocation
()
{
TextViewer
*
textViewer
=
currentTextViewer
();
if
(
!
textViewer
)
return
;
const
int
blockNumber
=
m_textBlockFromName
.
value
(
textViewer
,
-
1
);
if
(
blockNumber
==
1
)
return
;
const
QTextBlock
&
block
=
textViewer
->
document
()
->
findBlockByNumber
(
blockNumber
);
if
(
block
.
isValid
())
{
QTextCursor
cursor
(
block
);
//QTextBlockFormat format = block.blockFormat();
//format.setBackground(QColor(200, 200, 250));
cursor
.
setBlockFormat
(
QTextBlockFormat
());
textViewer
->
setTextCursor
(
cursor
);
textViewer
->
centerCursor
();
}
#ifdef USE_BASETEXTEDITOR
if
(
TextViewer
*
editor
=
theLocationMark
()
->