#!/bin/sh # # This script prints out full command line that can be used to # execute ARM binary under qemu gdbserver. Usage is limited to # armel binaries where cpu transparency is set to qemu-arm and # mapping mode is emulate. # # For example if one wants to debug standalone gui binary (maemopad) # run inside emulation mode: # run-standalone.sh `sb2-qemu-gdbserver-prepare` ./maemopad # and qemu should start listening gdbserver port. # # Copyright (C) 2008 Nokia Corporation. # Licensed under GPL version 2 # prog="$0" progbase=`basename $0` usage() { cat < /dev/null 2>&1 return $? } check_mode_and_cpu_transparency if [ $? -ne 0 ]; then echo "SB2: $progbase: This script can be only used inside" echo "emulation mode where cpu transparency is set to sb2-qemu-arm" exit 1 fi port=1234 while getopts hp: p; do case $p in p) port="$OPTARG" ;; -) break ;; ?) usage ;; esac done # consume parameters shift $((OPTIND - 1)) if [ $# -lt 1 ]; then usage fi # validate that target binary really exists, otherwise sb2-show fails target="$1" if [ ! -e $target ]; then echo "SB2: $progbase: Target binary $target doesn't exist" exit 1 fi # # Run sb2-show and prepare output so that it is suitable for # remote debugging. # exec /usr/bin/sb2-show qemu-debug-exec -g $port $@