From: Tom de Vries Date: Tue, 6 Jan 2026 20:05:46 +0000 (+0100) Subject: [gdbsupport] Fix get_print_cell use in threads X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8543102f51fa6edb5b2c63081378965adfc900ca;p=thirdparty%2Fbinutils-gdb.git [gdbsupport] Fix get_print_cell use in threads PR gdb/33753 reports problems with get_print_cell when used from threads. Fix this by making the two static variables in get_print_cell thread_local. Tested on x86_64-linux. Approved-By: Simon Marchi Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33753 --- diff --git a/gdbsupport/print-utils.cc b/gdbsupport/print-utils.cc index da47d1b45b5..d5a91ba0f83 100644 --- a/gdbsupport/print-utils.cc +++ b/gdbsupport/print-utils.cc @@ -28,8 +28,8 @@ char * get_print_cell (void) { - static char buf[NUMCELLS][PRINT_CELL_SIZE]; - static int cell = 0; + static thread_local char buf[NUMCELLS][PRINT_CELL_SIZE]; + static thread_local int cell = 0; if (++cell >= NUMCELLS) cell = 0;