From patchwork Mon Jul 20 13:33:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Junling X-Patchwork-Id: 497725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id A222A14076A for ; Mon, 20 Jul 2015 23:34:31 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6780D33A4D; Mon, 20 Jul 2015 13:34:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PnSozOyxbloC; Mon, 20 Jul 2015 13:34:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 7D89D2882A; Mon, 20 Jul 2015 13:34:25 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D41881C0FCC for ; Mon, 20 Jul 2015 13:34:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D093B8C7B4 for ; Mon, 20 Jul 2015 13:34:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hx42Z4GCYwi2 for ; Mon, 20 Jul 2015 13:34:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id 320738C564 for ; Mon, 20 Jul 2015 13:34:15 +0000 (UTC) Received: from 172.24.1.49 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.49]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BJO52486; Mon, 20 Jul 2015 21:34:10 +0800 (CST) Received: from Patch-Test.huawei (10.107.193.243) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.158.1; Mon, 20 Jul 2015 21:34:01 +0800 From: Junling Zheng To: Subject: [RFC PATCH] nptl_db/db_info: fix the incorrect initial size for dtvp Date: Mon, 20 Jul 2015 13:33:57 +0000 Message-ID: <1437399237-23720-1-git-send-email-zhengjunling@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 X-Originating-IP: [10.107.193.243] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.55ACF8D3.00E5, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 948e957d83a1c1df37a23c4d28f76b9a X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" When debugging a program on ARMv7 with thread-local storage declared using "__thread", attempting to print a thread-local variable will result in the following message: Cannot find thread-local storage for Thread (LWP ), executable file /tmp/tls: capability not available This can be traced back to uclibc libpthread/nptl_db/td_thr_tls_get_addr.c which gdb uses to look up the address of the TLS. The function returns TD_NOCAPAB due to a mismatch in size between the DTV pointer and the size recorded in the db description. The problem lies in libpthread/nptl_db/db_info.c which initializes the db with the sizeof the union dtv. Instead it should be the sizeof a pointer to union dtv. Fixed the initial size for dtvp to sizeof a pointer, instead of sizeof the union. Refer to: http://sourceware.org/ml/libc-alpha/2006-10/msg00088.html https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=416b630981788c1f08e746e19765aa0e5c2a1360 Signed-off-by: Junling Zheng --- libpthread/nptl_db/db_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpthread/nptl_db/db_info.c b/libpthread/nptl_db/db_info.c index a57a053..159a027 100644 --- a/libpthread/nptl_db/db_info.c +++ b/libpthread/nptl_db/db_info.c @@ -60,7 +60,7 @@ extern bool __nptl_initial_report_events; i.e. at the very end of the area covered by TLS_PRE_TCB_SIZE. */ DESC (_thread_db_pthread_dtvp, TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv) - - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv) + - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv *) #endif