diff options
author | Android Partner Docs <noreply@android.com> | 2017-06-05 11:09:27 -0700 |
---|---|---|
committer | Clay Murphy <claym@google.com> | 2017-06-05 11:14:03 -0700 |
commit | 83b56759b44593801d5b6e652edeb98ade4e533a (patch) | |
tree | c03a2c0d3084cc2cb12d958b1ed5427ceced5083 /en/devices/tech/debug/valgrind.html | |
parent | 2bf528574d473cffad95b19a573a76afa4de0a93 (diff) | |
download | source.android.com-83b56759b44593801d5b6e652edeb98ade4e533a.tar.gz |
Docs: Changes to source.android.com
- 158035892 Docs: adding new debuggerd example, tombstone tip by hvm <hvm@google.com>
- 158034244 Update CTS/CTS-Verifier for 7.1 R6, 7.0 R10, 6.0 R19, 5.1... by claym <claym@google.com>
- 158023345 June 2017 security bulletin by daroberts <daroberts@google.com>
- 158019731 Replace 'devsite-landing-row-grey' and 'devsite-landing-r... by Android Partner Docs <noreply@android.com>
- 157774882 Remove Downloading a Prebuilt GCC section. by gdimino <gdimino@google.com>
- 157756391 Docs: Updating file system config title and content by hvm <hvm@google.com>
- 157752981 Docs: adding strace, moving valgrind out, minor tweak to ... by hvm <hvm@google.com>
- 157732029 Correct a small typo in FBE doc. by Android Partner Docs <noreply@android.com>
PiperOrigin-RevId: 158035892
Change-Id: I98ec6809ea33f58e29a3f12331cc2af5f3e8f627
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> |