Commit 34981a8a authored by hjk's avatar hjk
Browse files

Memcheck: Merge part of local and remote code path



Change-Id: I683cedbe5fbed6d10b24100c51f77a75f74504a1
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 37dec964
...@@ -94,58 +94,41 @@ void MemcheckRunner::setParser(XmlProtocol::ThreadedParser *parser) ...@@ -94,58 +94,41 @@ void MemcheckRunner::setParser(XmlProtocol::ThreadedParser *parser)
bool MemcheckRunner::start() bool MemcheckRunner::start()
{ {
QTC_ASSERT(d->parser, return false);
QString ip;
QHostAddress hostAddr;
if (startMode() == Analyzer::StartLocal) { if (startMode() == Analyzer::StartLocal) {
QTC_ASSERT(d->parser, return false); ip = QLatin1String("127.0.0.1");
hostAddr = QHostAddress(QHostAddress::LocalHost);
bool check = d->xmlServer.listen(QHostAddress(QHostAddress::LocalHost));
QTC_ASSERT(check, return false);
d->xmlServer.setMaxPendingConnections(1);
const quint16 xmlPortNumber = d->xmlServer.serverPort();
connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
check = d->logServer.listen(QHostAddress(QHostAddress::LocalHost));
QTC_ASSERT(check, return false);
d->logServer.setMaxPendingConnections(1);
const quint16 logPortNumber = d->logServer.serverPort();
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
QStringList memcheckArguments;
memcheckArguments << QLatin1String("--xml=yes")
<< QString::fromLatin1("--xml-socket=127.0.0.1:%1").arg(xmlPortNumber)
<< QLatin1String("--child-silent-after-fork=yes")
<< QString::fromLatin1("--log-socket=127.0.0.1:%1").arg(logPortNumber)
<< valgrindArguments();
setValgrindArguments(memcheckArguments);
} }
if (startMode() == Analyzer::StartRemote) { if (startMode() == Analyzer::StartRemote) {
QTC_ASSERT(d->parser, return false); ip = connectionParameters().host;
QString ip = connectionParameters().host;
QTC_ASSERT(!ip.isEmpty(), return false); QTC_ASSERT(!ip.isEmpty(), return false);
hostAddr = QHostAddress(ip);
QHostAddress hostAddr(ip);
bool check = d->xmlServer.listen(hostAddr);
QTC_ASSERT(check, return false);
d->xmlServer.setMaxPendingConnections(1);
const quint16 xmlPortNumber = d->xmlServer.serverPort();
connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
check = d->logServer.listen(hostAddr);
QTC_ASSERT(check, return false);
d->logServer.setMaxPendingConnections(1);
const quint16 logPortNumber = d->logServer.serverPort();
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
QStringList memcheckArguments;
memcheckArguments << QLatin1String("--xml=yes")
<< QString::fromLatin1("--xml-socket=%1:%2").arg(ip).arg(xmlPortNumber)
<< QLatin1String("--child-silent-after-fork=yes")
<< QString::fromLatin1("--log-socket=%1:%2").arg(ip).arg(logPortNumber);
setValgrindArguments(memcheckArguments);
} }
bool check = d->xmlServer.listen(hostAddr);
QTC_ASSERT(check, return false);
d->xmlServer.setMaxPendingConnections(1);
const quint16 xmlPortNumber = d->xmlServer.serverPort();
connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
check = d->logServer.listen(hostAddr);
QTC_ASSERT(check, return false);
d->logServer.setMaxPendingConnections(1);
const quint16 logPortNumber = d->logServer.serverPort();
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
QStringList memcheckArguments;
memcheckArguments << QLatin1String("--xml=yes")
<< QString::fromLatin1("--xml-socket=%1:%2").arg(ip).arg(xmlPortNumber)
<< QLatin1String("--child-silent-after-fork=yes")
<< QString::fromLatin1("--log-socket=%1:%2").arg(ip).arg(logPortNumber);
setValgrindArguments(memcheckArguments);
return ValgrindRunner::start(); return ValgrindRunner::start();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment