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 E86183858438 for ; Tue, 22 Aug 2023 15:25:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E86183858438 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-34cacab5e33so7042835ab.2 for ; Tue, 22 Aug 2023 08:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1692717913; x=1693322713; 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=BZ2tOeYtEIjbw3IRKgBAv+HFbFkCqMLakSf74khIKNg=; b=XhPuGYOgt22DUxyQJQ3dYE2G2Dr5lQAqdLZeaONVaA+GEwzltBn567XAKsN1hlZsJX 4lm//BzbCNrLxYxsmxAW+ffj48NlSzPOhob2zfBxUeNzMLFXh/JCKUEiVgfQKNTcveJE ssfpeD0FN70LhOM6qzdc8PaSj7nns/kAVvtxqVFeFbh52rY50A2ObIN4RwvACtpbyrVq GAijx4OqoODp5kVX4o5kRN6BGriFPGvjmBC3OSYxyAazEpLPnIPwfa8NwlUfiU23Dvr+ sVh35x4WXj1DwbHdjY40veH7QlFcgXLhnbRGtLBzXQadho2fJUijIzbZXQ2WzNqS0cR9 A5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692717913; x=1693322713; 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=BZ2tOeYtEIjbw3IRKgBAv+HFbFkCqMLakSf74khIKNg=; b=UKtilpG7XQZr+aLt4jPtU76In96tYqMFi3jxG1j+eYjsC+qW2y+fP6we0Ze5yIw4Ac l0Es/SwS0rvPLhDYkA7Wc367FFR1T+r3IYvcS8TvoUMdlNLm9bnwbbX6fDOOUjhzAvnY VH2TUFkgUPhM1zAu/qAH8m41hx+6KMhDySiLsP7SejH/wVJsYD3lp/y3KnKlAXCDdZuz Zu6C+DcPwVZHK+JAOPxHhYuuBcmzUWnFRNk3oHyiGK0b/kYH1pKaOoHfIlryW/+vvTYW Bsk7f2b4RWtGiRsp++VccUqzclUj6y+zkS6MhrIopzdhczkyp4YRlpvxlkLWVkfVQFHq X2mg== X-Gm-Message-State: AOJu0Yzcsru8v3UM8UKS6TDRueYtwT0cfTZJ8yuExbLDLJdQr0F1GdxI qbj1W/BobohvtYFhg+rNf4+pCS4XBcqXaR0oCuB/9g== X-Google-Smtp-Source: AGHT+IF4G64BLdyJ+ZiCRq3Z25xnOV1HzNDHhtEcjY7yGIAUvaEZUFjGZArXrQdxuUW1d6q5poFLpQ== X-Received: by 2002:a05:6e02:eee:b0:349:8dfa:ad64 with SMTP id j14-20020a056e020eee00b003498dfaad64mr2209ilk.15.1692717913144; Tue, 22 Aug 2023 08:25:13 -0700 (PDT) Received: from localhost.localdomain (75-166-142-177.hlrn.qwest.net. [75.166.142.177]) by smtp.gmail.com with ESMTPSA id e8-20020a92de48000000b003460b8505easm1721608ilr.19.2023.08.22.08.25.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 08:25:12 -0700 (PDT) From: Tom Tromey Date: Tue, 22 Aug 2023 09:25:09 -0600 Subject: [PATCH 3/8] Introduce TYPE_SPECIFIC_RUST_STUFF MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230822-array-and-string-like-v1-3-2dcea29b0567@adacore.com> References: <20230822-array-and-string-like-v1-0-2dcea29b0567@adacore.com> In-Reply-To: <20230822-array-and-string-like-v1-0-2dcea29b0567@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-11.5 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: This adds a new enum constant, TYPE_SPECIFIC_RUST_STUFF, and changes the DWARF reader to set this on Rust types. This will be used as a flag in a later patch. Note that the size of the type_specific_field bitfield had to be increased. I checked that this did not impact the size of main_type. --- gdb/dwarf2/read.c | 9 ++++++++- gdb/gdbtypes.c | 7 +++++++ gdb/gdbtypes.h | 11 ++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index f1d7bfdfdec..c9f0a18feb5 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12689,7 +12689,14 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) } type = type_allocator (objfile).new_type (); - INIT_CPLUS_SPECIFIC (type); + if (cu->lang () == language_rust) + { + /* This is currently only needed for types that might be + slices. */ + INIT_RUST_SPECIFIC (type); + } + else + INIT_CPLUS_SPECIFIC (type); name = dwarf2_name (die, cu); if (name != NULL) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d7db7beb554..082d85bb4fc 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5403,6 +5403,10 @@ recursive_dump_type (struct type *type, int spaces) print_gnat_stuff (type, spaces); break; + case TYPE_SPECIFIC_RUST_STUFF: + gdb_printf ("%*srust\n", spaces, ""); + break; + case TYPE_SPECIFIC_FLOATFORMAT: gdb_printf ("%*sfloatformat ", spaces, ""); if (TYPE_FLOATFORMAT (type) == NULL @@ -5645,6 +5649,9 @@ copy_type_recursive (struct type *type, htab_t copied_types) case TYPE_SPECIFIC_GNAT_STUFF: INIT_GNAT_SPECIFIC (new_type); break; + case TYPE_SPECIFIC_RUST_STUFF: + INIT_RUST_SPECIFIC (new_type); + break; case TYPE_SPECIFIC_SELF_TYPE: set_type_self_type (new_type, copy_type_recursive (TYPE_SELF_TYPE (type), diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index aedaf53cd5d..389cd6c5757 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -501,6 +501,7 @@ enum type_specific_kind TYPE_SPECIFIC_NONE, TYPE_SPECIFIC_CPLUS_STUFF, TYPE_SPECIFIC_GNAT_STUFF, + TYPE_SPECIFIC_RUST_STUFF, TYPE_SPECIFIC_FLOATFORMAT, /* Note: This is used by TYPE_CODE_FUNC and TYPE_CODE_METHOD. */ TYPE_SPECIFIC_FUNC, @@ -831,7 +832,7 @@ struct main_type /* * A discriminant telling us which field of the type_specific union is being used for this type, if any. */ - ENUM_BITFIELD(type_specific_kind) type_specific_field : 3; + ENUM_BITFIELD(type_specific_kind) type_specific_field : 4; /* * Number of fields described for this type. This field appears at this location because it packs nicely here. */ @@ -1800,6 +1801,14 @@ extern void allocate_gnat_aux_type (struct type *); || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \ && (type)->is_fixed_instance ())) +/* Currently there isn't any associated data -- this is just a + marker. */ +#define INIT_RUST_SPECIFIC(type) \ + TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_RUST_STUFF + +#define HAVE_RUST_SPECIFIC(type) \ + (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_RUST_STUFF) + #define INIT_FUNC_SPECIFIC(type) \ (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \ TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \ -- 2.40.1