Commit a7e67742 authored by hjk's avatar hjk
Browse files

debugger: work on autotests

Qt creator starts up now, no debugging yet.
parent 9318459b
......@@ -148,8 +148,7 @@ extern IDebuggerEngine *createWinEngine(DebuggerManager *)
#endif
extern IDebuggerEngine *createScriptEngine(DebuggerManager *parent);
DebuggerManager::DebuggerManager() :
m_attachCoreAction(0)
DebuggerManager::DebuggerManager()
{
init();
}
......@@ -294,11 +293,9 @@ void DebuggerManager::init()
m_attachExternalAction = new QAction(this);
m_attachExternalAction->setText(tr("Attach to Running External Application..."));
#ifndef Q_OS_WIN
m_attachCoreAction = new QAction(this);
m_attachCoreAction->setText(tr("Attach to Core..."));
connect(m_attachCoreAction, SIGNAL(triggered()), this, SLOT(attachCore()));
#endif
m_continueAction = new QAction(this);
m_continueAction->setText(tr("Continue"));
......@@ -1193,8 +1190,11 @@ void DebuggerManager::setStatus(int status)
m_startExternalAction->setEnabled(!started && !starting);
m_attachExternalAction->setEnabled(!started && !starting);
if (m_attachCoreAction)
m_attachCoreAction->setEnabled(!started && !starting);
#ifdef Q_OS_WIN
m_attachCoreAction->setEnabled(false);
#else
m_attachCoreAction->setEnabled(!started && !starting);
#endif
m_watchAction->setEnabled(ready);
m_breakAction->setEnabled(true);
......@@ -1460,15 +1460,6 @@ void DebuggerManager::runTest(const QString &fileName)
m_executable = fileName;
m_processArgs = QStringList() << "--run-debuggee";
m_workingDir = QString();
qDebug() << "TESTING: " << fileName;
//QFile file(fileName);
//file.open(QIODevice::ReadOnly);
//QTextStream ts(&file);
//foreach (QString line, ts.readAll().split('\n')) {
// qDebug() << "TESTING: " << line;
// if (line.startsWith("Executable="))
//}
startNewDebugger(StartInternal);
}
......
......@@ -797,8 +797,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
void DebuggerPlugin::extensionsInitialized()
{
// time gdb -i mi -ex 'debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin
//qDebug() << "EXTENSIONS INITIALIZED";
QByteArray env = qgetenv("QTC_DEBUGGER_TEST");
//qDebug() << "EXTENSIONS INITIALIZED:" << env;
if (!env.isEmpty())
m_manager->runTest(QString::fromLocal8Bit(env));
}
......
......@@ -398,6 +398,10 @@ void GdbEngine::handleResponse(const QByteArray &buff)
// target-name="/usr/lib/libdrm.so.2",
// host-name="/usr/lib/libdrm.so.2",
// symbols-loaded="0"
} else if (asyncClass == "library-unloaded") {
// Archer has 'id="/usr/lib/libdrm.so.2",
// target-name="/usr/lib/libdrm.so.2",
// host-name="/usr/lib/libdrm.so.2"
} else if (asyncClass == "thread-group-created") {
// Archer has "{id="28902"}"
} else if (asyncClass == "thread-created") {
......
......@@ -80,25 +80,45 @@ private slots:
void mi11() { testMi(test11); }
void mi12() { testMi(test12); }
void runQtc();
public slots:
void readStandardOutput();
void readStandardError();
private:
QProcess m_proc; // the Qt Creaor process
};
void tst_Debugger::readStandardOutput()
{
qDebug() << "qtcreator-out: " << m_proc.readAllStandardOutput();
}
void tst_Debugger::readStandardError()
{
qDebug() << "qtcreator-err: " << m_proc.readAllStandardError();
}
void tst_Debugger::runQtc()
{
QString test = QFileInfo(qApp->arguments().at(0)).absoluteFilePath();
QString qtc = QFileInfo(test).absolutePath() + "/../../../bin/qtcreator.bin";
qtc = QFileInfo(qtc).absoluteFilePath();
QProcess proc;
QStringList env = QProcess::systemEnvironment();
env.append("QTC_DEBUGGER_TEST=" + test);
proc.setEnvironment(env);
qDebug() << "APP: " << test << qtc;
foreach (QString item, env)
qDebug() << item;
proc.start(qtc);
proc.waitForStarted();
QCOMPARE(proc.state(), QProcess::Running);
proc.waitForFinished();
QCOMPARE(proc.state(), QProcess::NotRunning);
m_proc.setEnvironment(env);
//qDebug() << "APP: " << test << qtc;
//foreach (QString item, env)
// qDebug() << item;
connect(&m_proc, SIGNAL(readyReadStandardOutput()),
this, SLOT(readStandardOutput()));
connect(&m_proc, SIGNAL(readyReadStandardError()),
this, SLOT(readStandardError()));
m_proc.start(qtc);
m_proc.waitForStarted();
QCOMPARE(m_proc.state(), QProcess::Running);
m_proc.waitForFinished();
QCOMPARE(m_proc.state(), QProcess::NotRunning);
}
void runDebuggee()
......
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