#!/bin/sh

DBGDIR=/usr/lib/debug
SBCONF=/targets/links/scratchbox.config

# in Sratchbox, create symlink(s) necessary for Gdb/Valgrind/Oprofile
# to find the debug symbol files
if [ -f $SBCONF ]; then
	mkdir -p $DBGDIR/targets
	cd $DBGDIR/targets
	ln -sf $DBGDIR $(sh -c ". $SBCONF;"'echo $SBOX_TARGET_NAME')

	# host-gdb needs .debug dirs, add them for the most common places
	for dir in lib usr/bin usr/lib; do
		cd /$dir/;
		ln -sf $DBGDIR/$dir .debug;
	done
fi

#DEBHELPER#

exit 0
