Re: [PATCH] Revised display-linkage-name

Michael Eager
2013-07-26T20:18:05Z

On 07/26/13 11:41, Tom Tromey wrote:
>>>>>> "Michael" == Michael Eager <eager@eagerm.com> writes:
>
> Michael> +set|show display-linkage-name-len
>
> It's more gdb-ish to spell out "length".

OK.

> Michael> + /* Print linkage name after source name if requested and different. */
> Michael> + if ((display_linkage_name || ui_out_is_mi_like_p (uiout))
> Michael> + && linkname != NULL && strcmp (funname, linkname) != 0)
> Michael> + {
> Michael> + annotate_linkage_name ();
>
> FWIW there isn't much need to add new annotations. Annotations are
> officially deprecated. It's fine by me if you want to leave this in for
> some reason though.

I added the annotations at your request (4/19/13):
>> I think for MI it is better to make this a real field.
>> Also I wonder whether this should be emitted unconditionally if
>> mi-like. Say:

Perhaps I misunderstood what you meant by "make this a real field".

> Michael> + ui_out_text (uiout, " [");
> Michael> +
> Michael> + if (strlen (linkname) > display_linkage_name_len)
> Michael> + {
> Michael> + char *lname = alloca (display_linkage_name_len + 4);
> Michael> +
> Michael> + strncpy (lname, linkname, display_linkage_name_len);
> Michael> + lname[display_linkage_name_len] = '\0';
> Michael> + strcat (lname, "...");
> Michael> + ui_out_text (uiout, lname);
> Michael> + }
> Michael> + else
> Michael> + ui_out_text (uiout, linkname);
> Michael> +
> Michael> + ui_out_text (uiout, "]");
> Michael> + ui_out_field_stream (uiout, "linkage_name", stb);
>
> This is emitting the linkage name using ui_out_text. That is wrong for
> MI.

What should it be? ui_out_field_string()? Something else?

> Then this emits the linkage_name field with the contents from "stb" --
> which is reusing a result computed previously (look up for the
> fprintf_symbol_filtered).
>
> I tend to think that limiting the name length should only be done in the
> not-MI case. That is, for MI, it is better to always print the whole
> thing.

OK.