2010-07-13 17:16:31 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2010-10-25 14:00:19 +02:00
|
|
|
#include "breakpoint.h"
|
2010-07-13 17:16:31 +02:00
|
|
|
|
|
|
|
|
#include <QtCore/QByteArray>
|
|
|
|
|
#include <QtCore/QDebug>
|
|
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2010-11-16 11:48:17 +01:00
|
|
|
// BreakpointParameters
|
2010-07-13 17:16:31 +02:00
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-11-16 11:48:17 +01:00
|
|
|
BreakpointParameters::BreakpointParameters(BreakpointType t)
|
|
|
|
|
: type(t), enabled(true), useFullPath(false),
|
2010-11-15 17:15:04 +01:00
|
|
|
ignoreCount(0), lineNumber(0), address(0)
|
2010-11-16 11:55:48 +01:00
|
|
|
{}
|
2010-07-13 17:16:31 +02:00
|
|
|
|
2010-11-15 17:04:29 +01:00
|
|
|
bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
|
|
|
|
|
{
|
2010-11-16 11:55:48 +01:00
|
|
|
return type == rhs.type
|
|
|
|
|
&& enabled == rhs.enabled
|
|
|
|
|
&& useFullPath == rhs.useFullPath
|
|
|
|
|
&& fileName == rhs.fileName
|
|
|
|
|
&& condition == rhs.condition
|
|
|
|
|
&& ignoreCount == rhs.ignoreCount
|
|
|
|
|
&& lineNumber == rhs.lineNumber
|
|
|
|
|
&& address == rhs.address
|
|
|
|
|
&& threadSpec == rhs.threadSpec
|
|
|
|
|
&& functionName == rhs.functionName;
|
2010-11-15 17:04:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-16 11:06:09 +01:00
|
|
|
bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
|
2010-07-13 17:16:31 +02:00
|
|
|
{
|
|
|
|
|
// Some versions of gdb "beautify" the passed condition.
|
2010-11-16 11:06:09 +01:00
|
|
|
QByteArray s1 = condition;
|
2010-11-15 16:22:51 +01:00
|
|
|
s1.replace(' ', "");
|
|
|
|
|
QByteArray s2 = other;
|
|
|
|
|
s2.replace(' ', "");
|
2010-07-13 17:16:31 +02:00
|
|
|
return s1 == s2;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-16 11:48:17 +01:00
|
|
|
QString BreakpointParameters::toString() const
|
2010-11-10 16:33:11 +01:00
|
|
|
{
|
|
|
|
|
QString result;
|
|
|
|
|
QTextStream ts(&result);
|
2010-11-16 11:48:17 +01:00
|
|
|
ts << fileName;
|
|
|
|
|
ts << condition;
|
|
|
|
|
ts << ignoreCount;
|
|
|
|
|
ts << lineNumber;
|
|
|
|
|
ts << address;
|
|
|
|
|
ts << functionName;
|
|
|
|
|
ts << useFullPath;
|
2010-11-10 16:33:11 +01:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-16 11:55:48 +01:00
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// BreakpointParameters
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
BreakpointResponse::BreakpointResponse()
|
2010-11-16 17:53:08 +01:00
|
|
|
: number(0), pending(true), multiple(false)
|
2010-11-16 11:55:48 +01:00
|
|
|
{}
|
|
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
QString BreakpointResponse::toString() const
|
|
|
|
|
{
|
|
|
|
|
QString result;
|
|
|
|
|
QTextStream ts(&result);
|
2010-11-15 17:04:29 +01:00
|
|
|
ts << number;
|
2010-11-16 17:53:08 +01:00
|
|
|
ts << pending;
|
2010-11-15 17:04:29 +01:00
|
|
|
ts << fullName;
|
2010-11-16 17:53:08 +01:00
|
|
|
ts << multiple;
|
|
|
|
|
ts << extra;
|
|
|
|
|
return result + BreakpointParameters::toString();
|
2010-11-10 16:33:11 +01:00
|
|
|
}
|
|
|
|
|
|
2010-11-16 10:23:20 +01:00
|
|
|
void BreakpointResponse::fromParameters(const BreakpointParameters &p)
|
|
|
|
|
{
|
|
|
|
|
BreakpointParameters::operator=(p);
|
|
|
|
|
number = 0;
|
|
|
|
|
fullName.clear();
|
|
|
|
|
multiple = false;
|
2010-11-16 11:55:48 +01:00
|
|
|
extra.clear();
|
2010-11-16 10:23:20 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-13 17:16:31 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|