cynthia / gperftools

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

pprof can't work on vs2010 #392

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I have a program(xxx.exe) used by vs2010, and use pprof --text xxx.exe 
test.txt
2. and then output info:
Total: 1.0 MB
     1.0  96.3%  96.3%      1.0  96.3% sidestep::MiniDisassembler::s_ia32_opcode_map_
     0.0   3.7% 100.0%      0.0   3.7% `string'
     0.0   0.0% 100.0%      0.0   0.4% 0x0000000000ed1495
     0.0   0.0% 100.0%      0.0   0.8% 0x0000000000ed14b1
     0.0   0.0% 100.0%      0.0   1.5% 0x0000000000ed14cd
     0.0   0.0% 100.0%      0.0   0.4% 0x0000000000ed14e9
     0.0   0.0% 100.0%      0.0   0.7% 0x0000000000ed1505
     0.0   0.0% 100.0%      1.0  96.3% 0x0000000000ed151f
     0.0   0.0% 100.0%      1.0 100.0% 0x0000000000ed19fe
     0.0   0.0% 100.0%      1.0 100.0% 0x0000000000ed1bce
     0.0   0.0% 100.0%      1.0 100.0% BaseThreadInitThunk
     0.0   0.0% 100.0%      1.0 100.0% RtlpLowFragHeapAllocFromContext
     0.0   0.0% 100.0%      1.0  96.3% std::_Debug_lt

3. test.txt:
heap profile:      6:  1089248 [     7:  1090272] @ heapprofile
     1:  1048576 [     1:  1048576] @ 0x66adff3a 0x66aae8db 0x00ed1520 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e
     1:    16384 [     1:    16384] @ 0x66ae016c 0x00ed14ce 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e
     1:     8192 [     1:     8192] @ 0x66ae016c 0x00ed14b2 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e
     1:     8000 [     1:     8000] @ 0x66ae016c 0x00ed1506 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e
     1:     4096 [     1:     4096] @ 0x66ae016c 0x00ed1496 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e
     1:     4000 [     1:     4000] @ 0x66ae016c 0x00ed14ea 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e
     0:        0 [     1:     1024] @ 0x66ae016c 0x00ed1462 0x00ed1bcf 0x00ed19ff 0x7701ed6c 0x7739377b 0x7739374e

MAPPED_LIBRARIES:
00ec0000-00edb000 r-xp 00000000 00:00 0           
D:\test\win32tcmalloc\Debug\win32tcmalloc.exe
77330000-7746c000 r-xp 00000000 00:00 0           C:\Windows\SYSTEM32\ntdll.dll
76fd0000-770a4000 r-xp 00000000 00:00 0           
C:\Windows\system32\kernel32.dll
756e0000-7572a000 r-xp 00000000 00:00 0           
C:\Windows\system32\KERNELBASE.dll
66a60000-66b48000 r-xp 00000000 00:00 0           
D:\test\win32tcmalloc\Debug\libtcmalloc_minimal-debug.dll
669a0000-66a57000 r-xp 00000000 00:00 0           
C:\Windows\system32\MSVCP100D.dll
66820000-66993000 r-xp 00000000 00:00 0           
C:\Windows\system32\MSVCR100D.dll
77480000-77485000 r-xp 00000000 00:00 0           C:\Windows\system32\PSAPI.DLL
75860000-758b7000 r-xp 00000000 00:00 0           
C:\Windows\system32\SHLWAPI.dll
76b00000-76b4e000 r-xp 00000000 00:00 0           C:\Windows\system32\GDI32.dll
76f00000-76fc9000 r-xp 00000000 00:00 0           C:\Windows\system32\USER32.dll
77490000-7749a000 r-xp 00000000 00:00 0           C:\Windows\system32\LPK.dll
759d0000-75a6d000 r-xp 00000000 00:00 0           C:\Windows\system32\USP10.dll
75a70000-75b1c000 r-xp 00000000 00:00 0           C:\Windows\system32\msvcrt.dll
76ee0000-76eff000 r-xp 00000000 00:00 0           C:\Windows\system32\IMM32.DLL
77260000-7732c000 r-xp 00000000 00:00 0           C:\Windows\system32\MSCTF.dll
6d590000-6d596000 r-xp 00000000 00:00 0           
C:\PROGRA~1\KASPER~1\KASPER~1.0FO\kloehk.dll
757c0000-75860000 r-xp 00000000 00:00 0           
C:\Windows\system32\ADVAPI32.dll
768e0000-768f9000 r-xp 00000000 00:00 0           
C:\Windows\SYSTEM32\sechost.dll
774b0000-77551000 r-xp 00000000 00:00 0           C:\Windows\system32\RPCRT4.dll

I use tcmalloc 1.9

Original issue reported on code.google.com by icery...@gmail.com on 11 Jan 2012 at 8:43

GoogleCodeExporter commented 9 years ago
How did you create xxx.exe?  Did you compile in debug mode or release mode?  
Did you have nm_pdb and the like installed on your system?

Original comment by csilv...@gmail.com on 12 Jan 2012 at 11:44

GoogleCodeExporter commented 9 years ago
How did you create xxx.exe?  Did you compile in debug mode or release mode?  
Did you have nm_pdb and the like installed on your system?
Create xxx.exe in vs2010, debug mode, and I have compiled nm_pdb and 
addr2line_pdb with vs2010.Used the same codes in vs2005, pprof works fine.
I suspect vs2010 pdb format is newer then vs2005,so I download latest dbghelp 
sdk, but pprof still can't output properly result.

This is my code:
#include "stdafx.h"
#include "google/heap-profiler.h"
#include "string.h"

int _tmain(int argc, _TCHAR* argv[])
{
    char * ccc = new char[1<< 20];
    HeapProfilerStart( "d:/test-heapprofile" );

    int * p = new int[256];
    delete []p;

    int * p1 = new int[1024];

    int * p2 = new int[2048];

    int * p3 = new int[4096];

    int * p4 = new int[1000];

    int * p5 = new int[2000];

    //HeapProfilerDump("test");

    strcpy(ccc, GetHeapProfile() );
    HeapProfilerStop();

    FILE * fp = fopen( "test.txt", "w+" );
    fwrite( ccc, strlen(ccc), 1, fp );
    fclose(fp);

    return 0;
}
---------------------------------------------
link command:
/OUT:"D:\test\win32tcmalloc\Debug\win32tcmalloc.exe" /INCREMENTAL /NOLOGO 
/LIBPATH:"D:\test\win32tcmalloc\Debug" "libtcmalloc_minimal-debug.lib" 
"kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" 
"advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" 
"odbccp32.lib" /INCLUDE:"__tcmalloc" /MANIFEST 
/ManifestFile:"Debug\win32tcmalloc.exe.intermediate.manifest" /ALLOWISOLATION 
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG 
/PDB:"D:\test\win32tcmalloc\Debug\win32tcmalloc.pdb" /MAP /MAPINFO:EXPORTS 
/SUBSYSTEM:CONSOLE /PGD:"D:\test\win32tcmalloc\Debug\win32tcmalloc.pgd" 
/TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE 

-------------------------------------
compler command:

/I"D:\test\google-perftools-1.9\src" /ZI /nologo /W3 /WX- /Od /Oy- /D "WIN32" 
/D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /GS 
/fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\win32tcmalloc.pch" 
/FAcs /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /analyze- 
/errorReport:queue 

Original comment by icery...@gmail.com on 13 Jan 2012 at 6:36

GoogleCodeExporter commented 9 years ago
Sorry for the delay in getting back to you; for some reason I didn't notice 
your response until now.

I think you may be right, this is a format change of some sort in VS2010 that 
wasn't in earlier versions.  I don't know anything about windows, so I'm not 
really qualified to debug this.  Do you have any ideas, or any leads how you 
might figure out what's going on?

Original comment by csilv...@gmail.com on 26 Jan 2012 at 1:08

GoogleCodeExporter commented 9 years ago
I will try to resolve it, vs2010 pdb format version is pdb10 and vs2005 pdb is 
pdb8,Maybe something wrong in addr2line_pdb. If I find anything about it, 
I'll give you message in here.

Original comment by icery...@gmail.com on 30 Jan 2012 at 2:27

GoogleCodeExporter commented 9 years ago
Just curious if there are any further developments here?

Original comment by chapp...@gmail.com on 21 Apr 2012 at 6:29

GoogleCodeExporter commented 9 years ago
I'm not sure I understand how you managed to build heap checker for windows. 
Can you elaborate ?

Original comment by alkondratenko on 30 Aug 2013 at 1:25