From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 192733858D35 for ; Tue, 5 Sep 2023 19:47:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 192733858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-34df008b0e7so630095ab.1 for ; Tue, 05 Sep 2023 12:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1693943224; x=1694548024; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SFCP8Nn/PjH/AwFFRYI7EJLzRR87goWL3uCbwovSQg4=; b=A9YjN1xa/v/RYC6nbaBcjqusrarqx8SIATju23XRhf86ICHnZM61Cs9mNZRxbgnNcX cJz/2g8zVUoWgM6XxMEbZUZq2G79CXkKO9JGGhhn/5odTVnLaAdUb2dNhjugWMNbHglG vBhuMb03Cf9ZRFmWaeuVx3yvFvS25jGH/cxe7rR00p9g8fr8Apz87zmNcs6w+qXg57t/ VJwj2KvUOR41evPV8fAHskEFTgETI1ji5bDbwaJEk8uUjLAV0eMvS+tvlqT3J30/CeUc UrbYGmN+TgXtaCTtxmsuJbqayu7cdEAtFzZDblWt1J3gYXuxs1enmmNiaTcPaadX1MKh KSSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693943224; x=1694548024; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SFCP8Nn/PjH/AwFFRYI7EJLzRR87goWL3uCbwovSQg4=; b=cZ+/q9qJr3Wxzp6G4Gf3J59kRQxP3g2vAS9WdAFFMwjezI4L93/yfaE/1OVPDR50oU NDMZLjuBvcD7dneIE+1gYK4+npXUelOFnTChKCGxyoKHO3zoPDMXQtov9O2Vlaws1aBs sDGZsJH/2MMJgP4U3wS9td9z52jix51v/eVpo8IF1MW++FMA/19hWAlJ+iwo4gsnpy0L SQELZV383up2N1aCzG8qyUAvl29X/TE2ekdavB90U36I7FK99sjU1Yq4neIpMj8+2b/Y SW0Gq/mLG8OXeFBx4hTPEIXBmPUvgFpwg2/sTl7LmwxppUeb3bu8OgZi1UdRtQ8gVcqs AiGw== X-Gm-Message-State: AOJu0YxJMJE5MmnYnxjK3VaBNfoBiZ5cLLNtBr2z5e+LYh1U3wx2egHS iL3vGv49Qf3evhUm4zrhwhIougMdTfxobBhXf6K1Qw== X-Google-Smtp-Source: AGHT+IF9eJuSL/r/VdpoVZJ58bplYMgawa1d/m2S6Zo3YgpIF1VDvcwPbhf1rf48xhoWMFkCuOUuWw== X-Received: by 2002:a05:6e02:de4:b0:34e:29ff:daae with SMTP id m4-20020a056e020de400b0034e29ffdaaemr6066425ilj.7.1693943224336; Tue, 05 Sep 2023 12:47:04 -0700 (PDT) Received: from localhost.localdomain (75-166-150-212.hlrn.qwest.net. [75.166.150.212]) by smtp.gmail.com with ESMTPSA id y9-20020a02a389000000b0042b144abf71sm4294910jak.179.2023.09.05.12.47.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 12:47:04 -0700 (PDT) From: Tom Tromey Date: Tue, 05 Sep 2023 13:47:02 -0600 Subject: [PATCH 2/5] Regularize some DWARF type initialization MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230905-dap-30821-pointers-v1-2-0d7323327678@adacore.com> References: <20230905-dap-30821-pointers-v1-0-0d7323327678@adacore.com> In-Reply-To: <20230905-dap-30821-pointers-v1-0-0d7323327678@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: In one spot, it will be convenient for a subsequent patch if the CU is passed to a type-creation helper function. In another spot, remove the redundant 'objfile' parameter to another such function. --- gdb/dwarf2/read.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2335bbe0aba..63a2a83f0a2 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15090,9 +15090,10 @@ gnat_encoded_fixed_point_type_info (const char *name) it to guess the correct format if necessary. */ static struct type * -dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name, +dwarf2_init_float_type (struct dwarf2_cu *cu, int bits, const char *name, const char *name_hint, enum bfd_endian byte_order) { + struct objfile *objfile = cu->per_objfile->objfile; struct gdbarch *gdbarch = objfile->arch (); const struct floatformat **format; struct type *type; @@ -15110,10 +15111,11 @@ dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name, /* Allocate an integer type of size BITS and name NAME. */ static struct type * -dwarf2_init_integer_type (struct dwarf2_cu *cu, struct objfile *objfile, - int bits, int unsigned_p, const char *name) +dwarf2_init_integer_type (struct dwarf2_cu *cu, int bits, int unsigned_p, + const char *name) { struct type *type; + struct objfile *objfile = cu->per_objfile->objfile; /* Versions of Intel's C Compiler generate an integer type called "void" instead of using DW_TAG_unspecified_type. This has been seen on @@ -15167,10 +15169,10 @@ has_zero_over_zero_small_attribute (struct die_info *die, component. */ static struct type * dwarf2_init_complex_target_type (struct dwarf2_cu *cu, - struct objfile *objfile, int bits, const char *name_hint, enum bfd_endian byte_order) { + struct objfile *objfile = cu->per_objfile->objfile; gdbarch *gdbarch = objfile->arch (); struct type *tt = nullptr; @@ -15218,7 +15220,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu, tt = nullptr; const char *name = (tt == nullptr) ? nullptr : tt->name (); - return dwarf2_init_float_type (objfile, bits, name, name_hint, byte_order); + return dwarf2_init_float_type (cu, bits, name, name_hint, byte_order); } /* Find a representation of a given base type and install @@ -15321,7 +15323,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) type = init_boolean_type (alloc, bits, 1, name); break; case DW_ATE_complex_float: - type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name, + type = dwarf2_init_complex_target_type (cu, bits / 2, name, byte_order); if (type->code () == TYPE_CODE_ERROR) { @@ -15341,10 +15343,10 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) type = init_decfloat_type (alloc, bits, name); break; case DW_ATE_float: - type = dwarf2_init_float_type (objfile, bits, name, name, byte_order); + type = dwarf2_init_float_type (cu, bits, name, name, byte_order); break; case DW_ATE_signed: - type = dwarf2_init_integer_type (cu, objfile, bits, 0, name); + type = dwarf2_init_integer_type (cu, bits, 0, name); break; case DW_ATE_unsigned: if (cu->lang () == language_fortran @@ -15352,7 +15354,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) && startswith (name, "character(")) type = init_character_type (alloc, bits, 1, name); else - type = dwarf2_init_integer_type (cu, objfile, bits, 1, name); + type = dwarf2_init_integer_type (cu, bits, 1, name); break; case DW_ATE_signed_char: if (cu->lang () == language_ada @@ -15361,7 +15363,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) || cu->lang () == language_fortran) type = init_character_type (alloc, bits, 0, name); else - type = dwarf2_init_integer_type (cu, objfile, bits, 0, name); + type = dwarf2_init_integer_type (cu, bits, 0, name); break; case DW_ATE_unsigned_char: if (cu->lang () == language_ada @@ -15371,7 +15373,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) || cu->lang () == language_rust) type = init_character_type (alloc, bits, 1, name); else - type = dwarf2_init_integer_type (cu, objfile, bits, 1, name); + type = dwarf2_init_integer_type (cu, bits, 1, name); break; case DW_ATE_UTF: { -- 2.40.1