mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-23 14:42:26 +00:00
A bunch of fixes/improvements to the gdb build:
- allow native builds (both shared and static) - fix enabling threads - better handle the gdbserver case - introduce the ncurses library to allow native builds - re-order config options adequately /trunk/scripts/build/debug/300-gdb.sh | 126 79 47 0 ++++++++++++++++++++++++++--------------- /trunk/config/debug/gdb.in | 45 33 12 0 +++++++++++---- 2 files changed, 112 insertions(+), 59 deletions(-)
This commit is contained in:
parent
e66d06e8e3
commit
3950f8e87d
@ -13,38 +13,59 @@ config GDB_CROSS
|
||||
bool
|
||||
prompt "Cross-gdb"
|
||||
default y
|
||||
select GDB_GDBSERVER
|
||||
help
|
||||
Build and install a cross-gdb for the target, and to run on host.
|
||||
Build and install a cross-gdb for the target, to run on host.
|
||||
|
||||
config GDB_CROSS_STATIC_GDB
|
||||
config GDB_CROSS_STATIC
|
||||
bool
|
||||
prompt "Build a static cross gdb"
|
||||
default n
|
||||
depends on GDB_CROSS
|
||||
help
|
||||
A static cross gdb can be usefull if you debug on a machine that is
|
||||
not the one that is used to compile.
|
||||
not the one that is used to compile the toolchain.
|
||||
|
||||
config GDB_CROSS_STATIC_GDBSERVER
|
||||
That way, you can share the cross-gdb without installing a toolchain
|
||||
on every machine that will be used to debug target programs.
|
||||
|
||||
config GDB_NATIVE
|
||||
bool
|
||||
prompt "Native gdb"
|
||||
default n
|
||||
select GDB_GDBSERVER
|
||||
help
|
||||
Build and install a native gdb for the target, to run on the target.
|
||||
|
||||
config GDB_NATIVE_STATIC
|
||||
bool
|
||||
prompt "Build a static native gdb"
|
||||
default n
|
||||
depends on GDB_NATIVE
|
||||
help
|
||||
In case you have trouble with dynamic loading of shared libraries,
|
||||
you will find that a static gdb comes in handy.
|
||||
|
||||
config GDB_GDBSERVER
|
||||
bool
|
||||
prompt "gdbserver"
|
||||
default n
|
||||
help
|
||||
Build and install a gdbserver for the target, to run on the target.
|
||||
|
||||
config GDB_GDBSERVER_STATIC
|
||||
bool
|
||||
prompt "Build a static gdbserver"
|
||||
default n
|
||||
depends on GDB_CROSS
|
||||
depends on GDB_GDBSERVER
|
||||
help
|
||||
In case you have trouble with dynamic loading of shared libraries,
|
||||
you will find that a static gdbserver comes in handy.
|
||||
|
||||
config GDB_NATIVE
|
||||
bool
|
||||
prompt "Native gdb (EXPERIMENTAL)"
|
||||
default n
|
||||
depends on EXPERIMENTAL
|
||||
help
|
||||
Build and install a native gdb for the target, to run on the target.
|
||||
|
||||
choice
|
||||
bool
|
||||
prompt "gdb version"
|
||||
depends on GDB_CROSS || GDB_NATIVE || GDB_GDBSERVER
|
||||
|
||||
config GDB_V_snapshot
|
||||
bool
|
||||
@ -118,6 +139,6 @@ config NCURSES_VERSION
|
||||
default "4.2" if NCURSES_V_4_2
|
||||
default "5.6" if NCURSES_V_5_6
|
||||
|
||||
endif # ncurses
|
||||
endif # GDB_NATIVE --> ncurses
|
||||
|
||||
endif
|
||||
|
@ -47,22 +47,29 @@ do_debug_gdb_build() {
|
||||
mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
|
||||
cd "${CT_BUILD_DIR}/build-gdb-cross"
|
||||
|
||||
if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
|
||||
extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
|
||||
fi
|
||||
case "${CT_THREADS}" in
|
||||
none) extra_config="${extra_config} --disable-threads";;
|
||||
*) extra_config="${extra_config} --enable-threads";;
|
||||
esac
|
||||
|
||||
CC_for_gdb=
|
||||
LD_for_gdb=
|
||||
if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
|
||||
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
|
||||
CC_for_gdb="gcc -static"
|
||||
LD_for_gdb="ld -static"
|
||||
fi
|
||||
|
||||
CC="${CC_for_gdb}" \
|
||||
LD="${LD_forgdb}" \
|
||||
LD="${LD_for_gdb}" \
|
||||
"${gdb_src_dir}/configure" \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_HOST} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix="${CT_PREFIX_DIR}" \
|
||||
--with-build-sysroot="${CT_SYSROOT_DIR}" \
|
||||
--enable-threads \
|
||||
${extra_config} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Building cross-gdb"
|
||||
@ -72,48 +79,6 @@ do_debug_gdb_build() {
|
||||
make install 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_EndStep
|
||||
|
||||
CT_DoStep INFO "Installing gdbserver"
|
||||
CT_DoLog EXTRA "Configuring gdbserver"
|
||||
|
||||
mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
|
||||
cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
|
||||
|
||||
# Workaround for bad versions, where the configure
|
||||
# script for gdbserver is not executable...
|
||||
# Bah, GNU folks strike again... :-(
|
||||
chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
|
||||
|
||||
gdbserver_LDFLAGS=
|
||||
if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
|
||||
gdbserver_LDFLAGS=-static
|
||||
fi
|
||||
|
||||
LDFLAGS="${gdbserver_LDFLAGS}" \
|
||||
"${gdb_src_dir}/gdb/gdbserver/configure" \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_TARGET} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--includedir="${CT_HEADERS_DIR}" \
|
||||
--with-build-sysroot="${CT_SYSROOT_DIR}" \
|
||||
--program-prefix= \
|
||||
--without-uiout \
|
||||
--disable-tui \
|
||||
--disable-gdbtk \
|
||||
--without-x \
|
||||
--without-included-gettext \
|
||||
${extra_config} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Building gdbserver"
|
||||
make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Installing gdbserver"
|
||||
make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_EndStep
|
||||
fi
|
||||
|
||||
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
||||
@ -138,7 +103,6 @@ do_debug_gdb_build() {
|
||||
--without-sysmouse \
|
||||
--without-progs \
|
||||
--enable-termcap \
|
||||
--without-develop \
|
||||
${ncurses_opts} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Building ncurses"
|
||||
@ -155,6 +119,22 @@ do_debug_gdb_build() {
|
||||
mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
|
||||
cd "${CT_BUILD_DIR}/build-gdb-native"
|
||||
|
||||
case "${CT_THREADS}" in
|
||||
none) extra_config="${extra_config} --disable-threads";;
|
||||
*) extra_config="${extra_config} --enable-threads";;
|
||||
esac
|
||||
|
||||
CC_for_gdb=
|
||||
LD_for_gdb=
|
||||
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
|
||||
CC_for_gdb="${CT_TARGET}-gcc -static"
|
||||
LD_for_gdb="${CT_TARGET}-ld -static"
|
||||
fi
|
||||
|
||||
export ac_cv_func_strncmp_works=yes
|
||||
|
||||
CC="${CC_for_gdb}" \
|
||||
LD="${LD_for_gdb}" \
|
||||
"${gdb_src_dir}/configure" \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_TARGET} \
|
||||
@ -166,8 +146,9 @@ do_debug_gdb_build() {
|
||||
--disable-gdbtk \
|
||||
--without-x \
|
||||
--disable-sim \
|
||||
--disable-gdbserver \
|
||||
--disable-werror \
|
||||
--without-included-gettext \
|
||||
--without-develop \
|
||||
${extra_config} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Building native gdb"
|
||||
@ -176,6 +157,57 @@ do_debug_gdb_build() {
|
||||
CT_DoLog EXTRA "Installing native gdb"
|
||||
make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
|
||||
|
||||
# Building a native gdb also builds a gdbserver
|
||||
CT_DoLog DEBUG "Removing spurious gdbserver"
|
||||
find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} + 2>&1 |CT_DoLog ALL
|
||||
|
||||
unset ac_cv_func_strncmp_works
|
||||
|
||||
CT_EndStep
|
||||
fi
|
||||
|
||||
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
|
||||
CT_DoStep INFO "Installing gdbserver"
|
||||
CT_DoLog EXTRA "Configuring gdbserver"
|
||||
|
||||
mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
|
||||
cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
|
||||
|
||||
# Workaround for bad versions, where the configure
|
||||
# script for gdbserver is not executable...
|
||||
# Bah, GNU folks strike again... :-(
|
||||
chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
|
||||
|
||||
gdbserver_LDFLAGS=
|
||||
if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
|
||||
gdbserver_LDFLAGS=-static
|
||||
fi
|
||||
|
||||
LDFLAGS="${gdbserver_LDFLAGS}" \
|
||||
"${gdb_src_dir}/gdb/gdbserver/configure" \
|
||||
--build=${CT_BUILD} \
|
||||
--host=${CT_TARGET} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--includedir="${CT_HEADERS_DIR}" \
|
||||
--with-build-sysroot="${CT_SYSROOT_DIR}" \
|
||||
--program-prefix= \
|
||||
--without-uiout \
|
||||
--disable-tui \
|
||||
--disable-gdbtk \
|
||||
--without-x \
|
||||
--without-included-gettext \
|
||||
--without-develop \
|
||||
${extra_config} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Building gdbserver"
|
||||
make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_DoLog EXTRA "Installing gdbserver"
|
||||
make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
|
||||
|
||||
CT_EndStep
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user