GNOME Bugzilla – Bug 793514
Adding version check for gdb
Last modified: 2018-02-25 14:04:08 UTC
Turns out gdb version 6 have a hard time with debugging modern code using DWARF > 2 debug information. See bug 793494. This is a problem in particular on FreeBSD where gdb 6 is installed by default. Let's add a version check.
The current status of GDB and LLDB on FreeBSD: FreeBSD 10.x (stable) includes GDB 6 only. FreeBSD 11.1 (stable) includes GDB 6 and LLDB 4. FreeBSD 12.0 (development) includes LLDB only. I guess the reason for FreeBSD to keep an old version of GDB is license issue and KGDB support. FreeBSD doesn't like GPLv3, so projects licensed under GPLv3 are never imported into the base system. KGDB is a set of downstream FreeBSD patches which enable GDB to debug FreeBSD kernel. The license of LLDB is acceptable to FreeBSD, but there is no equivalent of KGDB in LLDB. KGDB was maintained as a part of GDB 6 distributed with FreeBSD and it is not available in upstream GDB. The latest version of GDB has been available in FreeBSD ports for a long time, but it didn't include KGDB support until late 2015. https://reviews.freebsd.org/D3727 Both GDB and LLDB are available for installation from FreeBSD ports for all supported versions of FreeBSD. GDB from FreeBSD ports installs programs with both versioned (gdb801) and unversioned (gdb) names, while LLDB from FreeBSD ports only installs programs with versioned (lldb50) names.
Ok I added version check. I am not adding fallback of another gdb deeper in $PATH as you suggested in earlier comments though. As I said earlier, I don't really want to add specific code to scan all directories in $PATH and find all installed versions of gdb. I guess if you really want to use a specific gdb, you should update the PATH to have it used in priority anyway. Anyway, at least now if GDB 6.1 is still first in line, at least it will directly go to calling LLDB, which should fix the issue too. So I am closing. If you could please test, this would be nice. And feel free to reopen if something is still not right. :-) Thanks for the report! commit 6975188d6f8fcb1e84e4e7a2632bc3ebf620ea55 Author: Jehan <jehan@girinstud.io> Date: Thu Feb 22 05:05:24 2018 +0100 Bug 793514 - Adding version check for gdb. It seems that older GDB (under version 7) are not handling very well some common debug information format, in particular DWARF > 3. Such version of GDB is usually not a problem since it is quite old (more than 10 years old, it would seem) so you don't see it anymore on any modern GNU/Linux distribution. On FreeBSD on the other hand, it is still available (probably for license reasons) and even installed by default! As a consequence, it makes debugging fail, even though LLDB is also installed by default. That is even more of a problem because it would seem that GIMP is killed (most likely by FreeBSD kernel according to the reporter tests) as a side-effect of GDB failing, which is seriously bad, in particular since we also use the debug dialog for non-fatal errors (which could therefore end up killing GIMP as side effect of a bad GDB!). So I add some GDB version check. I implement this without any dynamic memory management, as usual, since this needs to happen also during crash handling where the state is unstable and prone to memory allocation failure. I also add gimp_utils_backtrace_available() public API which can be used by the Preferences. libgimpbase/gimputils.c | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- libgimpbase/gimputils.h | 1 + 2 files changed, 182 insertions(+), 3 deletions(-)
Thanks, it works for me on FreeBSD 11.1 now. :)