#!/bin/sh

. "$(dirname "$0")/../gdbwrapper_lib.sh"

# make alias from host path to container path. After this no
# path substitution will be reqired (like gdb substitute-path)
if [ "$PROJECT_LOC" ]; then
	sudo mkdir -p "$PROJECT_LOC"
	if ! mount | grep -q "$PROJECT_LOC"; then
		sudo mount --bind "$EMBOX_DIR" "$PROJECT_LOC"
	fi
fi

echo $$ > "$GDBPID"

# TODO add gdb cross-compile prefix detection
exec gdb "$@"
