From patchwork Tue Jan 9 12:01:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rudo X-Patchwork-Id: 25291 Received: (qmail 61715 invoked by alias); 9 Jan 2018 12:02:04 -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 61614 invoked by uid 89); 9 Jan 2018 12:02:04 -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; Tue, 09 Jan 2018 12:02:02 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w09Bxgw0059546 for ; Tue, 9 Jan 2018 07:02:01 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fcvq4hwvv-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 09 Jan 2018 07:02:00 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 9 Jan 2018 12:01:58 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 9 Jan 2018 12:01:55 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w09C1t1U31326420; Tue, 9 Jan 2018 12:01:55 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2ACB0AE05F; Tue, 9 Jan 2018 11:53:56 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0929AAE057; Tue, 9 Jan 2018 11:53:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 9 Jan 2018 11:53:55 +0000 (GMT) From: Philipp Rudo To: gdb-patches@sourceware.org Cc: Andreas Arnez , Ulrich Weigand , Yao Qi Subject: [PATCH v4 08/11] s390: gdbarch_tdep add hook for syscall record Date: Tue, 9 Jan 2018 13:01:41 +0100 In-Reply-To: <20180109120144.93854-1-prudo@linux.vnet.ibm.com> References: <20180109120144.93854-1-prudo@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18010912-0008-0000-0000-000004BF9BDD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18010912-0009-0000-0000-00001E52EEE2 Message-Id: <20180109120144.93854-9-prudo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-09_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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801090169 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 b5837a4600..81f3e75417 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. */