* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
@ 2022-10-31 20:21 ` tromey at sourceware dot org
2022-11-01 3:37 ` amab8901 at protonmail dot com
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2022-10-31 20:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|gdb |rust
CC| |tromey at sourceware dot org
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
This works for me. I tried the gdb 12 release branch and also git master.
Can you try reproducing with '-nx' -- that is, avoid your add-ons?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
2022-10-31 20:21 ` [Bug rust/29735] " tromey at sourceware dot org
@ 2022-11-01 3:37 ` amab8901 at protonmail dot com
2022-11-01 13:38 ` tromey at sourceware dot org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: amab8901 at protonmail dot com @ 2022-11-01 3:37 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #2 from amir <amab8901 at protonmail dot com> ---
(In reply to Tom Tromey from comment #1)
> This works for me. I tried the gdb 12 release branch and also git master.
>
> Can you try reproducing with '-nx' -- that is, avoid your add-ons?
Oh, it works for me now that I used `-nx`. Thanks
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
2022-10-31 20:21 ` [Bug rust/29735] " tromey at sourceware dot org
2022-11-01 3:37 ` amab8901 at protonmail dot com
@ 2022-11-01 13:38 ` tromey at sourceware dot org
2022-11-01 14:27 ` amab8901 at protonmail dot com
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2022-11-01 13:38 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
This doesn't mean there isn't a gdb bug.
Maybe gdb-dashboard is running other commands behind the scenes.
It would be good to find out.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (2 preceding siblings ...)
2022-11-01 13:38 ` tromey at sourceware dot org
@ 2022-11-01 14:27 ` amab8901 at protonmail dot com
2022-11-02 19:47 ` tromey at sourceware dot org
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: amab8901 at protonmail dot com @ 2022-11-01 14:27 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #4 from amir <amab8901 at protonmail dot com> ---
(In reply to Tom Tromey from comment #3)
> This doesn't mean there isn't a gdb bug.
> Maybe gdb-dashboard is running other commands behind the scenes.
> It would be good to find out.
Any suggestions on specific steps I may try out?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (3 preceding siblings ...)
2022-11-01 14:27 ` amab8901 at protonmail dot com
@ 2022-11-02 19:47 ` tromey at sourceware dot org
2023-03-08 0:28 ` tromey at sourceware dot org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2022-11-02 19:47 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to amir from comment #4)
> Any suggestions on specific steps I may try out?
I don't know much about gdb-dashboard, so I don't know what to suggest.
Based on the assertion, I'd say maybe try "info local" at the
second breakpoint. Otherwise maybe see if gdb-dashboard has some
kind of verbose mode or the like.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (4 preceding siblings ...)
2022-11-02 19:47 ` tromey at sourceware dot org
@ 2023-03-08 0:28 ` tromey at sourceware dot org
2023-10-28 18:34 ` tpzker at thepuzzlemaker dot info
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2023-03-08 0:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-03-08
Status|UNCONFIRMED |WAITING
--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
Any new info on this?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (5 preceding siblings ...)
2023-03-08 0:28 ` tromey at sourceware dot org
@ 2023-10-28 18:34 ` tpzker at thepuzzlemaker dot info
2023-10-28 18:51 ` tpzker at thepuzzlemaker dot info
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tpzker at thepuzzlemaker dot info @ 2023-10-28 18:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
The Puzzlemaker <tpzker at thepuzzlemaker dot info> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tpzker at thepuzzlemaker dot info
--- Comment #7 from The Puzzlemaker <tpzker at thepuzzlemaker dot info> ---
Created attachment 15198
--> https://sourceware.org/bugzilla/attachment.cgi?id=15198&action=edit
Patch for this issue, or an issue similar to it
I experienced this in 13.2. I believe it's related to the null pointer
optimization, or at least the case I encountered was.
```
use std::num::NonZeroUsize;
use std::hint::black_box;
pub fn main() {
foo(black_box(NonZeroUsize::new(5)), black_box(NonZeroUsize::new(5)))
}
#[inline(never)]
pub fn foo(x: Option<NonZeroUsize>, y: Option<NonZeroUsize>) {
black_box(x.unwrap().checked_add(y.unwrap().into()));
}
```
Put this in `tmp.rs`.
Compile with `rustc tmp.rs -Copt-level=1 -Cdebuginfo=full`
Run `gdb tmp::foo`
`break foo`
`run`
`info args`
Observe assertion fail:
```
x = core::option::Option<core::num::nonzero::NonZeroUsize>::Some(
../../gdb/gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx <
num_fields ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
```
This issue is related to this portion of code in `rust_lang::print_enum`:
```
461 type = resolve_dynamic_type (type, view, value_address (val));
... [snip]
472 int variant_fieldno = rust_enum_variant (type);
473 val = value_field (val, variant_fieldno);
474 struct type *variant_type = type->field (variant_fieldno).type ();
```
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/rust-lang.c;h=74808ad0716e4d67f6af859f05ebff2b55d5e276;hb=662243de0e14a4945555a480dca33c0e677976eb#l461
The type from `resolve_dynamic_type` makes only the variant field of the active
discriminant in active. However, the type of `val` has *all* variant fields
enabled, thus making this index meaningless for that. I created a patch for
this, which is somewhat hacky--any maintainers here, feel free to change it up
a bit; I am a Rust developer by nature and don't know much about idiomatic C/++
and in general, what the GDB codebase looks like.
Please let me know if you'd like me to test/update this patch to the v14
codebase.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (6 preceding siblings ...)
2023-10-28 18:34 ` tpzker at thepuzzlemaker dot info
@ 2023-10-28 18:51 ` tpzker at thepuzzlemaker dot info
2023-10-28 18:55 ` tpzker at thepuzzlemaker dot info
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tpzker at thepuzzlemaker dot info @ 2023-10-28 18:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #8 from The Puzzlemaker <tpzker at thepuzzlemaker dot info> ---
Woops, I apologize, I accidentally left a debugging `printf` in there. Give me
a moment and I'll upload the real patch
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (7 preceding siblings ...)
2023-10-28 18:51 ` tpzker at thepuzzlemaker dot info
@ 2023-10-28 18:55 ` tpzker at thepuzzlemaker dot info
2023-10-28 20:46 ` tromey at sourceware dot org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tpzker at thepuzzlemaker dot info @ 2023-10-28 18:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #9 from The Puzzlemaker <tpzker at thepuzzlemaker dot info> ---
Comment on attachment 15198
--> https://sourceware.org/bugzilla/attachment.cgi?id=15198
Patch for this issue, or an issue similar to it
>From 07bb370168aab780c4780435ad3d9257ad8a474b Mon Sep 17 00:00:00 2001
>From: ThePuzzlemaker <tpzker@thepuzzlemaker.info>
>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,
> }
>
> int variant_fieldno = rust_enum_variant (type);
>- val = value_field (val, variant_fieldno);
> struct type *variant_type = 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 = 0; i < value_type (val)->num_fields (); i++) {
>+ value* new_val = value_field (val, i);
>+ if (types_equal (value_type (new_val), variant_type)) {
>+ val = new_val;
>+ break;
>+ }
>+ }
>+ gdb_assert(types_equal(value_type (val), variant_type));
>
> int nfields = variant_type->num_fields ();
>
>--
>2.42.0
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (8 preceding siblings ...)
2023-10-28 18:55 ` tpzker at thepuzzlemaker dot info
@ 2023-10-28 20:46 ` tromey at sourceware dot org
2023-10-28 20:48 ` tromey at sourceware dot org
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2023-10-28 20:46 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to The Puzzlemaker from comment #9)
> Comment on attachment 15198 [details]
> Patch for this issue, or an issue similar to it
>
> >From 07bb370168aab780c4780435ad3d9257ad8a474b Mon Sep 17 00:00:00 2001
> >From: ThePuzzlemaker <tpzker@thepuzzlemaker.info>
> >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,
> > }
> >
> > int variant_fieldno = rust_enum_variant (type);
> >- val = value_field (val, variant_fieldno);
This code looks different on trunk.
IIRC I fixed a bug like this a while ago.
git says 2020 though, which seems wrong if you're using 13.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (9 preceding siblings ...)
2023-10-28 20:46 ` tromey at sourceware dot org
@ 2023-10-28 20:48 ` tromey at sourceware dot org
2023-10-28 20:56 ` tpzker at thepuzzlemaker dot info
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2023-10-28 20:48 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #11 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to The Puzzlemaker from comment #7)
> `break foo`
> `run`
> `info args`
This works for me with my 14.x build from git:
(gdb) info args
x =
core::option::Option<core::num::nonzero::NonZeroUsize>::Some(core::num::nonzero::NonZeroUsize
(
5
))
y =
core::option::Option<core::num::nonzero::NonZeroUsize>::Some(core::num::nonzero::NonZeroUsize
(
5
))
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (10 preceding siblings ...)
2023-10-28 20:48 ` tromey at sourceware dot org
@ 2023-10-28 20:56 ` tpzker at thepuzzlemaker dot info
2023-10-28 20:57 ` tpzker at thepuzzlemaker dot info
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tpzker at thepuzzlemaker dot info @ 2023-10-28 20:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #12 from The Puzzlemaker <tpzker at thepuzzlemaker dot info> ---
This is in fact fixed in 14.x git.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (11 preceding siblings ...)
2023-10-28 20:56 ` tpzker at thepuzzlemaker dot info
@ 2023-10-28 20:57 ` tpzker at thepuzzlemaker dot info
2023-10-28 21:08 ` tpzker at thepuzzlemaker dot info
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: tpzker at thepuzzlemaker dot info @ 2023-10-28 20:57 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #13 from The Puzzlemaker <tpzker at thepuzzlemaker dot info> ---
It seems it was 2023 actually.
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;f=gdb/rust-lang.c;h=debd0556e519c3d258299cf5f14a44cc01c795da
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (12 preceding siblings ...)
2023-10-28 20:57 ` tpzker at thepuzzlemaker dot info
@ 2023-10-28 21:08 ` tpzker at thepuzzlemaker dot info
2023-10-29 10:06 ` sam at gentoo dot org
2023-11-24 16:30 ` tromey at sourceware dot org
15 siblings, 0 replies; 17+ messages in thread
From: tpzker at thepuzzlemaker dot info @ 2023-10-28 21:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
--- Comment #14 from The Puzzlemaker <tpzker at thepuzzlemaker dot info> ---
Thanks for your help. @amir, it'd be great if you could test and see if this
issue still occurs with GDB 14.x
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (13 preceding siblings ...)
2023-10-28 21:08 ` tpzker at thepuzzlemaker dot info
@ 2023-10-29 10:06 ` sam at gentoo dot org
2023-11-24 16:30 ` tromey at sourceware dot org
15 siblings, 0 replies; 17+ messages in thread
From: sam at gentoo dot org @ 2023-10-29 10:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
Sam James <sam at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sam at gentoo dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug rust/29735] Can't have multiple breakpoints - crash otherwise
2022-10-31 13:25 [Bug gdb/29735] New: Can't have multiple breakpoints - crash otherwise amab8901 at protonmail dot com
` (14 preceding siblings ...)
2023-10-29 10:06 ` sam at gentoo dot org
@ 2023-11-24 16:30 ` tromey at sourceware dot org
15 siblings, 0 replies; 17+ messages in thread
From: tromey at sourceware dot org @ 2023-11-24 16:30 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29735
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|WAITING |RESOLVED
Target Milestone|--- |14.1
--- Comment #15 from Tom Tromey <tromey at sourceware dot org> ---
I think this is fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 17+ messages in thread