1

I've managed to build and install Valgrind on a rooted device as described here. The problem is, I need to profile a native library in a rather large app, and Valgrind tries to analyze the whole process, including the ART runtime itself. When the app starts, it pushes out massive amounts of logs regarding the runtime, displaying a couple of ANRs in the process. If I let it run for like a minute, it crashes with the following log because, I guess, there is a timeout of some sort imposed by the system:

A/OpenGLRenderer: Encountered EGL error 12302 EGL_CONTEXT_LOST during rendering
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 31435 (RenderThread)
I/start_valgrind.sh: ==31362== Process terminating with default action of signal 6 (SIGABRT)
I/start_valgrind.sh: ==31362==    at 0x49766A8: tgkill (in /system/lib/libc.so)
I/start_valgrind.sh: ==31362==    by 0x49539BF: pthread_kill (in /system/lib/libc.so)

It doesn't even get to display the main activity, everything happens during its initialization. Is there any way to use Valgrind only on that specific JNI library, without it touching the rest of the app, let alone the runtime?

Community
  • 1
  • 1
Grishka
  • 2,465
  • 1
  • 20
  • 38
  • Disabling hardware acceleration in the manifest fixed the OpenGL-related crash so the app does start, but I'm still curious if there's a way to not profile the whole VM. – Grishka Aug 10 '16 at 01:52
  • You could try to write some simple wrapper for your library (some hello world), I think. Or you could also try **gperftools** – c4pQ Aug 10 '16 at 21:24

0 Answers0