diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 5a4cc3a44976792ab130038de6e49e36aa84d226..1b066a8f616ddef3a4cda72ba8a955da6b7db386 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -30,6 +30,7 @@ HEADERS += breakhandler.h \ debuggermainwindow.h \ debuggerplugin.h \ debuggerrunner.h \ + debuggerstreamops.h \ debuggerstringutils.h \ debuggertooltip.h \ debuggeruiswitcher.h \ @@ -68,6 +69,7 @@ SOURCES += breakhandler.cpp \ debuggermainwindow.cpp \ debuggerplugin.cpp \ debuggerrunner.cpp \ + debuggerstreamops.cpp \ debuggertooltip.cpp \ debuggeruiswitcher.cpp \ logwindow.cpp \ diff --git a/src/plugins/debugger/debuggerstreamops.cpp b/src/plugins/debugger/debuggerstreamops.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aea66f5a6b0a4b9f6ca0c4d27fce2c0b0b16ce3a --- /dev/null +++ b/src/plugins/debugger/debuggerstreamops.cpp @@ -0,0 +1,240 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 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 "debuggerstreamops.h" + +namespace Debugger { +namespace Internal { + +QDataStream &operator<<(QDataStream &stream, const ThreadData &d) +{ + stream << (qint64)d.id; + stream << d.address; + stream << d.function; + stream << d.fileName; + stream << d.state; + stream << d.lineNumber; + stream << d.name; + return stream; +} + +QDataStream &operator>>(QDataStream &stream, ThreadData &d) +{ + qint64 id; + stream >> id; + d.id = id; + stream >> d.address; + stream >> d.function; + stream >> d.fileName; + stream >> d.state; + stream >> d.lineNumber; + stream >> d.name; + return stream; +} + +QDataStream &operator<<(QDataStream &stream, const Threads &threads) +{ + stream << (quint64)threads.count(); + for (int i = 0; i < threads.count(); i++) + { + const ThreadData &d = threads.at(i); + stream << d; + } + return stream; +} + +QDataStream &operator>>(QDataStream &stream, Threads &threads) +{ + quint64 count; + stream >> count; + threads.clear(); + for (quint64 i = 0; i < count; i++) + { + ThreadData d; + stream >> d; + threads.append(d); + } + return stream; +} + +QDataStream &operator<<(QDataStream &stream, const StackFrame &s) +{ + stream << (quint64)s.level; + stream << s.function; + stream << s.file; + stream << s.from; + stream << s.to; + stream << s.line; + stream << s.address; + return stream; +} + +QDataStream &operator>>(QDataStream &stream, StackFrame &s) +{ + quint64 level; + stream >> level; + s.level = level; + stream >> s.function; + stream >> s.file; + stream >> s.from; + stream >> s.to; + stream >> s.line; + stream >> s.address; + return stream; +} + +QDataStream &operator<<(QDataStream &stream, const StackFrames &frames) +{ + stream << (quint64)frames.count(); + for (int i = 0; i < frames.count(); i++) + { + const StackFrame &s = frames.at(i); + stream << s; + } + return stream; +} + +QDataStream &operator>>(QDataStream &stream, StackFrames &frames) +{ + quint64 count; + stream >> count; + frames.clear(); + for (quint64 i = 0; i < count; i++) + { + StackFrame s; + stream >> s; + frames.append(s); + } + return stream; +} + +QDataStream &operator<<(QDataStream &stream, const BreakpointData &s) +{ + stream << s.fileName; + stream << s.condition; + stream << (quint64)s.ignoreCount; + stream << (quint64)s.lineNumber; + stream << s.address; + stream << s.funcName; + stream << s.useFullPath; + + stream << s.bpNumber; + stream << s.bpCondition; + stream << s.bpIgnoreCount; + stream << s.bpFileName; + stream << s.bpFullName; + stream << s.bpLineNumber; + stream << s.bpCorrectedLineNumber; + stream << s.bpThreadSpec; + stream << s.bpFuncName; + stream << s.bpAddress; + + return stream; +} + +QDataStream &operator>>(QDataStream &stream, BreakpointData &s) +{ + quint64 t; + stream >> s.fileName; + stream >> s.condition; + stream >> t; + s.ignoreCount = t; + stream >> t; + s.lineNumber = t; + stream >> s.address; + stream >> s.funcName; + stream >> s.useFullPath; + + stream >> s.bpNumber; + stream >> s.bpCondition; + stream >> s.bpIgnoreCount; + stream >> s.bpFileName; + stream >> s.bpFullName; + stream >> s.bpLineNumber; + stream >> s.bpCorrectedLineNumber; + stream >> s.bpThreadSpec; + stream >> s.bpFuncName; + stream >> s.bpAddress; + return stream; +} + +QDataStream &operator<<(QDataStream &stream, const WatchData &wd) +{ + stream << wd.id; + stream << wd.iname; + stream << wd.exp; + stream << wd.name; + stream << wd.value; + stream << wd.editvalue; + stream << wd.editformat; + stream << wd.valuetooltip; + stream << wd.typeFormats; + stream << wd.type; + stream << wd.displayedType; + stream << wd.variable; + stream << wd.address; + stream << wd.hasChildren; + stream << wd.generation; + stream << wd.valueEnabled; + stream << wd.valueEditable; + stream << wd.error; + stream << wd.state; + stream << wd.changed; + return stream; +} + +QDataStream &operator>>(QDataStream &stream, WatchData &wd) +{ + stream >> wd.id; + stream >> wd.iname; + stream >> wd.exp; + stream >> wd.name; + stream >> wd.value; + stream >> wd.editvalue; + stream >> wd.editformat; + stream >> wd.valuetooltip; + stream >> wd.typeFormats; + stream >> wd.type; + stream >> wd.displayedType; + stream >> wd.variable; + stream >> wd.address; + stream >> wd.hasChildren; + stream >> wd.generation; + stream >> wd.valueEnabled; + stream >> wd.valueEditable; + stream >> wd.error; + stream >> wd.state; + stream >> wd.changed; + return stream; +} + +} // namespace Internal +} // namespace Debugger + + diff --git a/src/plugins/debugger/debuggerstreamops.h b/src/plugins/debugger/debuggerstreamops.h new file mode 100644 index 0000000000000000000000000000000000000000..8bb38a45d7d9ab318ff9c33092c52101acc7c316 --- /dev/null +++ b/src/plugins/debugger/debuggerstreamops.h @@ -0,0 +1,60 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 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 DEBUGGERPLUGIN_STREAMOPS_H +#define DEBUGGERPLUGIN_STREAMOPS_H +#include <QtCore/QDataStream> +#include "breakpoint.h" +#include "stackframe.h" +#include "watchdata.h" +#include "threaddata.h" +#include <QtCore/QVector> + +namespace Debugger { +namespace Internal { + +QDataStream &operator<<(QDataStream& stream, const ThreadData &thread); +QDataStream &operator>>(QDataStream& stream, ThreadData &threads); +QDataStream &operator<<(QDataStream& stream, const Threads &threads); +QDataStream &operator>>(QDataStream& stream, Threads &threads); +QDataStream &operator<<(QDataStream& stream, const StackFrame& frame); +QDataStream &operator>>(QDataStream& stream, StackFrame &frame); +QDataStream &operator<<(QDataStream& stream, const StackFrames& frames); +QDataStream &operator>>(QDataStream& stream, StackFrames &frames); +QDataStream &operator<<(QDataStream& stream, const BreakpointData &bps); +QDataStream &operator>>(QDataStream& stream, BreakpointData &bps); +QDataStream &operator<<(QDataStream& stream, const WatchData &bps); +QDataStream &operator>>(QDataStream& stream, WatchData &bps); +QDataStream &operator<<(QDataStream& stream, const WatchData &bps); +QDataStream &operator>>(QDataStream& stream, WatchData &bps); + +} // namespace Internal +} // namespace Debugger + +#endif diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index ce7b1fff92e8e0dcab07fce98a7f13787afa8d69..99232c51fcd3cd3b701625cff6d2c22f146b8c6d 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -114,7 +114,7 @@ bool operator==(const JSAgentBreakpointData &b1, const JSAgentBreakpointData &b2 typedef QSet<JSAgentBreakpointData> JSAgentBreakpoints; -QDataStream &operator>>(QDataStream &s, WatchData &data) +static QDataStream &operator>>(QDataStream &s, WatchData &data) { data = WatchData(); QByteArray name; @@ -130,7 +130,7 @@ QDataStream &operator>>(QDataStream &s, WatchData &data) return s; } -QDataStream &operator>>(QDataStream &s, StackFrame &frame) +static QDataStream &operator>>(QDataStream &s, StackFrame &frame) { frame = StackFrame(); QByteArray function;