diff options
author | Dave Allison <dallison@google.com> | 2014-09-09 21:56:11 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-09 21:56:11 +0000 |
commit | 8bc875bb40e5dc097100f1f4ab0a821d0e9c77cd (patch) | |
tree | dd633521d9f0236d50f579495fecd361efd2c0cd /scripts | |
parent | beecb20ed89e3c2efb5e41a321c1328f584f19d7 (diff) | |
parent | 72e4885cb6152c6bb4e5607d3aa3df2b8ed3a79d (diff) | |
download | android_development-8bc875bb40e5dc097100f1f4ab0a821d0e9c77cd.tar.gz android_development-8bc875bb40e5dc097100f1f4ab0a821d0e9c77cd.tar.bz2 android_development-8bc875bb40e5dc097100f1f4ab0a821d0e9c77cd.zip |
am 72e4885c: Merge "Add support for debugging ART to the dalvik.gdb script." into lmp-dev
* commit '72e4885cb6152c6bb4e5607d3aa3df2b8ed3a79d':
Add support for debugging ART to the dalvik.gdb script.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gdb/dalvik.gdb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/scripts/gdb/dalvik.gdb b/scripts/gdb/dalvik.gdb index cab0951d7..6ee8d1d71 100644 --- a/scripts/gdb/dalvik.gdb +++ b/scripts/gdb/dalvik.gdb @@ -49,3 +49,62 @@ document dbt frame. If omitted r5 will be used as the default (as the case in the interpreter and JIT'ed code). end + +# ART debugging. ART uses SIGSEGV signals for internal purposes. To allow +# gdb to debug programs using ART we need to treat this signal specially. We +# also set a breakpoint in a libart.so function to stop when the program +# hits an unexpected breakpoint +set $art_debug_enabled = 0 +define art-on + if $art_debug_enabled == 0 + # deal with SIGSEGV signals + handle SIGSEGV noprint nostop pass + + # set a breakpoint and record its number + set breakpoint pending on + break art_sigsegv_fault + set $art_bpnum = $bpnum + commands $art_bpnum + silent + printf "Caught SIGSEGV in user program\n" + end + set breakpoint pending auto + + printf "ART debugging mode is enabled.\n" + set $art_debug_enabled = 1 + else + printf "ART debugging mode is already enabled.\n" + end +end + +document art-on + Enter ART debugging mode. In ART debugging mode, SIGSEGV signals are ignored + by gdb unless they are not handled by ART itself. A breakpoint is + set to stop the program when an unexpected SIGSEGV signal is + encountered. + + To switch ART debugging mode off, use "art-off" +end + +define art-off + if $art_debug_enabled == 1 + # restore SIGSEGV to its default + handle SIGSEGV print stop pass + + # delete our breakpoint + delete $art_bpnum + + set $art_debug_enabled = 0 + printf "ART debugging mode is disabled.\n" + end +end + +document art-off + Leave ART debugging mode. Signal handling is restored to default settings. + + Use the command "art-on" to enable ART debugging mode. +end + +# switch on ART debugging +art-on + |