[Bug c++/33480] [gdb, c++] Gdb hang on "whatis std::string::npos" with prettyprinter

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Wed Sep 24 14:33:48 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=33480

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> (In reply to Tom de Vries from comment #0)
> > Valgrind complained about uninitialized values, which I silenced using:
> 
> Less hacky:
> ...
> diff --git a/gdb/cp-support.c b/gdb/cp-support.c
> index 7cfb5452ad9..3ace0036492 100644
> --- a/gdb/cp-support.c
> +++ b/gdb/cp-support.c
> @@ -378,9 +378,10 @@ replace_typedefs_qualified_name (struct
> demangle_parse_info *info,
> 
>  	  struct demangle_component newobj;
>  
>  	  buf.write (d_left (comp)->u.s_name.s, d_left (comp)->u.s_name.len);
> -	  newobj.type = DEMANGLE_COMPONENT_NAME;
> -	  newobj.u.s_name.s = obstack_strdup (&info->obstack, buf.string ());
> -	  newobj.u.s_name.len = buf.size ();
> +	  cplus_demangle_fill_name (&newobj,
> +				    obstack_strdup (&info->obstack,
> +						    buf.string ()),
> +				    buf.size ());
>  	  if (inspect_type (info, &newobj, finder, data))
>  	    {
>  	      char *s;
> ...

Using this patch, also reproduced with fedora 42.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list