From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10178 invoked by alias); 28 Nov 2011 15:39:40 -0000 Received: (qmail 9668 invoked by uid 22791); 28 Nov 2011 15:39:36 -0000 X-SWARE-Spam-Status: No, hits=4.1 required=5.0 tests=AWL,BAYES_00,BOTNET,FROM_12LTRDOM,RDNS_DYNAMIC X-Spam-Check-By: sourceware.org Received: from bl22-166-20.dsl.telepac.pt (HELO localhost6.localdomain6) (2.83.166.20) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Nov 2011 15:39:23 +0000 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pASFdKg8018000 for ; Mon, 28 Nov 2011 15:39:21 GMT Subject: [RFC/WIP PATCH 05/14] Add a small helper to get at a thread's inferior To: gdb-patches@sourceware.org From: Pedro Alves Date: Mon, 28 Nov 2011 15:39:00 -0000 Message-ID: <20111128153920.17761.5583.stgit@localhost6.localdomain6> In-Reply-To: <20111128153742.17761.21459.stgit@localhost6.localdomain6> References: <20111128153742.17761.21459.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2011-11/txt/msg00764.txt.bz2 Add a helper to get at a given thread's inferior. There are places that open code this that can just call this helper instead. --- gdb/gdbthread.h | 2 ++ gdb/thread.c | 9 +++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 97ded57..0135219 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -411,4 +411,6 @@ extern struct thread_info* inferior_thread (void); extern void update_thread_list (void); +extern struct inferior *get_thread_inferior (struct thread_info *thr); + #endif /* GDBTHREAD_H */ diff --git a/gdb/thread.c b/gdb/thread.c index 0777887..b42c8c3 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -74,6 +74,15 @@ inferior_thread (void) return tp; } +struct inferior * +get_thread_inferior (struct thread_info *thr) +{ + int pid; + + pid = ptid_get_pid (thr->ptid); + return find_inferior_pid (pid); +} + void delete_step_resume_breakpoint (struct thread_info *tp) {