[Bug build/25268] Build broken on macOS at 4da8c3a8a (Oct 13, 2019), which introduced pthread_setname_np()

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Wed Dec 11 15:04:00 GMT 2019


--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:


commit 2e744276988acd52b967d2505c42ef170147b5f9
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Dec 10 14:16:19 2019 -0700

    Fix build on macOS

    PR build/25268 points out that the build fails on macOS, because on
    macOS the "pthread_setname_np" function takes a single argument.

    This patch fixes the problem, by introducing a new adapter function
    that handles both styles of pthread_setname_np.

    This change also meant moving the pthread_setname_np call to the
    thread function, because macOS only permits setting the name of the
    current thread.  This means that there can be a brief window when gdb
    will see the wrong name; but I think this is a minor concern.

    Tested by rebuilding on x86-64 Fedora 30, and on macOS High Sierra.
    On Linux I also debugged gdb to ensure that the thread names are still
    set correctly.

    2019-12-11  Tom Tromey  <tromey@adacore.com>

        PR build/25268:
        * gdbsupport/thread-pool.c (set_thread_name): New function.
        (thread_pool::set_thread_count): Don't call pthread_setname_np.
        (thread_pool::thread_function): Call set_thread_name.

    Change-Id: Id7bf28d99ca27a893a9fc87ebb90b15a9c2a9cb4

You are receiving this mail because:
You are on the CC list for the bug.

More information about the Gdb-prs mailing list