debug/gdb: install gdbinit sample file
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 24 20:30:52 2011 +0200 (2011-07-24)
changeset 25702651341cc084
parent 2569 4aba7a7337b0
child 2571 c18e79033384
debug/gdb: install gdbinit sample file

gdb needs to know where to find the libstdc++ helper python script
to do, well, whatever it has to do with it...

We can't install that in the user's ~/.gdbinit, it's too complex to
handle all the cases. Moreover, if the user is using more than one
toolchain, we can't put all that stuff in there...

Just provide a sample config file the user can adapt to his/her
own needs.

Thanks go to Khem RAJ for providing such a hint:
http://sourceware.org/ml/crossgcc/2011-07/msg00026.html

Reported-by: ANDY KENNEDY <ANDY.KENNEDY@adtran.com>
CC: Khem Raj <raj.khem@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/debug/300-gdb.sh
scripts/build/debug/gdbinit.in
     1.1 --- a/scripts/build/debug/300-gdb.sh	Sun Jul 24 00:24:49 2011 +0200
     1.2 +++ b/scripts/build/debug/300-gdb.sh	Sun Jul 24 20:30:52 2011 +0200
     1.3 @@ -105,6 +105,7 @@
     1.4  
     1.5      if [ "${CT_GDB_CROSS}" = "y" ]; then
     1.6          local -a cross_extra_config
     1.7 +        local gcc_version
     1.8  
     1.9          CT_DoStep INFO "Installing cross-gdb"
    1.10          CT_DoLog EXTRA "Configuring cross-gdb"
    1.11 @@ -149,6 +150,21 @@
    1.12          CT_DoLog EXTRA "Installing cross-gdb"
    1.13          CT_DoExecLog ALL make install
    1.14  
    1.15 +        CT_DoLog EXTRA "Install '.gdbinit' template"
    1.16 +        # See in scripts/build/internals.sh for why we do this
    1.17 +        if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then
    1.18 +            gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" )
    1.19 +        else
    1.20 +            gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
    1.21 +                               "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c"   \
    1.22 +                         )
    1.23 +        fi
    1.24 +        ${sed} -r                                               \
    1.25 +               -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;"             \
    1.26 +               -e "s:@@VERSION@@:${gcc_version}:;"              \
    1.27 +               "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in"   \
    1.28 +               >"${CT_PREFIX_DIR}/share/gdb/gdbinit"
    1.29 +
    1.30          CT_EndStep
    1.31      fi
    1.32  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/scripts/build/debug/gdbinit.in	Sun Jul 24 20:30:52 2011 +0200
     2.3 @@ -0,0 +1,6 @@
     2.4 +python
     2.5 +import sys
     2.6 +sys.path.insert(0, '@@PREFIX@@/share/gcc-@@VERSION@@/python')
     2.7 +from libstdcxx.v6.printers import register_libstdcxx_printers
     2.8 +register_libstdcxx_printers (None)
     2.9 +end