blob: 3cd7be4aefe7d79deaea204b5382932e3bde6780 [file] [log] [blame]
David 'Digit' Turnera08d6052010-04-16 12:45:33 -07001#!/bin/sh
2#
3# Copyright (C) 2010 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18# This wrapper script is used to launch a native debugging session
19# on a given NDK application. The application must be debuggable, i.e.
20# its android:debuggable attribute must be set to 'true' in the
21# <application> element of its manifest.
22#
23# See docs/NDK-GDB.TXT for usage description. Essentially, you just
24# need to launch ndk-gdb from your application project directory
25# after doing ndk-build && ant install && <start-application-on-device>
26#
27. `dirname $0`/build/core/ndk-common.sh
28
29force_32bit_binaries
30
31find_program ADB_CMD adb
32ADB_FLAGS=
33
34AWK_CMD=awk
35
36DEBUG_PORT=5039
37
38PARAMETERS=
39OPTION_HELP=no
40OPTION_PROJECT=
41OPTION_FORCE=no
42OPTION_ADB=
43OPTION_EXEC=
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -070044OPTION_START=no
45OPTION_LAUNCH=
46OPTION_LAUNCH_LIST=no
David 'Digit' Turnera08d6052010-04-16 12:45:33 -070047
48check_parameter ()
49{
50 if [ -z "$2" ]; then
51 echo "ERROR: Missing parameter after option '$1'"
52 exit 1
53 fi
54}
55
56check_adb_flags ()
57{
58 if [ -n "$ADB_FLAGS" ] ; then
59 echo "ERROR: Only one of -e, -d or -s <serial> can be used at the same time!"
60 exit 1
61 fi
62}
63
64get_build_var ()
65{
66 if [ -z "$GNUMAKE" ] ; then
67 GNUMAKE=make
68 fi
69 $GNUMAKE --no-print-dir -f $ANDROID_NDK_ROOT/build/core/build-local.mk -C $PROJECT DUMP_$1
70}
71
72get_build_var_for_abi ()
73{
74 if [ -z "$GNUMAKE" ] ; then
75 GNUMAKE=make
76 fi
77 $GNUMAKE --no-print-dir -f $ANDROID_NDK_ROOT/build/core/build-local.mk -C $PROJECT DUMP_$1 APP_ABI=$2
78}
79
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -070080# Used to run an awk script on the manifest
81run_awk_manifest_script ()
82{
83 $AWK_CMD -f $AWK_SCRIPTS/$1 $PROJECT/$MANIFEST
84}
85
David 'Digit' Turnera08d6052010-04-16 12:45:33 -070086VERBOSE=no
87while [ -n "$1" ]; do
88 opt="$1"
89 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
90 case "$opt" in
91 --help|-h|-\?)
92 OPTION_HELP=yes
93 ;;
94 --verbose)
95 VERBOSE=yes
96 ;;
97 -s)
98 check_parameter $1 $2
99 check_adb_flags
100 ADB_FLAGS=" -s $2"
101 shift
102 ;;
103 -s*)
104 check_adb_flags
105 optarg=`expr -- "$opt" : '-s\(.*\)'`
106 ADB_FLAGS=" -s $optarg"
107 ;;
108 -p)
109 check_parameter $1 $2
110 OPTION_PROJECT="$2"
111 shift
112 ;;
113 -p*)
114 optarg=`expr -- "$opt" : '-p\(.*\)'`
115 OPTION_PROJECT="$optarg"
116 ;;
117 --exec=*)
118 OPTION_EXEC="$optarg"
119 ;;
120 -x)
121 check_parameter $1 $2
122 OPTION_EXEC="$2"
123 shift
124 ;;
125 -x*)
126 optarg=`expr -- "$opt" : '-x\(.*\)'`
127 OPTION_EXEC="$optarg"
128 ;;
129 -e)
130 check_adb_flags
131 ADB_FLAGS=" -e"
132 ;;
133 -d)
134 check_adb_flags
135 ADB_FLAGS=" -d"
136 ;;
137 --adb=*) # specify ADB command
138 OPTION_ADB="$optarg"
139 ;;
140 --awk=*)
141 AWK_CMD="$optarg"
142 ;;
143 --project=*)
144 OPTION_PROJECT="$optarg"
145 ;;
146 --port=*)
147 DEBUG_PORT="$optarg"
148 ;;
149 --force)
150 OPTION_FORCE="yes"
151 ;;
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700152 --launch-list)
153 OPTION_LAUNCH_LIST="yes"
154 ;;
155 --launch=*)
156 OPTION_LAUNCH="$optarg"
157 ;;
158 --start)
159 OPTION_START=yes
160 ;;
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700161 -*) # unknown options
162 echo "ERROR: Unknown option '$opt', use --help for list of valid ones."
163 exit 1
164 ;;
165 *) # Simply record parameter
166 if [ -z "$PARAMETERS" ] ; then
167 PARAMETERS="$opt"
168 else
169 PARAMETERS="$PARAMETERS $opt"
170 fi
171 ;;
172 esac
173 shift
174done
175
176if [ "$OPTION_HELP" = "yes" ] ; then
177 echo "Usage: $PROGNAME [options]"
178 echo ""
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700179 echo "Setup a gdb debugging session for your Android NDK application."
180 echo "Read $$NDK/docs/NDK-GDB.TXT for complete usage instructions."
181 echo ""
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700182 echo "Valid options:"
183 echo ""
184 echo " --help|-h|-? Print this help"
185 echo " --verbose Enable verbose mode"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700186 echo " --force Kill existing debug session if it exists"
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700187 echo " --start Launch application instead of attaching to existing one"
188 echo " --launch=<name> Same as --start, but specify activity name (see below)"
189 echo " --launch-list List all launchable activity names from manifest"
190 echo " --project=<path> Specify application project path"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700191 echo " -p <path> Same as --project=<path>"
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700192 echo " --port=<port> Use tcp:localhost:<port> to communicate with gdbserver [$DEBUG_PORT]"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700193 echo " --exec=<file> Execute gdb initialization commands in <file> after connection"
194 echo " -x <file> Same as --exec=<file>"
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700195 echo " --adb=<file> Use specific adb command [$ADB_CMD]"
196 echo " --awk=<file> Use specific awk command [$AWK_CMD]"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700197 echo " -e Connect to single emulator instance"
198 echo " -d Connect to single target device"
199 echo " -s <serial> Connect to specific emulator or device"
200 echo ""
201 exit 0
202fi
203
204log "Android NDK installation path: $ANDROID_NDK_ROOT"
205
206if [ -n "$OPTION_EXEC" ] ; then
207 if [ ! -f "$OPTION_EXEC" ]; then
208 echo "ERROR: Invalid initialization file: $OPTION_EXEC"
209 exit 1
210 fi
211fi
212
213# Check ADB tool version
214if [ -n "$OPTION_ADB" ] ; then
215 ADB_CMD="$OPTION_ADB"
216 log "Using specific adb command: $ADB_CMD"
217else
218 if [ -z "$ADB_CMD" ] ; then
219 echo "ERROR: The 'adb' tool is not in your path."
220 echo " You can change your PATH variable, or use"
221 echo " --adb=<executable> to point to a valid one."
222 exit 1
223 fi
224 log "Using default adb command: $ADB_CMD"
225fi
226
227ADB_VERSION=`$ADB_CMD version`
228if [ $? != 0 ] ; then
229 echo "ERROR: Could not run ADB with: $ADB_CMD"
230 exit 1
231fi
232log "ADB version found: $ADB_VERSION"
233
234ADB_CMD="${ADB_CMD}${ADB_FLAGS}"
235log "Using final ADB command: '$ADB_CMD'"
236
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700237adb_shell ()
238{
239 # Run an adb shell command and return its output.
240 #
241 # We need to filter weird control characters like \r that are
242 # included in the output.
243 #
244 $ADB_CMD shell $@ | sed -e 's![[:cntrl:]]!!g'
245}
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700246
247# Check the awk tool
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700248AWK_SCRIPTS=$ANDROID_NDK_ROOT/build/awk
249AWK_TEST=`$AWK_CMD -f $AWK_SCRIPTS/check-awk.awk`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700250if [ $? != 0 ] ; then
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700251 echo "ERROR: Could not run '$AWK_CMD' command. Do you have it installed properly?"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700252 exit 1
253fi
254if [ "$AWK_TEST" != "Pass" ] ; then
255 echo "ERROR: Your version of 'awk' is obsolete. Please use --awk=<file> to point to Nawk or Gawk!"
256 exit 1
257fi
258
259# Name of the manifest file
260MANIFEST=AndroidManifest.xml
261
262# Find the root of the application project.
263if [ -n "$OPTION_PROJECT" ] ; then
264 PROJECT=$OPTION_PROJECT
265 log "Using specified project path: $PROJECT"
266 if [ ! -d "$PROJECT" ] ; then
267 echo "ERROR: Your --project option does not point to a directory!"
268 exit 1
269 fi
270 if [ ! -f "$PROJECT/$MANIFEST" ] ; then
271 echo "ERROR: Your --project does not point to an Android project path!"
272 echo " It is missing a $MANIFEST file."
273 exit 1
274 fi
275else
276 # Assume we are in the project directory
277 if [ -f "$MANIFEST" ] ; then
278 PROJECT=.
279 else
280 PROJECT=
281 CURDIR=`pwd`
282 while [ "$CURDIR" != "/" ] ; do
283 if [ -f "$CURDIR/$MANIFEST" ] ; then
284 PROJECT="$CURDIR"
285 break
286 fi
287 CURDIR=`dirname $CURDIR`
288 done
289 if [ -z "$PROJECT" ] ; then
290 echo "ERROR: Launch this script from an application project directory, or use --project=<path>."
291 exit 1
292 fi
293 fi
294 log "Using auto-detected project path: $PROJECT"
295fi
296
297# Extract the package name from the manifest
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700298PACKAGE_NAME=`run_awk_manifest_script extract-package-name.awk`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700299log "Found package name: $PACKAGE_NAME"
300if [ $? != 0 -o "$PACKAGE_NAME" = "<none>" ] ; then
301 echo "ERROR: Could not extract package name from $PROJECT/$MANIFEST."
302 echo " Please check that the file is well-formed!"
303 exit 1
304fi
305
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700306# If --launch-list is used, list all launchable activities, and be done with it
307if [ "$OPTION_LAUNCH_LIST" = "yes" ] ; then
308 log "Extracting list of launchable activities from manifest:"
309 run_awk_manifest_script extract-launchable.awk
310 exit 0
311fi
312
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700313# Check that the application is debuggable, or nothing will work
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700314DEBUGGABLE=`run_awk_manifest_script extract-debuggable.awk`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700315log "Found debuggable flag: $DEBUGGABLE"
316if [ $? != 0 -o "$DEBUGGABLE" != "true" ] ; then
317 echo "ERROR: Package $PACKAGE_NAME is not debuggable ! Please fix your manifest,"
318 echo " rebuild your application and re-install it to fix this."
319 exit 1
320fi
321
322APP_ABIS=`get_build_var APP_ABI`
323log "ABIs targetted by application: $APP_ABIS"
324
325# Check the ADB command, and that we can connect to the device/emulator
326ADB_TEST=`$ADB_CMD shell ls`
327if [ $? != 0 ] ; then
328 echo "ERROR: Could not connect to device or emulator!"
329 echo " Please check that an emulator is running or a device is connected"
David 'Digit' Turner2e063fe2010-05-06 15:31:34 -0700330 echo " through USB to this machine. You can use -e, -d and -s <serial>"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700331 echo " in case of multiple ones."
332 exit 1
333fi
334
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700335# Check that the device is running Froyo (API Level 8) or higher
336#
337API_LEVEL=`adb_shell getprop ro.build.version.sdk`
338if [ $? != 0 -o -z "$API_LEVEL" ] ; then
339 echo "ERROR: Could not find target device's supported API level !"
340 echo "ndk-gdb will only work if your device is running Android 2.2 or higher."
341 exit 1
342fi
David 'Digit' Turner54be4862010-06-03 11:57:49 -0700343log "Device API Level: $API_LEVEL"
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700344if [ "$API_LEVEL" -lt "8" ] ; then
345 echo "ERROR: ndk-gdb requires a target device running Android 2.2 (API level 8) or higher."
346 echo "The target device is running API level $API_LEVEL !"
347 exit 1
348fi
349
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700350# Get the target device's supported ABI(s)
351# And check that they are supported by the application
352#
353COMPAT_ABI=none
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700354CPU_ABI=`adb_shell getprop ro.product.cpu.abi`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700355echo "$APP_ABIS" | grep -q -F "$CPU_ABI"
356if [ $? = 0 ] ; then
357 COMPAT_ABI=$CPU_ABI
358fi
359
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700360CPU_ABI2=`adb_shell getprop ro.product.cpu.abi2`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700361if [ -z "$CPU_ABI2" ] ; then
362 log "Device CPU ABI: $CPU_ABI"
363else
364 log "Device CPU ABIs: $CPU_ABI $CPU_ABI2"
365 echo "$APP_ABIS" | grep -q -F "$CPU_ABI2"
366 if [ $? = 0 ] ; then
367 COMPAT_ABI=$CPU_ABI2
368 fi
369fi
370if [ "$COMPAT_ABI" = none ] ; then
371 echo "ERROR: The device does not support the application's targetted CPU ABIs!"
372 if [ "$CPU_ABI2" = "$CPU_ABI" ] ; then
373 CPU_ABI2=
374 fi
375 echo " Device supports: $CPU_ABI $CPU_ABI2"
376 echo " Package supports: $APP_ABIS"
377 exit 1
378fi
379log "Compatible device ABI: $COMPAT_ABI"
380
David 'Digit' Turner2e063fe2010-05-06 15:31:34 -0700381# Let's check that the user didn't change the debuggable flag in
382# the manifest without calling ndk-build afterwards.
383if [ ! -f $PROJECT/libs/$COMPAT_ABI/gdbserver ] ; then
384 echo "ERROR: Could not find gdbserver binary under $PROJECT/libs/$COMPAT_ABI"
385 echo " This usually means you modified your AndroidManifest.xml to set"
386 echo " the android:debuggable flag to 'true' but did not rebuild the"
387 echo " native binaries. Please call 'ndk-build' to do so,"
388 echo " *then* re-install to the device !"
389 exit 1
390fi
391
392# Let's check that 'gdbserver' is properly installed on the device too. If this
393# is not the case, the user didn't install the proper package after rebuilding.
394#
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700395DEVICE_GDBSERVER=`adb_shell ls /data/data/$PACKAGE_NAME/lib/gdbserver`
David 'Digit' Turner2e063fe2010-05-06 15:31:34 -0700396log "Found device gdbserver: $DEVICE_GDBSERVER"
397if pattern_match "No such file or directory" "$DEVICE_GDBSERVER" ] ; then
398 echo "ERROR: Non-debuggable application installed on the target device."
399 echo " Please re-install the debuggable version !"
400 exit 1
401fi
402
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700403# Get information from the build system
404GDBSETUP_INIT=`get_build_var_for_abi NDK_APP_GDBSETUP $COMPAT_ABI`
405log "Using gdb setup init: $GDBSETUP_INIT"
406
407TOOLCHAIN_PREFIX=`get_build_var_for_abi TOOLCHAIN_PREFIX $COMPAT_ABI`
408log "Using toolchain prefix: $TOOLCHAIN_PREFIX"
409
410APP_OUT=`get_build_var_for_abi TARGET_OUT $COMPAT_ABI`
411log "Using app out directory: $APP_OUT"
412
413# Find the <dataDir> of the package on the device
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700414DATA_DIR=`adb_shell run-as $PACKAGE_NAME /system/bin/sh -c pwd`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700415log "Found data directory: '$DATA_DIR'"
David 'Digit' Turner4cff6502010-06-01 14:40:11 -0700416if [ $? != 0 -o -z "$DATA_DIR" ] ; then
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700417 echo "ERROR: Could not extract package's data directory. Are you sure that"
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700418 echo " your installed application is debuggable?"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700419 exit 1
420fi
421
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700422# Launch the activity if needed
423if [ -n "$OPTION_START" ] ; then
424 # If --launch is used, ignore --start, otherwise extract the first
425 # launchable activity name from the manifest and use it as if --launch=<name>
426 # was used instead.
427 #
428 if [ -z "$OPTION_LAUNCH" ] ; then
429 OPTION_LAUNCH=`run_awk_manifest_script extract-launchable.awk | sed 2q`
430 if [ $? != 0 ] ; then
431 echo "ERROR: Could not extract name of launchable activity from manifest!"
432 echo " Try to use --launch=<name> directly instead as a work-around."
433 exit 1
434 fi
435 log "Found first launchable activity: $OPTION_LAUNCH"
436 if [ -z "$OPTION_LAUNCH" ] ; then
437 echo "ERROR: It seems that your Application does not have any launchable activity!"
438 echo " Please fix your manifest file and rebuild/re-install your application."
439 exit 1
440 fi
441 fi
442fi
443
444if [ -n "$OPTION_LAUNCH" ] ; then
445 log "Launching activity: $PACKAGE_NAME/$OPTION_LAUNCH"
446 run $ADB_CMD shell am start -n $PACKAGE_NAME/$OPTION_LAUNCH
447 if [ $? != 0 ] ; then
448 echo "ERROR: Could not launch specified activity: $OPTION_LAUNCH"
449 echo " Use --launch-list to dump a list of valid values."
450 exit 1
451 fi
452 # Sleep a bit, it sometimes take one second to start properly
453 # Note that we use the 'sleep' command on the device here.
454 run $ADB_CMD shell sleep 1
455fi
456
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700457# Find the PID of the application being run
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700458PID=`$ADB_CMD shell ps | $AWK_CMD -f $AWK_SCRIPTS/extract-pid.awk -v PACKAGE=$PACKAGE_NAME`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700459log "Found running PID: $PID"
460if [ $? != 0 -o "$PID" = "0" ] ; then
461 echo "ERROR: Could not extract PID of application on device/emulator."
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700462 if [ -n "$OPTION_LAUNCH" ] ; then
David 'Digit' Turner2e063fe2010-05-06 15:31:34 -0700463 echo " Weird, this probably means one of these:"
464 echo ""
465 echo " - The installed package does not match your current manifest."
466 echo " - The application process was terminated."
467 echo ""
468 echo " Try using the --verbose option and look at its output for details."
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700469 else
470 echo " Are you sure the application is already started?"
471 echo " Consider using --start or --launch=<name> if not."
472 fi
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700473 exit 1
474fi
475
476# Check that there is no other instance of gdbserver running
477GDBSERVER_PS=`$ADB_CMD shell ps | grep lib/gdbserver`
478if [ -n "$GDBSERVER_PS" ] ; then
479 if [ "$OPTION_FORCE" = "no" ] ; then
480 echo "ERROR: Another debug session running, Use --force to kill it."
481 exit 1
482 fi
483 log "Killing existing debugging session"
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700484 GDBSERVER_PID=`echo $GDBSERVER_PS | $AWK_CMD -f $AWK_SCRIPTS/extract-pid.awk -v PACKAGE=lib/gdbserver`
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700485 if [ $GDBSERVER_PID != 0 ] ; then
486 run $ADB_CMD shell kill -9 $GDBSERVER_PID
487 fi
488fi
489
490# Launch gdbserver now
491DEBUG_SOCKET=debug-socket
492run $ADB_CMD shell run-as $PACKAGE_NAME lib/gdbserver +$DEBUG_SOCKET --attach $PID &
493if [ $? != 0 ] ; then
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700494 echo "ERROR: Could not launch gdbserver on the device?"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700495 exit 1
496fi
497log "Launched gdbserver succesfully."
498
499# Setup network redirection
500log "Setup network redirection"
501run $ADB_CMD forward tcp:$DEBUG_PORT localfilesystem:$DATA_DIR/$DEBUG_SOCKET
502if [ $? != 0 ] ; then
David 'Digit' Turner0b2676b2010-04-27 12:33:46 -0700503 echo "ERROR: Could not setup network redirection to gdbserver?"
504 echo " Maybe using --port=<port> to use a different TCP port might help?"
David 'Digit' Turnera08d6052010-04-16 12:45:33 -0700505 exit 1
506fi
507
508# Get the app_server binary from the device
509APP_PROCESS=$APP_OUT/app_process
510run adb pull /system/bin/app_process $APP_PROCESS
511log "Pulled $APP_BINARY from device/emulator."
512
513# Now launch the appropriate gdb client with the right init commands
514#
515GDBCLIENT=${TOOLCHAIN_PREFIX}gdb
516GDBSETUP=$APP_OUT/gdb.setup
517cp -f $GDBSETUP_INIT $GDBSETUP
518echo "target remote :$DEBUG_PORT" >> $GDBSETUP
519if [ -n "$OPTION_EXEC" ] ; then
520 cat $OPTION_EXEC >> $GDBSETUP
521fi
522$GDBCLIENT -x $GDBSETUP -e $APP_PROCESS