From patchwork Fri Dec 8 11:04:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rudo X-Patchwork-Id: 24820 Received: (qmail 8552 invoked by alias); 8 Dec 2017 11:04:58 -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 8506 invoked by uid 89); 8 Dec 2017 11:04:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=supervisor 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; Fri, 08 Dec 2017 11:04:57 +0000 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vB8B4obe072032 for ; Fri, 8 Dec 2017 06:04:55 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2eqn91vnus-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 08 Dec 2017 06:04:53 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 Dec 2017 11:04:50 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 8 Dec 2017 11:04:47 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vB8B4lxW44498952; Fri, 8 Dec 2017 11:04:47 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEA6711C05B; Fri, 8 Dec 2017 10:59:11 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A017611C04A; Fri, 8 Dec 2017 10:59:11 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 8 Dec 2017 10:59:11 +0000 (GMT) From: Philipp Rudo To: gdb-patches@sourceware.org Cc: Andreas Arnez , Ulrich Weigand , Yao Qi Subject: [PATCH v3 08/10] s390: gdbarch_tdep add hook for syscall record Date: Fri, 8 Dec 2017 12:04:34 +0100 In-Reply-To: <20171208110436.30199-1-prudo@linux.vnet.ibm.com> References: <20171208110436.30199-1-prudo@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17120811-0040-0000-0000-00000417CE04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17120811-0041-0000-0000-000020BAD085 Message-Id: <20171208110436.30199-9-prudo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-08_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712080160 X-IsSubscribed: yes Most parts of s390_process_record are common for the architecture. Only the systemcall handling differs between the OSes. In order to be able to move s390_process_record to a common code file add a hook to record syscalls to gdbarch_tdep. So every OS can implement their own handling. gdb/ChangeLog: * s390-linux-tdep.c (gdbarch_tdep.s390_syscall_record): New hook. (s390_process_record, s390_gdbarch_tdep_alloc) (s390_linux_init_abi_any): Use/Set new hook. --- gdb/s390-linux-tdep.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index b8c4e7e43f..dd085762d3 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -122,6 +122,9 @@ struct gdbarch_tdep bool have_tdb; bool have_vx; bool have_gs; + + /* Hook to record OS specific systemcall. */ + int (*s390_syscall_record) (struct regcache *regcache, LONGEST svc_number); }; @@ -3809,6 +3812,7 @@ static int s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr) { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); uint16_t insn[3] = {0}; /* Instruction as bytes. */ uint8_t ibyte[6]; @@ -3965,8 +3969,16 @@ ex: case 0x0a: /* SVC - supervisor call */ - if (s390_linux_syscall_record (regcache, ibyte[1])) - return -1; + if (tdep->s390_syscall_record != NULL) + { + if (tdep->s390_syscall_record (regcache, ibyte[1])) + return -1; + } + else + { + printf_unfiltered (_("no syscall record support\n")); + return -1; + } break; case 0x0b: /* BSM - branch and set mode */ @@ -7998,6 +8010,8 @@ s390_gdbarch_tdep_alloc () tdep->have_vx = false; tdep->have_gs = false; + tdep->s390_syscall_record = NULL; + return tdep; } @@ -8196,6 +8210,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) static void s390_linux_init_abi_any (struct gdbarch_info info, struct gdbarch *gdbarch) { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + tdep->s390_syscall_record = s390_linux_syscall_record; + linux_init_abi (info, gdbarch); /* Register handling. */