From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1F4993861827; Sat, 28 Oct 2023 18:55:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F4993861827 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1698519314; bh=tbdV1fL505AL3k5pAFsazlJFVOEdm6rHiq24Q+jlHF8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ojqD/y5UY9PGiSCYd/eOxl0q38hYr0tfGU3OL+LNxtyEKHkWTiQxRiLXgHNFL0oZ1 W28nRo7HMLV0rubYgJpgU5gk+lyEYD+HAgGllh7jZhO8nNkxD2SCUl+lCmuPW12O/a 7rSv4CInMIuHcvK6TQNW0RkDb1y/HZHsGpymLU0Q= From: "tpzker at thepuzzlemaker dot info" To: gdb-prs@sourceware.org Subject: [Bug rust/29735] Can't have multiple breakpoints - crash otherwise Date: Sat, 28 Oct 2023 18:55:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: rust X-Bugzilla-Version: 12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tpzker at thepuzzlemaker dot info X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29735 --- Comment #9 from The Puzzlemaker --- Comment on attachment 15198 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D15198 Patch for this issue, or an issue similar to it >>From 07bb370168aab780c4780435ad3d9257ad8a474b Mon Sep 17 00:00:00 2001 >From: ThePuzzlemaker >Date: Sat, 28 Oct 2023 13:28:33 -0500 >Subject: [PATCH] Fix assertion fail from `rust_lang::print_enum` > >This commit fixes an assertion fail in `rust_lang::print_enum` related >to the handling of field numbers for variant types. >--- > gdb/rust-lang.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c >index 74808ad0716..9acd2e1d2fa 100644 >--- a/gdb/rust-lang.c >+++ b/gdb/rust-lang.c >@@ -470,8 +470,18 @@ rust_language::print_enum (struct value *val, struct = ui_file *stream, > } >=20 > int variant_fieldno =3D rust_enum_variant (type); >- val =3D value_field (val, variant_fieldno); > struct type *variant_type =3D type->field (variant_fieldno).type (); >+ /* HACK: variant_fieldno is indexed in 'type', which has the field >+ disabled for other variants. The type of 'val' does not. Thus, >+ iterate through the fields and find the one that matches. */ >+ for (int i =3D 0; i < value_type (val)->num_fields (); i++) { >+ value* new_val =3D value_field (val, i); >+ if (types_equal (value_type (new_val), variant_type)) { >+ val =3D new_val; >+ break; >+ } >+ } >+ gdb_assert(types_equal(value_type (val), variant_type)); >=20 > int nfields =3D variant_type->num_fields (); >=20 >--=20 >2.42.0 --=20 You are receiving this mail because: You are on the CC list for the bug.=