@@ -135,9 +135,13 @@ function push_arm() {
135135 # export OFLAG="-Os"
136136 # export OFLAG="-O2"
137137
138- export CFLAGS=" -DANDROID -mandroid $OFLAG -g -fomit-frame-pointer --sysroot $NDKPLATFORM "
138+ if [ " X$DO_DEBUG_BUILD " == " X1" ]; then
139+ CFLAGS_G=" -g"
140+ fi
141+
142+ export CFLAGS=" -DANDROID -mandroid $OFLAG $CFLAGS_G -fomit-frame-pointer --sysroot $NDKPLATFORM "
139143 if [ " X$ARCH " == " Xarmeabi-v7a" ]; then
140- CFLAGS+=" -march=armv7-a -g -mfloat-abi=softfp -mfpu=vfp -mthumb"
144+ CFLAGS+=" -march=armv7-a $CFLAGS_G -mfloat-abi=softfp -mfpu=vfp -mthumb"
141145 fi
142146 export CXXFLAGS=" $CFLAGS "
143147
@@ -221,6 +225,7 @@ function usage() {
221225 echo " -m 'mod1 mod2' Modules to include"
222226 echo " -f Restart from scratch (remove the current build)"
223227 echo " -x display expanded values (execute 'set -x')"
228+ echo " -g create a distribution with debug symbols activated, to use with gdb-remote"
224229 echo
225230 exit 0
226231}
@@ -614,10 +619,13 @@ function run_distribute() {
614619 try rm -rf lib-dynload/_ctypes_test.so
615620 try rm -rf lib-dynload/_testcapi.so
616621
617- # debug "Strip libraries"
618- # push_arm
619- # try find "$DIST_PATH"/private "$DIST_PATH"/libs -iname '*.so' -exec $STRIP {} \;
620- # pop_arm
622+ if [ " X$DO_DEBUG_BUILD " == " X" ]
623+ then
624+ debug " Strip libraries"
625+ push_arm
626+ try find " $DIST_PATH " /private " $DIST_PATH " /libs -iname ' *.so' -exec $STRIP {} \;
627+ pop_arm
628+ fi
621629
622630}
623631
@@ -664,7 +672,7 @@ function arm_deduplicate() {
664672
665673
666674# Do the build
667- while getopts " :hvlfxm:d:s" opt; do
675+ while getopts " :hvlfxm:d:s:g " opt; do
668676 case $opt in
669677 h)
670678 usage
@@ -692,6 +700,10 @@ while getopts ":hvlfxm:d:s" opt; do
692700 x)
693701 DO_SET_X=1
694702 ;;
703+ g)
704+ # need to export so recipes can test on it
705+ export DO_DEBUG_BUILD=1
706+ ;;
695707 \? )
696708 echo " Invalid option: -$OPTARG " >&2
697709 exit 1
0 commit comments