From patchwork Tue Oct 8 17:11:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 98547 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98A363861039 for ; Tue, 8 Oct 2024 17:12:40 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 019F6385DDCA for ; Tue, 8 Oct 2024 17:11:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 019F6385DDCA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 019F6385DDCA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728407523; cv=none; b=iIH1Q78JubqMwd/ttATEU+B6HdZ8mXZrhXXwo7Xh0AGJaGrAUklHF5VUGjzJZ3PTQrnNUNjDBFLT/7lo27d/g1hQTj+JIoXJGz1JmyLnEacRufw9X1OFDaxgCoM/Bwt1KMmt+d5ZvpLSbCmAhsaB3aM+FgnEc7MsfuCL94Xu6Ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728407523; c=relaxed/simple; bh=t6uhWWI/vqTstW28v+jXjcST9fe0S7HdZwUMb7GRY0E=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=p5Q3NlUoH0kq8lfRsc3g1/7LjYhP+Ao/DEFgEo/Ey7BEgnFDhw0bT+CHW+/p2DydV77gNoP2tHEJ2UEz2sNSSb/AShk+4RtQ0kSMib0Vn7HiOO7qBcY2iTzzMoT5KpJarqZDwl5SlYlQ2ssCj/sR/Ib51rxSIJ4fQYEO8JPZEF4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728407518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dIgwktIVqCU5G1Gu7LT2IL4aSsdbkhd0tHCgYyK49Yw=; b=fnTn1kD5c/yenNZgGWucQwwJHWxQPAmqs2pPTMAFWWh6IH84nBlKapnn7gPRX7eMQ6Ml2Z /ySXduBMOCat8r9iYZaT2j7/el+MZBaPNIGoRcOCwlX1f6+fafzoCRllg3D3h5WK56vrHJ l74NFFqgr8Ydqk9+8fL3CfcY5wzykbE= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-rt7-o7bhOk605Tm9MWZ2Og-1; Tue, 08 Oct 2024 13:11:57 -0400 X-MC-Unique: rt7-o7bhOk605Tm9MWZ2Og-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a9959657eb9so141418066b.0 for ; Tue, 08 Oct 2024 10:11:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728407516; x=1729012316; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dIgwktIVqCU5G1Gu7LT2IL4aSsdbkhd0tHCgYyK49Yw=; b=rUlNBiQ+NN3vp4Oiwmj+04sq1k2wTdIO8EQNq79v4fhleXwU58sJLZnQt5o0pBt32f TZOqIAJTdd1KGgKnLwKNmnqrTR/DQNltHh1PbOeRFuJnmSpHiaBtfOsdS5v0Gb73yeec S6R7TzHWfyk96O62lRYuXQvcPW933Cb1ToH88huuYusaCu0+4AGhZsKIyw2kddufqkCz fpUlAbTvjnLJSahCyXt+9jRgBCiYCQycvMYwSMvQ2hJufpZECWegeEM6xIQshwfUr5Oy MhKKzxhVy7gnuJveBbn5afhCVE1TRZtGp+pCndtPEjFGYwa+Jx2r5RE78IopeTxUSL6P Ds7A== X-Gm-Message-State: AOJu0Yw+YUxiLDESU/LcutHNZleBLhN5OMyHf1vUxCXCBITomgPDVZAE jZWV/PzyTHwv59ByJnfGeRRLFPrrTio4XZ9CKHWv81RozOeRYAGIODDms248JWUVtT11LKyxqVt epMhdWDKxfFI+oicQiHxdDv1MruVIW4HH3OCz39NjrY81X2yfMryCropjT3yyKW2klOEqRmhdZQ y+peVgKTXbqMQJt2fUTil6xH3IZhGmY8SdX8Md/dI6Nvg= X-Received: by 2002:a17:906:7946:b0:a91:a5f:c9ce with SMTP id a640c23a62f3a-a991c077dc5mr1552141766b.62.1728407515601; Tue, 08 Oct 2024 10:11:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN31TPPxMQJSaW+zk7hdqps37wJrMaShnBCkyE8yKSV3SxLh/qDRGxfRSY7hsw7Zwhn41DHg== X-Received: by 2002:a17:906:7946:b0:a91:a5f:c9ce with SMTP id a640c23a62f3a-a991c077dc5mr1552139166b.62.1728407515103; Tue, 08 Oct 2024 10:11:55 -0700 (PDT) Received: from localhost ([195.213.152.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e5d007esm527541966b.29.2024.10.08.10.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 10:11:54 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , Luis Machado , Tom Tromey Subject: [PATCH 2/5] gdb: make use of set_tdesc_osabi overload in features/ files Date: Tue, 8 Oct 2024 18:11:47 +0100 Message-Id: <92ff2aaf4d9804491ca5c31849ff51025f2b6186.1728407374.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org There are two versions of the set_tdesc_osabi function in GDB: void set_tdesc_osabi (struct target_desc *target_desc, const char *name) { set_tdesc_osabi (target_desc, osabi_from_tdesc_string (name)); } void set_tdesc_osabi (struct target_desc *target_desc, enum gdb_osabi osabi) { target_desc->osabi = osabi; } In the gdb/features/ files we call the second of these functions, like this: set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux")); This can be replaced with a call to the first set_tdesc_osabi function, so lets do that. I think that this makes the features/ code slightly simpler and easier to understand. There should be no user visible changes after this commit. Approved-By: Tom Tromey --- gdb/features/mips-dsp-linux.c | 2 +- gdb/features/mips-linux.c | 2 +- gdb/features/or1k-linux.c | 2 +- gdb/features/sparc/sparc32-solaris.c | 2 +- gdb/features/sparc/sparc64-solaris.c | 2 +- gdb/target-descriptions.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/features/mips-dsp-linux.c b/gdb/features/mips-dsp-linux.c index d8e40283caf..17d30aac68f 100644 --- a/gdb/features/mips-dsp-linux.c +++ b/gdb/features/mips-dsp-linux.c @@ -11,7 +11,7 @@ initialize_tdesc_mips_dsp_linux (void) target_desc_up result = allocate_target_description (); set_tdesc_architecture (result.get (), bfd_scan_arch ("mips")); - set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux")); + set_tdesc_osabi (result.get (), "GNU/Linux"); struct tdesc_feature *feature; diff --git a/gdb/features/mips-linux.c b/gdb/features/mips-linux.c index f93eef5e41d..a43526db24e 100644 --- a/gdb/features/mips-linux.c +++ b/gdb/features/mips-linux.c @@ -11,7 +11,7 @@ initialize_tdesc_mips_linux (void) target_desc_up result = allocate_target_description (); set_tdesc_architecture (result.get (), bfd_scan_arch ("mips")); - set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux")); + set_tdesc_osabi (result.get (), "GNU/Linux"); struct tdesc_feature *feature; diff --git a/gdb/features/or1k-linux.c b/gdb/features/or1k-linux.c index 24731458de2..551b38f59c0 100644 --- a/gdb/features/or1k-linux.c +++ b/gdb/features/or1k-linux.c @@ -11,7 +11,7 @@ initialize_tdesc_or1k_linux (void) target_desc_up result = allocate_target_description (); set_tdesc_architecture (result.get (), bfd_scan_arch ("or1k")); - set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux")); + set_tdesc_osabi (result.get (), "GNU/Linux"); struct tdesc_feature *feature; diff --git a/gdb/features/sparc/sparc32-solaris.c b/gdb/features/sparc/sparc32-solaris.c index dce96851f96..ce57abaaaf2 100644 --- a/gdb/features/sparc/sparc32-solaris.c +++ b/gdb/features/sparc/sparc32-solaris.c @@ -11,7 +11,7 @@ initialize_tdesc_sparc32_solaris (void) target_desc_up result = allocate_target_description (); set_tdesc_architecture (result.get (), bfd_scan_arch ("sparc")); - set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("Solaris")); + set_tdesc_osabi (result.get (), "Solaris"); struct tdesc_feature *feature; diff --git a/gdb/features/sparc/sparc64-solaris.c b/gdb/features/sparc/sparc64-solaris.c index d030df63c6c..92cc88cd5cf 100644 --- a/gdb/features/sparc/sparc64-solaris.c +++ b/gdb/features/sparc/sparc64-solaris.c @@ -11,7 +11,7 @@ initialize_tdesc_sparc64_solaris (void) target_desc_up result = allocate_target_description (); set_tdesc_architecture (result.get (), bfd_scan_arch ("sparc:v9")); - set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("Solaris")); + set_tdesc_osabi (result.get (), "Solaris"); struct tdesc_feature *feature; diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index d78da14918f..c165750c6c5 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -1318,7 +1318,7 @@ class print_c_tdesc : public tdesc_element_visitor && tdesc_osabi (e) < GDB_OSABI_INVALID) { gdb_printf - (" set_tdesc_osabi (result.get (), osabi_from_tdesc_string (\"%s\"));\n", + (" set_tdesc_osabi (result.get (), \"%s\");\n", gdbarch_osabi_name (tdesc_osabi (e))); gdb_printf ("\n"); }