scripts/build/debug/gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Apr 26 21:31:05 2008 +0000 (2008-04-26)
changeset 454 372b2f397baa
parent 175 043e44606e28
child 457 578fdd250fcc
permissions -rw-r--r--
Configure tsocks with a simple heuristic.

Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.

So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.

If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).

/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
     1 # Build script for the gdb debug facility
     2 
     3 is_enabled="${CT_GDB}"
     4 
     5 do_print_filename() {
     6     [ "${CT_GDB}" = "y" ] || return 0
     7     echo "gdb`do_debug_gdb_suffix`"
     8 }
     9 
    10 do_debug_gdb_suffix() {
    11     case "${CT_GDB_VERSION}" in
    12         snapshot)   ;;
    13         *)          echo "-${CT_GDB_VERSION}";;
    14     esac
    15 }
    16 
    17 do_debug_gdb_get() {
    18     CT_GetFile "gdb`do_debug_gdb_suffix`"                           \
    19                ftp://ftp.gnu.org/pub/gnu/gdb                        \
    20                ftp://sources.redhat.com/pub/gdb/releases            \
    21                ftp://sources.redhat.com/pub/gdb/old-releases        \
    22                ftp://sources.redhat.com/pub/gdb/snapshots/current 
    23 }
    24 
    25 do_debug_gdb_extract() {
    26     CT_ExtractAndPatch "gdb`do_debug_gdb_suffix`"
    27 }
    28 
    29 do_debug_gdb_build() {
    30     gdb_src_dir="${CT_SRC_DIR}/gdb`do_debug_gdb_suffix`"
    31 
    32     extra_config=
    33     # Version 6.3 and below behave badly with gdbmi
    34     case "${CT_GDB_VERSION}" in
    35         6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    36     esac
    37 
    38     if [ "${CT_GDB_CROSS}" = "y" ]; then
    39         CT_DoStep INFO "Installing cross-gdb"
    40         CT_DoLog EXTRA "Configuring cross-gdb"
    41 
    42         mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    43         cd "${CT_BUILD_DIR}/build-gdb-cross"
    44 
    45         "${gdb_src_dir}/configure"                      \
    46             --build=${CT_BUILD}                         \
    47             --host=${CT_HOST}                           \
    48             --target=${CT_TARGET}                       \
    49             --prefix="${CT_PREFIX_DIR}"                 \
    50             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    51             --enable-threads                            \
    52             ${extra_config}                             2>&1 |CT_DoLog ALL
    53 
    54         CT_DoLog EXTRA "Building cross-gdb"
    55         make ${PARALLELMFLAGS}                          2>&1 |CT_DoLog ALL
    56 
    57         CT_DoLog EXTRA "Installing cross-gdb"
    58         make install                                    2>&1 |CT_DoLog ALL
    59 
    60         CT_EndStep
    61 
    62         CT_DoStep INFO "Installing gdbserver"
    63         CT_DoLog EXTRA "Configuring gdbserver"
    64 
    65         mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
    66         cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
    67 
    68         # Workaround for bad versions, where the configure
    69         # script for gdbserver is not executable...
    70         # Bah, GNU folks strike again... :-(
    71         chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
    72 
    73         gdbserver_LDFLAGS=
    74         if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
    75             gdbserver_LDFLAGS=-static
    76         fi
    77 
    78         LDFLAGS="${gdbserver_LDFLAGS}"                  \
    79         "${gdb_src_dir}/gdb/gdbserver/configure"        \
    80             --build=${CT_BUILD}                         \
    81             --host=${CT_TARGET}                         \
    82             --target=${CT_TARGET}                       \
    83             --prefix=/usr                               \
    84             --sysconfdir=/etc                           \
    85             --localstatedir=/var                        \
    86             --includedir="${CT_HEADERS_DIR}"            \
    87             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    88             --program-prefix=                           \
    89             --without-uiout                             \
    90             --disable-tui                               \
    91             --disable-gdbtk                             \
    92             --without-x                                 \
    93             --without-included-gettext                  \
    94             ${extra_config}                             2>&1 |CT_DoLog ALL
    95 
    96         CT_DoLog EXTRA "Building gdbserver"
    97         make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
    98 
    99         CT_DoLog EXTRA "Installing gdbserver"
   100         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   101 
   102         CT_EndStep
   103     fi
   104 
   105     if [ "${CT_GDB_NATIVE}" = "y" ]; then
   106         CT_DoStep EXTRA "Installing native gdb"
   107         CT_DoLog EXTRA "Configuring native gdb"
   108 
   109         mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
   110         cd "${CT_BUILD_DIR}/build-gdb-native"
   111 
   112         "${gdb_src_dir}/configure"                      \
   113             --build=${CT_BUILD}                         \
   114             --host=${CT_TARGET}                         \
   115             --target=${CT_TARGET}                       \
   116             --prefix=/usr                               \
   117             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   118             --without-uiout                             \
   119             --disable-tui                               \
   120             --disable-gdbtk                             \
   121             --without-x                                 \
   122             --disable-sim                               \
   123             --disable-gdbserver                          \
   124             --without-included-gettext                  \
   125             ${extra_config}                             2>&1 |CT_DoLog ALL
   126 
   127         CT_DoLog EXTRA "Building native gdb"
   128         make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
   129 
   130         CT_DoLog EXTRA "Installing native gdb"
   131         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   132 
   133         CT_EndStep
   134     fi
   135 }