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
ffaa42e5
Commit
ffaa42e5
authored
Sep 09, 2009
by
hjk
Browse files
debugger: merge trk adapter into debugger sources
parent
99435d5f
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debugger.pro
View file @
ffaa42e5
...
...
@@ -87,5 +87,7 @@ include(cdb/cdb.pri)
include
(
gdb
/
gdb
.
pri
)
include
(
script
/
script
.
pri
)
include
(
tcf
/
tcf
.
pri
)
include
(
symbian
/
symbian
.
pri
)
include
(
shared
/
shared
.
pri
)
OTHER_FILES
+=
Debugger
.
pluginspec
src/plugins/debugger/debuggermanager.cpp
View file @
ffaa42e5
...
...
@@ -103,6 +103,8 @@ namespace Internal {
IDebuggerEngine
*
createGdbEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
);
IDebuggerEngine
*
createSymbianEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
);
QDebug
operator
<<
(
QDebug
str
,
const
DebuggerStartParameters
&
p
)
{
QDebug
nospace
=
str
.
nospace
();
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
ffaa42e5
...
...
@@ -32,6 +32,7 @@
#include "idebuggerengine.h"
#include "gdbmi.h"
#include "gdbprocessbase.h"
#include "outputcollector.h"
#include "watchutils.h"
...
...
@@ -73,38 +74,6 @@ enum DebuggingHelperState
DebuggingHelperUnavailable
,
};
// GdbProcessBase is inherited by GdbProcess and the gdb/trk Adapter.
// In the GdbProcess case it's just a wrapper around a QProcess running
// gdb, in the Adapter case it's the interface to the gdb process in
// the whole rfomm/gdb/gdbserver combo.
class
GdbProcessBase
:
public
QObject
{
Q_OBJECT
public:
GdbProcessBase
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
virtual
void
start
(
const
QString
&
program
,
const
QStringList
&
args
,
QIODevice
::
OpenMode
mode
=
QIODevice
::
ReadWrite
)
=
0
;
virtual
void
kill
()
=
0
;
virtual
void
terminate
()
=
0
;
virtual
bool
waitForStarted
(
int
msecs
=
30000
)
=
0
;
virtual
bool
waitForFinished
(
int
msecs
=
30000
)
=
0
;
virtual
QProcess
::
ProcessState
state
()
const
=
0
;
virtual
QString
errorString
()
const
=
0
;
virtual
QByteArray
readAllStandardError
()
=
0
;
virtual
QByteArray
readAllStandardOutput
()
=
0
;
virtual
qint64
write
(
const
char
*
data
)
=
0
;
virtual
void
setWorkingDirectory
(
const
QString
&
dir
)
=
0
;
virtual
void
setEnvironment
(
const
QStringList
&
env
)
=
0
;
signals:
void
error
(
QProcess
::
ProcessError
);
void
readyReadStandardOutput
();
void
readyReadStandardError
();
void
finished
(
int
,
QProcess
::
ExitStatus
);
};
class
GdbProcess
:
public
GdbProcessBase
{
public:
...
...
src/plugins/debugger/gdb/gdbprocessbase.h
0 → 100644
View file @
ffaa42e5
/**************************************************************************
**
** 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 DEBUGGER_PROCESSBASE_H
#define DEBUGGER_PROCESSBASE_H
#include <QtCore/QObject>
#include <QtCore/QProcess>
namespace
Debugger
{
namespace
Internal
{
// GdbProcessBase is inherited by GdbProcess and the gdb/trk Adapter.
// In the GdbProcess case it's just a wrapper around a QProcess running
// gdb, in the Adapter case it's the interface to the gdb process in
// the whole rfomm/gdb/gdbserver combo.
class
GdbProcessBase
:
public
QObject
{
Q_OBJECT
public:
GdbProcessBase
(
QObject
*
parent
=
0
)
:
QObject
(
parent
)
{}
virtual
void
start
(
const
QString
&
program
,
const
QStringList
&
args
,
QIODevice
::
OpenMode
mode
=
QIODevice
::
ReadWrite
)
=
0
;
virtual
void
kill
()
=
0
;
virtual
void
terminate
()
=
0
;
virtual
bool
waitForStarted
(
int
msecs
=
30000
)
=
0
;
virtual
bool
waitForFinished
(
int
msecs
=
30000
)
=
0
;
virtual
QProcess
::
ProcessState
state
()
const
=
0
;
virtual
QString
errorString
()
const
=
0
;
virtual
QByteArray
readAllStandardError
()
=
0
;
virtual
QByteArray
readAllStandardOutput
()
=
0
;
virtual
qint64
write
(
const
char
*
data
)
=
0
;
virtual
void
setWorkingDirectory
(
const
QString
&
dir
)
=
0
;
virtual
void
setEnvironment
(
const
QStringList
&
env
)
=
0
;
signals:
void
error
(
QProcess
::
ProcessError
);
void
readyReadStandardOutput
();
void
readyReadStandardError
();
void
finished
(
int
,
QProcess
::
ExitStatus
);
};
}
// namespace Internal
}
// namespace Debugger
#endif // DEBUGGER_PROCESSBASE_H
src/plugins/debugger/symbian/symbian.pri
0 → 100644
View file @
ffaa42e5
HEADERS += \
$$PWD/trkclient.h \
$$PWD/symbianadapter.h \
#$$PWD/gdboptionspage.h \
SOURCES += \
$$PWD/trkclient.cpp \
$$PWD/symbianadapter.cpp \
$$PWD/symbianengine.cpp \
#$$PWD/gdboptionspage.cpp \
#FORMS += $$PWD/gdboptionspage.ui
#RESOURCES += $$PWD/gdb.qrc
src/plugins/debugger/symbian/symbianadapter.cpp
0 → 100644
View file @
ffaa42e5
This diff is collapsed.
Click to expand it.
src/plugins/debugger/symbian/symbianadapter.h
0 → 100644
View file @
ffaa42e5
/**************************************************************************
**
** 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 DEBUGGER_SYMBIANADAPTER_H
#define DEBUGGER_SYMBIANADAPTER_H
#include "trkutils.h"
#include "trkclient.h"
#include "../gdb/gdbprocessbase.h"
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QHash>
#include <QtCore/QPointer>
#include <QtCore/QProcess>
#include <QtCore/QQueue>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
#include <QtCore/QTimer>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QKeyEvent>
#include <QtGui/QTextBlock>
#include <QtGui/QTextEdit>
#include <QtGui/QToolBar>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
namespace
Debugger
{
namespace
Internal
{
struct
GdbResult
{
QByteArray
data
;
};
///////////////////////////////////////////////////////////////////////
//
// SymbianAdapter
//
///////////////////////////////////////////////////////////////////////
class
SymbianAdapter
:
public
GdbProcessBase
{
Q_OBJECT
public:
typedef
trk
::
TrkResult
TrkResult
;
typedef
trk
::
TrkFunctor1
<
const
TrkResult
&>
TrkCallback
;
typedef
trk
::
TrkFunctor1
<
const
GdbResult
&>
GdbCallback
;
SymbianAdapter
();
~
SymbianAdapter
();
void
setGdbServerName
(
const
QString
&
name
);
QString
gdbServerIP
()
const
;
uint
gdbServerPort
()
const
;
void
setVerbose
(
int
verbose
)
{
m_verbose
=
verbose
;
}
void
setSerialFrame
(
bool
b
)
{
m_serialFrame
=
b
;
}
void
setBufferedMemoryRead
(
bool
b
)
{
m_bufferedMemoryRead
=
b
;
}
public
slots
:
void
startInferior
();
signals:
void
output
(
const
QString
&
senderName
,
const
QString
&
data
);
private
slots
:
void
handleProcError
(
QProcess
::
ProcessError
error
);
void
handleProcFinished
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
);
void
handleProcStarted
();
void
handleProcStateChanged
(
QProcess
::
ProcessState
newState
);
void
run
();
void
startGdb
();
private:
friend
class
RunnerGui
;
void
connectProcess
(
QProcess
*
proc
);
void
sendOutput
(
QObject
*
sender
,
const
QString
&
data
);
void
sendOutput
(
const
QString
&
data
)
{
sendOutput
(
0
,
data
);
}
QString
m_rfcommDevice
;
// /dev/rfcomm0
QString
m_gdbServerName
;
// 127.0.0.1:(2222+uid)
QProcess
m_gdbProc
;
QProcess
m_rfcommProc
;
bool
m_running
;
public:
//
// Implementation of GdbProcessBase
//
void
start
(
const
QString
&
program
,
const
QStringList
&
args
,
QIODevice
::
OpenMode
mode
=
QIODevice
::
ReadWrite
);
void
kill
();
void
terminate
();
bool
waitForStarted
(
int
msecs
=
30000
);
bool
waitForFinished
(
int
msecs
=
30000
);
QProcess
::
ProcessState
state
()
const
;
QString
errorString
()
const
;
QByteArray
readAllStandardError
();
QByteArray
readAllStandardOutput
();
qint64
write
(
const
char
*
data
);
void
setWorkingDirectory
(
const
QString
&
dir
);
void
setEnvironment
(
const
QStringList
&
env
);
//
// TRK
//
void
sendTrkMessage
(
byte
code
,
TrkCallback
callback
=
TrkCallback
(),
const
QByteArray
&
data
=
QByteArray
(),
const
QVariant
&
cookie
=
QVariant
());
Q_SLOT
void
handleTrkResult
(
const
trk
::
TrkResult
&
data
);
Q_SLOT
void
handleTrkError
(
const
QString
&
msg
);
// convenience messages
void
sendTrkAck
(
byte
token
);
void
handleCpuType
(
const
TrkResult
&
result
);
void
handleCreateProcess
(
const
TrkResult
&
result
);
void
handleClearBreakpoint
(
const
TrkResult
&
result
);
void
handleSignalContinue
(
const
TrkResult
&
result
);
void
handleStop
(
const
TrkResult
&
result
);
void
handleSupportMask
(
const
TrkResult
&
result
);
void
handleTrkVersions
(
const
TrkResult
&
result
);
void
handleDisconnect
(
const
TrkResult
&
result
);
void
handleAndReportCreateProcess
(
const
TrkResult
&
result
);
void
handleAndReportReadRegisters
(
const
TrkResult
&
result
);
QByteArray
memoryReadLogMessage
(
uint
addr
,
uint
len
,
const
QByteArray
&
ba
)
const
;
QByteArray
trkContinueMessage
();
QByteArray
trkReadRegisterMessage
();
QByteArray
trkReadMemoryMessage
(
uint
addr
,
uint
len
);
QByteArray
trkBreakpointMessage
(
uint
addr
,
uint
len
,
bool
armMode
=
true
);
void
handleAndReportSetBreakpoint
(
const
TrkResult
&
result
);
void
handleReadMemoryBuffered
(
const
TrkResult
&
result
);
void
handleReadMemoryUnbuffered
(
const
TrkResult
&
result
);
void
handleStepRange
(
const
TrkResult
&
result
);
void
handleReadRegisters
(
const
TrkResult
&
result
);
void
reportReadMemoryBuffered
(
const
TrkResult
&
result
);
void
reportToGdb
(
const
TrkResult
&
result
);
// set breakpoints behind gdb's back
void
handleSetTrkBreakpoint
(
const
TrkResult
&
result
);
void
handleSetTrkMainBreakpoint
(
const
TrkResult
&
result
);
void
readMemory
(
uint
addr
,
uint
len
);
void
interruptInferior
();
trk
::
TrkDevice
m_trkDevice
;
//
// Gdb
//
struct
GdbCommand
{
GdbCommand
()
:
flags
(
0
),
callback
(
GdbCallback
()),
callbackName
(
0
)
{}
int
flags
;
GdbCallback
callback
;
const
char
*
callbackName
;
QString
command
;
QVariant
cookie
;
//QTime postTime;
};
void
sendGdbMessage
(
const
QString
&
msg
,
GdbCallback
callback
=
GdbCallback
(),
const
QVariant
&
cookie
=
QVariant
());
Q_SLOT
void
handleGdbConnection
();
Q_SLOT
void
readGdbServerCommand
();
void
readGdbResponse
();
void
handleGdbServerCommand
(
const
QByteArray
&
cmd
);
void
sendGdbServerMessage
(
const
QByteArray
&
msg
,
const
QByteArray
&
logNote
=
QByteArray
());
void
sendGdbServerMessageAfterTrkResponse
(
const
QByteArray
&
msg
,
const
QByteArray
&
logNote
=
QByteArray
());
void
sendGdbServerAck
();
bool
sendGdbServerPacket
(
const
QByteArray
&
packet
,
bool
doFlush
);
Q_SLOT
void
handleGdbReadyReadStandardError
();
Q_SLOT
void
handleGdbReadyReadStandardOutput
();
void
logMessage
(
const
QString
&
msg
,
bool
force
=
false
);
Q_SLOT
void
trkLogMessage
(
const
QString
&
msg
);
void
handleInfoAddress
(
const
GdbResult
&
result
);
void
handleInfoMainAddress
(
const
GdbResult
&
result
);
QTcpServer
m_gdbServer
;
QPointer
<
QTcpSocket
>
m_gdbConnection
;
QByteArray
m_gdbReadBuffer
;
bool
m_gdbAckMode
;
QHash
<
int
,
GdbCommand
>
m_gdbCookieForToken
;
//
// Rfcomm
//
Q_SLOT
void
handleRfcommReadyReadStandardError
();
Q_SLOT
void
handleRfcommReadyReadStandardOutput
();
// Debuggee state
Q_SLOT
void
executeCommand
(
const
QString
&
msg
);
trk
::
Session
m_session
;
// global-ish data (process id, target information)
trk
::
Snapshot
m_snapshot
;
// local-ish data (memory and registers)
int
m_verbose
;
bool
m_serialFrame
;
bool
m_bufferedMemoryRead
;
};
}
// namespace Internal
}
// namespace Debugger
#endif // DEBUGGER_SYMBIANADAPTER_H
src/plugins/debugger/symbian/symbianengine.cpp
0 → 100644
View file @
ffaa42e5
/**************************************************************************
**
** 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.
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "gdb/gdbengine.h"
#include "symbianadapter.h"
//#include "debuggerdialogs.h"
#include <utils/qtcassert.h>
#include <texteditor/itexteditor.h>
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QMetaObject>
#include <QtCore/QTime>
#include <QtCore/QTimer>
#include <QtCore/QTextStream>
namespace
Debugger
{
namespace
Internal
{
IDebuggerEngine
*
createSymbianEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
opts
)
{
Q_UNUSED
(
opts
);
//opts->push_back(new GdbOptionsPage);
return
new
GdbEngine
(
parent
,
new
SymbianAdapter
);
}
}
// namespace Internal
}
// namespace Debugger
tests/manual/trk/trkdevicex
.cpp
→
src/plugins/debugger/symbian/trkclient
.cpp
View file @
ffaa42e5
...
...
@@ -27,7 +27,7 @@
**
**************************************************************************/
#include "trk
devicex
.h"
#include "trk
client
.h"
#include "trkutils.h"
#include <QtCore/QString>
...
...
@@ -35,7 +35,6 @@
#include <QtCore/QQueue>
#include <QtCore/QHash>
#include <QtCore/QMap>
#include <QtCore/QSharedPointer>
#ifdef Q_OS_WIN
# include <windows.h>
...
...
tests/manual/trk/trkdevicex
.h
→
src/plugins/debugger/symbian/trkclient
.h
View file @
ffaa42e5
File moved
tests/manual/trk
/trkfunctor.h
→
src/plugins/debugger/symbian
/trkfunctor.h
View file @
ffaa42e5
...
...
@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef _TRK_FUNCTOR_H
_
#define _TRK_FUNCTOR_H
_
#ifndef
DEBUGGER
_TRK_FUNCTOR_H
#define
DEBUGGER
_TRK_FUNCTOR_H
#include <QtGlobal>
...
...
tests/manual/trk
/trkutils.cpp
→
src/plugins/debugger/symbian
/trkutils.cpp
View file @
ffaa42e5
File moved
tests/manual/trk
/trkutils.h
→
src/plugins/debugger/symbian
/trkutils.h
View file @
ffaa42e5
...
...
@@ -197,7 +197,6 @@ QByteArray hexNumber(uint n, int digits = 0);
QByteArray
hexxNumber
(
uint
n
,
int
digits
=
0
);
// prepends '0x', too
uint
swapEndian
(
uint
in
);
}
// namespace trk
#endif // DEBUGGER_TRK_UTILS
tests/manual/trk/adapter.pro
View file @
ffaa42e5
TEMPLATE
=
app
DEBUGGERHOME
=
..
/../../
src
/
plugins
/
debugger
/
symbian
INCLUDEPATH
*=
$$
DEBUGGERHOME
UTILSDIR
=
..
/../../
src
/
libs
QT
=
core
network
win32
:
CONFIG
+=
console
HEADERS
+=
trkutils
.
h
\
trkfunctor
.
h
\
trkdevice
.
h
\
HEADERS
+=
\
$$
DEBUGGERHOME
/
trkutils
.
h
\
$$
DEBUGGERHOME
/
trkfunctor
.
h
\
$$
PWD
/
trkdevice
.
h
\
SOURCES
+=
\
adapter
.
cpp
\
trkutils
.
cpp
\
trkdevice
.
cpp
$$
DEBUGGERHOME
/
trkutils
.
cpp
\
$$
PWD
/
trkdevice
.
cpp
\
$$
PWD
/
adapter
.
cpp
\
tests/manual/trk/runner.cpp
View file @
ffaa42e5
This diff is collapsed.
Click to expand it.
tests/manual/trk/runner.pro
View file @
ffaa42e5
TEMPLATE
=
app
DEBUGGERHOME
=
..
/../../
src
/
plugins
/
debugger
/
symbian
INCLUDEPATH
*=
$$
DEBUGGERHOME
QT
+=
network
win32
:
CONFIG
+=
console
HEADERS
+=
\
trkutils
.
h
\
trkdevicex
.
h
\
$$
DEBUGGERHOME
/../
gdb
/
gdbprocessbase
.
h
\
$$
DEBUGGERHOME
/
trkutils
.
h
\
$$
DEBUGGERHOME
/
trkclient
.
h
\
$$
DEBUGGERHOME
/
symbianadapter
.
h
\
SOURCES
+=
\
runner
.
cpp
\
trkutils
.
cpp
\
trkdevicex
.
cpp
\
$$
DEBUGGERHOME
/
trkutils
.
cpp
\
$$
DEBUGGERHOME
/
trkclient
.
cpp
\
$$
DEBUGGERHOME
/
symbianadapter
.
cpp
\
$$
PWD
/
runner
.
cpp
\
tests/manual/trk/trklauncher.pri
View file @
ffaa42e5
DEFINES += DEBUG_TRK=0
INCLUDEPATH *= $$PWD
SOURCES += $$PWD/launcher.cpp \
$$PWD/trkutils.cpp \
$$PWD/trkdevice.cpp
HEADERS += $$PWD/trkutils.h \
$$PWD/trkfunctor.h \
DEBUGGERHOME = ../../../src/plugins/debugger/symbian
INCLUDEPATH *= $$DEBUGGERHOME
SOURCES += \
$$DEBUGGERHOME/trkutils.cpp \
$$PWD/trkdevice.cpp \
$$PWD/launcher.cpp \
HEADERS += \
$$DEBUGGERHOME/trkutils.h \
$$DEBUGGERHOME/trkfunctor.h \
$$PWD/trkdevice.h \
$$PWD/launcher.h
tests/manual/trk/trkserver.pro
View file @
ffaa42e5
TEMPLATE
=
app
DEBUGGERHOME
=
..
/../../
src
/
plugins
/
debugger
/
symbian
QT
=
core
network
win32
:
CONFIG
+=
console
INCLUDEPATH
*=
$$
DEBUGGERHOME