Commit Graph

302 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
2e5ee04889 pprof: indicate if using remote profile
Missing profile file is common source of confusion. So a bit more
clarify is useful.
2014-11-02 18:29:55 -08:00
Aliaksey Kandratsenka
6efe96b41c issue-493: correctly detect __ARM_ARCH_6ZK__ for MemoryBarrier
Which should fix issue reported by user pedronavf
2014-11-02 18:29:38 -08:00
Aliaksey Kandratsenka
8e97626378 issue-655: use safe getenv for aggressive decommit mode flag
Because otherwise we risk deadlock due to too early use of getenv on
windows.
2014-11-02 11:28:30 -08:00
Aliaksey Kandratsenka
8c3dc52fcf issue-654: [pprof] handle split text segments
This applies patch by user simonb.

Quoting:

Relocation packing splits a single executable load segment into two.  Before:

  LOAD           0x000000 0x00000000 0x00000000 0x2034d28 0x2034d28 R E 0x1000
  LOAD           0x2035888 0x02036888 0x02036888 0x182d38 0x1a67d0 RW  0x1000

After:
  LOAD           0x000000 0x00000000 0x00000000 0x14648 0x14648 R E 0x1000
  LOAD           0x014648 0x0020c648 0x0020c648 0x1e286e0 0x1e286e0 R E 0x1000
  ...
  LOAD           0x1e3d888 0x02036888 0x02036888 0x182d38 0x1a67d0 RW  0x1000

The .text section is in the second LOAD, and this is not at
offset/address zero.  The result is that this library shows up in
/proc/self/maps as multiple executable entries, for example (note:
this trace is not from the library dissected above, but rather from an
earlier version of it):

  73b0c000-73b21000 r-xp 00000000 b3:19 786460 /data/.../libchrome.2160.0.so
  73b21000-73d12000 ---p 00000000 00:00 0
  73d12000-75a90000 r-xp 00014000 b3:19 786460 /data/.../libchrome.2160.0.so
  75a90000-75c0d000 rw-p 01d91000 b3:19 786460 /data/.../libchrome.2160.0.so

When parsing this, pprof needs to merge the two r-xp entries above
into a single entry, otherwise the addresses it prints are incorrect.

The following fix against 2.2.1 was sufficient to make pprof --text
print the correct output.  Untested with other pprof options.
2014-10-18 16:35:57 -07:00
Ricardo M. Correia
44c61ce6c4 Fix parsing /proc/pid/maps dump in CPU profile data file
When trying to use pprof on my machine, the symbols of my program were
not being recognized.

It turned out that pprof, when calculating the offset of the text list
of mapped objects (the last section of the CPU profile data file), was
assuming that the slot size was always 4 bytes, even on 64-bit machines.

This led to ParseLibraries() reading a lot of garbage data at the
beginning of the map, and consequently the regex was failing to match on
the first line of the real (non-garbage) map.
2014-10-11 16:37:29 -07:00
Aliaksey Kandratsenka
2a28ef24dd Added remaining memory allocated info to 'Exiting' dump message
This applies patch by user yurivict.
2014-09-06 16:49:24 -07:00
Adam McNeeney
bbf346a856 Cope with new addr2line outputs for DWARF4
Copes with ? for line number (converts to 0).
Copes with (discriminator <num>) suffixes to file/linenum (removes).

Change-Id: I96207165e4852c71d3512157864f12d101cdf44a
2014-08-23 14:59:30 -07:00
Aliaksey Kandratsenka
b08d760958 issue-641: Added --show_addresses option
This applies patch by user yurivict.
2014-08-23 14:47:04 -07:00
Aliaksey Kandratsenka
3c326d9f20 issue-644: fix possible out-of-bounds access in GetenvBeforeMain
As suggested by user Ivan L.
2014-08-19 08:30:07 -07:00
jiakai
f1ae3c446f Add an option to allow disabling stripping template argument in pprof 2014-08-01 22:14:16 -07:00
Aliaksey Kandratsenka
a12890df25 issue-635: allow whitespace in libraries paths
This applies change suggested by user mich...@sebesbefut.com
2014-07-26 14:12:42 -07:00
Aliaksey Kandratsenka
d5e36788d8 issue-636: fix prof/web command on Windows/MinGW
This applies patch sent by user chaishushan.
2014-07-26 14:04:26 -07:00
Michael Pasieka
4b788656bb added option to display stack traces in output for heap checker
Quoting from email:

I had the same question as William posted to stack overflow back on
Dec 9,2013: How to display symbols in stack trace of google-perftools
heap profiler (*).  I dug into the source and realized the
functionality was not there but could be added. I am hoping that
someone else will find this useful/helpful.

The patch I created will not attach so I am adding below.

Enjoy!

-- Michael

* http://stackoverflow.com/questions/20476918/how-to-display-symbols-in-stack-trace-of-google-perftools-heap-profiler
2014-07-13 18:15:20 -07:00
WenSheng He
3abb5cb819 issue-630: The env var should be "CPUPROFILE"
To enable cpu profile, the env var should be "CPUPROFILE", not "PROFILE"
actually.

Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2014-07-06 18:51:27 -07:00
Aliaksey Kandratsenka
fd81ec2578 issue-631: fixed miscompilation of debugallocation without mmap
This applies patch sent by user iamxujian.

Clearly, when I updated debugallocation to fix issue-464 I've broken
no-mmap path by forgetting closing brace.
2014-06-28 13:05:12 -07:00
Aliaksey Kandratsenka
2e90b6fd72 bumped version to 2.2.1 2014-06-21 15:52:34 -07:00
Aliaksey Kandratsenka
577b940cc0 updated NEWS for 2.2.1 2014-06-21 15:52:31 -07:00
Aliaksey Kandratsenka
2fe4b329ad applied chromium patch fixing some build issue on android
This applies patch from: https://codereview.chromium.org/284843002/ by
jungjik.lee@samsung.com
2014-06-21 12:12:04 -07:00
Aliaksey Kandratsenka
c009398e32 issue-628:package missing stacktrace_powerpc-{linux,darwin}-inl.h
This headers were missing in .tar.gz because they were not mentioned
anywhere in Makefile.am.
2014-06-15 12:58:29 -07:00
Adhemerval Zanella
81d99f21ed issue-626: Fix SetupAggressiveDecommit initialization
This patch fixes the SetupAggressiveDecommit initialization to run after
pageheap_ creation.  Current code it not enforcing it, since
InitStaticVars is being called outside the static_vars module.
2014-06-03 07:50:56 -05:00
Aliaksey Kandratsenka
846b775dfa bumped version to 2.2 2014-05-03 18:01:12 -07:00
Aliaksey Kandratsenka
cdf8e1e932 updated NEWS for 2.2 2014-05-03 17:59:42 -07:00
Aliaksey Kandratsenka
0807476f56 issue-620: windows dll patching: fixed delete of old stub code
After code for issue 359 was applied PreamblePatcher started using
it's own code to manage memory of stub code fragments. It's not using
new[] anymore. And it automatically frees stub code memory on
Unpatch.

Clearly, author of that code forgot to remote that no more needed
delete call. With that delete call we end up trying to free memory
that was never allocated with any of known allocators and crash.
2014-05-03 17:38:14 -07:00
Aliaksey Kandratsenka
facd7e83b3 bumped version to 2.1.90 2014-04-19 13:16:20 -07:00
Aliaksey Kandratsenka
e8e082af25 updated NEWS for 2.2rc 2014-04-19 13:16:20 -07:00
Aliaksey Kandratsenka
802fdb739e issue-610: use TCMallocGetenvSafe from inside malloc
Instead of plain getenv. So that windows getenv implementation that
may call malloc does not deadlock.
2014-04-12 18:08:46 -07:00
Aliaksey Kandratsenka
6b83516ade issue-610: made dynamic_annotations.c use TCMallocGetenvSafe 2014-04-12 18:06:32 -07:00
Aliaksey Kandratsenka
aeef3b4420 issue-610: introduced TCMallocGetenvSafe
This is version of GetenvBeforeMain that's available to C code.
2014-04-12 18:05:59 -07:00
Aliaksey Kandratsenka
125e5ed58b don't enable backtrace() for stacktrace capturing by default
Because we don't yet have a treatment for deadlocks that are caused by
(recursive) use of malloc from within that facility.
2014-04-12 18:05:37 -07:00
Raphael Moreira Zinsly
75b65f96b0 PowerPC: stacktrace function refactor and fixes
This patch fixes the stacktrace creating when the function is
interrupted by a signal. For Linux, the vDSO signal trampoline symbol is
compared against LR from stack backchain and handled different in that
case (since the signal trampoline layout a different stack frame).

Because of this extensive change the PowerPC stacktrace code has now
been refactored to split in Linux and Darwin specific codes.
2014-04-12 11:14:43 -07:00
Raphael Moreira Zinsly
8deea9ff2a VDSOsupport cleanup
This patch cleans up unused VDSO getcpu racking from VDSOsupport class,
since the code is not used anywhere in gperftools and symbol name is not
architecture independent.
2014-04-12 11:14:43 -07:00
Raphael Moreira Zinsly
9d5e1a0aa5 Fixed issues with heap checker on PPC64 LE.
Fixed the wrapper for the syscall sys_clone and the test for heap
checker on PPC64 LE. Both use the ODP structure, which is only
used on BE architectures.
2014-04-12 11:14:43 -07:00
Raphael Moreira Zinsly
49237462c8 Fixed the way that pprof packed profile data in BE.
pprof was writing profile data in a way that only works for little-endian
files, this patch verifies if the system is big-endian and writes packed
data correctly.
2014-04-12 11:14:42 -07:00
Raphael Moreira Zinsly
a1ae66ef11 Fixed the use of addr2line to discover the separator symbol.
In systems where addr2line has a version greater than 2.22 pprof fails
in discover the separator symbol (_fini). This patch identifies if
addr2line can find the symbol, otherwise pprof uses objdump to recover
a address that addr2line's newer versions can recognize as the separator
function.
2014-04-12 11:14:42 -07:00
Aliaksey Kandratsenka
8b2e5ee831 issue-614: use tc_memalign in ReallocAfterMemalloc test
Because some OSes lack plain memalign. And we really need to test our
implementation which is always available via tc_malloc.
2014-04-07 12:29:35 -07:00
Aliaksey Kandratsenka
0399af1019 added tc_malloc_skip_new_handler
This is port of corresponding chromium change at:
https://codereview.chromium.org/55333002/

Basic idea is that sometimes apps that use tc_set_new_mode in order to
have C++ out-of-memory handler catch OOMs in malloc, need to invoke
usual malloc that returns 0 on OOM.

That new API is exactly for that. It'll always return NULL on OOM even
if tc_new_mode is set to true.
2014-04-01 22:07:31 -07:00
Aliaksey Kandratsenka
d77317247e issue deprecation warning on use of google/ headers 2014-04-01 22:06:22 -07:00
Aliaksey Kandratsenka
e7297f0c14 speed up MallocExtension::instance()
It was reported that pthread_once is expensive, especially on ppc.

In new implementation in hot path instead of doing potentially
expensive atomic read with barrier, we do just plain read.

It's slightly less robust than older implementation, but it should be
faster.

New code is making assumption that programs do not spawn threads
before main() is called. And therefore all variables & modules are
initialized before threads are created. Which looks like pretty safe
assumption. With that assumption, doing plain read is safe, because
current_instance is initialized as part of module init and therefore
before threads are spawned.

This patch is based on feedback of Adhemerval Zanella.
2014-03-29 13:43:38 -07:00
Adhemerval Zanella
df22779436 Fix getpc_test for PPC64v2 LE
This patch fix the PPC64 guard to get the function address for PPC64v2.
It removes the use of an indirection (to get the ODP text address),
since the PPCv2 does not have function descriptors.
2014-03-29 13:35:36 -07:00
Aliaksey Kandratsenka
e3deb42d5d issue-613: remove friend declaration from HeapLeakChecker
This applies patch by davide.italiano@10gen.com:

heap-checker.h contains the following friend declaration of main:
friend int main(int, char**).

C99 allows another declaration of main, i.e. int main(int, char**,
char**), and if code uses it and includes the heap-checker header,
this might result in a conflict, e.g.

error: declaration of C function 'int main(int, char**, char**)' conflicts with
 int main(int argc, char* argv[], char** envp)

Actually the comment above the friend declaration of main() mentions
that this is required to get the unittest working and for other
internal usage, but I'm not completely sure if this is true as long as
I'm able to build and run the unittest removing the declaration.
2014-03-29 13:32:23 -07:00
Aliaksey Kandratsenka
1a28754656 issue-612: added missing include for std::min
Otherwise Visual Studio 2013 rightfully complains
2014-03-29 13:25:10 -07:00
Aliaksey Kandratsenka
fe56631426 unbreak building with libunwind
Caused by premature merging of previous patch.

When we're searching for backtrace in libexecinfo and don't find it,
we should not reset UNWIND_LIBS to empty value.

Correct fix is to first search for backtrace in libunwind and then to
search for it in libexecinfo.
2014-03-01 12:45:03 -08:00
Thomas Klausner
9117996149 Look for backtrace() in libexecinfo as well.
Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2014-03-01 11:34:04 -08:00
Thomas Klausner
fd3379a213 Fix unportable test(1) construct.
Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2014-03-01 11:29:22 -08:00
Thomas Klausner
a7223c2a14 Test for memalign in configure.ac. Disable a test that uses memalign if it is not found.
Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
2014-03-01 11:26:27 -08:00
Aliaksey Kandratsenka
bd9665ebbe issue-489: added tcmalloc test pass with chromium-style decommit 2014-02-22 13:46:42 -08:00
Aliaksey Kandratsenka
6a000d6dd5 issue-489: added unit test for chromium-style decommitting 2014-02-22 13:46:11 -08:00
Aliaksey Kandratsenka
eb2d69014c issue-489: made tests pass on enabled chromium-style decommitting 2014-02-22 13:10:08 -08:00
Aliaksey Kandratsenka
a92fc76f72 issue-489: enable chromium-style decommitting on env variable
TCMALLOC_AGGRESSIVE_DECOMMIT=t now enables aggressive decommitting by
default.
2014-02-22 13:09:33 -08:00
Aliaksey Kandratsenka
c7ce50cd04 issue-489: implemented API to set chromium-style de-committing
Chrome has code to decommit (release back to OS) every span that's
released. I don't want to make it default, but indeed some
applications may want to enable this mode.

The code itself is taken from 2-way-merging of code from Chromium
fork.
2014-02-22 12:37:54 -08:00