Merge "Add a conditional removal of \r\n from adb output."

This commit is contained in:
Christopher Ferris
2015-05-21 05:31:07 +00:00
committed by Gerrit Code Review

View File

@@ -13,16 +13,16 @@ fi
source $ANDROID_BUILD_TOP/build/envsetup.sh source $ANDROID_BUILD_TOP/build/envsetup.sh
function adb_get_product_device() { function adb_get_product_device() {
local candidate=`adb shell getprop ro.product.device | sed s/.$//` local candidate=`adb shell getprop ro.product.device | tr -d '\r\n'`
if [ -z $candidate ]; then if [ -z $candidate ]; then
candidate=`adb shell getprop ro.hardware | sed s/.$//` candidate=`adb shell getprop ro.hardware | tr -d '\r\n'`
fi fi
echo $candidate echo $candidate
} }
# returns 0 when process is not traced # returns 0 when process is not traced
function adb_get_traced_by() { function adb_get_traced_by() {
echo `adb shell cat /proc/$1/status | grep -e "^TracerPid:" | sed "s/^TracerPid:\t//" | sed s/.$//` echo `adb shell cat /proc/$1/status | grep -e "^TracerPid:" | sed "s/^TracerPid:\t//" | tr -d '\r\n'`
} }
function get_symbols_directory() function get_symbols_directory()
@@ -95,7 +95,7 @@ function gdbclient() {
fi fi
fi fi
local EXE=`adb shell readlink /proc/$PID/exe | sed s/.$//` local EXE=`adb shell readlink /proc/$PID/exe | tr -d '\r\n'`
if [ -z "$EXE" ]; then if [ -z "$EXE" ]; then
echo "Error: no such pid=$PID - is process still alive?" echo "Error: no such pid=$PID - is process still alive?"
@@ -126,7 +126,7 @@ function gdbclient() {
local GDB= local GDB=
local GDB64= local GDB64=
local CPU_ABI=`adb shell getprop ro.product.cpu.abilist | sed s/.$//` local CPU_ABI=`adb shell getprop ro.product.cpu.abilist | tr -d '\r\n'`
# TODO: Derive this differently to correctly support multi-arch. We could try to parse # TODO: Derive this differently to correctly support multi-arch. We could try to parse
# /proc/pid/exe. Right now, we prefer 64bit by checking those entries first. # /proc/pid/exe. Right now, we prefer 64bit by checking those entries first.
# TODO: Correctly support native bridge, which makes parsing abilist very brittle. # TODO: Correctly support native bridge, which makes parsing abilist very brittle.