History

perf map: Add accessor for dso

Later changes will add reference count checking for struct map, with dso being the most frequently accessed variable. Add an accessor so that the reference count check is only necessary in one place. Additional changes: - add a dso variable to avoid repeated map__dso calls. - in builtin-mem.c dump_raw_samples, code only partially tested for dso == NULL. Make the possibility of NULL consistent. - in thread.c thread__memcpy fix use of spaces and use tabs. Committer notes: Did missing conversions on these files: tools/perf/arch/powerpc/util/skip-callchain-idx.c tools/perf/arch/powerpc/util/sym-handling.c tools/perf/ui/browsers/hists.c tools/perf/ui/gtk/annotate.c tools/perf/util/cs-etm.c tools/perf/util/thread.c tools/perf/util/unwind-libunwind-local.c tools/perf/util/unwind-libunwind.c

Ian Rogers committed 3 years ago

Commit 63df0e41 parent 5ab6d7154 files · +447 −319Browse files

Showing the changes to tools/perf/scripts/python (1 of 54 files). Show all

Unified · Split

tools/perf/scripts/python/Perf-Trace-Util/Context.c+4−2
@@ -145,6 +145,7 @@ static PyObject *perf_sample_src(PyObject *obj, PyObject *args, bool get_srccode · 144 unmodified lines
145145 char *srccode = NULL;
146146 PyObject *result;
147147 struct map *map;
148+ struct dso *dso;
148149 int len = 0;
149150 u64 addr;
150151
@@ -153,9 +154,10 @@ static PyObject *perf_sample_src(PyObject *obj, PyObject *args, bool get_srccode · 2 unmodified lines
153154
154155 map = c->al->map;
155156 addr = c->al->addr;
157+ dso = map ? map__dso(map) : NULL;
156158
157− if (map && map->dso)
158− srcfile = get_srcline_split(map->dso, map__rip_2objdump(map, addr), &line);
159+ if (dso)
160+ srcfile = get_srcline_split(dso, map__rip_2objdump(map, addr), &line);
159161
160162 if (get_srccode) {
161163 if (srcfile)