From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id D64EE385703F for ; Wed, 26 Aug 2020 14:49:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D64EE385703F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x32f.google.com with SMTP id t14so2062471wmi.3 for ; Wed, 26 Aug 2020 07:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dMikCpSXfkisFYG1VSGtvXcLFGrU7XwjPDAx4wLTsyk=; b=QJoa0YgQkjr7Q6/3dekSx6t2ePPvZWjFMYm7mOYoHDkk1GywWX8yahajSK+6PKmTlt rWL/pOkfL6xC48zS070BmHnAOqfzfsBQiptLcfmYodOzfu/krPqRBbDaT/fgM7c9v41i +ySzGyqQyZX/GdWUT46NQdvOyH+3wIKELtbSGTz91y3bZSYdbjMDljmRjdKF/q6cukRl ebMYVGBtFYGW+rsZu2fCBVX4Luicbf5ZWFNStH+AAxBjJWj1I6OpGRbUo1DNZGMEdFov wibpvOJXca6QLrt3De4STW5y5m2OHOJUVAKrK5KFMvwMlkassyueinxNoj7nRI8TwWd4 Ceig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dMikCpSXfkisFYG1VSGtvXcLFGrU7XwjPDAx4wLTsyk=; b=rzeU3fQKth0RwBTyucLn/p/6v3Ie6JC7Ej96pbmKEMUarpXQS+n6cPDo7WlogqId/W SjKzmVMYPGfesQxCJJ0JOBda/ck0CRUABuJtRBUVo3u5nM2Guql59Wbw6QNw3d82IMdK 15DD1VGyWBERJLm8+j3u8dTvux0Y6QeCF6q2hJCFWh+cBlghMElZvl5WO3EhJssEu4nc n8FfzIE54Q4GJoIjpdtNfEBSBrxikDjyot3YhuWTkxRVtYdBGy05cRqdP3JUtULAFTUq f7loM34m5x6pssJo2b/JdNUV0ksmw7wK0EAJ/ffzQGaz0z/dYA/UajR4DeSsTBbPQtE7 mUlg== X-Gm-Message-State: AOAM530w787NdJUN2eEHSyitS4EwGOyOazZxhElyiQ+QABl/j9xX+Ge1 d8v2jEUCJuTKY32/rnrV9a+1wpBVDGBBYw== X-Google-Smtp-Source: ABdhPJwJ0xcraAqdS+w1SsMArWyNLLvoRQpGJGmDC/gkEfxbLOP+YzIVQ8r7KiA/tmKvnJi+UvbLow== X-Received: by 2002:a05:600c:214e:: with SMTP id v14mr7649699wml.118.1598453376333; Wed, 26 Aug 2020 07:49:36 -0700 (PDT) Received: from localhost (host109-148-134-218.range109-148.btcentralplus.com. [109.148.134.218]) by smtp.gmail.com with ESMTPSA id o125sm6726137wma.27.2020.08.26.07.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 07:49:35 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCHv2 04/10] gdb: additional changes to make use of type_instance_flags more Date: Wed, 26 Aug 2020 15:49:11 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 14:49:39 -0000 Further updates to make use of type_instance_flags. gdb/ChangeLog: * avr-tdep.c (avr_address_class_type_flags): Update return type. (avr_address_class_type_flags_to_name): Update argument types. (avr_address_class_name_to_type_flags): Update return type and argument types. * ft32-tdep.c (ft32_address_class_type_flags): Update return type. (ft32_address_class_type_flags_to_name): Update argument types. (ft32_address_class_name_to_type_flags): Update return type and argument types. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (address_class_type_flags_to_name): Update argument types. * s390-tdep.c (s390_address_class_type_flags): Update return type. (s390_address_class_type_flags_to_name): Update argument types. (s390_address_class_name_to_type_flags): Update return type and argument types. --- gdb/ChangeLog | 19 +++++++++++++++++++ gdb/avr-tdep.c | 13 +++++++------ gdb/ft32-tdep.c | 13 +++++++------ gdb/gdbarch.c | 2 +- gdb/gdbarch.h | 4 ++-- gdb/gdbarch.sh | 2 +- gdb/s390-tdep.c | 13 +++++++------ 7 files changed, 44 insertions(+), 22 deletions(-) diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 74ab531711e..0148f4e4db2 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1372,7 +1372,7 @@ avr_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) This method maps DW_AT_address_class attributes to a type_instance_flag_value. */ -static int +static type_instance_flags avr_address_class_type_flags (int byte_size, int dwarf2_addr_class) { /* The value 1 of the DW_AT_address_class attribute corresponds to the @@ -1389,7 +1389,8 @@ avr_address_class_type_flags (int byte_size, int dwarf2_addr_class) Convert a type_instance_flag_value to an address space qualifier. */ static const char* -avr_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) +avr_address_class_type_flags_to_name (struct gdbarch *gdbarch, + type_instance_flags type_flags) { if (type_flags & AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH) return "flash"; @@ -1401,18 +1402,18 @@ avr_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) Convert an address space qualifier to a type_instance_flag_value. */ -static int +static bool avr_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char* name, - int *type_flags_ptr) + type_instance_flags *type_flags_ptr) { if (strcmp (name, "flash") == 0) { *type_flags_ptr = AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH; - return 1; + return true; } else - return 0; + return false; } /* Initialize the gdbarch structure for the AVR's. */ diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index 99ef69de770..8ce16c06505 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -341,7 +341,7 @@ ft32_pointer_to_address (struct gdbarch *gdbarch, This method maps DW_AT_address_class attributes to a type_instance_flag_value. */ -static int +static type_instance_flags ft32_address_class_type_flags (int byte_size, int dwarf2_addr_class) { /* The value 1 of the DW_AT_address_class attribute corresponds to the @@ -357,7 +357,8 @@ ft32_address_class_type_flags (int byte_size, int dwarf2_addr_class) Convert a type_instance_flag_value to an address space qualifier. */ static const char* -ft32_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) +ft32_address_class_type_flags_to_name (struct gdbarch *gdbarch, + type_instance_flags type_flags) { if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) return "flash"; @@ -369,18 +370,18 @@ ft32_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) Convert an address space qualifier to a type_instance_flag_value. */ -static int +static bool ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char* name, - int *type_flags_ptr) + type_instance_flags *type_flags_ptr) { if (strcmp (name, "flash") == 0) { *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; - return 1; + return true; } else - return 0; + return false; } /* Given a return value in `regbuf' with a type `valtype', diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 2be959ecfc9..a3a67020078 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -3526,7 +3526,7 @@ gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch) } const char * -gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) +gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, type_instance_flags type_flags) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->address_class_type_flags_to_name != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 8a4a384fda9..5ac4f5495c4 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -854,8 +854,8 @@ extern void set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch, gdbar extern int gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch); -typedef const char * (gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch, int type_flags); -extern const char * gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags); +typedef const char * (gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch, type_instance_flags type_flags); +extern const char * gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, type_instance_flags type_flags); extern void set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name); /* Execute vendor-specific DWARF Call Frame Instruction. OP is the instruction. diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 7e9204119bd..a64afb5a3d2 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -690,7 +690,7 @@ v;int;cannot_step_breakpoint;;;0;0;;0 # non-steppable watchpoints. v;int;have_nonsteppable_watchpoint;;;0;0;;0 F;type_instance_flags;address_class_type_flags;int byte_size, int dwarf2_addr_class;byte_size, dwarf2_addr_class -M;const char *;address_class_type_flags_to_name;int type_flags;type_flags +M;const char *;address_class_type_flags_to_name;type_instance_flags type_flags;type_flags # Execute vendor-specific DWARF Call Frame Instruction. OP is the instruction. # FS are passed from the generic execute_cfa_program function. m;bool;execute_dwarf_cfa_vendor_op;gdb_byte op, struct dwarf2_frame_state *fs;op, fs;;default_execute_dwarf_cfa_vendor_op;;0 diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 65cb23705d2..49a507f7c2d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1583,7 +1583,7 @@ s390_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) /* Implement addr_class_type_flags gdbarch method. Only used for ABI_LINUX_ZSERIES. */ -static int +static type_instance_flags s390_address_class_type_flags (int byte_size, int dwarf2_addr_class) { if (byte_size == 4) @@ -1596,7 +1596,8 @@ s390_address_class_type_flags (int byte_size, int dwarf2_addr_class) Only used for ABI_LINUX_ZSERIES. */ static const char * -s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) +s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, + type_instance_flags type_flags) { if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) return "mode32"; @@ -1607,18 +1608,18 @@ s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) /* Implement addr_class_name_to_type_flags gdbarch method. Only used for ABI_LINUX_ZSERIES. */ -static int +static bool s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, - int *type_flags_ptr) + type_instance_flags *type_flags_ptr) { if (strcmp (name, "mode32") == 0) { *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; - return 1; + return true; } else - return 0; + return false; } /* Inferior function calls. */ -- 2.25.4