def collect_gdbinfo():
    """Prints information to stdout about the gdb setup that Numba has found"""

    # State flags:
    gdb_state = None
    gdb_has_python = False
    gdb_has_numpy = False
    gdb_python_version = 'No Python support'
    gdb_python_numpy_version = "No NumPy support"

    # There are so many ways for gdb to not be working as expected. Surround
    # the "is it working" tests with try/except and if there's an exception
    # store it for processing later.
    try:
        # Check gdb exists
        gdb_wrapper = _GDBTestWrapper()

        # Check gdb works
        status = gdb_wrapper.check_launch()
        if not gdb_wrapper.success(status):
            msg = (f"gdb at '{gdb_wrapper.gdb_binary}' does not appear to work."
                   f"\nstdout: {status.stdout}\nstderr: {status.stderr}")
            raise ValueError(msg)
        gdb_state = gdb_wrapper.gdb_binary
    except Exception as e:
        gdb_state = f"Testing gdb binary failed. Reported Error: {e}"
    else:
        # Got this far, so gdb works, start checking what it supports
        status = gdb_wrapper.check_python()
        if gdb_wrapper.success(status):
            version_match = re.match(r'\((\d+),\s+(\d+)\)',
                                     status.stdout.strip())
            if version_match is not None:
                pymajor, pyminor = version_match.groups()
                gdb_python_version = f"{pymajor}.{pyminor}"
                gdb_has_python = True

                status = gdb_wrapper.check_numpy()
                if gdb_wrapper.success(status):
                    if "Traceback" not in status.stderr.strip():
                        if status.stdout.strip() == 'True':
                            gdb_has_numpy = True
                            gdb_python_numpy_version = "Unknown"
                            # NumPy is present find the version
                            status = gdb_wrapper.check_numpy_version()
                            if gdb_wrapper.success(status):
                                if "Traceback" not in status.stderr.strip():
                                    gdb_python_numpy_version = \
                                        status.stdout.strip()

    # Work out what level of print-extension support is present in this gdb
    if gdb_has_python:
        if gdb_has_numpy:
            print_ext_supported = "Full (Python and NumPy supported)"
        else:
            print_ext_supported = "Partial (Python only, no NumPy support)"
    else:
        print_ext_supported = "None"

    # Work out print ext location
    print_ext_file = "gdb_print_extension.py"
    print_ext_path = os.path.join(os.path.dirname(__file__), print_ext_file)

    # return!
    return _gdb_info(gdb_state, print_ext_path, gdb_python_version,
                     gdb_python_numpy_version, print_ext_supported)
Prints information to stdout about the gdb setup that Numba has found
numba/misc/numba_gdbinfo.py