| 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 | 7 |
| 8 # A generic script used to attach to a running Chromium process and | 8 # A generic script used to attach to a running Chromium process and |
| 9 # debug it. Most users should not use this directly, but one of the | 9 # debug it. Most users should not use this directly, but one of the |
| 10 # wrapper scripts like adb_gdb_content_shell | 10 # wrapper scripts like adb_gdb_content_shell |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 | 904 |
| 905 # Push gdbserver to the device | 905 # Push gdbserver to the device |
| 906 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER" | 906 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER" |
| 907 adb push $GDBSERVER $TARGET_GDBSERVER &>/dev/null | 907 adb push $GDBSERVER $TARGET_GDBSERVER &>/dev/null |
| 908 fail_panic "Could not copy gdbserver to the device!" | 908 fail_panic "Could not copy gdbserver to the device!" |
| 909 | 909 |
| 910 PORT=5039 | 910 PORT=5039 |
| 911 HOST_PORT=$PORT | 911 HOST_PORT=$PORT |
| 912 TARGET_PORT=$PORT | 912 TARGET_PORT=$PORT |
| 913 | 913 |
| 914 # Pull the app_process binary from the device | 914 # Detect AddressSanitizer setup on the device. In that case app_process is a |
| 915 # script, and the real executable is app_process.real. |
| 915 GDBEXEC=app_process | 916 GDBEXEC=app_process |
| 917 GDBEXEC_ASAN=app_process.real |
| 918 adb_shell ls /system/bin/$GDBEXEC_ASAN |
| 919 if [ $? == 0 ]; then |
| 920 GDBEXEC=$GDBEXEC_ASAN |
| 921 fi |
| 922 |
| 923 # Pull the app_process binary from the device. |
| 916 log "Pulling $GDBEXEC from device" | 924 log "Pulling $GDBEXEC from device" |
| 917 adb pull /system/bin/$GDBEXEC "$TMPDIR"/$GDBEXEC &>/dev/null | 925 adb pull /system/bin/$GDBEXEC "$TMPDIR"/$GDBEXEC &>/dev/null |
| 918 fail_panic "Could not retrieve $GDBEXEC from the device!" | 926 fail_panic "Could not retrieve $GDBEXEC from the device!" |
| 919 | 927 |
| 920 # Setup network redirection | 928 # Setup network redirection |
| 921 log "Setting network redirection (host:$HOST_PORT -> device:$TARGET_PORT)" | 929 log "Setting network redirection (host:$HOST_PORT -> device:$TARGET_PORT)" |
| 922 adb forward tcp:$HOST_PORT tcp:$TARGET_PORT | 930 adb forward tcp:$HOST_PORT tcp:$TARGET_PORT |
| 923 fail_panic "Could not setup network redirection from \ | 931 fail_panic "Could not setup network redirection from \ |
| 924 host:localhost:$HOST_PORT to device:localhost:$TARGET_PORT!" | 932 host:localhost:$HOST_PORT to device:localhost:$TARGET_PORT!" |
| 925 | 933 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 | 979 |
| 972 if [ "$VERBOSE" -gt 0 ]; then | 980 if [ "$VERBOSE" -gt 0 ]; then |
| 973 echo "### START $COMMANDS" | 981 echo "### START $COMMANDS" |
| 974 cat $COMMANDS | 982 cat $COMMANDS |
| 975 echo "### END $COMMANDS" | 983 echo "### END $COMMANDS" |
| 976 fi | 984 fi |
| 977 | 985 |
| 978 log "Launching gdb client: $GDB $GDBARGS -x $COMMANDS" | 986 log "Launching gdb client: $GDB $GDBARGS -x $COMMANDS" |
| 979 $GDB $GDBARGS -x $COMMANDS && | 987 $GDB $GDBARGS -x $COMMANDS && |
| 980 rm -f "$GDBSERVER_PIDFILE" | 988 rm -f "$GDBSERVER_PIDFILE" |
| OLD | NEW |