Skip to content

Commit

Permalink
GDB 7.12 needs c++.
Browse files Browse the repository at this point in the history
Also, minor fixes in 300-gdb.sh

Signed-off-by: Alexey Neyman <stilor@att.net>
  • Loading branch information
stilor committed Jan 14, 2017
1 parent d7b3137 commit d34a6bd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
13 changes: 6 additions & 7 deletions config/debug/gdb.in
Expand Up @@ -6,15 +6,13 @@ source "config/debug/gdb.in.cross"
source "config/debug/gdb.in.native"
source "config/debug/gdb.in.gdbserver"

if GDB_CROSS || GDB_NATIVE || GDB_GDBSERVER

comment "gdb version"

config GDB_CUSTOM
bool
prompt "Custom gdb"
depends on EXPERIMENTAL
select GDB_7_2_or_later
select GDB_7_12_or_later
help
The choosen gdb version shall be not downloaded. Instead use
a custom location to get the source.
Expand Down Expand Up @@ -71,7 +69,7 @@ choice
config GDB_V_7_12
bool
prompt "7.12"
select GDB_7_2_or_later
select GDB_7_12_or_later

config GDB_V_7_11
bool
Expand Down Expand Up @@ -224,6 +222,10 @@ endchoice

endif # ! GDB_CUSTOM

config GDB_7_12_or_later
bool
select GDB_7_2_or_later

config GDB_7_2_or_later
bool
select GDB_7_0_or_later
Expand Down Expand Up @@ -280,6 +282,3 @@ config GDB_VERSION
default "6.8a" if GDB_V_6_8a

endif # ! GDB_CUSTOM

endif # GDB_CROSS || GDB_NATIVE || GDB_GDBSERVER

1 change: 1 addition & 0 deletions config/debug/gdb.in.native
Expand Up @@ -5,6 +5,7 @@ config GDB_NATIVE
prompt "Native gdb"
depends on ! BARE_METAL
depends on ! BACKEND
depends on CC_LANG_CXX || !GDB_7_12_or_later
select EXPAT_TARGET
select NCURSES_TARGET
help
Expand Down
29 changes: 20 additions & 9 deletions scripts/build/debug/300-gdb.sh
Expand Up @@ -90,24 +90,30 @@ do_debug_gdb_build() {
cross_extra_config+=("--disable-nls")
fi

CPP_for_gdb="${CT_HOST}-cpp ${CT_CFLAGS_FOR_HOST}"
CC_for_gdb="${CT_HOST}-gcc ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
CXX_for_gdb="${CT_HOST}-g++ ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
LD_for_gdb="${CT_HOST}-ld ${CT_LDFLAGS_FOR_HOST}"
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
CC_for_gdb+=" -static"
CXX_for_gdb+=" -static"
LD_for_gdb+=" -static"
fi
case "${CT_HOST}" in
*darwin*)
# FIXME: Really, we should be testing for host compiler being clang.
CC_for_gdb+=" -Qunused-arguments"
CXX_for_gdb+=" -Qunused-arguments"
;;
esac

# Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there
# are multiple consecutive spaces: sub-configure scripts replace them with a
# single space and then complain that $CC value changed from that in
# the master directory.
CPP_for_gdb=`echo $CPP_for_gdb`
CC_for_gdb=`echo $CC_for_gdb`
CXX_for_gdb=`echo $CXX_for_gdb`
LD_for_gdb=`echo $LD_for_gdb`

# Disable binutils options when building from the binutils-gdb repo.
Expand All @@ -118,7 +124,9 @@ do_debug_gdb_build() {
CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"

CT_DoExecLog CFG \
CPP="${CPP_for_gdb}" \
CC="${CC_for_gdb}" \
CXX="${CXX_for_gdb}" \
LD="${LD_for_gdb}" \
"${gdb_src_dir}/configure" \
--build=${CT_BUILD} \
Expand Down Expand Up @@ -165,7 +173,6 @@ do_debug_gdb_build() {

if [ "${CT_GDB_NATIVE}" = "y" ]; then
local -a native_extra_config
local -a gdb_native_CFLAGS

CT_DoStep INFO "Installing native gdb"

Expand Down Expand Up @@ -208,12 +215,14 @@ do_debug_gdb_build() {
[ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && \
native_extra_config+=("--disable-nls")

CPP_for_gdb="${CT_TARGET}-cpp"
CC_for_gdb="${CT_TARGET}-${CT_CC}"
CXX_for_gdb="${CT_TARGET}-g++"
LD_for_gdb="${CT_TARGET}-ld"
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
CC_for_gdb="${CT_TARGET}-gcc -static"
LD_for_gdb="${CT_TARGET}-ld -static"
else
CC_for_gdb="${CT_TARGET}-gcc"
LD_for_gdb="${CT_TARGET}-ld"
CC_for_gdb+=" -static"
CXX_for_gdb+=" -static"
LD_for_gdb+=" -static"
fi

export ac_cv_func_strncmp_works=yes
Expand All @@ -226,9 +235,10 @@ do_debug_gdb_build() {
CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"

CT_DoExecLog CFG \
CPP="${CPP_for_gdb}" \
CC="${CC_for_gdb}" \
CXX="${CXX_for_gdb}" \
LD="${LD_for_gdb}" \
CFLAGS="${gdb_native_CFLAGS[*]}" \
"${gdb_src_dir}/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
Expand All @@ -246,7 +256,7 @@ do_debug_gdb_build() {
"${native_extra_config[@]}"

CT_DoLog EXTRA "Building native gdb"
CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC}
CT_DoExecLog ALL make ${JOBSFLAGS}

CT_DoLog EXTRA "Installing native gdb"
CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
Expand All @@ -261,6 +271,7 @@ do_debug_gdb_build() {

if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
local -a gdbserver_extra_config
local gdbserver_LDFLAGS

CT_DoStep INFO "Installing gdbserver"
CT_DoLog EXTRA "Configuring gdbserver"
Expand Down Expand Up @@ -294,7 +305,7 @@ do_debug_gdb_build() {
gdbserver_extra_config+=("--disable-gas")

CT_DoExecLog CFG \
CC="${CT_TARGET}-gcc" \
CC="${CT_TARGET}-${CT_CC}" \
CPP="${CT_TARGET}-cpp" \
LD="${CT_TARGET}-ld" \
LDFLAGS="${gdbserver_LDFLAGS}" \
Expand Down

0 comments on commit d34a6bd

Please sign in to comment.