blob: f5686e6d0f1a76dff4b351070ea1d6a9424d8675 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/bin/sh
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Symbolize oat files from the dalvik cache of a device.
#
# By default, pulls everything from the dalvik cache. A simple yes/no/quit prompt for each file can
# be requested by giving "--interactive" as a parameter.
INTERACTIVE="no"
if [ "x$1" = "x--interactive" ] ; then
INTERACTIVE="yes"
shift
fi
# Pull the file from the device and symbolize it.
function one() {
echo $1 $2
if [ "x$INTERACTIVE" = "xyes" ] ; then
echo -n "What to do? [Y/n/q] "
read -e input
if [ "x$input" = "xn" ] ; then
return
fi
if [ "x$input" = "xq" ] ; then
exit 0
fi
fi
adb pull $1/$2 /tmp || exit 1
mkdir -p $OUT/symbols/$1
oatdump --symbolize=/tmp/$2 --output=$OUT/symbols/$1/$2
}
# adb shell find seems to output in DOS format (CRLF), which messes up scripting
function adbshellstrip() {
adb shell $@ | sed 's/\r$//'
}
# Search in all of /data on device.
function all() {
FILES=$(adbshellstrip find /data -name "'*.oat'" -o -name "'*.dex'" -o -name "'*.odex'")
for FILE in $FILES ; do
DIR=$(dirname $FILE)
NAME=$(basename $FILE)
one $DIR $NAME
done
}
if [ "x$1" = "x" ] ; then
# No further arguments, iterate over all oat files on device.
all
else
# Take the parameters as a list of paths on device.
while (($#)); do
DIR=$(dirname $1)
NAME=$(basename $1)
one $DIR $NAME
shift
done
fi
|