This patch improves the Android-specific adb_gdb debugging scripts
in several minor ways:
- It ensures that the temporary directory is always removed when
the script exits, even whe it is interrupted with Ctrl-C.
- It ensures that if --pull-libs is interrupted by a Ctrl-C,
the build.prop in /tmp/$USER-adb-gdb-libs/ is erased, forcing
a --pull-libs operation in the next invokation, instead of keeping
a portion of the libraries in a bad state.
- It adds a --su-prefix=<prefix> option, to be able to use tools
like 'su' on rooted production devices. This is useful when the
installed app is not debuggable (e.g. a release build), and there
is no way to run ADB as root.
BUG=NONE
Review URL: https://chromiumcodereview.appspot.com/17103007
git-svn-id: http://src.chromium.org/svn/trunk/src/build@206990 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This reverts the changes from commit 6394facfcd6150a69be418212f1caff2f6639540
and instead improves the adb_gdb script to properly auto-detect the right
location of the toolchain binaries.
This means that on a Linux 64-bit systems, it will first try to find the
64-bit binaries, and if not available, will fallback to 32-bit ones.
Tested with the default toolchain from third_party/android_tools/ndk/
(64-bit) and with --ndk-dir=/path/to/android-ndk-r8d (32-bit).
Also remove "gdb_apk" and "gdb_content_shell" which were obsoleted by
"adb_gdb" and "adb_gdb_content_shell", respectively.
BUG=none
R=yfriedman@chromium.org,navabi@chromium.org,wangxianzhu@chromium.org
Review URL: https://chromiumcodereview.appspot.com/14910010
git-svn-id: http://src.chromium.org/svn/trunk/src/build@200547 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
After recent upgradation to third_party/android_tools/ndk, there is no
linux-x86 toolchain directory any more, but linux-x86_64 instead. This
causes failure of adb_gdb and gdb_apk which hard-coded linux-x86
in the scripts. As envsetup.sh already set correct $ANDROID_TOOLCHAIN,
now use it in the scripts instead of the hardcoded one.
BUG=none
NOTRY=true (presubmit passed)
Review URL: https://chromiumcodereview.appspot.com/15028013
git-svn-id: http://src.chromium.org/svn/trunk/src/build@199567 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
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