diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-05 11:21:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-06 09:44:28 -0400 |
commit | 76e20522b709f3772e415d70b108028454a86ad5 (patch) | |
tree | 6692095969ac6243c9ad607d22e0a98482b7126e /tools/perf/util/scripting-engines/trace-event-perl.c | |
parent | bd0419e2a5a9fd9396cb7dc69044f961f52e19f0 (diff) |
perf script perl: Do error checking on new backtrace routine
This ended up triggering these warnings when building on Ubuntu 12.04.5:
util/scripting-engines/trace-event-perl.c: In function 'perl_process_callchain':
util/scripting-engines/trace-event-perl.c:293:4: error: value computed is not used [-Werror=unused-value]
util/scripting-engines/trace-event-perl.c:294:4: error: value computed is not used [-Werror=unused-value]
util/scripting-engines/trace-event-perl.c:295:4: error: value computed is not used [-Werror=unused-value]
util/scripting-engines/trace-event-perl.c:297:4: error: value computed is not used [-Werror=unused-value]
util/scripting-engines/trace-event-perl.c:309:4: error: value computed is not used [-Werror=unused-value]
cc1: all warnings being treated as errors
mv: cannot stat `/tmp/build/perf/util/scripting-engines/.trace-event-perl.o.tmp': No such file or directory
make[4]: *** [/tmp/build/perf/util/scripting-engines/trace-event-perl.o] Error 1
Fix it by doing error checking when building the perl data structures
related to callchains.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@gmail.com>
Fixes: f7380c12ec6c ("perf script perl: Perl scripts now get a backtrace, like the python ones")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-perl.c')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index 1d160855cda9..35ed00a600fb 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -283,18 +283,27 @@ static SV *perl_process_callchain(struct perf_sample *sample, | |||
283 | if (!elem) | 283 | if (!elem) |
284 | goto exit; | 284 | goto exit; |
285 | 285 | ||
286 | hv_stores(elem, "ip", newSVuv(node->ip)); | 286 | if (!hv_stores(elem, "ip", newSVuv(node->ip))) { |
287 | hv_undef(elem); | ||
288 | goto exit; | ||
289 | } | ||
287 | 290 | ||
288 | if (node->sym) { | 291 | if (node->sym) { |
289 | HV *sym = newHV(); | 292 | HV *sym = newHV(); |
290 | if (!sym) | 293 | if (!sym) { |
294 | hv_undef(elem); | ||
295 | goto exit; | ||
296 | } | ||
297 | if (!hv_stores(sym, "start", newSVuv(node->sym->start)) || | ||
298 | !hv_stores(sym, "end", newSVuv(node->sym->end)) || | ||
299 | !hv_stores(sym, "binding", newSVuv(node->sym->binding)) || | ||
300 | !hv_stores(sym, "name", newSVpvn(node->sym->name, | ||
301 | node->sym->namelen)) || | ||
302 | !hv_stores(elem, "sym", newRV_noinc((SV*)sym))) { | ||
303 | hv_undef(sym); | ||
304 | hv_undef(elem); | ||
291 | goto exit; | 305 | goto exit; |
292 | hv_stores(sym, "start", newSVuv(node->sym->start)); | 306 | } |
293 | hv_stores(sym, "end", newSVuv(node->sym->end)); | ||
294 | hv_stores(sym, "binding", newSVuv(node->sym->binding)); | ||
295 | hv_stores(sym, "name", newSVpvn(node->sym->name, | ||
296 | node->sym->namelen)); | ||
297 | hv_stores(elem, "sym", newRV_noinc((SV*)sym)); | ||
298 | } | 307 | } |
299 | 308 | ||
300 | if (node->map) { | 309 | if (node->map) { |
@@ -306,7 +315,10 @@ static SV *perl_process_callchain(struct perf_sample *sample, | |||
306 | else if (map->dso->name) | 315 | else if (map->dso->name) |
307 | dsoname = map->dso->name; | 316 | dsoname = map->dso->name; |
308 | } | 317 | } |
309 | hv_stores(elem, "dso", newSVpv(dsoname,0)); | 318 | if (!hv_stores(elem, "dso", newSVpv(dsoname,0))) { |
319 | hv_undef(elem); | ||
320 | goto exit; | ||
321 | } | ||
310 | } | 322 | } |
311 | 323 | ||
312 | callchain_cursor_advance(&callchain_cursor); | 324 | callchain_cursor_advance(&callchain_cursor); |