summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch286
-rw-r--r--debian/patches/gdb-PATH_MAX.patch21
-rw-r--r--debian/patches/gdb-fortran-main.patch91
-rw-r--r--debian/patches/gdb-glibc-vdso-workaround.patch35
-rw-r--r--debian/patches/gdb_bsd-kvm.c.diff31
-rw-r--r--debian/patches/gdb_configure.nat.patch22
-rw-r--r--debian/patches/load-versioned-libcc1.patch27
-rw-r--r--debian/patches/python-config.patch193
-rw-r--r--debian/patches/series10
-rw-r--r--debian/patches/solve_PATH_MAX_issue.patch50
-rw-r--r--debian/patches/struct-thread_info.patch249
11 files changed, 1015 insertions, 0 deletions
diff --git a/debian/patches/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/debian/patches/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
new file mode 100644
index 0000000..c8f97d3
--- /dev/null
+++ b/debian/patches/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
@@ -0,0 +1,286 @@
+From: Jan Kratochvil <jan.kratochvil@redhat.com>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2
+
+Bug-Debian: http://bugs.debian.org/581707
+Bug-Redhat: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
+Origin: vendor, http://pkgs.fedoraproject.org/cgit/gdb.git/tree/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
+
+2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Port to GDB-6.8pre.
+
+currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
+will get:
+ (gdb) p errno
+ [some error]
+
+* with -ggdb2 and less "errno" in fact does not exist anywhere as it was
+ compiled to "(*__errno_location ())" and the macro definition is not present.
+ Unfortunately gdb will find the TLS symbol and it will try to access it but
+ as the program has been compiled without -lpthread the TLS base register
+ (%gs on i386) is not setup and it will result in:
+ Cannot access memory at address 0x8
+
+Attached suggestion patch how to deal with the most common "errno" symbol
+for the most common under-ggdb3 compiled programs.
+
+Original patch hooked into target_translate_tls_address. But its inferior
+call invalidates `struct frame *' in the callers - RH BZ 690908.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1166549
+
+
+2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
+ DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.
+
+glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
+ <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
+ <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
+---
+ gdb/printcmd.c | 6 ++-
+ gdb/testsuite/gdb.dwarf2/dw2-errno.c | 28 +++++++++++++
+ gdb/testsuite/gdb.dwarf2/dw2-errno.exp | 60 ++++++++++++++++++++++++++++
+ gdb/testsuite/gdb.dwarf2/dw2-errno2.c | 28 +++++++++++++
+ gdb/testsuite/gdb.dwarf2/dw2-errno2.exp | 71 +++++++++++++++++++++++++++++++++
+ 5 files changed, 192 insertions(+), 1 deletion(-)
+ create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-errno.c
+ create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-errno.exp
+ create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-errno2.c
+ create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
+
+Index: gdb/gdb/printcmd.c
+===================================================================
+--- gdb.orig/gdb/printcmd.c 2019-02-22 11:22:04.575563176 +0100
++++ gdb/gdb/printcmd.c 2019-02-22 11:22:04.571563128 +0100
+@@ -1183,6 +1183,10 @@
+
+ if (exp && *exp)
+ {
++ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
++ function descriptors. */
++ if (target_has_execution && strcmp (exp, "errno") == 0)
++ exp = "*(*(int *(*)(void)) __errno_location) ()";
+ expression_up expr = parse_expression (exp);
+ val = evaluate_expression (expr.get ());
+ }
+@@ -1190,7 +1194,7 @@
+ val = access_value_history (0);
+
+ if (voidprint || (val && value_type (val) &&
+- TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
++ TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
+ print_value (val, &fmt);
+ }
+
+Index: gdb/gdb/testsuite/gdb.dwarf2/dw2-errno.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2019-02-22 11:22:04.571563128 +0100
+@@ -0,0 +1,28 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++#include <errno.h>
++
++int main()
++{
++ errno = 42;
++
++ return 0; /* breakpoint */
++}
+Index: gdb/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2019-02-22 11:22:04.571563128 +0100
+@@ -0,0 +1,60 @@
++# Copyright 2007 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++set testfile dw2-errno
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++
++proc prep {} {
++ global srcdir subdir binfile
++ gdb_exit
++ gdb_start
++ gdb_reinitialize_dir $srcdir/$subdir
++ gdb_load ${binfile}
++
++ runto_main
++
++ gdb_breakpoint [gdb_get_line_number "breakpoint"]
++ gdb_continue_to_breakpoint "breakpoint"
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=N threads=N"
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N"
++
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y"
++
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y"
++
++# TODO: Test the error on resolving ERRNO with only libc loaded.
++# Just how to find the current libc filename?
+Index: gdb/gdb/testsuite/gdb.dwarf2/dw2-errno2.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb/gdb/testsuite/gdb.dwarf2/dw2-errno2.c 2019-02-22 11:22:04.571563128 +0100
+@@ -0,0 +1,28 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@prep.ai.mit.edu */
++
++#include <errno.h>
++
++int main()
++{
++ errno = 42;
++
++ return 0; /* breakpoint */
++}
+Index: gdb/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp 2019-02-22 11:22:04.571563128 +0100
+@@ -0,0 +1,71 @@
++# Copyright 2007 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++set testfile dw2-errno2
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++
++proc prep { message {do_xfail 0} } { with_test_prefix $message {
++ global srcdir subdir binfile variant
++ gdb_exit
++ gdb_start
++ gdb_reinitialize_dir $srcdir/$subdir
++ gdb_load ${binfile}${variant}
++
++ runto_main
++
++ gdb_breakpoint [gdb_get_line_number "breakpoint"]
++ gdb_continue_to_breakpoint "breakpoint"
++
++ gdb_test "gcore ${binfile}${variant}.core" "\r\nSaved corefile .*" "gcore $variant"
++
++ gdb_test "print errno" ".* = 42"
++
++ gdb_test "kill" ".*" "kill" {Kill the program being debugged\? \(y or n\) } "y"
++ gdb_test "core-file ${binfile}${variant}.core" "\r\nCore was generated by .*" "core-file"
++ if $do_xfail {
++ setup_xfail "*-*-*"
++ }
++ gdb_test "print errno" ".* = 42" "print errno for core"
++}}
++
++set variant g2thrN
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++prep "macros=N threads=N" 1
++
++set variant g3thrN
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++prep "macros=Y threads=N" 1
++
++set variant g2thrY
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
++ return -1
++}
++prep "macros=N threads=Y"
++
++set variant g3thrY
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
++ return -1
++}
++prep "macros=Y threads=Y" 1
++
++# TODO: Test the error on resolving ERRNO with only libc loaded.
++# Just how to find the current libc filename?
diff --git a/debian/patches/gdb-PATH_MAX.patch b/debian/patches/gdb-PATH_MAX.patch
new file mode 100644
index 0000000..a547472
--- /dev/null
+++ b/debian/patches/gdb-PATH_MAX.patch
@@ -0,0 +1,21 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: gdb-PATH_MAX
+
+===================================================================
+---
+ gdb/remote.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+Index: gdb/gdb/remote.c
+===================================================================
+--- gdb.orig/gdb/remote.c 2019-02-22 11:26:21.254851487 +0100
++++ gdb/gdb/remote.c 2019-02-22 11:27:05.303425518 +0100
+@@ -7355,6 +7355,7 @@
+ /* This is freed during event handling. */
+ event->ws.value.execd_pathname = pathname;
+ event->ws.kind = TARGET_WAITKIND_EXECD;
++ xfree (pathname);
+
+ /* Skip the registers included in this packet, since
+ they may be for an architecture different from the
diff --git a/debian/patches/gdb-fortran-main.patch b/debian/patches/gdb-fortran-main.patch
new file mode 100644
index 0000000..38380de
--- /dev/null
+++ b/debian/patches/gdb-fortran-main.patch
@@ -0,0 +1,91 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: gdb-fortran-main
+
+Daniel,
+
+Although the proper way of adding case insensitivity to symbol lookup is
+still under discussion, I think it might be desirable to set the main
+function of Fortran programs to "MAIN__" first. Because it can at least
+let GDB recognize that the language is Fortran after loading a Fortran
+executable only. What is your idea on this? Please comments. TIA!
+
+Here is the patch to set the main function in Fortran programs to
+"MAIN__". And followed is a patch to verify this. Tested with g77 and
+gfortran on x86, and g77 on ppc64. With the first patch, it reported
+PASS; without, report FAIL. No regression is found in gdb.fortran
+testcases.
+
+P.S: if there is a symbol named "MAIN__" in sources of other languages, it
+might disturb the debugging. But I am not sure how much it is.
+---
+ gdb/symtab.c | 9 +++++++--
+ gdb/testsuite/gdb.fortran/lang.exp | 40 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 2 deletions(-)
+ create mode 100644 gdb/testsuite/gdb.fortran/lang.exp
+
+Index: gdb/gdb/symtab.c
+===================================================================
+--- gdb.orig/gdb/symtab.c 2019-02-22 11:21:51.583408077 +0100
++++ gdb/gdb/symtab.c 2019-02-22 11:21:51.579408029 +0100
+@@ -5795,8 +5795,13 @@
+ }
+
+ /* The languages above didn't identify the name of the main procedure.
+- Fallback to "main". */
+- set_main_name ("main", language_unknown);
++ Fallback to "MAIN__" (g77 and gfortran) if we can find it in the
++ minimal symtab, to "main" otherwise. */
++ struct bound_minimal_symbol msym = lookup_minimal_symbol ("MAIN__", NULL, NULL);
++ if (msym.minsym)
++ set_main_name ("MAIN__", language_fortran);
++ else
++ set_main_name ("main", language_unknown);
+ }
+
+ char *
+Index: gdb/gdb/testsuite/gdb.fortran/lang.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb/gdb/testsuite/gdb.fortran/lang.exp 2019-02-22 11:21:51.579408029 +0100
+@@ -0,0 +1,40 @@
++# Copyright 2005 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# This file was written by Wu Zhou. (woodzltc@cn.ibm.com)
++
++# This file is part of the gdb testsuite. It is intended to test that gdb
++# could recognize the Fortran language after loading the binary
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++set testfile "array-element"
++set srcfile ${srcdir}/${subdir}/${testfile}.f
++set binfile ${objdir}/${subdir}/${testfile}
++
++if { [gdb_compile "${srcfile}" "${binfile}" executable {debug f77}] != "" } {
++ untested "Couldn't compile ${srcfile}"
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++gdb_test "show language" ".*currently fortran.*" "show language(fortran)"
diff --git a/debian/patches/gdb-glibc-vdso-workaround.patch b/debian/patches/gdb-glibc-vdso-workaround.patch
new file mode 100644
index 0000000..e4f06df
--- /dev/null
+++ b/debian/patches/gdb-glibc-vdso-workaround.patch
@@ -0,0 +1,35 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: [RFC] Work around PR libc/13097 "linux-vdso.so.1" #2
+
+Hi,
+
+missed the x86_64-m32 case:
+
+gdb/
+2011-08-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Work around PR libc/13097.
+ * solib.c (update_solib_list): Ignore "linux-vdso.so.1".
+---
+ gdb/solib.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+Index: gdb/gdb/solib.c
+===================================================================
+--- gdb.orig/gdb/solib.c 2019-02-22 11:22:10.271631170 +0100
++++ gdb/gdb/solib.c 2019-02-22 11:22:10.267631123 +0100
+@@ -870,8 +870,11 @@
+
+ TRY
+ {
+- /* Fill in the rest of the `struct so_list' node. */
+- if (!solib_map_sections (i))
++ /* Fill in the rest of the `struct so_list' node.
++ Work around PR libc/13097. */
++ if (!solib_map_sections (i)
++ && strcmp (i->so_original_name, "linux-vdso.so.1") != 0
++ && strcmp (i->so_original_name, "linux-gate.so.1") != 0)
+ {
+ not_found++;
+ if (not_found_filename == NULL)
diff --git a/debian/patches/gdb_bsd-kvm.c.diff b/debian/patches/gdb_bsd-kvm.c.diff
new file mode 100644
index 0000000..e0bac78
--- /dev/null
+++ b/debian/patches/gdb_bsd-kvm.c.diff
@@ -0,0 +1,31 @@
+Index: gdb/gdb/bsd-kvm.c
+===================================================================
+--- gdb.orig/gdb/bsd-kvm.c 2019-02-22 11:36:33.514594292 +0100
++++ gdb/gdb/bsd-kvm.c 2019-02-22 11:36:33.514594292 +0100
+@@ -238,7 +238,7 @@
+ /* On dumping core, BSD kernels store the faulting context (PCB)
+ in the variable "dumppcb". */
+ memset (nl, 0, sizeof nl);
+- nl[0].n_name = "_dumppcb";
++ nl[0].n_un.n_name = (char *)"_dumppcb";
+
+ if (kvm_nlist (core_kd, nl) == -1)
+ error (("%s"), kvm_geterr (core_kd));
+@@ -256,7 +256,7 @@
+ "proc0paddr". */
+
+ memset (nl, 0, sizeof nl);
+- nl[0].n_name = "_proc0paddr";
++ nl[0].n_un.n_name = (char *)"_proc0paddr";
+
+ if (kvm_nlist (core_kd, nl) == -1)
+ error (("%s"), kvm_geterr (core_kd));
+@@ -280,7 +280,7 @@
+ variable "thread0". */
+
+ memset (nl, 0, sizeof nl);
+- nl[0].n_name = "_thread0";
++ nl[0].n_un.n_name = (char *)"_thread0";
+
+ if (kvm_nlist (core_kd, nl) == -1)
+ error (("%s"), kvm_geterr (core_kd));
diff --git a/debian/patches/gdb_configure.nat.patch b/debian/patches/gdb_configure.nat.patch
new file mode 100644
index 0000000..12bab39
--- /dev/null
+++ b/debian/patches/gdb_configure.nat.patch
@@ -0,0 +1,22 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: gdb_configure.nat
+
+===================================================================
+---
+ gdb/configure.nat | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: gdb/gdb/configure.nat
+===================================================================
+--- gdb.orig/gdb/configure.nat 2019-02-22 11:22:25.383811537 +0100
++++ gdb/gdb/configure.nat 2019-02-22 11:23:41.284731325 +0100
+@@ -214,7 +214,7 @@
+ i386)
+ # Host: Intel 386 running the GNU Hurd
+ NATDEPFILES='i386-gnu-nat.o gnu-nat.o \
+- x86-nat.o nat/x86-dregs.o fork-child.o \
++ x86-nat.o nat/x86-dregs.o fork-child.o fork-inferior.o \
+ nat/fork-inferior.o \
+ notify_S.o process_reply_S.o msg_reply_S.o \
+ msg_U.o exc_request_U.o exc_request_S.o'
diff --git a/debian/patches/load-versioned-libcc1.patch b/debian/patches/load-versioned-libcc1.patch
new file mode 100644
index 0000000..0696b66
--- /dev/null
+++ b/debian/patches/load-versioned-libcc1.patch
@@ -0,0 +1,27 @@
+From: Hector Oron <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: load-versioned-libcc1
+
+* d/p/load-versioned-libcc1.patch:
+ - load libcc1.so.0 instead unversioned file.
+
+* d/p/load-versioned-libcc1.patch:
+ - load libcc1.so.0 instead unversioned file.
+Author: Hector Oron <zumbi@debian.org>
+---
+ include/gcc-c-interface.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/gcc-c-interface.h b/include/gcc-c-interface.h
+index d14472a..dae2f0a 100644
+--- a/include/gcc-c-interface.h
++++ b/include/gcc-c-interface.h
+@@ -188,7 +188,7 @@ struct gcc_c_context
+ /* The name of the .so that the compiler builds. We dlopen this
+ later. */
+
+-#define GCC_C_FE_LIBCC libcc1.so
++#define GCC_C_FE_LIBCC libcc1.so.0
+
+ /* The compiler exports a single initialization function. This macro
+ holds its name as a symbol. */
diff --git a/debian/patches/python-config.patch b/debian/patches/python-config.patch
new file mode 100644
index 0000000..baf4954
--- /dev/null
+++ b/debian/patches/python-config.patch
@@ -0,0 +1,193 @@
+From: Matthias Klose <doko@ubuntu.com>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: Use system python-config if available
+
+Forwarded: https://sourceware.org/ml/gdb-patches/2012-12/msg00751.html
+---
+ gdb/configure | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++----
+ gdb/configure.ac | 14 ++++----
+ 2 files changed, 108 insertions(+), 12 deletions(-)
+
+Index: gdb/gdb/configure
+===================================================================
+--- gdb.orig/gdb/configure 2019-02-22 11:22:07.547598653 +0100
++++ gdb/gdb/configure 2019-02-22 11:22:07.543598605 +0100
+@@ -715,6 +715,7 @@
+ PYTHON_LIBS
+ PYTHON_CPPFLAGS
+ PYTHON_CFLAGS
++python_config
+ python_prog_path
+ LTLIBMPFR
+ LIBMPFR
+@@ -10478,29 +10479,122 @@
+ esac
+ esac
+
++ python_config=
+ if test "${python_prog}" != missing; then
++ if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}${python_prog}-config", so it can be a program name with args.
++set dummy ${ac_tool_prefix}${python_prog}-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_python_config+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$python_config"; then
++ ac_cv_prog_python_config="$python_config" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++ ac_cv_prog_python_config="${ac_tool_prefix}${python_prog}-config"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++python_config=$ac_cv_prog_python_config
++if test -n "$python_config"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_config" >&5
++$as_echo "$python_config" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_python_config"; then
++ ac_ct_python_config=$python_config
++ # Extract the first word of "${python_prog}-config", so it can be a program name with args.
++set dummy ${python_prog}-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_python_config+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_python_config"; then
++ ac_cv_prog_ac_ct_python_config="$ac_ct_python_config" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++ ac_cv_prog_ac_ct_python_config="${python_prog}-config"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_python_config=$ac_cv_prog_ac_ct_python_config
++if test -n "$ac_ct_python_config"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_python_config" >&5
++$as_echo "$ac_ct_python_config" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_python_config" = x; then
++ python_config="${python_prog} ${srcdir}/python/python-config.py"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ python_config=$ac_ct_python_config
++ fi
++else
++ python_config="$ac_cv_prog_python_config"
++fi
++
+ # We have a python program to use, but it may be too old.
+ # Don't flag an error for --with-python=auto (the default).
+ have_python_config=yes
+- python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
++ python_includes=`${python_config} --includes`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+- as_fn_error $? "failure running python-config --includes" "$LINENO" 5
++ as_fn_error $? "failure running ${python-config} --includes" "$LINENO" 5
+ fi
+ fi
+- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
++ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+- as_fn_error $? "failure running python-config --ldflags" "$LINENO" 5
++ as_fn_error $? "failure running ${python-config} --ldflags" "$LINENO" 5
+ fi
+ fi
+- python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
++ python_prefix=`${python_config} --exec-prefix`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+- as_fn_error $? "failure running python-config --exec-prefix" "$LINENO" 5
++ as_fn_error $? "failure running ${python-config} --exec-prefix" "$LINENO" 5
+ fi
+ fi
+ else
+Index: gdb/gdb/configure.ac
+===================================================================
+--- gdb.orig/gdb/configure.ac 2019-02-22 11:22:07.547598653 +0100
++++ gdb/gdb/configure.ac 2019-02-22 11:22:07.547598653 +0100
+@@ -834,29 +834,31 @@
+ esac
+ esac
+
++ python_config=
+ if test "${python_prog}" != missing; then
++ AC_CHECK_TOOL(python_config,[${python_prog}-config],[${python_prog} ${srcdir}/python/python-config.py])
+ # We have a python program to use, but it may be too old.
+ # Don't flag an error for --with-python=auto (the default).
+ have_python_config=yes
+- python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
++ python_includes=`${python_config} --includes`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+- AC_ERROR(failure running python-config --includes)
++ AC_ERROR(failure running ${python_config} --includes)
+ fi
+ fi
+- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
++ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+- AC_ERROR(failure running python-config --ldflags)
++ AC_ERROR(failure running ${python_config} --ldflags)
+ fi
+ fi
+- python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
++ python_prefix=`${python_config} --exec-prefix`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+- AC_ERROR(failure running python-config --exec-prefix)
++ AC_ERROR(failure running ${python_config} --exec-prefix)
+ fi
+ fi
+ else
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..858f648
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,10 @@
+gdb-fortran-main.patch
+solve_PATH_MAX_issue.patch
+gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+python-config.patch
+gdb-glibc-vdso-workaround.patch
+load-versioned-libcc1.patch
+gdb_configure.nat.patch
+gdb-PATH_MAX.patch
+struct-thread_info.patch
+gdb_bsd-kvm.c.diff
diff --git a/debian/patches/solve_PATH_MAX_issue.patch b/debian/patches/solve_PATH_MAX_issue.patch
new file mode 100644
index 0000000..4f860e9
--- /dev/null
+++ b/debian/patches/solve_PATH_MAX_issue.patch
@@ -0,0 +1,50 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: Patch out a PATH_MAX usage, for Hurd's benefit
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+Author: Svante Signell <svante.signell@gmail.com>
+Bug-Debian: http://bugs.debian.org/709508
+Forwarded: http://sourceware.org/ml/gdb-patches/2013-05/msg00878.html
+Reviewed-By: Héctor Orón Martínez <zumbi@debian.org>
+Last-Update: 2013-06-08
+---
+ gdb/nto-tdep.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
+index 82a4fcb..12923fc 100644
+--- a/gdb/nto-tdep.c
++++ b/gdb/nto-tdep.c
+@@ -155,10 +155,12 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
+ void
+ nto_init_solib_absolute_prefix (void)
+ {
+- char buf[PATH_MAX * 2], arch_path[PATH_MAX];
++ char *buf, *arch_path;
+ char *nto_root;
+ const char *endian;
+ const char *arch;
++ int arch_len, len;
++#define FMT "set solib-absolute-prefix %s"
+
+ nto_root = nto_target ();
+ if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
+@@ -181,9 +183,13 @@ nto_init_solib_absolute_prefix (void)
+ == BFD_ENDIAN_BIG ? "be" : "le";
+ }
+
+- xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian);
++ arch_len = strlen (nto_root) + 1 + strlen (arch) + strlen (endian) + 1;
++ arch_path = alloca (arch_len);
++ xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian);
+
+- xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_path);
++ len = strlen (FMT) - 2 + strlen (arch_path) + 1;
++ buf = alloca (len);
++ xsnprintf (buf, len, FMT, arch_path);
+ execute_command (buf, 0);
+ }
+
diff --git a/debian/patches/struct-thread_info.patch b/debian/patches/struct-thread_info.patch
new file mode 100644
index 0000000..e9583b5
--- /dev/null
+++ b/debian/patches/struct-thread_info.patch
@@ -0,0 +1,249 @@
+From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
+Date: Wed, 20 Feb 2019 13:25:36 +0100
+Subject: struct-thread_info
+
+===================================================================
+---
+ gdb/breakpoint.c | 2 +-
+ gdb/infcmd.c | 4 ++--
+ gdb/linux-tdep.c | 2 +-
+ gdb/mi/mi-main.c | 2 +-
+ gdb/progspace-and-thread.c | 2 +-
+ gdb/python/py-record-btrace.c | 8 ++++----
+ gdb/remote.c | 6 +++---
+ gdb/thread.c | 22 +++++++++++-----------
+ 8 files changed, 24 insertions(+), 24 deletions(-)
+
+Index: gdb/gdb/breakpoint.c
+===================================================================
+--- gdb.orig/gdb/breakpoint.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/breakpoint.c 2019-02-22 11:33:07.552034296 +0100
+@@ -12682,7 +12682,7 @@
+
+ longjmp_breakpoint::~longjmp_breakpoint ()
+ {
+- thread_info *tp = find_thread_global_id (this->thread);
++ struct thread_info *tp = find_thread_global_id (this->thread);
+
+ if (tp != NULL)
+ tp->initiating_frame = null_frame_id;
+Index: gdb/gdb/infcmd.c
+===================================================================
+--- gdb.orig/gdb/infcmd.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/infcmd.c 2019-02-22 11:33:07.552034296 +0100
+@@ -663,7 +663,7 @@
+ /* Queue a pending event so that the program stops immediately. */
+ if (run_how == RUN_STOP_AT_FIRST_INSN)
+ {
+- thread_info *thr = inferior_thread ();
++ struct thread_info *thr = inferior_thread ();
+ thr->suspend.waitstatus_pending_p = 1;
+ thr->suspend.waitstatus.kind = TARGET_WAITKIND_STOPPED;
+ thr->suspend.waitstatus.value.sig = GDB_SIGNAL_0;
+@@ -913,7 +913,7 @@
+ set_step_info (frame, sal);
+
+ CORE_ADDR pc = get_frame_pc (frame);
+- thread_info *tp = inferior_thread ();
++ struct thread_info *tp = inferior_thread ();
+ tp->control.step_start_function = find_pc_function (pc);
+ }
+
+Index: gdb/gdb/linux-tdep.c
+===================================================================
+--- gdb.orig/gdb/linux-tdep.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/linux-tdep.c 2019-02-22 11:33:07.552034296 +0100
+@@ -1654,7 +1654,7 @@
+ buffer. */
+
+ static gdb::byte_vector
+-linux_get_siginfo_data (thread_info *thread, struct gdbarch *gdbarch)
++linux_get_siginfo_data (struct thread_info *thread, struct gdbarch *gdbarch)
+ {
+ struct type *siginfo_type;
+ LONGEST bytes_read;
+Index: gdb/gdb/mi/mi-main.c
+===================================================================
+--- gdb.orig/gdb/mi/mi-main.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/mi/mi-main.c 2019-02-22 11:33:07.556034345 +0100
+@@ -553,7 +553,7 @@
+ error (_("-thread-select: USAGE: threadnum."));
+
+ int num = value_as_long (parse_and_eval (argv[0]));
+- thread_info *thr = find_thread_global_id (num);
++ struct thread_info *thr = find_thread_global_id (num);
+ if (thr == NULL)
+ error (_("Thread ID %d not known."), num);
+
+Index: gdb/gdb/progspace-and-thread.c
+===================================================================
+--- gdb.orig/gdb/progspace-and-thread.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/progspace-and-thread.c 2019-02-22 11:33:07.556034345 +0100
+@@ -28,7 +28,7 @@
+
+ if (inf != NULL && inf->pid != 0)
+ {
+- thread_info *tp = any_live_thread_of_inferior (inf);
++ struct thread_info *tp = any_live_thread_of_inferior (inf);
+
+ if (tp != NULL)
+ {
+Index: gdb/gdb/python/py-record-btrace.c
+===================================================================
+--- gdb.orig/gdb/python/py-record-btrace.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/python/py-record-btrace.c 2019-02-22 11:33:07.556034345 +0100
+@@ -72,7 +72,7 @@
+ {
+ const btrace_insn *insn;
+ const recpy_element_object *obj;
+- thread_info *tinfo;
++ struct thread_info *tinfo;
+ btrace_insn_iterator iter;
+
+ if (Py_TYPE (pyobject) != &recpy_insn_type)
+@@ -115,7 +115,7 @@
+ {
+ const btrace_function *func;
+ const recpy_element_object *obj;
+- thread_info *tinfo;
++ struct thread_info *tinfo;
+ btrace_call_iterator iter;
+
+ if (Py_TYPE (pyobject) != &recpy_func_type)
+@@ -153,7 +153,7 @@
+ gdb.RecordInstruction or gdb.RecordGap object for it accordingly. */
+
+ static PyObject *
+-btpy_insn_or_gap_new (thread_info *tinfo, Py_ssize_t number)
++btpy_insn_or_gap_new (struct thread_info *tinfo, Py_ssize_t number)
+ {
+ btrace_insn_iterator iter;
+ int err_code;
+@@ -338,7 +338,7 @@
+ recpy_bt_func_level (PyObject *self, void *closure)
+ {
+ const btrace_function * const func = btrace_func_from_recpy_func (self);
+- thread_info *tinfo;
++ struct thread_info *tinfo;
+
+ if (func == NULL)
+ return NULL;
+Index: gdb/gdb/remote.c
+===================================================================
+--- gdb.orig/gdb/remote.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/remote.c 2019-02-22 11:33:07.556034345 +0100
+@@ -2403,7 +2403,7 @@
+ return inf;
+ }
+
+-static remote_thread_info *get_remote_thread_info (thread_info *thread);
++static remote_thread_info *get_remote_thread_info (struct thread_info *thread);
+ static remote_thread_info *get_remote_thread_info (ptid_t ptid);
+
+ /* Add thread PTID to GDB's thread list. Tag it as executing/running
+@@ -2528,7 +2528,7 @@
+ /* Return THREAD's private thread data, creating it if necessary. */
+
+ static remote_thread_info *
+-get_remote_thread_info (thread_info *thread)
++get_remote_thread_info (struct thread_info *thread)
+ {
+ gdb_assert (thread != NULL);
+
+@@ -4344,7 +4344,7 @@
+ /* Add the main thread and switch to it. Don't try reading
+ registers yet, since we haven't fetched the target description
+ yet. */
+- thread_info *tp = add_thread_silent (curr_ptid);
++ struct thread_info *tp = add_thread_silent (curr_ptid);
+ switch_to_thread_no_regs (tp);
+ }
+
+Index: gdb/gdb/thread.c
+===================================================================
+--- gdb.orig/gdb/thread.c 2019-02-22 11:33:07.560034396 +0100
++++ gdb/gdb/thread.c 2019-02-22 11:35:39.389924517 +0100
+@@ -68,21 +68,21 @@
+ class scoped_inc_dec_ref
+ {
+ public:
+- explicit scoped_inc_dec_ref (const std::vector<thread_info *> &thrds)
++ explicit scoped_inc_dec_ref (const std::vector<struct thread_info *> &thrds)
+ : m_thrds (thrds)
+ {
+- for (thread_info *thr : m_thrds)
++ for (struct thread_info *thr : m_thrds)
+ thr->incref ();
+ }
+
+ ~scoped_inc_dec_ref ()
+ {
+- for (thread_info *thr : m_thrds)
++ for (struct thread_info *thr : m_thrds)
+ thr->decref ();
+ }
+
+ private:
+- const std::vector<thread_info *> &m_thrds;
++ const std::vector<struct thread_info *> &m_thrds;
+ };
+
+
+@@ -201,7 +201,7 @@
+ /* Set the TP's state as exited. */
+
+ static void
+-set_thread_exited (thread_info *tp, int silent)
++set_thread_exited (struct thread_info *tp, int silent)
+ {
+ /* Dead threads don't need to step-over. Remove from queue. */
+ if (tp->step_over_next != NULL)
+@@ -243,7 +243,7 @@
+ static struct thread_info *
+ new_thread (struct inferior *inf, ptid_t ptid)
+ {
+- thread_info *tp = new thread_info (inf, ptid);
++ struct thread_info *tp = new struct thread_info (inf, ptid);
+
+ if (inf->thread_list == NULL)
+ inf->thread_list = tp;
+@@ -1433,7 +1433,7 @@
+ order is determined by TP_ARRAY_COMPAR_ASCENDING. */
+
+ static bool
+-tp_array_compar (const thread_info *a, const thread_info *b)
++tp_array_compar (const struct thread_info *a, const struct thread_info *b)
+ {
+ if (a->inf->num != b->inf->num)
+ {
+@@ -1530,10 +1530,10 @@
+ thread, in case the command is one that wipes threads. E.g.,
+ detach, kill, disconnect, etc., or even normally continuing
+ over an inferior or thread exit. */
+- std::vector<thread_info *> thr_list_cpy;
++ std::vector<struct thread_info *> thr_list_cpy;
+ thr_list_cpy.reserve (tc);
+
+- for (thread_info *tp : all_non_exited_threads ())
++ for (struct thread_info *tp : all_non_exited_threads ())
+ thr_list_cpy.push_back (tp);
+ gdb_assert (thr_list_cpy.size () == tc);
+
+@@ -1545,7 +1545,7 @@
+
+ scoped_restore_current_thread restore_thread;
+
+- for (thread_info *thr : thr_list_cpy)
++ for (struct thread_info *thr : thr_list_cpy)
+ if (thread_alive (thr))
+ thr_try_catch_cmd (thr, cmd, from_tty, flags);
+ }
+@@ -1790,7 +1790,7 @@
+ /* See gdbthread.h. */
+
+ void
+-thread_select (const char *tidstr, thread_info *tp)
++thread_select (const char *tidstr, struct thread_info *tp)
+ {
+ if (!thread_alive (tp))
+ error (_("Thread ID %s has terminated."), tidstr);