install gdb pretty printers

This commit is contained in:
David Tardon 2011-08-09 10:35:19 +02:00
parent 575cd2219f
commit 22ccd4da86
3 changed files with 113 additions and 1 deletions

View file

@ -30,7 +30,8 @@ install:
ooinstall "@INSTALLDIR@" && \
echo "" && \
echo "Installation finished, you can now execute:" && \
echo "@INSTALLDIR@/program/soffice"
echo "@INSTALLDIR@/program/soffice" && \
install-gdb-printers -a "@INSTALLDIR@"
distro-pack-install: install
./bin/distro-install-clean-up
@ -46,6 +47,7 @@ dev-install:
cd @abs_builddir@ && ln -s $$SOLARVER/$$INPATH/installation/opt/ install && \
echo "" && \
$$SOLARENV/bin/linkoo $$SRC_ROOT/install $$SRC_ROOT && \
install-gdb-printers -a "$$SOLARVER/$$INPATH/installation/opt" -L && \
echo && echo "Developer installation finished, you can now execute:" && echo && \
if test `uname -s` = Darwin; then \
echo open install/LibreOffice.app; \

68
solenv/bin/install-gdb-printers Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash
GDBDIR="${SOLARENV}/gdb"
die() {
echo "$1" >&2
exit 1
}
make_autoload() {
local dir="${DESTDIR}${autoloaddir}/$2"
local gdbfile="${dir}/$3-gdb.py"
if ${create}; then
mkdir -p "${dir}" || die "cannot create dir '${dir}'"
elif ${follow}; then
gdbfile="$(readlink -f "${dir}/$3")-gdb.py"
fi
sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULE%!libreoffice.$1!" \
"${GDBDIR}/autoload.template" > "${gdbfile}"
}
# dir where the autoloaders will be placed
autoloaddir=
# dir where the pretty printers will be placed
pythondir="${GDBDIR}"
# Create autoload dir if it does not exist. This only makes sense when
# installing into system gdb dir, so $autoloaddir must be absolute path.
create=false
# Follow links when looking up the path for the autoload file. This only
# makes sense for dev-install.
follow=false
# b defghijklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789
while getopts :a:cp:L opt; do
case ${opt} in
a) autoloaddir="${OPTARG}" ;;
c) create=true ;;
p) pythondir="${OPTARG}" ;;
L) follow=true ;;
*) die "unknown option ${OPTARG}" ;;
esac
done
${create} && ${follow} && die "-c and -L cannot be used together"
if [[ -n ${DESTDIR} ]]; then
[[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path'
[[ ${pythondir:0:1} = / ]] || die 'the arg to -p must be an absolute path'
fi
if ${create}; then
[[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path'
else
[[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist"
fi
[[ ! -d ${GDBDIR} ]] && die "directory '${GDBDIR}' does not exist"
if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then
mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'"
cp -r "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}"
fi
make_autoload cppu basis-link/ure-link/lib libuno_cppu.so.3
make_autoload sal basis-link/ure-link/lib libuno_sal.so.3
make_autoload svl basis-link/program libsvllo.so
make_autoload sw basis-link/program libswlo.so
make_autoload tl basis-link/program libtllo.so
# vim:set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -0,0 +1,42 @@
# Version: MPL 1.1 / GPLv3+ / LGPLv3+
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License or as specified alternatively below. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Initial Developer of the Original Code is
# David Tardon, Red Hat Inc. <dtardon@redhat.com>
# Portions created by the Initial Developer are Copyright (C) 2010 the
# Initial Developer. All Rights Reserved.
#
# Major Contributor(s):
#
# For minor contributions see the git repository.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
# instead of those above.
import os.path
import sys
import gdb
pythondir = os.path.normpath('%PYTHONDIR%')
if gdb.current_objfile():
if pythondir not in sys.path:
sys.path.insert(0, pythondir)
from %MODULE% import register_pretty_printers
register_pretty_printers(gdb.current_objfile())
# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: