[w32error] Add WSA_INVALID_PARAMETER and WSA_INVALID_HANDLE
[mono-project.git] / sdks / android / lldb-android.sh
blobb79f9bce520ecf53bed8974ff1196e534a3bf93e
1 #!/bin/bash
3 show_usage()
5 echo "Usage: lldb-android [-d <DEVICE>] <package>."
8 shell()
10 adb -s "$DEVICE" shell "$@"
13 while getopts "d:" option ; do
14 case "$option" in
16 DEVICE=$OPTARG
17 shift 2
19 esac
20 done
22 if [ "$1" == "" ]; then
23 show_usage
24 exit 1
27 PKG=$1
29 echo "Package: $PKG"
31 if [ "$DEVICE" = "" ]; then
32 DEVICE_COUNT=`adb devices | grep 'device$' | wc -l`
33 if [ $DEVICE_COUNT -eq 1 ]; then
34 DEVICE=`adb devices | grep 'device$' | awk -F"\t+" '{print $1}'`
38 if [ -z $DEVICE ]; then
39 echo "Unable to find a device."
40 exit 1
43 echo "Device: $DEVICE"
45 for i in 1 2 3 4 5; do
46 PID=$(shell "ps" | grep -E "\b$PKG\b$" | awk -F' +' '{print $2}')
48 if [ "$PID" != "" ]; then
49 break
51 sleep 1
52 done
54 if [ "$PID" == "" ]; then
55 echo "Can't find process pid."
56 exit 1
59 START_FILE=/tmp/lldb_commands.$DEVICE.$PID
61 echo "
62 platform select remote-android
63 platform connect connect://[$DEVICE]:6101
64 settings set auto-confirm true
65 settings set plugin.symbol-file.dwarf.comp-dir-symlink-paths /proc/self/cwd
66 process attach -p $PID
67 process handle -p true -n true -s false SIGPWR SIGXCPU SIGTTIN
68 p (void)monodroid_clear_lldb_wait()" > $START_FILE
70 lldb -s $START_FILE