Commit de9fc126 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

Debugger: Force GNU/Linux osabi when debugging elf on Windows

Coredump fails to open with multi-target gdb on Windows.

Change-Id: I66cea184a84539c9f56cc46d7eabadd7760ba649
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent feecfcbc
......@@ -204,6 +204,7 @@ void GdbCoreEngine::writeCoreChunk()
void GdbCoreEngine::setupInferior()
{
CHECK_STATE(InferiorSetupRequested);
setLinuxOsAbi();
// Do that first, otherwise no symbols are loaded.
QFileInfo fi(m_executable);
QByteArray path = fi.absoluteFilePath().toLocal8Bit();
......
......@@ -1917,6 +1917,13 @@ void GdbEngine::handleGdbExit(const DebuggerResponse &response)
}
}
void GdbEngine::setLinuxOsAbi()
{
// In case GDB has multiple supported targets, the default osabi can be Cygwin.
if (HostOsInfo::isWindowsHost() && runParameters().toolChainAbi.binaryFormat() == Abi::ElfFormat)
runCommand({"set osabi GNU/Linux"});
}
void GdbEngine::detachDebugger()
{
CHECK_STATE(InferiorStopOk);
......
......@@ -94,6 +94,7 @@ protected: ////////// Gdb Process Management //////////
void startGdb(const QStringList &args = QStringList());
void handleInferiorShutdown(const DebuggerResponse &response);
void handleGdbExit(const DebuggerResponse &response);
void setLinuxOsAbi();
void loadInitScript();
void setEnvironmentVariables();
......
......@@ -162,6 +162,7 @@ void GdbRemoteServerEngine::uploadProcFinished()
void GdbRemoteServerEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
setLinuxOsAbi();
const DebuggerRunParameters &rp = runParameters();
QString executableFileName;
if (!rp.inferior.executable.isEmpty()) {
......
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