From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98968 invoked by alias); 28 Mar 2017 08:24:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 98922 invoked by uid 89); 28 Mar 2017 08:24:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=HERE X-HELO: mail-wr0-f193.google.com Received: from mail-wr0-f193.google.com (HELO mail-wr0-f193.google.com) (209.85.128.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Mar 2017 08:24:46 +0000 Received: by mail-wr0-f193.google.com with SMTP id p52so17338064wrc.2 for ; Tue, 28 Mar 2017 01:24:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=AsLyjdpdtIBtA6TUlusZokjhKiqsUGLXtvloZjGTVg8=; b=e1v3Snu02MNUAOZtjQAAa3iUP8Jp3e7qIzqICXdwCi9Hm2wEECBowxwK6hboVvYWoW 6nbh0rEGmAMys2e7ljOB/Ckh2cBRLl4BSQNrVewKD2MwkHVeiMPddIlO/o36PQ8YJXma dKWx5ji58sGRJgVj+C51PlBs3dS0FuyHwWJCN+7+iWpZ7rRM855edhD4ZC7X2A8UivsC UyU0ueUWOAS5ezluOFc45UrxN3Mpkl34PAsuazE72uSfrkYQOwXB+CuHDEYofXXy3p8M Lx8Wlzl7QCC0ZioN/OHsH92ugqkhf8fzYm2divjsDvwHLPNiR8ee1iKR7UchFKSgV3Gf WuzQ== X-Gm-Message-State: AFeK/H2WkFo0ErBEYpGgTYtNtQQaNdcPaUyF4xROJP1QfeWl35nQNtWnCHVao1a8SGY/Sw== X-Received: by 10.223.160.183 with SMTP id m52mr7200397wrm.201.1490689485487; Tue, 28 Mar 2017 01:24:45 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id o52sm3835188wrb.51.2017.03.28.01.24.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Mar 2017 01:24:45 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 0/2] Fix thread_info refcount Date: Tue, 28 Mar 2017 08:24:00 -0000 Message-Id: <1490689483-16084-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00474.txt.bz2 This patch set fixes PR gdb/19942 and hopefully fixes a GDB internal error reported https://sourceware.org/ml/gdb/2017-03/msg00054.html The fix in general is that we should free/delete thread_info when its refcount is zero. free_thread is a static function, which is not visible out side of thread.c, so have to make it external. That is what I did in the patch fixing this problem for 7.12 branch (https://sourceware.org/ml/gdb/2017-03/msg00062.html) However, we can add constructor and destructor to thread_info, and use delete instead of free_thread. That is why patch 1 add constructor and destructor to thread_info. Also, this change paves the way of using std::shared_ptr, so that "refcount" can be moved. They are tested on x86_64-linux. *** BLURB HERE *** Yao Qi (2): Add constructor and destructor to thread_info Delete thread_info is refcount is zero gdb/gdbthread.h | 48 ++++++++++++++++-------------- gdb/infrun.c | 7 ++++- gdb/thread.c | 90 ++++++++++++++++++++++++++++++++++----------------------- 3 files changed, 86 insertions(+), 59 deletions(-) -- 1.9.1