Commit 715e7211 authored by hjk's avatar hjk
Browse files

debugger: remove one of the three failure notification if a gdb binary is

not found with the remote adapter
parent 3d78066c
......@@ -4015,8 +4015,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
gdbProc()->start(m_gdb, gdbArgs);
if (!gdbProc()->waitForStarted()) {
const QString msg = tr("Unable to start gdb '%1': %2")
.arg(m_gdb, gdbProc()->errorString());
const QString msg = errorMessage(QProcess::FailedToStart);
handleAdapterStartFailed(msg, settingsIdHint);
return false;
}
......@@ -4129,19 +4128,23 @@ bool GdbEngine::checkDebuggingHelpers()
void GdbEngine::handleGdbError(QProcess::ProcessError error)
{
showMessage(_("HANDLE GDB ERROR: ") + errorMessage(error));
const QString msg = errorMessage(error);
showMessage(_("HANDLE GDB ERROR: ") + msg);
// Show a message box for asynchroneously reported issues.
switch (error) {
case QProcess::FailedToStart:
// This should be handled by the code trying to start the process.
break;
case QProcess::Crashed:
break; // will get a processExited() as well
// impossible case QProcess::FailedToStart:
// This will get a processExited() as well.
break;
case QProcess::ReadError:
case QProcess::WriteError:
case QProcess::Timedout:
default:
//gdbProc()->kill();
//setState(EngineShutdownRequested, true);
showMessageBox(QMessageBox::Critical, tr("Gdb I/O Error"),
errorMessage(error));
showMessageBox(QMessageBox::Critical, tr("Gdb I/O Error"), msg);
break;
}
}
......
......@@ -164,6 +164,11 @@ void RemoteGdbServerAdapter::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
QString fileName;
if (!startParameters().executable.isEmpty()) {
QFileInfo fi(startParameters().executable);
fileName = fi.absoluteFilePath();
}
m_engine->postCommand("set architecture "
+ startParameters().remoteArchitecture.toLatin1());
m_engine->postCommand("set sysroot "
......@@ -177,8 +182,13 @@ void RemoteGdbServerAdapter::setupInferior()
}
m_engine->postCommand("set target-async on", CB(handleSetTargetAsync));
QFileInfo fi(startParameters().executable);
QString fileName = fi.absoluteFilePath();
if (fileName.isEmpty()) {
showMessage(tr("No symbol file given."), StatusBar);
callTargetRemote();
return;
}
m_engine->postCommand("-file-exec-and-symbols \""
+ fileName.toLocal8Bit() + '"',
CB(handleFileExecAndSymbols));
......@@ -195,22 +205,27 @@ void RemoteGdbServerAdapter::handleFileExecAndSymbols(const GdbResponse &respons
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (response.resultClass == GdbResultDone) {
//m_breakHandler->clearBreakMarkers();
// "target remote" does three things:
// (1) connects to the gdb server
// (2) starts the remote application
// (3) stops the remote application (early, e.g. in the dynamic linker)
QString channel = startParameters().remoteChannel;
m_engine->postCommand("target remote " + channel.toLatin1(),
CB(handleTargetRemote));
callTargetRemote();
} else {
QString msg = tr("Starting remote executable failed:\n");
QString msg = tr("Reading debug information failed:\n");
msg += QString::fromLocal8Bit(response.data.findChild("msg").data());
m_engine->notifyInferiorSetupFailed(msg);
}
}
void RemoteGdbServerAdapter::callTargetRemote()
{
//m_breakHandler->clearBreakMarkers();
// "target remote" does three things:
// (1) connects to the gdb server
// (2) starts the remote application
// (3) stops the remote application (early, e.g. in the dynamic linker)
QString channel = startParameters().remoteChannel;
m_engine->postCommand("target remote " + channel.toLatin1(),
CB(handleTargetRemote));
}
void RemoteGdbServerAdapter::handleTargetRemote(const GdbResponse &record)
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
......
......@@ -75,6 +75,7 @@ private:
void handleSetTargetAsync(const GdbResponse &response);
void handleFileExecAndSymbols(const GdbResponse &response);
void callTargetRemote();
void handleTargetRemote(const GdbResponse &response);
const int m_toolChainType;
......
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