summaryrefslogtreecommitdiff
path: root/scripts/build/debug
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2019-03-11 07:33:22 (GMT)
committerAlexey Neyman <stilor@att.net>2019-03-11 07:33:22 (GMT)
commitde36f78f898940e7611b177e9ccd97516f131caf (patch)
tree468264dc671077e05270674518d3cbcea083dc58 /scripts/build/debug
parent5332f480e44d2eed46faf3290b385d141ccc2df8 (diff)
Allow older GDB to build against newer glibc
Also, fix the subdir used when only gdbserver is built (without native GDB). Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/build/debug')
-rw-r--r--scripts/build/debug/300-gdb.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 1438912..e62e5df 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -122,7 +122,7 @@ do_debug_gdb_build()
gdbserver_extra_config+=("--disable-inprocess-agent")
fi
if [ "${CT_GDB_NATIVE}" != "y" ]; then
- subdir=gdbserver/
+ subdir=gdb/gdbserver/
fi
fi
@@ -175,6 +175,22 @@ do_gdb_backend()
esac
done
+ # Starting with glibc 2.25, it now provides a <proc_service.h> header. The
+ # problem is that GDB releases prior to 7.12 used to implement one of the
+ # interfaces, ps_get_thread_are with a const qualifier on one of the arguments.
+ # Therefore, such older versions cannot be compiled against a newer glibc.
+ # If we detect such a combination, mitigate by creating a local proc_service.h
+ # with a prototype adjusted for GDB requirements.
+ if [ -r "${CT_HEADERS_DIR}/proc_service.h" -a "${CT_GDB_CONST_GET_THREAD_AREA}" = "y" ]; then
+ CT_DoLog DEBUG "Fixing up the prototype in <proc_service.h>"
+ CT_DoExecLog ALL mkdir -p gdb/gdbserver
+ CT_DoExecLog ALL cp "${CT_HEADERS_DIR}/proc_service.h" gdb/proc_service.h
+ CT_DoExecLog ALL sed -i \
+ "s/\(ps_get_thread_area *(\).*\(struct ps_prochandle\)/\1const \2/" \
+ gdb/proc_service.h
+ CT_DoExecLog ALL cp gdb/proc_service.h gdb/gdbserver/proc_service.h
+ fi
+
if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")