ProjectExplorer: Allow partial remote ABI detection

The "Mac static library" case from 2011 (c9f7d779a6) is still
local-only.

Change-Id: I5b437722bc1946458f54f3bdaf3e087f9264842a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-04-29 13:03:00 +02:00
parent 76675d9384
commit 5470d5d8d7

View File

@@ -1157,20 +1157,19 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path)
if (path.isEmpty())
return tmp;
QFile f(path.toString());
if (!f.exists())
return tmp;
if (!f.open(QFile::ReadOnly))
return tmp;
QByteArray data = f.read(1024);
QByteArray data = path.fileContents(1024);
if (data.size() >= 67
&& getUint8(data, 0) == '!' && getUint8(data, 1) == '<' && getUint8(data, 2) == 'a'
&& getUint8(data, 3) == 'r' && getUint8(data, 4) == 'c' && getUint8(data, 5) == 'h'
&& getUint8(data, 6) == '>' && getUint8(data, 7) == 0x0a) {
// We got an ar file: possibly a static lib for ELF, PE or Mach-O
// FIXME: Implement remote
QTC_ASSERT(!path.needsDevice(), return tmp);
QFile f(path.toString());
if (!f.open(QFile::ReadOnly))
return tmp;
data = data.mid(8); // Cut of ar file magic
quint64 offset = 8;
@@ -1203,7 +1202,6 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path)
} else {
tmp = abiOf(data);
}
f.close();
// Remove duplicates:
Abis result;