blob: b79f9bce520ecf53bed8974ff1196e534a3bf93e (
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
|
#!/bin/bash
show_usage()
{
echo "Usage: lldb-android [-d <DEVICE>] <package>."
}
shell()
{
adb -s "$DEVICE" shell "$@"
}
while getopts "d:" option ; do
case "$option" in
d)
DEVICE=$OPTARG
shift 2
;;
esac
done
if [ "$1" == "" ]; then
show_usage
exit 1
fi
PKG=$1
echo "Package: $PKG"
if [ "$DEVICE" = "" ]; then
DEVICE_COUNT=`adb devices | grep 'device$' | wc -l`
if [ $DEVICE_COUNT -eq 1 ]; then
DEVICE=`adb devices | grep 'device$' | awk -F"\t+" '{print $1}'`
fi
fi
if [ -z $DEVICE ]; then
echo "Unable to find a device."
exit 1
fi
echo "Device: $DEVICE"
for i in 1 2 3 4 5; do
PID=$(shell "ps" | grep -E "\b$PKG\b$" | awk -F' +' '{print $2}')
if [ "$PID" != "" ]; then
break
fi
sleep 1
done
if [ "$PID" == "" ]; then
echo "Can't find process pid."
exit 1
fi
START_FILE=/tmp/lldb_commands.$DEVICE.$PID
echo "
platform select remote-android
platform connect connect://[$DEVICE]:6101
settings set auto-confirm true
settings set plugin.symbol-file.dwarf.comp-dir-symlink-paths /proc/self/cwd
process attach -p $PID
process handle -p true -n true -s false SIGPWR SIGXCPU SIGTTIN
p (void)monodroid_clear_lldb_wait()" > $START_FILE
lldb -s $START_FILE
|