2015-06-03 08:54:13

by Wang Nan

[permalink] [raw]
Subject: [PATCH tip] perf tools: Fix a compiling problem

Commit 4bb11d012ab248d0e383008d725be0d26a74fac2 ("perf tools: Add
dso__data_get/put_fd()") has a problem: it uses a undefined variable
'dso' in find_proc_info(), which should be 'map->dso'. The buggy code
piece is not compiled if NO_LIBUNWIND_DEBUG_FRAME is not set.

Signed-off-by: Wang Nan <[email protected]>
---
tools/perf/util/unwind-libunwind.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index f079b63..4c00507 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -360,7 +360,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
unw_word_t base = is_exec ? 0 : map->start;

if (fd >= 0)
- dso__data_put_fd(dso);
+ dso__data_put_fd(map->dso);

memset(&di, 0, sizeof(di));
if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->name,
--
1.8.3.4


2015-06-03 12:31:22

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH tip] perf tools: Fix a compiling problem

Hi Wang,

On Wed, Jun 3, 2015 at 5:50 PM, Wang Nan <[email protected]> wrote:
> Commit 4bb11d012ab248d0e383008d725be0d26a74fac2 ("perf tools: Add
> dso__data_get/put_fd()") has a problem: it uses a undefined variable
> 'dso' in find_proc_info(), which should be 'map->dso'. The buggy code
> piece is not compiled if NO_LIBUNWIND_DEBUG_FRAME is not set.
>
> Signed-off-by: Wang Nan <[email protected]>

Acked-by: Namhyung Kim <[email protected]>

Thanks for fixing this!
Namhyung


> ---
> tools/perf/util/unwind-libunwind.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
> index f079b63..4c00507 100644
> --- a/tools/perf/util/unwind-libunwind.c
> +++ b/tools/perf/util/unwind-libunwind.c
> @@ -360,7 +360,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
> unw_word_t base = is_exec ? 0 : map->start;
>
> if (fd >= 0)
> - dso__data_put_fd(dso);
> + dso__data_put_fd(map->dso);
>
> memset(&di, 0, sizeof(di));
> if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->name,
> --
> 1.8.3.4
>



--
Thanks,
Namhyung

2015-06-17 11:54:54

by Wang Nan

[permalink] [raw]
Subject: Re: [PATCH tip] perf tools: Fix a compiling problem

Please note that a similar patch has been applied by Arnaldo Carvalho de
Melo:

http://lkml.kernel.org/r/[email protected]

On 2015/6/3 20:30, Namhyung Kim wrote:
> Hi Wang,
>
> On Wed, Jun 3, 2015 at 5:50 PM, Wang Nan <[email protected]> wrote:
>> Commit 4bb11d012ab248d0e383008d725be0d26a74fac2 ("perf tools: Add
>> dso__data_get/put_fd()") has a problem: it uses a undefined variable
>> 'dso' in find_proc_info(), which should be 'map->dso'. The buggy code
>> piece is not compiled if NO_LIBUNWIND_DEBUG_FRAME is not set.
>>
>> Signed-off-by: Wang Nan <[email protected]>
> Acked-by: Namhyung Kim <[email protected]>
>
> Thanks for fixing this!
> Namhyung
>
>
>> ---
>> tools/perf/util/unwind-libunwind.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
>> index f079b63..4c00507 100644
>> --- a/tools/perf/util/unwind-libunwind.c
>> +++ b/tools/perf/util/unwind-libunwind.c
>> @@ -360,7 +360,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
>> unw_word_t base = is_exec ? 0 : map->start;
>>
>> if (fd >= 0)
>> - dso__data_put_fd(dso);
>> + dso__data_put_fd(map->dso);
>>
>> memset(&di, 0, sizeof(di));
>> if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->name,
>> --
>> 1.8.3.4
>>
>
>