OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # Attach gdb to a running android application. Similar to ndk-gdb. | 7 # Attach gdb to a running android application. Similar to ndk-gdb. |
8 # Run with --annotate=3 if running under emacs (M-x gdb). | 8 # Run with --annotate=3 if running under emacs (M-x gdb). |
9 # | 9 # |
10 # By default it is used to debug content shell, if it is used to | 10 # By default it is used to debug content shell, if it is used to |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 # gdb commands | 152 # gdb commands |
153 cmdfile=$(mktemp /tmp/gdb_android_XXXXXXXX) | 153 cmdfile=$(mktemp /tmp/gdb_android_XXXXXXXX) |
154 cat >$cmdfile<<EOF | 154 cat >$cmdfile<<EOF |
155 # set solib-absolute-prefix null | 155 # set solib-absolute-prefix null |
156 set solib-search-path ${shared_lib_dir} | 156 set solib-search-path ${shared_lib_dir} |
157 file ${app_process} | 157 file ${app_process} |
158 target remote :4321 | 158 target remote :4321 |
159 EOF | 159 EOF |
160 | 160 |
161 gdb=$(echo $ANDROID_TOOLCHAIN/*gdb) | 161 gdb=$(echo $ANDROID_TOOLCHAIN/../../linux-x86/bin/*gdb) |
162 if [[ ! -f ${gdb} ]] ; then | 162 if [[ ! -f ${gdb} ]] ; then |
163 echo "Wow no gdb in env var ANDROID_TOOLCHAIN which is $ANDROID_TOOLCHAIN" | 163 echo "Wow no gdb in env var ANDROID_TOOLCHAIN which is $ANDROID_TOOLCHAIN" |
164 exit 4 | 164 exit 4 |
165 else | 165 else |
166 echo Using $gdb | 166 echo Using $gdb |
167 fi | 167 fi |
168 | 168 |
169 # ${gdb} -x $cmdfile $* $app_process | 169 # ${gdb} -x $cmdfile $* $app_process |
170 ${gdb} -x $cmdfile $gdb_args | 170 ${gdb} -x $cmdfile $gdb_args |
171 rm $cmdfile | 171 rm $cmdfile |
OLD | NEW |