Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
1931d22a
Commit
1931d22a
authored
16 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
deadeec1
745ee20f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/debugger/tcfengine.cpp
+83
-32
83 additions, 32 deletions
src/plugins/debugger/tcfengine.cpp
src/plugins/debugger/tcfengine.h
+10
-21
10 additions, 21 deletions
src/plugins/debugger/tcfengine.h
with
93 additions
and
53 deletions
src/plugins/debugger/tcfengine.cpp
+
83
−
32
View file @
1931d22a
...
...
@@ -40,6 +40,7 @@
#include
"watchhandler.h"
#include
"watchutils.h"
#include
"moduleshandler.h"
#include
"gdbmi.h"
#include
<utils/qtcassert.h>
...
...
@@ -74,6 +75,21 @@ using namespace Debugger::Constants;
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
#define CB(callback) &TcfEngine::callback, STRINGIFY(callback)
///////////////////////////////////////////////////////////////////////
//
// TcfData
//
///////////////////////////////////////////////////////////////////////
TcfData
::
TcfData
(
const
QByteArray
&
data
)
{
fromString
(
data
);
qDebug
()
<<
"TCF RESPONSE: "
<<
data
<<
" -> "
<<
toString
();
}
///////////////////////////////////////////////////////////////////////
//
// TcfEngine
...
...
@@ -119,8 +135,15 @@ void TcfEngine::socketReadyRead()
{
//XSDEBUG("TcfEngine::socketReadyRead()");
m_inbuffer
.
append
(
m_socket
->
readAll
());
//handleResponse(QByteArray::fromRawData(m_inbuffer.constData() + start, end - start));
handleResponse
(
m_inbuffer
);
int
pos
=
0
;
while
(
1
)
{
int
next
=
m_inbuffer
.
indexOf
(
"
\3\1
"
,
pos
);
//qDebug() << "pos: " << pos << "next: " << next;
if
(
next
==
-
1
)
break
;
handleResponse
(
m_inbuffer
.
mid
(
pos
,
next
-
pos
));
pos
=
next
+
2
;
}
m_inbuffer
.
clear
();
}
...
...
@@ -268,28 +291,61 @@ QList<Symbol> TcfEngine::moduleSymbols(const QString & /*moduleName*/)
}
void
TcfEngine
::
handleResponse
(
const
QByteArray
&
buf
)
void
TcfEngine
::
handleResponse
(
const
QByteArray
&
response
)
{
static
QTime
lastTime
;
//emit tcfOutputAvailable(_(" "), currentTime());
TcfResponse
response
;
QList
<
QByteArray
>
parts
=
buf
.
split
(
'\0'
);
QList
<
QByteArray
>
parts
=
response
.
split
(
'\0'
);
if
(
parts
.
size
()
<
2
||
!
parts
.
last
().
isEmpty
())
{
qDebug
()
<<
"Wrong response packet layout"
<<
quoteUnprintableLatin1
(
response
);
return
;
}
parts
.
removeLast
();
// always empty
QByteArray
tag
=
parts
.
at
(
0
);
int
n
=
parts
.
size
();
if
(
n
>=
1
)
response
.
tag
=
parts
.
at
(
0
);
if
(
n
>=
2
)
response
.
service
=
parts
.
at
(
1
);
if
(
n
>=
3
)
response
.
cmd
=
parts
.
at
(
2
);
if
(
n
>=
4
)
response
.
data
=
parts
.
at
(
3
);
if
(
response
.
cmd
!=
"peerHeartBeat"
)
emit
tcfOutputAvailable
(
_
(
"
\n
tcf:"
),
quoteUnprintableLatin1
(
buf
));
//emit tcfOutputAvailable(_("\ntcf:"), response.toString());
qDebug
()
<<
response
.
toString
();
if
(
response
.
service
==
"Locator"
&&
response
.
cmd
==
"Hello"
)
{
if
(
n
==
1
&&
tag
==
"N"
)
{
// unidentified command
qDebug
()
<<
"Command not recognized."
;
}
else
if
(
n
==
2
&&
tag
==
"N"
)
{
// flow control
int
congestion
=
parts
.
at
(
1
).
toInt
();
qDebug
()
<<
"Congestion: "
<<
congestion
;
}
else
if
(
n
==
4
&&
tag
==
"R"
)
{
// result data
int
token
=
parts
.
at
(
1
).
toInt
();
QByteArray
message
=
parts
.
at
(
2
);
TcfData
data
(
parts
.
at
(
3
));
emit
tcfOutputAvailable
(
_
(
"
\n
tcf R:"
),
quoteUnprintableLatin1
(
response
));
TcfCommand
tcf
=
m_cookieForToken
[
token
];
TcfData
result
(
data
);
//qDebug() << "Good response: " << quoteUnprintableLatin1(response);
if
(
tcf
.
callback
)
(
this
->*
(
tcf
.
callback
))(
result
,
tcf
.
cookie
);
}
else
if
(
n
==
3
&&
tag
==
"P"
)
{
// progress data (partial result)
//int token = parts.at(1).toInt();
QByteArray
data
=
parts
.
at
(
2
);
emit
tcfOutputAvailable
(
_
(
"
\n
tcf P:"
),
quoteUnprintableLatin1
(
response
));
}
else
if
(
n
==
4
&&
tag
==
"E"
)
{
// an event
QByteArray
service
=
parts
.
at
(
1
);
QByteArray
eventName
=
parts
.
at
(
2
);
TcfData
data
(
parts
.
at
(
3
));
if
(
eventName
!=
"peerHeartBeat"
)
emit
tcfOutputAvailable
(
_
(
"
\n
tcf E:"
),
quoteUnprintableLatin1
(
response
));
if
(
service
==
"Locator"
&&
eventName
==
"Hello"
)
{
m_services
.
clear
();
foreach
(
const
GdbMi
&
service
,
data
.
children
())
{
qDebug
()
<<
"Found service: "
<<
service
.
data
();
m_services
.
append
(
service
.
data
());
}
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
startDebugging
()));
}
}
else
{
qDebug
()
<<
"Unknown response packet"
<<
quoteUnprintableLatin1
(
response
)
<<
parts
;
}
}
void
TcfEngine
::
startDebugging
()
{
//postCommand('C', CB(handleRunControlSuspend),
// "RunControl", "suspend", "\"Thread1\"");
//postCommand('C', CB(handleRunControlSuspend),
...
...
@@ -304,12 +360,6 @@ void TcfEngine::handleResponse(const QByteArray &buf)
//postCommand('E', "Locator", "Hello", "");
//postCommand('C', "Locator", "sync", "");
//postCommand("Locator", "redirect", "ID");
return
;
}
TcfCommand
tcf
=
m_cookieForToken
[
1
];
if
(
tcf
.
callback
)
(
this
->*
(
tcf
.
callback
))(
response
,
tcf
.
cookie
);
}
void
TcfEngine
::
postCommand
(
char
tag
,
...
...
@@ -319,7 +369,7 @@ void TcfEngine::postCommand(char tag,
const
QByteArray
&
cmd
,
const
QByteArray
&
args
)
{
static
int
token
;
static
int
token
=
50
;
++
token
;
const
char
delim
=
0
;
...
...
@@ -330,7 +380,7 @@ void TcfEngine::postCommand(char tag,
QByteArray
ba
;
ba
.
append
(
tag
);
ba
.
append
(
delim
);
ba
.
append
(
Q
String
::
number
(
token
)
.
toLatin1
()
);
ba
.
append
(
Q
ByteArray
::
number
(
token
));
ba
.
append
(
delim
);
ba
.
append
(
service
);
ba
.
append
(
delim
);
...
...
@@ -353,21 +403,22 @@ void TcfEngine::postCommand(char tag,
emit
tcfInputAvailable
(
"send"
,
QString
::
number
(
result
));
}
void
TcfEngine
::
handleRunControlSuspend
(
const
Tcf
Response
&
response
,
const
QVariant
&
)
void
TcfEngine
::
handleRunControlSuspend
(
const
Tcf
Data
&
data
,
const
QVariant
&
)
{
qDebug
()
<<
"HANDLE RESULT"
;
}
void
TcfEngine
::
handleRunControlGetChildren
(
const
Tcf
Response
&
response
,
const
QVariant
&
)
void
TcfEngine
::
handleRunControlGetChildren
(
const
Tcf
Data
&
data
,
const
QVariant
&
)
{
qDebug
()
<<
"HANDLE R
ESULT"
<<
response
.
toString
();
qDebug
()
<<
"HANDLE R
UN CONTROL GET CHILDREN"
<<
data
.
toString
();
}
void
TcfEngine
::
handleSysMonitorGetChildren
(
const
Tcf
Response
&
response
,
const
QVariant
&
)
void
TcfEngine
::
handleSysMonitorGetChildren
(
const
Tcf
Data
&
data
,
const
QVariant
&
)
{
qDebug
()
<<
"HANDLE R
ESULT"
<<
response
.
toString
();
qDebug
()
<<
"HANDLE R
UN CONTROL GET CHILDREN"
<<
data
.
toString
();
}
//////////////////////////////////////////////////////////////////////
//
// Tooltip specific stuff
...
...
This diff is collapsed.
Click to expand it.
src/plugins/debugger/tcfengine.h
+
10
−
21
View file @
1931d22a
...
...
@@ -47,6 +47,7 @@ QT_END_NAMESPACE
#include
"idebuggerengine.h"
#include
"debuggermanager.h"
#include
"gdbmi.h"
namespace
Debugger
{
namespace
Internal
{
...
...
@@ -56,25 +57,10 @@ class IDebuggerManagerAccessForEngines;
class
ScriptAgent
;
class
WatchData
;
class
Tcf
Response
class
Tcf
Data
:
public
GdbMi
{
public:
enum
ResponseType
{
HelloResponse
,
HeartBeatResponse
};
QString
toString
()
const
{
return
_
(
"TAG: "
+
tag
+
" SERVICE: "
+
service
+
" CMD: "
+
cmd
+
" DATA: "
+
data
);
}
QByteArray
tag
;
QByteArray
service
;
QByteArray
cmd
;
QByteArray
data
;
TcfData
(
const
QByteArray
&
data
);
};
class
TcfEngine
:
public
IDebuggerEngine
...
...
@@ -140,13 +126,15 @@ private:
Q_SLOT
void
socketReadyRead
();
void
handleResponse
(
const
QByteArray
&
ba
);
void
handleRunControlSuspend
(
const
Tcf
Response
&
response
,
const
QVariant
&
);
void
handleRunControlGetChildren
(
const
Tcf
Response
&
response
,
const
QVariant
&
);
void
handleSysMonitorGetChildren
(
const
Tcf
Response
&
response
,
const
QVariant
&
);
void
handleRunControlSuspend
(
const
Tcf
Data
&
response
,
const
QVariant
&
);
void
handleRunControlGetChildren
(
const
Tcf
Data
&
response
,
const
QVariant
&
);
void
handleSysMonitorGetChildren
(
const
Tcf
Data
&
response
,
const
QVariant
&
);
private
:
Q_SLOT
void
startDebugging
();
typedef
void
(
TcfEngine
::*
TcfCommandCallback
)
(
const
Tcf
Response
&
record
,
const
QVariant
&
cookie
);
(
const
Tcf
Data
&
record
,
const
QVariant
&
cookie
);
struct
TcfCommand
{
...
...
@@ -171,6 +159,7 @@ private:
IDebuggerManagerAccessForEngines
*
qq
;
QTcpSocket
*
m_socket
;
QByteArray
m_inbuffer
;
QStringList
m_services
;
};
}
// namespace Internal
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment