perf unwind: Report error from dwfl_attach_state
authorMartin Vuille <[email protected]>
Sun, 18 Mar 2018 17:50:53 +0000 (13:50 -0400)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 20 Mar 2018 16:16:09 +0000 (13:16 -0300)
In verbose level 2, errors returned by libdw are reported in most cases,
but not when calling dwfl_attach_state.

Since elfutils v 0.160 (2014), dwfl_attach_state sets the error code to
report failure cause. On failure, log the reported error.

Signed-off-by: Martin Vuille <[email protected]>
Reviewed-by: Kim Phillips <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/unwind-libdw.c

index 8e969f28cc597e2d96d65029200fe639f4dba041..7bdd239c795c16f71ea5a25bf4e6085060feacbd 100644 (file)
@@ -236,7 +236,8 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
        if (err)
                goto out;
 
-       if (!dwfl_attach_state(ui->dwfl, EM_NONE, thread->tid, &callbacks, ui))
+       err = !dwfl_attach_state(ui->dwfl, EM_NONE, thread->tid, &callbacks, ui);
+       if (err)
                goto out;
 
        err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui);