diff options
author | Android Partner Docs <noreply@android.com> | 2017-06-06 19:33:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-06 19:33:39 +0000 |
commit | a529e1528ca5c613d511f816aeaba4e9daeb5d3d (patch) | |
tree | c03a2c0d3084cc2cb12d958b1ed5427ceced5083 /en/devices/tech/debug/valgrind.html | |
parent | 4814500d5e8e3acea8043cdd3f2710cd3cefe0ed (diff) | |
parent | 4ecfdb8d77e11f3bd0ab0638e23b332f3a1011a3 (diff) | |
download | source.android.com-a529e1528ca5c613d511f816aeaba4e9daeb5d3d.tar.gz |
Merge "Docs: Changes to source.android.com" am: 9e286c1def
am: 4ecfdb8d77
Change-Id: Id40db24934cc9246236053e4b7a3f1deb979c852
Diffstat (limited to 'en/devices/tech/debug/valgrind.html')
-rw-r--r-- | en/devices/tech/debug/valgrind.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/en/devices/tech/debug/valgrind.html b/en/devices/tech/debug/valgrind.html new file mode 100644 index 00000000..d8f1e42b --- /dev/null +++ b/en/devices/tech/debug/valgrind.html @@ -0,0 +1,75 @@ +<html devsite> + <head> + <title>Using Valgrind</title> + <meta name="project_path" value="/_project.yaml" /> + <meta name="book_path" value="/_book.yaml" /> + </head> + <body> + <!-- + Copyright 2017 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + +<p>The <a href="http://valgrind.org/">Valgrind</a> tool suite includes Memcheck +(for detecting memory-related errors in C and C++), Cachegrind (a cache +profiler), Massif (a heap profiler), and several other tools.</p> + +<p class="note"><strong>Note:</strong> While you can use Valgrind for Android +debugging, most Android platform developers use +<a href="/devices/tech/debug/asan.html">AddressSanitizer</a> instead.</p> + +<h2 id=build-valgrind>Building Valgrind</h2> +<p>To build Valgrind:</p> +<pre class="no-pretty-print"> +$ mmma -j6 external/valgrind +</pre> + +<h2 id=app-valgrind>Using on an application</h2> +<p>To use Valgrind on an application:</p> + +<pre class="no-pretty-print"> +$ adb shell setprop wrap.<em>app_name</em> "logwrapper valgrind" +$ adb shell am start -a android.intent.action.MAIN -n <em>app_name</em>/.MainActivity +</pre> + +<code><em>app_name</em></code> must be a fully-qualified name such as +<strong>com.google.example_app</strong>. + +<h2 id=server-valgrind>Using on the system server</h2> +<p>To run the system server with Valgrind:</p> + +<pre class="no-pretty-print"> +$ adb shell setprop wrap.system_server "logwrapper valgrind" +$ adb shell stop && adb shell start +</pre> + + +<h2 id=symbols-valgrind>Getting debug symbols</h2> +<p>For debug symbols, push unstripped libraries to <code>/data/local/symbols</code>:</p> +<pre class="no-pretty-print"> +$ adb shell mkdir /data/local/symbols +$ adb push $OUT/symbols /data/local/symbols +</pre> + +<h2 id=boot-valgrind>Using during boot up</h2> +<p>To use Valgrind during boot up, edit +<code>out/target/product/XXXX/root/init.rc</code> by changing</p> +<p><code>service example /system/bin/foo --arg1 --arg2</code></p> +<p>to:</p> +<p><code>service example /system/bin/logwrapper /system/bin/valgrind /system/bin/foo --arg1 --arg2</code></p> +<p>To see the effects, create a <code>boot.img</code> and reflash the +device.</p> + + </body> +</html> |