From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id BDE9F3858CDB for ; Wed, 1 Mar 2023 15:18:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDE9F3858CDB 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-x12b.google.com with SMTP id y14so6426494ilv.4 for ; Wed, 01 Mar 2023 07:18:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1677683925; 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=LNRLXbyYMWVJiMLzZWwRM635xSfccEZzAzrkJIv2dks=; b=iGGxlFv4+wf8EPRZx4CSujWWDKCjcnX2ebnKC3hToDSEOvx8M0opYtH+Uh2NOE7/lH EZjygH0GvMJPHeLiT7lPyLaH7fUJHF2sTels9QIdAVmmsmRtwrzpLHn2EMLUEUReeuX+ 2rU8ECqVXf/BoEmomP11qfPllO4Tk6lz5IwtmhfWHtCMiQZF9EWWVH8V7jNwEwk1dvXZ xhAzoMpd5ha2C5c6pn6at9sR3CLR+mH0jJSsKpLIsZdSvJrQ3mwtJFwRyPbb2g/Nm5EA Z8hfPoHivP3Y58TWT+BtRbQShoHmdMb3fqEU075SOEUERcUt62vCJadvfdmT9cXvY8HL oD+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677683925; 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=LNRLXbyYMWVJiMLzZWwRM635xSfccEZzAzrkJIv2dks=; b=dOUeH/1m8bQ1/XIL/JFcefcYfOWWAWhPBGhH9BzEI85/aW3aKUBhC4q++XGTA6H/NV DBd6zHn3NsgMxuo6JuCyDNBOnJxsRl7qubmxwWSIlnreDD4oWlnlymTnQH5lCE2HziU/ l0SuaUJ8vJFr53AFt3A4hFXyWQqdEIkAQb+5BHH3OwuZOTgJsG5DcmMJ68IJtN1cAcDo tDGebasFvz03c2cUSKc/VV81lfPCeKXf330jf0vtpgAAqlBOnUDE73l/jJxt9lUkPKhQ PUL6NCDH/NTmWJM6FhiLES2WLjwVfSpZtQ0lqle3NfSTVclab7Si59lfNneSqPI/gY75 NzuQ== X-Gm-Message-State: AO0yUKXeb1o1HHRZEIbER9x2K7YkIQ67IrSjBLnSk9adtN/vb64Z8Qgf efkwTPp/x9MGvRLlsCiRbD2RUXDiDadmptAT X-Google-Smtp-Source: AK7set/MoiZjzxox6YhMejW0o0v15Ymz+qzWu1kXnuTJb9ZvaHPPM2i4++568/aMn9avs5SrUORLoQ== X-Received: by 2002:a05:6e02:152c:b0:310:e816:8c8c with SMTP id i12-20020a056e02152c00b00310e8168c8cmr6747558ilu.3.1677683924911; Wed, 01 Mar 2023 07:18:44 -0800 (PST) Received: from localhost.localdomain (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id p10-20020a02b38a000000b003c4f96913c1sm3974241jan.105.2023.03.01.07.18.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 07:18:44 -0800 (PST) From: Tom Tromey Date: Wed, 01 Mar 2023 08:18:43 -0700 Subject: [PATCH 2/2] Use const for dwarf2_property_baton MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230301-submit-baton-stuff-v1-2-567d536a8245@adacore.com> References: <20230301-submit-baton-stuff-v1-0-567d536a8245@adacore.com> In-Reply-To: <20230301-submit-baton-stuff-v1-0-567d536a8245@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.1 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: Once a baton is stored in a struct type, it doesn't make sense to modify it. This patch constifies the API. --- gdb/dwarf2/loc.c | 8 ++++---- gdb/dwarf2/loc.h | 2 +- gdb/gdbtypes.h | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index bf582bcfeff..914e016f085 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -347,7 +347,7 @@ decode_debug_loc_dwo_addresses (dwarf2_per_cu_data *per_cu, can be more than one in the list. */ const gdb_byte * -dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton, +dwarf2_find_location_expression (const dwarf2_loclist_baton *baton, size_t *locexpr_length, CORE_ADDR pc) { dwarf2_per_objfile *per_objfile = baton->per_objfile; @@ -1691,7 +1691,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, case PROP_LOCLIST: { - struct dwarf2_property_baton *baton = prop->baton (); + const dwarf2_property_baton *baton = prop->baton (); CORE_ADDR pc; const gdb_byte *data; struct value *val; @@ -1722,7 +1722,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, case PROP_ADDR_OFFSET: { - struct dwarf2_property_baton *baton = prop->baton (); + const dwarf2_property_baton *baton = prop->baton (); const struct property_addr_info *pinfo; struct value *val; @@ -1772,7 +1772,7 @@ dwarf2_compile_property_to_c (string_file *stream, CORE_ADDR pc, struct symbol *sym) { - struct dwarf2_property_baton *baton = prop->baton (); + const dwarf2_property_baton *baton = prop->baton (); const gdb_byte *data; size_t size; dwarf2_per_cu_data *per_cu; diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h index 37925f48497..ad60177e93c 100644 --- a/gdb/dwarf2/loc.h +++ b/gdb/dwarf2/loc.h @@ -37,7 +37,7 @@ extern unsigned int entry_values_debug; /* Find a particular location expression from a location list. */ const gdb_byte *dwarf2_find_location_expression - (struct dwarf2_loclist_baton *baton, + (const dwarf2_loclist_baton *baton, size_t *locexpr_length, CORE_ADDR pc); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 701a64d457a..c4889a4a05b 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -290,7 +290,7 @@ union dynamic_prop_data /* Storage for dynamic property. */ - dwarf2_property_baton *baton; + const dwarf2_property_baton *baton; /* Storage of variant parts for a type. A type with variant parts has all its fields "linearized" -- stored in a single field @@ -340,7 +340,7 @@ struct dynamic_prop m_data.const_val = const_val; } - dwarf2_property_baton *baton () const + const dwarf2_property_baton *baton () const { gdb_assert (m_kind == PROP_LOCEXPR || m_kind == PROP_LOCLIST @@ -349,19 +349,19 @@ struct dynamic_prop return m_data.baton; } - void set_locexpr (dwarf2_property_baton *baton) + void set_locexpr (const dwarf2_property_baton *baton) { m_kind = PROP_LOCEXPR; m_data.baton = baton; } - void set_loclist (dwarf2_property_baton *baton) + void set_loclist (const dwarf2_property_baton *baton) { m_kind = PROP_LOCLIST; m_data.baton = baton; } - void set_addr_offset (dwarf2_property_baton *baton) + void set_addr_offset (const dwarf2_property_baton *baton) { m_kind = PROP_ADDR_OFFSET; m_data.baton = baton; -- 2.39.1