This file is indexed.

/usr/bin/sb2-qemu-gdbserver-prepare is in scratchbox2 2.2.4-1debian1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
#!/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 <<EOF
Usage: $progbase [OPTION] COMMAND

Options:
   -p PORT  sets gdbserver port to PORT (default 1234)
   -h       displays this help text

Prints out full command line that can be used to start ARM
binary under remote qemu gdbserver.
EOF
	exit 1
}

error_not_inside_sb2()
{
	echo "SB2: $progbase: This program can only be used from inside"
	echo "the scratchbox 2'ed environment"
	exit 1
}

if [ -z "$SBOX_SESSION_DIR" ]; then
	error_not_inside_sb2
fi

. $SBOX_SESSION_DIR/sb2-session.conf

#
# Checks whether we are in emulation mode and cpu transparency
# is set to sb2-qemu-arm.  Returns true (0) when environment
# is correct, false otherwise.
#
check_mode_and_cpu_transparency()
{
	local transp

	if [ "$sbox_mapmode" != "emulate" ]; then
		return 1
	fi
	transp=$sbox_cputransparency_cmd
	if [ -z "$transp" ]; then
		return 1
	fi
	/usr/bin/expr $transp : '.*-qemu-arm$' > /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 $@