This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Revised display-linkage-name
- From: Tom Tromey <tromey at redhat dot com>
- To: Michael Eager <eager at eagerm dot com>
- Cc: Keith Seitz <keiths at redhat dot com>, "gdb-patches\ at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Fri, 26 Jul 2013 12:41:51 -0600
- Subject: Re: [PATCH] Revised display-linkage-name
- References: <519D086A dot 50105 at eagerm dot com> <51BF47DB dot 6070709 at eagerm dot com> <51DD891D dot 7090009 at eagerm dot com> <51DF3F97 dot 90805 at redhat dot com> <51E07263 dot 6080605 at eagerm dot com> <51E6E797 dot 30709 at eagerm dot com> <51ED705A dot 5000601 at redhat dot com> <51ED90E3 dot 30801 at eagerm dot com> <51EDAA3A dot 5090504 at redhat dot com> <51EFF8F8 dot 6050807 at eagerm dot com>
>>>>> "Michael" == Michael Eager <eager@eagerm.com> writes:
Michael> This is pretty pointless busywork, serving no useful purpose.
It's part of the currently-agreed-upon coding style.
You're always welcome to propose changes.
Michael> +set|show display-linkage-name-len
It's more gdb-ish to spell out "length".
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.
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.
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.
Tom