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 content shell. Similar to ndk-gdb. | 7 # Attach gdb to a running content shell. 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 # TODO(jrg): allow package_name and shared_lib_dir to be set on the | 10 # TODO(jrg): allow package_name and shared_lib_dir to be set on the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 # Pull app_process and C libraries from device if needed | 65 # Pull app_process and C libraries from device if needed |
66 app_process=${shared_lib_dir}/app_process | 66 app_process=${shared_lib_dir}/app_process |
67 if [[ ! -f ${app_process} ]] ; then | 67 if [[ ! -f ${app_process} ]] ; then |
68 adb pull /system/bin/app_process ${app_process} | 68 adb pull /system/bin/app_process ${app_process} |
69 adb pull /system/lib/libc.so ${shared_lib_dir} | 69 adb pull /system/lib/libc.so ${shared_lib_dir} |
70 fi | 70 fi |
71 | 71 |
72 # gdb commands | 72 # gdb commands |
73 cmdfile=$(mktemp /tmp/gdb_android_XXXXXXXX) | 73 cmdfile=$(mktemp /tmp/gdb_android_XXXXXXXX) |
74 cat >$cmdfile<<EOF | 74 cat >$cmdfile<<EOF |
75 set solib-absolute-prefix null | 75 # set solib-absolute-prefix null |
76 set solib-search-path ${shared_lib_dir} | 76 set solib-search-path ${shared_lib_dir} |
| 77 file ${app_process} |
77 target remote :4321 | 78 target remote :4321 |
78 EOF | 79 EOF |
79 | 80 |
80 gdb=$(echo $ANDROID_TOOLCHAIN/*gdb) | 81 gdb=$(echo $ANDROID_TOOLCHAIN/*gdb) |
81 if [[ ! -f ${gdb} ]] ; then | 82 if [[ ! -f ${gdb} ]] ; then |
82 echo "Wow no gdb in env var ANDROID_TOOLCHAIN which is $ANDROID_TOOLCHAIN" | 83 echo "Wow no gdb in env var ANDROID_TOOLCHAIN which is $ANDROID_TOOLCHAIN" |
83 exit 4 | 84 exit 4 |
84 else | 85 else |
85 echo Using $gdb | 86 echo Using $gdb |
86 fi | 87 fi |
87 | 88 |
88 ${gdb} -x $cmdfile $* $app_process | 89 # ${gdb} -x $cmdfile $* $app_process |
| 90 ${gdb} -x $cmdfile $* |
89 rm $cmdfile | 91 rm $cmdfile |
OLD | NEW |