Message ID | CAA3XUr0uXykCTVuw-sYmkhsFZ-cimeuJkXTXNdJyhJh7976xEQ@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 1/21/15 5:34 PM, Victor Kamensky wrote: > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c > index 45be944..ca8d8d5 100644 > --- a/tools/perf/util/dso.c > +++ b/tools/perf/util/dso.c > @@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso, > case DSO_BINARY_TYPE__DEBUGLINK: { > char *debuglink; > > - strncpy(filename, dso->long_name, size); > - debuglink = filename + dso->long_name_len; > + len = __symbol__join_symfs(filename, size, dso->long_name); > + debuglink = filename + len; > while (debuglink != filename && *debuglink != '/') > debuglink--; > if (*debuglink == '/') > debuglink++; > - ret = filename__read_debuglink(dso->long_name, debuglink, > + ret = filename__read_debuglink(filename, debuglink, > size - (debuglink - filename)); > } > break; > I do not see any reason this will not work. Essentially after filename__read_debuglink filename contains symfs + dso path + debuglink read from .gnu_debuglink section which is what is wanted. Thanks for the example. I used it with both a symfs and non-symfs example and both times this change worked properly -- the correct hang.debug file is read. Arnaldo? David
On 21 January 2015 at 16:53, David Ahern <dsahern@gmail.com> wrote: > On 1/21/15 5:34 PM, Victor Kamensky wrote: >> >> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c >> index 45be944..ca8d8d5 100644 >> --- a/tools/perf/util/dso.c >> +++ b/tools/perf/util/dso.c >> @@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso >> *dso, >> case DSO_BINARY_TYPE__DEBUGLINK: { >> char *debuglink; >> >> - strncpy(filename, dso->long_name, size); >> - debuglink = filename + dso->long_name_len; >> + len = __symbol__join_symfs(filename, size, dso->long_name); >> + debuglink = filename + len; >> while (debuglink != filename && *debuglink != '/') >> debuglink--; >> if (*debuglink == '/') >> debuglink++; >> - ret = filename__read_debuglink(dso->long_name, debuglink, >> + ret = filename__read_debuglink(filename, debuglink, >> size - (debuglink - filename)); >> } >> break; >> > > I do not see any reason this will not work. Essentially after > filename__read_debuglink filename contains symfs + dso path + debuglink read > from .gnu_debuglink section which is what is wanted. OK, I am good with this. Let me repost the whole mini-series based on mailing list review comments. May I use 'Acked-by' (maybe 'Tested-by' as well) with your name for the shorter (no filename_copy) as above version of the patch for .gnu_debuglink issue fix. ARM/Aarch64 specific change also needs update based on discussion with Will and Russell. I'll post updated version 2 latter tonight. Thanks, Victor > Thanks for the example. I used it with both a symfs and non-symfs example > and both times this change worked properly -- the correct hang.debug file is > read. > > Arnaldo? > > David
On 1/21/15 6:32 PM, Victor Kamensky wrote: > May I use 'Acked-by' (maybe 'Tested-by' as well) with > your name for the shorter (no filename_copy) as above > version of the patch for .gnu_debuglink issue fix. You can add both to your second patch -- the short version. Acked-and-Tested-by: David Ahern <dsahern@gmail.com>
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 45be944..ca8d8d5 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso, case DSO_BINARY_TYPE__DEBUGLINK: { char *debuglink; - strncpy(filename, dso->long_name, size); - debuglink = filename + dso->long_name_len; + len = __symbol__join_symfs(filename, size, dso->long_name); + debuglink = filename + len; while (debuglink != filename && *debuglink != '/') debuglink--; if (*debuglink == '/') debuglink++; - ret = filename__read_debuglink(dso->long_name, debuglink, + ret = filename__read_debuglink(filename, debuglink, size - (debuglink - filename)); } break;