When change it with the following:
name = NULL;

 The whole gdb backtrace is:
#0  0xb804f424 in __kernel_vsyscall ()
#1  0x00b7dd80 in raise () from /lib/libc.so.6
#2  0x00b7f691 in abort () from /lib/libc.so.6
#3  0x00bb624b in __libc_message () from /lib/libc.so.6
#4  0x00bbe0f1 in _int_free () from /lib/libc.so.6
#5  0x00bc1bc0 in free () from /lib/libc.so.6
#6  0x0805d289 in perf_event::set_event_name (this=0xc94ff4,
    event_name=0x8089a6b "power:power_frequency") at perf/perf.cpp:153
#7  0x0805d752 in perf_bundle::add_event (this=0x8097de0,
    event_name=0x8089a6b "power:power_frequency") at perf/perf_bundle.cpp:68
#8  0x08054e7d in enumerate_cpus () at cpu/cpu.cpp:242
#9  0x0804e77d in main (argc=1, argv=0xbff2a7b4) at main.cpp:175

I think free "power:power_frequency" is the porblem.
At 2011-01-01 08:35:00,wkq5325 <wkq5...@163.com> wrote:

I get code from
git clone git://git.kernel.org/pub/scm/status/powertop/powertop.git

 The whole gdb backtrace is:

#0  0xb80ad424 in __kernel_vsyscall ()
#1  0x00b7dd80 in raise () from /lib/libc.so.6
#2  0x00b7f691 in abort () from /lib/libc.so.6
#3  0x00bb624b in __libc_message () from /lib/libc.so.6
#4  0x00bbe0f1 in _int_free () from /lib/libc.so.6
#5  0x00bc1bc0 in free () from /lib/libc.so.6
#6  0x0805d289 in perf_event::set_event_name (this=0xc94ff4,
    event_name=0x8089a4b "power:power_frequency") at perf/perf.cpp:152
#7  0x0805d732 in perf_bundle::add_event (this=0x8097de0,
    event_name=0x8089a4b "power:power_frequency") at perf/perf_bundle.cpp:68
#8  0x08054e7d in enumerate_cpus () at cpu/cpu.cpp:242
#9  0x0804e77d in main (argc=1, argv=0xbfaadf34) at main.cpp:175


Happy new year!

At 2011-01-01 00:01:28,"Sergey Senozhatsky" <sergey.senozhat...@gmail.com> 
wrote:

>On (12/31/10 18:28), wkq5325 wrote:
>>    Sorry, it can't work with
>> 
>>  name = NULL;
>> 
>
>Hm, could you please provide the whole gdb backtrace (bt)?
>
>I thought it will work. We don't have pointer initialization in .ctor
>so it could be anything and could pass `if (name)' check (which will
>cause freeing of unallocated memory).
>
>Do we have the exact stack traces for patched and unpatched versions?
>
>Happy new year!
>
>
>>  Same problem like before.
>> 
>>  >No, changing it to `if (!name)' will introduce bug.
>>  >Could you please try the following one:
>>  >
>>  >---
>>  >
>>  > perf/perf.cpp |    1 +
>>  > 1 files changed, 1 insertions(+), 0 deletions(-)
>>  >
>>  >diff --git a/perf/perf.cpp b/perf/perf.cpp
>>  >index c9758ff..2f2686b 100644
>>  >--- a/perf/perf.cpp
>>  >+++ b/perf/perf.cpp
>>  >@@ -177,6 +177,7 @@ void perf_event::set_cpu(int _cpu)
>>  > 
>>  > perf_event::perf_event(const char *event_name, int _cpu, int buffer_size)
>>  > {
>>  >+   name = NULL;
>>  >       set_event_name(event_name);
>>  >       perf_fd = -1;
>>  >       bufsize = buffer_size;
>>  >
>
>
>       Sergey



_______________________________________________
Discuss mailing list
Discuss@lesswatts.org
http://lists.lesswatts.org/listinfo/discuss

Reply via email to