determine gdb target ABI by parsing 'gdb --configuration'

Currently, the gdb target ABI is determined by running
`gdb -version`, which for recent gdb's does not reproduce
the target ABI string -- yet this string is searched in
the output.  This obviously fails, and qtcreator uses a
fallback behavior, that is not suitable when using gdb
for debugging on targets (like avr microcontrollers).
With this change, QtCreator calls `gdb --configuration`
if that is supported by gdb and extracts `<string> from
`--target=<string>` in the output.

For older versions of gdb (which do not support the
`--configuration` flag, but still have the target
information in the output of `--version`, the output of
`--version` is parsed.

If both methods fail, no ABI is set for gdb.

Change-Id: Ib406f6700b63e2cedb46bd4ec8cc0d215677ecdc
Reviewed-by: Michael Kopp <kopp.michael@yahoo.de>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Michael Kopp
2018-11-20 22:31:27 +01:00
parent be4bd1dc06
commit 7e45ccc99b
3 changed files with 63 additions and 16 deletions

View File

@@ -958,6 +958,7 @@ Abi Abi::hostAbi()
return result;
}
//! Extract available ABIs from a binary using heuristics.
QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
{
QList<Abi> tmp;