From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71106 invoked by alias); 13 Feb 2018 07:55:23 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 71092 invoked by uid 89); 13 Feb 2018 07:55:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=thr, H*M:0305 X-HELO: hqemgate16.nvidia.com Received: from hqemgate16.nvidia.com (HELO hqemgate16.nvidia.com) (216.228.121.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Feb 2018 07:55:21 +0000 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Mon, 12 Feb 2018 23:55:27 -0800 Received: from HQMAIL103.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 12 Feb 2018 23:55:19 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 12 Feb 2018 23:55:19 -0800 Received: from UKMAIL102.nvidia.com (10.26.138.15) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 13 Feb 2018 07:55:18 +0000 Received: from localhost.localdomain (10.21.38.99) by UKMAIL102.nvidia.com (10.26.138.15) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 13 Feb 2018 07:55:14 +0000 Subject: Re: Printing thread_local a.k.a. __thread variables To: Yao Qi CC: GDB Development References: <780169f5-fa63-3357-ed78-a3045991c307@nvidia.com> From: Dmitry Antipov Message-ID: <469e1280-3581-0305-6c9a-2693a765ab7a@nvidia.com> Date: Tue, 13 Feb 2018 07:55:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL102.nvidia.com (10.26.138.15) X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00089.txt.bz2 On 02/12/2018 05:54 PM, Yao Qi wrote: > ... is it broken in every threads in "thread apply all" or just in some > threads? Can you reproduce it every time or it is intermittent? > If you manually switch threads via command "thread N", can > you examine 'tlocal'? It seems that 'qGetTLSAddr' fails every time for any thread in question: (gdb) info threads Id Target Id Frame * 1 Thread 19378.19378 "t-thread" 0x00007f62ae10b89d in pthread_join () from target:/lib64/libpthread.so.0 2 Thread 19378.19379 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 3 Thread 19378.19380 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 4 Thread 19378.19381 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 5 Thread 19378.19382 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 6 Thread 19378.19383 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 7 Thread 19378.19384 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 8 Thread 19378.19385 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 9 Thread 19378.19386 "worker" 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 (gdb) print tlocal Cannot find thread-local storage for Thread 19378.19378, executable file target:/home/dantipov/tmp/t-thread: Remote target failed to process qGetTLSAddr request (gdb) thread 2 [Switching to thread 2 (Thread 19378.19379)] #0 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 (gdb) print tlocal Cannot find thread-local storage for Thread 19378.19379, executable file target:/home/dantipov/tmp/t-thread: Remote target failed to process qGetTLSAddr request (gdb) thread 3 [Switching to thread 3 (Thread 19378.19380)] #0 0x00007f62ae11499d in nanosleep () from target:/lib64/libpthread.so.0 (gdb) print tlocal Cannot find thread-local storage for Thread 19378.19380, executable file target:/home/dantipov/tmp/t-thread: Remote target failed to process qGetTLSAddr request gdbserver output is: ... getpkt ("qGetTLSAddr:p4bb2.4bb2,0,7f62aedff330"); [no ack sent] putpkt ("$E01#a6"); [noack mode] ... getpkt ("qGetTLSAddr:p4bb2.4bb3,0,7f62aedff330"); [no ack sent] putpkt ("$E01#a6"); [noack mode] ... getpkt ("qGetTLSAddr:p4bb2.4bb4,0,7f62aedff330"); [no ack sent] putpkt ("$E01#a6"); [noack mode] ... As for the local debugging, the same GDB binary on the same system works as expected: (gdb) i thr Id Target Id Frame * 1 Thread 0x7f62aedd2740 (LWP 19378) "t-thread" 0x00007f62ae10b89d in pthread_join () from /lib64/libpthread.so.0 2 Thread 0x7f62add2d700 (LWP 19379) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 3 Thread 0x7f62ad52c700 (LWP 19380) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 4 Thread 0x7f62acd2b700 (LWP 19381) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 5 Thread 0x7f62ac52a700 (LWP 19382) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 6 Thread 0x7f62abd29700 (LWP 19383) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 7 Thread 0x7f62ab528700 (LWP 19384) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 8 Thread 0x7f62aad27700 (LWP 19385) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 9 Thread 0x7f62aa526700 (LWP 19386) "worker" 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 (gdb) print tlocal $1 = 100 (gdb) thread 2 [Switching to thread 2 (Thread 0x7f62add2d700 (LWP 19379))] #0 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 (gdb) print tlocal $2 = 653 (gdb) thread 3 [Switching to thread 3 (Thread 0x7f62ad52c700 (LWP 19380))] #0 0x00007f62ae11499d in nanosleep () from /lib64/libpthread.so.0 (gdb) print tlocal $3 = 1220 Dmitry