forked from qt-creator/qt-creator
GDB: Set OsAbi also when the executable is ELF and the toolchain is not
If the toolchain is misconfigured, it's still possible to save GDB from crashing by reading the binary format from the executable. Change-Id: I8f8db163e1dd6aef31fed23b1306e714e563646a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
25f5710df2
commit
a33bf92bd2
@@ -1879,7 +1879,17 @@ 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)
|
||||
if (!HostOsInfo::isWindowsHost())
|
||||
return;
|
||||
const DebuggerRunParameters &rp = runParameters();
|
||||
bool isElf = (rp.toolChainAbi.binaryFormat() == Abi::ElfFormat);
|
||||
if (!isElf && !rp.inferior.executable.isEmpty()) {
|
||||
isElf = Utils::anyOf(Abi::abisOfBinary(FileName::fromString(rp.inferior.executable)),
|
||||
[](const Abi &abi) {
|
||||
return abi.binaryFormat() == Abi::ElfFormat;
|
||||
});
|
||||
}
|
||||
if (isElf)
|
||||
runCommand({"set osabi GNU/Linux"});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user