Signed-off-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
Chris Packham 2021-08-25 20:29:43 +12:00
commit 86e7788dd0
11 changed files with 310 additions and 31 deletions

View File

@ -40,3 +40,9 @@ config GDB_HAS_IPA_LIB
config GDB_CONST_GET_THREAD_AREA
bool
default y if GDB_older_than_7_12
# As of GDB 10.x gdbserver is now at the toplevel of the distributed
# tarball (instead of a subdirectory of gdb)
config GDB_GDBSERVER_TOPLEVEL
def_bool y
depends on GDB_10_2_or_later

33
packages/gdb/10.2/0000-musl_fix.patch vendored Normal file
View File

@ -0,0 +1,33 @@
---
gdb/linux-nat.c | 5 +++++
gdb/stopcode.h | 4 ++++
2 files changed, 9 insertions(+)
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "stopcode.h"
#include "defs.h"
#include "inferior.h"
#include "infrun.h"
@@ -70,6 +71,10 @@
#include "gdbsupport/gdb-sigmask.h"
#include "debug.h"
+#ifndef __SIGRTMIN
+#define __SIGRTMIN SIGRTMIN
+#endif
+
/* This comment documents high-level logic of this file.
Waiting for events in sync mode
--- a/gdb/stopcode.h
+++ b/gdb/stopcode.h
@@ -0,0 +1,4 @@
+#ifndef W_STOPCODE
+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#endif
+

View File

@ -0,0 +1,35 @@
Improve gnulib in gdb's guess work, gettimeofday() works in uClibcm promise.
This patch helps building x86_64-unknown-linux-uclibc toolchains, the final
gdb-native step otherwise fails when linking the libinproctrace.so
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
---
gnulib/configure | 2 ++
gnulib/import/m4/gettimeofday.m4 | 2 ++
2 files changed, 4 insertions(+)
--- a/gnulib/configure
+++ b/gnulib/configure
@@ -20745,6 +20745,8 @@
case "$host_os" in
# Guess all is fine on glibc systems.
*-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+ # Guess all is fine on uclibc systems.
+ *-uclibc*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# Guess all is fine on musl systems.
*-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# Guess no on native Windows.
--- a/gnulib/import/m4/gettimeofday.m4
+++ b/gnulib/import/m4/gettimeofday.m4
@@ -105,6 +105,8 @@
case "$host_os" in
# Guess all is fine on glibc systems.
*-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+ # Guess all is fine on uclibc systems.
+ *-uclibc*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# Guess all is fine on musl systems.
*-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
# Guess no on native Windows.

View File

@ -0,0 +1,30 @@
From 208ea73d38c9c16cf983b6419f58050dbadcb6a9 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 7 Jun 2015 22:43:49 +0300
Subject: [PATCH 2/2] xtensa: make sure ar_base is initialized
ar_base is uninitialized for cores w/o windowed registers as their
regmap doesn't have register 0x0100.
Check that ar_base is initialized and if not initialize it with a0_base.
gdb/
* xtensa-tdep.c (xtensa_derive_tdep): Make sure ar_base is
initialized.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gdb/xtensa-tdep.c | 3 +++
1 file changed, 3 insertions(+)
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -3137,6 +3137,9 @@
if (tdep->num_regs == 0)
tdep->num_regs = tdep->num_nopriv_regs;
+ if (tdep->ar_base == -1)
+ tdep->ar_base = tdep->a0_base;
+
/* Number of pseudo registers. */
tdep->num_pseudo_regs = n - tdep->num_regs;

View File

@ -0,0 +1,26 @@
From 7f8eacbb468575fb67db7fd1155a3aedaa91911b Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 7 Jun 2015 23:15:39 +0300
Subject: [PATCH] WIP: *end of prologue* detection hack
see
http://www.esp8266.com/viewtopic.php?p=18461#p18461
http://www.esp8266.com/viewtopic.php?p=19026#p19026
http://www.esp8266.com/viewtopic.php?p=19683#p19683
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gdb/xtensa-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -2385,7 +2385,7 @@
/* Find out, if we have an information about the prologue from DWARF. */
prologue_sal = find_pc_line (start, 0);
if (prologue_sal.line != 0) /* Found debug info. */
- body_pc = prologue_sal.end;
+ body_pc = prologue_sal.end + 40;
/* If we are going to analyze the prologue in general without knowing about
the current PC, make the best assumption for the end of the prologue. */

View File

@ -0,0 +1,45 @@
---
gdb/gdbserver/configure | 11 -----------
gdb/gdbserver/configure.ac | 11 -----------
2 files changed, 22 deletions(-)
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -10069,17 +10069,6 @@
case "${target}" in
- *-android*)
- # Starting with NDK version 9, <elf.h> actually includes definitions
- # of Elf32_auxv_t and Elf64_auxv_t. But sadly, <elf.h> includes
- # <sys/exec_elf.h> which defines some of the ELF types incorrectly,
- # leading to conflicts with the defintions from <linux/elf.h>.
- # This makes it impossible for us to include both <elf.h> and
- # <linux/elf.h>, which means that, in practice, we do not have
- # access to Elf32_auxv_t and Elf64_auxv_t on this platform.
- # Therefore, do not try to auto-detect availability, as it would
- # get it wrong on this platform.
- ;;
*)
ac_fn_c_check_type "$LINENO" "Elf32_auxv_t" "ac_cv_type_Elf32_auxv_t" "#include <elf.h>
--- a/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -155,17 +155,6 @@
])
case "${target}" in
- *-android*)
- # Starting with NDK version 9, <elf.h> actually includes definitions
- # of Elf32_auxv_t and Elf64_auxv_t. But sadly, <elf.h> includes
- # <sys/exec_elf.h> which defines some of the ELF types incorrectly,
- # leading to conflicts with the defintions from <linux/elf.h>.
- # This makes it impossible for us to include both <elf.h> and
- # <linux/elf.h>, which means that, in practice, we do not have
- # access to Elf32_auxv_t and Elf64_auxv_t on this platform.
- # Therefore, do not try to auto-detect availability, as it would
- # get it wrong on this platform.
- ;;
*)
AC_CHECK_TYPES([Elf32_auxv_t, Elf64_auxv_t], [], [],
#include <elf.h>

View File

@ -0,0 +1,35 @@
From 6f110500ed04148e3734f5b6a4fc573477c8398a Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin@synopsys.com>
Date: Tue, 24 Aug 2021 12:29:18 -0700
Subject: [PATCH] xtensa: Fix compilation of gdbserver
Otherwise a lot of errors like the following happen:
--------------------------->8---------------------------------
Error: .../gdb/xtensa-linux-nat.c:66:17: error: 'gdbarch_pc_regnum' was not declared in this scope
Error: .../gdb/xtensa-linux-nat.c:68:17: error: 'gdbarch_ps_regnum' was not declared in this scope
Error: .../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to 'gdbarch_tdep::gdbarch_tdep(gdbarch*&)'
...
--------------------------->8---------------------------------
Initially caught by https://github.com/crosstool-ng/crosstool-ng/pull/1573/checks?check_run_id=3361561567
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
gdb/xtensa-linux-nat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index b2b3db182bc..03f3ba7b50a 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -34,6 +34,7 @@
#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
+#include "gdbarch.h"
#include "gregset.h"
#include "xtensa-tdep.h"
--
2.16.2

8
packages/gdb/10.2/chksum vendored Normal file
View File

@ -0,0 +1,8 @@
md5 gdb-10.2.tar.xz c044b7146903ec51c9d2337a29aee93b
sha1 gdb-10.2.tar.xz 1056e2743a825ecce46ec9eec37f0b357831012b
sha256 gdb-10.2.tar.xz aaa1223d534c9b700a8bec952d9748ee1977513f178727e1bee520ee000b4f29
sha512 gdb-10.2.tar.xz 3653762ac008e065c37cd641653184c9ff7ce51ee2222ade1122bec9d6cc64dffd4fb74888ef11ac1942064a08910e96b7865112ad37f4602eb0a16bed074caa
md5 gdb-10.2.tar.gz 7aeb896762924ae9a2ec59525088bada
sha1 gdb-10.2.tar.gz 6bf5ee7877a4740835745ed97ce525a00bb2232c
sha256 gdb-10.2.tar.gz b33ad58d687487a821ec8d878daab0f716be60d0936f2e3ac5cf08419ce70350
sha512 gdb-10.2.tar.gz aa89caf47c1c84366020377d47e7c51ddbc48e5b7686f244e38797c8eb88411cf57fcdc37eb669961efb41ceeac4181747f429625fd1acce7712cb9a1fea9c41

0
packages/gdb/10.2/version.desc vendored Normal file
View File

View File

@ -2,5 +2,5 @@ origin='GNU'
repository='git git://sourceware.org/git/binutils-gdb.git'
mirrors='$(CT_Mirrors GNU gdb) $(CT_Mirrors sourceware gdb/releases)'
relevantpattern='*.*|[a-z.]'
milestones='7.0 7.2 7.12 8.0 8.3'
milestones='7.0 7.2 7.12 8.0 8.3 10.2'
archive_formats='.tar.xz .tar.gz'

View File

@ -50,6 +50,25 @@ do_debug_gdb_build()
cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security")
fi
# Target libexpat resides in sysroot and does not have
# any dependencies, so just passing '-lexpat' to gcc is enough.
#
# By default gdb configure looks for expat in '$prefix/lib'
# directory. In our case '$prefix/lib' resolves to '/usr/lib'
# where libexpat for build platform lives, which is
# unacceptable for cross-compiling.
#
# To prevent this '--without-libexpat-prefix' flag must be passed.
# Thus configure falls back to '-lexpat', which is exactly what we want.
#
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
# It conflicts with a static build: GDB's configure script will find the shared
# version of expat and will attempt to link that, despite the -static flag.
# The link will fail, and configure will abort with "expat missing or unusable"
# message.
extra_config+=("--with-expat")
extra_config+=("--without-libexpat-prefix")
do_gdb_backend \
buildtype=cross \
host="${CT_HOST}" \
@ -88,7 +107,7 @@ do_debug_gdb_build()
CT_EndStep
fi
if [ "${CT_GDB_NATIVE}" = "y" -o "${CT_GDB_GDBSERVER}" = "y" ]; then
if [ "${CT_GDB_NATIVE}" = "y" ]; then
local -a native_extra_config
local subdir
@ -102,17 +121,78 @@ do_debug_gdb_build()
native_extra_config+=("--with-curses")
fi
# Build a native gdbserver if needed. If building only
# gdbserver, configure in the subdirectory.
# Newer versions enable it automatically for a native target by default.
if [ "${CT_GDB_GDBSERVER}" != "y" ]; then
native_extra_config+=("--disable-gdbserver")
if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then
native_extra_config+=("--enable-inprocess-agent")
else
native_extra_config+=("--enable-gdbserver")
if [ "${CT_GDB_NATIVE}" != "y" ]; then
native_extra_config+=("--disable-inprocess-agent")
fi
export ac_cv_func_strncmp_works=yes
# TBD do we need all these? Eg why do we disable TUI if we build curses for target?
native_extra_config+=(
--without-uiout
--disable-tui
--disable-gdbtk
--without-x
--disable-sim
--without-included-gettext
--without-develop
--sysconfdir=/etc
--localstatedir=/var
)
# Target libexpat resides in sysroot and does not have
# any dependencies, so just passing '-lexpat' to gcc is enough.
#
# By default gdb configure looks for expat in '$prefix/lib'
# directory. In our case '$prefix/lib' resolves to '/usr/lib'
# where libexpat for build platform lives, which is
# unacceptable for cross-compiling.
#
# To prevent this '--without-libexpat-prefix' flag must be passed.
# Thus configure falls back to '-lexpat', which is exactly what we want.
#
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
# It conflicts with a static build: GDB's configure script will find the shared
# version of expat and will attempt to link that, despite the -static flag.
# The link will fail, and configure will abort with "expat missing or unusable"
# message.
extra_config+=("--with-expat")
extra_config+=("--without-libexpat-prefix")
do_gdb_backend \
buildtype=native \
subdir=${subdir} \
host="${CT_TARGET}" \
cflags="${CT_ALL_TARGET_CFLAGS}" \
ldflags="${CT_ALL_TARGET_LDFLAGS}" \
static="${CT_GDB_NATIVE_STATIC}" \
static_libstdc="${CT_GDB_NATIVE_STATIC_LIBSTDC}" \
prefix=/usr \
destdir="${CT_DEBUGROOT_DIR}" \
"${native_extra_config[@]}"
unset ac_cv_func_strncmp_works
CT_Popd
CT_EndStep # native gdb build
fi
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
local -a native_extra_config
local subdir
if [ "${CT_GDB_GDBSERVER_TOPLEVEL}" != "y" ]; then
subdir=gdb/gdbserver/
fi
fi
CT_DoStep INFO "Installing gdb server"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-server"
native_extra_config+=("--program-prefix=")
native_extra_config+=("--enable-gdbserver")
if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then
native_extra_config+=("--enable-inprocess-agent")
else
@ -149,7 +229,7 @@ do_debug_gdb_build()
unset ac_cv_func_strncmp_works
CT_Popd
CT_EndStep # native gdb build
CT_EndStep # gdb server build
fi
}
@ -208,25 +288,6 @@ do_gdb_backend()
extra_config+=("--disable-nls")
fi
# Target libexpat resides in sysroot and does not have
# any dependencies, so just passing '-lexpat' to gcc is enough.
#
# By default gdb configure looks for expat in '$prefix/lib'
# directory. In our case '$prefix/lib' resolves to '/usr/lib'
# where libexpat for build platform lives, which is
# unacceptable for cross-compiling.
#
# To prevent this '--without-libexpat-prefix' flag must be passed.
# Thus configure falls back to '-lexpat', which is exactly what we want.
#
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
# It conflicts with a static build: GDB's configure script will find the shared
# version of expat and will attempt to link that, despite the -static flag.
# The link will fail, and configure will abort with "expat missing or unusable"
# message.
extra_config+=("--with-expat")
extra_config+=("--without-libexpat-prefix")
if [ "${static}" = "y" ]; then
cflags+=" -static"
ldflags+=" -static"