From e146cc1cc24f15ecae79cea41b1bd7e8c514654c Mon Sep 17 00:00:00 2001 From: Yu Xiaolei Date: Tue, 9 Dec 2014 20:53:09 +0800 Subject: ndk-gdb: add a command-line switch to allow overriding of package name This is useful when native librares are built inside library projects. Change-Id: Iac4a210a3a3aeb879e2729d0396ad5a42013508d --- ndk-gdb | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'ndk-gdb') diff --git a/ndk-gdb b/ndk-gdb index 026fde85b..a204ba257 100755 --- a/ndk-gdb +++ b/ndk-gdb @@ -99,6 +99,7 @@ OPTION_LAUNCH= OPTION_LAUNCH_LIST=no OPTION_DELAY= OPTION_WAIT="-D" +OPTION_PACKAGE_NAME= check_parameter () { @@ -262,6 +263,9 @@ while [ -n "$1" ]; do JDB_PORT= OPTION_WAIT= ;; + --package=*) + OPTION_PACKAGE_NAME="$optarg" + ;; -*) # unknown options echo "ERROR: Unknown option '$opt', use --help for list of valid ones." exit 1 @@ -305,6 +309,7 @@ if [ "$OPTION_HELP" = "yes" ] ; then echo " --delay= Delay in seconds between activity start and gdbserver attach." echo " --project= Specify application project path" echo " -p Same as --project=" + echo " --package= Specify package name" echo " --port= Use tcp:localhost: to communicate with gdbserver [$DEBUG_PORT]" echo " --exec= Execute gdb initialization commands in after connection" echo " -x Same as --exec=" @@ -482,13 +487,18 @@ else log "Using auto-detected project path: $PROJECT" fi -# Extract the package name from the manifest -PACKAGE_NAME=`run_awk_manifest_script extract-package-name.awk` -log "Found package name: $PACKAGE_NAME" -if [ $? != 0 -o "$PACKAGE_NAME" = "" ] ; then - echo "ERROR: Could not extract package name from $PROJECT/$MANIFEST." - echo " Please check that the file is well-formed!" - exit 1 +if [ ! -z "$OPTION_PACKAGE_NAME" ]; then + PACKAGE_NAME="$OPTION_PACKAGE_NAME" + log "Using package name: $PACKAGE_NAME" +else + # Extract the package name from the manifest + PACKAGE_NAME=`run_awk_manifest_script extract-package-name.awk` + log "Found package name: $PACKAGE_NAME" + if [ $? != 0 -o "$PACKAGE_NAME" = "" ] ; then + echo "ERROR: Could not extract package name from $PROJECT/$MANIFEST." + echo " Please check that the file is well-formed!" + exit 1 + fi fi # If --launch-list is used, list all launchable activities, and be done with it -- cgit v1.2.3