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
145 char *srccode = NULL;145 char *srccode = NULL;
146 PyObject *result;146 PyObject *result;
147 struct map *map;147 struct map *map;
148 struct dso *dso;
148 int len = 0;149 int len = 0;
149 u64 addr;150 u64 addr;
150 151
@@ -153,9 +154,10 @@ static PyObject *perf_sample_src(PyObject *obj, PyObject *args, bool get_srccode · 2 unmodified lines
153 154
154 map = c->al->map;155 map = c->al->map;
155 addr = c->al->addr;156 addr = c->al->addr;
157 dso = map ? map__dso(map) : NULL;
156 158
157 if (map && map->dso)159 if (dso)
158 srcfile = get_srcline_split(map->dso, map__rip_2objdump(map, addr), &line);160 srcfile = get_srcline_split(dso, map__rip_2objdump(map, addr), &line);
159 161
160 if (get_srccode) {162 if (get_srccode) {
161 if (srcfile)163 if (srcfile)