#!/bin/sh # Copyright 2014-2015 VMware, Inc. All rights reserved. -- VMware Confidential # Work around for PR 1320956: Set LD_LIBRARY_PATH so that gdb will find # libpython2.7.so.1.0. This is needed because the linux-targeted gdb # expects to dynamically link with the libpython from cayman_esx_python, # but that's not trivially available when the bug was found (two days # before final freeze for 2015 RC). # Since the gdb executable is included in each devkit, we need to find # the one for this particular devkit and invoke it. That means figuring # out which one we're in. The scenarios are: # # - We were invoked via PATH. # - We were invoked with a relative pathname. # - We were invoked with an absolute pathname. # # For the first case (no / in $0), search PATH until we find ourselves. # Take the result and proceed to case three. # # For the second case (there is a slash in $0, but it's not the first # character), concatenate the current working directory and the relative # path. Proceed to case three. # # In case three, we know where the real gdb is relative to this script, # so just modify the path to remove our script name and append the relative # path to gdb to it. gdbPath=$(/bin/rpm -q --qf '%{INSTPREFIXES}\n' \ vmware-esx-cayman_esx_gdb-1af75dbb095cc2348c35c6708c8b326ac1661974-toolchain)/lin64/usr/bin/gdb CAYMAN_PYTHON_ROOT=$(/bin/rpm -q --qf '%{INSTPREFIXES}\n' \ vmware-esx-cayman_python-99788ba0a9e40ea80ae7b05efb941377abfb31e4-toolchain) export PYTHONHOME=${CAYMAN_PYTHON_ROOT}/lin64 export LD_LIBRARY_PATH=${PYTHONHOME}/lib exec "$gdbPath" "$@"