Android: Add new debugging scripts (adb_gdb_xxx)
This patch adds several new scripts to help debug Chromium
programs on Android devices. The old "gdb_apk" and
"gdb_content_shell" are now *deprecated* and will be
removed shortly.
The new scripts are significantly more sophisticated than
the previous ones:
- They pull the system libraries from the device into a
temporary directory. This allows you to have much more
symbol information in back traces.
The scripts will not re-download the libraries if you
use the same device again. However, they will
automatically detect they're connected to a new
device a download new versions of the system libraries.
You can control this behaviour with several options
(--pull-libs, --no-pull-libs and --pull-libs-dir)
- The --verbose option can be used to dump useful
information about what's going on in case of problems.
- The --script=<file> option can be used to pass GDB
initialization commands that will be run after the
program has been properly attached (handy to set
breakpoints, signal handlers and printers).
- Works for both ARM and x86 devices. Should work
automatically for MIPS ones (provided a Chromium build
exists for this architecture).
- Works properly on all production devices. I.e. you don't
need to run ADB as root.
- Supports attaching to renderer processes with the
--sandboxed and --sandboxed=<num> option.
Special note: starting from JellyBean (4.1), you
*need* to run ADB as root to be able to attach to
sandboxed renderer processes. This is a platform
limitation.
- Automatically detects the most recent build directory.
This means there is no need to set BUILDTYPE in your
environment, and both Make-based and ninja-based builds
are supported (they don't place target libraries at the
same location).
- Generally speaking, much better handling of edge
cases, and proper cleanup when the script terminates
(either normally or through exceptions like Ctrl-C).
For complete details, use the --help option of each script.
By default, each script tries to attach to a running instance
of the program, but you can use the --start option to start
it automatically.
Note that 'adb_gdb' script is generic and can be used to
debug any Chromium Android application, as long as you
know its package name and activity name.
'adb_gdb_content_shell' et al at just convenience scripts
around 'adb_gdb' that hard-code these values for you.
Its trivial to write other wrapper scripts for other
packages if you wish so.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11187027
git-svn-id: http://src.chromium.org/svn/trunk/src/build@162704 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
2012-10-18 18:53:26 +04:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
#
|
|
|
|
# Attach to or start a DumpRenderTree process and debug it.
|
|
|
|
# See --help for details.
|
|
|
|
#
|
|
|
|
PROGDIR=$(dirname "$0")
|
|
|
|
export ADB_GDB_PROGNAME=$(basename "$0")
|
|
|
|
export ADB_GDB_ACTIVITY=.ChromeNativeTestActivity
|
|
|
|
"$PROGDIR"/adb_gdb \
|
|
|
|
--program-name=DumpRenderTree \
|
|
|
|
--package-name=org.chromium.native_test \
|
|
|
|
"$@"
|