From patchwork Tue Jan 9 12:01:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rudo X-Patchwork-Id: 25293 Received: (qmail 63152 invoked by alias); 9 Jan 2018 12:02:16 -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 63097 invoked by uid 89); 9 Jan 2018 12:02:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=belonging, 4978, ctype.h, ctypeh 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:14 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w09BxYHf140330 for ; Tue, 9 Jan 2018 07:02:12 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fcuy54ng4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 09 Jan 2018 07:02:09 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 9 Jan 2018 12:02:03 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 9 Jan 2018 12:02:00 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w09C1x4G32768124; Tue, 9 Jan 2018 12:01:59 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F0ECAE064; Tue, 9 Jan 2018 11:54:00 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55540AE051; Tue, 9 Jan 2018 11:54:00 +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:54:00 +0000 (GMT) From: Philipp Rudo To: gdb-patches@sourceware.org Cc: Andreas Arnez , Ulrich Weigand , Yao Qi Subject: [PATCH v4 11/11] s390: Clean up s390-linux-tdep.c Date: Tue, 9 Jan 2018 13:01:44 +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-0016-0000-0000-000005159AC4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18010912-0017-0000-0000-00002851F45F Message-Id: <20180109120144.93854-12-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 After moving big parts of the code to the new s390-tdep.c file s390-linux-tdep.c now contains many includes it doesn't need anymore. Furthermore, there are some functions lacking a description. Fix both and order the remaining includes alphabetically. gdb/ChangeLog * s390-linux-tdep.c: Remove unneeded includes and order them alphabetically. Add comments to functions without description. --- gdb/s390-linux-tdep.c | 76 +++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 687fd2fdad..9d1351946e 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -21,46 +21,27 @@ along with this program. If not, see . */ #include "defs.h" -#include "arch-utils.h" -#include "frame.h" -#include "inferior.h" -#include "infrun.h" -#include "symtab.h" -#include "target.h" + +#include "auxv.h" +#include "elf/common.h" +#include "frame-base.h" +#include "frame-unwind.h" +#include "gdbarch.h" #include "gdbcore.h" -#include "gdbcmd.h" +#include "linux-record.h" +#include "linux-tdep.h" #include "objfiles.h" #include "osabi.h" #include "regcache.h" -#include "trad-frame.h" -#include "frame-base.h" -#include "frame-unwind.h" -#include "dwarf2-frame.h" -#include "reggroups.h" +#include "record-full.h" #include "regset.h" -#include "value.h" -#include "dis-asm.h" -#include "solib-svr4.h" -#include "prologue-value.h" -#include "linux-tdep.h" #include "s390-tdep.h" #include "s390-linux-tdep.h" -#include "linux-record.h" -#include "record-full.h" -#include "auxv.h" +#include "solib-svr4.h" +#include "target.h" +#include "trad-frame.h" #include "xml-syscall.h" -#include "stap-probe.h" -#include "ax.h" -#include "ax-gdb.h" -#include "user-regs.h" -#include "cli/cli-utils.h" -#include -#include "elf/common.h" -#include "elf/s390.h" -#include "elf-bfd.h" -#include - #include "features/s390-linux32.c" #include "features/s390-linux32v1.c" #include "features/s390-linux32v2.c" @@ -82,6 +63,11 @@ #define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml" #define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml" + +/* Register handling. */ + +/* Implement cannot_store_register gdbarch method. */ + static int s390_cannot_store_register (struct gdbarch *gdbarch, int regnum) { @@ -89,6 +75,8 @@ s390_cannot_store_register (struct gdbarch *gdbarch, int regnum) return regnum == S390_LAST_BREAK_REGNUM; } +/* Implement write_pc gdbarch method. */ + static void s390_write_pc (struct regcache *regcache, CORE_ADDR pc) { @@ -193,7 +181,6 @@ static const struct regcache_map_entry s390_regmap_gsbc[] = { 0 } }; - /* Supply the TDB regset. Like regcache_supply_regset, but invalidate the TDB registers unless the TDB format field is valid. */ @@ -341,6 +328,8 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch, } } +/* Implement core_read_description gdbarch method. */ + static const struct target_desc * s390_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) @@ -388,6 +377,8 @@ s390_core_read_description (struct gdbarch *gdbarch, } } +/* Frame unwinding. */ + /* Signal trampoline stack frames. */ struct s390_sigtramp_unwind_cache { @@ -395,6 +386,9 @@ struct s390_sigtramp_unwind_cache { struct trad_frame_saved_reg *saved_regs; }; +/* Unwind THIS_FRAME and return the corresponding unwind cache for + s390_sigtramp_frame_unwind. */ + static struct s390_sigtramp_unwind_cache * s390_sigtramp_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) @@ -503,6 +497,8 @@ s390_sigtramp_frame_unwind_cache (struct frame_info *this_frame, return info; } +/* Implement this_id frame_unwind method for s390_sigtramp_frame_unwind. */ + static void s390_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, @@ -513,6 +509,8 @@ s390_sigtramp_frame_this_id (struct frame_info *this_frame, *this_id = frame_id_build (info->frame_base, get_frame_pc (this_frame)); } +/* Implement prev_register frame_unwind method for sigtramp frames. */ + static struct value * s390_sigtramp_frame_prev_register (struct frame_info *this_frame, void **this_prologue_cache, int regnum) @@ -522,6 +520,8 @@ s390_sigtramp_frame_prev_register (struct frame_info *this_frame, return s390_trad_frame_prev_register (this_frame, info->saved_regs, regnum); } +/* Implement sniffer frame_unwind method for sigtramp frames. */ + static int s390_sigtramp_frame_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, @@ -543,6 +543,8 @@ s390_sigtramp_frame_sniffer (const struct frame_unwind *self, return 1; } +/* S390 sigtramp frame unwinder. */ + static const struct frame_unwind s390_sigtramp_frame_unwind = { SIGTRAMP_FRAME, default_frame_unwind_stop_reason, @@ -552,6 +554,8 @@ static const struct frame_unwind s390_sigtramp_frame_unwind = { s390_sigtramp_frame_sniffer }; +/* Syscall handling. */ + /* Retrieve the syscall number at a ptrace syscall-stop. Return -1 upon error. */ @@ -623,6 +627,9 @@ s390_all_but_pc_registers_record (struct regcache *regcache) return 0; } +/* Canonicalize system call SYSCALL belonging to ABI. Helper for + s390_linux_syscall_record. */ + static enum gdb_syscall s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi) { @@ -791,6 +798,9 @@ s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi) } } +/* Record a system call. Returns 0 on success, -1 otherwise. + Helper function for s390_process_record. */ + static int s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native) { @@ -839,6 +849,8 @@ s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native) return 0; } +/* Implement process_record_signal gdbarch method. */ + static int s390_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal)