Files
xen/tools/debugger/gdb/gdb-6.2.1-xen-sparse/mkbuildtree
T
kaf24@firebug.cl.cam.ac.uk 7254a301ec bitkeeper revision 1.1665.1.5 (42a1a779yqLZDCutMj_vFNQlo3q3zw)
Rationalise debugger stuff in the tree.

Within Xen itself, remove PDB references and fold into domu_debug.
When domu_debug hits a breakpoint, it pauses all vcpus of the domain
and raises VIRQ_DEBUGGER (not VIRQ_PDB). The debugger in domain0 can
either poll pause status or bind to VIRQ_DEBUGGER. Before debugging
a breakpointed domain the debugger should issue PAUSEDOMAIN itself, or
it is not guaranteed to see paused state of the domain!

Outside Xen there's a new dir tools/debugger, containing gdb, pdb and
a new library libxendebug (used by pdb). I also think the ptrace
functions in libxc also ought to be moved out: either to libxendebug
or to a new library libxenptrace.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-06-04 13:07:05 +00:00

116 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# mkbuildtree <build tree>
#
# Creates symbolic links in <build tree> for the sparse tree
# in the current directory.
# Script to determine the relative path between two directories.
# Copyright (c) D. J. Hawkey Jr. 2002
# Fixed for Xen project by K. Fraser in 2003.
abs_to_rel ()
{
local CWD SRCPATH
if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
SRCPATH=${1%?}
else
SRCPATH=$1
fi
if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
DESTPATH=${2%?}
else
DESTPATH=$2
fi
CWD=$PWD
[ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
[ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
[ "$CWD" != "$PWD" ] && cd $CWD
BASEPATH=$SRCPATH
[ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
[ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
BASEPATH=${BASEPATH%/*}
done
SRCPATH=${SRCPATH#$BASEPATH}
DESTPATH=${DESTPATH#$BASEPATH}
DESTPATH=${DESTPATH#?}
while [ -n "$SRCPATH" ]; do
SRCPATH=${SRCPATH%/*}
DESTPATH="../$DESTPATH"
done
[ -z "$BASEPATH" ] && BASEPATH="/"
[ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
}
# relative_lndir <target_dir>
# Creates a tree of symlinks in the current working directory that mirror
# real files in <target_dir>. <target_dir> should be relative to the current
# working directory. Symlinks in <target_dir> are ignored. Source-control files
# are ignored.
relative_lndir ()
{
local SYMLINK_DIR REAL_DIR pref i j
SYMLINK_DIR=$PWD
REAL_DIR=$1
(
cd $REAL_DIR
for i in `find . -type d | grep -v SCCS`; do
[ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
(
cd $i
pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
for j in `find . -type f -o -type l -maxdepth 1`; do
ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
done
)
done
)
}
[ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
# Get absolute path to the destination directory
pushd . >/dev/null
cd ${1}
AD=$PWD
popd >/dev/null
# Get absolute path to the source directory
AS=`pwd`
# Get name of sparse directory
SDN=$(basename $AS)
# Get path to source, relative to destination
abs_to_rel ${AD} ${AS}
RS=$DESTPATH
# We now work from the destination directory
cd ${AD}
# Remove old symlinks
find sys -type l | while read f
do
case $(readlink $f) in
*/$SDN/*)
rm -f $f
;;
esac
done
if [ -f ${AD}/BUILDING ]; then
# Create symlinks of files and directories which exist in the sparse source
(cd sys && relative_lndir ../${RS}/sys)
else
# Create symlinks of files and directories which exist in the sparse source
relative_lndir ${RS}
rm -f mkbuildtree
fi