tfzxyinhao / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Hooked allocator frame not found, returning empty trace message is displayed in heapprofiler #407

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. i built gperf 2.0 in the cross compile environment for arm
2. there is no issue to use tcmalloc and cpu profiler
3. but, when i use heap profiler, there is an error like below
   "Hooked allocator frame not found, returning empty trace"

What is the expected output? What do you see instead?

<expected output>
Dumping heap profile to ./mybin.hprof.0161.heap (1 MB allocated cumulatively, 1 
MB currently in use)

<current output>
Hooked allocator frame not found, returning empty trace

i tried to use ./configure --enable-frame-pointers, but same error is happened 
again

What version of the product are you using? On what operating system?
O/S : linux 2.6.36
perf : 2.0

Please provide any additional information below.
- i used scratchbox2 to build tcmalloc for arm

Original issue reported on code.google.com by bokun.c...@gmail.com on 27 Feb 2012 at 10:45

Attachments:

GoogleCodeExporter commented 9 years ago
I did almost exact the same thing you have done and got exact the same problem, 
but my OS is Linux 2.6.32.12-0.7 with  Intel X64, buiding with g++.

Original comment by meng.mob...@gmail.com on 1 Mar 2012 at 1:20

GoogleCodeExporter commented 9 years ago
The function generating this message seems to have a comment regarding this 
issue. Refer to the comment at the end of the function 
MallocHook_GetCallerStackTrace in the file src/malloc_hook.cc. If that doesn't 
work then I would do the following:

1. Set a breakpoint in this function using gdb and generate a full backtrace.
2. Instrument this function to print out the backtrace as it is generating it.

From the results above we should be able to further determine where things are 
going wrong.

-Dave

Original comment by chapp...@gmail.com on 2 Mar 2012 at 4:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I added callstack

(gdb)  b MallocHook_GetCallerStackTrace
Breakpoint 2 at 0x401afd60: file src/malloc_hook.cc, line 655.
(gdb) c
Continuing.

Breakpoint 2, MallocHook_GetCallerStackTrace (result=0xbecd66b8, max_depth=32, 
skip_count=4) at src/malloc_hook.cc:655
1: x/i $pc
=> 0x401afd60 <MallocHook_GetCallerStackTrace(void**, int, int)+8>:
    ldr r10, [pc, #404] ; 0x401afefc <MallocHook_GetCallerStackTrace(void**, int, int)+420>

(gdb) bt full
#0  MallocHook_GetCallerStackTrace (result=0xbecd66b8, max_depth=32, 
skip_count=4) at src/malloc_hook.cc:655
        stack =           {0x400fa020,
          0x0,
          0x1,
          0x2d5,
          0x0,
          0x400fa020,
          0x40197c7e,
          0x40197c7e,
          0x401917e4,
          0x40190d04,
          0x1,
          0x4018dfb4,
          0x400fa1d8,
          0xe16ee263,
          0xbecd6714,
          0x401912d4,
          0x400fa020,
          0x40197c7e,
          0xffffffff,
          0xbecd66fc,
          0x401d5560,
          0x400cb4c0,
          0x41025000,
          0x400cb000,
          0x400fa020,
          0x4a690,
          0x4018b000,
          0xbecd6824,
          0x4100db38,
          0x0,
          0x1,
          0x1,
          0x0,
          0xbecd6734,
          0x401912d4,
          0xbecd6700,
          0x401d5560,
          0x15588,
          0xbecd66b8,
          0x1,
          0x3e8,
          0x3e8,
          0x0,
          0xc4000}
        depth = <value optimized out>
#1  0x401b7914 in RecordAlloc (ptr=0xc4000, size=1000) at 
src/heap-profiler.cc:303
        stack =           {0x0,
          0x400fa1d8,
          0x41025000,
          0x0,
          0x40190d04,
          0x400fa020,
          0xbecd679c,
          0xffffffff,
          0xbecd6768,
          0xc4000,
          0x400cb4c0,
          0x41025000,
          0x400cb000,
          0x400fa020,
          0x4ac28,
          0x4018b000,
          0xbecd6824,
          0x4100db38,
          0x0,
          0x1,
          0x1,
          0x0,
          0x400fa020,
          0x40190d04,
          0x400cb4c0,
          0xc4000,
          0x3e8,
          0xbecd675c,
          0x928e0,
          0x928e0,
          0xc4000,
          0x0,
          0x3e8}
        depth = <value optimized out>
#2  NewHook (ptr=0xc4000, size=1000) at src/heap-profiler.cc:326
No locals.
#3  0x401b00f4 in MallocHook::InvokeNewHookSlow (p=0xc4000, s=1000) at 
src/malloc_hook.cc:525
        i = <value optimized out>
        hooks =           {0x401b78e4 <NewHook(void const*, size_t)>,

          0x928e0 <std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > std::money_put<wchar_t, std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> > >::_M_insert<false>(std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >, std::ios_base&, wchar
_t, std::basic_string<wchar_t, std::char_traits<wchar_t>, 
std::allocator<wchar_t> > const&) const+1756>,
          0xc4000,
          0,
          0x3e8,
          0xbecd6824,
          0x41014018}
        num_hooks = 1
#4  0x401bf12c in InvokeNewHook (size=1000) at src/malloc_hook-inl.h:161
        hook = <value optimized out>
#5  tc_malloc (size=1000) at src/tcmalloc.cc:1493
        result = 0xc4000
#6  0x00008ad0 in main () at multithread_heapprofiler.c:99
        pAtr = 0x8b44 "\370E-\351"
        p_thread =           {34748,
          35144,
          35732,
          1104460656,
          0}
        status = 0
        j = 0
        rotate = 0

Original comment by bokun.c...@gmail.com on 5 Mar 2012 at 9:23

GoogleCodeExporter commented 9 years ago
I found the same problem with GCC 4.7 on Fedora 17. I got it to work by 
manually editing the makefile to add -fno-omit-frame-pointers, as per revision 
150.

Original comment by michael....@gmail.com on 19 Jun 2012 at 2:10

GoogleCodeExporter commented 9 years ago
-fno-omit-frame-pointers is now explicitly specified for i386 as gcc changed 
the default to omit. Code is on the trunk at the present time waiting for 
release. Refer to issue-385.

Original comment by chapp...@gmail.com on 11 Mar 2013 at 2:04