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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 echo "Failure log (use --verbose for more information):" | 977 echo "Failure log (use --verbose for more information):" |
978 cat $GDBSERVER_LOG | 978 cat $GDBSERVER_LOG |
979 exit 1 | 979 exit 1 |
980 fi | 980 fi |
981 fi | 981 fi |
982 | 982 |
983 # Generate a file containing useful GDB initialization commands | 983 # Generate a file containing useful GDB initialization commands |
984 readonly COMMANDS=$TMPDIR/gdb.init | 984 readonly COMMANDS=$TMPDIR/gdb.init |
985 log "Generating GDB initialization commands file: $COMMANDS" | 985 log "Generating GDB initialization commands file: $COMMANDS" |
986 echo -n "" > $COMMANDS | 986 echo -n "" > $COMMANDS |
| 987 echo "set print pretty 1" >> $COMMANDS |
| 988 echo "python" >> $COMMANDS |
| 989 echo "import sys" >> $COMMANDS |
| 990 echo "sys.path.insert(0, '$CHROMIUM_SRC/tools/gdb/')" >> $COMMANDS |
| 991 echo "try:" >> $COMMANDS |
| 992 echo " import gdb_chrome" >> $COMMANDS |
| 993 echo "finally:" >> $COMMANDS |
| 994 echo " sys.path.pop(0)" >> $COMMANDS |
| 995 echo "end" >> $COMMANDS |
987 echo "file $TMPDIR/$GDBEXEC" >> $COMMANDS | 996 echo "file $TMPDIR/$GDBEXEC" >> $COMMANDS |
988 echo "directory $CHROMIUM_SRC" >> $COMMANDS | 997 echo "directory $CHROMIUM_SRC" >> $COMMANDS |
989 echo "set solib-absolute-prefix $PULL_LIBS_DIR" >> $COMMANDS | 998 echo "set solib-absolute-prefix $PULL_LIBS_DIR" >> $COMMANDS |
990 echo "set solib-search-path $SOLIB_DIRS:$PULL_LIBS_DIR:$SYMBOL_DIR" \ | 999 echo "set solib-search-path $SOLIB_DIRS:$PULL_LIBS_DIR:$SYMBOL_DIR" \ |
991 >> $COMMANDS | 1000 >> $COMMANDS |
992 echo "echo Attaching and reading symbols, this may take a while.." \ | 1001 echo "echo Attaching and reading symbols, this may take a while.." \ |
993 >> $COMMANDS | 1002 >> $COMMANDS |
994 echo "target remote :$HOST_PORT" >> $COMMANDS | 1003 echo "target remote :$HOST_PORT" >> $COMMANDS |
995 | 1004 |
996 if [ "$GDBINIT" ]; then | 1005 if [ "$GDBINIT" ]; then |
997 cat "$GDBINIT" >> $COMMANDS | 1006 cat "$GDBINIT" >> $COMMANDS |
998 fi | 1007 fi |
999 | 1008 |
1000 if [ "$VERBOSE" -gt 0 ]; then | 1009 if [ "$VERBOSE" -gt 0 ]; then |
1001 echo "### START $COMMANDS" | 1010 echo "### START $COMMANDS" |
1002 cat $COMMANDS | 1011 cat $COMMANDS |
1003 echo "### END $COMMANDS" | 1012 echo "### END $COMMANDS" |
1004 fi | 1013 fi |
1005 | 1014 |
1006 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" | 1015 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" |
1007 $GDB $GDB_ARGS -x $COMMANDS && | 1016 $GDB $GDB_ARGS -x $COMMANDS && |
1008 rm -f "$GDBSERVER_PIDFILE" | 1017 rm -f "$GDBSERVER_PIDFILE" |
OLD | NEW |