From patchwork Mon Jun 12 17:08:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rudo X-Patchwork-Id: 20966 Received: (qmail 65254 invoked by alias); 12 Jun 2017 17:08:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 65176 invoked by uid 89); 12 Jun 2017 17:08:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=1019 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Jun 2017 17:08:51 +0000 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v5CH8i0R046019 for ; Mon, 12 Jun 2017 13:08:54 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2b1xph12t8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 12 Jun 2017 13:08:53 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 12 Jun 2017 18:08:52 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 12 Jun 2017 18:08:48 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v5CH8l6t39780408; Mon, 12 Jun 2017 17:08:47 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA0BE4C044; Mon, 12 Jun 2017 18:07:02 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C7844C04A; Mon, 12 Jun 2017 18:07:02 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 12 Jun 2017 18:07:02 +0100 (BST) From: Philipp Rudo To: gdb-patches@sourceware.org Cc: omair.javaid@linaro.org, yao.qi@linaro.org, peter.griffin@linaro.org, arnez@linux.vnet.ibm.com Subject: [RFC v4 8/9] Link frame_info to thread_info Date: Mon, 12 Jun 2017 19:08:35 +0200 In-Reply-To: <20170612170836.25174-1-prudo@linux.vnet.ibm.com> References: <20170612170836.25174-1-prudo@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17061217-0012-0000-0000-0000054AFD05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17061217-0013-0000-0000-000018BAD1DD Message-Id: <20170612170836.25174-9-prudo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-12_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706120298 X-IsSubscribed: yes Linux kernel stacks on S390 are spread over several memory locations. These locations differ for every kernel task/thread. Thus we need to know to which task/thread a frame belongs to check whether a stack pointer is valid and when to stop unwinding. To do so add a pointer to corresponding thread_info to frame_info. This connection already exists implicitly by the fact that switch_to_thread reinitializes the frame cache. gdb/ChangeLog: * frame.h (frame_get_thread): New extern declaration. * frame.c (frame_info) : New field. (frame_get_thread): New function. (create_sentinel_frame, create_new_frame, get_prev_frame_raw): Set new field. --- gdb/frame.c | 12 ++++++++++++ gdb/frame.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/gdb/frame.c b/gdb/frame.c index 30e4aeab7e..5a2fdda783 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -101,6 +101,9 @@ struct frame_info /* The frame's address space. */ struct address_space *aspace; + /* The thread this frame belongs to. */ + struct thread_info *thread; + /* The frame's low-level unwinder and corresponding cache. The low-level unwinder is responsible for unwinding register values for the previous frame. The low-level unwind methods are @@ -157,6 +160,12 @@ struct frame_info const char *stop_string; }; +struct thread_info * +frame_get_thread (struct frame_info *frame) +{ + return frame->thread; +} + /* A frame stash used to speed up frame lookups. Create a hash table to stash frames previously accessed from the frame cache for quicker subsequent retrieval. The hash table is emptied whenever @@ -1527,6 +1536,7 @@ create_sentinel_frame (struct program_space *pspace, struct regcache *regcache) frame->level = -1; frame->pspace = pspace; frame->aspace = get_regcache_aspace (regcache); + frame->thread = inferior_thread (); /* Explicitly initialize the sentinel frame's cache. Provide it with the underlying regcache. In the future additional information, such as the frame's thread will be added. */ @@ -1768,6 +1778,7 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) /* We currently assume that frame chain's can't cross spaces. */ fi->pspace = fi->next->pspace; fi->aspace = fi->next->aspace; + fi->thread = fi->next->thread; /* Select/initialize both the unwind function and the frame's type based on the PC. */ @@ -2179,6 +2190,7 @@ get_prev_frame_raw (struct frame_info *this_frame) spaces. */ prev_frame->pspace = this_frame->pspace; prev_frame->aspace = this_frame->aspace; + prev_frame->thread = this_frame->thread; /* Don't yet compute ->unwind (and hence ->type). It is computed on-demand in get_frame_type, frame_register_unwind, and diff --git a/gdb/frame.h b/gdb/frame.h index 56cbd4400b..26079e8215 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -103,6 +103,8 @@ enum frame_id_stack_status struct frame_info; +extern struct thread_info *frame_get_thread (struct frame_info *frame); + /* The frame object's ID. This provides a per-frame unique identifier that can be used to relocate a `struct frame_info' after a target resume or a frame cache destruct. It of course assumes that the