Re: [PATCH -tip v2 2/6] perf script: add magic word to indicate the failure of resolving symbols

David Ahern
2011-07-21T14:39:51Z

On 07/21/2011 03:36 AM, Akihiro Nagai wrote
>> Evidently I had the shift key down -- s/{}/[]/. :-) And I see now, for
>> dsoname you have [unknown] and for symname (unknown). Use the same for
>> both. Since () is already used for separating dsoname, use [unknown] for
>> both
> At print_sample_start() in builtin-script.c, there is the code that
> print "(unknown)"
> when perf cannnot resolve the event name.
>
> printf("%s: ", evname ? evname : "(unknown)");
>
> On the other hand, at hist_entry__dso_snprintf() in util/sort.c, there
> is the code
> prints "[unknown]" for unresolvable DSO name.
>
> return repsep_snprintf(bf, size, "%-*s", width, "[unknown]");
>
> In addition, perf uses "[]" for DSO name for example "[kernel.kallsyms]".
> So, I chose it. However, this specification is not easy for user-scripts.
> Should I unify this expression?

That was my thought -- to use the same for both dso and sym if it is
unknown. And since DSO names are wrapped in () use "[unknown]" for both
-- ie., right now the format is "symname (dsoname)" (though kernel syms
from kallsyms come out as "symname ([kernel.kallsyms])"). With an
unknown it will be "[unknown] (dsoname)" or "[unknown] ([unknown])"
which retains the number of fields in a uniquely parse-able way.

David