History log of /ndk/ndk-gdb
Revision Date Author Comments
bd7544d2c67817fc565e89529a56bae3cc063622 10-Jun-2013 David 'Digit' Turner <digit@android.com> Move ndk-common.sh to build/tools/

It doesn't make sense to put it under build/core/ anymore.

Change-Id: I3a63ecabd15d4c34c2ba3800b95246f5eeb6a6f3
5f2f1101d7560844b26ac330b1b8d925984e7f1b 08-Apr-2013 Andrew Hsieh <andrewhsieh@google.com> Fix ndk-gdb to search compatibile ABI in order of CPU_ABIS

Instead of in the order of APP_ABIS, which will miss armeabi-v7a
if APP_ABI := armeabi armeabi-v7a (note that armeabi appears first
and get matched)

ndk-gdb.py looks in the order of CPU_ABIS already. Fixed two
bugs (unrelated nonetheless).

See https://code.google.com/p/android/issues/detail?id=54033

Change-Id: I4c97e90a552a16598295e0b1597882f7d3c939b8
5cbc03fc48fb839a6f858156c6f7ea4b29ac5e5e 12-Dec-2012 Ryan V. Bissell <rbissell@nvidia.com> ndk-gdb: add "am start -D" support

Make this new behavior the default, and add "--nowait" to revert to
the old behavior.

See http://code.google.com/p/android/issues/detail?id=41278

Change-Id: I101caddb8c04a5d64ca5c309fa65fd1f8021ff48
2c1bb7ca4db1efd528e2ae7beac53b1b04cdb154 21-Sep-2012 Andrew Hsieh <andrewhsieh@google.com> Bail out when NDK installation path contains space

Check to ensure NDK isn't installed in path
containing space. Many NDK scripts aren't ready to handle
path with space yet.

Change-Id: I1a76a9ff7bb84fd9a5c27f73e17b753c858070e7
7bbc211d514351896f4b8061bd0dcbf849f65903 27-Aug-2012 David 'Digit' Turner <digit@android.com> Only take the last line of output for ndk-build DUMP_XXXX

This ensures that if Application.mk or Android.mk do print
something with $(info ...), it doesn't get injected into
the result of DUMP_XXX.

See https://groups.google.com/d/msg/android-ndk/-/ew0lTWGr1UEJ
for original discussion on android-ndk forum.

Change-Id: I4089aa7aa6a003a5953b93625f765b4988b35895
3c3ce1505410dc8333b905136cfd68d85a275dd8 03-Aug-2012 Andrew Hsieh <andrewhsieh@google.com> Enhance ndk-gdb to handle list of ABIs in cpu.abi and cpu.abi2

In order for vendor to provide more than two CPU_ABIs, both
ro.product.cpu.abi and abi2 may contain multiple comma-delimited
ABIs. This scheme is also backward compatible when there is only
one or two APIs.

Enhance ndk-gdb to handle it.

Change-Id: I81f5765a5d51a8a131753828d73919618c0a9d3f
f065e2968edcf9c038a0e0647fa0cf525677e6e2 27-Jul-2012 Andrew Hsieh <andrewhsieh@google.com> Fix ndk-gdb when APP_ABI contains "all"

"all" in APP_ABI should be expanded into all available ABIs

Related issue:
http://code.google.com/p/android/issues/detail?id=35392

Change-Id: I0e9f5a5483c4487f501707f44df66b5bf15cebea
07a6a66c1fd347e24bd057f89191e0e8842a3b18 03-Jul-2012 Andrew Hsieh <andrewhsieh@google.com> Fix ndk-gdb to also pull /system/bin/link

ndk-gdb should also pull /system/bin/link, so gdb on host can set
a breakpoint in __dl_rtld_db_dlactivity and be aware of linker
activity (eg. rescan solib symbols when dlopen() is called)

Change-Id: Ie98d026a92177a076650665d7c26ac88781621a2
20f4e7e46e5e9a7be390245db6205e5777cddce6 29-Jun-2012 Andrew Hsieh <andrewhsieh@google.com> Fixed ndk-gdb to accept device serial which contains space

eg. ndk-gdb -s "Novo7 Basic"

Change-Id: Id1c57b2c7d6af45c755fc32e320585d0abdfa58c
201486c71651b4750d3cd8b7c4cd9a9c823f2e71 16-May-2012 Andrew Hsieh <andrewhsieh@google.com> Pass flags to all adb in ndk-gdb

Fixed an issue where $ADB_FLAGS isn't consistently passed to call
$ADB_CMD in ndk-gdb

Change-Id: I6d9542f6de8e3802024db4cc4a5348cf8bdcec6c
http://code.google.com/p/android/issues/detail?id=31126
ff7cd04c9fb4fc916998f7b2735ef75b839cbef5 14-Feb-2012 David 'Digit' Turner <digit@google.com> Custom output directory support with NDK_OUT

This patch allows the use of the NDK_OUT environment variable
to specify a custom output directory for all intermediate
generated files (i.e. instead of $PROJECT_PATH/obj).

ndk-gdb will pick up the right location if the variable is
defined too. Note that final binaries are still placed under
$PROJECT_PATH/libs by default since the packaging scripts
expect them to be here.

This fixes http://code.google.com/p/android/issues/detail?id=25470

Change-Id: I50618df619c13f5208200f8d0902b8e4fe201de8
db09243ebd50824a7fb6b59fd7931101db802f77 02-Nov-2011 David 'Digit' Turner <digit@google.com> ndk-gdb: Fix for when the 'adb' path contains spaces

This patch ensures the ndk-gdb works correctly if the "adb"
program (either from the path, or from the --adb=<path> option)
contains spaces.

Change-Id: I6b4c2469d89236ee5adf8edf1eaf05a69a79564e
ec2b8ddacdadf4c04325dfd0a4135566ec29a8ef 27-Oct-2011 David 'Digit' Turner <digit@google.com> Fix the use of $@ in all shell scripts

This patch allows all our development scripts, as well as ndk-gdb
to work well when parameters containing spaces are used.

The $@ shell variable is very special because it will expand
differently if inside a quoted string. What this means is that,
while $@ normally corresponds to the list of all parameters to
a function or script, we have:

$@ -> expands to a single string
"$@" -> expands to a series of strings

This is important when using them as parameters to other commands
for example consider:

# Simple function to dump all parameters, one per line.
dump () {
for ITEM; do
echo "$ITEM"
done
}

dump1 () { # this will always print a single line
dump $@
}

dump2 () { # this will print one line per item
dump "$@"
}

dump1 aaa bbb ccc # prints "aaa bbb ccc" on a single line
dump2 aaa bbb ccc # prints three lines: "aaa", "bbb" and "ccc"

Generally speaking, one should always use "$@" except in very rare cases
(e.g. when called from an eval command).

Change-Id: I87ec2a7b078cbe463f0ec0257ecad8fd38835b2e
9c10d8826645a08de528b4c918bcbf5273f11ed0 27-Oct-2011 David 'Digit' Turner <digit@google.com> ndk-gdb: Fix debugging of private services

This patch fixes ndk-gdb so it can properly debug an application
that has private services. These will appear in the 'ps' output
as <package-name>:<service-name>, and the way the extract-pid.awk
script worked, were matched against <package-name> incorrectly.

+ Make extrac-pid.awk usable when custom ROM use a Busybox 'ps'
instead of the standard Android toolbox version

+ Add unit test for extract-pid.awk

Change-Id: Ifb38d5bdfd5b648ff468cb3642db3bb64297707d
b2e3ee77bb837411c63f5ad1743cafb732a2836d 23-Mar-2011 David 'Digit' Turner <digit@android.com> ndk-gdb: Fixes for Darwin and --project option

This patch contains several fixes for ndk-gdb:

- Allow it to run properly on Darwin, where 'mktemp' will return an
error if used without parameters. Note that 'mktemp -t <pattern>'
does not work the same on Linux and Darwin, so use an invocation
that is supported by all host platforms (Cygwin included).

- Ensure that ANDROID_NDK_ROOT is defined as an absolute path,
to avoid problems when the script is invoked as in:

cd $NDKROOT
./ndk-gdb --project=/path/to/project/

- The _adb_var_shell redirection was buggy and created files named
"&1" and "&2" in the current directory for no good reason.

Fix for bug 4156117

Change-Id: I8dbd29bd33db808289755055a6ff5c9ccd181bfc
e3cfafbda4b0b3cff9360a64c12b5af11a4ad4e0 15-Mar-2011 David 'Digit' Turner <digit@android.com> ndk-gdb: More robust error detection for 'adb shell' commands.

This allows ndk-gdb to properly detects when some adb shell commands fail.
This prevents certain errors from incorrectly propagating to later parts
of the script.

See http://code.google.com/p/android/issues/detail?id=14002 for context.

Change-Id: I49e22e397bad5d39a9f002aa41f029d798038254
caf06194afcdd0cf31ce3cd688f83f94c24b4b2a 18-Oct-2010 David 'Digit' Turner <digit@google.com> ndk-gdb: Fix windows invokation

This also simplifies the gdb client invokation by putting
the "file" command inside the gdb.setup file, instead of
using the command-line.

Change-Id: Iaa31dd2afaada8552db0b72baca91ecd16d6ff95
5b65625ab0a6a50f332b9970a8cca513d9775788 08-Oct-2010 David 'Digit' Turner <digit@google.com> Fix ndk-gdb and add --delay=<seconds> option.

Fix ndk-gdb to _not_ start the activity unless --start or --launch is used.

Add a new option --delay=<seconds> to change the wait delay between the
launch of an activity and its attachement with gdbserver. The default delay
is also changed from 1 to 2 seconds.

Document the system libraries update.

Change-Id: Ia7e8c47221e3741bdc2688e750dae366c5426e67
fd204377de03a20556b38acf0dc2bdb195729343 14-Sep-2010 David 'Digit' Turner <digit@google.com> Add easy native debugging support through NDK_DEBUG=1

"ndk-build NDK_DEBUG=1" will force the build of a debuggable application.
This really copies gdbserver to the proper location, as if android:debuggable
was set to "true" in the app's manifest.

The value of NDK_DEBUG can be 0, 1, true or false, and will override the content
of the manifest. The main benefit from this change is that you don't have to
edit your manifest file just to rebuilt

Change-Id: I3fafb620189ac53a72b492c963832dd0c7f8b7d7
47eff9f6e34a7919585f841fb01f67355a914226 03-Jun-2010 David 'Digit' Turner <digit@google.com> ndk-gdb: fix to work properly with cygwin path madness.

Change-Id: Ia7e750f9042d4ed93f6cb8193dfc5d4f67857c17
54be48689b90488cb570f3393ef53e1b9e3d4e6a 03-Jun-2010 David 'Digit' Turner <digit@google.com> ndk-gdb: fix to work properly with OS X's BSD awk

"gensub()" is a GNUAwk-ism that should not be used.

Change-Id: I2df89efc165c84034594b98327921f9461188a76
4cff650ddc3e0b2e56528b6aca56ef9171cac972 01-Jun-2010 David 'Digit' Turner <digit@google.com> ndk-gdb: check target device API level + proper filtering of adb shell output.

Change-Id: I2472ac149e6b6a435a864e7a10109306322b512c
2e063fe130190c48101e4150afee80802d0c7a3e 07-May-2010 David 'Digit' Turner <digit@google.com> ndk-gdb: Improve detection of common user errors. Clarify some error messages.

Change-Id: If72f42324848823a01cffcad56c304b5c7e46d7d
0b2676bac67c271de9989357f6e3b2e762a7adf1 27-Apr-2010 David 'Digit' Turner <digit@google.com> Add --start, --launch=<name> and --launch-list options to ndk-gdb.

Move all awk scripts to build/awk/ and rework them a bit

Add build/awk/xmlparser.awk to parse XML files into something that
is easier to process with awk. Its output is used by several
scripts now (extract-debuggable.awk, extract-package-name.awk and
the new extract-launchable.awk).

Also update documentation.

Change-Id: I50507abbb2b438aeea25a4e0521e6bf69ad86603
a08d605794902f5c7ed79b3d894adb722e1b6cac 16-Apr-2010 David 'Digit' Turner <digit@google.com> Add ndk-gdb script to the NDK.

This is a helper script used to launch a native debugging session.
To use it, follow these steps:

1. Make your application debuggable
2. Build the machine code with 'ndk-build' (make APP=<name> is not supported)
3. Build the package with ant or the ADT Eclipse plugin
4. Install it on your device/emulator
5. Launch it
6. Run 'ndk-gdb' from your application project directory.

Change-Id: Ie3b0557e70cefa0080075a34ad0ca46bebef3c42
NOTE: To work properly, a modified gdbserver binary must be used
(one that binds to Unix sockets instead of TCP ones). Patch
upcoming.