In an ideal world everyone would just install `gdb-multiarch` and be
happy. However, some MCUs need magic GDB versions sprinkled with
unicorn-stardust-Espressif-patches...
Since there is little reason to have `$(target)-gdb` installed in
addition to `gdb-multiarch` if `gdb-multiarch` would work fine, let's
assume the user wants to use `$(target)-gdb` when present over
`gdb-multiarch`.
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Redirecting `2>&1 >/dev/null` moves stderr to stdout first and then
stdout to /dev/null; when checking for command existence or otherwise
silencing output, this is usually not desired (but only starts producing
errors when the actual command fails, which is often not tested).
Modern versions of GDB support multiple targets with the same gdb binary.
At least Ubuntu and Debian have dropped the gdb-arm-none-eabi package in favour
of gdb-multiarch.
Here, no $(PREFIX)-gdb binary is availiable, instead gdb-multiarch should be used.
This patch tries to automatically detect the presense of gdb-multiarch and uses it
instead of arm-none-eabi-gdb.