diff --git a/gdb-6.3-attach-see-vdso-test.patch b/gdb-6.3-attach-see-vdso-test.patch index 14fff2131ecd587edc3421c739bc09624eb33795..0c2ccc1cf91d6acc297694c5bce1a9a661453836 100644 --- a/gdb-6.3-attach-see-vdso-test.patch +++ b/gdb-6.3-attach-see-vdso-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-attach-see-vdso-test.patch - -;; Test kernel VDSO decoding while attaching to an i386 process. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c new file mode 100644 --- /dev/null @@ -113,3 +105,4 @@ new file mode 100644 +# work. + +remote_exec build "kill -9 ${testpid}" + diff --git a/gdb-6.3-bz140532-ppc-unwinding-test.patch b/gdb-6.3-bz140532-ppc-unwinding-test.patch index 4a96e8ea62933c84fdb4c10adc7a1d6b80cf90d4..0a7f1bc3fc1ed7c1d5ac3c1a121a1ce73784587d 100644 --- a/gdb-6.3-bz140532-ppc-unwinding-test.patch +++ b/gdb-6.3-bz140532-ppc-unwinding-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-bz140532-ppc-unwinding-test.patch - -;; Update PPC unwinding patches to their upstream variants (BZ 140532). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S new file mode 100644 --- /dev/null @@ -318,3 +310,4 @@ diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arc verbose "Skipping PowerPC prologue tests." return } + diff --git a/gdb-6.3-bz202689-exec-from-pthread-test.patch b/gdb-6.3-bz202689-exec-from-pthread-test.patch index df59b77e98ea510636c55b06917f3dca42a6c793..6d5549300108b64e634b3e79954f6ea6154051c2 100644 --- a/gdb-6.3-bz202689-exec-from-pthread-test.patch +++ b/gdb-6.3-bz202689-exec-from-pthread-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-bz202689-exec-from-pthread-test.patch - -;; Testcase for exec() from threaded program (BZ 202689). -;;=fedoratest - 2007-01-17 Jan Kratochvil * gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files. @@ -107,3 +99,4 @@ new file mode 100644 + pass "Program exited" + } +} + diff --git a/gdb-6.3-focus-cmd-prev-test.patch b/gdb-6.3-focus-cmd-prev-test.patch index 27c85f1201bda6f22baf31c5cff4d3638e04068f..61cbcad9a607818ba25b6030c99bc212156a1f36 100644 --- a/gdb-6.3-focus-cmd-prev-test.patch +++ b/gdb-6.3-focus-cmd-prev-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-focus-cmd-prev-test.patch - -;; Test a crash on `focus cmd', `focus prev' commands. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/focus-cmd-prev.exp b/gdb/testsuite/gdb.base/focus-cmd-prev.exp new file mode 100644 --- /dev/null @@ -51,3 +43,4 @@ new file mode 100644 + pass $test + } +} + diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 37b09de089ba3a0fc18bb59967868b6143684ff7..66061d980525d93ff1a380dab728a195c8780159 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Andrew Cagney -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-gstack-20050411.patch - -;; Add a wrapper script to GDB that implements pstack using the -;; --readnever option. -;;=push - 2004-11-23 Andrew Cagney * Makefile.in (uninstall-gstack, install-gstack): New rules, add @@ -16,7 +7,7 @@ Subject: gdb-6.3-gstack-20050411.patch diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1735,7 +1735,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force +@@ -1749,7 +1749,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -25,7 +16,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1784,7 +1784,25 @@ install-guile: +@@ -1798,7 +1798,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -52,7 +43,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1807,6 +1825,18 @@ uninstall: force $(CONFIG_UNINSTALL) +@@ -1821,6 +1839,18 @@ uninstall: force $(CONFIG_UNINSTALL) fi @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do @@ -171,7 +162,7 @@ diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.e new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/gstack.exp -@@ -0,0 +1,66 @@ +@@ -0,0 +1,84 @@ +# Copyright (C) 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -202,6 +193,10 @@ new file mode 100644 + fail $test + return +} ++ ++# The spawn id of the test inferior. ++set test_spawn_id $res ++ +set use_gdb_stub 1 +set pid [exp_pid -i $res] +gdb_expect { @@ -217,7 +212,6 @@ new file mode 100644 + return + } +} -+gdb_exit + +# Testcase uses the most simple notification not to get caught by attach on +# exiting the function. Still we could retry the gstack command if we fail. @@ -229,12 +223,28 @@ new file mode 100644 + perror "Spawning $command failed." + fail $test +} -+set pid [exp_pid -i $res] ++ ++set gdb_spawn_id $res ++ +gdb_test_multiple "" $test { + -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" { + pass $test + } +} -+gdb_exit + -+remote_exec host "kill -9 $pid" ++gdb_test_multiple "" "gstack exits" { ++ eof { ++ set result [wait -i $gdb_spawn_id] ++ verbose $result ++ ++ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error" ++ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0" ++ ++ remote_close host ++ clear_gdb_spawn_id ++ } ++} ++ ++# Kill the test inferior. ++kill_wait_spawned_process $test_spawn_id + diff --git a/gdb-6.3-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch index b94b432f8200405cb5179061daaf2b3c8f370c81..9e1b27c7031de53e93bf9aa050a545636101826f 100644 --- a/gdb-6.3-inferior-notification-20050721.patch +++ b/gdb-6.3-inferior-notification-20050721.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jeff Johnston -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-inferior-notification-20050721.patch - -;; Notify observers that the inferior has been created -;;=fedoratest - 2005-07-21 Jeff Johnston * gdb.base/attach-32.exp: New test for attaching in 32-bit @@ -321,3 +313,4 @@ new file mode 100644 + } + return (0); +} + diff --git a/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch index 6b220110109cb972041d3f65f8271d71c7cd4644..cde4b9b283b00ccd861275d6649f5d09556dc134 100644 --- a/gdb-6.3-inheritancetest-20050726.patch +++ b/gdb-6.3-inheritancetest-20050726.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jeff Johnston -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-inheritancetest-20050726.patch - -;; Verify printing of inherited members test -;;=fedoratest - 2005-07-26 Jeff Johnston * gdb.cp/b146835.exp: New testcase. @@ -159,3 +151,4 @@ new file mode 100644 +void A::funcD (class E *e, class D *d) {} +void A::funcE (E *e, D *d) {} +void A::funcF (unsigned long x, D *d) {} + diff --git a/gdb-6.3-mapping-zero-inode-test.patch b/gdb-6.3-mapping-zero-inode-test.patch index 1ef25d96585f43039baab3a2aafba09112df65de..f1d5f43bc4ffae3e337d92040eb110c16f9d1634 100644 --- a/gdb-6.3-mapping-zero-inode-test.patch +++ b/gdb-6.3-mapping-zero-inode-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-mapping-zero-inode-test.patch - -;; Test GCORE for shmid 0 shared memory mappings. -;;=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible. - diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c new file mode 100644 --- /dev/null @@ -245,3 +237,4 @@ new file mode 100644 + fail $test + } +} + diff --git a/gdb-6.3-ppc64displaysymbol-20041124.patch b/gdb-6.3-ppc64displaysymbol-20041124.patch deleted file mode 100644 index a09b0fe954de15b0b4360646dd6cd8486ef382cc..0000000000000000000000000000000000000000 --- a/gdb-6.3-ppc64displaysymbol-20041124.patch +++ /dev/null @@ -1,32 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Andrew Cagney -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-ppc64displaysymbol-20041124.patch - -;; Include the pc's section when doing a symbol lookup so that the -;; correct symbol is found. -;;=push: Write new testcase. - -2004-11-24 Andrew Cagney - - * printcmd.c (build_address_symbolic): Find a section for the - address. - -diff --git a/gdb/printcmd.c b/gdb/printcmd.c ---- a/gdb/printcmd.c -+++ b/gdb/printcmd.c -@@ -587,6 +587,14 @@ build_address_symbolic (struct gdbarch *gdbarch, - addr = overlay_mapped_address (addr, section); - } - } -+ /* To ensure that the symbol returned belongs to the correct setion -+ (and that the last [random] symbol from the previous section -+ isn't returned) try to find the section containing PC. First try -+ the overlay code (which by default returns NULL); and second try -+ the normal section code (which almost always succeeds). */ -+ section = find_pc_overlay (addr); -+ if (section == NULL) -+ section = find_pc_section (addr); - - /* First try to find the address in the symbol table, then - in the minsyms. Take the closest one. */ diff --git a/gdb-6.3-ppc64syscall-20040622.patch b/gdb-6.3-ppc64syscall-20040622.patch deleted file mode 100644 index e6319bebf0895274b5787d9230f8ea13ce9e897e..0000000000000000000000000000000000000000 --- a/gdb-6.3-ppc64syscall-20040622.patch +++ /dev/null @@ -1,118 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Andrew Cagney -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-ppc64syscall-20040622.patch - -;; Better parse 64-bit PPC system call prologues. -;;=push: Write new testcase. - -2004-06-22 Andrew Cagney - - * rs6000-tdep.c (struct rs6000_framedata): Add field "func_start". - (skip_prologue): Delete local variable "orig_pc", use - "func_start". Add local variable "num_skip_linux_syscall_insn", - use to skip over first half of a GNU/Linux syscall and update - "func_start". - -diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c ---- a/gdb/rs6000-tdep.c -+++ b/gdb/rs6000-tdep.c -@@ -134,6 +134,7 @@ static const char *powerpc_vector_abi_string = "auto"; - - struct rs6000_framedata - { -+ CORE_ADDR func_start; /* True function start. */ - int offset; /* total size of frame --- the distance - by which we decrement sp to allocate - the frame */ -@@ -1426,7 +1427,6 @@ static CORE_ADDR - skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, - struct rs6000_framedata *fdata) - { -- CORE_ADDR orig_pc = pc; - CORE_ADDR last_prologue_pc = pc; - CORE_ADDR li_found_pc = 0; - gdb_byte buf[4]; -@@ -1445,12 +1445,14 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, - int minimal_toc_loaded = 0; - int prev_insn_was_prologue_insn = 1; - int num_skip_non_prologue_insns = 0; -+ int num_skip_ppc64_gnu_linux_syscall_insn = 0; - int r0_contains_arg = 0; - const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - - memset (fdata, 0, sizeof (struct rs6000_framedata)); -+ fdata->func_start = pc; - fdata->saved_gpr = -1; - fdata->saved_fpr = -1; - fdata->saved_vr = -1; -@@ -1484,6 +1486,55 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, - break; - op = extract_unsigned_integer (buf, 4, byte_order); - -+ /* A PPC64 GNU/Linux system call function is split into two -+ sub-functions: a non-threaded fast-path (__NAME_nocancel) -+ which does not use a frame; and a threaded slow-path -+ (Lpseudo_cancel) that does create a frame. Ref: -+ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h -+ -+ *INDENT-OFF* -+ NAME: -+ SINGLE_THREAD_P -+ bne- .Lpseudo_cancel -+ __NAME_nocancel: -+ li r0,162 -+ sc -+ bnslr+ -+ b 0x7fe014ef64 <.__syscall_error> -+ Lpseudo_cancel: -+ stdu r1,-128(r1) -+ ... -+ *INDENT-ON* -+ -+ Unfortunatly, because the latter case uses a local label (not -+ in the symbol table) a PC in "Lpseudo_cancel" appears to be -+ in "__NAME_nocancel". The following code recognizes this, -+ adjusting FUNC_START to point to where "Lpseudo_cancel" -+ should be, and parsing the prologue sequence as if -+ "Lpseudo_cancel" was the entry point. */ -+ -+ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */ -+ && pc == fdata->func_start + 0 -+ && num_skip_ppc64_gnu_linux_syscall_insn == 0) -+ || (op == 0x44000002 /* sc */ -+ && pc == fdata->func_start + 4 -+ && num_skip_ppc64_gnu_linux_syscall_insn == 1) -+ || (op == 0x4ca30020 /* bnslr+ */ -+ && pc == fdata->func_start + 8 -+ && num_skip_ppc64_gnu_linux_syscall_insn == 2)) -+ { -+ num_skip_ppc64_gnu_linux_syscall_insn++; -+ continue; -+ } -+ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */ -+ && pc == fdata->func_start + 12 -+ && num_skip_ppc64_gnu_linux_syscall_insn == 3) -+ { -+ num_skip_ppc64_gnu_linux_syscall_insn = -1; -+ fdata->func_start = pc; -+ continue; -+ } -+ - if ((op & 0xfc1fffff) == 0x7c0802a6) - { /* mflr Rx */ - /* Since shared library / PIC code, which needs to get its -@@ -1673,9 +1724,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, - we have no line table information or the line info tells - us that the subroutine call is not part of the line - associated with the prologue. */ -- if ((pc - orig_pc) > 8) -+ if ((pc - fdata->func_start) > 8) - { -- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0); -+ struct symtab_and_line prologue_sal = find_pc_line (fdata->func_start, 0); - struct symtab_and_line this_sal = find_pc_line (pc, 0); - - if ((prologue_sal.line == 0) diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch deleted file mode 100644 index b70b58f6ae1906020d92d287703bfd021b94b57a..0000000000000000000000000000000000000000 --- a/gdb-6.3-readnever-20050907.patch +++ /dev/null @@ -1,35 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Andrew Cagney -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-readnever-20050907.patch - -;; Add readnever option -;;=push - -2004-11-18 Andrew Cagney - - * dwarf2read.c: Include "top.c". - (dwarf2_has_info): Check for readnever_symbol_files. - * symfile.c (readnever_symbol_files): Define. - * top.h (readnever_symbol_files): Declare. - * main.c (captured_main): Add --readnever option. - (print_gdb_help): Ditto. - -2004-11-18 Andrew Cagney - - * gdb.texinfo (File Options): Document --readnever. - -Pushed upstream: https://sourceware.org/ml/gdb-cvs/2017-12/msg00007.html - -diff --git a/gdb/gcore.in b/gdb/gcore.in ---- a/gdb/gcore.in -+++ b/gdb/gcore.in -@@ -97,7 +97,7 @@ for pid in "$@" - do - # ` -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-test-dtorfix-20050121.patch - -;; Test support of multiple destructors just like multiple constructors -;;=fedoratest - diff --git a/gdb/testsuite/gdb.cp/constructortest.cc b/gdb/testsuite/gdb.cp/constructortest.cc new file mode 100644 --- /dev/null @@ -245,3 +237,4 @@ new file mode 100644 +} + +gdb_continue_to_breakpoint "First line ~C" + diff --git a/gdb-6.3-test-movedir-20050125.patch b/gdb-6.3-test-movedir-20050125.patch index bcce9fa56b498c49f5adb1f4525d9c9d92148e7d..7c37204f88f55641966245c67803b5f87cf2c881 100644 --- a/gdb-6.3-test-movedir-20050125.patch +++ b/gdb-6.3-test-movedir-20050125.patch @@ -1,12 +1,4 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Elena Zannoni -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-test-movedir-20050125.patch - -;; Fix to support executable moving -;;=fedoratest - -2005-01-25 Elena Zannoni +i2005-01-25 Elena Zannoni * gdb.base/move-dir.exp: New test. * gdb.base/move-dir.c: Ditto. @@ -101,3 +93,4 @@ new file mode 100644 + printf ("%s\n", ostring);; +} + + diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch index 85f133b03389595bd071178befa95eed6d8c970e..f7dd03d5dcca7a47f79b5482267b1ccf9dc0b31c 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-test-pie-20050107.patch - -;; VSYSCALL and PIE -;;=fedoratest - diff --git a/gdb/testsuite/gdb.pie/attach.c b/gdb/testsuite/gdb.pie/attach.c new file mode 100644 --- /dev/null @@ -2025,3 +2017,4 @@ new file mode 100644 + return 0; +} + + diff --git a/gdb-6.3-test-self-20050110.patch b/gdb-6.3-test-self-20050110.patch index 5662a0eb3b0c9c0f6b38c1db79bebbaa57da32e3..e5afa99c1ad4e5f3517154766bbb928f6f24c658 100644 --- a/gdb-6.3-test-self-20050110.patch +++ b/gdb-6.3-test-self-20050110.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Elena Zannoni -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-test-self-20050110.patch - -;; Get selftest working with sep-debug-info -;;=fedoratest - 2004-02-23 Elena Zannoni * gdb.gdb/selftest.exp: Make sure that the debug directory is @@ -40,3 +32,4 @@ diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest if {$result < 0} then { warning "Couldn't test self" + diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch index 42b89bf6b6a4cd5c6d45170d99eb1a3064cbc345..c88ab73e43e22b18e491f65b18a56de25e4ce11c 100644 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ b/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jeff Johnston -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-threaded-watchpoints2-20050225.patch - -;; Test sibling threads to set threaded watchpoints for x86 and x86-64 -;;=fedoratest - 2005-02-28 Jeff Johnston * config/i386/nm-linux.h: Change dr register routines to @@ -252,3 +244,4 @@ new file mode 100644 +} else { + fail $message +} + diff --git a/gdb-6.5-BEA-testsuite.patch b/gdb-6.5-BEA-testsuite.patch index 84e1c9f1644ca56f1398956a8c1b5093bbd12909..37343ec70a118d76980da4c1d68cf9d983ecc557 100644 --- a/gdb-6.5-BEA-testsuite.patch +++ b/gdb-6.5-BEA-testsuite.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-BEA-testsuite.patch - -;; Improved testsuite results by the testsuite provided by the courtesy of BEA. -;;=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful. - diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c new file mode 100644 --- /dev/null @@ -936,3 +928,4 @@ new file mode 100644 +rm -rf $WORKDIR + +exit $FAILURES + diff --git a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch index a27c8f3677f8a1dcf0b658efd4220ba2fa758e01..c0c49f994131825c8cf2a93c630a7a6232371e13 100644 --- a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch +++ b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz109921-DW_AT_decl_file-test.patch - -;; Find symbols properly at their original (included) file (BZ 109921). -;;=fedoratest - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921 It is duplicite to its upstream variant: @@ -132,3 +124,4 @@ new file mode 100644 + USA. */ + +int integer; + diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index fbeb88cb608a7a660cd1656b20124d1c1ddf47f7..e9fa786f786193b6295827d3c98653909875c707 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch - -;; Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). -;;=push+jan: It should be replaced by Infinity project. - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 2008-02-24 Jan Kratochvil @@ -44,7 +36,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: diff --git a/gdb/printcmd.c b/gdb/printcmd.c --- a/gdb/printcmd.c +++ b/gdb/printcmd.c -@@ -1190,6 +1190,10 @@ print_command_1 (const char *exp, int voidprint) +@@ -1183,6 +1183,10 @@ print_command_1 (const char *exp, int voidprint) if (exp && *exp) { @@ -262,3 +254,4 @@ new file mode 100644 + +# TODO: Test the error on resolving ERRNO with only libc loaded. +# Just how to find the current libc filename? + diff --git a/gdb-6.5-bz203661-emit-relocs.patch b/gdb-6.5-bz203661-emit-relocs.patch deleted file mode 100644 index 75ca84f70ba25728bd362f26e693c6e7081c3c7a..0000000000000000000000000000000000000000 --- a/gdb-6.5-bz203661-emit-relocs.patch +++ /dev/null @@ -1,24 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz203661-emit-relocs.patch - -;; Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661). -;;=push+jan: There was some mail thread about it, this patch may be a hack. - -diff --git a/gdb/symfile.c b/gdb/symfile.c ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -3584,6 +3584,12 @@ default_symfile_relocate (struct objfile *objfile, asection *sectp, - DWO file. */ - bfd *abfd = sectp->owner; - -+ /* Executable files have all the relocations already resolved. -+ Handle files linked with --emit-relocs. -+ http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */ -+ if ((abfd->flags & EXEC_P) != 0) -+ return NULL; -+ - /* We're only interested in sections with relocation - information. */ - if ((sectp->flags & SEC_RELOC) == 0) diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch index f11df0a9b41d6fe8b13eca01d1ca0356fff2c6e5..d90e7c834fb7e52b10efbe820a988cede3213b95 100644 --- a/gdb-6.5-bz216711-clone-is-outermost.patch +++ b/gdb-6.5-bz216711-clone-is-outermost.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz216711-clone-is-outermost.patch - -;; Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711). -;;=fedora - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711 FIXME: This workaround should be dropped and @@ -127,7 +119,7 @@ diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c -@@ -2595,6 +2595,7 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, +@@ -2601,6 +2601,7 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, { struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache); @@ -135,7 +127,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c if (!cache->base_p) return UNWIND_UNAVAILABLE; -@@ -2603,6 +2604,10 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, +@@ -2609,6 +2610,10 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, if (cache->base == 0) return UNWIND_OUTERMOST; @@ -146,7 +138,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c return UNWIND_NO_REASON; } -@@ -2737,6 +2742,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, +@@ -2743,6 +2748,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, { struct amd64_frame_cache *cache = amd64_sigtramp_frame_cache (this_frame, this_cache); @@ -154,7 +146,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c if (!cache->base_p) (*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame)); -@@ -2745,6 +2751,11 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, +@@ -2751,6 +2757,11 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, /* This marks the outermost frame. */ return; } @@ -169,7 +161,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -8406,6 +8406,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +@@ -8407,6 +8407,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->xsave_xcr0_offset = -1; @@ -302,3 +294,4 @@ new file mode 100644 + pass "0x0 entry not found" + } +} + diff --git a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch index 8a648a3aacfc559ed7c75acc057905be5a8a37dd..7b580687208326f2b5e59183bdd66413fb5412f7 100644 --- a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +++ b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch - -;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379). -;;=fedoratest - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c @@ -100,3 +92,4 @@ new file mode 100644 + fail "stepped into trampoline" + } +} + diff --git a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch index 45d857003ed234a71616f882751ddd6568dcdd06..302a25b9f0e078fda9103be3ba5cbb8fd47d345e 100644 --- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +++ b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch @@ -1,17 +1,9 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch - -;; Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379). -;;=fedora - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 diff --git a/gdb/symtab.c b/gdb/symtab.c --- a/gdb/symtab.c +++ b/gdb/symtab.c -@@ -3165,6 +3165,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) +@@ -3177,6 +3177,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) SYMBOL_LINKAGE_NAME (msymbol)); */ ; /* fall through */ @@ -25,3 +17,4 @@ diff --git a/gdb/symtab.c b/gdb/symtab.c else return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0); } + diff --git a/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch index a0520d77a14376c0459efe14e021b1b0631b8a11..b7d248d35fd0d46b93d813e66c6271076b908157 100644 --- a/gdb-6.5-bz243845-stale-testing-zombie-test.patch +++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-bz243845-stale-testing-zombie-test.patch - -;; Test leftover zombie process (BZ 243845). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp new file mode 100644 --- /dev/null @@ -86,3 +78,4 @@ new file mode 100644 +} else { + fail $test +} + diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch index f4ae65e1cdcc2182610d88e5a1ae9a434a78420d..6d57b0d1233f7aee39eaa10d03ae898057ee7a3d 100644 --- a/gdb-6.5-gcore-buffer-limit-test.patch +++ b/gdb-6.5-gcore-buffer-limit-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-gcore-buffer-limit-test.patch - -;; Test gcore memory and time requirements for large inferiors. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c new file mode 100644 --- /dev/null @@ -147,3 +139,4 @@ new file mode 100644 + +# Cleanup. +exec kill -9 $pid_of_bin + diff --git a/gdb-6.5-ia64-libunwind-leak-test.patch b/gdb-6.5-ia64-libunwind-leak-test.patch index 8a8a43a83a35552d3fb51d4816de547239b10b95..efa56afa653ee035d9d68d2288cdd2c1195cad01 100644 --- a/gdb-6.5-ia64-libunwind-leak-test.patch +++ b/gdb-6.5-ia64-libunwind-leak-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-ia64-libunwind-leak-test.patch - -;; Test ia64 memory leaks of the code using libunwind. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c new file mode 100644 --- /dev/null @@ -128,3 +120,4 @@ new file mode 100644 + fail $test + } +} + diff --git a/gdb-6.5-last-address-space-byte-test.patch b/gdb-6.5-last-address-space-byte-test.patch index 9c5779fcb37286751e6de88142b882186a5da952..bcf1af97c11888d9b484b5897b4f13674d050a8d 100644 --- a/gdb-6.5-last-address-space-byte-test.patch +++ b/gdb-6.5-last-address-space-byte-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-last-address-space-byte-test.patch - -;; Testcase for deadlocking on last address space byte; for corrupted backtraces. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp new file mode 100644 --- /dev/null @@ -60,3 +52,4 @@ new file mode 100644 + "Read the last address space byte" + +set timeout ${timeoutold} + diff --git a/gdb-6.5-missed-trap-on-step-test.patch b/gdb-6.5-missed-trap-on-step-test.patch index 06a9f7efc9ea035ede15e2be7a69d8926c44ddd6..bd71f7f97c2fed83fc3d3424cfc47f4415fa405e 100644 --- a/gdb-6.5-missed-trap-on-step-test.patch +++ b/gdb-6.5-missed-trap-on-step-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-missed-trap-on-step-test.patch - -;; Test hiding unexpected breakpoints on intentional step commands. -;;=fedoratest - Fix has been committed to: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -93,3 +85,4 @@ new file mode 100644 +# we step from as in this case it is a valid upstream KFAIL gdb/38 + +gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint" + diff --git a/gdb-6.5-readline-long-line-crash-test.patch b/gdb-6.5-readline-long-line-crash-test.patch index 5410899cfae7859300acc4320470472c68e813c4..9f4f9b309fcfcb8a59edf118537340c32636ce3e 100644 --- a/gdb-6.5-readline-long-line-crash-test.patch +++ b/gdb-6.5-readline-long-line-crash-test.patch @@ -1,18 +1,10 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-readline-long-line-crash-test.patch - -;; Fix readline segfault on excessively long hand-typed lines. -;;=fedoratest - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/readline-overflow.exp -@@ -0,0 +1,126 @@ +@@ -0,0 +1,104 @@ +# Copyright 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -44,98 +36,77 @@ new file mode 100644 + strace $tracelevel +} + -+# Don't let a .inputrc file or an existing setting of INPUTRC mess up -+# the test results. Even if /dev/null doesn't exist on the particular -+# platform, the readline library will use the default setting just by -+# failing to open the file. OTOH, opening /dev/null successfully will -+# also result in the default settings being used since nothing will be -+# read from this file. +global env -+if [info exists env(INPUTRC)] { -+ set old_inputrc $env(INPUTRC) -+} -+set env(INPUTRC) "/dev/null" + -+set oldtimeout1 $timeout -+set timeout 600 ++save_vars { env(INPUTRC) env(GDBHISTFILE) env(HISTSIZE) TERM timeout } { ++ # The arrow key test relies on the standard VT100 bindings, so ++ # make sure that an appropriate terminal is selected. The same ++ # bug doesn't show up if we use ^P / ^N instead. ++ setenv TERM vt100 + -+if [info exists env(GDBHISTFILE)] { -+ set old_gdbhistfile $env(GDBHISTFILE) -+} -+if [info exists env(HISTSIZE)] { -+ set old_histsize $env(HISTSIZE) -+} -+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" -+set env(HISTSIZE) "10" ++ # Don't let a .inputrc file or an existing setting of INPUTRC mess up ++ # the test results. Even if /dev/null doesn't exist on the particular ++ # platform, the readline library will use the default setting just by ++ # failing to open the file. OTOH, opening /dev/null successfully will ++ # also result in the default settings being used since nothing will be ++ # read from this file. ++ set env(INPUTRC) "/dev/null" ++ ++ set timeout 600 + -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir ++ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" ++ set env(HISTSIZE) "10" + ++ gdb_exit ++ gdb_start ++ gdb_reinitialize_dir $srcdir/$subdir + -+set width 11 -+gdb_test "set width $width" \ -+ "" \ -+ "Setting width to $width." -+#gdb_test "set height 1" \ -+# "" \ -+# "Setting height to 1." -+send_gdb "run X" -+set i 0 -+# It crashes using `set width 7' on `set total 3560'. -+# Sometimes it corrupts screen on `set width 7'. -+# Bugreport used `set total 130001': -+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 -+# Check also `timeout' above. -+set total 4200 -+gdb_expect { ++ ++ set width 11 ++ gdb_test "set width $width" \ ++ "" \ ++ "Setting width to $width." ++ #gdb_test "set height 1" \ ++ # "" \ ++ # "Setting height to 1." ++ send_gdb "run X" ++ set i 0 ++ # It crashes using `set width 7' on `set total 3560'. ++ # Sometimes it corrupts screen on `set width 7'. ++ # Bugreport used `set total 130001': ++ # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 ++ # Check also `timeout' above. ++ set total 4200 ++ gdb_expect { + -re X { -+ incr i -+ if {$i <= $total} { -+ send_gdb "X" -+ exp_continue -+ } ++ incr i ++ if {$i <= $total} { ++ send_gdb "X" ++ exp_continue ++ } + } + -re "\[ \b\r\n\]" { -+ exp_continue ++ exp_continue + } + eof { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters, reason: EOF" -+ gdb_clear_suppressed ++ fail "gdb sending total $total characters" ++ note "Failed after sending $i characters, reason: EOF" ++ gdb_clear_suppressed + } + timeout { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT" -+ gdb_clear_suppressed ++ fail "gdb sending total $total characters" ++ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT" ++ gdb_clear_suppressed + } + default { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]" -+ gdb_clear_suppressed ++ fail "gdb sending total $total characters" ++ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]" ++ gdb_clear_suppressed + } ++ } ++ send_gdb "\r" ++ gdb_test "" \ ++ "No executable file specified..*" \ ++ "All the characters transferred" +} -+send_gdb "\r" -+gdb_test "" \ -+ "No executable file specified..*" \ -+ "All the characters transferred" -+ -+ -+# Restore globals modified in this test... -+if [info exists old_inputrc] { -+ set env(INPUTRC) $old_inputrc -+} else { -+ unset env(INPUTRC) -+} -+if [info exists old_gdbhistfile] { -+ set env(GDBHISTFILE) $old_gdbhistfile -+} else { -+ unset env(GDBHISTFILE) -+} -+if [info exists old_histsize] { -+ set env(HISTSIZE) $old_histsize -+} else { -+ unset env(HISTSIZE) -+} -+set timeout $oldtimeout1 -+ + diff --git a/gdb-6.5-section-num-fixup-test.patch b/gdb-6.5-section-num-fixup-test.patch index 012ba921c40a49b0ee10d64f7909f2d98caaac09..9c9cbbff878259b063faf7eb7994704c878b500a 100644 --- a/gdb-6.5-section-num-fixup-test.patch +++ b/gdb-6.5-section-num-fixup-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-section-num-fixup-test.patch - -;; Test a crash on libraries missing the .text section. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c new file mode 100644 --- /dev/null @@ -120,3 +112,4 @@ new file mode 100644 +gdb_test "start" \ + "main \\(\\) at .*${srcfilemain}.*" \ + "start" + diff --git a/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch index 6f31e88aee0ad786e85f20f0bac0d801059d82a6..ebbf301d8fa4f6140adf377e12f6153b5b794071 100644 --- a/gdb-6.5-sharedlibrary-path.patch +++ b/gdb-6.5-sharedlibrary-path.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-sharedlibrary-path.patch - -;; Fix TLS symbols resolving for shared libraries with a relative pathname. -;; The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. -;;=fedoratest: One should recheck if it is really fixed upstream. - If you provided some relative path to the shared library, such as with export LD_LIBRARY_PATH=. then gdb would fail to match the shared library name during the TLS lookup. @@ -178,3 +169,4 @@ new file mode 100644 + "\\\$1 = \[0-9\].*" \ + "print TLS variable from a shared library with $name-directory separate debug info file" +} + diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch index 40938a540ed7fb45342ffc2b499f7b44a70f2b9b..73c231787d4c4f19174dc3997a7c4b7aa0ff35b7 100644 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ b/gdb-6.6-buildid-locate-core-as-arg.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate-core-as-arg.patch - -;;=push+jan - http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html [ Fixed up since the mail. ] @@ -85,7 +78,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c #include #include "readline/readline.h" -@@ -357,12 +358,27 @@ exec_file_attach (const char *filename, int from_tty) +@@ -355,12 +356,27 @@ exec_file_attach (const char *filename, int from_tty) if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) { @@ -102,7 +95,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c exec_close (); - error (_("\"%s\": not in executable format: %s"), - scratch_pathname, -- gdb_bfd_errmsg (bfd_get_error (), matching)); +- gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); + + if (is_core != 0) + throw_error (IS_CORE_ERROR, @@ -112,14 +105,14 @@ diff --git a/gdb/exec.c b/gdb/exec.c + else + error (_("\"%s\": not in executable format: %s"), + scratch_pathname, -+ gdb_bfd_errmsg (bfd_get_error (), matching)); ++ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); } if (build_section_table (exec_bfd, §ions, §ions_end)) diff --git a/gdb/main.c b/gdb/main.c --- a/gdb/main.c +++ b/gdb/main.c -@@ -447,6 +447,37 @@ struct cmdarg +@@ -448,6 +448,35 @@ struct cmdarg char *string; }; @@ -130,8 +123,6 @@ diff --git a/gdb/main.c b/gdb/main.c +static void +exec_or_core_file_attach (const char *filename, int from_tty) +{ -+ volatile struct gdb_exception e; -+ + gdb_assert (exec_bfd == NULL); + + TRY @@ -157,7 +148,7 @@ diff --git a/gdb/main.c b/gdb/main.c static void captured_main_1 (struct captured_main_args *context) { -@@ -883,6 +914,8 @@ captured_main_1 (struct captured_main_args *context) +@@ -893,6 +922,8 @@ captured_main_1 (struct captured_main_args *context) { symarg = argv[optind]; execarg = argv[optind]; @@ -166,7 +157,7 @@ diff --git a/gdb/main.c b/gdb/main.c optind++; } -@@ -1033,11 +1066,25 @@ captured_main_1 (struct captured_main_args *context) +@@ -1043,12 +1074,25 @@ captured_main_1 (struct captured_main_args *context) && symarg != NULL && strcmp (execarg, symarg) == 0) { @@ -185,13 +176,15 @@ diff --git a/gdb/main.c b/gdb/main.c /* The exec file and the symbol-file are the same. If we can't open it, better only print one error message. - catch_command_errors returns non-zero on success! */ -- if (catch_command_errors (exec_file_attach, execarg, -- !batch_flag)) +- ret = catch_command_errors (exec_file_attach, execarg, +- !batch_flag); +- if (ret != 0) + catch_command_errors returns non-zero on success! + Do not load EXECARG as a symbol file if it has been already processed + as a core file. */ -+ if (catch_command_errors (func, execarg, !batch_flag) -+ && core_bfd == NULL) - catch_command_errors (symbol_file_add_main_adapter, symarg, - !batch_flag); ++ ret = catch_command_errors (func, execarg, !batch_flag); ++ if (ret != 0 && core_bfd == NULL) + ret = catch_command_errors (symbol_file_add_main_adapter, + symarg, !batch_flag); } + diff --git a/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch b/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch index a25057ec30d85c4094a6975a257409d0a59dbc1e..3de8e1e5a11fbfc8d4bf95e4ac3f73356309b3c4 100644 --- a/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch +++ b/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch @@ -1,13 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: - gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch - -;; Fix 'gdb gives highly misleading error when debuginfo pkg is present, -;; but not corresponding binary pkg' (RH BZ 981154). -;;=push+jan - Comments by Sergio Durigan Junior : This is the fix for RH BZ #981154 @@ -25,21 +15,6 @@ Comments by Sergio Durigan Junior : NULL after it is free'd, otherwise the code below thinks that it is still valid and doesn't print the necessary warning ("Try: yum install ..."). -diff --git a/gdb/build-id.c b/gdb/build-id.c ---- a/gdb/build-id.c -+++ b/gdb/build-id.c -@@ -581,7 +581,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, - do_cleanups (inner); - - if (abfd == NULL) -- continue; -+ { -+ filename = NULL; -+ continue; -+ } - - if (build_id_verify (abfd.get(), build_id_len, build_id)) - break; diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp new file mode 100644 --- /dev/null @@ -142,3 +117,4 @@ new file mode 100644 + +# Leaving the link there will cause breakage in the next run. +remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]" + diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch index 375b1780c9fef8100092f63593f8989ee6cba423..39311a58dc765e1cc79ed010ac3c8755071da2e7 100644 --- a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch - -;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). -;;=push+jan - diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -652,6 +652,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) +@@ -712,6 +712,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) #include #endif @@ -40,3 +32,4 @@ diff --git a/gdb/proc-service.list b/gdb/proc-service.list + /* gdb-6.6-buildid-locate-rpm.patch */ + rpmsqEnable; }; + diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch index 7e3948857c44b7332f323080ace16b7c8c021905..c203fef11e3603f85eaa04d60306d27daa8e96d2 100644 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ b/gdb-6.6-buildid-locate-rpm-scl.patch @@ -1,18 +1,10 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate-rpm-scl.patch - -;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). -;;=push+jan - warning: Skipping deprecated .gdb_index section https://bugzilla.redhat.com/show_bug.cgi?id=953585 diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -689,7 +689,11 @@ static int missing_rpm_list_entries; +@@ -746,7 +746,11 @@ static int missing_rpm_list_entries; /* Returns the count of newly added rpms. */ static int @@ -24,7 +16,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { static int rpm_init_done = 0; rpmts ts; -@@ -796,7 +800,11 @@ missing_rpm_enlist (const char *filename) +@@ -853,7 +857,11 @@ missing_rpm_enlist (const char *filename) mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); if (mi != NULL) { @@ -36,7 +28,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { Header h; char *debuginfo, **slot, *s, *s2; -@@ -914,6 +922,37 @@ missing_rpm_enlist (const char *filename) +@@ -971,6 +979,37 @@ missing_rpm_enlist (const char *filename) xfree (debuginfo); count++; } @@ -74,7 +66,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c rpmdbFreeIterator_p (mi); } -@@ -924,6 +963,21 @@ missing_rpm_enlist (const char *filename) +@@ -981,6 +1020,21 @@ missing_rpm_enlist (const char *filename) } static int @@ -99,7 +91,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -3469,6 +3469,16 @@ read_gdb_index_from_section (struct objfile *objfile, +@@ -3501,6 +3501,16 @@ read_gdb_index_from_buffer (struct objfile *objfile, "set use-deprecated-index-sections on". */ if (version < 6 && !deprecated_ok) { @@ -116,7 +108,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c static int warning_printed = 0; if (!warning_printed) { -@@ -3480,6 +3490,10 @@ to use the section anyway."), +@@ -3512,6 +3522,10 @@ to use the section anyway."), warning_printed = 1; } return 0; @@ -127,3 +119,4 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } /* Version 7 indices generated by gold refer to the CU for a symbol instead of the TU (for symbols coming from TUs), + diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index d5ec4b08c7d1f1692edd216cae7e69bcc83a9fc0..64a96b741d1727eec380f0256c85f3829fafface 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate-rpm.patch - -;;=push+jan - diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -244,7 +237,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c #define BUILD_ID_VERBOSE_NONE 0 #define BUILD_ID_VERBOSE_FILENAMES 1 -@@ -640,8 +642,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) +@@ -700,8 +702,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) return result; } @@ -612,7 +605,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c avoidance. */ struct missing_filepair -@@ -695,11 +1055,17 @@ missing_filepair_change (void) +@@ -755,11 +1115,17 @@ missing_filepair_change (void) /* All their memory came just from missing_filepair_OBSTACK. */ missing_filepair_hash = NULL; } @@ -630,7 +623,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c missing_filepair_change (); } -@@ -766,14 +1132,39 @@ debug_print_missing (const char *binary, const char *debug) +@@ -826,14 +1192,39 @@ debug_print_missing (const char *binary, const char *debug) *slot = missing_filepair; @@ -690,7 +683,7 @@ diff --git a/gdb/config.in b/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -270,6 +273,9 @@ +@@ -261,6 +264,9 @@ /* Define if Python 2.7 is being used. */ #undef HAVE_LIBPYTHON2_7 @@ -703,7 +696,7 @@ diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -749,6 +749,11 @@ CODESIGN_CERT +@@ -751,6 +751,11 @@ CODESIGN_CERT HAVE_NATIVE_GCORE_TARGET TARGET_OBS subdirs @@ -715,15 +708,15 @@ diff --git a/gdb/configure b/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -853,6 +858,7 @@ with_gdb_datadir +@@ -855,6 +860,7 @@ with_gdb_datadir with_relocated_sources with_auto_load_dir with_auto_load_safe_path +with_rpm enable_targets enable_64_bit_bfd - enable_gdbcli -@@ -912,6 +918,11 @@ CCC + enable_gdbmi +@@ -915,6 +921,11 @@ CCC CPP MAKEINFO MAKEINFOFLAGS @@ -735,7 +728,7 @@ diff --git a/gdb/configure b/gdb/configure YACC YFLAGS XMKMF' -@@ -1583,6 +1594,8 @@ Optional Packages: +@@ -1588,6 +1599,8 @@ Optional Packages: [--with-auto-load-dir] --without-auto-load-safe-path do not restrict auto-loaded files locations @@ -744,7 +737,7 @@ diff --git a/gdb/configure b/gdb/configure --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-curses use the curses library instead of the termcap library -@@ -1640,6 +1653,13 @@ Some influential environment variables: +@@ -1645,6 +1658,13 @@ Some influential environment variables: MAKEINFO Parent configure detects if it is of sufficient version. MAKEINFOFLAGS Parameters for MAKEINFO. @@ -758,7 +751,7 @@ diff --git a/gdb/configure b/gdb/configure YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. -@@ -6575,6 +6595,494 @@ _ACEOF +@@ -6626,6 +6646,494 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -1459,7 +1452,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/corelow.c b/gdb/corelow.c --- a/gdb/corelow.c +++ b/gdb/corelow.c -@@ -366,7 +366,7 @@ build_id_locate_exec (int from_tty) +@@ -365,7 +365,7 @@ build_id_locate_exec (int from_tty) symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; } else @@ -1472,7 +1465,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -40,6 +40,7 @@ - #include "buffer.h" + #include "common/buffer.h" #include "ser-event.h" #include "gdb_select.h" +#include "symfile.h" @@ -1488,7 +1481,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* Do not call the python hook on an explicit prompt change as passed to this function, as this forms a secondary/local prompt, IE, displayed but not set. */ -@@ -774,7 +777,10 @@ command_line_handler (char *rl) +@@ -770,7 +773,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) command_handler (cmd); if (ui->prompt_state != PROMPTED) @@ -1503,7 +1496,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c diff --git a/gdb/symfile.h b/gdb/symfile.h --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -540,6 +540,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data, +@@ -534,6 +534,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data, /* build-id support. */ extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); extern void debug_print_missing (const char *binary, const char *debug); @@ -1512,3 +1505,4 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h /* From dwarf2read.c */ + diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch index 2b961666c9034755b2b5ebdc1e41897375bc4d4f..c8bb3ba846367b0c5453a7caf4c2bd87cc919d4c 100644 --- a/gdb-6.6-buildid-locate-solib-missing-ids.patch +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -1,20 +1,10 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate-solib-missing-ids.patch - -;; Fix loading of core files without build-ids but with build-ids in executables. -;; Load strictly build-id-checked core files only if no executable is specified -;; (Jan Kratochvil, RH BZ 1339862). -;;=push+jan - gdb returns an incorrect back trace when applying a debuginfo https://bugzilla.redhat.com/show_bug.cgi?id=1339862 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -1358,14 +1358,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1347,14 +1347,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, } { @@ -44,7 +34,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c if (build_id != NULL) { char *name, *build_id_filename; -@@ -1380,23 +1393,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1369,23 +1382,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, xfree (name); } else @@ -235,3 +225,4 @@ new file mode 100644 + +gdb_test "bt" +gdb_test "info shared" + diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 6acb6bc744454bf8016e258ca34ad0f9a63f5e8f..10f6162e2d8a5a4fca3f22794961a96872505e3c 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate.patch - -;; New locating of the matching binaries from the pure core file (build-id). -;;=push+jan - diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -55,13 +47,13 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + && namesz == sizeof "GNU" + && memcmp (xnp->name, "GNU", sizeof "GNU") == 0) + { -+ size_t size = descsz; ++ size_t sz = descsz; + gdb_byte *data = (gdb_byte *) descdata; + struct bfd_build_id *retval; + -+ retval = (struct bfd_build_id *) xmalloc (sizeof *retval - 1 + size); -+ retval->size = size; -+ memcpy (retval->data, data, size); ++ retval = (struct bfd_build_id *) xmalloc (sizeof *retval - 1 + sz); ++ retval->size = sz; ++ memcpy (retval->data, data, sz); + + return retval; + } @@ -436,7 +428,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), -@@ -65,11 +463,50 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -65,62 +463,173 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) return retval; } @@ -474,123 +466,132 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + return retval; +} + - /* See build-id.h. */ + /* Helper for build_id_to_debug_bfd. LINK is a path to a potential + build-id-based separate debug file, potentially a symlink to the real file. + If the file exists and matches BUILD_ID, return a BFD reference to it. */ - gdb_bfd_ref_ptr --build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) -+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, -+ char **link_return, int add_debug_suffix) + static gdb_bfd_ref_ptr +-build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, +- const bfd_byte *build_id) ++build_id_to_debug_bfd_1 (const std::string &orig_link, size_t build_id_len, ++ const bfd_byte *build_id, char **link_return, ++ int add_debug_suffix) { -+ char *debugdir; -+ std::string link, link_all; -+ struct cleanup *back_to; -+ int ix; - gdb_bfd_ref_ptr abfd; - - /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will -@@ -82,63 +519,296 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) ++ gdb_bfd_ref_ptr ret_bfd = {}; ++ std::string ret_link; ++ + if (separate_debug_file_debug) { - const gdb_byte *data = build_id; - size_t size = build_id_len; -+ char *filename = NULL; -+ struct cleanup *inner; -+ unsigned seqno; -+ struct stat statbuf_trash; -+ std::string link0; - -- std::string link = debugdir.get (); -+ link = debugdir.get (); - link += "/.build-id/"; +- printf_unfiltered (_(" Trying %s..."), link.c_str ()); ++ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ()); + gdb_flush (gdb_stdout); + } - if (size > 0) - { - size--; -- string_appendf (link, "%02x/", (unsigned) *data++); -+ string_appendf (link, "%02x", (unsigned) *data++); - } +- /* lrealpath() is expensive even for the usually non-existent files. */ +- gdb::unique_xmalloc_ptr filename; +- if (access (link.c_str (), F_OK) == 0) +- filename.reset (lrealpath (link.c_str ())); - -+ if (size > 0) -+ link += "/"; - while (size-- > 0) - string_appendf (link, "%02x", (unsigned) *data++); - -- link += ".debug"; -- - if (separate_debug_file_debug) - printf_unfiltered (_(" Trying %s\n"), link.c_str ()); +- if (filename == NULL) ++ for (unsigned seqno = 0;; seqno++) + { +- if (separate_debug_file_debug) +- printf_unfiltered (_(" no, unable to compute real path\n")); ++ std::string link = orig_link; -- /* lrealpath() is expensive even for the usually non-existent files. */ -- gdb::unique_xmalloc_ptr filename; -- if (access (link.c_str (), F_OK) == 0) -- filename.reset (lrealpath (link.c_str ())); -- -- if (filename == NULL) -- continue; -+ for (seqno = 0;; seqno++) +- return {}; +- } ++ if (seqno > 0) + { -+ if (seqno) -+ { -+ /* There can be multiple build-id symlinks pointing to real files -+ with the same build-id (such as hard links). Some of the real -+ files may not be installed. */ ++ /* There can be multiple build-id symlinks pointing to real files ++ with the same build-id (such as hard links). Some of the real ++ files may not be installed. */ + +- /* We expect to be silent on the non-existing files. */ +- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); ++ string_appendf (link, ".%u", seqno); ++ } + +- if (debug_bfd == NULL) +- { +- if (separate_debug_file_debug) +- printf_unfiltered (_(" no, unable to open.\n")); ++ if (add_debug_suffix) ++ link += ".debug"; + -+ string_appendf (link, ".%u", seqno); -+ } ++ ret_link = link; + -+ if (add_debug_suffix) -+ link += ".debug"; ++ struct stat statbuf_trash; + -+ if (!seqno) -+ { -+ /* If none of the real files is found report as missing file -+ always the non-.%u-suffixed file. */ -+ link0 = link; -+ } ++ /* `access' automatically dereferences LINK. */ ++ if (lstat (link.c_str (), &statbuf_trash) != 0) ++ { ++ /* Stop increasing SEQNO. */ ++ break; ++ } + -+ /* `access' automatically dereferences LINK. */ -+ if (lstat (link.c_str (), &statbuf_trash) != 0) -+ { -+ /* Stop increasing SEQNO. */ -+ break; -+ } ++ /* lrealpath() is expensive even for the usually non-existent files. */ ++ gdb::unique_xmalloc_ptr filename; + -+ filename = lrealpath (link.c_str ()); -+ if (filename == NULL) -+ continue; ++ if (access (link.c_str (), F_OK) == 0) ++ filename.reset (lrealpath (link.c_str ())); + -+ /* We expect to be silent on the non-existing files. */ -+ inner = make_cleanup (xfree, filename); -+ abfd = gdb_bfd_open (filename, gnutarget, -1); -+ do_cleanups (inner); ++ if (filename == NULL) ++ { ++ if (separate_debug_file_debug) ++ printf_unfiltered (_(" no, unable to compute real path\n")); + -+ if (abfd == NULL) -+ continue; ++ continue; ++ } + -+ if (build_id_verify (abfd.get(), build_id_len, build_id)) -+ break; ++ /* We expect to be silent on the non-existing files. */ ++ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); + -+ abfd.release (); ++ if (debug_bfd == NULL) ++ { ++ if (separate_debug_file_debug) ++ printf_unfiltered (_(" no, unable to open.\n")); + -+ filename = NULL; ++ continue; + } - -- /* We expect to be silent on the non-existing files. */ -- abfd = gdb_bfd_open (filename.get (), gnutarget, -1); -+ if (filename != NULL) ++ ++ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) + { -+ /* LINK_ALL is not used below in this non-NULL FILENAME case. */ -+ break; ++ if (separate_debug_file_debug) ++ printf_unfiltered (_(" no, build-id does not match.\n")); ++ ++ continue; + } -- if (abfd == NULL) -- continue; +- return {}; ++ ret_bfd = debug_bfd; ++ break; + } + +- if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) ++ std::string link_all; ++ ++ if (ret_bfd != NULL) + { + if (separate_debug_file_debug) +- printf_unfiltered (_(" no, build-id does not match.\n")); ++ printf_unfiltered (_(" yes!\n")); ++ } ++ else ++ { ++ /* If none of the real files is found report as missing file ++ always the non-.%u-suffixed file. */ ++ std::string link0 = orig_link; ++ ++ if (add_debug_suffix) ++ link0 += ".debug"; ++ + /* If the symlink has target request to install the target. -+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. -+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ ++ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. ++ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ + std::string link0_resolved (link_resolve (link0.c_str (), 0)); -- if (build_id_verify (abfd.get(), build_id_len, build_id)) -- break; +- return {}; + if (link_all.empty ()) + link_all = link0_resolved; + else @@ -599,22 +600,69 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + its possible use as an argument for installation command. */ + link_all += " " + link0_resolved; + } -+ } + } -- abfd.release (); +- if (separate_debug_file_debug) +- printf_unfiltered (_(" yes!\n")); + if (link_return != NULL) + { -+ if (abfd != NULL) ++ if (ret_bfd != NULL) + { -+ *link_return = xstrdup (link.c_str ()); ++ *link_return = xstrdup (ret_link.c_str ()); + } + else + { + *link_return = xstrdup (link_all.c_str ()); + } - } ++ } + +- return debug_bfd; ++ return ret_bfd; + } + + /* See build-id.h. */ + + gdb_bfd_ref_ptr +-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return, int add_debug_suffix) + { + /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will + cause "/.build-id/..." lookups. */ +@@ -143,16 +652,16 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) + if (size > 0) + { + size--; +- string_appendf (link, "%02x/", (unsigned) *data++); ++ string_appendf (link, "%02x", (unsigned) *data++); + } +- ++ if (size > 0) ++ link += "/"; + while (size-- > 0) + string_appendf (link, "%02x", (unsigned) *data++); - return abfd; +- link += ".debug"; +- + gdb_bfd_ref_ptr debug_bfd +- = build_id_to_debug_bfd_1 (link, build_id_len, build_id); ++ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, ++ link_return, add_debug_suffix); + if (debug_bfd != NULL) + return debug_bfd; + +@@ -166,7 +675,8 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) + if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0) + { + link = gdb_sysroot + link; +- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id); ++ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, ++ link_return, add_debug_suffix); + if (debug_bfd != NULL) + return debug_bfd; + } +@@ -175,22 +685,190 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) + return {}; } +char * @@ -807,7 +855,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* Prevent looping on a stripped .debug file. */ if (abfd != NULL && filename_cmp (bfd_get_filename (abfd.get ()), -@@ -151,3 +821,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) +@@ -203,3 +881,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) return std::string (); } @@ -832,9 +880,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/build-id.h b/gdb/build-id.h --- a/gdb/build-id.h +++ b/gdb/build-id.h -@@ -22,9 +22,10 @@ - +@@ -23,9 +23,10 @@ #include "gdb_bfd.h" + #include "common/rsp-low.h" -/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ +/* Separate debuginfo files have corrupted PHDR but SHDR is correct there. @@ -845,7 +893,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h /* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value. Otherwise, issue a warning and return false. */ -@@ -38,13 +39,18 @@ extern int build_id_verify (bfd *abfd, +@@ -39,14 +40,19 @@ extern int build_id_verify (bfd *abfd, the caller. */ extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, @@ -866,11 +914,12 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h +extern std::string find_separate_debug_file_by_buildid (struct objfile *objfile, + gdb::unique_xmalloc_ptr *build_id_filename_return); - #endif /* BUILD_ID_H */ + /* Return an hex-string representation of BUILD_ID. */ + diff --git a/gdb/coffread.c b/gdb/coffread.c --- a/gdb/coffread.c +++ b/gdb/coffread.c -@@ -733,7 +733,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -732,7 +732,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) /* Try to add separate debug file if no symbols table found. */ if (!objfile_has_partial_symbols (objfile)) { @@ -883,10 +932,10 @@ diff --git a/gdb/coffread.c b/gdb/coffread.c diff --git a/gdb/corelow.c b/gdb/corelow.c --- a/gdb/corelow.c +++ b/gdb/corelow.c -@@ -45,6 +45,10 @@ +@@ -43,6 +43,10 @@ #include "gdb_bfd.h" #include "completer.h" - #include "filestuff.h" + #include "common/filestuff.h" +#include "auxv.h" +#include "elf/common.h" +#include "gdbcmd.h" @@ -894,7 +943,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c #ifndef O_LARGEFILE #define O_LARGEFILE 0 -@@ -321,6 +325,54 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) +@@ -320,6 +324,54 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) inferior_ptid = ptid; /* Yes, make it current. */ } @@ -905,7 +954,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c +{ + CORE_ADDR at_entry; + struct bfd_build_id *build_id; -+ char *execfilename, *debug_filename; ++ char *execfilename; + char *build_id_filename; + struct cleanup *back_to; + @@ -949,7 +998,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c /* Issue a message saying we have no core to debug, if FROM_TTY. */ static void -@@ -464,6 +516,14 @@ core_target_open (const char *arg, int from_tty) +@@ -455,6 +507,14 @@ core_target_open (const char *arg, int from_tty) switch_to_thread (thread); } @@ -964,7 +1013,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c post_create_inferior (target, from_tty); /* Now go through the target stack looking for threads since there -@@ -1072,4 +1132,11 @@ void +@@ -1063,4 +1123,11 @@ void _initialize_corelow (void) { add_target (core_target_info, core_target_open, filename_completer); @@ -979,7 +1028,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -19570,6 +19570,27 @@ information files. +@@ -19949,6 +19949,27 @@ information files. @end table @@ -1007,10 +1056,22 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named +diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c +--- a/gdb/dwarf-index-cache.c ++++ b/gdb/dwarf-index-cache.c +@@ -93,7 +93,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) + if (!enabled ()) + return; + +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + if (build_id == nullptr) + { + if (debug_index_cache) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -2683,7 +2683,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) +@@ -2727,7 +2727,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) } if (dwz_bfd == NULL) @@ -1019,10 +1080,28 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c if (dwz_bfd == NULL) error (_("could not find '.gnu_debugaltlink' file for %s"), +@@ -6237,7 +6237,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) + static gdb::array_view + get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) + { +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + if (build_id == nullptr) + return {}; + +@@ -6250,7 +6250,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) + static gdb::array_view + get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) + { +- const bfd_build_id *build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + if (build_id == nullptr) + return {}; + diff --git a/gdb/elfread.c b/gdb/elfread.c --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -1290,7 +1290,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1287,7 +1287,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { @@ -1033,8 +1112,8 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c if (debugfile.empty ()) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1302,6 +1304,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) - symbol_file_add_separate (abfd.get (), debugfile.c_str (), +@@ -1299,6 +1301,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) + symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (), symfile_flags, objfile); } + /* Check if any separate debug info has been extracted out. */ @@ -1047,7 +1126,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c diff --git a/gdb/objfiles.h b/gdb/objfiles.h --- a/gdb/objfiles.h +++ b/gdb/objfiles.h -@@ -470,6 +470,10 @@ struct objfile +@@ -554,6 +554,10 @@ struct objfile htab_t static_links {}; }; @@ -1061,7 +1140,7 @@ diff --git a/gdb/objfiles.h b/gdb/objfiles.h diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c -@@ -137,7 +137,7 @@ objfpy_get_build_id (PyObject *self, void *closure) +@@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure) TRY { @@ -1070,7 +1149,7 @@ diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c } CATCH (except, RETURN_MASK_ALL) { -@@ -544,7 +544,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) +@@ -535,7 +535,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) /* Don't return separate debug files. */ if (objfile->separate_debug_objfile_backlink != NULL) continue; @@ -1090,7 +1169,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c static struct link_map_offsets *svr4_fetch_link_map_offsets (void); static int svr4_have_link_map_offsets (void); -@@ -1356,9 +1357,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1345,9 +1346,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1148,7 +1227,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c diff --git a/gdb/symfile.h b/gdb/symfile.h --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -537,6 +537,10 @@ void expand_symtabs_matching +@@ -531,6 +531,10 @@ void expand_symtabs_matching void map_symbol_filenames (symbol_filename_ftype *fun, void *data, int need_fullname); @@ -1210,7 +1289,7 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp -@@ -1695,6 +1695,16 @@ proc default_gdb_start { } { +@@ -1716,6 +1716,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } } @@ -1247,3 +1326,4 @@ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp if { $separate_inferior_pty } { mi_create_inferior_pty + diff --git a/gdb-6.6-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch index b4ddc9f8df0a6da0baae66560469ada731dba11e..f0eaf8a32788deccbe044ed12a16ef243457b989 100644 --- a/gdb-6.6-bz229517-gcore-without-terminal.patch +++ b/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-bz229517-gcore-without-terminal.patch - -;; Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). -;;=fedoratest - 2007-04-22 Jan Kratochvil * gdb_gcore.sh: Redirect GDB from ` -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-bz230000-power6-disassembly-test.patch - -;; Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). -;;=fedoratest - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000 The original testcase @@ -92,3 +84,4 @@ new file mode 100644 + .long 0xfc020444 /* ddivq f0,f2,f0 */ + .long 0xec820d04 /* dcmpu cr1,f2,f1 */ + .long 0xfc820504 /* dcmpuq cr1,f2,f0 */ + diff --git a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch index 89f2d6462b6204dd36ef5cfd339ded3a4430e361..df7426be932f5b2a87d5d4b6be7d3b01089cae00 100644 --- a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +++ b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch - -;; Support for stepping over PPC atomic instruction sequences (BZ 237572). -;;=fedoratest - 2007-06-25 Jan Kratochvil * gdb.threads/atomic-seq-threaded.c, @@ -276,3 +268,4 @@ new file mode 100644 +gdb_test "c" \ + ".*Program exited normally\\..*" \ + "run till program exit" + diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch index ebc4aa6151cde0ef12bf5b8422bf905311aae3cb..804eb8e255d95038b36acddd127b4ededab04b3b 100644 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ b/gdb-6.6-scheduler_locking-step-is-default.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-scheduler_locking-step-is-default.patch - -;; Make upstream `set scheduler-locking step' as default. -;;=push+jan: How much is scheduler-locking relevant after non-stop? - diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -2193,7 +2193,7 @@ static const char *const scheduler_enums[] = { +@@ -2075,7 +2075,7 @@ static const char *const scheduler_enums[] = { schedlock_replay, NULL }; @@ -76,3 +68,4 @@ diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inlin pass $message } timeout { + diff --git a/gdb-6.6-testsuite-timeouts.patch b/gdb-6.6-testsuite-timeouts.patch index a89631335b84631a82669e584899215a833e4213..07747caa55e04b9df2185ff097736418f973dca9 100644 --- a/gdb-6.6-testsuite-timeouts.patch +++ b/gdb-6.6-testsuite-timeouts.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-testsuite-timeouts.patch - -;; Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -30,3 +22,4 @@ diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3 # The commands we test here produce many lines of output; disable "press # to continue" prompts. gdb_test_no_output "set height 0" + diff --git a/gdb-6.7-charsign-test.patch b/gdb-6.7-charsign-test.patch index 8c89b13ec110eda08a88cb3e939a0c2c7ad7d341..87b1242a36a0070f96fe3fa783d621b76be93def 100644 --- a/gdb-6.7-charsign-test.patch +++ b/gdb-6.7-charsign-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.7-charsign-test.patch - -;; Fix displaying of numeric char arrays as strings (BZ 224128). -;;=fedoratest: But it is failing anyway, one should check the behavior more. - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128 2007-01-25 Jan Kratochvil @@ -128,3 +120,4 @@ new file mode 100644 +do_test {} +do_test {-fsigned-char} +do_test {-funsigned-char} + diff --git a/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/gdb-6.7-ppc-clobbered-registers-O2-test.patch index 08ee2f9f79eb685601bc2deab5e59d60c6781e4a..75e8740ee28a28eff0c84ac2bd0adc1319d2a10a 100644 --- a/gdb-6.7-ppc-clobbered-registers-O2-test.patch +++ b/gdb-6.7-ppc-clobbered-registers-O2-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.7-ppc-clobbered-registers-O2-test.patch - -;; Test PPC hiding of call-volatile parameter register. -;;=fedoratest - 2007-11-04 Jan Kratochvil * gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to @@ -106,3 +98,4 @@ new file mode 100644 + +gdb_test backtrace ".*operand0=.*operand1=.*" \ + "Check value of call clobbered registers" + diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch index ec8f9c22c5dcd7da8d5e6f41b3cbec0592bef762..0585906abee71aea4878a2e67a742931cabadfc8 100644 --- a/gdb-6.7-testsuite-stable-results.patch +++ b/gdb-6.7-testsuite-stable-results.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.7-testsuite-stable-results.patch - -;; Testsuite fixes for more stable/comparable results. -;;=fedoratest - gdb/testsuite/gdb.base/fileio.c: gdb/testsuite/gdb.base/fileio.exp: 2007-12-08 Jan Kratochvil @@ -102,3 +94,4 @@ diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.e set timeout $oldtimeout return 0 + diff --git a/gdb-6.8-bz436037-reg-no-longer-active.patch b/gdb-6.8-bz436037-reg-no-longer-active.patch index ea240afae457acc0e03d25037c524a3148cb0051..8dab2bbe534a7a44ca950912a44f144ec4cb3d28 100644 --- a/gdb-6.8-bz436037-reg-no-longer-active.patch +++ b/gdb-6.8-bz436037-reg-no-longer-active.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.8-bz436037-reg-no-longer-active.patch - -;; Fix register assignments with no GDB stack frames (BZ 436037). -;;=push+jan: This fix is incorrect. - diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -1104,6 +1104,8 @@ value_assign (struct value *toval, struct value *fromval) +@@ -1092,6 +1092,8 @@ value_assign (struct value *toval, struct value *fromval) struct gdbarch *gdbarch; int value_reg; @@ -18,7 +10,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c /* Figure out which frame this is in currently. We use VALUE_FRAME_ID for obtaining the value's frame id instead of -@@ -1113,8 +1115,14 @@ value_assign (struct value *toval, struct value *fromval) +@@ -1101,8 +1103,14 @@ value_assign (struct value *toval, struct value *fromval) frame. */ frame = frame_find_by_id (VALUE_FRAME_ID (toval)); @@ -35,3 +27,4 @@ diff --git a/gdb/valops.c b/gdb/valops.c if (!frame) error (_("Value being assigned to is no longer active.")); + diff --git a/gdb-6.8-bz442765-threaded-exec-test.patch b/gdb-6.8-bz442765-threaded-exec-test.patch index e2ed4318828fd0b9794d231b21b3f6b7c5020e15..651a19c51b7807d38a517dc196490dca45ad9218 100644 --- a/gdb-6.8-bz442765-threaded-exec-test.patch +++ b/gdb-6.8-bz442765-threaded-exec-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.8-bz442765-threaded-exec-test.patch - -;; Test various forms of threads tracking across exec() (BZ 442765). -;;=fedoratest - Test various forms of threads tracking across exec(2). diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c @@ -179,3 +171,4 @@ diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.thr gdb_test_multiple {} "Program exited" { -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { + diff --git a/gdb-6.8-bz466901-backtrace-full-prelinked.patch b/gdb-6.8-bz466901-backtrace-full-prelinked.patch index 542a95685ac66b8f975ba79157d3057e695d2cc2..33498b376dcccfad8b17c43ab10277228a9067e9 100644 --- a/gdb-6.8-bz466901-backtrace-full-prelinked.patch +++ b/gdb-6.8-bz466901-backtrace-full-prelinked.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.8-bz466901-backtrace-full-prelinked.patch - -;; Fix resolving of variables at locations lists in prelinked libs (BZ 466901). -;;=fedoratest - Fix resolving of variables at locations lists in prelinked libs (BZ 466901). diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S @@ -479,3 +471,4 @@ new file mode 100644 + +# `abort' can get expressed as `*__GI_abort'. +gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()" + diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch index 85db824bcc2eb9ccc3869ce327667bc7861c1eb5..f42719bfe05088cd5d2a3b12e5518ac74b5865fa 100644 --- a/gdb-6.8-quit-never-aborts.patch +++ b/gdb-6.8-quit-never-aborts.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.8-quit-never-aborts.patch - -;; Make the GDB quit processing non-abortable to cleanup everything properly. -;;=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch . - We may abort the process of detaching threads with multiple SIGINTs - which are being sent during a testcase terminating its child GDB. @@ -45,7 +37,7 @@ diff --git a/gdb/extension.c b/gdb/extension.c diff --git a/gdb/top.c b/gdb/top.c --- a/gdb/top.c +++ b/gdb/top.c -@@ -1606,7 +1606,13 @@ quit_force (int *exit_arg, int from_tty) +@@ -1626,7 +1626,13 @@ quit_force (int *exit_arg, int from_tty) qt.from_tty = from_tty; @@ -62,7 +54,7 @@ diff --git a/gdb/top.c b/gdb/top.c diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -108,6 +108,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; +@@ -100,6 +100,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; static int debug_timestamp = 0; @@ -76,3 +68,4 @@ diff --git a/gdb/utils.c b/gdb/utils.c /* Nonzero means that strings with character values >0x7F should be printed as octal escapes. Zero means just print the value (e.g. it's an international character, and the terminal or window can cope.) */ + diff --git a/gdb-6.8-sparc64-silence-memcpy-check.patch b/gdb-6.8-sparc64-silence-memcpy-check.patch deleted file mode 100644 index 6c0848d2577d2f038ade6cf5ec1b92d4920d48fd..0000000000000000000000000000000000000000 --- a/gdb-6.8-sparc64-silence-memcpy-check.patch +++ /dev/null @@ -1,19 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.8-sparc64-silence-memcpy-check.patch - -;; Silence memcpy check which returns false positive (sparc64) -;;=push: But it is just a GCC workaround, look up the existing GCC PR for it. - -diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c ---- a/gdb/sparc-tdep.c -+++ b/gdb/sparc-tdep.c -@@ -1462,6 +1462,7 @@ sparc32_store_return_value (struct type *type, struct regcache *regcache, - if (sparc_floating_p (type) || sparc_complex_floating_p (type)) - { - /* Floating return values. */ -+ len = (len <= 8) ? len : 8; - memcpy (buf, valbuf, len); - regcache->cooked_write (SPARC_F0_REGNUM, buf); - if (len > 4) diff --git a/gdb-6.8-watchpoint-conditionals-test.patch b/gdb-6.8-watchpoint-conditionals-test.patch deleted file mode 100644 index 5096a6788d996e7fc6d0b974a600f315ac0219c5..0000000000000000000000000000000000000000 --- a/gdb-6.8-watchpoint-conditionals-test.patch +++ /dev/null @@ -1,90 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.8-watchpoint-conditionals-test.patch - -;; Test the watchpoints conditionals works. -;;=fedoratest - -For: -http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html -http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html - -diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.c b/gdb/testsuite/gdb.base/watchpoint-cond.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-cond.c -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 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 . -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+int -+main (int argc, char **argv) -+{ -+ static int i = 0; /* `static' to start initialized. */ -+ int j = 2; -+ -+ for (j = 0; j < 30; j++) -+ i = 30 - j; -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/watchpoint-cond.exp b/gdb/testsuite/gdb.base/watchpoint-cond.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-cond.exp -@@ -0,0 +1,37 @@ -+# Copyright 2008 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 . -+ -+set testfile watchpoint-cond -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if { [runto_main] < 0 } { -+ untested watchpoint-cond -+ return -1 -+} -+ -+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i" -+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*" diff --git a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch b/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch deleted file mode 100644 index fc753294edcaa5370f637569401360605d99ca16..0000000000000000000000000000000000000000 --- a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch +++ /dev/null @@ -1,68 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch - -;; Toolchain on sparc is slightly broken and debuginfo files are generated -;; with non 64bit aligned tables/offsets. -;; See for example readelf -S ../Xvnc.debug. -;; -;; As a consenquence calculation of sectp->filepos as used in -;; dwarf2_read_section (gdb/dwarf2read.c:1525) will return a non aligned buffer -;; that cannot be used directly as done with MMAP. -;; Usage will result in a BusError. -;; -;; While we figure out what's wrong in the toolchain and do a full archive -;; rebuild to fix it, we need to be able to use gdb :) -;;=push - -diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c ---- a/gdb/gdb_bfd.c -+++ b/gdb/gdb_bfd.c -@@ -24,12 +24,14 @@ - #include "hashtab.h" - #include "filestuff.h" - #include "vec.h" -+#ifndef __sparc__ - #ifdef HAVE_MMAP - #include - #ifndef MAP_FAILED - #define MAP_FAILED ((void *) -1) - #endif - #endif -+#endif - #include "target.h" - #include "gdb/fileio.h" - #include "inferior.h" -@@ -484,6 +486,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore) - - if (sect != NULL && sect->data != NULL) - { -+#ifndef __sparc__ - #ifdef HAVE_MMAP - if (sect->map_addr != NULL) - { -@@ -493,6 +496,7 @@ free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore) - gdb_assert (res == 0); - } - else -+#endif - #endif - xfree (sect->data); - } -@@ -659,6 +663,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size) - if (descriptor->data != NULL) - goto done; - -+#ifndef __sparc__ - #ifdef HAVE_MMAP - if (!bfd_is_section_compressed (abfd, sectp)) - { -@@ -693,6 +698,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size) - } - } - #endif /* HAVE_MMAP */ -+#endif - - /* Handle compressed sections, or ordinary uncompressed sections in - the no-mmap case. */ diff --git a/gdb-8.2.tar.xz b/gdb-8.3.1.tar.xz similarity index 67% rename from gdb-8.2.tar.xz rename to gdb-8.3.1.tar.xz index fc5ae3c1535a9337abac634e3cec57c7e303be81..c4a4cdaca0c0613d70d88b4b0dc95e03c4c21daf 100644 Binary files a/gdb-8.2.tar.xz and b/gdb-8.3.1.tar.xz differ diff --git a/gdb-Detect-invalid-length-field-in-debug-frame-FDE-header.patch b/gdb-Detect-invalid-length-field-in-debug-frame-FDE-header.patch deleted file mode 100644 index 57216282b53739421c17d45d2ff01a09ee40d654..0000000000000000000000000000000000000000 --- a/gdb-Detect-invalid-length-field-in-debug-frame-FDE-header.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 723adb650a31859d7cc45832cb8adca0206455ed Mon Sep 17 00:00:00 2001 -From: Sandra Loosemore -Date: Thu, 25 Apr 2019 07:27:02 -0700 -Subject: [PATCH] Detect invalid length field in debug frame FDE header. - -GDB was failing to catch cases where a corrupt ELF or core file -contained an invalid length value in a Dwarf debug frame FDE header. -It was checking for buffer overflow but not cases where the length was -negative or caused pointer wrap-around. - -In addition to the additional validity check, this patch cleans up the -multiple signed/unsigned conversions on the length field so that an -unsigned representation is used consistently throughout. - -This patch fixes CVE-2017-9778 and PR gdb/21600. - -2019-04-25 Sandra Loosemore - Kang Li - - PR gdb/21600 - - * dwarf2-frame.c (read_initial_length): Be consistent about using - unsigned representation of length. - (decode_frame_entry_1): Likewise. Check for wraparound of - end pointer as well as buffer overflow. ---- - gdb/ChangeLog | 10 ++++++++++ - gdb/dwarf2-frame.c | 14 +++++++------- - 2 files changed, 17 insertions(+), 7 deletions(-) - -diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c -index e2bf61b..b697afa 100644 ---- a/gdb/dwarf2-frame.c -+++ b/gdb/dwarf2-frame.c -@@ -1487,7 +1487,7 @@ static ULONGEST - read_initial_length (bfd *abfd, const gdb_byte *buf, - unsigned int *bytes_read_ptr) - { -- LONGEST result; -+ ULONGEST result; - - result = bfd_get_32 (abfd, buf); - if (result == 0xffffffff) -@@ -1788,7 +1788,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, - { - struct gdbarch *gdbarch = get_objfile_arch (unit->objfile); - const gdb_byte *buf, *end; -- LONGEST length; -+ ULONGEST length; - unsigned int bytes_read; - int dwarf64_p; - ULONGEST cie_id; -@@ -1799,15 +1799,15 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, - buf = start; - length = read_initial_length (unit->abfd, buf, &bytes_read); - buf += bytes_read; -- end = buf + length; -- -- /* Are we still within the section? */ -- if (end > unit->dwarf_frame_buffer + unit->dwarf_frame_size) -- return NULL; -+ end = buf + (size_t) length; - - if (length == 0) - return end; - -+ /* Are we still within the section? */ -+ if (end <= buf || end > unit->dwarf_frame_buffer + unit->dwarf_frame_size) -+ return NULL; -+ - /* Distinguish between 32 and 64-bit encoded frame info. */ - dwarf64_p = (bytes_read == 12); - --- -2.9.3 - diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch index 26643f8def36d2832cae96964720589a4c9aa691..38751e49336fb7af15a6d9d3015e580829db1acb 100644 --- a/gdb-archer-next-over-throw-cxx-exec.patch +++ b/gdb-archer-next-over-throw-cxx-exec.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-archer-next-over-throw-cxx-exec.patch - -;; Fix follow-exec for C++ programs (bugreported by Martin Stransky). -;;=fedoratest - Archer-upstreamed: http://sourceware.org/ml/archer/2010-q2/msg00031.html @@ -43,7 +35,7 @@ diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.cp/cxxexec.exp -@@ -0,0 +1,51 @@ +@@ -0,0 +1,42 @@ +# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -83,15 +75,7 @@ new file mode 100644 + } +} + -+set test continue -+gdb_test_multiple $test $test { -+ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+# `info inferiors' can show on older GDBs. -+gdb_test "info threads" "info threads" "program finished" ++# Run to end. The buggy GDB failed instead with: ++# Cannot access memory at address ADDR. ++gdb_continue_to_end "" "continue" 1 + diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index 8824e5420e56c6a502d7fc6fed636b3cd0c42ea9..338d0dc4751b935a534857cc9668e90a2d4f604d 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -1,16 +1,9 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-archer-pie-addons-keep-disabled.patch - -;;=push+jan: Breakpoints disabling matching should not be based on address. - diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -15522,6 +15522,50 @@ initialize_breakpoint_ops (void) +@@ -15441,6 +15441,50 @@ static struct cmd_list_element *enablebreaklist = NULL; - static struct cmd_list_element *enablebreaklist = NULL; + cmd_list_element *commands_cmd_element = nullptr; +void +breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta) @@ -62,7 +55,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h -@@ -1679,6 +1679,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg); +@@ -1664,6 +1664,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg); UIOUT iff debugging multiple threads. */ extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout); @@ -75,7 +68,7 @@ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h diff --git a/gdb/objfiles.c b/gdb/objfiles.c --- a/gdb/objfiles.c +++ b/gdb/objfiles.c -@@ -883,6 +883,11 @@ objfile_relocate1 (struct objfile *objfile, +@@ -875,6 +875,11 @@ objfile_relocate1 (struct objfile *objfile, obj_section_addr (s)); } @@ -87,3 +80,4 @@ diff --git a/gdb/objfiles.c b/gdb/objfiles.c /* Data changed. */ return 1; } + diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 9aef61725654664c2c5924ce1766a3653b86c1ec..2152aa0fb04002b28c2545f3f88b2437bbac61e8 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -1,14 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-archer-pie-addons.patch - -;;=push+jan: May get obsoleted by Tom's unrelocated objfiles patch. - diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -505,6 +505,7 @@ enum field_loc_kind +@@ -507,6 +507,7 @@ enum field_loc_kind { FIELD_LOC_KIND_BITPOS, /**< bitpos */ FIELD_LOC_KIND_ENUMVAL, /**< enumval */ @@ -16,7 +9,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h FIELD_LOC_KIND_PHYSADDR, /**< physaddr */ FIELD_LOC_KIND_PHYSNAME, /**< physname */ FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */ -@@ -556,6 +557,7 @@ union field_location +@@ -558,6 +559,7 @@ union field_location field. Otherwise, physname is the mangled label of the static field. */ @@ -24,7 +17,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h CORE_ADDR physaddr; const char *physname; -@@ -1438,6 +1440,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1436,6 +1438,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval) #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) @@ -32,7 +25,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) #define SET_FIELD_BITPOS(thisfld, bitpos) \ -@@ -1449,6 +1452,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1447,6 +1450,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) @@ -40,7 +33,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -1465,6 +1469,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1463,6 +1467,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) @@ -51,7 +44,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h diff --git a/gdb/value.c b/gdb/value.c --- a/gdb/value.c +++ b/gdb/value.c -@@ -2829,7 +2829,8 @@ value_static_field (struct type *type, int fieldno) +@@ -2827,7 +2827,8 @@ value_static_field (struct type *type, int fieldno) { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), @@ -61,3 +54,4 @@ diff --git a/gdb/value.c b/gdb/value.c break; case FIELD_LOC_KIND_PHYSNAME: { + diff --git a/gdb-archer-vla-tests.patch b/gdb-archer-vla-tests.patch index fa4fa0db891bcc574e909893734c08b82ceb227a..ff25c8d3d79a35a35d453445a56ae98881aeee55 100644 --- a/gdb-archer-vla-tests.patch +++ b/gdb-archer-vla-tests.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-archer-vla-tests.patch - -;;=fedoratest - diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp --- a/gdb/testsuite/gdb.ada/packed_array.exp +++ b/gdb/testsuite/gdb.ada/packed_array.exp @@ -3735,3 +3728,4 @@ diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp } set pascal_init_done 1 } + diff --git a/gdb-archer.patch b/gdb-archer.patch index dcb989c944cf201fe61e0b381d20c55cf38917a4..575b70b10c9e82cad47ef47f62f2f89cfc2bc243 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-archer.patch - -;; Python patches of: http://sourceware.org/gdb/wiki/ProjectArcher -;;=push - http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement @@ -17,7 +9,7 @@ tromey/python diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -2112,6 +2112,12 @@ stamp-h: $(srcdir)/config.in config.status +@@ -2082,6 +2082,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -53,7 +45,7 @@ diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -1245,6 +1245,16 @@ for remote debugging. +@@ -1251,6 +1251,16 @@ for remote debugging. Run using @var{device} for your program's standard input and output. @c FIXME: kingdon thinks there is more to -tty. Investigate. @@ -73,7 +65,7 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi -@@ -88,8 +88,6 @@ containing @code{end}. For example: +@@ -90,8 +90,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -112,7 +104,7 @@ diff --git a/gdb/main.c b/gdb/main.c #include "source.h" #include "cli/cli-cmds.h" #include "objfiles.h" -@@ -479,7 +480,7 @@ exec_or_core_file_attach (const char *filename, int from_tty) +@@ -478,7 +479,7 @@ exec_or_core_file_attach (const char *filename, int from_tty) } static void @@ -121,7 +113,7 @@ diff --git a/gdb/main.c b/gdb/main.c { int argc = context->argc; char **argv = context->argv; -@@ -695,10 +696,14 @@ captured_main_1 (struct captured_main_args *context) +@@ -698,10 +699,14 @@ captured_main_1 (struct captured_main_args *context) {"args", no_argument, &set_args, 1}, {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, @@ -137,7 +129,7 @@ diff --git a/gdb/main.c b/gdb/main.c { int option_index; -@@ -716,6 +721,9 @@ captured_main_1 (struct captured_main_args *context) +@@ -719,6 +724,9 @@ captured_main_1 (struct captured_main_args *context) case 0: /* Long option that just sets a flag. */ break; @@ -147,7 +139,7 @@ diff --git a/gdb/main.c b/gdb/main.c case OPT_SE: symarg = optarg; execarg = optarg; -@@ -890,7 +898,31 @@ captured_main_1 (struct captured_main_args *context) +@@ -898,7 +906,31 @@ captured_main_1 (struct captured_main_args *context) /* Now that gdb_init has created the initial inferior, we're in position to set args for that inferior. */ @@ -180,7 +172,7 @@ diff --git a/gdb/main.c b/gdb/main.c { /* The remaining options are the command-line options for the inferior. The first one is the sym/exec file, and the rest -@@ -1180,7 +1212,8 @@ captured_main_1 (struct captured_main_args *context) +@@ -1199,7 +1231,8 @@ captured_main_1 (struct captured_main_args *context) /* Read in the old history after all the command files have been read. */ @@ -190,7 +182,7 @@ diff --git a/gdb/main.c b/gdb/main.c if (batch_flag) { -@@ -1193,24 +1226,37 @@ static void +@@ -1215,24 +1248,37 @@ static void captured_main (void *data) { struct captured_main_args *context = (struct captured_main_args *) data; @@ -241,7 +233,7 @@ diff --git a/gdb/main.c b/gdb/main.c } /* No exit -- exit is through quit_command. */ } -@@ -1253,6 +1299,12 @@ print_gdb_help (struct ui_file *stream) +@@ -1275,6 +1321,12 @@ print_gdb_help (struct ui_file *stream) fputs_unfiltered (_("\ This is the GNU debugger. Usage:\n\n\ gdb [options] [executable-file [core-file or process-id]]\n\ @@ -254,7 +246,7 @@ diff --git a/gdb/main.c b/gdb/main.c gdb [options] --args executable-file [inferior-arguments ...]\n\n\ "), stream); fputs_unfiltered (_("\ -@@ -1298,6 +1350,13 @@ Output and user interface control:\n\n\ +@@ -1320,6 +1372,13 @@ Output and user interface control:\n\n\ #endif fputs_unfiltered (_("\ --dbx DBX compatibility mode.\n\ @@ -365,8 +357,8 @@ new file mode 100644 diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h -@@ -644,6 +644,9 @@ class gdbpy_enter_varobj : public gdbpy_enter - +@@ -709,6 +709,9 @@ private: + PyThreadState *m_save; }; +struct cleanup *ensure_python_env (struct gdbarch *gdbarch, @@ -378,16 +370,16 @@ diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h diff --git a/gdb/python/python.c b/gdb/python/python.c --- a/gdb/python/python.c +++ b/gdb/python/python.c -@@ -95,6 +95,8 @@ const struct extension_language_defn extension_language_python = +@@ -94,6 +94,8 @@ const struct extension_language_defn extension_language_python = #include "linespec.h" #include "source.h" - #include "version.h" + #include "common/version.h" +#include "inferior.h" +#include "gdbthread.h" #include "target.h" #include "gdbthread.h" #include "interps.h" -@@ -237,6 +239,29 @@ gdbpy_enter::~gdbpy_enter () +@@ -235,6 +237,29 @@ gdbpy_enter::~gdbpy_enter () restore_active_ext_lang (m_previous_active); } @@ -417,10 +409,10 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c /* Set the quit flag. */ static void -@@ -1367,6 +1392,92 @@ gdbpy_print_stack (void) +@@ -1283,6 +1308,92 @@ gdbpy_print_stack_or_quit () + + - /* Return the current Progspace. - There always is one. */ +/* True if 'gdb -P' was used, false otherwise. */ +static int running_python_script; + @@ -507,10 +499,10 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c + + + + /* Return a sequence holding all the Progspaces. */ static PyObject * - gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -2057,6 +2168,8 @@ PyMethodDef python_GdbMethods[] = +@@ -1937,6 +2048,8 @@ PyMethodDef python_GdbMethods[] = Evaluate command, a string, as a gdb CLI command. Optionally returns\n\ a Python String containing the output of the command if to_string is\n\ set to True." }, @@ -522,13 +514,17 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c diff --git a/gdb/python/python.h b/gdb/python/python.h --- a/gdb/python/python.h +++ b/gdb/python/python.h -@@ -25,4 +25,6 @@ +@@ -25,7 +25,10 @@ /* This is all that python exports to gdb. */ extern const struct extension_language_defn extension_language_python; ++ + /* Command element for the 'python' command. */ + extern cmd_list_element *python_cmd_element; + +extern void run_python_script (int argc, char **argv); + - #endif /* GDB_PYTHON_H */ + #endif /* PYTHON_PYTHON_H */ diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp --- a/gdb/testsuite/gdb.python/py-frame.exp +++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -544,7 +540,7 @@ diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -384,6 +384,15 @@ proc test_value_after_death {} { +@@ -399,6 +399,15 @@ proc test_value_after_death {} { "print value's type" } @@ -560,8 +556,8 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py # Regression test for invalid subscript operations. The bug was that # the type of the value was not being checked before allowing a # subscript operation to proceed. -@@ -512,6 +521,7 @@ if ![runto_main] then { - test_value_in_inferior +@@ -585,6 +594,7 @@ test_value_in_inferior + test_value_from_buffer test_inferior_function_call test_value_after_death +test_cast_regression @@ -571,7 +567,7 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py diff --git a/gdb/varobj.c b/gdb/varobj.c --- a/gdb/varobj.c +++ b/gdb/varobj.c -@@ -218,6 +218,14 @@ is_root_p (const struct varobj *var) +@@ -217,6 +217,14 @@ is_root_p (const struct varobj *var) } #ifdef HAVE_PYTHON @@ -598,3 +594,4 @@ diff --git a/gdb/varobj.h b/gdb/varobj.h extern bool varobj_default_value_is_changeable_p (const struct varobj *var); extern bool varobj_value_is_changeable_p (const struct varobj *var); + diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch index c8b1267fb49673c8d039c940b205a46661c41e3c..cfcf1830b550d28d6d2d7f13d5dfeae81cf272bf 100644 --- a/gdb-attach-fail-reasons-5of5.patch +++ b/gdb-attach-fail-reasons-5of5.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-attach-fail-reasons-5of5.patch - -;; Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878). -;;=push+jan - http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html Hi, @@ -45,7 +37,7 @@ gdb/gdbserver/ diff --git a/gdb/config.in b/gdb/config.in --- a/gdb/config.in +++ b/gdb/config.in -@@ -276,6 +276,9 @@ +@@ -267,6 +267,9 @@ /* Define if librpm library is being used. */ #undef HAVE_LIBRPM @@ -55,7 +47,7 @@ diff --git a/gdb/config.in b/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_LIBUNWIND_IA64_H -@@ -399,6 +402,9 @@ +@@ -390,6 +393,9 @@ /* Define to 1 if you have the `scm_new_smob' function. */ #undef HAVE_SCM_NEW_SMOB @@ -68,7 +60,7 @@ diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -15854,6 +15854,64 @@ cat >>confdefs.h <<_ACEOF +@@ -15898,6 +15898,64 @@ cat >>confdefs.h <<_ACEOF _ACEOF @@ -136,7 +128,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -2054,6 +2054,10 @@ case $host_os in +@@ -2051,6 +2051,10 @@ case $host_os in esac AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.]) @@ -173,7 +165,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure -@@ -8535,6 +8535,64 @@ if $want_ipa ; then +@@ -8589,6 +8589,64 @@ if $want_ipa ; then fi fi @@ -241,7 +233,7 @@ diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac -@@ -486,6 +486,10 @@ if $want_ipa ; then +@@ -478,6 +478,10 @@ if $want_ipa ; then fi fi @@ -276,9 +268,9 @@ diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -1089,7 +1089,17 @@ linux_nat_target::create_inferior (const char *exec_file, +@@ -1099,7 +1099,17 @@ linux_nat_target::create_inferior (const char *exec_file, /* Make sure we report all signals during startup. */ - pass_signals (0, NULL); + pass_signals ({}); - inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty); + TRY @@ -318,7 +310,7 @@ diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c return result; } -@@ -583,6 +589,25 @@ linux_ptrace_init_warnings (void) +@@ -586,6 +592,25 @@ linux_ptrace_init_warnings (void) linux_ptrace_test_ret_to_nx (); } @@ -355,3 +347,4 @@ diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h extern void linux_check_ptrace_features (void); extern void linux_enable_event_reporting (pid_t pid, int attached); extern void linux_disable_event_reporting (pid_t pid); + diff --git a/gdb-btrobust.patch b/gdb-btrobust.patch index 40d406c8e4e4fac84e91b0a7efc25ecc92db0fb5..7c5eafaa392e4e78f460eb49b9ff99d24780c114 100644 --- a/gdb-btrobust.patch +++ b/gdb-btrobust.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-btrobust.patch - -;; Continue backtrace even if a frame filter throws an exception (Phil Muldoon). -;;=push - This should fix the error with glib. An error message will still be printed, but a default backtrace will occur in this case. @@ -14,7 +6,7 @@ printed, but a default backtrace will occur in this case. diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c -@@ -1151,6 +1151,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1139,6 +1139,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, htab_eq_pointer, NULL)); @@ -22,24 +14,25 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c while (true) { gdbpy_ref<> item (PyIter_Next (iterable.get ())); -@@ -1159,8 +1160,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1147,8 +1148,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, { if (PyErr_Occurred ()) { -- throw_quit_or_print_exception (); +- gdbpy_print_stack_or_quit (); - return EXT_LANG_BT_ERROR; + gdbpy_print_stack (); + return count_printed > 0 ? EXT_LANG_BT_ERROR : EXT_LANG_BT_NO_FILTERS; } break; } -@@ -1193,7 +1194,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1181,7 +1182,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, /* Do not exit on error printing a single frame. Print the error and continue with other frames. */ if (success == EXT_LANG_BT_ERROR) -- throw_quit_or_print_exception (); +- gdbpy_print_stack_or_quit (); + gdbpy_print_stack (); + count_printed++; } return success; + diff --git a/gdb-bz1219747-attach-kills.patch b/gdb-bz1219747-attach-kills.patch index 6ae10a22f631c4dacde8283b8b91244186fde15f..6dc27e79066cb97e57f24205c158d987ea4fda98 100644 --- a/gdb-bz1219747-attach-kills.patch +++ b/gdb-bz1219747-attach-kills.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-bz1219747-attach-kills.patch - -;; Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747). -;;=push+jan - http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html Hi, @@ -80,18 +72,18 @@ gdb/testsuite/ChangeLog diff --git a/gdb/main.c b/gdb/main.c --- a/gdb/main.c +++ b/gdb/main.c -@@ -1115,7 +1115,10 @@ captured_main_1 (struct captured_main_args *context) - if (isdigit (pid_or_core_arg[0])) +@@ -1129,7 +1129,10 @@ captured_main_1 (struct captured_main_args *context) { - if (catch_command_errors (attach_command, pid_or_core_arg, -- !batch_flag) == 0) -+ !batch_flag) == 0 + ret = catch_command_errors (attach_command, pid_or_core_arg, + !batch_flag); +- if (ret == 0) ++ if (ret == 0 + /* attach_command could succeed partially and core_file_command + would try to kill it. */ + && !have_inferiors ()) - catch_command_errors (core_file_command, pid_or_core_arg, - !batch_flag); - } + ret = catch_command_errors (core_file_command, + pid_or_core_arg, + !batch_flag); diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c new file mode 100644 --- /dev/null @@ -176,3 +168,4 @@ new file mode 100644 +} + +kill_wait_spawned_process $test_spawn_id + diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch index 8a23b3389765389683022faa909d6f39f5a9248c..7213a4efa65a21141012dfd4504a38b5a902e5f2 100644 --- a/gdb-bz533176-fortran-omp-step.patch +++ b/gdb-bz533176-fortran-omp-step.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-bz533176-fortran-omp-step.patch - -;; Fix stepping with OMP parallel Fortran sections (BZ 533176). -;;=push+jan: It requires some better DWARF annotations. - https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4 I find it a bug in DWARF and gdb behaves correctly according to it. From the @@ -30,7 +22,7 @@ debugging problem of GOMP outside of the scope of this Bug. diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -6695,6 +6695,16 @@ process_event_stop_test (struct execution_control_state *ecs) +@@ -6499,6 +6499,16 @@ process_event_stop_test (struct execution_control_state *ecs) if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL) { @@ -47,7 +39,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c /* We're doing a "next". Normal (forward) execution: set a breakpoint at the -@@ -6728,6 +6738,7 @@ process_event_stop_test (struct execution_control_state *ecs) +@@ -6532,6 +6542,7 @@ process_event_stop_test (struct execution_control_state *ecs) keep_going (ecs); return; @@ -128,3 +120,4 @@ new file mode 100644 + end do + print *, "success" + end + diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch index 0ff3a93e8c845ff0b9bbde33bb00e5c2e5f21617..51a711829c10c45573f556e76007ac8a395d9f59 100644 --- a/gdb-bz541866-rwatch-before-run.patch +++ b/gdb-bz541866-rwatch-before-run.patch @@ -1,16 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-bz541866-rwatch-before-run.patch - -;; Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866). -;; Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866). -;;=push+jan: It should be fixed properly instead. - diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -8807,7 +8807,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, +@@ -8773,7 +8773,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, int enabled, int internal, unsigned flags, int display_canonical) { @@ -19,7 +10,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c if (type == bp_hardware_breakpoint) { -@@ -14356,7 +14356,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, +@@ -14271,7 +14271,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, if (bpt->type == bp_hardware_breakpoint) { @@ -97,26 +88,26 @@ new file mode 100644 diff --git a/gdb/configure.nat b/gdb/configure.nat --- a/gdb/configure.nat +++ b/gdb/configure.nat -@@ -238,6 +238,7 @@ case ${gdb_host} in +@@ -245,6 +245,7 @@ case ${gdb_host} in ;; i386) # Host: Intel 386 running GNU/Linux. + NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux.h" - NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \ - i386-linux-nat.o x86-linux-nat.o linux-btrace.o \ - x86-linux.o x86-linux-dregs.o" -@@ -290,6 +291,7 @@ case ${gdb_host} in + NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ + i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \ + nat/x86-linux.o nat/x86-linux-dregs.o" +@@ -301,6 +302,7 @@ case ${gdb_host} in case ${gdb_host_cpu} in i386) # Host: GNU/Linux x86-64 + NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux64.h" - NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \ - amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-btrace.o \ - x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o" + NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ + amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \ + nat/linux-btrace.o \ diff --git a/gdb/target.h b/gdb/target.h --- a/gdb/target.h +++ b/gdb/target.h -@@ -1953,9 +1953,11 @@ extern struct thread_info *target_thread_handle_to_thread_info +@@ -1971,9 +1971,11 @@ extern struct thread_info *target_thread_handle_to_thread_info one. OTHERTYPE is the number of watchpoints of other types than this one used so far. */ @@ -173,3 +164,4 @@ new file mode 100644 +gdb_test "" "main .* at .*" "start" + +gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*" + diff --git a/gdb-bz568248-oom-is-error.patch b/gdb-bz568248-oom-is-error.patch index f3f61da4c15208ac2f922eda39662d012fb8c42a..9ee832ac17a3908a94d403dd1d58ef4954c0305a 100644 --- a/gdb-bz568248-oom-is-error.patch +++ b/gdb-bz568248-oom-is-error.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-bz568248-oom-is-error.patch - -;; Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248). -;;=push+jan: Inferior objects should be read in parts, then this patch gets obsoleted. - http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html Hi, @@ -53,7 +45,7 @@ gdb/ diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -746,13 +746,11 @@ malloc_failure (long size) +@@ -721,13 +721,11 @@ malloc_failure (long size) { if (size > 0) { @@ -69,3 +61,4 @@ diff --git a/gdb/utils.c b/gdb/utils.c } } + diff --git a/gdb-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch index 87b7817d8d851dff557b64fff9ba3efd8f51ef33..561b3b87d83712393c2a125e072fbc1f36a74a49 100644 --- a/gdb-bz601887-dwarf4-rh-test.patch +++ b/gdb-bz601887-dwarf4-rh-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-bz601887-dwarf4-rh-test.patch - -;; Backport DWARF-4 support (BZ 601887, Tom Tromey). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S new file mode 100644 --- /dev/null @@ -252,3 +244,4 @@ new file mode 100644 +clean_restart $executable + +gdb_test "ptype main" {type = int \(void\)} + diff --git a/gdb-bz634108-solib_address.patch b/gdb-bz634108-solib_address.patch index abbc407e9cf7de29971857d7f6f4421176456660..7292be43e12a478ea9ecf41fdc8855e4ff8b757e 100644 --- a/gdb-bz634108-solib_address.patch +++ b/gdb-bz634108-solib_address.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-bz634108-solib_address.patch - -;; Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108). -;;=fedoratest - Fix gdb.solib_address (fix by Phil Muldoon). s/solib_address/solib_name/ during upstreaming. @@ -39,3 +31,4 @@ new file mode 100644 +if { [skip_python_tests] } { continue } + +gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists" + diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch index 60bc5cc80c5c5c87002725c4e2a7d62246a19dfa..816d18e05b90cb3cda5143959f31193c9d83d122 100644 --- a/gdb-ccache-workaround.patch +++ b/gdb-ccache-workaround.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-ccache-workaround.patch - -;; Workaround ccache making lineno non-zero for command-line definitions. -;;=fedoratest: ccache is rarely used and it is even fixed now. - diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp --- a/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp @@ -24,3 +16,4 @@ diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.e # Generate the intermediate object file. This is required by Darwin to # have access to the .debug_macinfo section. if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ + diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch index 2defc8df0dfeb3c9315de23432428dc3b32d5d05..ed2ee2e7a3342f9dda85b5ededa48a9c02f64808 100644 --- a/gdb-container-rh-pkg.patch +++ b/gdb-container-rh-pkg.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-container-rh-pkg.patch - -;; Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114). -;;=fedora - diff --git a/gdb/remote.c b/gdb/remote.c --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -13909,7 +13909,17 @@ remote_target::pid_to_exec_file (int pid) +@@ -13966,7 +13966,17 @@ remote_target::pid_to_exec_file (int pid) char *annex = NULL; if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) @@ -28,3 +20,4 @@ diff --git a/gdb/remote.c b/gdb/remote.c inf = find_inferior_pid (pid); if (inf == NULL) + diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index b0a7311af47e9593cff79af052d7e53be570870e..6e5e0533210fec72cca2510ec431f160a9bfdd46 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-core-open-vdso-warning.patch - -;; Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. -;; Fix regression of undisplayed missing shared libraries caused by a fix for. -;;=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*> - http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. @@ -56,3 +47,4 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so +gdb_run_cmd +gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \ + "warning for missing libraries" + diff --git a/gdb-dts-rhel6-python-compat.patch b/gdb-dts-rhel6-python-compat.patch index 697c6f08c6bdef3e3bd78fca42b6fd3a73d6ddf1..0d3e083a18719053425a895aa3a5e0237732f2dd 100644 --- a/gdb-dts-rhel6-python-compat.patch +++ b/gdb-dts-rhel6-python-compat.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-dts-rhel6-python-compat.patch - -;; [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon). -;;=fedora - https://bugzilla.redhat.com/show_bug.cgi?id=1020004 diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in @@ -313,3 +305,4 @@ new file mode 100644 + pair[1].describe (sys.stdout, full) + +FilteringBacktrace() + diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index 5037e293732468024550582ec045a586ffcbd78e..db2803b78a2f4c448981816227a01af7b7d291a4 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -1,18 +1,10 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-fedora-libncursesw.patch - -;; Force libncursesw over libncurses to match the includes (RH BZ 1270534). -;;=push+jan - Fedora: Force libncursesw over libncurses to match the includes. https://bugzilla.redhat.com/show_bug.cgi?id=1270534 diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9393,6 +9393,7 @@ if test x"$prefer_curses" = xyes; then +@@ -9418,6 +9418,7 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -20,7 +12,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 $as_echo_n "checking for library containing waddstr... " >&6; } if ${ac_cv_search_waddstr+:} false; then : -@@ -9417,7 +9418,7 @@ return waddstr (); +@@ -9442,7 +9443,7 @@ return waddstr (); return 0; } _ACEOF @@ -29,7 +21,7 @@ diff --git a/gdb/configure b/gdb/configure if test -z "$ac_lib"; then ac_res="none required" else -@@ -9491,6 +9492,7 @@ case $host_os in +@@ -9516,6 +9517,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -37,19 +29,19 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 $as_echo_n "checking for library containing tgetent... " >&6; } if ${ac_cv_search_tgetent+:} false; then : -@@ -9515,7 +9517,7 @@ return tgetent (); +@@ -9540,7 +9542,7 @@ return tgetent (); return 0; } _ACEOF --for ac_lib in '' termcap tinfo curses ncursesw ncurses; do -+for ac_lib in '' termcap tinfo ncursesw; do +-for ac_lib in '' termcap tinfow tinfo curses ncursesw ncurses; do ++for ac_lib in '' ncursesw; do if test -z "$ac_lib"; then ac_res="none required" else diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -766,7 +766,8 @@ if test x"$prefer_curses" = xyes; then +@@ -743,7 +743,8 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -59,13 +51,14 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_waddstr" != no; then curses_found=yes -@@ -808,7 +809,8 @@ case $host_os in +@@ -785,7 +786,8 @@ case $host_os in esac # These are the libraries checked by Readline. --AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncursesw ncurses]) +-AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses]) +# Fedora: Force libncursesw over libncurses to match the includes. -+AC_SEARCH_LIBS(tgetent, [termcap tinfo ncursesw]) ++AC_SEARCH_LIBS(tgetent, [ncursesw]) if test "$ac_cv_search_tgetent" = no; then CONFIG_OBS="$CONFIG_OBS stub-termcap.o" + diff --git a/gdb-follow-child-stale-parent.patch b/gdb-follow-child-stale-parent.patch index ab3a76507d5283ad179c052480d32fe287526ab8..e5b10103317f88c370a610779e01599df0258cdd 100644 --- a/gdb-follow-child-stale-parent.patch +++ b/gdb-follow-child-stale-parent.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-follow-child-stale-parent.patch - -;; Fix regression by python on ia64 due to stale current frame. -;;=push+jan - Problem occurs with python and its get_current_arch () as it selects selected_frame and current_frame while still inferior_ptid is valid for the original parent. But since this place it is already attached and later @@ -24,7 +16,7 @@ unwinders try to access it, breaking: diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -752,6 +752,9 @@ follow_fork (void) +@@ -754,6 +754,9 @@ follow_fork (void) } else { @@ -34,3 +26,4 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c /* This pending follow fork event is now handled, one way or another. The previous selected thread may be gone from the lists by now, but if it is still around, need + diff --git a/gdb-fortran-frame-string.patch b/gdb-fortran-frame-string.patch index a7b7b588ccfa573dfd97bab2835703f2c8e28fd1..17b2a121274b2df4b8d5cf28fdfc2b4ebd87efb8 100644 --- a/gdb-fortran-frame-string.patch +++ b/gdb-fortran-frame-string.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-fortran-frame-string.patch - -;; Display Fortran strings in backtraces. -;;=fedoratest - http://sourceware.org/ml/gdb-patches/2014-07/msg00709.html Hi, @@ -102,3 +94,4 @@ new file mode 100644 + program main + call f ('foo') + end + diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch index 85c9621a169785e62cf7752ff7de84d10ac236a9..005ee119e64abc7dd0ad2ea66e2a74f7857a94b2 100644 --- a/gdb-glibc-strstr-workaround.patch +++ b/gdb-glibc-strstr-workaround.patch @@ -1,46 +1,8 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-glibc-strstr-workaround.patch - -;; Workaround PR libc/14166 for inferior calls of strstr. -;;=fedora: Compatibility with RHELs (unchecked which ones). - -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -21286,6 +21286,26 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, - /* Cache this symbol's name and the name's demangled form (if any). */ - SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack); - linkagename = dwarf2_physname (name, die, cu); -+ -+ /* Workaround for: -+ * invalid IFUNC DW_AT_linkage_name: memmove strstr time -+ * http://sourceware.org/bugzilla/show_bug.cgi?id=14166 */ -+ if (strcmp (linkagename, "strstr") == 0 -+ && strstr (objfile_name (objfile), "/libc") != NULL) -+ { -+ struct objfile *objfile_msym; -+ struct bound_minimal_symbol bmsym; -+ -+ if (objfile->separate_debug_objfile_backlink) -+ objfile_msym = objfile->separate_debug_objfile_backlink; -+ else -+ objfile_msym = objfile; -+ bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym); -+ if (bmsym.minsym != NULL -+ && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc) -+ linkagename = "__strstr"; -+ } -+ - SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile); - - /* Fortran does not have mangling standard and the mangling does differ diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -@@ -0,0 +1,108 @@ +@@ -0,0 +1,115 @@ +# Copyright (C) 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -103,6 +65,10 @@ new file mode 100644 + set addr $expect_out(1,string) + pass "$test (fixed glibc)" + } ++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr_ifunc>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (fixed glibc)" ++ } + -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { + untested "$test (gnu-ifunc not in use by glibc)" + return 0 @@ -142,6 +108,9 @@ new file mode 100644 + -re " = {} $addr <__libc_strstr>\r\n$gdb_prompt $" { + pass "$test (fixed glibc)" + } ++ -re " = {} $addr <__libc_strstr_ifunc>\r\n$gdb_prompt $" { ++ pass "$test (fixed glibc)" ++ } + -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { + fail $test + } @@ -149,3 +118,4 @@ new file mode 100644 + +gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} +gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"} + diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch index a20da466409a440b8bba85d07ebe78b091da5d7a..c947062f65bf4e8f38e930bf50ce72b3e01755ed 100644 --- a/gdb-gnat-dwarf-crash-3of3.patch +++ b/gdb-gnat-dwarf-crash-3of3.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-gnat-dwarf-crash-3of3.patch - -;; Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211). -;;=push+jan - http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html --6TrnltStXW4iwmi0 @@ -42,7 +34,7 @@ gdb/ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -10499,6 +10499,13 @@ private: +@@ -10588,6 +10588,13 @@ private: static void process_die (struct die_info *die, struct dwarf2_cu *cu) { @@ -59,7 +51,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -607,6 +607,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ +@@ -609,6 +609,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ target_pid_to_str (process_ptid)); } @@ -76,7 +68,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -191,6 +191,12 @@ struct linux_nat_target *linux_target; +@@ -192,6 +192,12 @@ struct linux_nat_target *linux_target; /* Does the current host support PTRACE_GETREGSET? */ enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN; @@ -86,10 +78,10 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c + +#endif + - /* The saved to_close method, inherited from inf-ptrace.c. - Called by our to_close. */ - static void (*super_close) (struct target_ops *); -@@ -1027,6 +1033,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled) + static unsigned int debug_linux_nat; + static void + show_debug_linux_nat (struct ui_file *file, int from_tty, +@@ -1037,6 +1043,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled) if (debug_linux_nat) fprintf_unfiltered (gdb_stdlog, "LNPAW: Attaching to a stopped process\n"); @@ -99,7 +91,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c /* The process is definitely stopped. It is in a job control stop, unless the kernel predates the TASK_STOPPED / -@@ -1359,6 +1368,25 @@ get_detach_signal (struct lwp_info *lp) +@@ -1369,6 +1378,25 @@ get_detach_signal (struct lwp_info *lp) return gdb_signal_to_host (signo); } @@ -125,7 +117,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c return 0; } -@@ -1507,6 +1535,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) +@@ -1517,6 +1545,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) detach_one_lwp (main_lwp, &signo); detach_success (inf); @@ -136,7 +128,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c } } -@@ -1765,6 +1797,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) +@@ -1775,6 +1807,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) return; } @@ -153,7 +145,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c if (resume_many) iterate_over_lwps (ptid, linux_nat_resume_callback, lp); -@@ -3761,6 +3803,10 @@ linux_nat_target::mourn_inferior () +@@ -3763,6 +3805,10 @@ linux_nat_target::mourn_inferior () /* Let the arch-specific native code know this process is gone. */ linux_target->low_forget_process (pid); @@ -234,3 +226,4 @@ diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.th set test "$threadtype: attach2 to stopped, after setting file" gdb_test_multiple "attach $testpid" "$test" { + diff --git a/gdb-jit-reader-multilib.patch b/gdb-jit-reader-multilib.patch index 2aa41c22f60056fd16ce590cdcd3ff1bed2490ed..5b55ac86905969a7e9f1182434bb2861cf3620f5 100644 --- a/gdb-jit-reader-multilib.patch +++ b/gdb-jit-reader-multilib.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-jit-reader-multilib.patch - -;; Fix jit-reader.h for multi-lib. -;;=push+jan - diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9680,10 +9680,12 @@ _ACEOF +@@ -9705,10 +9705,12 @@ _ACEOF @@ -28,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -843,10 +843,12 @@ AC_CHECK_SIZEOF(unsigned long long) +@@ -820,10 +820,12 @@ AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned __int128) @@ -44,3 +36,4 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then TARGET_PTR="unsigned __int128" else + diff --git a/gdb-libexec-add-index.patch b/gdb-libexec-add-index.patch index 7856866c5ec164078d1e627f85016d5def997f3f..a527706a75e2fcbd15eeff230630504245258f25 100644 --- a/gdb-libexec-add-index.patch +++ b/gdb-libexec-add-index.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-libexec-add-index.patch - -;; Fix gdb-headless /usr/bin/ executables (BZ 1390251). -;;=fedora - diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh --- a/gdb/contrib/gdb-add-index.sh +++ b/gdb/contrib/gdb-add-index.sh @@ -21,3 +13,4 @@ diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh myname="${0##*/}" dwarf5="" + diff --git a/gdb-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch index 313421dc6f9b9877b7e3cb634cab2182172d81e8..5f2ed2fc1338afae20368e8a1d78f00ef0ead64d 100644 --- a/gdb-lineno-makeup-test.patch +++ b/gdb-lineno-makeup-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-lineno-makeup-test.patch - -;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz. -;;=fedoratest - New testcase for: https://bugzilla.redhat.com/show_bug.cgi?id=466222 (for the first / customer recommended fix) @@ -163,3 +155,4 @@ new file mode 100644 + fail $test + } +} + diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch index c7533f7c224af64a630a2def6d0fd8182260a4f6..5a2d3de281718ee294d0a33fc28e7120ce44b074 100644 --- a/gdb-linux_perf-bundle.patch +++ b/gdb-linux_perf-bundle.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-linux_perf-bundle.patch - -;; [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). -;;=fedora - diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -12059,7 +12059,7 @@ else +@@ -12137,7 +12137,7 @@ else #include #ifndef PERF_ATTR_SIZE_VER5 @@ -21,7 +13,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -1477,7 +1477,7 @@ else +@@ -1500,7 +1500,7 @@ else AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include #ifndef PERF_ATTR_SIZE_VER5 @@ -234,3 +226,4 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h struct target_ops; #if HAVE_LINUX_PERF_EVENT_H + diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch index f41e4fbdf4d09df35ef7eb11a50d835d08f48f73..6f8e69b570667e5442c1420d1d38131b56c142dd 100644 --- a/gdb-moribund-utrace-workaround.patch +++ b/gdb-moribund-utrace-workaround.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-moribund-utrace-workaround.patch - -;; Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623). -;;=push+jan: Currently it is still not fully safe. - https://bugzilla.redhat.com/show_bug.cgi?id=590623 http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593 @@ -14,7 +6,7 @@ Bug in FSF GDB exploited by the ptrace-on-utrace interaction. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -12016,6 +12016,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode) +@@ -11929,6 +11929,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode) traps we can no longer explain. */ old_loc->events_till_retirement = 3 * (thread_count () + 1); @@ -22,4 +14,5 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c + old_loc->events_till_retirement *= 10; old_loc->owner = NULL; - VEC_safe_push (bp_location_p, moribund_locations, old_loc); + moribund_locations.push_back (old_loc); + diff --git a/gdb-opcodes-clflushopt-test.patch b/gdb-opcodes-clflushopt-test.patch index f95999e9cfcba50d9266d42bef5edece0a076348..d7de1500fb0c3d969410790f9c8f211cafcc188f 100644 --- a/gdb-opcodes-clflushopt-test.patch +++ b/gdb-opcodes-clflushopt-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-opcodes-clflushopt-test.patch - -;; Test clflushopt instruction decode (for RH BZ 1262471). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S new file mode 100644 --- /dev/null @@ -60,3 +52,4 @@ new file mode 100644 +} + +gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt" + diff --git a/gdb-physname-pr11734-test.patch b/gdb-physname-pr11734-test.patch index e862eea84dd42152bda3d37abcce049a6cc41a70..c5c258a0353179e6db051b3320889419fed8b459 100644 --- a/gdb-physname-pr11734-test.patch +++ b/gdb-physname-pr11734-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-physname-pr11734-test.patch - -;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). -;;=fedoratest - http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc @@ -232,3 +224,4 @@ new file mode 100644 + void foo (char *); +}; + + diff --git a/gdb-physname-pr12273-test.patch b/gdb-physname-pr12273-test.patch index 6c943ad89e9c451bc88dd577b94cc8c6f3af2fdd..82b3f0996c97a70e0c0952b196cca53a3702f40d 100644 --- a/gdb-physname-pr12273-test.patch +++ b/gdb-physname-pr12273-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-physname-pr12273-test.patch - -;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). -;;=fedoratest - http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc @@ -101,3 +93,4 @@ new file mode 100644 +} + +gdb_exit + diff --git a/gdb-ppc-power7-test.patch b/gdb-ppc-power7-test.patch index 3ca7667ac0652d8ac5ba32e981a78ea314b7d2b9..260d5104f89d5f3a0fa134568c4a3e78bc6096f9 100644 --- a/gdb-ppc-power7-test.patch +++ b/gdb-ppc-power7-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-ppc-power7-test.patch - -;; Test power7 ppc disassembly. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.arch/powerpc-power7rh.exp b/gdb/testsuite/gdb.arch/powerpc-power7rh.exp new file mode 100644 --- /dev/null @@ -301,3 +293,4 @@ new file mode 100644 + .long 0xedc07834 /* 194: frsqrtes f14,f15 */ + .long 0xedc07835 /* 198: frsqrtes. f14,f15 */ + .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */ + diff --git a/gdb-python-gil.patch b/gdb-python-gil.patch deleted file mode 100644 index 9ff2e45c7ca5bb400aec1abd413dd0f2dc5474e8..0000000000000000000000000000000000000000 --- a/gdb-python-gil.patch +++ /dev/null @@ -1,241 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-python-gil.patch - -;; Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957). -;;=push - -diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi ---- a/gdb/doc/python.texi -+++ b/gdb/doc/python.texi -@@ -232,6 +232,14 @@ returned as a string. The default is @code{False}, in which case the - return value is @code{None}. If @var{to_string} is @code{True}, the - @value{GDBN} virtual terminal will be temporarily set to unlimited width - and height, and its pagination will be disabled; @pxref{Screen Size}. -+ -+The @var{release_gil} flag specifies whether @value{GDBN} ought to -+release the Python GIL before executing the command. This is useful -+in multi-threaded Python programs where by default the Python -+interpreter will acquire the GIL and lock other threads from -+executing. After the command has completed executing in @value{GDBN} -+the Python GIL is reacquired. This flag must be a boolean value. If -+omitted, it defaults to @code{False}. - @end defun - - @findex gdb.breakpoints -diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h ---- a/gdb/python/python-internal.h -+++ b/gdb/python/python-internal.h -@@ -148,6 +148,8 @@ typedef int Py_ssize_t; - #define PyGILState_Release(ARG) ((void)(ARG)) - #define PyEval_InitThreads() - #define PyThreadState_Swap(ARG) ((void)(ARG)) -+#define PyEval_SaveThread() ((void)(ARG)) -+#define PyEval_RestoreThread(ARG) ((void)(ARG)) - #define PyEval_ReleaseLock() - #endif - -diff --git a/gdb/python/python.c b/gdb/python/python.c ---- a/gdb/python/python.c -+++ b/gdb/python/python.c -@@ -556,12 +556,16 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) - { - const char *arg; - PyObject *from_tty_obj = NULL, *to_string_obj = NULL; -- int from_tty, to_string; -- static const char *keywords[] = { "command", "from_tty", "to_string", NULL }; -+ int from_tty, to_string, release_gil; -+ static const char *keywords[] = {"command", "from_tty", "to_string", "release_gil", NULL }; -+ PyObject *release_gil_obj = NULL; -+ /* Initialize it just to avoid a GCC false warning. */ -+ PyThreadState *state = NULL; - -- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg, -+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!O!", keywords, &arg, - &PyBool_Type, &from_tty_obj, -- &PyBool_Type, &to_string_obj)) -+ &PyBool_Type, &to_string_obj, -+ &PyBool_Type, &release_gil_obj)) - return NULL; - - from_tty = 0; -@@ -582,6 +586,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) - to_string = cmp; - } - -+ release_gil = 0; -+ if (release_gil_obj) -+ { -+ int cmp = PyObject_IsTrue (release_gil_obj); -+ if (cmp < 0) -+ return NULL; -+ release_gil = cmp; -+ } -+ - std::string to_string_res; - - TRY -@@ -602,6 +615,13 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) - - counted_command_line lines = read_command_lines_1 (reader, 1, nullptr); - -+ /* In the case of long running GDB commands, allow the user to -+ release the Python GIL acquired by Python. Restore the GIL -+ after the command has completed before handing back to -+ Python. */ -+ if (release_gil) -+ state = PyEval_SaveThread(); -+ - scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0); - - scoped_restore save_uiout = make_scoped_restore (¤t_uiout); -@@ -617,10 +637,22 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) - from_tty); - else - execute_control_commands (lines.get (), from_tty); -+ -+ /* Reacquire the GIL if it was released earlier. */ -+ if (release_gil) -+ PyEval_RestoreThread (state); - } - CATCH (except, RETURN_MASK_ALL) - { -- GDB_PY_HANDLE_EXCEPTION (except); -+ if (except.reason < 0) -+ { -+ /* Reacquire the GIL if it was released earlier. */ -+ if (release_gil) -+ PyEval_RestoreThread (state); -+ -+ gdbpy_convert_exception (except); -+ return NULL; -+ } - } - END_CATCH - -diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.c b/gdb/testsuite/gdb.python/py-gil-mthread.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-gil-mthread.c -@@ -0,0 +1,13 @@ -+#include -+#include -+ -+int -+main (void) -+{ -+ int i; -+ for (i = 0; i < 10; i++) -+ { -+ sleep (1); /* break-here */ -+ printf ("Sleeping %d\n", i); -+ } -+} -diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.exp b/gdb/testsuite/gdb.python/py-gil-mthread.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-gil-mthread.exp -@@ -0,0 +1,69 @@ -+# Copyright (C) 2014 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 . -+ -+standard_testfile .c .py -+set executable $testfile -+ -+if { [prepare_for_testing $testfile.exp $executable $srcfile] } { -+ return -1 -+} -+ -+# Skip all tests if Python scripting is not enabled. -+if { [skip_python_tests] } { continue } -+ -+if ![runto_main] { -+ return -1 -+} -+ -+gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] temporary -+gdb_continue_to_breakpoint "break-here" ".* break-here .*" -+ -+set test "response" -+set timeout 60 -+set sleeping_last -1 -+set hello_last 0 -+set minimal 5 -+gdb_test_multiple "python exec (open ('$srcdir/$subdir/$srcfile2').read ())" $test { -+ -re "Error: unable to start thread\r\n" { -+ fail $test -+ # Not $gdb_prompt-synced! -+ } -+ -re "Sleeping (\[0-9\]+)\r\n" { -+ set n $expect_out(1,string) -+ if { $sleeping_last + 1 != $n } { -+ fail $test -+ } else { -+ set sleeping_last $n -+ if { $sleeping_last >= $minimal && $hello_last >= $minimal } { -+ pass $test -+ } else { -+ exp_continue -+ } -+ } -+ } -+ -re "Hello \\( (\[0-9\]+) \\)\r\n" { -+ set n $expect_out(1,string) -+ if { $hello_last + 1 != $n } { -+ fail $test -+ } else { -+ set hello_last $n -+ if { $sleeping_last >= $minimal && $hello_last >= $minimal } { -+ pass $test -+ } else { -+ exp_continue -+ } -+ } -+ } -+} -diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.py b/gdb/testsuite/gdb.python/py-gil-mthread.py -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-gil-mthread.py -@@ -0,0 +1,28 @@ -+try: -+ import thread -+except: -+ import _thread -+import time -+import gdb -+ -+# Define a function for the thread -+def print_thread_hello(): -+ count = 0 -+ while count < 10: -+ time.sleep(1) -+ count += 1 -+ print ("Hello ( %d )" % count) -+ -+# Create a threads a continue -+try: -+ thread.start_new_thread (print_thread_hello, ()) -+ gdb.execute ("continue", release_gil=True) -+except: -+ try: -+ _thread.start_new_thread (print_thread_hello, ()) -+ gdb.execute ("continue", release_gil=True) -+ except: -+ print ("Error: unable to start thread") -+ -+while 1: -+ pass diff --git a/gdb-readline62-ask-more-rh.patch b/gdb-readline62-ask-more-rh.patch index a1f1171dcde59f159e8c045e3fe4bb6991ec0041..c7d4165d14df9182c480479b34686b3fa57306f9 100644 --- a/gdb-readline62-ask-more-rh.patch +++ b/gdb-readline62-ask-more-rh.patch @@ -1,15 +1,7 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-readline62-ask-more-rh.patch - -;; Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131). -;;=fedora - diff --git a/gdb/event-top.c b/gdb/event-top.c --- a/gdb/event-top.c +++ b/gdb/event-top.c -@@ -1183,6 +1183,13 @@ gdb_setup_readline (int editing) +@@ -1179,6 +1179,13 @@ gdb_setup_readline (int editing) { struct ui *ui = current_ui; @@ -23,3 +15,4 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* This function is a noop for the sync case. The assumption is that the sync setup is ALL done in gdb_init, and we would only mess it up here. The sync stuff should really go away over + diff --git a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch index 20e5f7555428dccccb6a64cf82bc5e42d918f7ef..7d87a56a3bed585536b7045b05d6fd9f89601a01 100644 --- a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +++ b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch - -;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c new file mode 100644 --- /dev/null @@ -81,3 +73,4 @@ new file mode 100644 + ".*warning: Unable to find dynamic linker breakpoint function.*" \ + "set solib-absolute-prefix" +gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall" + diff --git a/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch index 4d05ba56998ff2c1b326b9255294852cbd83f8b5..2761f72111c8b6a9b9e353888723cab557207d3f 100644 --- a/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +++ b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch - -;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614) -;;=fedoratest - Original message by Tom Tromey: @@ -168,3 +160,4 @@ new file mode 100644 + print "Hello, World!" + +HelloWorld () + diff --git a/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch index d92bfc3bfe8a09be812f1f4df8c3a7f98e4b9708..49b870796f5d8bbebf46fd2bb6da66138fc5ad61 100644 --- a/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +++ b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch - -;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan -;; Kratochvil, RH BZ 1084404). -;;=fedoratest - These testcases have been created by compiling glibc-2.17-78 on RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file present at $builddir/misc/select.o. @@ -233,3 +224,4 @@ new file mode 100644 +L````(`````$````%````````````````````/`````$````%`````````$@` +` +end + diff --git a/gdb-rhbz1149205-catch-syscall-after-fork-test.patch b/gdb-rhbz1149205-catch-syscall-after-fork-test.patch index 63c40515430ebb8d99cfac30ef7de7d6e2905c27..0bba7e09bb5a9709c5654fa8059a64445187aa88 100644 --- a/gdb-rhbz1149205-catch-syscall-after-fork-test.patch +++ b/gdb-rhbz1149205-catch-syscall-after-fork-test.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1149205-catch-syscall-after-fork-test.patch - -;; Fix '`catch syscall' doesn't work for parent after `fork' is called' -;; (Philippe Waroquiers, RH BZ 1149205). -;;=fedoratest - URL: Message-ID: <1368136582.30058.7.camel@soleil> @@ -121,3 +112,4 @@ new file mode 100644 +gdb_test "continue" \ + "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \ + "continue from catch syscall after fork" + diff --git a/gdb-rhbz1156192-recursive-dlopen-test.patch b/gdb-rhbz1156192-recursive-dlopen-test.patch index 6ca0c7bc2830d006ada9b28e7411357571d37ec8..ca00141152bad8f5647ac28bd234665d7958d4d3 100644 --- a/gdb-rhbz1156192-recursive-dlopen-test.patch +++ b/gdb-rhbz1156192-recursive-dlopen-test.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1156192-recursive-dlopen-test.patch - -;; Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to -;; crash.' (RH BZ 1156192). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c new file mode 100644 --- /dev/null @@ -348,3 +339,4 @@ new file mode 100644 +} + +test_stop_on_solib_events + diff --git a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch index 21a1a082d58f6cba0f96c6dc18e020fcd7ff5eb9..5e7caef332cc136a7f2e7ea33d3a020f40b65635 100644 --- a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +++ b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch @@ -1,13 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch - -;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug -;; description: 'C++ (and objc): Internal error on unqualified name -;; re-set', PR 11657] (RH BZ 1186476). -;;=fedoratest - Comments from Sergio Durigan Junior: The "proper" fix for this whole problem would be to backport the @@ -133,3 +123,4 @@ new file mode 100644 +gdb_test "run" + +gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*" + diff --git a/gdb-rhbz1187581-power8-regs-1of7.patch b/gdb-rhbz1187581-power8-regs-1of7.patch deleted file mode 100644 index 29bd7985d01bc3321a58d3fb728e9a463e0791b2..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-1of7.patch +++ /dev/null @@ -1,65 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:09:48 +0200 -Subject: gdb-rhbz1187581-power8-regs-1of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 05abfc39c719e740530000059bb963ad33462479 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Fix indentation in remote_target::download_tracepoint - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Fix indentation - in for block. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12912,24 +12912,24 @@ remote_target::download_tracepoint (struct bp_location *loc) - error (_("Error on target while setting tracepoints.")); - } - -- for (auto action_it = stepping_actions.begin (); -- action_it != stepping_actions.end (); action_it++) -- { -- QUIT; /* Allow user to bail out with ^C. */ -- -- bool is_first = action_it == stepping_actions.begin (); -- bool has_more = action_it != stepping_actions.end (); -- -- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", -- b->number, addrbuf, /* address */ -- is_first ? "S" : "", -- action_it->c_str (), -- has_more ? "-" : ""); -- putpkt (buf); -- remote_get_noisy_reply (); -- if (strcmp (rs->buf, "OK")) -- error (_("Error on target while setting tracepoints.")); -- } -+ for (auto action_it = stepping_actions.begin (); -+ action_it != stepping_actions.end (); action_it++) -+ { -+ QUIT; /* Allow user to bail out with ^C. */ -+ -+ bool is_first = action_it == stepping_actions.begin (); -+ bool has_more = action_it != stepping_actions.end (); -+ -+ xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", -+ b->number, addrbuf, /* address */ -+ is_first ? "S" : "", -+ action_it->c_str (), -+ has_more ? "-" : ""); -+ putpkt (buf); -+ remote_get_noisy_reply (); -+ if (strcmp (rs->buf, "OK")) -+ error (_("Error on target while setting tracepoints.")); -+ } - - if (packet_support (PACKET_TracepointSource) == PACKET_ENABLE) - { diff --git a/gdb-rhbz1187581-power8-regs-2of7.patch b/gdb-rhbz1187581-power8-regs-2of7.patch deleted file mode 100644 index b0d42cd7fbfa7b85ea777bcbd3fc0af98d24dc63..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-2of7.patch +++ /dev/null @@ -1,45 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:10:46 +0200 -Subject: gdb-rhbz1187581-power8-regs-2of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit aa6f3694ce867884e43d1c0406c64df08ea24bd3 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Remove trailing '-' from the last QTDP action packet - - The has_more predicate in remote_target::download_tracepoint always - evaluates to true, so the last action packet will be sent with a - trailing '-'. This patch changes the predicate to remove the last - trailing '-'. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Fix the has_more - predicate in the QTDP action list iteration. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12899,7 +12899,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - { - QUIT; /* Allow user to bail out with ^C. */ - -- bool has_more = (action_it != tdp_actions.end () -+ bool has_more = ((action_it + 1) != tdp_actions.end () - || !stepping_actions.empty ()); - - xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c", -@@ -12918,7 +12918,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - QUIT; /* Allow user to bail out with ^C. */ - - bool is_first = action_it == stepping_actions.begin (); -- bool has_more = action_it != stepping_actions.end (); -+ bool has_more = (action_it + 1) != stepping_actions.end (); - - xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", - b->number, addrbuf, /* address */ diff --git a/gdb-rhbz1187581-power8-regs-3of7.patch b/gdb-rhbz1187581-power8-regs-3of7.patch deleted file mode 100644 index 5546f2b963297c9eb8937ea10dbbd2c789c4dcc7..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-3of7.patch +++ /dev/null @@ -1,258 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:11:09 +0200 -Subject: gdb-rhbz1187581-power8-regs-3of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 3df3a985a475db004706d64f83d9085f99053611 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Use get_remote_packet_size in download_tracepoint - - This patch changes the remote target to use the remote packet size to - build QTDP packets, and to check if there is enough room for the - packet. - - I changed the function to raise an error if the packet is too small, - instead of aborting gdb (through xsnprintf). It isn't clear if gdb - will be in a consistent state with respect to the stub after this, - since it's possible that some packets will be sent but not others, and - there could be an incomplete tracepoint on the stub. - - The char array used to build the packets is changed to a - gdb::char_vector and sized with the result from - get_remote_packet_size. - - When checking if the buffer is large enough to hold the tracepoint - condition agent expression, the length of the expression is multiplied - by two, since it is encoded with two hex digits per expression - byte. For simplicity, I assume that the result won't overflow, which - can happen for very long condition expressions. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Remove BUF_SIZE. - Replace array buf with gdb::char_vector buf, of size - get_remote_packet_size (). Replace references to buf and - BUF_SIZE to buf.data () and buf.size (). Replace strcpy, strcat - and xsnprintf with snprintf. Raise errors if the buffer is too - small. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12799,26 +12799,35 @@ remote_target::remote_download_command_source (int num, ULONGEST addr, - void - remote_target::download_tracepoint (struct bp_location *loc) - { --#define BUF_SIZE 2048 -- - CORE_ADDR tpaddr; - char addrbuf[40]; -- char buf[BUF_SIZE]; - std::vector tdp_actions; - std::vector stepping_actions; - char *pkt; - struct breakpoint *b = loc->owner; - struct tracepoint *t = (struct tracepoint *) b; - struct remote_state *rs = get_remote_state (); -+ int ret; -+ char *err_msg = _("Tracepoint packet too large for target."); -+ size_t size_left; -+ -+ /* We use a buffer other than rs->buf because we'll build strings -+ across multiple statements, and other statements in between could -+ modify rs->buf. */ -+ gdb::char_vector buf (get_remote_packet_size ()); - - encode_actions_rsp (loc, &tdp_actions, &stepping_actions); - - tpaddr = loc->address; - sprintf_vma (addrbuf, tpaddr); -- xsnprintf (buf, BUF_SIZE, "QTDP:%x:%s:%c:%lx:%x", b->number, -- addrbuf, /* address */ -- (b->enable_state == bp_enabled ? 'E' : 'D'), -- t->step_count, t->pass_count); -+ ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x", -+ b->number, addrbuf, /* address */ -+ (b->enable_state == bp_enabled ? 'E' : 'D'), -+ t->step_count, t->pass_count); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ - /* Fast tracepoints are mostly handled by the target, but we can - tell the target how big of an instruction block should be moved - around. */ -@@ -12830,8 +12839,15 @@ remote_target::download_tracepoint (struct bp_location *loc) - { - if (gdbarch_fast_tracepoint_valid_at (loc->gdbarch, tpaddr, - NULL)) -- xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x", -- gdb_insn_length (loc->gdbarch, tpaddr)); -+ { -+ size_left = buf.size () - strlen (buf.data ()); -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, ":F%x", -+ gdb_insn_length (loc->gdbarch, tpaddr)); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ } - else - /* If it passed validation at definition but fails now, - something is very wrong. */ -@@ -12855,7 +12871,14 @@ remote_target::download_tracepoint (struct bp_location *loc) - struct static_tracepoint_marker marker; - - if (target_static_tracepoint_marker_at (tpaddr, &marker)) -- strcat (buf, ":S"); -+ { -+ size_left = buf.size () - strlen (buf.data ()); -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, ":S"); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ } - else - error (_("Static tracepoint not valid during download")); - } -@@ -12873,10 +12896,26 @@ remote_target::download_tracepoint (struct bp_location *loc) - capabilities at definition time. */ - if (remote_supports_cond_tracepoints ()) - { -- agent_expr_up aexpr = gen_eval_for_expr (tpaddr, loc->cond.get ()); -- xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":X%x,", -- aexpr->len); -- pkt = buf + strlen (buf); -+ agent_expr_up aexpr = gen_eval_for_expr (tpaddr, -+ loc->cond.get ()); -+ -+ size_left = buf.size () - strlen (buf.data ()); -+ -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, ":X%x,", aexpr->len); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ -+ size_left = buf.size () - strlen (buf.data ()); -+ -+ /* Two bytes to encode each aexpr byte, plus the terminating -+ null byte. */ -+ if (aexpr->len * 2 + 1 > size_left) -+ error (err_msg); -+ -+ pkt = buf.data () + strlen (buf.data ()); -+ - for (int ndx = 0; ndx < aexpr->len; ++ndx) - pkt = pack_hex_byte (pkt, aexpr->buf[ndx]); - *pkt = '\0'; -@@ -12887,8 +12926,17 @@ remote_target::download_tracepoint (struct bp_location *loc) - } - - if (b->commands || *default_collect) -- strcat (buf, "-"); -- putpkt (buf); -+ { -+ size_left = buf.size () - strlen (buf.data ()); -+ -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, "-"); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ } -+ -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - error (_("Target does not support tracepoints.")); -@@ -12902,11 +12950,15 @@ remote_target::download_tracepoint (struct bp_location *loc) - bool has_more = ((action_it + 1) != tdp_actions.end () - || !stepping_actions.empty ()); - -- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c", -- b->number, addrbuf, /* address */ -- action_it->c_str (), -- has_more ? '-' : 0); -- putpkt (buf); -+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%c", -+ b->number, addrbuf, /* address */ -+ action_it->c_str (), -+ has_more ? '-' : 0); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - error (_("Error on target while setting tracepoints.")); -@@ -12920,12 +12972,16 @@ remote_target::download_tracepoint (struct bp_location *loc) - bool is_first = action_it == stepping_actions.begin (); - bool has_more = (action_it + 1) != stepping_actions.end (); - -- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", -- b->number, addrbuf, /* address */ -- is_first ? "S" : "", -- action_it->c_str (), -- has_more ? "-" : ""); -- putpkt (buf); -+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%s%s", -+ b->number, addrbuf, /* address */ -+ is_first ? "S" : "", -+ action_it->c_str (), -+ has_more ? "-" : ""); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - error (_("Error on target while setting tracepoints.")); -@@ -12935,22 +12991,32 @@ remote_target::download_tracepoint (struct bp_location *loc) - { - if (b->location != NULL) - { -- strcpy (buf, "QTDPsrc:"); -+ ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ - encode_source_string (b->number, loc->address, "at", - event_location_to_string (b->location.get ()), -- buf + strlen (buf), 2048 - strlen (buf)); -- putpkt (buf); -+ buf.data () + strlen (buf.data ()), -+ buf.size () - strlen (buf.data ())); -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - warning (_("Target does not support source download.")); - } - if (b->cond_string) - { -- strcpy (buf, "QTDPsrc:"); -+ ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ - encode_source_string (b->number, loc->address, -- "cond", b->cond_string, buf + strlen (buf), -- 2048 - strlen (buf)); -- putpkt (buf); -+ "cond", b->cond_string, -+ buf.data () + strlen (buf.data ()), -+ buf.size () - strlen (buf.data ())); -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - warning (_("Target does not support source download.")); diff --git a/gdb-rhbz1187581-power8-regs-4of7.patch b/gdb-rhbz1187581-power8-regs-4of7.patch deleted file mode 100644 index 8c553a864f737ff25d5631fefe9397bdefa0e19a..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-4of7.patch +++ /dev/null @@ -1,449 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:17:16 +0200 -Subject: gdb-rhbz1187581-power8-regs-4of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 4277c4b87addb5354cc47b98d7a73e44cfaf22c2 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Use remote register numbers in tracepoint mask - - Currently, tracepoint register masks in the QTDP packets include both - internal and remote register numbers, as well as pseudo-register - numbers. - - This patch changes this so that the mask only includes remote register - numbers. - - Register numbers from agent expressions are already set in the mask - using remote numbers. Other tracepoint actions used internal numbers, - e.g. "collect $regs" or "collect $". To handle pseudoreg - numbers, an empty agent expression is created and ax_reg_mask is - called for this expression and the pseudoreg. This will cause the ax - to set its mask with the corresponding remote raw register - numbers (using ax_regs_mask, which calls - gdbarch_ax_pseudo_register_collect). - - If ax_regs_mask and gdbarch_ax_pseudo_register_collect also generate - more ax bytecode, the ax is also appended to the collection list. It - isn't clear that this was the original intent for - gdbarch_ax_pseudo_register_collect, and none of the arches seem to do - this, but if this changes in the future, it should work. - - The patch also refactors the code used by validate_action line to - validate axs into a function that is now called from every place that - generates axs. Previously, some parts of tracepoint.c that generated - axs didn't check if the ax length was greater than MAX_AGENT_EXPR_LEN. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (class collection_list) : Remove. - : - Declare. - : Add scope parameter. - * tracepoint.c (encode_actions_1): Likewise. - (collection_list::add_register): Rename to ... - (collection_list::add_remote_register): ... this. Update - comment. - (collection_list::add_ax_registers, add_local_register): New - methods. - (collection_list::add_memrange): Add scope parameter. Call - add_local_register instead of add_register. - (finalize_tracepoint_aexpr): New function. - (collection_list::collect_symbol): Update calls to add_memrange. - Call add_local_register instead of add_register. Call - add_ax_registers. Call finalize_tracepoint_aexpr. - (encode_actions_1): Get remote regnos for $reg action. Call - add_remote_register, add_ax_registers, and add_local_register. - Update call to add_memrange. Call finalize_tracepoint_aexpr. - (validate_actionline): Call finalize_tracepoint_aexpr. - -+2018-08-06 Pedro Franco de Carvalho -+ -+ * tracepoint.h (class collection_list) : Remove. -+ : -+ Declare. -+ : Add scope parameter. -+ * tracepoint.c (encode_actions_1): Likewise. -+ (collection_list::add_register): Rename to ... -+ (collection_list::add_remote_register): ... this. Update -+ comment. -+ (collection_list::add_ax_registers, add_local_register): New -+ methods. -+ (collection_list::add_memrange): Add scope parameter. Call -+ add_local_register instead of add_register. -+ (finalize_tracepoint_aexpr): New function. -+ (collection_list::collect_symbol): Update calls to add_memrange. -+ Call add_local_register instead of add_register. Call -+ add_ax_registers. Call finalize_tracepoint_aexpr. -+ (encode_actions_1): Get remote regnos for $reg action. Call -+ add_remote_register, add_ax_registers, and add_local_register. -+ Update call to add_memrange. Call finalize_tracepoint_aexpr. -+ (validate_actionline): Call finalize_tracepoint_aexpr. -+ - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Remove BUF_SIZE. - -diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c ---- a/gdb/tracepoint.c -+++ b/gdb/tracepoint.c -@@ -615,6 +615,19 @@ report_agent_reqs_errors (struct agent_expr *aexpr) - error (_("Expression is too complicated.")); - } - -+/* Call ax_reqs on AEXPR and raise an error if something is wrong. */ -+ -+static void -+finalize_tracepoint_aexpr (struct agent_expr *aexpr) -+{ -+ ax_reqs (aexpr); -+ -+ if (aexpr->len > MAX_AGENT_EXPR_LEN) -+ error (_("Expression is too complicated.")); -+ -+ report_agent_reqs_errors (aexpr); -+} -+ - /* worker function */ - void - validate_actionline (const char *line, struct breakpoint *b) -@@ -699,12 +712,7 @@ validate_actionline (const char *line, struct breakpoint *b) - exp.get (), - trace_string); - -- if (aexpr->len > MAX_AGENT_EXPR_LEN) -- error (_("Expression is too complicated.")); -- -- ax_reqs (aexpr.get ()); -- -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - } - } - while (p && *p++ == ','); -@@ -731,11 +739,7 @@ validate_actionline (const char *line, struct breakpoint *b) - long. */ - agent_expr_up aexpr = gen_eval_for_expr (loc->address, exp.get ()); - -- if (aexpr->len > MAX_AGENT_EXPR_LEN) -- error (_("Expression is too complicated.")); -- -- ax_reqs (aexpr.get ()); -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - } - } - while (p && *p++ == ','); -@@ -811,10 +815,10 @@ memrange_sortmerge (std::vector &memranges) - } - } - --/* Add a register to a collection list. */ -+/* Add remote register number REGNO to the collection list mask. */ - - void --collection_list::add_register (unsigned int regno) -+collection_list::add_remote_register (unsigned int regno) - { - if (info_verbose) - printf_filtered ("collect register %d\n", regno); -@@ -824,12 +828,74 @@ collection_list::add_register (unsigned int regno) - m_regs_mask[regno / 8] |= 1 << (regno % 8); - } - -+/* Add all the registers from the mask in AEXPR to the mask in the -+ collection list. Registers in the AEXPR mask are already remote -+ register numbers. */ -+ -+void -+collection_list::add_ax_registers (struct agent_expr *aexpr) -+{ -+ if (aexpr->reg_mask_len > 0) -+ { -+ for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -+ { -+ QUIT; /* Allow user to bail out with ^C. */ -+ if (aexpr->reg_mask[ndx1] != 0) -+ { -+ /* Assume chars have 8 bits. */ -+ for (int ndx2 = 0; ndx2 < 8; ndx2++) -+ if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -+ /* It's used -- record it. */ -+ add_remote_register (ndx1 * 8 + ndx2); -+ } -+ } -+ } -+} -+ -+/* If REGNO is raw, add its corresponding remote register number to -+ the mask. If REGNO is a pseudo-register, figure out the necessary -+ registers using a temporary agent expression, and add it to the -+ list if it needs more than just a mask. */ -+ -+void -+collection_list::add_local_register (struct gdbarch *gdbarch, -+ unsigned int regno, -+ CORE_ADDR scope) -+{ -+ if (regno < gdbarch_num_regs (gdbarch)) -+ { -+ int remote_regno = gdbarch_remote_register_number (gdbarch, regno); -+ -+ if (remote_regno < 0) -+ error (_("Can't collect register %d"), regno); -+ -+ add_remote_register (remote_regno); -+ } -+ else -+ { -+ agent_expr_up aexpr (new agent_expr (gdbarch, scope)); -+ -+ ax_reg_mask (aexpr.get (), regno); -+ -+ finalize_tracepoint_aexpr (aexpr.get ()); -+ -+ add_ax_registers (aexpr.get ()); -+ -+ /* Usually ax_reg_mask for a pseudo-regiser only sets the -+ corresponding raw registers in the ax mask, but if this isn't -+ the case add the expression that is generated to the -+ collection list. */ -+ if (aexpr->len > 0) -+ add_aexpr (std::move (aexpr)); -+ } -+} -+ - /* Add a memrange to a collection list. */ - - void - collection_list::add_memrange (struct gdbarch *gdbarch, - int type, bfd_signed_vma base, -- ULONGEST len) -+ ULONGEST len, CORE_ADDR scope) - { - if (info_verbose) - printf_filtered ("(%d,%s,%s)\n", type, paddress (gdbarch, base), pulongest (len)); -@@ -840,7 +906,7 @@ collection_list::add_memrange (struct gdbarch *gdbarch, - m_memranges.emplace_back (type, base, base + len); - - if (type != memrange_absolute) /* Better collect the base register! */ -- add_register (type); -+ add_local_register (gdbarch, type, scope); - } - - /* Add a symbol to a collection list. */ -@@ -882,19 +948,19 @@ collection_list::collect_symbol (struct symbol *sym, - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT) - treat_as_expr = 1; - else -- add_memrange (gdbarch, memrange_absolute, offset, len); -+ add_memrange (gdbarch, memrange_absolute, offset, len, scope); - break; - case LOC_REGISTER: - reg = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch); - if (info_verbose) - printf_filtered ("LOC_REG[parm] %s: ", - SYMBOL_PRINT_NAME (sym)); -- add_register (reg); -+ add_local_register (gdbarch, reg, scope); - /* Check for doubles stored in two registers. */ - /* FIXME: how about larger types stored in 3 or more regs? */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT && - len > register_size (gdbarch, reg)) -- add_register (reg + 1); -+ add_local_register (gdbarch, reg + 1, scope); - break; - case LOC_REF_ARG: - printf_filtered ("Sorry, don't know how to do LOC_REF_ARG yet.\n"); -@@ -911,7 +977,7 @@ collection_list::collect_symbol (struct symbol *sym, - SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } -- add_memrange (gdbarch, reg, offset, len); -+ add_memrange (gdbarch, reg, offset, len, scope); - break; - case LOC_REGPARM_ADDR: - reg = SYMBOL_VALUE (sym); -@@ -923,7 +989,7 @@ collection_list::collect_symbol (struct symbol *sym, - SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } -- add_memrange (gdbarch, reg, offset, len); -+ add_memrange (gdbarch, reg, offset, len, scope); - break; - case LOC_LOCAL: - reg = frame_regno; -@@ -935,7 +1001,7 @@ collection_list::collect_symbol (struct symbol *sym, - SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } -- add_memrange (gdbarch, reg, offset, len); -+ add_memrange (gdbarch, reg, offset, len, scope); - break; - - case LOC_UNRESOLVED: -@@ -968,26 +1034,10 @@ collection_list::collect_symbol (struct symbol *sym, - return; - } - -- ax_reqs (aexpr.get ()); -- -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* Take care of the registers. */ -- if (aexpr->reg_mask_len > 0) -- { -- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -- { -- QUIT; /* Allow user to bail out with ^C. */ -- if (aexpr->reg_mask[ndx1] != 0) -- { -- /* Assume chars have 8 bits. */ -- for (int ndx2 = 0; ndx2 < 8; ndx2++) -- if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -- /* It's used -- record it. */ -- add_register (ndx1 * 8 + ndx2); -- } -- } -- } -+ add_ax_registers (aexpr.get ()); - - add_aexpr (std::move (aexpr)); - } -@@ -1257,8 +1307,18 @@ encode_actions_1 (struct command_line *action, - - if (0 == strncasecmp ("$reg", action_exp, 4)) - { -- for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++) -- collect->add_register (i); -+ for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); -+ i++) -+ { -+ int remote_regno = (gdbarch_remote_register_number -+ (target_gdbarch (), i)); -+ -+ /* Ignore arch regnos without a corresponding -+ remote regno. This can happen for regnos not -+ in the tdesc. */ -+ if (remote_regno >= 0) -+ collect->add_remote_register (remote_regno); -+ } - action_exp = strchr (action_exp, ','); /* more? */ - } - else if (0 == strncasecmp ("$arg", action_exp, 4)) -@@ -1288,27 +1348,10 @@ encode_actions_1 (struct command_line *action, - target_gdbarch (), - trace_string); - -- ax_reqs (aexpr.get ()); -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* take care of the registers */ -- if (aexpr->reg_mask_len > 0) -- { -- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -- { -- QUIT; /* allow user to bail out with ^C */ -- if (aexpr->reg_mask[ndx1] != 0) -- { -- /* assume chars have 8 bits */ -- for (int ndx2 = 0; ndx2 < 8; ndx2++) -- if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -- { -- /* It's used -- record it. */ -- collect->add_register (ndx1 * 8 + ndx2); -- } -- } -- } -- } -+ collect->add_ax_registers (aexpr.get ()); - - collect->add_aexpr (std::move (aexpr)); - action_exp = strchr (action_exp, ','); /* more? */ -@@ -1340,7 +1383,8 @@ encode_actions_1 (struct command_line *action, - name); - if (info_verbose) - printf_filtered ("OP_REGISTER: "); -- collect->add_register (i); -+ collect->add_local_register (target_gdbarch (), -+ i, tloc->address); - break; - } - -@@ -1352,7 +1396,8 @@ encode_actions_1 (struct command_line *action, - check_typedef (exp->elts[1].type); - collect->add_memrange (target_gdbarch (), - memrange_absolute, addr, -- TYPE_LENGTH (exp->elts[1].type)); -+ TYPE_LENGTH (exp->elts[1].type), -+ tloc->address); - collect->append_exp (exp.get ()); - break; - -@@ -1376,28 +1421,10 @@ encode_actions_1 (struct command_line *action, - exp.get (), - trace_string); - -- ax_reqs (aexpr.get ()); -- -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* Take care of the registers. */ -- if (aexpr->reg_mask_len > 0) -- { -- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -- { -- QUIT; /* Allow user to bail out with ^C. */ -- if (aexpr->reg_mask[ndx1] != 0) -- { -- /* Assume chars have 8 bits. */ -- for (int ndx2 = 0; ndx2 < 8; ndx2++) -- if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -- { -- /* It's used -- record it. */ -- collect->add_register (ndx1 * 8 + ndx2); -- } -- } -- } -- } -+ collect->add_ax_registers (aexpr.get ()); - - collect->add_aexpr (std::move (aexpr)); - collect->append_exp (exp.get ()); -@@ -1422,8 +1449,7 @@ encode_actions_1 (struct command_line *action, - agent_expr_up aexpr = gen_eval_for_expr (tloc->address, - exp.get ()); - -- ax_reqs (aexpr.get ()); -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* Even though we're not officially collecting, add - to the collect list anyway. */ -diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h ---- a/gdb/tracepoint.h -+++ b/gdb/tracepoint.h -@@ -263,9 +263,14 @@ public: - void add_aexpr (agent_expr_up aexpr); - - void add_register (unsigned int regno); -+ void add_remote_register (unsigned int regno); -+ void add_ax_registers (struct agent_expr *aexpr); -+ void add_local_register (struct gdbarch *gdbarch, -+ unsigned int regno, -+ CORE_ADDR scope); - void add_memrange (struct gdbarch *gdbarch, - int type, bfd_signed_vma base, -- ULONGEST len); -+ ULONGEST len, CORE_ADDR scope); - void collect_symbol (struct symbol *sym, - struct gdbarch *gdbarch, - long frame_regno, long frame_offset, diff --git a/gdb-rhbz1187581-power8-regs-5of7.patch b/gdb-rhbz1187581-power8-regs-5of7.patch deleted file mode 100644 index eaca52f7351a1257268562f9262f28687a9e25ac..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-5of7.patch +++ /dev/null @@ -1,215 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:17:46 +0200 -Subject: gdb-rhbz1187581-power8-regs-5of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit a04b9d62a234923826e431a209d396a628661548 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Variable size for regs mask in collection list - - This patch changes collection_list to allow larger register masks. - - The mask is changed from an array to a vector and is initialized to - hold the maximum possible remote register number. The stringify - method is updated to resize temp_buf if needed. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (collection_list) : Change type to - std::vector. - * tracepoint.c (collection_list::collection_list): Remove - m_regs_mask initializer from initializer list. Resize - m_regs_mask using the largest remote register number. - (collection_list::add_remote_register): Remove size check on - m_regs_mask. Use at to access element. - (collection_list::stringify): Change type of temp_buf to - gdb::char_vector. Update uses of temp_buf. Resize if needed to - stringify the register mask. Use pack_hex_byte for the register - mask. - -+2018-08-06 Pedro Franco de Carvalho -+ -+ * tracepoint.h (collection_list) : Change type to -+ std::vector. -+ * tracepoint.c (collection_list::collection_list): Remove -+ m_regs_mask initializer from initializer list. Resize -+ m_regs_mask using the largest remote register number. -+ (collection_list::add_remote_register): Remove size check on -+ m_regs_mask. Use at to access element. -+ (collection_list::stringify): Change type of temp_buf to -+ gdb::char_vector. Update uses of temp_buf. Resize if needed to -+ stringify the register mask. Use pack_hex_byte for the register -+ mask. -+ - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (class collection_list) : Remove. - -diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c ---- a/gdb/tracepoint.c -+++ b/gdb/tracepoint.c -@@ -822,10 +822,8 @@ collection_list::add_remote_register (unsigned int regno) - { - if (info_verbose) - printf_filtered ("collect register %d\n", regno); -- if (regno >= (8 * sizeof (m_regs_mask))) -- error (_("Internal: register number %d too large for tracepoint"), -- regno); -- m_regs_mask[regno / 8] |= 1 << (regno % 8); -+ -+ m_regs_mask.at (regno / 8) |= 1 << (regno % 8); - } - - /* Add all the registers from the mask in AEXPR to the mask in the -@@ -1136,9 +1134,20 @@ collection_list::add_static_trace_data () - } - - collection_list::collection_list () -- : m_regs_mask (), -- m_strace_data (false) -+ : m_strace_data (false) - { -+ int max_remote_regno = 0; -+ for (int i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++) -+ { -+ int remote_regno = (gdbarch_remote_register_number -+ (target_gdbarch (), i)); -+ -+ if (remote_regno >= 0 && remote_regno > max_remote_regno) -+ max_remote_regno = remote_regno; -+ } -+ -+ m_regs_mask.resize ((max_remote_regno / 8) + 1); -+ - m_memranges.reserve (128); - m_aexprs.reserve (128); - } -@@ -1148,7 +1157,8 @@ collection_list::collection_list () - std::vector - collection_list::stringify () - { -- char temp_buf[2048]; -+ gdb::char_vector temp_buf (2048); -+ - int count; - char *end; - long i; -@@ -1158,35 +1168,45 @@ collection_list::stringify () - { - if (info_verbose) - printf_filtered ("\nCollecting static trace data\n"); -- end = temp_buf; -+ end = temp_buf.data (); - *end++ = 'L'; -- str_list.emplace_back (temp_buf, end - temp_buf); -+ str_list.emplace_back (temp_buf.data (), end - temp_buf.data ()); - } - -- for (i = sizeof (m_regs_mask) - 1; i > 0; i--) -+ for (i = m_regs_mask.size () - 1; i > 0; i--) - if (m_regs_mask[i] != 0) /* Skip leading zeroes in regs_mask. */ - break; - if (m_regs_mask[i] != 0) /* Prepare to send regs_mask to the stub. */ - { - if (info_verbose) - printf_filtered ("\nCollecting registers (mask): 0x"); -- end = temp_buf; -+ -+ /* One char for 'R', one for the null terminator and two per -+ mask byte. */ -+ std::size_t new_size = (i + 1) * 2 + 2; -+ if (new_size > temp_buf.size ()) -+ temp_buf.resize (new_size); -+ -+ end = temp_buf.data (); - *end++ = 'R'; - for (; i >= 0; i--) - { - QUIT; /* Allow user to bail out with ^C. */ - if (info_verbose) - printf_filtered ("%02X", m_regs_mask[i]); -- sprintf (end, "%02X", m_regs_mask[i]); -- end += 2; -+ -+ end = pack_hex_byte (end, m_regs_mask[i]); - } -- str_list.emplace_back (temp_buf); -+ *end = '\0'; -+ -+ str_list.emplace_back (temp_buf.data ()); - } - if (info_verbose) - printf_filtered ("\n"); - if (!m_memranges.empty () && info_verbose) - printf_filtered ("Collecting memranges: \n"); -- for (i = 0, count = 0, end = temp_buf; i < m_memranges.size (); i++) -+ for (i = 0, count = 0, end = temp_buf.data (); -+ i < m_memranges.size (); i++) - { - QUIT; /* Allow user to bail out with ^C. */ - if (info_verbose) -@@ -1200,9 +1220,9 @@ collection_list::stringify () - } - if (count + 27 > MAX_AGENT_EXPR_LEN) - { -- str_list.emplace_back (temp_buf, count); -+ str_list.emplace_back (temp_buf.data (), count); - count = 0; -- end = temp_buf; -+ end = temp_buf.data (); - } - - { -@@ -1222,7 +1242,7 @@ collection_list::stringify () - } - - count += strlen (end); -- end = temp_buf + count; -+ end = temp_buf.data () + count; - } - - for (i = 0; i < m_aexprs.size (); i++) -@@ -1230,9 +1250,9 @@ collection_list::stringify () - QUIT; /* Allow user to bail out with ^C. */ - if ((count + 10 + 2 * m_aexprs[i]->len) > MAX_AGENT_EXPR_LEN) - { -- str_list.emplace_back (temp_buf, count); -+ str_list.emplace_back (temp_buf.data (), count); - count = 0; -- end = temp_buf; -+ end = temp_buf.data (); - } - sprintf (end, "X%08X,", m_aexprs[i]->len); - end += 10; /* 'X' + 8 hex digits + ',' */ -@@ -1244,9 +1264,9 @@ collection_list::stringify () - - if (count != 0) - { -- str_list.emplace_back (temp_buf, count); -+ str_list.emplace_back (temp_buf.data (), count); - count = 0; -- end = temp_buf; -+ end = temp_buf.data (); - } - - return str_list; -diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h ---- a/gdb/tracepoint.h -+++ b/gdb/tracepoint.h -@@ -293,8 +293,9 @@ public: - { return m_computed; } - - private: -- /* room for up to 256 regs */ -- unsigned char m_regs_mask[32]; -+ /* We need the allocator zero-initialize the mask, so we don't use -+ gdb::byte_vector. */ -+ std::vector m_regs_mask; - - std::vector m_memranges; - diff --git a/gdb-rhbz1187581-power8-regs-6of7.patch b/gdb-rhbz1187581-power8-regs-6of7.patch deleted file mode 100644 index b0a5e1fe981b8854ce5488b9556c72167babfbdf..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-6of7.patch +++ /dev/null @@ -1,187 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:18:15 +0200 -Subject: gdb-rhbz1187581-power8-regs-6of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 296956befef3711ed458c7cba8041fde0dab9c50 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Allow larger regblock sizes when saving tracefiles - - The tracefile.c:trace_save function assumes trace_regblock_size won't - be larger than the MAX_TRACE_UPLOAD constant, used to size the buffer - which holds trace data. This can cause buffer overruns when this is - not the case. This patch changes this function so that the larger - size is used to size the buffer. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * tracefile.c: Include common/byte-vector.h. - (trace_save): Change type of buf to gdb::byte_vector. Initialize - with trace_regblock_size if needed. Update uses of buf. - -+2018-08-06 Pedro Franco de Carvalho -+ -+ * tracefile.c: Include common/byte-vector.h. -+ (trace_save): Change type of buf to gdb::byte_vector. Initialize -+ with trace_regblock_size if needed. Update uses of buf. -+ - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (collection_list) : Change type to - -diff --git a/gdb/tracefile.c b/gdb/tracefile.c ---- a/gdb/tracefile.c -+++ b/gdb/tracefile.c -@@ -22,6 +22,7 @@ - #include "ctf.h" - #include "exec.h" - #include "regcache.h" -+#include "common/byte-vector.h" - - /* Helper macros. */ - -@@ -67,7 +68,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - - ULONGEST offset = 0; - #define MAX_TRACE_UPLOAD 2000 -- gdb_byte buf[MAX_TRACE_UPLOAD]; -+ gdb::byte_vector buf (std::max (MAX_TRACE_UPLOAD, trace_regblock_size)); - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - - /* If the target is to save the data to a file on its own, then just -@@ -144,7 +145,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* We ask for big blocks, in the hopes of efficiency, but - will take less if the target has packet size limitations - or some such. */ -- gotten = target_get_raw_trace_data (buf, offset, -+ gotten = target_get_raw_trace_data (buf.data (), offset, - MAX_TRACE_UPLOAD); - if (gotten < 0) - error (_("Failure to get requested trace buffer data")); -@@ -152,7 +153,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - if (gotten == 0) - break; - -- writer->ops->write_trace_buffer (writer, buf, gotten); -+ writer->ops->write_trace_buffer (writer, buf.data (), gotten); - - offset += gotten; - } -@@ -163,7 +164,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* Parse the trace buffers according to how data are stored - in trace buffer in GDBserver. */ - -- gotten = target_get_raw_trace_data (buf, offset, 6); -+ gotten = target_get_raw_trace_data (buf.data (), offset, 6); - - if (gotten == 0) - break; -@@ -171,10 +172,10 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* Read the first six bytes in, which is the tracepoint - number and trace frame size. */ - tp_num = (uint16_t) -- extract_unsigned_integer (&buf[0], 2, byte_order); -+ extract_unsigned_integer (&((buf.data ())[0]), 2, byte_order); - - tf_size = (uint32_t) -- extract_unsigned_integer (&buf[2], 4, byte_order); -+ extract_unsigned_integer (&((buf.data ())[2]), 4, byte_order); - - writer->ops->frame_ops->start (writer, tp_num); - gotten = 6; -@@ -192,7 +193,8 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* We'll fetch one block each time, in order to - handle the extremely large 'M' block. We first - fetch one byte to get the type of the block. */ -- gotten = target_get_raw_trace_data (buf, offset, 1); -+ gotten = target_get_raw_trace_data (buf.data (), -+ offset, 1); - if (gotten < 1) - error (_("Failure to get requested trace buffer data")); - -@@ -205,13 +207,13 @@ trace_save (const char *filename, struct trace_file_writer *writer, - { - case 'R': - gotten -- = target_get_raw_trace_data (buf, offset, -+ = target_get_raw_trace_data (buf.data (), offset, - trace_regblock_size); - if (gotten < trace_regblock_size) - error (_("Failure to get requested trace" - " buffer data")); - -- TRACE_WRITE_R_BLOCK (writer, buf, -+ TRACE_WRITE_R_BLOCK (writer, buf.data (), - trace_regblock_size); - break; - case 'M': -@@ -221,7 +223,8 @@ trace_save (const char *filename, struct trace_file_writer *writer, - LONGEST t; - int j; - -- t = target_get_raw_trace_data (buf,offset, 10); -+ t = target_get_raw_trace_data (buf.data (), -+ offset, 10); - if (t < 10) - error (_("Failure to get requested trace" - " buffer data")); -@@ -231,10 +234,10 @@ trace_save (const char *filename, struct trace_file_writer *writer, - - gotten = 0; - addr = (ULONGEST) -- extract_unsigned_integer (buf, 8, -+ extract_unsigned_integer (buf.data (), 8, - byte_order); - mlen = (unsigned short) -- extract_unsigned_integer (&buf[8], 2, -+ extract_unsigned_integer (&((buf.data ())[8]), 2, - byte_order); - - TRACE_WRITE_M_BLOCK_HEADER (writer, addr, -@@ -252,14 +255,15 @@ trace_save (const char *filename, struct trace_file_writer *writer, - else - read_length = mlen - j; - -- t = target_get_raw_trace_data (buf, -+ t = target_get_raw_trace_data (buf.data (), - offset + j, - read_length); - if (t < read_length) - error (_("Failure to get requested" - " trace buffer data")); - -- TRACE_WRITE_M_BLOCK_MEMORY (writer, buf, -+ TRACE_WRITE_M_BLOCK_MEMORY (writer, -+ buf.data (), - read_length); - - j += read_length; -@@ -274,18 +278,18 @@ trace_save (const char *filename, struct trace_file_writer *writer, - LONGEST val; - - gotten -- = target_get_raw_trace_data (buf, offset, -- 12); -+ = target_get_raw_trace_data (buf.data (), -+ offset, 12); - if (gotten < 12) - error (_("Failure to get requested" - " trace buffer data")); - -- vnum = (int) extract_signed_integer (buf, -+ vnum = (int) extract_signed_integer (buf.data (), - 4, - byte_order); - val -- = extract_signed_integer (&buf[4], 8, -- byte_order); -+ = extract_signed_integer (&((buf.data ())[4]), -+ 8, byte_order); - - TRACE_WRITE_V_BLOCK (writer, vnum, val); - } diff --git a/gdb-rhbz1187581-power8-regs-7of7.patch b/gdb-rhbz1187581-power8-regs-7of7.patch deleted file mode 100644 index ee82673b88e32893d827872355e61f9ecc38e0ba..0000000000000000000000000000000000000000 --- a/gdb-rhbz1187581-power8-regs-7of7.patch +++ /dev/null @@ -1,129 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:18:49 +0200 -Subject: gdb-rhbz1187581-power8-regs-7of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit a7f25a84f4cc1df5248c46346337f19a2a66af5a -Author: Simon Marchi -Date: Mon Aug 6 16:54:47 2018 -0400 - - Fix compilation failure in remote.c - - A recent patch introduced a few of these: - - /home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security] - error (err_msg); - ^ - - Fix them by replacing the call to error with - - error ("%s", err_msg); - - gdb/ChangeLog: - - * remote.c (remote_target::download_tracepoint): Fix format - string errors. - -+2018-08-06 Simon Marchi -+ -+ * remote.c (remote_target::download_tracepoint): Fix format -+ string errors. -+ - 2018-08-06 Pedro Franco de Carvalho - - * tracefile.c: Include common/byte-vector.h. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12826,7 +12826,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - t->step_count, t->pass_count); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - /* Fast tracepoints are mostly handled by the target, but we can - tell the target how big of an instruction block should be moved -@@ -12846,7 +12846,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - gdb_insn_length (loc->gdbarch, tpaddr)); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - } - else - /* If it passed validation at definition but fails now, -@@ -12877,7 +12877,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - size_left, ":S"); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - } - else - error (_("Static tracepoint not valid during download")); -@@ -12905,14 +12905,14 @@ remote_target::download_tracepoint (struct bp_location *loc) - size_left, ":X%x,", aexpr->len); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - - size_left = buf.size () - strlen (buf.data ()); - - /* Two bytes to encode each aexpr byte, plus the terminating - null byte. */ - if (aexpr->len * 2 + 1 > size_left) -- error (err_msg); -+ error ("%s", err_msg); - - pkt = buf.data () + strlen (buf.data ()); - -@@ -12933,7 +12933,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - size_left, "-"); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - } - - putpkt (buf.data ()); -@@ -12956,7 +12956,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - has_more ? '-' : 0); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - putpkt (buf.data ()); - remote_get_noisy_reply (); -@@ -12979,7 +12979,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - has_more ? "-" : ""); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - putpkt (buf.data ()); - remote_get_noisy_reply (); -@@ -12994,7 +12994,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - encode_source_string (b->number, loc->address, "at", - event_location_to_string (b->location.get ()), -@@ -13010,7 +13010,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - encode_source_string (b->number, loc->address, - "cond", b->cond_string, diff --git a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch index b4e310945b37feb043d3125795a85aea0a855203..7b2e547bbdacbbcb7b5c2474dbfc7a26d09c5501 100644 --- a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +++ b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch - -;; [aarch64] Fix hardware watchpoints (RH BZ 1261564). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c new file mode 100644 --- /dev/null @@ -102,3 +94,4 @@ new file mode 100644 +setup_xfail "powerpc*-*-*" + +gdb_continue_to_end + diff --git a/gdb-rhbz1325795-framefilters-test.patch b/gdb-rhbz1325795-framefilters-test.patch index cfe309d970889951a284734387c7a165a518ad1e..fb643bb067b71bb8c6745a036dc16e90fd33dc69 100644 --- a/gdb-rhbz1325795-framefilters-test.patch +++ b/gdb-rhbz1325795-framefilters-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1325795-framefilters-test.patch - -;; New test for Python "Cannot locate object file for block" (for RH BZ 1325795). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.c b/gdb/testsuite/gdb.python/py-framefilter-thread.c new file mode 100644 --- /dev/null @@ -174,3 +166,4 @@ new file mode 100644 + return frame_iter + +FrameFilter() + diff --git a/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch index d06e1214f056adcd31e2a17bc8588841fb2bc17c..0eae4dfe4500fc50bcd0b9219b25f1f768893ec8 100644 --- a/gdb-rhbz1350436-type-printers-error.patch +++ b/gdb-rhbz1350436-type-printers-error.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1350436-type-printers-error.patch - -;; Test 'info type-printers' Python error (RH BZ 1350436). -;;=fedoratest - Typo in Python support breaks info type-printers command https://bugzilla.redhat.com/show_bug.cgi?id=1350436 @@ -79,3 +71,4 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python + +import gdb.types +gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter()) + diff --git a/gdb-rhbz1371380-gcore-elf-headers.patch b/gdb-rhbz1371380-gcore-elf-headers.patch new file mode 100644 index 0000000000000000000000000000000000000000..562a4021110a5c9c64cbd9c94bcd02cb10fe0be6 --- /dev/null +++ b/gdb-rhbz1371380-gcore-elf-headers.patch @@ -0,0 +1,454 @@ +Implement dump of mappings with ELF headers by gcore + +This patch has a long story, but it all started back in 2015, with +commit df8411da087dc05481926f4c4a82deabc5bc3859 ("Implement support +for checking /proc/PID/coredump_filter"). The purpose of that commit +was to bring GDB's corefile generation closer to what the Linux kernel +does. However, back then, I did not implement the full support for +the dumping of memory mappings containing ELF headers (like mappings +of DSOs or executables). These mappings were being dumped most of +time, though, because the default value of /proc/PID/coredump_filter +is 0x33, which would cause anonymous private mappings (DSOs/executable +code mappings have this type) to be dumped. Well, until something +happened on binutils... + +A while ago, I noticed something strange was happening with one of our +local testcases on Fedora GDB: it was failing due to some strange +build-id problem. On Fedora GDB, we (unfortunately) carry a bunch of +"local" patches, and some of these patches actually extend upstream's +build-id support in order to generate more useful information for the +user of a Fedora system (for example, when the user loads a corefile +into GDB, we detect whether the executable that generated that +corefile is present, and if it's not we issue a warning suggesting +that it should be installed, while also providing the build-id of the +executable). A while ago, Fedora GDB stopped printing those warnings. + +I wanted to investigate this right away, and spent some time trying to +determine what was going on, but other things happened and I got +sidetracked. Meanwhile, the bug started to be noticed by some of our +users, and its priority started changing. Then, someone on IRC also +mentioned the problem, and when I tried helping him, I noticed he +wasn't running Fedora. Hm... So maybe the bug was *also* present +upstream. + +After "some" time investigating, and with a lot of help from Keith and +others, I was finally able to determine that yes, the bug is also +present upstream, and that even though it started with a change in ld, +it is indeed a GDB issue. + +So, as I said, the problem started with binutils, more specifically +after the following commit was pushed: + + commit f6aec96dce1ddbd8961a3aa8a2925db2021719bb + Author: H.J. Lu + Date: Tue Feb 27 11:34:20 2018 -0800 + + ld: Add --enable-separate-code + +This commit makes ld use "-z separate-code" by default on x86-64 +machines. What this means is that code pages and data pages are now +separated in the binary, which is confusing GDB when it tries to decide +what to dump. + +BTW, Fedora 28 binutils doesn't have this code, which means that +Fedora 28 GDB doesn't have the problem. From Fedora 29 on, binutils +was rebased and incorporated the commit above, which started causing +Fedora GDB to fail. + +Anyway, the first thing I tried was to pass "-z max-page-size" and +specify a bigger page size (I saw a patch that did this and was +proposed to Linux, so I thought it might help). Obviously, this +didn't work, because the real "problem" is that ld will always use +separate pages for code and data. So I decided to look into how GDB +dumped the pages, and that's where I found the real issue. + +What happens is that, because of "-z separate-code", the first two pages +of the ELF binary are (from /proc/PID/smaps): + + 00400000-00401000 r--p 00000000 fc:01 799548 /file + Size: 4 kB + KernelPageSize: 4 kB + MMUPageSize: 4 kB + Rss: 4 kB + Pss: 4 kB + Shared_Clean: 0 kB + Shared_Dirty: 0 kB + Private_Clean: 4 kB + Private_Dirty: 0 kB + Referenced: 4 kB + Anonymous: 0 kB + LazyFree: 0 kB + AnonHugePages: 0 kB + ShmemPmdMapped: 0 kB + Shared_Hugetlb: 0 kB + Private_Hugetlb: 0 kB + Swap: 0 kB + SwapPss: 0 kB + Locked: 0 kB + THPeligible: 0 + VmFlags: rd mr mw me dw sd + 00401000-00402000 r-xp 00001000 fc:01 799548 /file + Size: 4 kB + KernelPageSize: 4 kB + MMUPageSize: 4 kB + Rss: 4 kB + Pss: 4 kB + Shared_Clean: 0 kB + Shared_Dirty: 0 kB + Private_Clean: 0 kB + Private_Dirty: 4 kB + Referenced: 4 kB + Anonymous: 4 kB + LazyFree: 0 kB + AnonHugePages: 0 kB + ShmemPmdMapped: 0 kB + Shared_Hugetlb: 0 kB + Private_Hugetlb: 0 kB + Swap: 0 kB + SwapPss: 0 kB + Locked: 0 kB + THPeligible: 0 + VmFlags: rd ex mr mw me dw sd + +Whereas before, we had only one: + + 00400000-00401000 r-xp 00000000 fc:01 798593 /file + Size: 4 kB + KernelPageSize: 4 kB + MMUPageSize: 4 kB + Rss: 4 kB + Pss: 4 kB + Shared_Clean: 0 kB + Shared_Dirty: 0 kB + Private_Clean: 0 kB + Private_Dirty: 4 kB + Referenced: 4 kB + Anonymous: 4 kB + LazyFree: 0 kB + AnonHugePages: 0 kB + ShmemPmdMapped: 0 kB + Shared_Hugetlb: 0 kB + Private_Hugetlb: 0 kB + Swap: 0 kB + SwapPss: 0 kB + Locked: 0 kB + THPeligible: 0 + VmFlags: rd ex mr mw me dw sd + +Notice how we have "Anonymous" data mapped into the page. This will be +important. + +So, the way GDB decides which pages it should dump has been revamped +by my patch in 2015, and now it takes the contents of +/proc/PID/coredump_filter into account. The default value for Linux +is 0x33, which means: + + Dump anonymous private, anonymous shared, ELF headers and HugeTLB + private pages. + +Or: + + filter_flags filterflags = (COREFILTER_ANON_PRIVATE + | COREFILTER_ANON_SHARED + | COREFILTER_ELF_HEADERS + | COREFILTER_HUGETLB_PRIVATE); + +Now, it is important to keep in mind that GDB doesn't always have *all* +of the necessary information to exactly determine the type of a page, so +the whole algorithm is based on heuristics (you can take a look at +linux-tdep.c:dump_mapping_p and +linux-tdep.c:linux_find_memory_regions_full for more info). + +Before the patch to make ld use "-z separate-code", the (single) page +containing data and code was being flagged as an anonymous (due to the +non-zero "Anonymous:" field) private (due to the "r-xp" permission), +which means that it was being dumped into the corefile. That's why it +was working fine. + +Now, as you can imagine, when "-z separate-code" is used, the *data* +page (which is where the ELF notes are, including the build-id one) now +doesn't have any "Anonymous:" mapping, so the heuristic is flagging it +as file-backed private, which is *not* dumped by default. + +The next question I had to answer was: how come a corefile generated by +the Linux kernel was correct? Well, the answer is that GDB, unlike +Linux, doesn't actually implement the COREFILTER_ELF_HEADERS support. +On Linux, even though the data page is also treated as a file-backed +private mapping, it is also checked to see if there are any ELF headers +in the page, and then, because we *do* have ELF headers there, it is +dumped. + +So, after more time trying to think of ways to fix this, I was able to +implement an algorithm that reads the first few bytes of the memory +mapping being processed, and checks to see if the ELF magic code is +present. This is basically what Linux does as well, except that, if +it finds the ELF magic code, it just dumps one page to the corefile, +whereas GDB will dump the whole mapping. But I don't think that's a +big issue, to be honest. + +It's also important to explain that we *only* perform the ELF magic +code check if: + + - The algorithm has decided *not* to dump the mapping so far, and; + - The mapping is private, and; + - The mapping's offset is zero, and; + - The user has requested us to dump mappings with ELF headers. + +IOW, we're not going to blindly check every mapping. + +As for the testcase, I struggled even more trying to write it. Since +our build-id support on upstream GDB is not very extensive, it's not +really possible to determine whether a corefile contains build-id +information or not just by using GDB. So, after thinking a lot about +the problem, I decided to rely on an external tool, eu-unstrip, in +order to verify whether the dump was successful. I verified the test +here on my machine, and everything seems to work as expected (i.e., it +fails without the patch, and works with the patch applied). We are +working hard to upstream our "local" Fedora GDB patches, and we intend +to submit our build-id extension patches "soon", so hopefully we'll be +able to use GDB itself to perform this verification. + +I built and regtested this on the BuildBot, and no problems were +found. + +gdb/ChangeLog: +2019-04-25 Sergio Durigan Junior + + PR corefiles/11608 + PR corefiles/18187 + * linux-tdep.c (dump_mapping_p): Add new parameters ADDR and + OFFSET. Verify if current mapping contains an ELF header. + (linux_find_memory_regions_full): Adjust call to + dump_mapping_p. + +gdb/testsuite/ChangeLog: +2019-04-25 Sergio Durigan Junior + + PR corefiles/11608 + PR corefiles/18187 + * gdb.base/coredump-filter-build-id.exp: New file. + +diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c +--- a/gdb/linux-tdep.c ++++ b/gdb/linux-tdep.c +@@ -591,8 +591,8 @@ mapping_is_anonymous_p (const char *filename) + } + + /* Return 0 if the memory mapping (which is related to FILTERFLAGS, V, +- MAYBE_PRIVATE_P, and MAPPING_ANONYMOUS_P) should not be dumped, or +- greater than 0 if it should. ++ MAYBE_PRIVATE_P, MAPPING_ANONYMOUS_P, ADDR and OFFSET) should not ++ be dumped, or greater than 0 if it should. + + In a nutshell, this is the logic that we follow in order to decide + if a mapping should be dumped or not. +@@ -630,12 +630,17 @@ mapping_is_anonymous_p (const char *filename) + see 'p' in the permission flags, then we assume that the mapping + is private, even though the presence of the 's' flag there would + mean VM_MAYSHARE, which means the mapping could still be private. +- This should work OK enough, however. */ ++ This should work OK enough, however. ++ ++ - Even if, at the end, we decided that we should not dump the ++ mapping, we still have to check if it is something like an ELF ++ header (of a DSO or an executable, for example). If it is, and ++ if the user is interested in dump it, then we should dump it. */ + + static int + dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, + int maybe_private_p, int mapping_anon_p, int mapping_file_p, +- const char *filename) ++ const char *filename, ULONGEST addr, ULONGEST offset) + { + /* Initially, we trust in what we received from our caller. This + value may not be very precise (i.e., it was probably gathered +@@ -645,6 +650,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, + (assuming that the version of the Linux kernel being used + supports it, of course). */ + int private_p = maybe_private_p; ++ int dump_p; + + /* We always dump vDSO and vsyscall mappings, because it's likely that + there'll be no file to read the contents from at core load time. +@@ -685,13 +691,13 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, + /* This is a special situation. It can happen when we see a + mapping that is file-backed, but that contains anonymous + pages. */ +- return ((filterflags & COREFILTER_ANON_PRIVATE) != 0 +- || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0); ++ dump_p = ((filterflags & COREFILTER_ANON_PRIVATE) != 0 ++ || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0); + } + else if (mapping_anon_p) +- return (filterflags & COREFILTER_ANON_PRIVATE) != 0; ++ dump_p = (filterflags & COREFILTER_ANON_PRIVATE) != 0; + else +- return (filterflags & COREFILTER_MAPPED_PRIVATE) != 0; ++ dump_p = (filterflags & COREFILTER_MAPPED_PRIVATE) != 0; + } + else + { +@@ -700,14 +706,55 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, + /* This is a special situation. It can happen when we see a + mapping that is file-backed, but that contains anonymous + pages. */ +- return ((filterflags & COREFILTER_ANON_SHARED) != 0 +- || (filterflags & COREFILTER_MAPPED_SHARED) != 0); ++ dump_p = ((filterflags & COREFILTER_ANON_SHARED) != 0 ++ || (filterflags & COREFILTER_MAPPED_SHARED) != 0); + } + else if (mapping_anon_p) +- return (filterflags & COREFILTER_ANON_SHARED) != 0; ++ dump_p = (filterflags & COREFILTER_ANON_SHARED) != 0; + else +- return (filterflags & COREFILTER_MAPPED_SHARED) != 0; ++ dump_p = (filterflags & COREFILTER_MAPPED_SHARED) != 0; + } ++ ++ /* Even if we decided that we shouldn't dump this mapping, we still ++ have to check whether (a) the user wants us to dump mappings ++ containing an ELF header, and (b) the mapping in question ++ contains an ELF header. If (a) and (b) are true, then we should ++ dump this mapping. ++ ++ A mapping contains an ELF header if it is a private mapping, its ++ offset is zero, and its first word is ELFMAG. */ ++ if (!dump_p && private_p && offset == 0 ++ && (filterflags & COREFILTER_ELF_HEADERS) != 0) ++ { ++ /* Let's check if we have an ELF header. */ ++ gdb::unique_xmalloc_ptr header; ++ int errcode; ++ ++ /* Useful define specifying the size of the ELF magical ++ header. */ ++#ifndef SELFMAG ++#define SELFMAG 4 ++#endif ++ ++ /* Read the first SELFMAG bytes and check if it is ELFMAG. */ ++ if (target_read_string (addr, &header, SELFMAG, &errcode) == SELFMAG ++ && errcode == 0) ++ { ++ const char *h = header.get (); ++ ++ /* The EI_MAG* and ELFMAG* constants come from ++ . */ ++ if (h[EI_MAG0] == ELFMAG0 && h[EI_MAG1] == ELFMAG1 ++ && h[EI_MAG2] == ELFMAG2 && h[EI_MAG3] == ELFMAG3) ++ { ++ /* This mapping contains an ELF header, so we ++ should dump it. */ ++ dump_p = 1; ++ } ++ } ++ } ++ ++ return dump_p; + } + + /* Implement the "info proc" command. */ +@@ -1311,7 +1358,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch, + if (has_anonymous) + should_dump_p = dump_mapping_p (filterflags, &v, priv, + mapping_anon_p, mapping_file_p, +- filename); ++ filename, addr, offset); + else + { + /* Older Linux kernels did not support the "Anonymous:" counter. +diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp +@@ -0,0 +1,69 @@ ++# Copyright 2019 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 . ++ ++# Test whether GDB's gcore/generate-core-file command can dump memory ++# mappings with ELF headers, containing a build-id note. ++# ++# Due to the fact that we don't have an easy way to process a corefile ++# and look for specific notes using GDB/dejagnu, we rely on an ++# external tool, eu-unstrip, to verify if the corefile contains ++# build-ids. ++ ++standard_testfile "normal.c" ++ ++# This test is Linux x86_64 only. ++if { ![istarget *-*-linux*] } { ++ untested "$testfile.exp" ++ return -1 ++} ++if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } { ++ untested "$testfile.exp" ++ return -1 ++} ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { ++ return -1 ++} ++ ++if { ![runto_main] } { ++ untested "could not run to main" ++ return -1 ++} ++ ++# First we need to generate a corefile. ++set corefilename "[standard_output_file gcore.test]" ++if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } { ++ verbose -log "Could not save corefile" ++ untested "$testfile.exp" ++ return -1 ++} ++ ++# Determine if GDB dumped the mapping containing the build-id. This ++# is done by invoking an external program (eu-unstrip). ++if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } { ++ set line [lindex [split $output "\n"] 0] ++ set test "gcore dumped mapping with build-id" ++ ++ verbose -log "First line of eu-unstrip: $line" ++ ++ if { [regexp "^${hex}\\+${hex} \[a-f0-9\]+@${hex}.*[string_to_regexp $binfile]$" $line] } { ++ pass "$test" ++ } else { ++ fail "$test" ++ } ++} else { ++ verbose -log "Could not execute eu-unstrip program" ++ untested "$testfile.exp" ++} +diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp +--- a/gdb/testsuite/lib/future.exp ++++ b/gdb/testsuite/lib/future.exp +@@ -162,6 +162,16 @@ proc gdb_find_readelf {} { + return $readelf + } + ++proc gdb_find_eu-unstrip {} { ++ global EU_UNSTRIP_FOR_TARGET ++ if [info exists EU_UNSTRIP_FOR_TARGET] { ++ set eu_unstrip $EU_UNSTRIP_FOR_TARGET ++ } else { ++ set eu_unstrip [transform eu-unstrip] ++ } ++ return $eu_unstrip ++} ++ + proc gdb_default_target_compile {source destfile type options} { + global target_triplet + global tool_root_dir + diff --git a/gdb-rhbz1398387-tab-crash-test.patch b/gdb-rhbz1398387-tab-crash-test.patch index c8fe7b45c3396e424b51d64ac1a8897ea3dd106c..1546bfe04387d26fffe144e4dafb473302aa2019 100644 --- a/gdb-rhbz1398387-tab-crash-test.patch +++ b/gdb-rhbz1398387-tab-crash-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz1398387-tab-crash-test.patch - -;; New testcase for: Fix -completion crash (Gary Benson, RH BZ 1398387). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.base/tab-crash.bz2.uu b/gdb/testsuite/gdb.base/tab-crash.bz2.uu new file mode 100644 --- /dev/null @@ -452,3 +444,4 @@ new file mode 100644 +clean_restart ${debugfile} + +gdb_test "complete p si" "complete p si\r\np size_of_encoded_value" + diff --git a/gdb-rhbz1491128-batch-mode-exit-status-1of2.patch b/gdb-rhbz1491128-batch-mode-exit-status-1of2.patch deleted file mode 100644 index 3648130013d1a07259ebd5f6dcb9c0419b329dc6..0000000000000000000000000000000000000000 --- a/gdb-rhbz1491128-batch-mode-exit-status-1of2.patch +++ /dev/null @@ -1,323 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Gary Benson -Date: Wed, 29 Aug 2018 16:11:50 +0100 -Subject: gdb-rhbz1491128-batch-mode-exit-status-1of2.patch - -;; Fix for 'gdb in batch mode always exit with status 0' (Gary Benson) -;; RHBZ #1491128 - -Indicate batch mode failures by exiting with nonzero status - -This commit causes GDB in batch mode to exit with nonzero status -if the last command to be executed fails. - -gdb/ChangeLog: - - PR gdb/13000: - * gdb/main.c (captured_main_1): Exit with nonzero status - in batch mode if the last command to be executed failed. - * NEWS: Mention the above. - -gdb/testsuite/ChangeLog: - - PR gdb/13000: - * gdb.base/batch-exit-status.exp: New file. - * gdb.base/batch-exit-status.good-commands: Likewise. - * gdb.base/batch-exit-status.bad-commands: Likewise. - -diff --git a/gdb/ChangeLog b/gdb/ChangeLog ---- a/gdb/ChangeLog -+++ b/gdb/ChangeLog -@@ -1,3 +1,10 @@ -+2018-08-16 Gary Benson -+ -+ PR gdb/13000: -+ * gdb/main.c (captured_main_1): Exit with nonzero status -+ in batch mode if the last command to be executed failed. -+ * NEWS: Mention the above. -+ - 2018-08-03 Sergio Durigan Junior - - * ser-tcp.c (net_open): Fix thinko when deciding whether to -diff --git a/gdb/NEWS b/gdb/NEWS ---- a/gdb/NEWS -+++ b/gdb/NEWS -@@ -7,6 +7,9 @@ - can be passed using the '[ADDRESS]:PORT' notation, or the regular - 'ADDRESS:PORT' method. - -+* GDB in batch mode now exits with status 1 if the last command to be -+ executed failed. -+ - *** Changes in GDB 8.2 - - * The 'set disassembler-options' command now supports specifying options -diff --git a/gdb/main.c b/gdb/main.c ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -518,6 +518,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - int i; - int save_auto_load; - struct objfile *objfile; -+ int ret = 1; - - #ifdef HAVE_SBRK - /* Set this before constructing scoped_command_stats. */ -@@ -1051,7 +1052,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - processed; it sets global parameters, which are independent of - what file you are debugging or what directory you are in. */ - if (system_gdbinit && !inhibit_gdbinit) -- catch_command_errors (source_script, system_gdbinit, 0); -+ ret = catch_command_errors (source_script, system_gdbinit, 0); - - /* Read and execute $HOME/.gdbinit file, if it exists. This is done - *before* all the command line arguments are processed; it sets -@@ -1059,7 +1060,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - debugging or what directory you are in. */ - - if (home_gdbinit && !inhibit_gdbinit && !inhibit_home_gdbinit) -- catch_command_errors (source_script, home_gdbinit, 0); -+ ret = catch_command_errors (source_script, home_gdbinit, 0); - - /* Process '-ix' and '-iex' options early. */ - for (i = 0; i < cmdarg_vec.size (); i++) -@@ -1069,12 +1070,12 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - switch (cmdarg_p.type) - { - case CMDARG_INIT_FILE: -- catch_command_errors (source_script, cmdarg_p.string, -- !batch_flag); -+ ret = catch_command_errors (source_script, cmdarg_p.string, -+ !batch_flag); - break; - case CMDARG_INIT_COMMAND: -- catch_command_errors (execute_command, cmdarg_p.string, -- !batch_flag); -+ ret = catch_command_errors (execute_command, cmdarg_p.string, -+ !batch_flag); - break; - } - } -@@ -1082,11 +1083,11 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - /* Now perform all the actions indicated by the arguments. */ - if (cdarg != NULL) - { -- catch_command_errors (cd_command, cdarg, 0); -+ ret = catch_command_errors (cd_command, cdarg, 0); - } - - for (i = 0; i < dirarg.size (); i++) -- catch_command_errors (directory_switch, dirarg[i], 0); -+ ret = catch_command_errors (directory_switch, dirarg[i], 0); - - /* Skip auto-loading section-specified scripts until we've sourced - local_gdbinit (which is often used to augment the source search -@@ -1115,19 +1116,19 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - catch_command_errors returns non-zero on success! - Do not load EXECARG as a symbol file if it has been already processed - as a core file. */ -- if (catch_command_errors (func, execarg, !batch_flag) -- && core_bfd == NULL) -- catch_command_errors (symbol_file_add_main_adapter, symarg, -- !batch_flag); -+ ret = catch_command_errors (func, execarg, !batch_flag); -+ if (ret != 0 && core_bfd == NULL) -+ ret = catch_command_errors (symbol_file_add_main_adapter, -+ symarg, !batch_flag); - } - else - { - if (execarg != NULL) -- catch_command_errors (exec_file_attach, execarg, -- !batch_flag); -+ ret = catch_command_errors (exec_file_attach, execarg, -+ !batch_flag); - if (symarg != NULL) -- catch_command_errors (symbol_file_add_main_adapter, symarg, -- !batch_flag); -+ ret = catch_command_errors (symbol_file_add_main_adapter, -+ symarg, !batch_flag); - } - - if (corearg && pidarg) -@@ -1135,9 +1136,14 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - "a core file at the same time.")); - - if (corearg != NULL) -- catch_command_errors (core_file_command, corearg, !batch_flag); -+ { -+ ret = catch_command_errors (core_file_command, corearg, -+ !batch_flag); -+ } - else if (pidarg != NULL) -- catch_command_errors (attach_command, pidarg, !batch_flag); -+ { -+ ret = catch_command_errors (attach_command, pidarg, !batch_flag); -+ } - else if (pid_or_core_arg) - { - /* The user specified 'gdb program pid' or gdb program core'. -@@ -1146,17 +1152,23 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - - if (isdigit (pid_or_core_arg[0])) - { -- if (catch_command_errors (attach_command, pid_or_core_arg, -- !batch_flag) == 0 -+ ret = catch_command_errors (attach_command, pid_or_core_arg, -+ !batch_flag); -+ if (ret == 0 - /* attach_command could succeed partially and core_file_command - would try to kill it. */ - && !have_inferiors ()) -- catch_command_errors (core_file_command, pid_or_core_arg, -- !batch_flag); -+ ret = catch_command_errors (core_file_command, -+ pid_or_core_arg, -+ !batch_flag); -+ } -+ else -+ { -+ /* Can't be a pid, better be a corefile. */ -+ ret = catch_command_errors (core_file_command, -+ pid_or_core_arg, -+ !batch_flag); - } -- else /* Can't be a pid, better be a corefile. */ -- catch_command_errors (core_file_command, pid_or_core_arg, -- !batch_flag); - } - - if (ttyarg != NULL) -@@ -1180,7 +1192,7 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - { - auto_load_local_gdbinit_loaded = 1; - -- catch_command_errors (source_script, local_gdbinit, 0); -+ ret = catch_command_errors (source_script, local_gdbinit, 0); - } - } - -@@ -1200,12 +1212,12 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - switch (cmdarg_p.type) - { - case CMDARG_FILE: -- catch_command_errors (source_script, cmdarg_p.string, -- !batch_flag); -+ ret = catch_command_errors (source_script, cmdarg_p.string, -+ !batch_flag); - break; - case CMDARG_COMMAND: -- catch_command_errors (execute_command, cmdarg_p.string, -- !batch_flag); -+ ret = catch_command_errors (execute_command, cmdarg_p.string, -+ !batch_flag); - break; - } - } -@@ -1217,8 +1229,11 @@ captured_main_1 (struct captured_main_args *context, int &python_script) - - if (batch_flag) - { -+ int error_status = EXIT_FAILURE; -+ int *exit_arg = ret == 0 ? &error_status : NULL; -+ - /* We have hit the end of the batch file. */ -- quit_force (NULL, 0); -+ quit_force (exit_arg, 0); - } - } - -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog ---- a/gdb/testsuite/ChangeLog -+++ b/gdb/testsuite/ChangeLog -@@ -1,3 +1,10 @@ -+2018-08-16 Gary Benson -+ -+ PR gdb/13000: -+ * gdb.base/batch-exit-status.exp: New file. -+ * gdb.base/batch-exit-status.good-commands: Likewise. -+ * gdb.base/batch-exit-status.bad-commands: Likewise. -+ - 2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser -diff --git a/gdb/testsuite/gdb.base/batch-exit-status.bad-commands b/gdb/testsuite/gdb.base/batch-exit-status.bad-commands -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/batch-exit-status.bad-commands -@@ -0,0 +1 @@ -+bork -diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp -@@ -0,0 +1,63 @@ -+# Copyright (C) 2018 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 . -+ -+# Check that "gdb -batch" exits with appropriate status. -+ -+standard_testfile -+ -+set good_commands "$srcdir/$subdir/batch-exit-status.good-commands" -+set bad_commands "$srcdir/$subdir/batch-exit-status.bad-commands" -+ -+proc _test_exit_status {expect_status cmdline_opts} { -+ global gdb_spawn_id -+ -+ gdb_exit -+ if {[gdb_spawn_with_cmdline_opts $cmdline_opts] != 0} { -+ fail "spawn" -+ return -+ } -+ -+ set result [wait -i $gdb_spawn_id] -+ verbose $result -+ gdb_assert { [lindex $result 2] == 0 } -+ set actual_status [lindex $result 3] -+ gdb_assert { $actual_status == $expect_status } -+} -+ -+proc test_exit_status {expect_status cmdline_opts} { -+ with_test_prefix $cmdline_opts { -+ _test_exit_status $expect_status $cmdline_opts -+ } -+} -+ -+# gdb -batch with nothing to do should exit 0. -+test_exit_status 0 "-batch" -+ -+# Bad command-line options should cause exit 1. -+test_exit_status 1 "-batch -jslkflsdjlkfjlksdjf" -+ -+# gdb -batch with good commands should exit 0. -+test_exit_status 0 "-batch -ex \"info source\"" -+test_exit_status 0 "-batch -x $good_commands" -+ -+# gdb -batch with bad commands should exit 1. -+test_exit_status 1 "-batch -ex \"set not-a-thing 4\"" -+test_exit_status 1 "-batch -x $bad_commands" -+ -+# Success or failure of the last thing determines the exit code. -+test_exit_status 0 "-batch -ex \"set not-a-thing 4\" -x $good_commands" -+test_exit_status 0 "-batch -x $bad_commands -ex \"info source\"" -+test_exit_status 1 "-batch -x $good_commands -x $bad_commands" -+test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\"" -diff --git a/gdb/testsuite/gdb.base/batch-exit-status.good-commands b/gdb/testsuite/gdb.base/batch-exit-status.good-commands -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/batch-exit-status.good-commands -@@ -0,0 +1 @@ -+info mem diff --git a/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch b/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch deleted file mode 100644 index b1ba52393514bd48061422eb0fb91b359c28ac1a..0000000000000000000000000000000000000000 --- a/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch +++ /dev/null @@ -1,65 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Gary Benson -Date: Mon, 3 Sep 2018 16:14:55 +0100 -Subject: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch - -;; Fix for 'gdb in batch mode always exit with status 0' (Gary Benson) -;; RHBZ #1491128 - -Fix batch exit status test failure on Fedora 28 - -This commit adds calls to remote_close and clear_gdb_spawn_id to -gdb.base/batch-exit-status.exp, fixing failures reported by buildbot -on Fedora 28 where gdb_spawn_id not being reset by the previous test -caused default_gdb_spawn to return without spawning. - -This commit also changes the test to use detect GDB's exit using -gdb_test_multiple expecting 'eof', rather than using 'wait -i' alone. -This means the testcase won't hang forever on failure as fixed in -gdb.base/quit.exp by commit 15763a09d4ae ("Fix 'gdb.base/quit.exp -hangs forever' if the test fails"). - -gdb/testsuite/ChangeLog: - - * gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect - 'eof' before 'wait -i'. Use remote_close and clear_gdb_spawn_id. - -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog ---- a/gdb/testsuite/ChangeLog -+++ b/gdb/testsuite/ChangeLog -@@ -1,3 +1,8 @@ -+2018-09-04 Gary Benson -+ -+ * gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect -+ 'eof' before 'wait -i'. Use remote_close and clear_gdb_spawn_id. -+ - 2018-08-16 Gary Benson - - PR gdb/13000: -diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp ---- a/gdb/testsuite/gdb.base/batch-exit-status.exp -+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp -@@ -29,11 +29,18 @@ proc _test_exit_status {expect_status cmdline_opts} { - return - } - -- set result [wait -i $gdb_spawn_id] -- verbose $result -- gdb_assert { [lindex $result 2] == 0 } -- set actual_status [lindex $result 3] -- gdb_assert { $actual_status == $expect_status } -+ gdb_test_multiple "" "run til exit" { -+ eof { -+ set result [wait -i $gdb_spawn_id] -+ verbose $result -+ -+ gdb_assert { [lindex $result 2] == 0 } -+ gdb_assert { [lindex $result 3] == $expect_status } -+ -+ remote_close host -+ clear_gdb_spawn_id -+ } -+ } - } - - proc test_exit_status {expect_status cmdline_opts} { diff --git a/gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch b/gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch new file mode 100644 index 0000000000000000000000000000000000000000..18a9924a624fa63dc1990d45659fab9ce8ae16b6 --- /dev/null +++ b/gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch @@ -0,0 +1,76 @@ +Stop the BFD library from issuing a warning message when processing allocated sections in debuginfo files that lie outside of any loadable segment. + + PR 24717 + * elf.c (is_debuginfo_file): New function. + (assign_file_positions_for_non_load_sections): Do not warn about + allocated sections outside of loadable segments if they are found + in a debuginfo file. + * elf-bfd.h (is_debuginfo_file): Prototype. + +diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h +--- a/bfd/elf-bfd.h ++++ b/bfd/elf-bfd.h +@@ -2751,6 +2751,8 @@ extern bfd_vma elf64_r_sym (bfd_vma); + extern bfd_vma elf32_r_info (bfd_vma, bfd_vma); + extern bfd_vma elf32_r_sym (bfd_vma); + ++extern bfd_boolean is_debuginfo_file (bfd *); ++ + /* Large common section. */ + extern asection _bfd_elf_large_com_section; + +diff --git a/bfd/elf.c b/bfd/elf.c +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -5800,6 +5800,35 @@ assign_file_positions_for_load_sections (bfd *abfd, + return TRUE; + } + ++/* Determine if a bfd is a debuginfo file. Unfortunately there ++ is no defined method for detecting such files, so we have to ++ use heuristics instead. */ ++ ++bfd_boolean ++is_debuginfo_file (bfd *abfd) ++{ ++ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour) ++ return FALSE; ++ ++ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd); ++ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd); ++ Elf_Internal_Shdr **headerp; ++ ++ for (headerp = start_headers; headerp < end_headers; headerp ++) ++ { ++ Elf_Internal_Shdr *header = * headerp; ++ ++ /* Debuginfo files do not have any allocated SHT_PROGBITS sections. ++ The only allocated sections are SHT_NOBITS or SHT_NOTES. */ ++ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC ++ && header->sh_type != SHT_NOBITS ++ && header->sh_type != SHT_NOTE) ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ + /* Assign file positions for the other sections. */ + + static bfd_boolean +@@ -5833,7 +5862,13 @@ assign_file_positions_for_non_load_sections (bfd *abfd, + BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos); + else if ((hdr->sh_flags & SHF_ALLOC) != 0) + { +- if (hdr->sh_size != 0) ++ if (hdr->sh_size != 0 ++ /* PR 24717 - debuginfo files are known to be not strictly ++ compliant with the ELF standard. In particular they often ++ have .note.gnu.property sections that are outside of any ++ loadable segment. This is not a problem for such files, ++ so do not warn about them. */ ++ && ! is_debuginfo_file (abfd)) + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB: warning: allocated section `%s' not in segment"), + diff --git a/gdb-rhbz1553104-s390x-arch12-test.patch b/gdb-rhbz1553104-s390x-arch12-test.patch index 2cb15e5b25fddfc2bec064b5009d8d273e87286c..d4484483817abe9a0122b2d7077755f0024f80cf 100644 --- a/gdb-rhbz1553104-s390x-arch12-test.patch +++ b/gdb-rhbz1553104-s390x-arch12-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 23 Mar 2018 20:42:44 +0100 -Subject: gdb-rhbz1553104-s390x-arch12-test.patch - -;; [s390x] Backport arch12 instructions decoding (RH BZ 1553104). -;; =fedoratest - diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S new file mode 100644 --- /dev/null @@ -79,3 +71,4 @@ new file mode 100644 +H`````````2@`````````#@````````````````````$````````````` +` +end + diff --git a/gdb-rhbz1704406-disable-style-log-output-1of3.patch b/gdb-rhbz1704406-disable-style-log-output-1of3.patch new file mode 100644 index 0000000000000000000000000000000000000000..35b1b289e887e3c2a595ad465a08b2eb6621f840 --- /dev/null +++ b/gdb-rhbz1704406-disable-style-log-output-1of3.patch @@ -0,0 +1,81 @@ +Add "style" proc to the test suite + +This adds a "style" helper proc to the test suite, and updates +existing style tests to use it. Thanks to Sergio for the idea. + +Tested on x86-64 Fedora 29. + +gdb/testsuite/ChangeLog +2019-05-22 Tom Tromey + + * gdb.base/info-shared.exp (check_info_shared): Use "style". + * gdb.base/style.exp: Use "style". + * lib/gdb-utils.exp (style): New proc. + +diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp +--- a/gdb/testsuite/gdb.base/style.exp ++++ b/gdb/testsuite/gdb.base/style.exp +@@ -41,10 +41,10 @@ save_vars { env(TERM) } { + + gdb_test_no_output "set style enabled on" + +- set main_expr "\033\\\[33mmain\033\\\[m" +- set base_file_expr "\033\\\[32m.*style\\.c\033\\\[m" ++ set main_expr [style main function] ++ set base_file_expr [style ".*style\\.c" file] + set file_expr "$base_file_expr:\[0-9\]" +- set arg_expr "\033\\\[36marg.\033\\\[m" ++ set arg_expr [style "arg." variable] + + gdb_test "frame" \ + "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*" +@@ -58,7 +58,7 @@ save_vars { env(TERM) } { + + gdb_test "break main" "file $base_file_expr.*" + +- gdb_test "print &main" " = .* \033\\\[34m$hex\033\\\[m <$main_expr>" ++ gdb_test "print &main" " = .* [style $hex address] <$main_expr>" + + # Regression test for a bug where line-wrapping would occur at the + # wrong spot with styling. There were different bugs at different +@@ -86,11 +86,12 @@ save_vars { env(TERM) } { + gdb_exit + gdb_spawn + +- gdb_test "" "\033\\\[35;1mGNU gdb.*\033\\\[m.*" \ ++ set vers [style "GNU gdb.*" "35;1"] ++ gdb_test "" "${vers}.*" \ + "version is styled" + + set quoted [string_to_regexp $binfile] + gdb_test "file $binfile" \ +- "Reading symbols from \033\\\[32m${quoted}\033\\\[m..." \ ++ "Reading symbols from [style $quoted file]..." \ + "filename is styled when loading symbol file" + } +diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp +--- a/gdb/testsuite/lib/gdb-utils.exp ++++ b/gdb/testsuite/lib/gdb-utils.exp +@@ -37,3 +37,21 @@ proc string_to_regexp {str} { + regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result + return $result + } ++ ++# Wrap STR in an ANSI terminal escape sequences -- one to set the ++# style to STYLE, and one to reset the style to the default. The ++# return value is suitable for use as a regular expression. ++ ++# STYLE can either be the payload part of an ANSI terminal sequence, ++# or a shorthand for one of the gdb standard styles: "file", ++# "function", "variable", or "address". ++ ++proc style {str style} { ++ switch -exact -- $style { ++ file { set style 32 } ++ function { set style 33 } ++ variable { set style 36 } ++ address { set style 34 } ++ } ++ return "\033\\\[${style}m${str}\033\\\[m" ++} + diff --git a/gdb-rhbz1704406-disable-style-log-output-2of3.patch b/gdb-rhbz1704406-disable-style-log-output-2of3.patch new file mode 100644 index 0000000000000000000000000000000000000000..ad1533270855634880fdfadc92d646575b614d82 --- /dev/null +++ b/gdb-rhbz1704406-disable-style-log-output-2of3.patch @@ -0,0 +1,187 @@ +Do not emit style escape sequences to log file + +PR gdb/24502 requests that the "set logging" log file not contain +style escape sequences emitted by gdb. + +This seemed like a reasonable request to me, so this patch implements +filtering for the log file. + +This also updates a comment in ui-style.h that I noticed while writing +the patch. + +Tested on x86-64 Fedora 29. + +gdb/ChangeLog +2019-06-14 Tom Tromey + + PR gdb/24502: + * ui-style.h (skip_ansi_escape): Update comment. + * ui-file.h (class no_terminal_escape_file): New class. + * ui-file.c (no_terminal_escape_file::write) + (no_terminal_escape_file::puts): New methods. + * cli/cli-logging.c (handle_redirections): Use + no_terminal_escape_file. + +gdb/testsuite/ChangeLog +2019-06-14 Tom Tromey + + PR gdb/24502: + * gdb.base/style-logging.exp: New file. + +diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c +--- a/gdb/cli/cli-logging.c ++++ b/gdb/cli/cli-logging.c +@@ -117,7 +117,7 @@ handle_redirections (int from_tty) + return; + } + +- stdio_file_up log (new stdio_file ()); ++ stdio_file_up log (new no_terminal_escape_file ()); + if (!log->open (logging_filename, logging_overwrite ? "w" : "a")) + perror_with_name (_("set logging")); + +diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/style-logging.exp +@@ -0,0 +1,64 @@ ++# Copyright 2019 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 . ++ ++# Test that logging does not style. ++ ++if {[is_remote host]} { ++ untested "does not work on remote host" ++ return 0 ++} ++ ++standard_testfile style.c ++ ++save_vars { env(TERM) } { ++ # We need an ANSI-capable terminal to get the output. ++ setenv TERM ansi ++ ++ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { ++ return -1 ++ } ++ ++ if {![runto_main]} { ++ fail "style tests failed" ++ return ++ } ++ ++ gdb_test_no_output "set style enabled on" ++ ++ set log_name [standard_output_file log.txt] ++ gdb_test_no_output "set logging file $log_name" ++ gdb_test_no_output "set logging overwrite on" ++ gdb_test "set logging on" "Copying output to .*" ++ ++ set main_expr [style main function] ++ set base_file_expr [style ".*style\\.c" file] ++ set file_expr "$base_file_expr:\[0-9\]" ++ set arg_expr [style "arg." variable] ++ gdb_test "frame" \ ++ "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*" ++ ++ gdb_test "set logging off" "Done logging to .*" ++ ++ set fd [open $log_name] ++ set data [read -nonewline $fd] ++ close $fd ++ ++ set testname "log is escape-free" ++ if {[regexp "\033" $data]} { ++ fail $testname ++ } else { ++ pass $testname ++ } ++} +diff --git a/gdb/ui-file.c b/gdb/ui-file.c +--- a/gdb/ui-file.c ++++ b/gdb/ui-file.c +@@ -332,3 +332,33 @@ tee_file::isatty () + { + return m_one->isatty (); + } ++ ++void ++no_terminal_escape_file::write (const char *buf, long length_buf) ++{ ++ std::string copy (buf, length_buf); ++ this->puts (copy.c_str ()); ++} ++ ++/* See ui-file.h. */ ++ ++void ++no_terminal_escape_file::puts (const char *buf) ++{ ++ while (*buf != '\0') ++ { ++ const char *esc = strchr (buf, '\033'); ++ if (esc == nullptr) ++ break; ++ ++ int n_read = 0; ++ if (!skip_ansi_escape (esc, &n_read)) ++ ++esc; ++ ++ this->stdio_file::write (buf, esc - buf); ++ buf = esc + n_read; ++ } ++ ++ if (*buf != '\0') ++ this->stdio_file::write (buf, strlen (buf)); ++} +diff --git a/gdb/ui-file.h b/gdb/ui-file.h +--- a/gdb/ui-file.h ++++ b/gdb/ui-file.h +@@ -264,4 +264,20 @@ private: + bool m_close_one, m_close_two; + }; + ++/* A ui_file implementation that filters out terminal escape ++ sequences. */ ++ ++class no_terminal_escape_file : public stdio_file ++{ ++public: ++ no_terminal_escape_file () ++ { ++ } ++ ++ /* Like the stdio_file methods, but these filter out terminal escape ++ sequences. */ ++ void write (const char *buf, long length_buf) override; ++ void puts (const char *linebuffer) override; ++}; ++ + #endif +diff --git a/gdb/ui-style.h b/gdb/ui-style.h +--- a/gdb/ui-style.h ++++ b/gdb/ui-style.h +@@ -233,8 +233,8 @@ private: + + /* Skip an ANSI escape sequence in BUF. BUF must begin with an ESC + character. Return true if an escape sequence was successfully +- skipped; false otherwise. In either case, N_READ is updated to +- reflect the number of chars read from BUF. */ ++ skipped; false otherwise. If an escape sequence was skipped, ++ N_READ is updated to reflect the number of chars read from BUF. */ + + extern bool skip_ansi_escape (const char *buf, int *n_read); + + diff --git a/gdb-rhbz1704406-disable-style-log-output-3of3.patch b/gdb-rhbz1704406-disable-style-log-output-3of3.patch new file mode 100644 index 0000000000000000000000000000000000000000..f2301021dcbf65ce37f454daa612398532848699 --- /dev/null +++ b/gdb-rhbz1704406-disable-style-log-output-3of3.patch @@ -0,0 +1,23 @@ +gdb: Remove file path from test name + +Having paths in test names makes comparing sum files difficult, rename +a test to avoid paths in test names. + +gdb/testsuite/ChangeLog: + + * gdb.base/style-logging.exp: Remove path from test name. + +diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp +--- a/gdb/testsuite/gdb.base/style-logging.exp ++++ b/gdb/testsuite/gdb.base/style-logging.exp +@@ -38,7 +38,8 @@ save_vars { env(TERM) } { + gdb_test_no_output "set style enabled on" + + set log_name [standard_output_file log.txt] +- gdb_test_no_output "set logging file $log_name" ++ gdb_test_no_output "set logging file $log_name" \ ++ "set logging filename" + gdb_test_no_output "set logging overwrite on" + gdb_test "set logging on" "Copying output to .*" + + diff --git a/gdb-rhbz1708192-parse_macro_definition-crash.patch b/gdb-rhbz1708192-parse_macro_definition-crash.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca89553ff291db56cf08afd7d403a650ff25e7ae --- /dev/null +++ b/gdb-rhbz1708192-parse_macro_definition-crash.patch @@ -0,0 +1,61 @@ +Don't crash if dwarf_decode_macro_bytes's 'body' is NULL + +Hi, + +Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192 + https://bugzilla.redhat.com/show_bug.cgi?id=1708786 + +During the Fedora RPM build process, gdb-add-index is invoked to +extract the DWARF index from the binary, and GDB will segfault because +dwarf2read.c:parse_definition_macro's 'body' variable is NULL. + +The underlying problem is that Fedora's rpm-build's "debugedit" +program will silently corrupt .debug_macro strings when a binary is +compiled with -g3. This is being taken care of by Mark Wielaard, +here: + + https://bugzilla.redhat.com/show_bug.cgi?id=1708786 + +However, I still feel it's important to make GDB more resilient +against invalid DWARF input, so I'm proposing this rather simple patch +to catch the situation when "body == NULL" (i.e., it's probably been +corrupted) and issue a complaint. This is not a real fix to the +problem, of course, but at least GDB is able to finish without +segfaulting. + +OK for master? + +gdb/ChangeLog: +2019-05-15 Sergio Durigan Junior + + Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192 + * dwarf2read.c (dwarf_decode_macro_bytes): Check whether 'body' is + NULL, and complain if that's the case. + +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -24627,7 +24627,21 @@ dwarf_decode_macro_bytes (struct dwarf2_cu *cu, + is_define ? _("definition") : _("undefinition"), + line == 0 ? _("zero") : _("non-zero"), line, body); + +- if (is_define) ++ if (body == NULL) ++ { ++ /* Fedora's rpm-build's "debugedit" binary ++ corrupted .debug_macro sections. ++ ++ For more info, see ++ https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */ ++ complaint (_("debug info gives %s invalid macro %s " ++ "without body (corrupted?) at line %d " ++ "on file %s"), ++ at_commandline ? _("command-line") : _("in-file"), ++ is_define ? _("definition") : _("undefinition"), ++ line, current_file->filename); ++ } ++ else if (is_define) + parse_macro_definition (current_file, line, body); + else + { + diff --git a/gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch b/gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c7ab3c92e528eb9cb12826b3f3cd200db657bc7 --- /dev/null +++ b/gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch @@ -0,0 +1,103 @@ +Fix crash when using PYTHONMALLOC=debug (PR python/24742) + +This bug was originally reported against Fedora GDB: + + https://bugzilla.redhat.com/show_bug.cgi?id=1723564 + +The problem is that GDB will crash in the following scenario: + +- PYTHONMALLOC=debug or PYTHONDEVMODE=1 is set. + +- The Python debuginfo is installed. + +- GDB is used to debug Python. + +The crash looks like this: + + $ PYTHONMALLOC=debug gdb -args python3 -c pass + GNU gdb (GDB) Fedora 8.3-3.fc30 + Reading symbols from python3... + Reading symbols from /usr/lib/debug/usr/bin/python3.7m-3.7.3-3.fc30.x86_64.debug... + (gdb) run + Starting program: /usr/bin/python3 -c pass + Missing separate debuginfos, use: dnf debuginfo-install glibc-2.29-9.fc30.x86_64 + Debug memory block at address p=0x5603977bf330: API '' + 8098648152243306496 bytes originally requested + The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfb): + at p-7: 0x03 *** OUCH + at p-6: 0x00 *** OUCH + at p-5: 0x00 *** OUCH + at p-4: 0x00 *** OUCH + at p-3: 0x00 *** OUCH + at p-2: 0x00 *** OUCH + at p-1: 0x00 *** OUCH + Because memory is corrupted at the start, the count of bytes requested + may be bogus, and checking the trailing pad bytes may segfault. + The 8 pad bytes at tail=0x706483999ad1f330 are Segmentation fault (core dumped) + +It's hard to determine what happens, but after doing some +investigation and talking to Victor Stinner I found that GDB should +not use the Python memory allocation functions before the Python +interpreter is initialized (which makes sense). However, we do just +that on python/python.c:do_start_initialization: + + ... + progsize = strlen (progname.get ()); + progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t)); + ... + /* Note that Py_SetProgramName expects the string it is passed to + remain alive for the duration of the program's execution, so + it is not freed after this call. */ + Py_SetProgramName (progname_copy); + ... + Py_Initialize (); + PyEval_InitThreads (); + +Upon reading the Python 3 C API documentation, I +found (https://docs.python.org/3.5/c-api/memory.html): + + To avoid memory corruption, extension writers should never try to + operate on Python objects with the functions exported by the C + library: malloc(), calloc(), realloc() and free(). This will result in + mixed calls between the C allocator and the Python memory manager with + fatal consequences, because they implement different algorithms and + operate on different heaps. However, one may safely allocate and + release memory blocks with the C library allocator for individual + purposes[...] + +And Py_SetProgramName seems like a very simple call that doesn't need +a Python-allocated memory to work on. So I'm proposing this patch, +which simply replaces PyMem_Malloc by xmalloc. + +Testing this is more complicated. First, the crash is completely +non-deterministic; I was able to reproduce it 10 times in a row, and +then I wasn't able to reproduce it anymore. I found that if you +completely remove your build directory and rebuild GDB from scratch, +you can reproduce it again confidently. And with my patch, I +confirmed that the bug doesn't manifest even in this situation. + +No regressions found. + +OK to apply? + +gdb/ChangeLog: +2019-06-28 Sergio Durigan Junior + + PR python/24742 + https://bugzilla.redhat.com/show_bug.cgi?id=1723564 + * python/python.c (do_start_initialization): Use 'xmalloc' + instead of 'PyMem_Malloc'. + +diff --git a/gdb/python/python.c b/gdb/python/python.c +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -1720,7 +1720,7 @@ do_start_initialization () + std::string oldloc = setlocale (LC_ALL, NULL); + setlocale (LC_ALL, ""); + progsize = strlen (progname.get ()); +- progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t)); ++ progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t)); + if (!progname_copy) + { + fprintf (stderr, "out of memory\n"); + diff --git a/gdb-rhbz795424-bitpos-20of25.patch b/gdb-rhbz795424-bitpos-20of25.patch index 6082e3e0cc9604c8e15ce6c477c78354206fec37..42359e482d0c4502237e402d5077e1783936399b 100644 --- a/gdb-rhbz795424-bitpos-20of25.patch +++ b/gdb-rhbz795424-bitpos-20of25.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-20of25.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - http://sourceware.org/ml/gdb-patches/2012-09/msg00631.html --MP_/yp5f+W_ED2JtUlSyBi8xujr @@ -519,17 +510,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c static struct type *decode_constrained_packed_array_type (struct type *); -@@ -190,7 +190,8 @@ static int ada_is_unconstrained_packed_array_type (struct type *); - static struct value *value_subscript_packed (struct value *, int, - struct value **); - --static void move_bits (gdb_byte *, int, const gdb_byte *, int, int, int); -+static void move_bits (gdb_byte *, int, const gdb_byte *, LONGEST, LONGEST, -+ int); - - static struct value *coerce_unspec_val_to_type (struct value *, - struct type *); -@@ -216,14 +217,14 @@ static struct value *value_val_atr (struct type *, struct value *); +@@ -214,14 +214,14 @@ static struct value *value_val_atr (struct type *, struct value *); static struct symbol *standard_lookup (const char *, const struct block *, domain_enum); @@ -548,7 +529,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c static int ada_resolve_function (struct block_symbol *, int, struct value **, int, const char *, -@@ -234,7 +235,7 @@ static int ada_is_direct_array_type (struct type *); +@@ -232,7 +232,7 @@ static int ada_is_direct_array_type (struct type *); static void ada_language_arch_info (struct gdbarch *, struct language_arch_info *); @@ -557,7 +538,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *); static struct value *assign_aggregate (struct value *, struct value *, -@@ -697,7 +698,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) +@@ -701,7 +701,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) } static const gdb_byte * @@ -566,7 +547,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c { if (valaddr == NULL) return NULL; -@@ -706,7 +707,7 @@ cond_offset_host (const gdb_byte *valaddr, long offset) +@@ -710,7 +710,7 @@ cond_offset_host (const gdb_byte *valaddr, long offset) } static CORE_ADDR @@ -575,7 +556,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c { if (address == 0) return 0; -@@ -1743,7 +1744,7 @@ desc_bounds (struct value *arr) +@@ -1752,7 +1752,7 @@ desc_bounds (struct value *arr) /* If TYPE is the type of an array-descriptor (fat pointer), the bit position of the field containing the address of the bounds data. */ @@ -584,7 +565,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c fat_pntr_bounds_bitpos (struct type *type) { return TYPE_FIELD_BITPOS (desc_base_type (type), 1); -@@ -1809,7 +1810,7 @@ desc_data (struct value *arr) +@@ -1818,7 +1818,7 @@ desc_data (struct value *arr) /* If TYPE is the type of an array-descriptor (fat pointer), the bit position of the field containing the address of the data. */ @@ -593,7 +574,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c fat_pntr_data_bitpos (struct type *type) { return TYPE_FIELD_BITPOS (desc_base_type (type), 0); -@@ -1844,7 +1845,7 @@ desc_one_bound (struct value *bounds, int i, int which) +@@ -1853,7 +1853,7 @@ desc_one_bound (struct value *bounds, int i, int which) of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper bound, if WHICH is 1. The first bound is I=1. */ @@ -602,7 +583,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c desc_bound_bitpos (struct type *type, int i, int which) { return TYPE_FIELD_BITPOS (desc_base_type (type), 2 * i + which - 2); -@@ -2034,7 +2035,7 @@ ada_type_of_array (struct value *arr, int bounds) +@@ -2043,7 +2043,7 @@ ada_type_of_array (struct value *arr, int bounds) zero, and does not need to be recomputed. */ if (lo < hi) { @@ -611,7 +592,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0); TYPE_LENGTH (array_type) = (array_bitsize + 7) / 8; -@@ -2194,7 +2195,7 @@ decode_packed_array_bitsize (struct type *type) +@@ -2203,7 +2203,7 @@ decode_packed_array_bitsize (struct type *type) the length is arbitrary. */ static struct type * @@ -620,7 +601,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c { struct type *new_elt_type; struct type *new_type; -@@ -2248,7 +2249,7 @@ decode_constrained_packed_array_type (struct type *type) +@@ -2257,7 +2257,7 @@ decode_constrained_packed_array_type (struct type *type) char *name; const char *tail; struct type *shadow_type; @@ -629,7 +610,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c if (!raw_name) raw_name = ada_type_name (desc_base_type (type)); -@@ -2319,7 +2320,8 @@ decode_constrained_packed_array (struct value *arr) +@@ -2328,7 +2328,8 @@ decode_constrained_packed_array (struct value *arr) array with no wrapper. In order to interpret the value through the (left-justified) packed array type we just built, we must first left-justify it. */ @@ -639,7 +620,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c ULONGEST mod; mod = ada_modulus (value_type (arr)) - 1; -@@ -2547,7 +2549,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, +@@ -2556,7 +2557,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, struct value * ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, @@ -648,7 +629,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { struct value *v; -@@ -2617,7 +2619,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, +@@ -2626,7 +2627,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, if (obj != NULL) { @@ -657,16 +638,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c set_value_component_location (v, obj); set_value_bitpos (v, bit_offset + value_bitpos (obj)); -@@ -2663,7 +2665,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, - not overlap. */ - static void - move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source, -- int src_offset, int n, int bits_big_endian_p) -+ LONGEST src_offset, LONGEST n, int bits_big_endian_p) - { - unsigned int accum, mask; - int accum_bits, chunk_size; -@@ -2753,7 +2755,7 @@ ada_value_assign (struct value *toval, struct value *fromval) +@@ -2696,7 +2697,7 @@ ada_value_assign (struct value *toval, struct value *fromval) { int len = (value_bitpos (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; @@ -675,7 +647,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c gdb_byte *buffer = (gdb_byte *) alloca (len); struct value *val; CORE_ADDR to_addr = value_address (toval); -@@ -2804,7 +2806,7 @@ value_assign_to_component (struct value *container, struct value *component, +@@ -2747,7 +2748,7 @@ value_assign_to_component (struct value *container, struct value *component, (LONGEST) (value_address (component) - value_address (container)); int bit_offset_in_container = value_bitpos (component) - value_bitpos (container); @@ -684,7 +656,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c val = value_cast (value_type (component), val); -@@ -4462,7 +4464,7 @@ ensure_lval (struct value *val) +@@ -4445,7 +4446,7 @@ ensure_lval (struct value *val) if (VALUE_LVAL (val) == not_lval || VALUE_LVAL (val) == lval_internalvar) { @@ -693,7 +665,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c const CORE_ADDR addr = value_as_long (value_allocate_space_in_inferior (len)); -@@ -4546,7 +4548,7 @@ static CORE_ADDR +@@ -4529,7 +4530,7 @@ static CORE_ADDR value_pointer (struct value *value, struct type *type) { struct gdbarch *gdbarch = get_type_arch (type); @@ -702,7 +674,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c gdb_byte *buf = (gdb_byte *) alloca (len); CORE_ADDR addr; -@@ -6657,7 +6659,7 @@ value_tag_from_contents_and_address (struct type *type, +@@ -6642,7 +6643,7 @@ value_tag_from_contents_and_address (struct type *type, const gdb_byte *valaddr, CORE_ADDR address) { @@ -711,7 +683,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *tag_type; if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, -@@ -7150,7 +7152,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) +@@ -7135,7 +7136,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) only in that it can handle packed values of arbitrary type. */ static struct value * @@ -720,7 +692,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *arg_type) { struct type *type; -@@ -7162,7 +7164,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, +@@ -7147,7 +7148,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0) { @@ -729,7 +701,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); return ada_value_primitive_packed_val (arg1, value_contents (arg1), -@@ -7239,9 +7241,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, +@@ -7224,9 +7225,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, Returns 1 if found, 0 otherwise. */ static int @@ -741,7 +713,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c int *index_p) { int i; -@@ -7260,8 +7262,8 @@ find_struct_field (const char *name, struct type *type, int offset, +@@ -7245,8 +7246,8 @@ find_struct_field (const char *name, struct type *type, int offset, for (i = 0; i < TYPE_NFIELDS (type); i += 1) { @@ -752,7 +724,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c const char *t_field_name = TYPE_FIELD_NAME (type, i); if (t_field_name == NULL) -@@ -7363,7 +7365,7 @@ num_visible_fields (struct type *type) +@@ -7348,7 +7349,7 @@ num_visible_fields (struct type *type) long explanation in find_struct_field's function documentation. */ static struct value * @@ -761,7 +733,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { int i; -@@ -7411,7 +7413,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, +@@ -7396,7 +7397,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, int j; struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -770,7 +742,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c for (j = 0; j < TYPE_NFIELDS (field_type); j += 1) { -@@ -7443,8 +7445,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, +@@ -7428,8 +7429,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, return NULL; } @@ -781,7 +753,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c /* Return field #INDEX in ARG, where the index is that returned by -@@ -7453,7 +7455,7 @@ static struct value *ada_index_struct_field_1 (int *, struct value *, +@@ -7438,7 +7439,7 @@ static struct value *ada_index_struct_field_1 (int *, struct value *, * If found, return value, else return NULL. */ static struct value * @@ -790,7 +762,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { return ada_index_struct_field_1 (&index, arg, offset, type); -@@ -7465,7 +7467,7 @@ ada_index_struct_field (int index, struct value *arg, int offset, +@@ -7450,7 +7451,7 @@ ada_index_struct_field (int index, struct value *arg, int offset, * *INDEX_P. */ static struct value * @@ -799,7 +771,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { int i; -@@ -7555,7 +7557,8 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) +@@ -7541,7 +7542,8 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) v = ada_search_struct_field (name, arg, 0, t); else { @@ -809,7 +781,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *field_type; CORE_ADDR address; -@@ -7899,8 +7902,8 @@ ada_coerce_ref (struct value *val0) +@@ -7890,8 +7892,8 @@ ada_coerce_ref (struct value *val0) /* Return OFF rounded upward if necessary to a multiple of ALIGNMENT (a power of 2). */ @@ -820,7 +792,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c { return (off + alignment - 1) & ~(alignment - 1); } -@@ -8290,10 +8293,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, +@@ -8281,10 +8283,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, struct value *mark = value_mark (); struct value *dval; struct type *rtype; @@ -833,7 +805,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c int f; /* Compute the number of fields in this record type that are going -@@ -8370,7 +8372,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, +@@ -8361,7 +8362,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, that follow this one. */ if (ada_is_aligner_type (field_type)) { @@ -842,7 +814,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c field_valaddr = cond_offset_host (field_valaddr, field_offset); field_address = cond_offset_target (field_address, field_offset); -@@ -8506,11 +8508,11 @@ ada_template_to_fixed_record_type_1 (struct type *type, +@@ -8497,11 +8498,11 @@ ada_template_to_fixed_record_type_1 (struct type *type, if (TYPE_LENGTH (type) <= 0) { if (TYPE_NAME (rtype)) @@ -858,7 +830,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c } else { -@@ -8974,7 +8976,8 @@ to_fixed_array_type (struct type *type0, struct value *dval, +@@ -8965,7 +8966,8 @@ to_fixed_array_type (struct type *type0, struct value *dval, type was a regular (non-packed) array type. As a result, the bitsize of the array elements needs to be set again, and the array length needs to be recomputed based on that bitsize. */ @@ -889,7 +861,7 @@ diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h const struct value_print_options *); struct value *ada_convert_actual (struct value *actual, -@@ -261,7 +261,7 @@ extern int ada_is_constrained_packed_array_type (struct type *); +@@ -263,7 +263,7 @@ extern int ada_is_constrained_packed_array_type (struct type *); extern struct value *ada_value_primitive_packed_val (struct value *, const gdb_byte *, @@ -901,7 +873,7 @@ diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c -@@ -896,8 +896,8 @@ ada_print_type (struct type *type0, const char *varstring, +@@ -895,8 +895,8 @@ ada_print_type (struct type *type0, const char *varstring, const char *name = ada_type_name (type); if (!ada_is_range_type_name (name)) @@ -912,7 +884,7 @@ diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c else { fprintf_filtered (stream, "range "); -@@ -918,7 +918,8 @@ ada_print_type (struct type *type0, const char *varstring, +@@ -917,7 +917,8 @@ ada_print_type (struct type *type0, const char *varstring, } break; case TYPE_CODE_FLT: @@ -1072,7 +1044,7 @@ diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c -@@ -727,7 +727,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -732,7 +732,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, gdb_byte *readbuf, const gdb_byte *writebuf) { enum amd64_reg_class theclass[2]; @@ -1081,7 +1053,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM }; static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM }; int integer_reg = 0; -@@ -844,10 +844,10 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -849,10 +849,10 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, gdb_assert (regnum != -1); if (readbuf) @@ -1126,7 +1098,7 @@ diff --git a/gdb/annotate.c b/gdb/annotate.c diff --git a/gdb/annotate.h b/gdb/annotate.h --- a/gdb/annotate.h +++ b/gdb/annotate.h -@@ -102,8 +102,8 @@ extern void annotate_frame_source_end (void); +@@ -105,8 +105,8 @@ extern void annotate_frame_source_end (void); extern void annotate_frame_where (void); extern void annotate_frame_end (void); @@ -1140,7 +1112,7 @@ diff --git a/gdb/annotate.h b/gdb/annotate.h diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c -@@ -228,7 +228,7 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, +@@ -227,7 +227,7 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, const struct floatformat ** default_floatformat_for_type (struct gdbarch *gdbarch, @@ -1164,7 +1136,7 @@ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c -@@ -1098,7 +1098,7 @@ arm_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, +@@ -1096,7 +1096,7 @@ arm_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, /* Are we able to use a hardware watchpoint for the LEN bytes starting at ADDR? */ int @@ -1299,7 +1271,7 @@ diff --git a/gdb/ax.h b/gdb/ax.h diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -2059,9 +2059,9 @@ should_be_inserted (struct bp_location *bl) +@@ -2056,9 +2056,9 @@ should_be_inserted (struct bp_location *bl) { fprintf_unfiltered (gdb_stdlog, "infrun: stepping past non-steppable watchpoint. " @@ -1311,7 +1283,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c } return 0; } -@@ -6822,7 +6822,7 @@ breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, +@@ -6793,7 +6793,7 @@ breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, static int breakpoint_address_match_range (const address_space *aspace1, CORE_ADDR addr1, @@ -1320,7 +1292,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c CORE_ADDR addr2) { return ((gdbarch_has_global_breakpoints (target_gdbarch ()) -@@ -10905,7 +10905,7 @@ can_use_hardware_watchpoint (const std::vector &vals) +@@ -10859,7 +10859,7 @@ can_use_hardware_watchpoint (const std::vector &vals) && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { CORE_ADDR vaddr = value_address (v); @@ -1341,7 +1313,7 @@ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h /* If the breakpoint lives in memory and reading that memory would give back the breakpoint, instead of the original contents, then -@@ -429,7 +429,7 @@ public: +@@ -417,7 +417,7 @@ public: /* For hardware watchpoints, the size of the memory region being watched. For hardware ranged breakpoints, the size of the breakpoint range. */ @@ -1445,7 +1417,7 @@ diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c -@@ -307,11 +307,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, +@@ -270,11 +270,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, default: fprintf_unfiltered (stream, @@ -1571,7 +1543,7 @@ diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -1817,7 +1817,7 @@ rw_pieced_value (struct value *v, struct value *from) +@@ -1625,7 +1625,7 @@ rw_pieced_value (struct value *v, struct value *from) for (; i < c->pieces.size () && offset < max_offset; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1580,7 +1552,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c this_size_bits = p->size - bits_to_skip; if (this_size_bits > max_offset - offset) -@@ -2064,7 +2064,7 @@ write_pieced_value (struct value *to, struct value *from) +@@ -1872,7 +1872,7 @@ write_pieced_value (struct value *to, struct value *from) static int check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, @@ -1589,7 +1561,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c { struct piece_closure *c = (struct piece_closure *) value_computed_closure (value); -@@ -2077,7 +2077,7 @@ check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, +@@ -1885,7 +1885,7 @@ check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, for (i = 0; i < c->pieces.size () && bit_length > 0; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1598,7 +1570,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c if (bit_offset > 0) { -@@ -2179,8 +2179,8 @@ indirect_pieced_value (struct value *value) +@@ -1989,8 +1989,8 @@ indirect_pieced_value (struct value *value) = (struct piece_closure *) value_computed_closure (value); struct type *type; struct frame_info *frame; @@ -1609,7 +1581,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c struct dwarf_expr_piece *piece = NULL; LONGEST byte_offset; enum bfd_endian byte_order; -@@ -2197,7 +2197,7 @@ indirect_pieced_value (struct value *value) +@@ -2007,7 +2007,7 @@ indirect_pieced_value (struct value *value) for (i = 0; i < c->pieces.size () && bit_length > 0; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1618,7 +1590,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c if (bit_offset > 0) { -@@ -2486,9 +2486,9 @@ if (frame != NULL) select_frame (frame); +@@ -2296,9 +2296,9 @@ if (frame != NULL) select_frame (frame); case DWARF_VALUE_STACK: { struct value *value = ctx.fetch (0); @@ -1634,7 +1606,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -2021,11 +2021,11 @@ dwarf2_complex_location_expr_complaint (void) +@@ -2065,11 +2065,11 @@ dwarf2_complex_location_expr_complaint (void) } static void @@ -1650,7 +1622,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } static void -@@ -14953,8 +14953,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, +@@ -15104,8 +15104,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, object, and then subtract off the number of bits of the field itself. The result is the bit offset of the LSB of the field. */ @@ -1683,7 +1655,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c if (exp->elts[*pos].opcode == BINOP_COMMA) { -@@ -800,11 +801,11 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, +@@ -799,11 +800,11 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, /* FIXME: Also mixed integral/booleans, with result an integer. */ { const struct builtin_type *builtin = builtin_type (gdbarch); @@ -1698,7 +1670,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c int unsigned_operation; /* Determine type length and signedness after promotion for -@@ -1546,7 +1547,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1553,7 +1554,7 @@ evaluate_subexp_standard (struct type *expect_type, struct value **argvec; int code; int ix; @@ -1707,7 +1679,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c struct type **arg_types; pc = (*pos)++; -@@ -1729,7 +1730,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1738,7 +1739,7 @@ evaluate_subexp_standard (struct type *expect_type, struct type *range_type = TYPE_INDEX_TYPE (type); struct type *element_type = TYPE_TARGET_TYPE (type); struct value *array = allocate_value (expect_type); @@ -1731,7 +1703,7 @@ diff --git a/gdb/f-lang.c b/gdb/f-lang.c diff --git a/gdb/f-lang.h b/gdb/f-lang.h --- a/gdb/f-lang.h +++ b/gdb/f-lang.h -@@ -28,7 +28,7 @@ extern int f_parse (struct parser_state *); +@@ -31,7 +31,7 @@ extern int f_parse (struct parser_state *); extern void f_print_type (struct type *, const char *, struct ui_file *, int, int, const struct type_print_options *); @@ -1832,7 +1804,7 @@ diff --git a/gdb/findvar.c b/gdb/findvar.c diff --git a/gdb/frame.c b/gdb/frame.c --- a/gdb/frame.c +++ b/gdb/frame.c -@@ -1396,7 +1396,7 @@ deprecated_frame_register_read (struct frame_info *frame, int regnum, +@@ -1393,7 +1393,7 @@ deprecated_frame_register_read (struct frame_info *frame, int regnum, int get_frame_register_bytes (struct frame_info *frame, int regnum, @@ -1841,7 +1813,7 @@ diff --git a/gdb/frame.c b/gdb/frame.c int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -1425,7 +1425,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, +@@ -1422,7 +1422,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, } if (len > maxsize) error (_("Bad debug information detected: " @@ -1865,7 +1837,7 @@ diff --git a/gdb/frame.h b/gdb/frame.h diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c -@@ -1799,7 +1799,7 @@ set_gdbarch_wchar_signed (struct gdbarch *gdbarch, +@@ -1795,7 +1795,7 @@ set_gdbarch_wchar_signed (struct gdbarch *gdbarch, } const struct floatformat ** @@ -1877,7 +1849,7 @@ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h -@@ -195,8 +195,8 @@ extern void set_gdbarch_wchar_signed (struct gdbarch *gdbarch, int wchar_signed) +@@ -218,8 +218,8 @@ extern void set_gdbarch_wchar_signed (struct gdbarch *gdbarch, int wchar_signed) NAME, if non-NULL, is the type name, which may be used to distinguish different target formats of the same length. */ @@ -1903,7 +1875,7 @@ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -2906,7 +2906,7 @@ floatformat_from_type (const struct type *type) +@@ -2889,7 +2889,7 @@ floatformat_from_type (const struct type *type) least as long as OBJFILE. */ struct type * @@ -1912,7 +1884,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c const char *name) { struct type *type; -@@ -3360,8 +3360,8 @@ is_public_ancestor (struct type *base, struct type *dclass) +@@ -3340,8 +3340,8 @@ is_public_ancestor (struct type *base, struct type *dclass) static int is_unique_ancestor_worker (struct type *base, struct type *dclass, @@ -1923,7 +1895,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c CORE_ADDR address, struct value *val) { int i, count = 0; -@@ -3372,7 +3372,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, +@@ -3352,7 +3352,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, for (i = 0; i < TYPE_N_BASECLASSES (dclass) && count < 2; ++i) { struct type *iter; @@ -1932,7 +1904,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c iter = check_typedef (TYPE_BASECLASS (dclass, i)); -@@ -3413,7 +3413,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, +@@ -3393,7 +3393,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, int is_unique_ancestor (struct type *base, struct value *val) { @@ -1941,7 +1913,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c return is_unique_ancestor_worker (base, value_type (val), &offset, value_contents_for_printing (val), -@@ -4642,7 +4642,7 @@ recursive_dump_type (struct type *type, int spaces) +@@ -4620,7 +4620,7 @@ recursive_dump_type (struct type *type, int spaces) break; } puts_filtered ("\n"); @@ -1950,7 +1922,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c if (TYPE_OBJFILE_OWNED (type)) { printfi_filtered (spaces, "objfile "); -@@ -5085,7 +5085,7 @@ copy_type (const struct type *type) +@@ -5065,7 +5065,7 @@ copy_type (const struct type *type) struct type * arch_type (struct gdbarch *gdbarch, @@ -1962,7 +1934,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -862,7 +862,7 @@ struct type +@@ -864,7 +864,7 @@ struct type type_length_units function should be used in order to get the length expressed in target addressable memory units. */ @@ -1971,7 +1943,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* * Core type, shared by a group of qualified types. */ -@@ -1783,7 +1783,7 @@ extern unsigned int type_length_units (struct type *type); +@@ -1787,7 +1787,7 @@ extern unsigned int type_length_units (struct type *type); /* * Helper function to construct objfile-owned types. */ @@ -1980,7 +1952,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h const char *); extern struct type *init_integer_type (struct objfile *, int, int, const char *); -@@ -1800,7 +1800,7 @@ extern struct type *init_pointer_type (struct objfile *, int, const char *, +@@ -1804,7 +1804,7 @@ extern struct type *init_pointer_type (struct objfile *, int, const char *, struct type *); /* Helper functions to construct architecture-owned types. */ @@ -2122,7 +2094,7 @@ diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -8155,7 +8155,7 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, +@@ -8156,7 +8156,7 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, const struct floatformat ** i386_floatformat_for_type (struct gdbarch *gdbarch, @@ -2134,7 +2106,7 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c diff --git a/gdb/language.c b/gdb/language.c --- a/gdb/language.c +++ b/gdb/language.c -@@ -766,7 +766,7 @@ unk_lang_printchar (int c, struct type *type, struct ui_file *stream) +@@ -765,7 +765,7 @@ unk_lang_printchar (int c, struct type *type, struct ui_file *stream) static void unk_lang_printstr (struct ui_file *stream, struct type *type, @@ -2143,7 +2115,7 @@ diff --git a/gdb/language.c b/gdb/language.c const char *encoding, int force_ellipses, const struct value_print_options *options) { -@@ -785,7 +785,7 @@ unk_lang_print_type (struct type *type, const char *varstring, +@@ -784,7 +784,7 @@ unk_lang_print_type (struct type *type, const char *varstring, static void unk_lang_val_print (struct type *type, @@ -2213,7 +2185,7 @@ diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h --- a/gdb/m2-lang.h +++ b/gdb/m2-lang.h -@@ -32,7 +32,7 @@ extern void m2_print_typedef (struct type *, struct symbol *, +@@ -35,7 +35,7 @@ extern void m2_print_typedef (struct type *, struct symbol *, extern int m2_is_long_set (struct type *type); extern int m2_is_unbounded_array (struct type *type); @@ -2360,7 +2332,7 @@ diff --git a/gdb/memrange.h b/gdb/memrange.h diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c -@@ -614,7 +614,7 @@ mips_linux_nat_target::stopped_data_address (CORE_ADDR *paddr) +@@ -610,7 +610,7 @@ mips_linux_nat_target::stopped_data_address (CORE_ADDR *paddr) the specified region can be covered by the watch registers. */ int @@ -2393,7 +2365,7 @@ diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c diff --git a/gdb/nat/x86-dregs.h b/gdb/nat/x86-dregs.h --- a/gdb/nat/x86-dregs.h +++ b/gdb/nat/x86-dregs.h -@@ -116,7 +116,7 @@ extern int x86_dr_remove_watchpoint (struct x86_debug_reg_state *state, +@@ -117,7 +117,7 @@ extern int x86_dr_remove_watchpoint (struct x86_debug_reg_state *state, /* Return non-zero if we can watch a memory region that starts at address ADDR and whose length is LEN bytes. */ extern int x86_dr_region_ok_for_watchpoint (struct x86_debug_reg_state *state, @@ -2526,7 +2498,7 @@ diff --git a/gdb/p-lang.c b/gdb/p-lang.c diff --git a/gdb/p-lang.h b/gdb/p-lang.h --- a/gdb/p-lang.h +++ b/gdb/p-lang.h -@@ -34,7 +34,7 @@ extern void pascal_print_type (struct type *, const char *, struct ui_file *, +@@ -37,7 +37,7 @@ extern void pascal_print_type (struct type *, const char *, struct ui_file *, extern void pascal_print_typedef (struct type *, struct symbol *, struct ui_file *); @@ -2535,7 +2507,7 @@ diff --git a/gdb/p-lang.h b/gdb/p-lang.h CORE_ADDR, struct ui_file *, int, struct value *, const struct value_print_options *); -@@ -48,13 +48,13 @@ extern void pascal_type_print_method_args (const char *, const char *, +@@ -51,13 +51,13 @@ extern void pascal_type_print_method_args (const char *, const char *, /* These are in p-lang.c: */ extern int @@ -2563,9 +2535,9 @@ diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c struct ui_file *stream, int recurse, struct value *original_value, const struct value_print_options *options) -@@ -71,8 +71,8 @@ pascal_val_print (struct type *type, +@@ -70,8 +70,8 @@ pascal_val_print (struct type *type, + unsigned int i = 0; /* Number of characters printed */ unsigned len; - LONGEST low_bound, high_bound; struct type *elttype; - unsigned eltlen; - int length_pos, length_size, string_pos; @@ -2577,7 +2549,7 @@ diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c -@@ -1308,7 +1308,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot) +@@ -1716,7 +1716,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot) } int @@ -2589,7 +2561,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c -@@ -1706,7 +1706,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, +@@ -2263,7 +2263,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, const struct floatformat ** ppc_floatformat_for_type (struct gdbarch *gdbarch, @@ -2601,7 +2573,7 @@ diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c diff --git a/gdb/printcmd.c b/gdb/printcmd.c --- a/gdb/printcmd.c +++ b/gdb/printcmd.c -@@ -275,7 +275,7 @@ print_formatted (struct value *val, int size, +@@ -276,7 +276,7 @@ print_formatted (struct value *val, int size, struct ui_file *stream) { struct type *type = check_typedef (value_type (val)); @@ -2610,7 +2582,7 @@ diff --git a/gdb/printcmd.c b/gdb/printcmd.c if (VALUE_LVAL (val) == lval_memory) next_address = value_address (val) + len; -@@ -351,7 +351,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, +@@ -352,7 +352,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, int size, struct ui_file *stream) { struct gdbarch *gdbarch = get_type_arch (type); @@ -2622,7 +2594,7 @@ diff --git a/gdb/printcmd.c b/gdb/printcmd.c diff --git a/gdb/procfs.c b/gdb/procfs.c --- a/gdb/procfs.c +++ b/gdb/procfs.c -@@ -3358,7 +3358,7 @@ procfs_target::remove_watchpoint (CORE_ADDR addr, int len, +@@ -3374,7 +3374,7 @@ procfs_target::remove_watchpoint (CORE_ADDR addr, int len, } int @@ -2634,7 +2606,7 @@ diff --git a/gdb/procfs.c b/gdb/procfs.c diff --git a/gdb/regcache.c b/gdb/regcache.c --- a/gdb/regcache.c +++ b/gdb/regcache.c -@@ -795,7 +795,7 @@ regcache::cooked_write (int regnum, const gdb_byte *buf) +@@ -763,7 +763,7 @@ regcache::cooked_write (int regnum, const gdb_byte *buf) /* See regcache.h. */ enum register_status @@ -2643,7 +2615,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c gdb_byte *out, bool is_raw) { int reg_size = register_size (arch (), regnum); -@@ -862,7 +862,7 @@ reg_buffer::raw_collect_part (int regnum, int offset, int len, +@@ -830,7 +830,7 @@ reg_buffer::raw_collect_part (int regnum, int offset, int len, /* See regcache.h. */ enum register_status @@ -2652,7 +2624,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c const gdb_byte *in, bool is_raw) { int reg_size = register_size (arch (), regnum); -@@ -933,7 +933,7 @@ reg_buffer::raw_supply_part (int regnum, int offset, int len, +@@ -901,7 +901,7 @@ reg_buffer::raw_supply_part (int regnum, int offset, int len, } enum register_status @@ -2661,7 +2633,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c gdb_byte *buf) { assert_regnum (regnum); -@@ -943,7 +943,7 @@ readable_regcache::raw_read_part (int regnum, int offset, int len, +@@ -911,7 +911,7 @@ readable_regcache::raw_read_part (int regnum, int offset, int len, /* See regcache.h. */ void @@ -2670,7 +2642,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c const gdb_byte *buf) { assert_regnum (regnum); -@@ -953,7 +953,7 @@ regcache::raw_write_part (int regnum, int offset, int len, +@@ -921,7 +921,7 @@ regcache::raw_write_part (int regnum, int offset, int len, /* See regcache.h. */ enum register_status @@ -2679,7 +2651,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c gdb_byte *buf) { gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers); -@@ -963,7 +963,7 @@ readable_regcache::cooked_read_part (int regnum, int offset, int len, +@@ -931,7 +931,7 @@ readable_regcache::cooked_read_part (int regnum, int offset, int len, /* See regcache.h. */ void @@ -2691,7 +2663,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c diff --git a/gdb/regcache.h b/gdb/regcache.h --- a/gdb/regcache.h +++ b/gdb/regcache.h -@@ -256,8 +256,8 @@ public: +@@ -273,8 +273,8 @@ public: enum register_status raw_read (int regnum, T *val); /* Partial transfer of raw registers. Return the status of the register. */ @@ -2702,7 +2674,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h /* Make certain that the register REGNUM is up-to-date. */ virtual void raw_update (int regnum) = 0; -@@ -269,8 +269,8 @@ public: +@@ -286,8 +286,8 @@ public: enum register_status cooked_read (int regnum, T *val); /* Partial transfer of a cooked register. */ @@ -2713,7 +2685,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h /* Read register REGNUM from the regcache and return a new value. This will call mark_value_bytes_unavailable as appropriate. */ -@@ -280,7 +280,7 @@ protected: +@@ -297,7 +297,7 @@ protected: /* Perform a partial register transfer using a read, modify, write operation. Will fail if register is currently invalid. */ @@ -2722,7 +2694,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h gdb_byte *out, bool is_raw); }; -@@ -338,11 +338,12 @@ public: +@@ -355,11 +355,12 @@ public: /* Partial transfer of raw registers. Perform read, modify, write style operations. */ @@ -2737,7 +2709,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h const gdb_byte *buf); void supply_regset (const struct regset *regset, -@@ -393,7 +394,7 @@ private: +@@ -410,7 +411,7 @@ private: /* Perform a partial register transfer using a read, modify, write operation. */ @@ -2749,7 +2721,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h diff --git a/gdb/remote.c b/gdb/remote.c --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -462,7 +462,7 @@ public: +@@ -458,7 +458,7 @@ public: int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; @@ -2758,7 +2730,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; -@@ -10413,7 +10413,7 @@ int remote_hw_watchpoint_length_limit = -1; +@@ -10406,7 +10406,7 @@ int remote_hw_watchpoint_length_limit = -1; int remote_hw_breakpoint_limit = -1; int @@ -2770,7 +2742,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c -@@ -288,7 +288,7 @@ rust_printchar (int c, struct type *type, struct ui_file *stream) +@@ -301,7 +301,7 @@ rust_printchar (int c, struct type *type, struct ui_file *stream) static void rust_printstr (struct ui_file *stream, struct type *type, @@ -2779,7 +2751,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c const char *user_encoding, int force_ellipses, const struct value_print_options *options) { -@@ -497,7 +497,7 @@ static const struct generic_val_print_decorations rust_decorations = +@@ -517,7 +517,7 @@ static const struct generic_val_print_decorations rust_decorations = /* la_val_print implementation for Rust. */ static void @@ -2791,7 +2763,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c -@@ -952,7 +952,8 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, +@@ -951,7 +951,8 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, } int @@ -2804,7 +2776,7 @@ diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c -@@ -66,7 +66,7 @@ struct spu_multiarch_target final : public target_ops +@@ -65,7 +65,7 @@ struct spu_multiarch_target final : public target_ops const gdb_byte *pattern, ULONGEST pattern_len, CORE_ADDR *found_addrp) override; @@ -2813,7 +2785,7 @@ diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c struct gdbarch *thread_architecture (ptid_t) override; }; -@@ -163,7 +163,7 @@ spu_multiarch_target::thread_architecture (ptid_t ptid) +@@ -162,7 +162,7 @@ spu_multiarch_target::thread_architecture (ptid_t ptid) /* Override the to_region_ok_for_hw_watchpoint routine. */ int @@ -2825,7 +2797,7 @@ diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c diff --git a/gdb/stack.c b/gdb/stack.c --- a/gdb/stack.c +++ b/gdb/stack.c -@@ -190,7 +190,7 @@ print_stack_frame (struct frame_info *frame, int print_level, +@@ -194,7 +194,7 @@ print_stack_frame (struct frame_info *frame, int print_level, argument (not just the first nameless argument). */ static void @@ -2834,7 +2806,7 @@ diff --git a/gdb/stack.c b/gdb/stack.c int first, struct ui_file *stream) { struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -540,7 +540,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, +@@ -544,7 +544,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, /* Offset of next stack argument beyond the one we have seen that is at the highest offset, or -1 if we haven't come to a stack argument yet. */ @@ -2843,7 +2815,7 @@ diff --git a/gdb/stack.c b/gdb/stack.c /* Number of ints of arguments that we have printed so far. */ int args_printed = 0; /* True if we should print arguments, false otherwise. */ -@@ -569,8 +569,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame, +@@ -573,8 +573,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame, case LOC_ARG: case LOC_REF_ARG: { @@ -2854,7 +2826,7 @@ diff --git a/gdb/stack.c b/gdb/stack.c /* Compute address of next argument by adding the size of this argument and rounding to an int boundary. */ -@@ -705,7 +705,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, +@@ -709,7 +709,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, enough about the stack to find them. */ if (num != -1) { @@ -2866,7 +2838,7 @@ diff --git a/gdb/stack.c b/gdb/stack.c diff --git a/gdb/symmisc.c b/gdb/symmisc.c --- a/gdb/symmisc.c +++ b/gdb/symmisc.c -@@ -586,11 +586,11 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, +@@ -587,11 +587,11 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_CONST_BYTES: { @@ -2884,8 +2856,8 @@ diff --git a/gdb/symmisc.c b/gdb/symmisc.c diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c -@@ -39,7 +39,7 @@ struct dummy_target : public target_ops - bool have_continuable_watchpoint () override; +@@ -38,7 +38,7 @@ struct dummy_target : public target_ops + bool have_steppable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; - int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override; @@ -2893,8 +2865,8 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; -@@ -207,7 +207,7 @@ struct debug_target : public target_ops - bool have_continuable_watchpoint () override; +@@ -205,7 +205,7 @@ struct debug_target : public target_ops + bool have_steppable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; - int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override; @@ -2902,7 +2874,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; -@@ -1098,19 +1098,19 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int +@@ -1071,19 +1071,19 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int } int @@ -2925,7 +2897,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c { int result; fprintf_unfiltered (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath ()->shortname ()); -@@ -1118,7 +1118,7 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) +@@ -1091,7 +1091,7 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) fprintf_unfiltered (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (", this->beneath ()->shortname ()); target_debug_print_CORE_ADDR (arg0); fputs_unfiltered (", ", gdb_stdlog); @@ -2937,7 +2909,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c diff --git a/gdb/target.c b/gdb/target.c --- a/gdb/target.c +++ b/gdb/target.c -@@ -59,7 +59,7 @@ static int default_watchpoint_addr_within_range (struct target_ops *, +@@ -58,7 +58,7 @@ static int default_watchpoint_addr_within_range (struct target_ops *, CORE_ADDR, CORE_ADDR, int); static int default_region_ok_for_hw_watchpoint (struct target_ops *, @@ -2946,7 +2918,7 @@ diff --git a/gdb/target.c b/gdb/target.c static void default_rcmd (struct target_ops *, const char *, struct ui_file *); -@@ -3181,7 +3181,7 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) +@@ -3103,7 +3103,7 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) static int default_region_ok_for_hw_watchpoint (struct target_ops *self, @@ -2958,7 +2930,7 @@ diff --git a/gdb/target.c b/gdb/target.c diff --git a/gdb/target.h b/gdb/target.h --- a/gdb/target.h +++ b/gdb/target.h -@@ -562,7 +562,7 @@ struct target_ops +@@ -566,7 +566,7 @@ struct target_ops /* Documentation of this routine is provided with the corresponding target_* macro. */ @@ -2970,12 +2942,12 @@ diff --git a/gdb/target.h b/gdb/target.h diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c -@@ -829,10 +829,10 @@ collection_list::add_register (unsigned int regno) +@@ -893,10 +893,10 @@ collection_list::add_local_register (struct gdbarch *gdbarch, void collection_list::add_memrange (struct gdbarch *gdbarch, int type, bfd_signed_vma base, -- unsigned long len) -+ ULONGEST len) +- unsigned long len, CORE_ADDR scope) ++ ULONGEST len, CORE_ADDR scope) { if (info_verbose) - printf_filtered ("(%d,%s,%ld)\n", type, paddress (gdbarch, base), len); @@ -2983,7 +2955,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c /* type: memrange_absolute == memory, other n == basereg */ /* base: addr if memory, offset if reg relative. */ -@@ -852,7 +852,7 @@ collection_list::collect_symbol (struct symbol *sym, +@@ -916,7 +916,7 @@ collection_list::collect_symbol (struct symbol *sym, CORE_ADDR scope, int trace_string) { @@ -2992,7 +2964,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c unsigned int reg; bfd_signed_vma offset; int treat_as_expr = 0; -@@ -873,8 +873,8 @@ collection_list::collect_symbol (struct symbol *sym, +@@ -937,8 +937,8 @@ collection_list::collect_symbol (struct symbol *sym, offset = SYMBOL_VALUE_ADDRESS (sym); if (info_verbose) { @@ -3003,7 +2975,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c paddress (gdbarch, offset)); } /* A struct may be a C++ class with static fields, go to general -@@ -906,9 +906,9 @@ collection_list::collect_symbol (struct symbol *sym, +@@ -970,9 +970,9 @@ collection_list::collect_symbol (struct symbol *sym, offset = frame_offset + SYMBOL_VALUE (sym); if (info_verbose) { @@ -3014,8 +2986,8 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c + SYMBOL_PRINT_NAME (sym), pulongest (len), paddress (gdbarch, offset), reg); } - add_memrange (gdbarch, reg, offset, len); -@@ -918,9 +918,9 @@ collection_list::collect_symbol (struct symbol *sym, + add_memrange (gdbarch, reg, offset, len, scope); +@@ -982,9 +982,9 @@ collection_list::collect_symbol (struct symbol *sym, offset = 0; if (info_verbose) { @@ -3026,8 +2998,8 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c + SYMBOL_PRINT_NAME (sym), pulongest (len), paddress (gdbarch, offset), reg); } - add_memrange (gdbarch, reg, offset, len); -@@ -930,9 +930,9 @@ collection_list::collect_symbol (struct symbol *sym, + add_memrange (gdbarch, reg, offset, len, scope); +@@ -994,9 +994,9 @@ collection_list::collect_symbol (struct symbol *sym, offset = frame_offset + SYMBOL_VALUE (sym); if (info_verbose) { @@ -3038,8 +3010,8 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c + SYMBOL_PRINT_NAME (sym), pulongest (len), paddress (gdbarch, offset), reg); } - add_memrange (gdbarch, reg, offset, len); -@@ -2447,7 +2447,8 @@ info_scope_command (const char *args_in, int from_tty) + add_memrange (gdbarch, reg, offset, len, scope); +@@ -2492,7 +2492,8 @@ info_scope_command (const char *args_in, int from_tty) const char *symname; const char *save_args = args_in; struct block_iterator iter; @@ -3049,7 +3021,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c struct gdbarch *gdbarch; int regno; const char *args = args_in; -@@ -2591,8 +2592,11 @@ info_scope_command (const char *args_in, int from_tty) +@@ -2636,8 +2637,11 @@ info_scope_command (const char *args_in, int from_tty) } } if (SYMBOL_TYPE (sym)) @@ -3066,12 +3038,12 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h -@@ -265,7 +265,7 @@ public: - void add_register (unsigned int regno); +@@ -269,7 +269,7 @@ public: + CORE_ADDR scope); void add_memrange (struct gdbarch *gdbarch, int type, bfd_signed_vma base, -- unsigned long len); -+ ULONGEST len); +- unsigned long len, CORE_ADDR scope); ++ ULONGEST len, CORE_ADDR scope); void collect_symbol (struct symbol *sym, struct gdbarch *gdbarch, long frame_regno, long frame_offset, @@ -3111,7 +3083,7 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c { struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); -@@ -659,7 +659,7 @@ value_concat (struct value *arg1, struct value *arg2) +@@ -656,7 +656,7 @@ value_concat (struct value *arg1, struct value *arg2) struct value *inval1; struct value *inval2; struct value *outval = NULL; @@ -3120,7 +3092,7 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c int count, idx; char inchar; struct type *type1 = check_typedef (value_type (arg1)); -@@ -1419,7 +1419,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) +@@ -1416,7 +1416,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) int value_logical_not (struct value *arg1) { @@ -3129,7 +3101,7 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c const gdb_byte *p; struct type *type1; -@@ -1447,11 +1447,11 @@ value_logical_not (struct value *arg1) +@@ -1444,11 +1444,11 @@ value_logical_not (struct value *arg1) static int value_strcmp (struct value *arg1, struct value *arg2) { @@ -3147,8 +3119,8 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -81,7 +81,7 @@ oload_classification classify_oload_match (struct badness_vector *, - int, int); +@@ -81,7 +81,7 @@ static enum oload_classification classify_oload_match + (const badness_vector &, int, int); static struct value *value_struct_elt_for_reference (struct type *, - int, struct type *, @@ -3156,7 +3128,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c const char *, struct type *, int, enum noside); -@@ -183,7 +183,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) +@@ -171,7 +171,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) space. */ struct value * @@ -3165,7 +3137,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c { struct objfile *objf; struct value *val = find_function_in_inferior ("malloc", &objf); -@@ -398,12 +398,12 @@ value_cast (struct type *type, struct value *arg2) +@@ -386,12 +386,12 @@ value_cast (struct type *type, struct value *arg2) if (code1 == TYPE_CODE_ARRAY) { struct type *element_type = TYPE_TARGET_TYPE (type); @@ -3180,7 +3152,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c LONGEST low_bound, high_bound, new_length; if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -@@ -1055,7 +1055,7 @@ value_assign (struct value *toval, struct value *fromval) +@@ -1043,7 +1043,7 @@ value_assign (struct value *toval, struct value *fromval) { const gdb_byte *dest_buffer; CORE_ADDR changed_addr; @@ -3189,7 +3161,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c gdb_byte buffer[sizeof (LONGEST)]; if (value_bitsize (toval)) -@@ -3357,7 +3357,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial) +@@ -3335,7 +3335,7 @@ get_baseclass_offset (struct type *vt, struct type *cls, the form "DOMAIN::NAME". */ static struct value * @@ -3198,7 +3170,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c struct type *curtype, const char *name, struct type *intype, int want_address, -@@ -3391,7 +3391,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, +@@ -3369,7 +3369,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, if (want_address) return value_from_longest (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain), @@ -3207,7 +3179,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c else if (noside != EVAL_NORMAL) return allocate_value (TYPE_FIELD_TYPE (t, i)); else -@@ -3564,7 +3564,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, +@@ -3548,7 +3548,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--) { struct value *v; @@ -3216,7 +3188,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c if (BASETYPE_VIA_VIRTUAL (t, i)) base_offset = 0; -@@ -3713,7 +3713,7 @@ value_rtti_indirect_type (struct value *v, int *full, +@@ -3697,7 +3697,7 @@ value_rtti_indirect_type (struct value *v, int *full, struct value * value_full_object (struct value *argp, struct type *rtype, @@ -3237,7 +3209,7 @@ diff --git a/gdb/valprint.c b/gdb/valprint.c struct ui_file *stream, int recurse, struct value *original_value, const struct value_print_options *options, -@@ -1773,7 +1773,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr, +@@ -1774,7 +1774,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr, void print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr, @@ -3246,7 +3218,7 @@ diff --git a/gdb/valprint.c b/gdb/valprint.c bool zero_pad) { const gdb_byte *p; -@@ -1926,17 +1926,17 @@ val_print_array_elements (struct type *type, +@@ -1927,17 +1927,17 @@ val_print_array_elements (struct type *type, int recurse, struct value *val, const struct value_print_options *options, @@ -3269,7 +3241,7 @@ diff --git a/gdb/valprint.c b/gdb/valprint.c LONGEST low_bound, high_bound; LONGEST low_pos, high_pos; -@@ -2026,7 +2026,7 @@ val_print_array_elements (struct type *type, +@@ -2027,7 +2027,7 @@ val_print_array_elements (struct type *type, address, stream, recurse + 1, val, options, current_language); annotate_elt_rep (reps); @@ -3443,7 +3415,7 @@ diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h extern int x86_stopped_by_watchpoint (); extern int x86_stopped_data_address (CORE_ADDR *addr_p); extern int x86_insert_watchpoint (CORE_ADDR addr, int len, -@@ -82,7 +82,7 @@ struct x86_nat_target : public BaseTarget +@@ -75,7 +75,7 @@ struct x86_nat_target : public BaseTarget int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override { return x86_can_use_hw_breakpoint (type, cnt, othertype); } @@ -3452,3 +3424,4 @@ diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h { return x86_region_ok_for_hw_watchpoint (addr, len); } int insert_watchpoint (CORE_ADDR addr, int len, + diff --git a/gdb-rhbz795424-bitpos-21of25.patch b/gdb-rhbz795424-bitpos-21of25.patch index 5617a50ff145725c8edb36efbe520243f601f4ab..b3a0afaed9c94beebc2e2f220a446cd93b11e26e 100644 --- a/gdb-rhbz795424-bitpos-21of25.patch +++ b/gdb-rhbz795424-bitpos-21of25.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-21of25.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - http://sourceware.org/ml/gdb-patches/2012-09/msg00632.html --MP_/PnL6l3LUsXWpZ/olqawWlzb @@ -62,7 +53,7 @@ Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c -@@ -413,6 +413,13 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, accumulate_size = 0; else accumulate_size -= sizeof(arg_reg_buffer); @@ -90,7 +81,7 @@ diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c diff --git a/gdb/defs.h b/gdb/defs.h --- a/gdb/defs.h +++ b/gdb/defs.h -@@ -665,4 +665,6 @@ DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what); +@@ -669,4 +669,6 @@ DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what); #include "utils.h" @@ -100,7 +91,7 @@ diff --git a/gdb/defs.h b/gdb/defs.h diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c -@@ -773,6 +773,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr, +@@ -775,6 +775,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr, if (boffset < 0 || boffset >= TYPE_LENGTH (type)) { @@ -111,7 +102,7 @@ diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -2834,6 +2834,17 @@ string_to_core_addr (const char *my_string) +@@ -2957,6 +2957,17 @@ string_to_core_addr (const char *my_string) return addr; } @@ -132,7 +123,7 @@ diff --git a/gdb/utils.c b/gdb/utils.c diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -2088,6 +2088,7 @@ search_struct_method (const char *name, struct value **arg1p, +@@ -2064,6 +2064,7 @@ search_struct_method (const char *name, struct value **arg1p, { CORE_ADDR address; @@ -160,7 +151,7 @@ diff --git a/gdb/value.c b/gdb/value.c if (!val->contents) { check_type_length_before_alloc (val->enclosing_type); -@@ -2876,6 +2879,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type) +@@ -2874,6 +2877,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type) if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val))) { check_type_length_before_alloc (new_encl_type); @@ -171,7 +162,7 @@ diff --git a/gdb/value.c b/gdb/value.c diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c -@@ -218,6 +218,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -219,6 +219,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function, ULONGEST addr; regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); @@ -179,3 +170,4 @@ diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c read_memory (addr, readbuf, len); } + diff --git a/gdb-rhbz795424-bitpos-22of25.patch b/gdb-rhbz795424-bitpos-22of25.patch index 8072f7753ef0b40a42f687f63b2fae57283ad54a..ce5ac57dd2695daa0d3373b46ef23e351416a92b 100644 --- a/gdb-rhbz795424-bitpos-22of25.patch +++ b/gdb-rhbz795424-bitpos-22of25.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-22of25.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html --MP_/6HRlH6vpyqtSy4CYyMrX6b2 @@ -154,7 +145,7 @@ diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c const struct target_desc *read_description () override; -@@ -1207,7 +1207,7 @@ arm_linux_nat_target::stopped_by_watchpoint () +@@ -1203,7 +1203,7 @@ arm_linux_nat_target::stopped_by_watchpoint () bool arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, @@ -221,7 +212,7 @@ diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c struct aarch64_debug_reg_state *state) { if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len)) -@@ -722,14 +723,14 @@ aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state, +@@ -742,14 +743,14 @@ aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state, void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, const char *func, CORE_ADDR addr, @@ -239,7 +230,7 @@ diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c type == hw_write ? "hw-write-watchpoint" : (type == hw_read ? "hw-read-watchpoint" : (type == hw_access ? "hw-access-watchpoint" -@@ -812,7 +813,7 @@ aarch64_linux_get_debug_reg_capacity (int tid) +@@ -832,7 +833,7 @@ aarch64_linux_get_debug_reg_capacity (int tid) ADDR and whose length is LEN in bytes. */ int @@ -260,7 +251,7 @@ diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h struct aarch64_debug_reg_state *state); void aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state, -@@ -184,12 +184,12 @@ void aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state, +@@ -189,12 +189,12 @@ bool aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state, void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, const char *func, CORE_ADDR addr, @@ -274,11 +265,11 @@ diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h -int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len); +int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len); - #endif /* AARCH64_LINUX_HW_POINT_H */ + #endif /* NAT_AARCH64_LINUX_HW_POINT_H */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c -@@ -282,7 +282,7 @@ struct ppc_linux_nat_target final : public linux_nat_target +@@ -284,7 +284,7 @@ struct ppc_linux_nat_target final : public linux_nat_target int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; @@ -287,7 +278,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; -@@ -300,9 +300,9 @@ struct ppc_linux_nat_target final : public linux_nat_target +@@ -302,9 +302,9 @@ struct ppc_linux_nat_target final : public linux_nat_target bool stopped_data_address (CORE_ADDR *) override; @@ -299,7 +290,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c override; int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override; -@@ -1659,11 +1659,11 @@ can_use_watchpoint_cond_accel (void) +@@ -2065,11 +2065,11 @@ can_use_watchpoint_cond_accel (void) CONDITION_VALUE will hold the value which should be put in the DVC register. */ static void @@ -314,7 +305,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c CORE_ADDR addr_end_data, addr_end_dvc; /* The DVC register compares bytes within fixed-length windows which -@@ -1751,7 +1751,7 @@ num_memory_accesses (const std::vector &chain) +@@ -2157,7 +2157,7 @@ num_memory_accesses (const std::vector &chain) of the constant. */ static int check_condition (CORE_ADDR watch_addr, struct expression *cond, @@ -323,7 +314,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c { int pc = 1, num_accesses_left, num_accesses_right; struct value *left_val, *right_val; -@@ -1802,7 +1802,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, +@@ -2208,7 +2208,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, the condition expression, thus only triggering the watchpoint when it is true. */ bool @@ -333,7 +324,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c int rw, struct expression *cond) { -@@ -1820,7 +1821,7 @@ ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len, +@@ -2226,7 +2227,7 @@ ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len, static void create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, @@ -342,7 +333,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c struct expression *cond, int insert) { if (len == 1 -@@ -2086,7 +2087,7 @@ ppc_linux_nat_target::stopped_by_watchpoint () +@@ -2492,7 +2493,7 @@ ppc_linux_nat_target::stopped_by_watchpoint () bool ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, @@ -354,7 +345,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c diff --git a/gdb/procfs.c b/gdb/procfs.c --- a/gdb/procfs.c +++ b/gdb/procfs.c -@@ -1561,7 +1561,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) +@@ -1546,7 +1546,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) } static int @@ -363,7 +354,7 @@ diff --git a/gdb/procfs.c b/gdb/procfs.c { struct { procfs_ctl_t cmd; -@@ -3214,7 +3214,7 @@ procfs_target::pid_to_str (ptid_t ptid) +@@ -3238,7 +3238,7 @@ procfs_target::pid_to_exec_file (int pid) /* Insert a watchpoint. */ static int @@ -375,7 +366,7 @@ diff --git a/gdb/procfs.c b/gdb/procfs.c diff --git a/gdb/remote.c b/gdb/remote.c --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -454,7 +454,7 @@ public: +@@ -450,7 +450,7 @@ public: bool stopped_data_address (CORE_ADDR *) override; @@ -384,16 +375,16 @@ diff --git a/gdb/remote.c b/gdb/remote.c int can_use_hw_breakpoint (enum bptype, int, int) override; -@@ -10342,7 +10342,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, - p = strchr (rs->buf, '\0'); +@@ -10335,7 +10335,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, + p = strchr (rs->buf.data (), '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); - xsnprintf (p, endbuf - p, ",%x", len); + xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len))); putpkt (rs->buf); - getpkt (&rs->buf, &rs->buf_size, 0); -@@ -10362,7 +10362,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, + getpkt (&rs->buf, 0); +@@ -10355,7 +10355,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, bool remote_target::watchpoint_addr_within_range (CORE_ADDR addr, @@ -402,14 +393,14 @@ diff --git a/gdb/remote.c b/gdb/remote.c { CORE_ADDR diff = remote_address_masked (addr - start); -@@ -10391,7 +10391,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, - p = strchr (rs->buf, '\0'); +@@ -10384,7 +10384,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, + p = strchr (rs->buf.data (), '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); - xsnprintf (p, endbuf - p, ",%x", len); + xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len))); putpkt (rs->buf); - getpkt (&rs->buf, &rs->buf_size, 0); + getpkt (&rs->buf, 0); diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c --- a/gdb/s390-linux-nat.c @@ -420,15 +411,15 @@ diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c override; - int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; + int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - bool have_continuable_watchpoint () override { return true; } bool stopped_by_watchpoint () override; int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, + struct expression *) override; diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c -@@ -38,9 +38,9 @@ struct dummy_target : public target_ops - int have_steppable_watchpoint () override; - bool have_continuable_watchpoint () override; +@@ -37,9 +37,9 @@ struct dummy_target : public target_ops + bool stopped_by_watchpoint () override; + bool have_steppable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; - bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; + bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override; @@ -438,9 +429,9 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; bool supports_terminal_ours () override; -@@ -206,9 +206,9 @@ struct debug_target : public target_ops - int have_steppable_watchpoint () override; - bool have_continuable_watchpoint () override; +@@ -204,9 +204,9 @@ struct debug_target : public target_ops + bool stopped_by_watchpoint () override; + bool have_steppable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; - bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; + bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override; @@ -450,7 +441,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; bool supports_terminal_ours () override; -@@ -1068,19 +1068,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0) +@@ -1041,19 +1041,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0) } bool @@ -473,7 +464,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c { bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ()); -@@ -1090,7 +1090,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int +@@ -1063,7 +1063,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int fputs_unfiltered (", ", gdb_stdlog); target_debug_print_CORE_ADDR (arg1); fputs_unfiltered (", ", gdb_stdlog); @@ -482,7 +473,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c fputs_unfiltered (") = ", gdb_stdlog); target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); -@@ -1126,19 +1126,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) +@@ -1099,19 +1099,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) } bool @@ -505,7 +496,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c { bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ()); -@@ -1146,7 +1146,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2 +@@ -1119,7 +1119,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2 fprintf_unfiltered (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ()); target_debug_print_CORE_ADDR (arg0); fputs_unfiltered (", ", gdb_stdlog); @@ -517,7 +508,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c diff --git a/gdb/target.c b/gdb/target.c --- a/gdb/target.c +++ b/gdb/target.c -@@ -56,7 +56,7 @@ static void generic_tls_error (void) ATTRIBUTE_NORETURN; +@@ -55,7 +55,7 @@ static void generic_tls_error (void) ATTRIBUTE_NORETURN; static void default_terminal_info (struct target_ops *, const char *, int); static int default_watchpoint_addr_within_range (struct target_ops *, @@ -526,7 +517,7 @@ diff --git a/gdb/target.c b/gdb/target.c static int default_region_ok_for_hw_watchpoint (struct target_ops *, CORE_ADDR, LONGEST); -@@ -3189,7 +3189,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self, +@@ -3111,7 +3111,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self, static int default_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -538,7 +529,7 @@ diff --git a/gdb/target.c b/gdb/target.c diff --git a/gdb/target.h b/gdb/target.h --- a/gdb/target.h +++ b/gdb/target.h -@@ -557,7 +557,7 @@ struct target_ops +@@ -561,7 +561,7 @@ struct target_ops TARGET_DEFAULT_RETURN (false); virtual bool stopped_data_address (CORE_ADDR *) TARGET_DEFAULT_RETURN (false); @@ -547,7 +538,7 @@ diff --git a/gdb/target.h b/gdb/target.h TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range); /* Documentation of this routine is provided with the corresponding -@@ -565,7 +565,7 @@ struct target_ops +@@ -569,7 +569,7 @@ struct target_ops virtual int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint); @@ -556,3 +547,4 @@ diff --git a/gdb/target.h b/gdb/target.h struct expression *) TARGET_DEFAULT_RETURN (false); virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) + diff --git a/gdb-rhbz795424-bitpos-23of25.patch b/gdb-rhbz795424-bitpos-23of25.patch index ebbe69621935ee374899a9f92d3bc1c2613c6d57..72b23f4765ec0a489becab992a2c04286e115b4e 100644 --- a/gdb-rhbz795424-bitpos-23of25.patch +++ b/gdb-rhbz795424-bitpos-23of25.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-23of25.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html --MP_/X_WjDOvz/B_fvlsrmCwRdxe @@ -147,12 +138,12 @@ Content-Disposition: attachment; filename=bitpos-tdep.patch diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c -@@ -299,17 +299,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -300,17 +300,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int i; -- int accumulate_size = struct_return ? 8 : 0; -+ ssize_t accumulate_size = struct_return ? 8 : 0; +- int accumulate_size = (return_method == return_method_struct) ? 8 : 0; ++ ssize_t accumulate_size = (return_method == return_method_struct) ? 8 : 0; struct alpha_arg { const gdb_byte *contents; @@ -169,7 +160,7 @@ diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c CORE_ADDR func_addr = find_function_addr (function, NULL); /* The ABI places the address of the called function in T12. */ -@@ -429,8 +429,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -430,8 +430,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (i = nargs; m_arg--, --i >= 0;) { const gdb_byte *contents = m_arg->contents; @@ -180,7 +171,7 @@ diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c /* Copy the bytes destined for registers into arg_reg_buffer. */ if (offset < sizeof(arg_reg_buffer)) -@@ -442,7 +442,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -443,7 +443,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else { @@ -192,7 +183,7 @@ diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c -@@ -878,8 +878,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs, +@@ -883,8 +883,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args, }; struct value **stack_args = XALLOCAVEC (struct value *, nargs); int num_stack_args = 0; @@ -203,7 +194,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c int integer_reg = 0; int sse_reg = 0; int i; -@@ -891,7 +891,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs, +@@ -896,7 +896,7 @@ if (return_method == return_method_struct) for (i = 0; i < nargs; i++) { struct type *type = value_type (args[i]); @@ -212,7 +203,7 @@ diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c enum amd64_reg_class theclass[2]; int needed_integer_regs = 0; int needed_sse_regs = 0; -@@ -955,7 +955,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs, +@@ -960,7 +960,7 @@ if (return_method == return_method_struct) gdb_assert (regnum != -1); memset (buf, 0, sizeof buf); @@ -236,7 +227,7 @@ diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c -@@ -3468,7 +3468,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b) +@@ -3472,7 +3472,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b) array). Vector types are not currently supported, matching the generic AAPCS support. */ @@ -245,7 +236,7 @@ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c arm_vfp_cprc_sub_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type) { -@@ -3551,7 +3551,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, +@@ -3555,7 +3555,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, } else { @@ -254,7 +245,7 @@ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c unsigned unitlen; count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t), -@@ -3574,12 +3574,12 @@ arm_vfp_cprc_sub_candidate (struct type *t, +@@ -3578,12 +3578,12 @@ arm_vfp_cprc_sub_candidate (struct type *t, case TYPE_CODE_STRUCT: { @@ -269,7 +260,7 @@ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c if (!field_is_static (&TYPE_FIELD (t, i))) sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), -@@ -3603,13 +3603,15 @@ arm_vfp_cprc_sub_candidate (struct type *t, +@@ -3607,13 +3607,15 @@ arm_vfp_cprc_sub_candidate (struct type *t, case TYPE_CODE_UNION: { @@ -288,7 +279,7 @@ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c if (sub_count == -1) return -1; count = (count > sub_count ? count : sub_count); -@@ -3645,7 +3647,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type, +@@ -3649,7 +3651,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type, int *count) { enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN; @@ -297,7 +288,7 @@ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c if (c <= 0 || c > 4) return 0; *base_type = b; -@@ -3726,7 +3728,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -3731,7 +3733,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argnum = 0; argnum < nargs; argnum++) { @@ -325,7 +316,7 @@ diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c { struct stack_item *si; si = XNEW (struct stack_item); -@@ -1286,12 +1286,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -1287,12 +1287,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (i = 0; i < nargs; i++) { @@ -357,8 +348,8 @@ diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c { struct type *value_type = value_enclosing_type (args[i]); struct type *arg_type = check_typedef (value_type); -- int container_len = (TYPE_LENGTH (value_type) + 3) & ~3; -+ ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3; +- int container_len = (TYPE_LENGTH (arg_type) + 3) & ~3; ++ ssize_t container_len = (TYPE_LENGTH (arg_type) + 3) & ~3; sp -= container_len; write_memory (sp, value_contents (args[i]), container_len); @@ -381,7 +372,7 @@ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c { struct stack_item *si = XNEW (struct stack_item); si->data = (gdb_byte *) xmalloc (len); -@@ -833,13 +833,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -832,13 +832,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argnum = 0; argnum < nargs; argnum++) { @@ -402,8 +393,8 @@ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c -@@ -637,7 +637,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - int struct_return, CORE_ADDR struct_addr) +@@ -638,7 +638,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + CORE_ADDR struct_addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int stack_alloc = 0, stack_offset = 0; @@ -411,7 +402,7 @@ diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c int wordsize = BINWORD (gdbarch); int reg = E_ARG0_REGNUM; int argument; -@@ -663,11 +663,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -664,11 +664,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argument = 0; argument < nargs; argument++) { struct type *type = value_type (args[argument]); @@ -425,7 +416,7 @@ diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c /* Use std::vector here to get zero initialization. */ std::vector padded (padded_len); -@@ -696,7 +696,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -697,7 +697,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Heavens to Betsy --- it's really going in registers! Note that on the h8/300s, there are gaps between the registers in the register file. */ @@ -437,7 +428,7 @@ diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c -@@ -984,7 +984,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -985,7 +985,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { struct value *arg = args[i]; struct type *type = value_type (arg); @@ -446,7 +437,7 @@ diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c const bfd_byte *valbuf; bfd_byte fptrbuf[8]; int regnum; -@@ -1177,7 +1177,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -1178,7 +1178,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { @@ -458,7 +449,7 @@ diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c --- a/gdb/i386-darwin-tdep.c +++ b/gdb/i386-darwin-tdep.c -@@ -166,7 +166,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -167,7 +167,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (write_pass = 0; write_pass < 2; write_pass++) { @@ -466,11 +457,11 @@ diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c + LONGEST args_space = 0; int num_m128 = 0; - if (struct_return) + if (return_method == return_method_struct) diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -2678,7 +2678,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -2679,7 +2679,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, gdb_byte buf[4]; int i; int write_pass; @@ -479,16 +470,16 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c /* BND registers can be in arbitrary values at the moment of the inferior call. This can cause boundary violations that are not -@@ -2693,7 +2693,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -2694,7 +2694,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (write_pass = 0; write_pass < 2; write_pass++) { - int args_space_used = 0; + LONGEST args_space_used = 0; - if (struct_return) + if (return_method == return_method_struct) { -@@ -2710,7 +2710,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -2711,7 +2711,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (i = 0; i < nargs; i++) { @@ -497,7 +488,7 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c if (write_pass) { -@@ -2917,7 +2917,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) +@@ -2918,7 +2918,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum type_code code = TYPE_CODE (type); @@ -506,7 +497,7 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION -@@ -3703,7 +3703,7 @@ static int +@@ -3704,7 +3704,7 @@ static int i386_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) { @@ -515,7 +506,7 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c /* Values may be spread across multiple registers. Most debugging formats aren't expressive enough to specify the locations, so -@@ -3736,7 +3736,7 @@ i386_register_to_value (struct frame_info *frame, int regnum, +@@ -3737,7 +3737,7 @@ i386_register_to_value (struct frame_info *frame, int regnum, int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); @@ -524,7 +515,7 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c if (i386_fp_regnum_p (gdbarch, regnum)) return i387_register_to_value (frame, regnum, type, to, -@@ -3772,7 +3772,7 @@ static void +@@ -3773,7 +3773,7 @@ static void i386_value_to_register (struct frame_info *frame, int regnum, struct type *type, const gdb_byte *from) { @@ -536,7 +527,7 @@ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c -@@ -651,8 +651,9 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -652,8 +652,9 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const bfd_byte *val; bfd_byte buf[4]; struct type *type; @@ -572,7 +563,7 @@ diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION || code == TYPE_CODE_COMPLEX); -@@ -504,9 +504,9 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -505,9 +505,9 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (i = nargs - 1; i >= 0; i--) { struct type *value_type = value_enclosing_type (args[i]); @@ -588,7 +579,7 @@ diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c -@@ -2239,7 +2239,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv, +@@ -2238,7 +2238,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv, for (i = 0; i < argc; i++) { @@ -620,7 +611,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c if (mips_debug && out != NULL) { int i; -@@ -4543,13 +4543,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -4563,13 +4563,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -637,7 +628,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c /* The EABI passes structures that do not fit in a register by reference. */ -@@ -4819,7 +4819,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -4839,7 +4839,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function, static int mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, @@ -646,7 +637,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c { int i; -@@ -4834,7 +4834,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, +@@ -4854,7 +4854,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, for (i = 0; i < TYPE_NFIELDS (arg_type); i++) { @@ -655,16 +646,29 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c struct type *field_type; /* We're only looking at normal fields. */ -@@ -4876,7 +4876,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -4897,7 +4897,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int argreg; int float_argreg; int argnum; -- int len = 0; +- int arg_space = 0; ++ ULONGEST arg_space = 0; + LONGEST len = 0; int stack_offset = 0; enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5227,11 +5227,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -4926,9 +4927,9 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, +- "mips_n32n64_push_dummy_call: sp=%s allocated %ld\n", ++ "mips_n32n64_push_dummy_call: sp=%s allocated %s\n", + paddress (gdbarch, sp), +- (long) align_up (arg_space, 16)); ++ pulongest (align_up (arg_space, 16))); + + /* Initialize the integer and float register pointers. */ + argreg = MIPS_A0_REGNUM; +@@ -5249,11 +5250,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, : MIPS_V0_REGNUM); field < TYPE_NFIELDS (type); field++, regnum += 2) { @@ -680,7 +684,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16) { /* A 16-byte long double field goes in two consecutive -@@ -5273,8 +5273,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -5295,8 +5296,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) @@ -691,16 +695,29 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c mips_xfer_register (gdbarch, regcache, gdbarch_num_regs (gdbarch) + regnum, xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf, -@@ -5332,7 +5332,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5355,7 +5356,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int argreg; int float_argreg; int argnum; -- int len = 0; +- int arg_space = 0; ++ ULONGEST arg_space = 0; + LONGEST len = 0; int stack_offset = 0; enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5396,13 +5396,13 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5392,9 +5394,9 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, +- "mips_o32_push_dummy_call: sp=%s allocated %ld\n", ++ "mips_o32_push_dummy_call: sp=%s allocated %s\n", + paddress (gdbarch, sp), +- (long) align_up (arg_space, 16)); ++ pulongest (align_up (arg_space, 16))); + + /* Initialize the integer and float register pointers. */ + argreg = MIPS_A0_REGNUM; +@@ -5420,13 +5422,13 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const gdb_byte *val; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -717,18 +734,30 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c val = value_contents (arg); -@@ -5856,8 +5856,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5880,8 +5882,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int argreg; int float_argreg; int argnum; -- int len = 0; +- int arg_space = 0; - int stack_offset = 0; -+ LONGEST len = 0; ++ ULONGEST arg_space = 0; + LONGEST stack_offset = 0; enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5917,13 +5917,13 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5914,9 +5916,9 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, +- "mips_o64_push_dummy_call: sp=%s allocated %ld\n", ++ "mips_o64_push_dummy_call: sp=%s allocated %s\n", + paddress (gdbarch, sp), +- (long) align_up (arg_space, 16)); ++ pulongest (align_up (arg_space, 16))); + + /* Initialize the integer and float register pointers. */ + argreg = MIPS_A0_REGNUM; +@@ -5942,13 +5944,13 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const gdb_byte *val; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -760,7 +789,7 @@ diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c -@@ -68,7 +68,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -69,7 +69,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function)); ULONGEST saved_sp; @@ -769,7 +798,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c int write_pass; gdb_assert (tdep->wordsize == 4); -@@ -99,9 +99,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -100,9 +100,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Next available vector register for vector arguments. */ int vreg = 2; /* Arguments start above the "LR save word" and "Back chain". */ @@ -781,7 +810,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c /* If the function is returning a `struct', then the first word (which will be passed in r3) is used for struct return -@@ -120,7 +120,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -121,7 +121,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { struct value *arg = args[argno]; struct type *type = check_typedef (value_type (arg)); @@ -790,7 +819,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c const bfd_byte *val = value_contents (arg); if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8 -@@ -1246,11 +1246,11 @@ struct ppc64_sysv_argpos +@@ -1247,11 +1247,11 @@ struct ppc64_sysv_argpos static void ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, @@ -804,7 +833,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c /* Enforce alignment of stack location, if requested. */ if (align > tdep->wordsize) -@@ -1287,7 +1287,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, +@@ -1288,7 +1288,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, { if (argpos->regcache && argpos->greg <= 10) argpos->regcache->cooked_write_part @@ -813,7 +842,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c argpos->greg++; } } -@@ -1346,7 +1346,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, +@@ -1347,7 +1347,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, if (argpos->regcache && argpos->freg <= 13) { int regnum = tdep->ppc_fp0_regnum + argpos->freg; @@ -822,7 +851,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) offset = 8 - TYPE_LENGTH (type); -@@ -1795,7 +1795,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, +@@ -1797,7 +1797,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) { int regnum = tdep->ppc_fp0_regnum + 1 + index; @@ -831,7 +860,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) offset = 8 - TYPE_LENGTH (valtype); -@@ -1871,7 +1871,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, +@@ -1873,7 +1873,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) { int regnum = tdep->ppc_gp0_regnum + 3 + index; @@ -840,7 +869,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) offset = 8 - TYPE_LENGTH (valtype); -@@ -1979,7 +1979,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -1981,7 +1981,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) { int regnum = tdep->ppc_gp0_regnum + 3; @@ -853,7 +882,7 @@ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c -@@ -1346,8 +1346,8 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -1347,8 +1347,8 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (i = nargs - 1; i >= 0; i--) { struct type *value_type = value_enclosing_type (args[i]); @@ -867,7 +896,7 @@ diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c -@@ -177,9 +177,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -291,9 +291,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int ii; @@ -879,7 +908,7 @@ diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c gdb_byte tmp_buffer[50]; int f_argno = 0; /* current floating point argno */ int wordsize = gdbarch_tdep (gdbarch)->wordsize; -@@ -307,7 +307,7 @@ ran_out_of_registers_for_arguments: +@@ -421,7 +421,7 @@ ran_out_of_registers_for_arguments: if ((argno < nargs) || argbytes) { @@ -891,7 +920,7 @@ diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c -@@ -516,7 +516,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -517,7 +517,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int argnum; int argreg; @@ -931,7 +960,7 @@ diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c int pass_on_stack = 0; int treat_as_flt; int last_reg_arg = INT_MAX; -@@ -1215,7 +1216,8 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, +@@ -1216,7 +1217,8 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, struct type *type; CORE_ADDR regval; const gdb_byte *val; @@ -944,7 +973,7 @@ diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c -@@ -1205,7 +1205,7 @@ sparc64_16_byte_align_p (struct type *type) +@@ -1206,7 +1206,7 @@ sparc64_16_byte_align_p (struct type *type) static void sparc64_store_floating_fields (struct regcache *regcache, struct type *type, @@ -953,7 +982,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c { struct gdbarch *gdbarch = regcache->arch (); int len = TYPE_LENGTH (type); -@@ -1265,7 +1265,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, +@@ -1266,7 +1266,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, for (i = 0; i < TYPE_NFIELDS (type); i++) { struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -962,7 +991,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c sparc64_store_floating_fields (regcache, subtype, valbuf, element, subpos); -@@ -1297,7 +1297,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, +@@ -1298,7 +1298,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, static void sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, @@ -971,7 +1000,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c { struct gdbarch *gdbarch = regcache->arch (); -@@ -1353,7 +1353,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, +@@ -1354,7 +1354,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, for (i = 0; i < TYPE_NFIELDS (type); i++) { struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -980,7 +1009,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos); } -@@ -1386,7 +1386,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, +@@ -1388,7 +1388,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, for (i = 0; i < nargs; i++) { struct type *type = value_type (args[i]); @@ -989,7 +1018,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c if (sparc64_structure_or_union_p (type) || (sparc64_complex_floating_p (type) && len == 32)) -@@ -1486,7 +1486,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, +@@ -1488,7 +1488,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, { const gdb_byte *valbuf = value_contents (args[i]); struct type *type = value_type (args[i]); @@ -1001,7 +1030,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c -@@ -1431,7 +1431,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -1432,7 +1432,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct value *arg = args[i]; struct type *type = check_typedef (value_type (arg)); const gdb_byte *contents = value_contents (arg); @@ -1010,7 +1039,7 @@ diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c /* If the argument doesn't wholly fit into registers, it and all subsequent arguments go to the stack. */ -@@ -1463,7 +1463,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -1464,7 +1464,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { struct value *arg = args[i]; struct type *type = check_typedef (value_type (arg)); @@ -1028,10 +1057,10 @@ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c int stack_offset = 4; - int references_offset = 4; + LONGEST references_offset = 4; - CORE_ADDR func_addr = find_function_addr (function, NULL); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct type *func_type = value_type (function); -@@ -915,7 +915,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + /* The first arg passed on stack. Mostly the first 10 args are passed by +@@ -914,7 +914,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) { @@ -1040,7 +1069,7 @@ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c if (argnum >= 10 - argreg) references_offset += len; stack_offset += len; -@@ -934,7 +934,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -933,7 +933,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const gdb_byte *val; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -1049,7 +1078,7 @@ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c enum type_code typecode = TYPE_CODE (arg_type); val = value_contents (arg); -@@ -1090,7 +1090,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -1088,7 +1088,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else internal_error (__FILE__, __LINE__, @@ -1074,16 +1103,17 @@ diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c -@@ -1019,7 +1019,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch, +@@ -1019,7 +1019,8 @@ v850_push_dummy_call (struct gdbarch *gdbarch, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int argreg; int argnum; -- int len = 0; +- int arg_space = 0; ++ ULONGEST arg_space = 0; + LONGEST len = 0; int stack_offset; if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850) -@@ -1047,7 +1047,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch, +@@ -1047,7 +1048,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch, in four registers available. Loop thru args from first to last. */ for (argnum = 0; argnum < nargs; argnum++) { @@ -1116,7 +1146,7 @@ diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c -@@ -232,8 +232,9 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch, +@@ -233,8 +233,10 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR stack_dest = sp; int argreg = E_1ST_ARG_REGNUM; @@ -1125,13 +1155,14 @@ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c + int i, slacklen; + LONGEST j; + LONGEST typelen; - const gdb_byte *val; ++ const gdb_byte *val; gdb_byte buf[xstormy16_pc_size]; + /* If returning a struct using target ABI method, then the struct return diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c -@@ -1626,8 +1626,7 @@ xtensa_store_return_value (struct type *type, +@@ -1615,8 +1615,7 @@ xtensa_store_return_value (struct type *type, if (len > (callsize > 8 ? 8 : 16)) internal_error (__FILE__, __LINE__, @@ -1141,11 +1172,12 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c areg = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb); -@@ -1701,18 +1700,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1689,18 +1688,19 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, + CORE_ADDR struct_addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int i; - int size, onstack_size; ++ int i; + LONGEST size, onstack_size; gdb_byte *buf = (gdb_byte *) alloca (16); CORE_ADDR ra, ps; @@ -1163,7 +1195,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c int regno; /* regno if in register. */ } u; }; -@@ -1736,9 +1735,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1723,9 +1723,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, { struct value *arg = args[i]; struct type *arg_type = check_typedef (value_type (arg)); @@ -1177,7 +1209,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c switch (TYPE_CODE (arg_type)) { case TYPE_CODE_INT: -@@ -1808,8 +1808,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1794,8 +1795,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long); break; } @@ -1187,7 +1219,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c /* Align size and onstack_size. */ size = (size + info->align - 1) & ~(info->align - 1); -@@ -1854,7 +1854,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1840,7 +1841,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, if (info->onstack) { @@ -1196,7 +1228,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c CORE_ADDR offset = sp + info->u.offset; /* Odd-sized structs are aligned to the lower side of a memory -@@ -1870,7 +1870,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1856,7 +1857,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, } else { @@ -1205,3 +1237,4 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c const bfd_byte *cp = info->contents; int r = info->u.regno; + diff --git a/gdb-rhbz795424-bitpos-25of25-test.patch b/gdb-rhbz795424-bitpos-25of25-test.patch index 1738f5b81e00f0fdc61b31fc708a9f762d356d9e..09858b416c8fb61e1d974702da9666dabce57f1e 100644 --- a/gdb-rhbz795424-bitpos-25of25-test.patch +++ b/gdb-rhbz795424-bitpos-25of25-test.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-25of25-test.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - http://sourceware.org/ml/gdb-patches/2012-10/msg00231.html On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote: @@ -636,3 +627,4 @@ new file mode 100644 + stop + end + + diff --git a/gdb-rhbz795424-bitpos-25of25.patch b/gdb-rhbz795424-bitpos-25of25.patch index de6a324f031ec03e718b8c6802603f30f760c764..1feb24f2ae1d50f0545506a73728cc0eb6f29875 100644 --- a/gdb-rhbz795424-bitpos-25of25.patch +++ b/gdb-rhbz795424-bitpos-25of25.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-25of25.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html --MP_/90J7bck2fqDySEX9JkZtaqL @@ -57,7 +48,7 @@ Content-Disposition: attachment; filename=f77-bounds.patch diff --git a/gdb/f-lang.h b/gdb/f-lang.h --- a/gdb/f-lang.h +++ b/gdb/f-lang.h -@@ -47,9 +47,9 @@ struct common_block +@@ -50,9 +50,9 @@ struct common_block struct symbol *contents[1]; }; @@ -138,3 +129,4 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c f77_get_upperbound (struct type *type) { if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + diff --git a/gdb-rhbz795424-bitpos-arrayview.patch b/gdb-rhbz795424-bitpos-arrayview.patch new file mode 100644 index 0000000000000000000000000000000000000000..791cdbd229f6a2403d0a7aeee143c297d9f9aca6 --- /dev/null +++ b/gdb-rhbz795424-bitpos-arrayview.patch @@ -0,0 +1,52 @@ +diff --git a/gdb/common/array-view.h b/gdb/common/array-view.h +--- a/gdb/common/array-view.h ++++ b/gdb/common/array-view.h +@@ -85,7 +85,7 @@ public: + using value_type = T; + using reference = T &; + using const_reference = const T &; +- using size_type = size_t; ++ using size_type = ULONGEST; + + /* Default construction creates an empty view. */ + constexpr array_view () noexcept +@@ -114,7 +114,7 @@ public: + count. */ + template>> +- constexpr array_view (U *array, size_t size) noexcept ++ constexpr array_view (U *array, ULONGEST size) noexcept + : m_array (array), m_size (size) + {} + +@@ -128,7 +128,7 @@ public: + {} + + /* Create an array view from an array. */ +- template>> + constexpr array_view (U (&array)[Size]) noexcept + : m_array (array), m_size (Size) +@@ -161,9 +161,9 @@ public: + /*constexpr14*/ T *end () noexcept { return m_array + m_size; } + constexpr const T *end () const noexcept { return m_array + m_size; } + +- /*constexpr14*/ reference operator[] (size_t index) noexcept ++ /*constexpr14*/ reference operator[] (ULONGEST index) noexcept + { return m_array[index]; } +- constexpr const_reference operator[] (size_t index) const noexcept ++ constexpr const_reference operator[] (ULONGEST index) const noexcept + { return m_array[index]; } + + constexpr size_type size () const noexcept { return m_size; } +@@ -196,7 +196,7 @@ operator== (const gdb::array_view &lhs, const gdb::array_view &rhs) + if (lhs.size () != rhs.size ()) + return false; + +- for (size_t i = 0; i < lhs.size (); i++) ++ for (ULONGEST i = 0; i < lhs.size (); i++) + if (!(lhs[i] == rhs[i])) + return false; + + diff --git a/gdb-rhbz795424-bitpos-lazyvalue.patch b/gdb-rhbz795424-bitpos-lazyvalue.patch index 0f5c2e8aa439171675cc6223a4a3aa01d869ac9e..9c77b653cae5c5cc626dc35199c405f2384b4d91 100644 --- a/gdb-rhbz795424-bitpos-lazyvalue.patch +++ b/gdb-rhbz795424-bitpos-lazyvalue.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz795424-bitpos-lazyvalue.patch - -;; Fix `GDB cannot access struct member whose offset is larger than 256MB' -;; (RH BZ 795424). -;;=push - diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.S b/gdb/testsuite/gdb.base/longest-types-64bit.S new file mode 100644 --- /dev/null @@ -430,3 +421,4 @@ new file mode 100644 +} + +test "native" + diff --git a/gdb-rhbz881849-ipv6-1of3.patch b/gdb-rhbz881849-ipv6-1of3.patch deleted file mode 100644 index 542db3a59f48e4f0d224255300dcd84a582bcc98..0000000000000000000000000000000000000000 --- a/gdb-rhbz881849-ipv6-1of3.patch +++ /dev/null @@ -1,1934 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Fri, 18 May 2018 01:29:24 -0400 -Subject: gdb-rhbz881849-ipv6-1of3.patch - -;; Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). - -Implement IPv6 support for GDB/gdbserver - -This patch implements IPv6 support for both GDB and gdbserver. Based -on my research, it is the fourth attempt to do that since 2006. Since -I used ideas from all of the previous patches, I also added their -authors's names on the ChangeLogs as a way to recognize their -efforts. For reference sake, you can find the previous attempts at: - - https://sourceware.org/ml/gdb-patches/2006-09/msg00192.html - - https://sourceware.org/ml/gdb-patches/2014-02/msg00248.html - - https://sourceware.org/ml/gdb-patches/2016-02/msg00226.html - -The basic idea behind the patch is to start using the new -'getaddrinfo'/'getnameinfo' calls, which are responsible for -translating names and addresses in a protocol-independent way. This -means that if we ever have a new version of the IP protocol, we won't -need to change the code again (or, at least, won't have to change the -majority of the code). - -The function 'getaddrinfo' returns a linked list of possible addresses -to connect to. Dealing with multiple addresses proved to be a hard -task with the current TCP auto-retry mechanism implemented on -ser-tcp:net_open. For example, when gdbserver listened only on an -IPv4 socket: - - $ ./gdbserver --once 127.0.0.1:1234 ./a.out - -and GDB was instructed to try to connect to both IPv6 and IPv4 -sockets: - - $ ./gdb -ex 'target extended-remote localhost:1234' ./a.out - -the user would notice a somewhat big delay before GDB was able to -connect to the IPv4 socket. This happened because GDB was trying to -connect to the IPv6 socket first, and had to wait until the connection -timed out before it tried to connect to the IPv4 socket. - -For that reason, I had to rewrite the main loop and implement a new -method for handling multiple connections. After some discussion, -Pedro and I agreed on the following algorithm: - - 1) For each entry returned by 'getaddrinfo', we try to open a socket - and connect to it. - - 2.a) If we have a successful 'connect', we just use that connection. - - 2.b) If we don't have a successfull 'connect', but if we've got a - ECONNREFUSED (meaning the the connection was refused), we keep track - of this fact by using a flag. - - 2.c) If we don't have a successfull 'connect', but if we've got a - EINPROGRESS (meaning that the connection is in progress), we perform - a 'select' call on the socket until we have a result (either a - successful connection, or an error on the socket). - - 3) If tcp_auto_retry is true, and we haven't gotten a successful - connection, and at least one of our attempts failed with - ECONNREFUSED, then we wait a little bit (i.e., call - 'wait_for_connect'), check to see if there was a - timeout/interruption (in which case we bail out), and then go back - to (1). - -After multiple tests, I was able to connect without delay on the -scenario described above, and was also able to connect in all other -types of scenarios. - -I also implemented some hostname parsing functions (along with their -corresponding unit tests) which are used to help GDB and gdbserver to -parse hostname strings provided by the user. These new functions are -living inside common/netstuff.[ch]. I've had to do that since IPv6 -introduces a new URL scheme, which defines that square brackets can be -used to enclose the host part and differentiate it from the -port (e.g., "[::1]:1234" means "host ::1, port 1234"). I spent some -time thinking about a reasonable way to interpret what the user wants, -and I came up with the following: - - - If the user has provided a prefix that doesn't specify the protocol - version (i.e., "tcp:" or "udp:"), or if the user has not provided - any prefix, don't make any assumptions (i.e., assume AF_UNSPEC when - dealing with 'getaddrinfo') *unless* the host starts with "[" (in - which case, assume it's an IPv6 host). - - - If the user has provided a prefix that does specify the protocol - version (i.e., "tcp4:", "tcp6:", "udp4:" or "udp6:"), then respect - that. - -This method doesn't follow strictly what RFC 2732 proposes (that -literal IPv6 addresses should be provided enclosed in "[" and "]") -because IPv6 addresses still can be provided without square brackets -in our case, but since we have prefixes to specify protocol versions I -think this is not an issue. - -Another thing worth mentioning is the new 'GDB_TEST_SOCKETHOST' -testcase parameter, which makes it possible to specify the -hostname (without the port) to be used when testing GDB and -gdbserver. For example, to run IPv6 tests: - - $ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]' - -Or, to run IPv4 tests: - - $ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp4:127.0.0.1' - -This required a few changes on the gdbserver-base.exp, and also a -minimal adjustment on gdb.server/run-without-local-binary.exp. - -Finally, I've implemented a new testcase, -gdb.server/server-connect.exp, which is supposed to run on the native -host and perform various "smoke tests" using different connection -methods. - -This patch has been regression-tested on BuildBot and locally, and -also built using a x86_64-w64-mingw32 GCC, and no problems were found. - -gdb/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - Pedro Alves - - * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add - 'unittests/parse-connection-spec-selftests.c'. - (COMMON_SFILES): Add 'common/netstuff.c'. - (HFILES_NO_SRCDIR): Add 'common/netstuff.h'. - * NEWS (Changes since GDB 8.2): Mention IPv6 support. - * common/netstuff.c: New file. - * common/netstuff.h: New file. - * ser-tcp.c: Include 'netstuff.h' and 'wspiapi.h'. - (wait_for_connect): Update comment. New parameter - 'gdb::optional sock' instead of 'struct serial *scb'. - Use 'sock' directly instead of 'scb->fd'. - (try_connect): New function, with code from 'net_open'. - (net_open): Rewrite main loop to deal with multiple - sockets/addresses. Handle IPv6-style hostnames; implement - support for IPv6 connections. - * unittests/parse-connection-spec-selftests.c: New file. - -gdb/gdbserver/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - - * Makefile.in (SFILES): Add '$(srcdir)/common/netstuff.c'. - (OBS): Add 'common/netstuff.o'. - (GDBREPLAY_OBS): Likewise. - * gdbreplay.c: Include 'wspiapi.h' and 'netstuff.h'. - (remote_open): Implement support for IPv6 - connections. - * remote-utils.c: Include 'netstuff.h', 'filestuff.h' - and 'wspiapi.h'. - (handle_accept_event): Accept connections from IPv6 sources. - (remote_prepare): Handle IPv6-style hostnames; implement - support for IPv6 connections. - (remote_open): Implement support for printing connections from - IPv6 sources. - -gdb/testsuite/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - - * README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST' - parameter. - * boards/native-extended-gdbserver.exp: Do not set 'sockethost' - by default. - * boards/native-gdbserver.exp: Likewise. - * gdb.server/run-without-local-binary.exp: Improve regexp used - for detecting when a remote debugging connection succeeds. - * gdb.server/server-connect.exp: New file. - * lib/gdbserver-support.exp (gdbserver_default_get_comm_port): - Do not prefix the port number with ":". - (gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement - support for detecting and using it. Add '$debughost_gdbserver' - to the list of arguments used to start gdbserver. Handle case - when gdbserver cannot resolve a network name. - -gdb/doc/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - - * gdb.texinfo (Remote Connection Commands): Add explanation - about new IPv6 support. Add new connection prefixes. - -diff --git a/gdb/Makefile.in b/gdb/Makefile.in ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -430,6 +430,7 @@ SUBDIR_UNITTESTS_SRCS = \ - unittests/offset-type-selftests.c \ - unittests/observable-selftests.c \ - unittests/optional-selftests.c \ -+ unittests/parse-connection-spec-selftests.c \ - unittests/ptid-selftests.c \ - unittests/rsp-low-selftests.c \ - unittests/scoped_fd-selftests.c \ -@@ -967,6 +968,7 @@ COMMON_SFILES = \ - common/job-control.c \ - common/gdb_tilde_expand.c \ - common/gdb_vecs.c \ -+ common/netstuff.c \ - common/new-op.c \ - common/pathstuff.c \ - common/print-utils.c \ -@@ -1448,6 +1450,7 @@ HFILES_NO_SRCDIR = \ - common/gdb_vecs.h \ - common/gdb_wait.h \ - common/common-inferior.h \ -+ common/netstuff.h \ - common/host-defs.h \ - common/pathstuff.h \ - common/print-utils.h \ -diff --git a/gdb/NEWS b/gdb/NEWS ---- a/gdb/NEWS -+++ b/gdb/NEWS -@@ -1,6 +1,12 @@ - What has changed in GDB? - (Organized release by release) - -+*** Changes since GDB 8.2 -+ -+* GDB and GDBserver now support IPv6 connections. IPv6 addresses -+ can be passed using the '[ADDRESS]:PORT' notation, or the regular -+ 'ADDRESS:PORT' method. -+ - *** Changes in GDB 8.2 - - * The 'set disassembler-options' command now supports specifying options -diff --git a/gdb/common/netstuff.c b/gdb/common/netstuff.c -new file mode 100644 ---- /dev/null -+++ b/gdb/common/netstuff.c -@@ -0,0 +1,155 @@ -+/* Operations on network stuff. -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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 . */ -+ -+#include "common-defs.h" -+#include "netstuff.h" -+#include -+ -+#ifdef USE_WIN32API -+#include -+#include -+#else -+#include -+#include -+#include -+#include -+#include -+#endif -+ -+/* See common/netstuff.h. */ -+ -+scoped_free_addrinfo::~scoped_free_addrinfo () -+{ -+ freeaddrinfo (m_res); -+} -+ -+/* See common/netstuff.h. */ -+ -+parsed_connection_spec -+parse_connection_spec_without_prefix (std::string spec, struct addrinfo *hint) -+{ -+ parsed_connection_spec ret; -+ size_t last_colon_pos = 0; -+ /* We're dealing with IPv6 if: -+ -+ - ai_family is AF_INET6, or -+ - ai_family is not AF_INET, and -+ - spec[0] is '[', or -+ - the number of ':' on spec is greater than 1. */ -+ bool is_ipv6 = (hint->ai_family == AF_INET6 -+ || (hint->ai_family != AF_INET -+ && (spec[0] == '[' -+ || std::count (spec.begin (), -+ spec.end (), ':') > 1))); -+ -+ if (is_ipv6) -+ { -+ if (spec[0] == '[') -+ { -+ /* IPv6 addresses can be written as '[ADDR]:PORT', and we -+ support this notation. */ -+ size_t close_bracket_pos = spec.find_first_of (']'); -+ -+ if (close_bracket_pos == std::string::npos) -+ error (_("Missing close bracket in hostname '%s'"), -+ spec.c_str ()); -+ -+ hint->ai_family = AF_INET6; -+ -+ const char c = spec[close_bracket_pos + 1]; -+ -+ if (c == '\0') -+ last_colon_pos = std::string::npos; -+ else if (c != ':') -+ error (_("Invalid cruft after close bracket in '%s'"), -+ spec.c_str ()); -+ -+ /* Erase both '[' and ']'. */ -+ spec.erase (0, 1); -+ spec.erase (close_bracket_pos - 1, 1); -+ } -+ else if (spec.find_first_of (']') != std::string::npos) -+ error (_("Missing open bracket in hostname '%s'"), -+ spec.c_str ()); -+ } -+ -+ if (last_colon_pos == 0) -+ last_colon_pos = spec.find_last_of (':'); -+ -+ /* The length of the hostname part. */ -+ size_t host_len; -+ -+ if (last_colon_pos != std::string::npos) -+ { -+ /* The user has provided a port. */ -+ host_len = last_colon_pos; -+ ret.port_str = spec.substr (last_colon_pos + 1); -+ } -+ else -+ host_len = spec.size (); -+ -+ ret.host_str = spec.substr (0, host_len); -+ -+ /* Default hostname is localhost. */ -+ if (ret.host_str.empty ()) -+ ret.host_str = "localhost"; -+ -+ return ret; -+} -+ -+/* See common/netstuff.h. */ -+ -+parsed_connection_spec -+parse_connection_spec (const char *spec, struct addrinfo *hint) -+{ -+ /* Struct to hold the association between valid prefixes, their -+ family and socktype. */ -+ struct host_prefix -+ { -+ /* The prefix. */ -+ const char *prefix; -+ -+ /* The 'ai_family'. */ -+ int family; -+ -+ /* The 'ai_socktype'. */ -+ int socktype; -+ }; -+ static const struct host_prefix prefixes[] = -+ { -+ { "udp:", AF_UNSPEC, SOCK_DGRAM }, -+ { "tcp:", AF_UNSPEC, SOCK_STREAM }, -+ { "udp4:", AF_INET, SOCK_DGRAM }, -+ { "tcp4:", AF_INET, SOCK_STREAM }, -+ { "udp6:", AF_INET6, SOCK_DGRAM }, -+ { "tcp6:", AF_INET6, SOCK_STREAM }, -+ }; -+ -+ for (const host_prefix prefix : prefixes) -+ if (startswith (spec, prefix.prefix)) -+ { -+ spec += strlen (prefix.prefix); -+ hint->ai_family = prefix.family; -+ hint->ai_socktype = prefix.socktype; -+ hint->ai_protocol -+ = hint->ai_socktype == SOCK_DGRAM ? IPPROTO_UDP : IPPROTO_TCP; -+ break; -+ } -+ -+ return parse_connection_spec_without_prefix (spec, hint); -+} -diff --git a/gdb/common/netstuff.h b/gdb/common/netstuff.h -new file mode 100644 ---- /dev/null -+++ b/gdb/common/netstuff.h -@@ -0,0 +1,76 @@ -+/* Operations on network stuff. -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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 . */ -+ -+#ifndef NETSTUFF_H -+#define NETSTUFF_H -+ -+#include -+ -+/* Like NI_MAXHOST/NI_MAXSERV, but enough for numeric forms. */ -+#define GDB_NI_MAX_ADDR 64 -+#define GDB_NI_MAX_PORT 16 -+ -+/* Helper class to guarantee that we always call 'freeaddrinfo'. */ -+ -+class scoped_free_addrinfo -+{ -+public: -+ /* Default constructor. */ -+ explicit scoped_free_addrinfo (struct addrinfo *ainfo) -+ : m_res (ainfo) -+ { -+ } -+ -+ /* Destructor responsible for free'ing M_RES by calling -+ 'freeaddrinfo'. */ -+ ~scoped_free_addrinfo (); -+ -+ DISABLE_COPY_AND_ASSIGN (scoped_free_addrinfo); -+ -+private: -+ /* The addrinfo resource. */ -+ struct addrinfo *m_res; -+}; -+ -+/* The struct we return after parsing the connection spec. */ -+ -+struct parsed_connection_spec -+{ -+ /* The hostname. */ -+ std::string host_str; -+ -+ /* The port, if any. */ -+ std::string port_str; -+}; -+ -+ -+/* Parse SPEC (which is a string in the form of "ADDR:PORT") and -+ return a 'parsed_connection_spec' structure with the proper fields -+ filled in. Also adjust HINT accordingly. */ -+extern parsed_connection_spec -+ parse_connection_spec_without_prefix (std::string spec, -+ struct addrinfo *hint); -+ -+/* Parse SPEC (which is a string in the form of -+ "[tcp[6]:|udp[6]:]ADDR:PORT") and return a 'parsed_connection_spec' -+ structure with the proper fields filled in. Also adjust HINT -+ accordingly. */ -+extern parsed_connection_spec parse_connection_spec (const char *spec, -+ struct addrinfo *hint); -+ -+#endif /* ! NETSTUFF_H */ -diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog ---- a/gdb/doc/ChangeLog -+++ b/gdb/doc/ChangeLog -@@ -1,3 +1,11 @@ -+2018-07-11 Sergio Durigan Junior -+ Jan Kratochvil -+ Paul Fertser -+ Tsutomu Seki -+ -+ * gdb.texinfo (Remote Connection Commands): Add explanation -+ about new IPv6 support. Add new connection prefixes. -+ - 2018-08-21 Alan Hayward - - * gdb.texinfo (AArch64 SVE): New subsubsection. -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -20548,16 +20548,27 @@ If you're using a serial line, you may want to give @value{GDBN} the - @code{target} command. - - @item target remote @code{@var{host}:@var{port}} -+@itemx target remote @code{@var{[host]}:@var{port}} - @itemx target remote @code{tcp:@var{host}:@var{port}} -+@itemx target remote @code{tcp:@var{[host]}:@var{port}} -+@itemx target remote @code{tcp4:@var{host}:@var{port}} -+@itemx target remote @code{tcp6:@var{host}:@var{port}} -+@itemx target remote @code{tcp6:@var{[host]}:@var{port}} - @itemx target extended-remote @code{@var{host}:@var{port}} -+@itemx target extended-remote @code{@var{[host]}:@var{port}} - @itemx target extended-remote @code{tcp:@var{host}:@var{port}} -+@itemx target extended-remote @code{tcp:@var{[host]}:@var{port}} -+@itemx target extended-remote @code{tcp4:@var{host}:@var{port}} -+@itemx target extended-remote @code{tcp6:@var{host}:@var{port}} -+@itemx target extended-remote @code{tcp6:@var{[host]}:@var{port}} - @cindex @acronym{TCP} port, @code{target remote} - Debug using a @acronym{TCP} connection to @var{port} on @var{host}. --The @var{host} may be either a host name or a numeric @acronym{IP} --address; @var{port} must be a decimal number. The @var{host} could be --the target machine itself, if it is directly connected to the net, or --it might be a terminal server which in turn has a serial line to the --target. -+The @var{host} may be either a host name, a numeric @acronym{IPv4} -+address, or a numeric @acronym{IPv6} address (with or without the -+square brackets to separate the address from the port); @var{port} -+must be a decimal number. The @var{host} could be the target machine -+itself, if it is directly connected to the net, or it might be a -+terminal server which in turn has a serial line to the target. - - For example, to connect to port 2828 on a terminal server named - @code{manyfarms}: -@@ -20566,6 +20577,28 @@ For example, to connect to port 2828 on a terminal server named - target remote manyfarms:2828 - @end smallexample - -+To connect to port 2828 on a terminal server whose address is -+@code{2001:0db8:85a3:0000:0000:8a2e:0370:7334}, you can either use the -+square bracket syntax: -+ -+@smallexample -+target remote [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2828 -+@end smallexample -+ -+@noindent -+or explicitly specify the @acronym{IPv6} protocol: -+ -+@smallexample -+target remote tcp6:2001:0db8:85a3:0000:0000:8a2e:0370:7334:2828 -+@end smallexample -+ -+This last example may be confusing to the reader, because there is no -+visible separation between the hostname and the port number. -+Therefore, we recommend the user to provide @acronym{IPv6} addresses -+using square brackets for clarity. However, it is important to -+mention that for @value{GDBN} there is no ambiguity: the number after -+the last colon is considered to be the port number. -+ - If your remote target is actually running on the same machine as your - debugger session (e.g.@: a simulator for your target running on the - same host), you can omit the hostname. For example, to connect to -@@ -20579,7 +20612,15 @@ target remote :1234 - Note that the colon is still required here. - - @item target remote @code{udp:@var{host}:@var{port}} -+@itemx target remote @code{udp:@var{[host]}:@var{port}} -+@itemx target remote @code{udp4:@var{host}:@var{port}} -+@itemx target remote @code{udp6:@var{[host]}:@var{port}} -+@itemx target extended-remote @code{udp:@var{host}:@var{port}} - @itemx target extended-remote @code{udp:@var{host}:@var{port}} -+@itemx target extended-remote @code{udp:@var{[host]}:@var{port}} -+@itemx target extended-remote @code{udp4:@var{host}:@var{port}} -+@itemx target extended-remote @code{udp6:@var{host}:@var{port}} -+@itemx target extended-remote @code{udp6:@var{[host]}:@var{port}} - @cindex @acronym{UDP} port, @code{target remote} - Debug using @acronym{UDP} packets to @var{port} on @var{host}. For example, to - connect to @acronym{UDP} port 2828 on a terminal server named @code{manyfarms}: -diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog ---- a/gdb/gdbserver/ChangeLog -+++ b/gdb/gdbserver/ChangeLog -@@ -1,3 +1,22 @@ -+2018-07-11 Sergio Durigan Junior -+ Jan Kratochvil -+ Paul Fertser -+ Tsutomu Seki -+ -+ * Makefile.in (SFILES): Add '$(srcdir)/common/netstuff.c'. -+ (OBS): Add 'common/netstuff.o'. -+ (GDBREPLAY_OBS): Likewise. -+ * gdbreplay.c: Include 'wspiapi.h' and 'netstuff.h'. -+ (remote_open): Implement support for IPv6 -+ connections. -+ * remote-utils.c: Include 'netstuff.h', 'filestuff.h' -+ and 'wspiapi.h'. -+ (handle_accept_event): Accept connections from IPv6 sources. -+ (remote_prepare): Handle IPv6-style hostnames; implement -+ support for IPv6 connections. -+ (remote_open): Implement support for printing connections from -+ IPv6 sources. -+ - 2018-08-26 Simon Marchi - - PR gdb/23374 -diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in ---- a/gdb/gdbserver/Makefile.in -+++ b/gdb/gdbserver/Makefile.in -@@ -211,6 +211,7 @@ SFILES = \ - $(srcdir)/common/job-control.c \ - $(srcdir)/common/gdb_tilde_expand.c \ - $(srcdir)/common/gdb_vecs.c \ -+ $(srcdir)/common/netstuff.c \ - $(srcdir)/common/new-op.c \ - $(srcdir)/common/pathstuff.c \ - $(srcdir)/common/print-utils.c \ -@@ -254,6 +255,7 @@ OBS = \ - common/format.o \ - common/gdb_tilde_expand.o \ - common/gdb_vecs.o \ -+ common/netstuff.o \ - common/new-op.o \ - common/pathstuff.o \ - common/print-utils.o \ -@@ -290,6 +292,7 @@ GDBREPLAY_OBS = \ - common/common-exceptions.o \ - common/common-utils.o \ - common/errors.o \ -+ common/netstuff.o \ - common/print-utils.o \ - gdbreplay.o \ - utils.o \ -diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c ---- a/gdb/gdbserver/gdbreplay.c -+++ b/gdb/gdbserver/gdbreplay.c -@@ -46,8 +46,11 @@ - - #if USE_WIN32API - #include -+#include - #endif - -+#include "netstuff.h" -+ - #ifndef HAVE_SOCKLEN_T - typedef int socklen_t; - #endif -@@ -142,56 +145,108 @@ remote_close (void) - static void - remote_open (char *name) - { -- if (!strchr (name, ':')) -+ char *last_colon = strrchr (name, ':'); -+ -+ if (last_colon == NULL) - { - fprintf (stderr, "%s: Must specify tcp connection as host:addr\n", name); - fflush (stderr); - exit (1); - } -- else -- { -+ - #ifdef USE_WIN32API -- static int winsock_initialized; -+ static int winsock_initialized; - #endif -- char *port_str; -- int port; -- struct sockaddr_in sockaddr; -- socklen_t tmp; -- int tmp_desc; -+ char *port_str; -+ int tmp; -+ int tmp_desc; -+ struct addrinfo hint; -+ struct addrinfo *ainfo; - -- port_str = strchr (name, ':'); -+ memset (&hint, 0, sizeof (hint)); -+ /* Assume no prefix will be passed, therefore we should use -+ AF_UNSPEC. */ -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_socktype = SOCK_STREAM; -+ hint.ai_protocol = IPPROTO_TCP; - -- port = atoi (port_str + 1); -+ parsed_connection_spec parsed = parse_connection_spec (name, &hint); -+ -+ if (parsed.port_str.empty ()) -+ error (_("Missing port on hostname '%s'"), name); - - #ifdef USE_WIN32API -- if (!winsock_initialized) -- { -- WSADATA wsad; -+ if (!winsock_initialized) -+ { -+ WSADATA wsad; - -- WSAStartup (MAKEWORD (1, 0), &wsad); -- winsock_initialized = 1; -- } -+ WSAStartup (MAKEWORD (1, 0), &wsad); -+ winsock_initialized = 1; -+ } - #endif - -- tmp_desc = socket (PF_INET, SOCK_STREAM, 0); -- if (tmp_desc == -1) -- perror_with_name ("Can't open socket"); -+ int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (), -+ &hint, &ainfo); - -- /* Allow rapid reuse of this port. */ -- tmp = 1; -- setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, -- sizeof (tmp)); -+ if (r != 0) -+ { -+ fprintf (stderr, "%s:%s: cannot resolve name: %s\n", -+ parsed.host_str.c_str (), parsed.port_str.c_str (), -+ gai_strerror (r)); -+ fflush (stderr); -+ exit (1); -+ } -+ -+ scoped_free_addrinfo free_ainfo (ainfo); -+ -+ struct addrinfo *p; -+ -+ for (p = ainfo; p != NULL; p = p->ai_next) -+ { -+ tmp_desc = socket (p->ai_family, p->ai_socktype, p->ai_protocol); - -- sockaddr.sin_family = PF_INET; -- sockaddr.sin_port = htons (port); -- sockaddr.sin_addr.s_addr = INADDR_ANY; -+ if (tmp_desc >= 0) -+ break; -+ } -+ -+ if (p == NULL) -+ perror_with_name ("Cannot open socket"); - -- if (bind (tmp_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr)) -- || listen (tmp_desc, 1)) -- perror_with_name ("Can't bind address"); -+ /* Allow rapid reuse of this port. */ -+ tmp = 1; -+ setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, -+ sizeof (tmp)); -+ -+ switch (p->ai_family) -+ { -+ case AF_INET: -+ ((struct sockaddr_in *) p->ai_addr)->sin_addr.s_addr = INADDR_ANY; -+ break; -+ case AF_INET6: -+ ((struct sockaddr_in6 *) p->ai_addr)->sin6_addr = in6addr_any; -+ break; -+ default: -+ fprintf (stderr, "Invalid 'ai_family' %d\n", p->ai_family); -+ exit (1); -+ } -+ -+ if (bind (tmp_desc, p->ai_addr, p->ai_addrlen) != 0) -+ perror_with_name ("Can't bind address"); -+ -+ if (p->ai_socktype == SOCK_DGRAM) -+ remote_desc = tmp_desc; -+ else -+ { -+ struct sockaddr_storage sockaddr; -+ socklen_t sockaddrsize = sizeof (sockaddr); -+ char orig_host[GDB_NI_MAX_ADDR], orig_port[GDB_NI_MAX_PORT]; -+ -+ if (listen (tmp_desc, 1) != 0) -+ perror_with_name ("Can't listen on socket"); -+ -+ remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, -+ &sockaddrsize); - -- tmp = sizeof (sockaddr); -- remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, &tmp); - if (remote_desc == -1) - perror_with_name ("Accept failed"); - -@@ -206,6 +261,16 @@ remote_open (char *name) - setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (tmp)); - -+ if (getnameinfo ((struct sockaddr *) &sockaddr, sockaddrsize, -+ orig_host, sizeof (orig_host), -+ orig_port, sizeof (orig_port), -+ NI_NUMERICHOST | NI_NUMERICSERV) == 0) -+ { -+ fprintf (stderr, "Remote debugging from host %s, port %s\n", -+ orig_host, orig_port); -+ fflush (stderr); -+ } -+ - #ifndef USE_WIN32API - close (tmp_desc); /* No longer need this */ - -diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c ---- a/gdb/gdbserver/remote-utils.c -+++ b/gdb/gdbserver/remote-utils.c -@@ -26,6 +26,8 @@ - #include "dll.h" - #include "rsp-low.h" - #include "gdbthread.h" -+#include "netstuff.h" -+#include "filestuff.h" - #include - #if HAVE_SYS_IOCTL_H - #include -@@ -63,6 +65,7 @@ - - #if USE_WIN32API - #include -+#include - #endif - - #if __QNX__ -@@ -151,19 +154,18 @@ enable_async_notification (int fd) - static int - handle_accept_event (int err, gdb_client_data client_data) - { -- struct sockaddr_in sockaddr; -- socklen_t tmp; -+ struct sockaddr_storage sockaddr; -+ socklen_t len = sizeof (sockaddr); - - if (debug_threads) - debug_printf ("handling possible accept event\n"); - -- tmp = sizeof (sockaddr); -- remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &tmp); -+ remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len); - if (remote_desc == -1) - perror_with_name ("Accept failed"); - - /* Enable TCP keep alive process. */ -- tmp = 1; -+ socklen_t tmp = 1; - setsockopt (remote_desc, SOL_SOCKET, SO_KEEPALIVE, - (char *) &tmp, sizeof (tmp)); - -@@ -192,8 +194,19 @@ handle_accept_event (int err, gdb_client_data client_data) - delete_file_handler (listen_desc); - - /* Convert IP address to string. */ -- fprintf (stderr, "Remote debugging from host %s\n", -- inet_ntoa (sockaddr.sin_addr)); -+ char orig_host[GDB_NI_MAX_ADDR], orig_port[GDB_NI_MAX_PORT]; -+ -+ int r = getnameinfo ((struct sockaddr *) &sockaddr, len, -+ orig_host, sizeof (orig_host), -+ orig_port, sizeof (orig_port), -+ NI_NUMERICHOST | NI_NUMERICSERV); -+ -+ if (r != 0) -+ fprintf (stderr, _("Could not obtain remote address: %s\n"), -+ gai_strerror (r)); -+ else -+ fprintf (stderr, _("Remote debugging from host %s, port %s\n"), -+ orig_host, orig_port); - - enable_async_notification (remote_desc); - -@@ -222,10 +235,7 @@ remote_prepare (const char *name) - #ifdef USE_WIN32API - static int winsock_initialized; - #endif -- int port; -- struct sockaddr_in sockaddr; - socklen_t tmp; -- char *port_end; - - remote_is_stdio = 0; - if (strcmp (name, STDIO_CONNECTION_NAME) == 0) -@@ -238,17 +248,25 @@ remote_prepare (const char *name) - return; - } - -- port_str = strchr (name, ':'); -- if (port_str == NULL) -+ struct addrinfo hint; -+ struct addrinfo *ainfo; -+ -+ memset (&hint, 0, sizeof (hint)); -+ /* Assume no prefix will be passed, therefore we should use -+ AF_UNSPEC. */ -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_socktype = SOCK_STREAM; -+ hint.ai_protocol = IPPROTO_TCP; -+ -+ parsed_connection_spec parsed -+ = parse_connection_spec_without_prefix (name, &hint); -+ -+ if (parsed.port_str.empty ()) - { - cs.transport_is_reliable = 0; - return; - } - -- port = strtoul (port_str + 1, &port_end, 10); -- if (port_str[1] == '\0' || *port_end != '\0') -- error ("Bad port argument: %s", name); -- - #ifdef USE_WIN32API - if (!winsock_initialized) - { -@@ -259,8 +277,26 @@ remote_prepare (const char *name) - } - #endif - -- listen_desc = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); -- if (listen_desc == -1) -+ int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (), -+ &hint, &ainfo); -+ -+ if (r != 0) -+ error (_("%s: cannot resolve name: %s"), name, gai_strerror (r)); -+ -+ scoped_free_addrinfo freeaddrinfo (ainfo); -+ -+ struct addrinfo *iter; -+ -+ for (iter = ainfo; iter != NULL; iter = iter->ai_next) -+ { -+ listen_desc = gdb_socket_cloexec (iter->ai_family, iter->ai_socktype, -+ iter->ai_protocol); -+ -+ if (listen_desc >= 0) -+ break; -+ } -+ -+ if (iter == NULL) - perror_with_name ("Can't open socket"); - - /* Allow rapid reuse of this port. */ -@@ -268,14 +304,25 @@ remote_prepare (const char *name) - setsockopt (listen_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, - sizeof (tmp)); - -- sockaddr.sin_family = PF_INET; -- sockaddr.sin_port = htons (port); -- sockaddr.sin_addr.s_addr = INADDR_ANY; -+ switch (iter->ai_family) -+ { -+ case AF_INET: -+ ((struct sockaddr_in *) iter->ai_addr)->sin_addr.s_addr = INADDR_ANY; -+ break; -+ case AF_INET6: -+ ((struct sockaddr_in6 *) iter->ai_addr)->sin6_addr = in6addr_any; -+ break; -+ default: -+ internal_error (__FILE__, __LINE__, -+ _("Invalid 'ai_family' %d\n"), iter->ai_family); -+ } - -- if (bind (listen_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr)) -- || listen (listen_desc, 1)) -+ if (bind (listen_desc, iter->ai_addr, iter->ai_addrlen) != 0) - perror_with_name ("Can't bind address"); - -+ if (listen (listen_desc, 1) != 0) -+ perror_with_name ("Can't listen on socket"); -+ - cs.transport_is_reliable = 1; - } - -@@ -350,18 +397,24 @@ remote_open (const char *name) - #endif /* USE_WIN32API */ - else - { -- int port; -- socklen_t len; -- struct sockaddr_in sockaddr; -- -- len = sizeof (sockaddr); -- if (getsockname (listen_desc, -- (struct sockaddr *) &sockaddr, &len) < 0 -- || len < sizeof (sockaddr)) -+ char listen_port[GDB_NI_MAX_PORT]; -+ struct sockaddr_storage sockaddr; -+ socklen_t len = sizeof (sockaddr); -+ -+ if (getsockname (listen_desc, (struct sockaddr *) &sockaddr, &len) < 0) - perror_with_name ("Can't determine port"); -- port = ntohs (sockaddr.sin_port); - -- fprintf (stderr, "Listening on port %d\n", port); -+ int r = getnameinfo ((struct sockaddr *) &sockaddr, len, -+ NULL, 0, -+ listen_port, sizeof (listen_port), -+ NI_NUMERICSERV); -+ -+ if (r != 0) -+ fprintf (stderr, _("Can't obtain port where we are listening: %s"), -+ gai_strerror (r)); -+ else -+ fprintf (stderr, _("Listening on port %s\n"), listen_port); -+ - fflush (stderr); - - /* Register the event loop handler. */ -diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c ---- a/gdb/ser-tcp.c -+++ b/gdb/ser-tcp.c -@@ -25,6 +25,7 @@ - #include "cli/cli-decode.h" - #include "cli/cli-setshow.h" - #include "filestuff.h" -+#include "netstuff.h" - - #include - -@@ -39,6 +40,7 @@ - - #ifdef USE_WIN32API - #include -+#include - #ifndef ETIMEDOUT - #define ETIMEDOUT WSAETIMEDOUT - #endif -@@ -81,12 +83,13 @@ static unsigned int tcp_retry_limit = 15; - - #define POLL_INTERVAL 5 - --/* Helper function to wait a while. If SCB is non-null, wait on its -- file descriptor. Otherwise just wait on a timeout, updating *POLLS. -- Returns -1 on timeout or interrupt, otherwise the value of select. */ -+/* Helper function to wait a while. If SOCK is not -1, wait on its -+ file descriptor. Otherwise just wait on a timeout, updating -+ *POLLS. Returns -1 on timeout or interrupt, otherwise the value of -+ select. */ - - static int --wait_for_connect (struct serial *scb, unsigned int *polls) -+wait_for_connect (int sock, unsigned int *polls) - { - struct timeval t; - int n; -@@ -120,24 +123,24 @@ wait_for_connect (struct serial *scb, unsigned int *polls) - t.tv_usec = 0; - } - -- if (scb) -+ if (sock >= 0) - { - fd_set rset, wset, eset; - - FD_ZERO (&rset); -- FD_SET (scb->fd, &rset); -+ FD_SET (sock, &rset); - wset = rset; - eset = rset; -- -+ - /* POSIX systems return connection success or failure by signalling - wset. Windows systems return success in wset and failure in - eset. -- -+ - We must call select here, rather than gdb_select, because - the serial structure has not yet been initialized - the - MinGW select wrapper will not know that this FD refers - to a socket. */ -- n = select (scb->fd + 1, &rset, &wset, &eset, &t); -+ n = select (sock + 1, &rset, &wset, &eset, &t); - } - else - /* Use gdb_select here, since we have no file descriptors, and on -@@ -153,80 +156,28 @@ wait_for_connect (struct serial *scb, unsigned int *polls) - return n; - } - --/* Open a tcp socket. */ -+/* Try to connect to the host represented by AINFO. If the connection -+ succeeds, return its socket. Otherwise, return -1 and set ERRNO -+ accordingly. POLLS is used when 'connect' returns EINPROGRESS, and -+ we need to invoke 'wait_for_connect' to obtain the status. */ - --int --net_open (struct serial *scb, const char *name) -+static int -+try_connect (const struct addrinfo *ainfo, unsigned int *polls) - { -- char hostname[100]; -- const char *port_str; -- int n, port, tmp; -- int use_udp; -- struct hostent *hostent; -- struct sockaddr_in sockaddr; --#ifdef USE_WIN32API -- u_long ioarg; --#else -- int ioarg; --#endif -- unsigned int polls = 0; -- -- use_udp = 0; -- if (startswith (name, "udp:")) -- { -- use_udp = 1; -- name = name + 4; -- } -- else if (startswith (name, "tcp:")) -- name = name + 4; -- -- port_str = strchr (name, ':'); -- -- if (!port_str) -- error (_("net_open: No colon in host name!")); /* Shouldn't ever -- happen. */ -- -- tmp = std::min (port_str - name, (ptrdiff_t) sizeof hostname - 1); -- strncpy (hostname, name, tmp); /* Don't want colon. */ -- hostname[tmp] = '\000'; /* Tie off host name. */ -- port = atoi (port_str + 1); -- -- /* Default hostname is localhost. */ -- if (!hostname[0]) -- strcpy (hostname, "localhost"); -- -- hostent = gethostbyname (hostname); -- if (!hostent) -- { -- fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname); -- errno = ENOENT; -- return -1; -- } -+ int sock = gdb_socket_cloexec (ainfo->ai_family, ainfo->ai_socktype, -+ ainfo->ai_protocol); - -- sockaddr.sin_family = PF_INET; -- sockaddr.sin_port = htons (port); -- memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr, -- sizeof (struct in_addr)); -- -- retry: -- -- if (use_udp) -- scb->fd = gdb_socket_cloexec (PF_INET, SOCK_DGRAM, 0); -- else -- scb->fd = gdb_socket_cloexec (PF_INET, SOCK_STREAM, 0); -- -- if (scb->fd == -1) -+ if (sock < 0) - return -1; -- -+ - /* Set socket nonblocking. */ -- ioarg = 1; -- ioctl (scb->fd, FIONBIO, &ioarg); -+ int ioarg = 1; -+ -+ ioctl (sock, FIONBIO, &ioarg); - - /* Use Non-blocking connect. connect() will return 0 if connected - already. */ -- n = connect (scb->fd, (struct sockaddr *) &sockaddr, sizeof (sockaddr)); -- -- if (n < 0) -+ if (connect (sock, ainfo->ai_addr, ainfo->ai_addrlen) < 0) - { - #ifdef USE_WIN32API - int err = WSAGetLastError(); -@@ -234,21 +185,26 @@ net_open (struct serial *scb, const char *name) - int err = errno; - #endif - -- /* Maybe we're waiting for the remote target to become ready to -- accept connections. */ -- if (tcp_auto_retry -+ /* If we've got a "connection refused" error, just return -+ -1. The caller will know what to do. */ -+ if ( - #ifdef USE_WIN32API -- && err == WSAECONNREFUSED -+ err == WSAECONNREFUSED - #else -- && err == ECONNREFUSED -+ err == ECONNREFUSED - #endif -- && wait_for_connect (NULL, &polls) >= 0) -+ ) - { -- close (scb->fd); -- goto retry; -+ close (sock); -+ errno = err; -+ return -1; - } - - if ( -+ /* Any other error (except EINPROGRESS) will be "swallowed" -+ here. We return without specifying a return value, and -+ set errno if the caller wants to inspect what -+ happened. */ - #ifdef USE_WIN32API - /* Under Windows, calling "connect" with a non-blocking socket - results in WSAEWOULDBLOCK, not WSAEINPROGRESS. */ -@@ -258,66 +214,166 @@ net_open (struct serial *scb, const char *name) - #endif - ) - { -+ close (sock); - errno = err; -- net_close (scb); - return -1; - } - - /* Looks like we need to wait for the connect. */ -- do -- { -- n = wait_for_connect (scb, &polls); -- } -+ int n; -+ -+ do -+ n = wait_for_connect (sock, polls); - while (n == 0); -+ - if (n < 0) - { -- net_close (scb); -+ int saved_errno = errno; -+ -+ /* A negative value here means that we either timed out or -+ got interrupted by the user. Just return. */ -+ close (sock); -+ errno = saved_errno; - return -1; - } - } - - /* Got something. Is it an error? */ -- { -- int res, err; -- socklen_t len; -- -- len = sizeof (err); -- /* On Windows, the fourth parameter to getsockopt is a "char *"; -- on UNIX systems it is generally "void *". The cast to "char *" -- is OK everywhere, since in C++ any data pointer type can be -- implicitly converted to "void *". */ -- res = getsockopt (scb->fd, SOL_SOCKET, SO_ERROR, (char *) &err, &len); -- if (res < 0 || err) -- { -- /* Maybe the target still isn't ready to accept the connection. */ -- if (tcp_auto_retry -+ int err; -+ socklen_t len = sizeof (err); -+ -+ /* On Windows, the fourth parameter to getsockopt is a "char *"; -+ on UNIX systems it is generally "void *". The cast to "char *" -+ is OK everywhere, since in C++ any data pointer type can be -+ implicitly converted to "void *". */ -+ int ret = getsockopt (sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len); -+ -+ if (ret < 0) -+ { -+ int saved_errno = errno; -+ -+ close (sock); -+ errno = saved_errno; -+ return -1; -+ } -+ else if (ret == 0 && err != 0) -+ { -+ close (sock); -+ errno = err; -+ return -1; -+ } -+ -+ /* The connection succeeded. Return the socket. */ -+ return sock; -+} -+ -+/* Open a tcp socket. */ -+ -+int -+net_open (struct serial *scb, const char *name) -+{ -+ struct addrinfo hint; -+ struct addrinfo *ainfo; -+ -+ memset (&hint, 0, sizeof (hint)); -+ /* Assume no prefix will be passed, therefore we should use -+ AF_UNSPEC. */ -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_socktype = SOCK_STREAM; -+ hint.ai_protocol = IPPROTO_TCP; -+ -+ parsed_connection_spec parsed = parse_connection_spec (name, &hint); -+ -+ if (parsed.port_str.empty ()) -+ error (_("Missing port on hostname '%s'"), name); -+ -+ int r = getaddrinfo (parsed.host_str.c_str (), -+ parsed.port_str.c_str (), -+ &hint, &ainfo); -+ -+ if (r != 0) -+ { -+ fprintf_unfiltered (gdb_stderr, _("%s: cannot resolve name: %s\n"), -+ name, gai_strerror (r)); -+ errno = ENOENT; -+ return -1; -+ } -+ -+ scoped_free_addrinfo free_ainfo (ainfo); -+ -+ /* Flag to indicate whether we've got a connection refused. It will -+ be true if any of the connections tried was refused. */ -+ bool got_connrefused; -+ /* If a connection succeeeds, SUCCESS_AINFO will point to the -+ 'struct addrinfo' that succeed. */ -+ struct addrinfo *success_ainfo = NULL; -+ unsigned int polls = 0; -+ -+ /* Assume the worst. */ -+ scb->fd = -1; -+ -+ do -+ { -+ got_connrefused = false; -+ -+ for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next) -+ { -+ /* Iterate over the list of possible addresses to connect -+ to. For each, we'll try to connect and see if it -+ succeeds. */ -+ int sock = try_connect (iter, &polls); -+ -+ if (sock >= 0) -+ { -+ /* We've gotten a successful connection. Save its -+ 'struct addrinfo', the socket, and break. */ -+ success_ainfo = iter; -+ scb->fd = sock; -+ break; -+ } -+ else if ( - #ifdef USE_WIN32API -- && err == WSAECONNREFUSED -+ errno == WSAECONNREFUSED - #else -- && err == ECONNREFUSED -+ errno == ECONNREFUSED - #endif -- && wait_for_connect (NULL, &polls) >= 0) -- { -- close (scb->fd); -- goto retry; -- } -- if (err) -- errno = err; -- net_close (scb); -- return -1; -- } -- } -+ ) -+ got_connrefused = true; -+ } -+ } -+ /* Just retry if: -+ -+ - tcp_auto_retry is true, and -+ - We haven't gotten a connection yet, and -+ - Any of our connection attempts returned with ECONNREFUSED, and -+ - wait_for_connect signals that we can keep going. */ -+ while (tcp_auto_retry -+ && success_ainfo == NULL -+ && got_connrefused -+ && wait_for_connect (-1, &polls) >= 0); -+ -+ if (success_ainfo == NULL) -+ { -+ net_close (scb); -+ return -1; -+ } - - /* Turn off nonblocking. */ -- ioarg = 0; -+#ifdef USE_WIN32API -+ u_long ioarg = 0; -+#else -+ int ioarg = 0; -+#endif -+ - ioctl (scb->fd, FIONBIO, &ioarg); - -- if (use_udp == 0) -+ if (success_ainfo->ai_socktype == IPPROTO_TCP) - { - /* Disable Nagle algorithm. Needed in some cases. */ -- tmp = 1; -+ int tmp = 1; -+ - setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, -- (char *)&tmp, sizeof (tmp)); -+ (char *) &tmp, sizeof (tmp)); - } - - #ifdef SIGPIPE -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog ---- a/gdb/testsuite/ChangeLog -+++ b/gdb/testsuite/ChangeLog -@@ -1,3 +1,23 @@ -+2018-07-11 Sergio Durigan Junior -+ Jan Kratochvil -+ Paul Fertser -+ Tsutomu Seki -+ -+ * README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST' -+ parameter. -+ * boards/native-extended-gdbserver.exp: Do not set 'sockethost' -+ by default. -+ * boards/native-gdbserver.exp: Likewise. -+ * gdb.server/run-without-local-binary.exp: Improve regexp used -+ for detecting when a remote debugging connection succeeds. -+ * gdb.server/server-connect.exp: New file. -+ * lib/gdbserver-support.exp (gdbserver_default_get_comm_port): -+ Do not prefix the port number with ":". -+ (gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement -+ support for detecting and using it. Add '$debughost_gdbserver' -+ to the list of arguments used to start gdbserver. Handle case -+ when gdbserver cannot resolve a network name. -+ - 2018-08-31 Tom Tromey - - * gdb.rust/simple.rs: Rename second variable "v". -diff --git a/gdb/testsuite/README b/gdb/testsuite/README ---- a/gdb/testsuite/README -+++ b/gdb/testsuite/README -@@ -259,6 +259,20 @@ This make (not runtest) variable is used to specify whether the - testsuite preloads the read1.so library into expect. Any non-empty - value means true. See "Race detection" below. - -+GDB_TEST_SOCKETHOST -+ -+This variable can provide the hostname/address that should be used -+when performing GDBserver-related tests. This is useful in some -+situations, e.g., when you want to test the IPv6 connectivity of GDB -+and GDBserver, or when using a different hostname/address is needed. -+For example, to make GDB and GDBserver use IPv6-only connections, you -+can do: -+ -+ make check TESTS="gdb.server/*.exp" RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]' -+ -+Note that only a hostname/address can be provided, without a port -+number. -+ - Race detection - ************** - -diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp ---- a/gdb/testsuite/boards/native-extended-gdbserver.exp -+++ b/gdb/testsuite/boards/native-extended-gdbserver.exp -@@ -24,8 +24,6 @@ load_generic_config "extended-gdbserver" - load_board_description "gdbserver-base" - load_board_description "local-board" - --set_board_info sockethost "localhost:" -- - # We will be using the extended GDB remote protocol. - set_board_info gdb_protocol "extended-remote" - -diff --git a/gdb/testsuite/boards/native-gdbserver.exp b/gdb/testsuite/boards/native-gdbserver.exp ---- a/gdb/testsuite/boards/native-gdbserver.exp -+++ b/gdb/testsuite/boards/native-gdbserver.exp -@@ -30,7 +30,6 @@ set_board_info gdb,do_reload_on_run 1 - # There's no support for argument-passing (yet). - set_board_info noargs 1 - --set_board_info sockethost "localhost:" - set_board_info use_gdb_stub 1 - set_board_info exit_is_reliable 1 - -diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp ---- a/gdb/testsuite/gdb.server/run-without-local-binary.exp -+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp -@@ -53,7 +53,7 @@ save_vars { GDBFLAGS } { - set use_gdb_stub 0 - - gdb_test "target ${gdbserver_protocol} ${gdbserver_gdbport}" \ -- "Remote debugging using $gdbserver_gdbport" \ -+ "Remote debugging using [string_to_regexp $gdbserver_gdbport]" \ - "connect to gdbserver" - - gdb_test "run" \ -diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.server/server-connect.exp -@@ -0,0 +1,111 @@ -+# This testcase is part of GDB, the GNU debugger. -+# -+# Copyright 2018 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 . -+ -+# Test multiple types of connection (IPv4, IPv6, TCP, UDP) and make -+# sure both gdbserver and GDB work. -+ -+load_lib gdbserver-support.exp -+ -+standard_testfile normal.c -+ -+if {[skip_gdbserver_tests]} { -+ return 0 -+} -+ -+# We want to have control over where we start gdbserver. -+if { [is_remote target] } { -+ return 0 -+} -+ -+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { -+ return -1 -+} -+ -+# Make sure we're disconnected, in case we're testing with an -+# extended-remote board, therefore already connected. -+gdb_test "disconnect" ".*" -+ -+set target_exec [gdbserver_download_current_prog] -+ -+# An array containing the test instructions for each scenario. The -+# description of each field is as follows: -+# -+# - The connection specification to be used when starting -+# gdbserver/GDB. This string will be used to set the -+# GDB_TEST_SOCKETHOST when calling gdbserver_start. -+# -+# - A flag indicating whether gdbserver should fail when we attempt to -+# start it. Useful when testing erroneous connection specs such as -+# "tcp8:". -+# -+# - The prefix that should be prepended to the test messages. -+set test_params \ -+ { \ -+ { "tcp4:127.0.0.1" 0 "tcp4" } \ -+ { "tcp6:::1" 0 "tcp6" } \ -+ { "tcp6:[::1]" 0 "tcp6-with-brackets" } \ -+ { "tcp:localhost" 0 "tcp" } \ -+ { "udp4:127.0.0.1" 0 "udp4" } \ -+ { "udp6:::1" 0 "udp6" } \ -+ { "udp6:[::1]" 0 "udp6-with-brackets" } \ -+ { "tcp8:123" 1 "tcp8" } \ -+ { "udp123:::" 1 "udp123" } \ -+ { "garbage:1234" 1 "garbage:1234" } \ -+ } -+ -+# The best way to test different types of connections is to set the -+# GDB_TEST_SOCKETHOST variable accordingly. -+save_vars { GDB_TEST_SOCKETHOST } { -+ foreach line $test_params { -+ set sockhost [lindex $line 0] -+ set gdbserver_should_fail [lindex $line 1] -+ set prefix [lindex $line 2] -+ -+ with_test_prefix $prefix { -+ set GDB_TEST_SOCKETHOST $sockhost -+ set test "start gdbserver" -+ -+ # Try to start gdbserver. -+ set catchres [catch {set res [gdbserver_start "" $target_exec]} errmsg] -+ -+ if { $catchres != 0 } { -+ if { $gdbserver_should_fail } { -+ pass "$test: gdbserver failed as expected" -+ } else { -+ fail "$test: $errmsg" -+ } -+ continue -+ } else { -+ if { $gdbserver_should_fail } { -+ fail "$test: gdbserver should fail but did not" -+ } else { -+ pass "$test" -+ } -+ } -+ -+ set gdbserver_protocol [lindex $res 0] -+ set gdbserver_gdbport [lindex $res 1] -+ set test "connect to gdbserver using $sockhost" -+ -+ if { [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0 } { -+ pass $test -+ } else { -+ fail $test -+ } -+ } -+ } -+} -diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp ---- a/gdb/testsuite/lib/gdbserver-support.exp -+++ b/gdb/testsuite/lib/gdbserver-support.exp -@@ -211,7 +211,7 @@ proc gdbserver_default_get_remote_address { host port } { - # Default routine to compute the "comm" argument for gdbserver. - - proc gdbserver_default_get_comm_port { port } { -- return ":$port" -+ return "$port" - } - - # Start a gdbserver process with initial OPTIONS and trailing ARGUMENTS. -@@ -221,6 +221,7 @@ proc gdbserver_default_get_comm_port { port } { - - proc gdbserver_start { options arguments } { - global portnum -+ global GDB_TEST_SOCKETHOST - - # Port id -- either specified in baseboard file, or managed here. - if [target_info exists gdb,socketport] { -@@ -231,10 +232,22 @@ proc gdbserver_start { options arguments } { - } - - # Extract the local and remote host ids from the target board struct. -- if [target_info exists sockethost] { -+ if { [info exists GDB_TEST_SOCKETHOST] } { -+ # The user is not supposed to provide a port number, just a -+ # hostname/address, therefore we add the trailing ":" here. -+ set debughost "${GDB_TEST_SOCKETHOST}:" -+ # Escape open and close square brackets. -+ set debughost_tmp [string map { [ \\[ ] \\] } $debughost] -+ # We need a "gdbserver" version of the debughost, which will -+ # have the possible connection prefix stripped. This is -+ # because gdbserver currently doesn't recognize the prefixes. -+ regsub -all "^\(tcp:|udp:|tcp4:|udp4:|tcp6:|udp6:\)" $debughost_tmp "" debughost_gdbserver -+ } elseif [target_info exists sockethost] { - set debughost [target_info sockethost] -+ set debughost_gdbserver $debughost - } else { - set debughost "localhost:" -+ set debughost_gdbserver $debughost - } - - # Some boards use a different value for the port that is passed to -@@ -277,8 +290,14 @@ proc gdbserver_start { options arguments } { - if { $options != "" } { - append gdbserver_command " $options" - } -+ if { $debughost_gdbserver != "" } { -+ append gdbserver_command " $debughost_gdbserver" -+ } - if { $portnum != "" } { -- append gdbserver_command " [$get_comm_port $portnum]" -+ if { $debughost_gdbserver == "" } { -+ append gdbserver_command " " -+ } -+ append gdbserver_command "[$get_comm_port $portnum]" - } - if { $arguments != "" } { - append gdbserver_command " $arguments" -@@ -307,6 +326,9 @@ proc gdbserver_start { options arguments } { - continue - } - } -+ -re ".*: cannot resolve name: Name or service not known\r\n" { -+ error "gdbserver cannot resolve name." -+ } - timeout { - error "Timeout waiting for gdbserver response." - } -diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c -new file mode 100644 ---- /dev/null -+++ b/gdb/unittests/parse-connection-spec-selftests.c -@@ -0,0 +1,249 @@ -+/* Self tests for parsing connection specs for GDB, the GNU debugger. -+ -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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 . */ -+ -+#include "defs.h" -+#include "selftest.h" -+#include "common/netstuff.h" -+#include "diagnostics.h" -+#ifdef USE_WIN32API -+#include -+#include -+#else -+#include -+#include -+#include -+#include -+#include -+#endif -+ -+namespace selftests { -+namespace parse_connection_spec_tests { -+ -+/* Auxiliary struct that holds info about a specific test for a -+ connection spec. */ -+ -+struct parse_conn_test -+{ -+ /* The connection spec. */ -+ const char *connspec; -+ -+ /* Expected result from 'parse_connection_spec'. */ -+ parsed_connection_spec expected_result; -+ -+ /* True if this test should fail, false otherwise. If true, only -+ the CONNSPEC field should be considered as valid. */ -+ bool should_fail; -+ -+ /* The expected AI_FAMILY to be found on the 'struct addrinfo' -+ HINT. */ -+ int exp_ai_family; -+ -+ /* The expected AI_SOCKTYPE to be found on the 'struct addrinfo' -+ HINT. */ -+ int exp_ai_socktype; -+ -+ /* The expected AI_PROTOCOL to be found on the 'struct addrinfo' -+ HINT. */ -+ int exp_ai_protocol; -+}; -+ -+/* Some defines to help us fill a 'struct parse_conn_test'. */ -+ -+/* Initialize a full entry. */ -+#define INIT_ENTRY(ADDR, EXP_HOST, EXP_PORT, SHOULD_FAIL, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \ -+ { ADDR, { EXP_HOST, EXP_PORT }, SHOULD_FAIL, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL } -+ -+/* Initialize an unprefixed entry. In this case, we don't expect -+ anything on the 'struct addrinfo' HINT. */ -+#define INIT_UNPREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, 0, 0, 0) -+ -+/* Initialized an unprefixed IPv6 entry. In this case, we don't -+ expect anything on the 'struct addrinfo' HINT. */ -+#define INIT_UNPREFIXED_IPV6_ENTRY(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, AF_INET6, 0, 0) -+ -+/* Initialize a prefixed entry. */ -+#define INIT_PREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \ -+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) -+ -+/* Initialize an entry prefixed with "tcp4:". */ -+#define INIT_PREFIXED_IPV4_TCP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_STREAM, \ -+ IPPROTO_TCP) -+ -+/* Initialize an entry prefixed with "tcp6:". */ -+#define INIT_PREFIXED_IPV6_TCP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_STREAM, \ -+ IPPROTO_TCP) -+ -+/* Initialize an entry prefixed with "udp4:". */ -+#define INIT_PREFIXED_IPV4_UDP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_DGRAM, \ -+ IPPROTO_UDP) -+ -+/* Initialize an entry prefixed with "udp6:". */ -+#define INIT_PREFIXED_IPV6_UDP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_DGRAM, \ -+ IPPROTO_UDP) -+ -+/* Initialize a bogus entry, i.e., a connection spec that should -+ fail. */ -+#define INIT_BOGUS_ENTRY(ADDR) \ -+ INIT_ENTRY (ADDR, "", "", true, 0, 0, 0) -+ -+/* The variable which holds all of our tests. */ -+ -+static const parse_conn_test conn_test[] = -+ { -+ /* Unprefixed addresses. */ -+ -+ /* IPv4, host and port present. */ -+ INIT_UNPREFIXED_ENTRY ("127.0.0.1:1234", "127.0.0.1", "1234"), -+ /* IPv4, only host. */ -+ INIT_UNPREFIXED_ENTRY ("127.0.0.1", "127.0.0.1", ""), -+ /* IPv4, missing port. */ -+ INIT_UNPREFIXED_ENTRY ("127.0.0.1:", "127.0.0.1", ""), -+ -+ /* IPv6, host and port present, no brackets. */ -+ INIT_UNPREFIXED_ENTRY ("::1:1234", "::1", "1234"), -+ /* IPv6, missing port, no brackets. */ -+ INIT_UNPREFIXED_ENTRY ("::1:", "::1", ""), -+ /* IPv6, host and port present, with brackets. */ -+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:1234", "::1", "1234"), -+ /* IPv6, only host, with brackets. */ -+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]", "::1", ""), -+ /* IPv6, missing port, with brackets. */ -+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:", "::1", ""), -+ -+ /* Unspecified, only port. */ -+ INIT_UNPREFIXED_ENTRY (":1234", "localhost", "1234"), -+ -+ /* Prefixed addresses. */ -+ -+ /* Prefixed "tcp4:" IPv4, host and port presents. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:1234", "127.0.0.1", "1234"), -+ /* Prefixed "tcp4:" IPv4, only port. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4::1234", "localhost", "1234"), -+ /* Prefixed "tcp4:" IPv4, only host. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1", "127.0.0.1", ""), -+ /* Prefixed "tcp4:" IPv4, missing port. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:", "127.0.0.1", ""), -+ -+ /* Prefixed "udp4:" IPv4, host and port present. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:1234", "127.0.0.1", "1234"), -+ /* Prefixed "udp4:" IPv4, only port. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4::1234", "localhost", "1234"), -+ /* Prefixed "udp4:" IPv4, only host. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1", "127.0.0.1", ""), -+ /* Prefixed "udp4:" IPv4, missing port. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:", "127.0.0.1", ""), -+ -+ -+ /* Prefixed "tcp6:" IPv6, host and port present. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:1234", "::1", "1234"), -+ /* Prefixed "tcp6:" IPv6, only port. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6::1234", "localhost", "1234"), -+ /* Prefixed "tcp6:" IPv6, only host. */ -+ //INIT_PREFIXED_IPV6_TCP ("tcp6:::1", "::1", ""), -+ /* Prefixed "tcp6:" IPv6, missing port. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:", "::1", ""), -+ -+ /* Prefixed "udp6:" IPv6, host and port present. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:::1:1234", "::1", "1234"), -+ /* Prefixed "udp6:" IPv6, only port. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6::1234", "localhost", "1234"), -+ /* Prefixed "udp6:" IPv6, only host. */ -+ //INIT_PREFIXED_IPV6_UDP ("udp6:::1", "::1", ""), -+ /* Prefixed "udp6:" IPv6, missing port. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:::1:", "::1", ""), -+ -+ /* Prefixed "tcp6:" IPv6 with brackets, host and port present. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:1234", "::1", "1234"), -+ /* Prefixed "tcp6:" IPv6 with brackets, only host. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]", "::1", ""), -+ /* Prefixed "tcp6:" IPv6 with brackets, missing port. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:", "::1", ""), -+ -+ /* Prefixed "udp6:" IPv6 with brackets, host and port present. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:1234", "::1", "1234"), -+ /* Prefixed "udp6:" IPv6 with brackets, only host. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]", "::1", ""), -+ /* Prefixed "udp6:" IPv6 with brackets, missing port. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:", "::1", ""), -+ -+ -+ /* Bogus addresses. */ -+ INIT_BOGUS_ENTRY ("tcp6:[::1]123:44"), -+ INIT_BOGUS_ENTRY ("[::1"), -+ INIT_BOGUS_ENTRY ("tcp6:::1]:"), -+ }; -+ -+/* Test a connection spec C. */ -+ -+static void -+test_conn (const parse_conn_test &c) -+{ -+ struct addrinfo hint; -+ parsed_connection_spec ret; -+ -+ memset (&hint, 0, sizeof (hint)); -+ -+ TRY -+ { -+ ret = parse_connection_spec (c.connspec, &hint); -+ } -+ CATCH (ex, RETURN_MASK_ERROR) -+ { -+ /* If we caught an error, we should check if this connection -+ spec was supposed to fail. */ -+ SELF_CHECK (c.should_fail); -+ return; -+ } -+ END_CATCH -+ -+ SELF_CHECK (!c.should_fail); -+ SELF_CHECK (ret.host_str == c.expected_result.host_str); -+ SELF_CHECK (ret.port_str == c.expected_result.port_str); -+ SELF_CHECK (hint.ai_family == c.exp_ai_family); -+ SELF_CHECK (hint.ai_socktype == c.exp_ai_socktype); -+ SELF_CHECK (hint.ai_protocol == c.exp_ai_protocol); -+} -+ -+/* Run the tests associated with parsing connection specs. */ -+ -+static void -+run_tests () -+{ -+ for (const parse_conn_test &c : conn_test) -+ test_conn (c); -+} -+} /* namespace parse_connection_spec_tests */ -+} /* namespace selftests */ -+ -+void -+_initialize_parse_connection_spec_selftests () -+{ -+ selftests::register_test ("parse_connection_spec", -+ selftests::parse_connection_spec_tests::run_tests); -+} diff --git a/gdb-rhbz881849-ipv6-2of3.patch b/gdb-rhbz881849-ipv6-2of3.patch deleted file mode 100644 index 390be0f39e00a3180f02185696bb541869ea788f..0000000000000000000000000000000000000000 --- a/gdb-rhbz881849-ipv6-2of3.patch +++ /dev/null @@ -1,54 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Mon, 30 Jul 2018 15:23:27 -0400 -Subject: gdb-rhbz881849-ipv6-2of3.patch - -Match any kind of error after "cannot resolve name" on lib/gdbserver-support.exp:gdbserver_start - -On commit: - -commit 7f1f7e23939adc7d71036a17fc6081e3af7ca585 -Author: Sergio Durigan Junior -Date: Fri Jul 13 16:20:34 2018 -0400 - - Expect for another variant of error message when gdbserver cannot resolve hostname - -I extended the regular expression being used to identify whether -gdbserver could not resolve a (host)name. This was needed because the -error message being printed had a different variation across some -systems. However, as it turns out, I've just noticed that the message -has yet another variation: - - target remote tcp8:123:2353 - tcp8:123:2353: cannot resolve name: System error - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - tcp8:123:2353: No such file or directory. - (gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123 - -which is causing FAILs on some systems (namely, Fedora-i686 on -BuildBot). - -So instead of trying to predict everything that can be printed, I -decided to just match anything after the "cannot resolve name: " part. -This patch implements that. - -Regression tested on the BuildBot. - -gdb/testsuite/ChangeLog: -2018-07-30 Sergio Durigan Junior - - * lib/gdbserver-support.exp (gdbserver_start): Match any kind of - error after "cannot resolve name" string. - -diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp ---- a/gdb/testsuite/lib/gdbserver-support.exp -+++ b/gdb/testsuite/lib/gdbserver-support.exp -@@ -326,7 +326,7 @@ proc gdbserver_start { options arguments } { - continue - } - } -- -re ".*: cannot resolve name: Name or service not known\r\n" { -+ -re ".*: cannot resolve name: .*\r\n" { - error "gdbserver cannot resolve name." - } - timeout { diff --git a/gdb-rhbz881849-ipv6-3of3.patch b/gdb-rhbz881849-ipv6-3of3.patch deleted file mode 100644 index 32f3744d53de78be98763ae55f9866338af2271f..0000000000000000000000000000000000000000 --- a/gdb-rhbz881849-ipv6-3of3.patch +++ /dev/null @@ -1,72 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Fri, 3 Aug 2018 18:04:38 -0400 -Subject: gdb-rhbz881849-ipv6-3of3.patch - -Fix thinko when deciding whether to disable TCP's Nagle algorithm - -This patch fixes a thinko that happened when I was implementing the -IPv6 support on GDB/gdbserver. On certain situations, it is necessary -to disable TCP's Nagle algorithm (NODELAY). For obvious reasons, this -only applies when we are dealing with a TCP connection. - -While implementing the IPv6 patch, I noticed that the net_open -function (on gdb/ser-tcp.c) kept a flag indicating whether the -connection type was UDP or TCP. I eliminated that flag, and started -using the 'struct addrinfo *' related to the successful connection -directly. However, I made a mistake: - - if (success_ainfo->ai_socktype == IPPROTO_TCP) - ^^^^^^^^^^^ - { - /* Disable Nagle algorithm. Needed in some cases. */ - int tmp = 1; - - setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (tmp)); - } - -The 'ai_socktype' field specifies the socket type (SOCK_STREAM or -SOCK_DGRAM), and not the protocol. This test was always failing, and -the Nagle algorithm was never being disabled. - -The obvious fix is to use the 'ai_protocol' field. This is what this -patch does. - -Huge "thank you" to Joel Brobecker who reported the regression (he was -experiencing an unusual delay while debugging a bare-metal program -running under QEMU) and helped me set up a proper reproducer for the -bug. - -gdb/ChangeLog: -2018-08-03 Sergio Durigan Junior - - * ser-tcp.c (net_open): Fix thinko when deciding whether to - disable TCP's Nagle algorithm (use "ai_protocol" instead of - "ai_socktype"). - -diff --git a/gdb/ChangeLog b/gdb/ChangeLog ---- a/gdb/ChangeLog -+++ b/gdb/ChangeLog -@@ -1,3 +1,9 @@ -+2018-08-03 Sergio Durigan Junior -+ -+ * ser-tcp.c (net_open): Fix thinko when deciding whether to -+ disable TCP's Nagle algorithm (use "ai_protocol" instead of -+ "ai_socktype"). -+ - 2018-09-05 Joel Brobecker - - * version.in: Set GDB version number to 8.2. -diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c ---- a/gdb/ser-tcp.c -+++ b/gdb/ser-tcp.c -@@ -367,7 +367,7 @@ net_open (struct serial *scb, const char *name) - - ioctl (scb->fd, FIONBIO, &ioarg); - -- if (success_ainfo->ai_socktype == IPPROTO_TCP) -+ if (success_ainfo->ai_protocol == IPPROTO_TCP) - { - /* Disable Nagle algorithm. Needed in some cases. */ - int tmp = 1; diff --git a/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch index 0df5ee52f35d956f6d5a1e0ecad82651499889af..167ffba643370a00675cf236dd3f42a60fd5a093 100644 --- a/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +++ b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch @@ -1,12 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch - -;; Import regression test for `gdb/findvar.c:417: internal-error: -;; read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc new file mode 100644 --- /dev/null @@ -145,3 +136,4 @@ new file mode 100644 +} else { + fail "different values for TLS variable" +} + diff --git a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch index b130d1f677eb03883ee33ba9af62842abfd486e2..1886b8765b0a451a37f56e9a6a7c315d756e21a7 100644 --- a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +++ b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch - -;; Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S new file mode 100644 --- /dev/null @@ -729,3 +721,4 @@ new file mode 100644 + use mod1 + call sub1 + end + diff --git a/gdb-runtest-pie-override.patch b/gdb-runtest-pie-override.patch index f878dc317a20103ed29696387236f545922a837e..9354d8b4286d8da5552331ca49b2b9ff97626623 100644 --- a/gdb-runtest-pie-override.patch +++ b/gdb-runtest-pie-override.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-runtest-pie-override.patch - -;; Hack for proper PIE run of the testsuite. -;;=fedoratest - make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp gcc -fpic -c -fPIE -pie -o x.o x.c @@ -47,3 +39,4 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp verbose "doing compile" set sources "" + diff --git a/gdb-simultaneous-step-resume-breakpoint-test.patch b/gdb-simultaneous-step-resume-breakpoint-test.patch index 5e1315b77e9809e81742d6596d419fc963577a06..604d2822db42c39f05a4ea48105c7982b8926829 100644 --- a/gdb-simultaneous-step-resume-breakpoint-test.patch +++ b/gdb-simultaneous-step-resume-breakpoint-test.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-simultaneous-step-resume-breakpoint-test.patch - -;; New test for step-resume breakpoint placed in multiple threads at once. -;;=fedoratest - diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c new file mode 100644 --- /dev/null @@ -160,3 +152,4 @@ new file mode 100644 + +gdb_test "continue" "sleep-after.*" "second continue" +gdb_test "continue" "final-exit.*" "third continue" + diff --git a/gdb-test-bt-cfi-without-die.patch b/gdb-test-bt-cfi-without-die.patch index 6167c145816b5da3217f2b4c1aae46d9fe11ecf8..42a017c8a6b4c6711f44215058470f29f2d47c1c 100644 --- a/gdb-test-bt-cfi-without-die.patch +++ b/gdb-test-bt-cfi-without-die.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-test-bt-cfi-without-die.patch - -;; [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). -;;=fedoratest - http://sourceware.org/ml/archer/2010-q3/msg00028.html On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote: @@ -212,3 +204,4 @@ new file mode 100644 +# #1 0x00000000004004e9 in caller () +# #2 0x00000000004004cd in main () at ... +gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs" + diff --git a/gdb-test-dw2-aranges.patch b/gdb-test-dw2-aranges.patch index 054a769a8d4c9c511686487808d48bad73b3c8a9..ce41c364210b0f3181af0fc141e882ebcbbce0a8 100644 --- a/gdb-test-dw2-aranges.patch +++ b/gdb-test-dw2-aranges.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-test-dw2-aranges.patch - -;; [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. -;;=fedoratest - [archer-tromey-delayed-symfile] commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d @@ -218,3 +210,4 @@ new file mode 100644 + +# Failed gdb_load would abort the testcase execution earlier. +pass "file loaded" + diff --git a/gdb-test-expr-cumulative-archer.patch b/gdb-test-expr-cumulative-archer.patch index 28a903dd9b4c7b65f8967b43b6154f863c0b234b..ba41b81d30cdbe44fbd82371b1ef4e4ef0dd4175 100644 --- a/gdb-test-expr-cumulative-archer.patch +++ b/gdb-test-expr-cumulative-archer.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-test-expr-cumulative-archer.patch - -;; [archer-keiths-expr-cumulative+upstream] Import C++ testcases. -;;=fedoratest - archer archer-keiths-expr-cumulative b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc @@ -221,3 +213,4 @@ new file mode 100644 +gdb_test "print _a" "= 11" +gdb_test "print ab" "= 22" +gdb_test "print abc" "= 33" + diff --git a/gdb-test-ivy-bridge.patch b/gdb-test-ivy-bridge.patch index c0d8edcecde48ed1981ca7e65664727af83039e8..5b4ea18e64569f39c0788f4debb5a7593be89961 100644 --- a/gdb-test-ivy-bridge.patch +++ b/gdb-test-ivy-bridge.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-test-ivy-bridge.patch - -;; Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890). -;;=fedoratest - diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S new file mode 100644 --- /dev/null @@ -467,3 +459,4 @@ new file mode 100644 +\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r +\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r +End of assembler dump\\." "intel" + diff --git a/gdb-test-pid0-core.patch b/gdb-test-pid0-core.patch index 4401dcd28bcce746b817d87a5e13e231171c24f0..b127ced0cb5c8488d088f166b6be5d4cec615900 100644 --- a/gdb-test-pid0-core.patch +++ b/gdb-test-pid0-core.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-test-pid0-core.patch - -;; New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). -;;=fedoratest - https://bugzilla.redhat.com/show_bug.cgi?id=611435 Fix: @@ -90,3 +82,4 @@ new file mode 100644 +# Former crash was: +# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed. +gdb_test "core-file ${corefile}" "Program terminated with signal (11|SIGSEGV), Segmentation fault\\.\r\n.*" + diff --git a/gdb-testsuite-readline63-sigint.patch b/gdb-testsuite-readline63-sigint.patch index 338895a8d4a12417971ad2892b2d3172d403e068..98b2d6e6abe385aa37895d9056b4ce37599d59a1 100644 --- a/gdb-testsuite-readline63-sigint.patch +++ b/gdb-testsuite-readline63-sigint.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-testsuite-readline63-sigint.patch - -;; [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka). -;;=fedoratest - gdb/users/ppalka/readline-7.0-update commit 379059215e823555a37a8dc7e02cef8fd86566e4 https://sourceware.org/ml/gdb-patches/2015-07/msg00422.html @@ -44,3 +36,4 @@ diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest # Switch back to the GDB thread if Guile support is linked in. # "signal SIGINT" could also switch the current thread. + diff --git a/gdb-use-pulongest-aarch64-linux-tdep.patch b/gdb-use-pulongest-aarch64-linux-tdep.patch deleted file mode 100644 index ebc7b9a08c047d99123b9b1c4199d4a22a779a14..0000000000000000000000000000000000000000 --- a/gdb-use-pulongest-aarch64-linux-tdep.patch +++ /dev/null @@ -1,44 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Thu, 6 Sep 2018 00:22:18 -0400 -Subject: gdb-use-pulongest-aarch64-linux-tdep.patch - -;; Use pulongest in aarch64-linux-tdep.c. -;; This patch was forgotten during the 8.2 release process, and is -;; needed to unbreak GDB when compiling on 32-bit arches. - -Use pulongest in aarch64-linux-tdep.c - -While testing a patch on the buildbot, I got this error: - -../../binutils-gdb/gdb/aarch64-linux-tdep.c: In function uint64_t aarch64_linux_core_read_vq(gdbarch*, bfd*): -../../binutils-gdb/gdb/aarch64-linux-tdep.c:285:29: error: format %ld expects argument of type long int, but argument 2 has type uint64_t {aka long long unsigned int} [-Werror=format=] - -This patch avoids the problem by using pulongest rather than %ld. -This seems safe to me because, if aarch64-linux-tdep.c is included in -the build, then ULONGEST must be a 64-bit type. - -gdb/ChangeLog -2018-08-15 Tom Tromey - - * aarch64-linux-tdep.c (aarch64_linux_core_read_vq): Use pulongest. - -diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c ---- a/gdb/aarch64-linux-tdep.c -+++ b/gdb/aarch64-linux-tdep.c -@@ -282,12 +282,13 @@ aarch64_linux_core_read_vq (struct gdbarch *gdbarch, bfd *abfd) - if (vq > AARCH64_MAX_SVE_VQ) - { - warning (_("SVE Vector length in core file not supported by this version" -- " of GDB. (VQ=%ld)"), vq); -+ " of GDB. (VQ=%s)"), pulongest (vq)); - return 0; - } - else if (vq == 0) - { -- warning (_("SVE Vector length in core file is invalid. (VQ=%ld"), vq); -+ warning (_("SVE Vector length in core file is invalid. (VQ=%s"), -+ pulongest (vq)); - return 0; - } - diff --git a/gdb-vla-intel-fix-print-char-array.patch b/gdb-vla-intel-fix-print-char-array.patch index 944f82b72d3da70cd27df8cbd13921b5377cfae6..b4b069f406247f5ec88733bc424a04a8e3356aee 100644 --- a/gdb-vla-intel-fix-print-char-array.patch +++ b/gdb-vla-intel-fix-print-char-array.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Thu, 7 Dec 2017 16:20:31 -0500 -Subject: gdb-vla-intel-fix-print-char-array.patch - -;; Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd - Revert commit (only the part touching gdb/f-valprint.c): commit 469412dd9ccc4de5874fd3299b105833f36b34cd @@ -59,3 +52,4 @@ diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fo gdb_test "print twobytes" " = 2" gdb_test "print chvalue" " = \'a\'" gdb_test "print logvalue" " = \.TRUE\." + diff --git a/gdb-vla-intel-fortran-strides.patch b/gdb-vla-intel-fortran-strides.patch index 7868efe758192fca651c6e87f93c6a3a8e1c5929..ba6ab1cd564537fe83fd4542696d150d18b1af91 100644 --- a/gdb-vla-intel-fortran-strides.patch +++ b/gdb-vla-intel-fortran-strides.patch @@ -1,11 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-vla-intel-fortran-strides.patch - -;; VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests. -;;=push - git diff --stat -p gdb/master...gdb/users/bheckel/fortran-strides dbfd7140bf4c0500d1f5d192be781f83f78f7922 @@ -37,7 +29,7 @@ dbfd7140bf4c0500d1f5d192be781f83f78f7922 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -2600,11 +2600,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, +@@ -2429,11 +2429,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, /* See dwarf2loc.h. */ int @@ -54,7 +46,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c if (prop == NULL) return 0; -@@ -2628,7 +2631,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2457,7 +2460,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, *value = value_as_address (val); } @@ -63,7 +55,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c } } break; -@@ -2650,7 +2653,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2479,7 +2482,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, if (!value_optimized_out (val)) { *value = value_as_address (val); @@ -72,7 +64,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c } } } -@@ -2658,8 +2661,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2487,8 +2490,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, case PROP_CONST: *value = prop->data.const_val; @@ -83,7 +75,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c case PROP_ADDR_OFFSET: { struct dwarf2_property_baton *baton -@@ -2680,11 +2683,38 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2509,11 +2512,38 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, val = value_at (baton->offset_info.type, pinfo->addr + baton->offset_info.offset); *value = value_as_address (val); @@ -143,7 +135,7 @@ diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -17566,7 +17566,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17773,7 +17773,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type, *orig_base_type; struct type *range_type; struct attribute *attr; @@ -152,7 +144,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c int low_default_is_valid; int high_bound_is_count = 0; const char *name; -@@ -17586,7 +17586,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17793,7 +17793,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) low.kind = PROP_CONST; high.kind = PROP_CONST; @@ -162,7 +154,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow omitting DW_AT_lower_bound. */ -@@ -17619,6 +17621,14 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17826,6 +17828,14 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) break; } @@ -177,7 +169,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c attr = dwarf2_attr (die, DW_AT_lower_bound, cu); if (attr) attr_to_dynamic_prop (attr, die, cu, &low); -@@ -17696,7 +17706,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17918,7 +17928,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask)) high.data.const_val |= negative_mask; @@ -189,7 +181,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/eval.c b/gdb/eval.c --- a/gdb/eval.c +++ b/gdb/eval.c -@@ -377,29 +377,325 @@ init_array_element (struct value *array, struct value *element, +@@ -377,29 +377,324 @@ init_array_element (struct value *array, struct value *element, return index; } @@ -207,8 +199,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c + int *pos, int nargs, enum noside noside) { - int pc = (*pos) + 1; -+ int i, dim_count = 0; - LONGEST low_bound, high_bound; +- LONGEST low_bound, high_bound; - struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array))); - enum range_type range_type - = (enum range_type) longest_to_int (exp->elts[pc].longconst); @@ -219,11 +210,12 @@ diff --git a/gdb/eval.c b/gdb/eval.c - low_bound = TYPE_LOW_BOUND (range); - else - low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); ++ int i, dim_count = 0; + struct value *new_array = array; + struct type *array_type = check_typedef (value_type (new_array)); + struct type *elt_type; + -+ typedef struct subscript_range ++ typedef struct + { + enum range_type f90_range_type; + LONGEST low, high, stride; @@ -272,11 +264,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c + for (i = 0; i < nargs; i++) + { + struct subscript_store *index = &subscript_array[i]; - -- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) -- high_bound = TYPE_HIGH_BOUND (range); -- else -- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); ++ + /* The user input is a range, with or without lower and upper bound. + E.g.: "p arry(2:5)", "p arry( :5)", "p arry( : )", etc. */ + if (exp->elts[*pos].opcode == OP_RANGE) @@ -310,7 +298,11 @@ diff --git a/gdb/eval.c b/gdb/eval.c + /* Assign the default stride value '1'. */ + else + range->stride = 1; -+ + +- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) +- high_bound = TYPE_HIGH_BOUND (range); +- else +- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); + /* Check the provided stride value is illegal, aka '0'. */ + if (range->stride == 0) + error (_("Stride must not be 0")); @@ -480,7 +472,8 @@ diff --git a/gdb/eval.c b/gdb/eval.c + struct value *v = NULL; + + elt_type = TYPE_TARGET_TYPE (value_type (new_array)); -+ + +- return value_slice (array, low_bound, high_bound - low_bound + 1); + /* Every SUBSCRIPT_RANGE in the user input signifies an actual range in + the output array. So we traverse the SUBSCRIPT_ARRAY again, looking + for a range entry. When we find one, we use the range info to create @@ -497,8 +490,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c + struct type *range_type, *interim_array_type; + + int new_length; - -- return value_slice (array, low_bound, high_bound - low_bound + 1); ++ + /* The length of a sub-dimension with all elements between the + bounds plus the start element itself. It may be modified by + a user provided stride value. */ @@ -533,20 +525,54 @@ diff --git a/gdb/eval.c b/gdb/eval.c } -@@ -1926,19 +2222,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1242,19 +1537,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, + return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type); + } + +-/* Helper for skipping all the arguments in an undetermined argument list. +- This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST +- case of evaluate_subexp_standard as multiple, but not all, code paths +- require a generic skip. */ +- +-static void +-skip_undetermined_arglist (int nargs, struct expression *exp, int *pos, +- enum noside noside) +-{ +- for (int i = 0; i < nargs; ++i) +- evaluate_subexp (NULL_TYPE, exp, pos, noside); +-} +- + struct value * + evaluate_subexp_standard (struct type *expect_type, + struct expression *exp, int *pos, +@@ -1949,33 +2231,8 @@ evaluate_subexp_standard (struct type *expect_type, switch (code) { case TYPE_CODE_ARRAY: - if (exp->elts[*pos].opcode == OP_RANGE) - return value_f90_subarray (arg1, exp, pos, noside); - else -- goto multi_f77_subscript; +- { +- if (noside == EVAL_SKIP) +- { +- skip_undetermined_arglist (nargs, exp, pos, noside); +- /* Return the dummy value with the correct type. */ +- return arg1; +- } +- goto multi_f77_subscript; +- } - case TYPE_CODE_STRING: - if (exp->elts[*pos].opcode == OP_RANGE) - return value_f90_subarray (arg1, exp, pos, noside); - else - { +- if (noside == EVAL_SKIP) +- { +- skip_undetermined_arglist (nargs, exp, pos, noside); +- /* Return the dummy value with the correct type. */ +- return arg1; +- } - arg2 = evaluate_subexp_with_coercion (exp, pos, noside); - return value_subscript (arg1, value_as_long (arg2)); - } @@ -554,7 +580,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c case TYPE_CODE_PTR: case TYPE_CODE_FUNC: -@@ -2334,49 +2619,6 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2372,49 +2629,6 @@ evaluate_subexp_standard (struct type *expect_type, } return (arg1); @@ -604,7 +630,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c case BINOP_LOGICAL_AND: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) -@@ -3293,6 +3535,9 @@ calc_f77_array_dims (struct type *array_type) +@@ -3334,6 +3548,9 @@ calc_f77_array_dims (struct type *array_type) int ndimen = 1; struct type *tmp_type; @@ -639,7 +665,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); fputs_filtered (")", stream); return; -@@ -1098,22 +1095,24 @@ dump_subexp_body_standard (struct expression *exp, +@@ -1105,22 +1102,24 @@ dump_subexp_body_standard (struct expression *exp, switch (range_type) { @@ -672,7 +698,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream); break; default: -@@ -1121,11 +1120,9 @@ dump_subexp_body_standard (struct expression *exp, +@@ -1128,11 +1127,9 @@ dump_subexp_body_standard (struct expression *exp, break; } @@ -689,7 +715,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c diff --git a/gdb/expression.h b/gdb/expression.h --- a/gdb/expression.h +++ b/gdb/expression.h -@@ -148,28 +148,27 @@ extern void dump_raw_expression (struct expression *, +@@ -150,28 +150,27 @@ extern void dump_raw_expression (struct expression *, struct ui_file *, const char *); extern void dump_prefix_expression (struct expression *, struct ui_file *); @@ -832,7 +858,7 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -902,7 +902,8 @@ operator== (const range_bounds &l, const range_bounds &r) +@@ -911,7 +911,8 @@ operator== (const range_bounds &l, const range_bounds &r) struct type * create_range_type (struct type *result_type, struct type *index_type, const struct dynamic_prop *low_bound, @@ -842,7 +868,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { if (result_type == NULL) result_type = alloc_type_copy (index_type); -@@ -917,6 +918,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -926,6 +927,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_RANGE_DATA (result_type)->low = *low_bound; TYPE_RANGE_DATA (result_type)->high = *high_bound; @@ -850,7 +876,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -945,7 +947,7 @@ struct type * +@@ -954,7 +956,7 @@ struct type * create_static_range_type (struct type *result_type, struct type *index_type, LONGEST low_bound, LONGEST high_bound) { @@ -859,7 +885,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c low.kind = PROP_CONST; low.data.const_val = low_bound; -@@ -953,7 +955,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, +@@ -962,7 +964,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, high.kind = PROP_CONST; high.data.const_val = high_bound; @@ -872,7 +898,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c return result_type; } -@@ -1171,16 +1177,20 @@ create_array_type_with_stride (struct type *result_type, +@@ -1180,16 +1186,20 @@ create_array_type_with_stride (struct type *result_type, && (!type_not_associated (result_type) && !type_not_allocated (result_type))) { @@ -894,7 +920,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c else if (bit_stride > 0) TYPE_LENGTH (result_type) = (bit_stride * (high_bound - low_bound + 1) + 7) / 8; -@@ -1981,12 +1991,12 @@ resolve_dynamic_range (struct type *dyn_range_type, +@@ -1990,12 +2000,12 @@ resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR value; struct type *static_range_type, *static_target_type; const struct dynamic_prop *prop; @@ -909,7 +935,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { low_bound.kind = PROP_CONST; low_bound.data.const_val = value; -@@ -1998,7 +2008,7 @@ resolve_dynamic_range (struct type *dyn_range_type, +@@ -2007,7 +2017,7 @@ resolve_dynamic_range (struct type *dyn_range_type, } prop = &TYPE_RANGE_DATA (dyn_range_type)->high; @@ -918,7 +944,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { high_bound.kind = PROP_CONST; high_bound.data.const_val = value; -@@ -2013,12 +2023,20 @@ resolve_dynamic_range (struct type *dyn_range_type, +@@ -2022,12 +2032,20 @@ resolve_dynamic_range (struct type *dyn_range_type, high_bound.data.const_val = 0; } @@ -943,7 +969,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -612,6 +612,10 @@ struct range_bounds +@@ -614,6 +614,10 @@ struct range_bounds struct dynamic_prop high; @@ -954,7 +980,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* True if HIGH range bound contains the number of elements in the subrange. This affects how the final hight bound is computed. */ -@@ -776,7 +780,6 @@ struct main_type +@@ -778,7 +782,6 @@ struct main_type /* * Union member used for range types. */ struct range_bounds *bounds; @@ -962,7 +988,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h } flds_bnds; /* * Slot to point to additional language-specific fields of this -@@ -1329,6 +1332,15 @@ extern bool set_type_align (struct type *, ULONGEST); +@@ -1327,6 +1330,15 @@ extern bool set_type_align (struct type *, ULONGEST); TYPE_RANGE_DATA(range_type)->high.kind #define TYPE_LOW_BOUND_KIND(range_type) \ TYPE_RANGE_DATA(range_type)->low.kind @@ -978,7 +1004,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* Property accessors for the type data location. */ #define TYPE_DATA_LOCATION(thistype) \ -@@ -1363,6 +1375,9 @@ extern bool set_type_align (struct type *, ULONGEST); +@@ -1361,6 +1373,9 @@ extern bool set_type_align (struct type *, ULONGEST); TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) @@ -988,7 +1014,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) -@@ -1892,6 +1907,7 @@ extern struct type *create_array_type_with_stride +@@ -1896,6 +1911,7 @@ extern struct type *create_array_type_with_stride struct dynamic_prop *, unsigned int); extern struct type *create_range_type (struct type *, struct type *, @@ -1038,7 +1064,7 @@ diff --git a/gdb/parse.c b/gdb/parse.c diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y -@@ -2478,24 +2478,28 @@ convert_ast_to_expression (struct parser_state *state, +@@ -2475,24 +2475,28 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, case OP_RANGE: { @@ -1047,13 +1073,13 @@ diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y if (operation->left.op != NULL) { - convert_ast_to_expression (state, operation->left.op, top); + convert_ast_to_expression (operation->left.op, top); - kind = HIGH_BOUND_DEFAULT; + kind = SUBARRAY_LOW_BOUND; } if (operation->right.op != NULL) { - convert_ast_to_expression (state, operation->right.op, top); + convert_ast_to_expression (operation->right.op, top); - if (kind == BOTH_BOUND_DEFAULT) - kind = (operation->inclusive - ? LOW_BOUND_DEFAULT : LOW_BOUND_DEFAULT_EXCLUSIVE); @@ -1078,7 +1104,7 @@ diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c -@@ -1149,13 +1149,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside) +@@ -1193,13 +1193,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside) kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst); *pos += 3; @@ -1095,7 +1121,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c if (noside == EVAL_SKIP) return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); -@@ -1244,7 +1242,7 @@ rust_compute_range (struct type *type, struct value *range, +@@ -1288,7 +1286,7 @@ rust_compute_range (struct type *type, struct value *range, *low = 0; *high = 0; @@ -1104,7 +1130,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c if (TYPE_NFIELDS (type) == 0) return; -@@ -1252,15 +1250,14 @@ rust_compute_range (struct type *type, struct value *range, +@@ -1296,15 +1294,14 @@ rust_compute_range (struct type *type, struct value *range, i = 0; if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0) { @@ -1122,7 +1148,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c *high = value_as_long (value_field (range, i)); if (rust_inclusive_range_type_p (type)) -@@ -1278,7 +1275,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1322,7 +1319,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, struct type *rhstype; LONGEST low, high_bound; /* Initialized to appease the compiler. */ @@ -1131,7 +1157,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c LONGEST high = 0; int want_slice = 0; -@@ -1376,7 +1373,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1420,7 +1417,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, error (_("Cannot subscript non-array type")); if (want_slice @@ -1140,7 +1166,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c low = low_bound; if (low < 0) error (_("Index less than zero")); -@@ -1394,7 +1391,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1438,7 +1435,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, CORE_ADDR addr; struct value *addrval, *tem; @@ -1761,7 +1787,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f diff --git a/gdb/valarith.c b/gdb/valarith.c --- a/gdb/valarith.c +++ b/gdb/valarith.c -@@ -187,10 +187,16 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) +@@ -187,11 +187,17 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); ULONGEST elt_size = type_length_units (elt_type); @@ -1774,16 +1800,17 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c + else + elt_offs *= elt_size; - if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) -- && elt_offs >= type_length_units (array_type))) -+ && abs (elt_offs) >= type_length_units (array_type))) + if (index < lowerbound + || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) +- && elt_offs >= type_length_units (array_type)) ++ && abs (elt_offs) >= type_length_units (array_type)) + || (VALUE_LVAL (array) != lval_memory + && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type))) { - if (type_not_associated (array_type)) - error (_("no such vector element (vector not associated)")); diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -3808,56 +3808,195 @@ value_of_this_silent (const struct language_defn *lang) +@@ -3792,56 +3792,195 @@ value_of_this_silent (const struct language_defn *lang) struct value * value_slice (struct value *array, int lowbound, int length) @@ -2021,3 +2048,4 @@ diff --git a/gdb/value.h b/gdb/value.h extern struct value *value_literal_complex (struct value *, struct value *, struct type *); + diff --git a/gdb-vla-intel-fortran-vla-strings.patch b/gdb-vla-intel-fortran-vla-strings.patch index 49ab71c94f55fb367611a41e9c22bb838daaf8e3..8b81c5383de562ce0f088cb353e1683b66aecf24 100644 --- a/gdb-vla-intel-fortran-vla-strings.patch +++ b/gdb-vla-intel-fortran-vla-strings.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-vla-intel-fortran-vla-strings.patch - -;;=push - git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings 0ad7d8d1a3a36c6e04e3b6d37d8825f18d595723 @@ -33,7 +26,7 @@ git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings diff --git a/gdb/NEWS b/gdb/NEWS --- a/gdb/NEWS +++ b/gdb/NEWS -@@ -109,6 +109,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* +@@ -336,6 +336,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* *** Changes in GDB 8.1 @@ -77,7 +70,7 @@ diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -1789,7 +1789,8 @@ static void read_signatured_type (struct signatured_type *); +@@ -1833,7 +1833,8 @@ static void read_signatured_type (struct signatured_type *); static int attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, struct dwarf2_cu *cu, @@ -87,7 +80,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c /* memory allocation interface */ -@@ -13648,7 +13649,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -13757,7 +13758,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) { newobj->static_link = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop); @@ -95,8 +88,8 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + attr_to_dynamic_prop (attr, die, cu, newobj->static_link, NULL, 0); } - cu->list_in_scope = &local_symbols; -@@ -16329,7 +16330,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) + cu->list_in_scope = cu->get_builder ()->get_local_symbols (); +@@ -16516,7 +16517,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) byte_stride_prop = (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop)); @@ -106,7 +99,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c if (!stride_ok) { complaint (_("unable to read array DW_AT_byte_stride " -@@ -17090,29 +17092,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17277,29 +17279,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -150,7 +143,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + operand. */ + DW_OP_deref_size, + /* Operand for DW_OP_deref_size. */ -+ DW_UNSND(byte_size) }; ++ (gdb_byte) DW_UNSND(byte_size) }; + + if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops, + ARRAY_SIZE(append_ops))) @@ -208,7 +201,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -17460,7 +17523,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17667,7 +17730,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) static int attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, @@ -218,7 +211,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c { struct dwarf2_property_baton *baton; struct obstack *obstack -@@ -17471,14 +17535,33 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -17678,14 +17742,33 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, if (attr_form_is_block (attr)) { @@ -256,7 +249,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } else if (attr_form_is_ref (attr)) { -@@ -17511,8 +17594,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -17718,8 +17801,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, baton = XOBNEW (obstack, struct dwarf2_property_baton); baton->referenced_type = die_type (target_die, target_cu); baton->locexpr.per_cu = cu->per_cu; @@ -287,7 +280,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -17623,7 +17726,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17830,7 +17933,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_byte_stride, cu); if (attr) @@ -296,7 +289,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c complaint (_("Missing DW_AT_byte_stride " "- DIE at 0x%s [in module %s]"), sect_offset_str (die->sect_off), -@@ -17631,7 +17734,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17838,7 +17941,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_lower_bound, cu); if (attr) @@ -305,20 +298,20 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c else if (!low_default_is_valid) complaint (_("Missing DW_AT_lower_bound " "- DIE at %s [in module %s]"), -@@ -17639,10 +17742,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); +@@ -17847,10 +17950,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - attr = dwarf2_attr (die, DW_AT_upper_bound, cu); + struct attribute *attr_ub, *attr_count; + attr = attr_ub = dwarf2_attr (die, DW_AT_upper_bound, cu); - if (!attr_to_dynamic_prop (attr, die, cu, &high)) + if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) { - attr = dwarf2_attr (die, DW_AT_count, cu); + attr = attr_count = dwarf2_attr (die, DW_AT_count, cu); - if (attr_to_dynamic_prop (attr, die, cu, &high)) + if (attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) { /* If bounds are constant do the final calculation here. */ if (low.kind == PROP_CONST && high.kind == PROP_CONST) -@@ -25143,7 +25246,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -25417,7 +25520,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_allocated, cu); if (attr_form_is_block (attr)) { @@ -327,7 +320,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c add_dyn_prop (DYN_PROP_ALLOCATED, prop, type); } else if (attr != NULL) -@@ -25157,7 +25260,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -25431,7 +25534,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_associated, cu); if (attr_form_is_block (attr)) { @@ -336,7 +329,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type); } else if (attr != NULL) -@@ -25169,7 +25272,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -25443,7 +25546,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) /* Read DW_AT_data_location and set in type. */ attr = dwarf2_attr (die, DW_AT_data_location, cu); @@ -500,7 +493,7 @@ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -1904,7 +1904,8 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1913,7 +1913,8 @@ is_dynamic_type_internal (struct type *type, int top_level) type = check_typedef (type); /* We only want to recognize references at the outermost level. */ @@ -510,7 +503,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c type = check_typedef (TYPE_TARGET_TYPE (type)); /* Types that have a dynamic TYPE_DATA_LOCATION are considered -@@ -1938,6 +1939,7 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1947,6 +1948,7 @@ is_dynamic_type_internal (struct type *type, int top_level) } case TYPE_CODE_ARRAY: @@ -518,7 +511,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { gdb_assert (TYPE_NFIELDS (type) == 1); -@@ -2056,7 +2058,8 @@ resolve_dynamic_array (struct type *type, +@@ -2065,7 +2067,8 @@ resolve_dynamic_array (struct type *type, struct dynamic_prop *prop; unsigned int bit_stride = 0; @@ -528,7 +521,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c type = copy_type (type); -@@ -2081,11 +2084,15 @@ resolve_dynamic_array (struct type *type, +@@ -2090,11 +2093,15 @@ resolve_dynamic_array (struct type *type, ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); @@ -545,7 +538,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type); if (prop != NULL) { -@@ -2240,6 +2247,28 @@ resolve_dynamic_struct (struct type *type, +@@ -2249,6 +2256,28 @@ resolve_dynamic_struct (struct type *type, return resolved_type; } @@ -574,7 +567,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c /* Worker for resolved_dynamic_type. */ static struct type * -@@ -2288,7 +2317,12 @@ resolve_dynamic_type_internal (struct type *type, +@@ -2297,7 +2326,12 @@ resolve_dynamic_type_internal (struct type *type, break; } @@ -1306,7 +1299,7 @@ diff --git a/gdb/typeprint.c b/gdb/typeprint.c diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -1565,6 +1565,19 @@ value_ind (struct value *arg1) +@@ -1553,6 +1553,19 @@ value_ind (struct value *arg1) if (TYPE_CODE (base_type) == TYPE_CODE_PTR) { struct type *enc_type; @@ -1326,7 +1319,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c /* We may be pointing to something embedded in a larger object. Get the real type of the enclosing object. */ -@@ -1580,8 +1593,7 @@ value_ind (struct value *arg1) +@@ -1568,8 +1581,7 @@ value_ind (struct value *arg1) else /* Retrieve the enclosing object pointed to. */ arg2 = value_at_lazy (enc_type, @@ -1352,3 +1345,4 @@ diff --git a/gdb/valprint.c b/gdb/valprint.c if (type_not_allocated (value_type (val))) { val_print_not_allocated (stream); + diff --git a/gdb-vla-intel-stringbt-fix.patch b/gdb-vla-intel-stringbt-fix.patch index b2170f4c5493048a5342018b32e975663c0ddf04..b31e525a7c91b588493a271405cb1d78ab3c2a94 100644 --- a/gdb-vla-intel-stringbt-fix.patch +++ b/gdb-vla-intel-stringbt-fix.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 1 Aug 2014 23:02:17 +0200 -Subject: gdb-vla-intel-stringbt-fix.patch - -;;=push+jan - http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote: @@ -38,7 +31,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c #include "common/underlying.h" #include "common/byte-vector.h" -@@ -2348,6 +2349,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2158,6 +2159,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, ctx.per_cu = per_cu; ctx.obj_address = 0; @@ -173,3 +166,4 @@ new file mode 100644 + end interface + call foo ('hello') +end + diff --git a/gdb-vla-intel-tests.patch b/gdb-vla-intel-tests.patch index 36c97abc7cf5e1bb0a9a31c32da490b84544f89c..d7a2407f8e7fe02d74aabf90916ea2f96411d3a7 100644 --- a/gdb-vla-intel-tests.patch +++ b/gdb-vla-intel-tests.patch @@ -1,10 +1,3 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-vla-intel-tests.patch - -;;=fedoratest - diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp new file mode 100644 --- /dev/null @@ -298,3 +291,4 @@ new file mode 100644 + var_char_p => null() + l = associated(var_char_p) ! var_char_p-not-associated +end program vla_strings + diff --git a/gdb-x86_64-i386-syscall-restart.patch b/gdb-x86_64-i386-syscall-restart.patch deleted file mode 100644 index 575674f8f1f38ab236c9ce86ff2597278a1bdb3a..0000000000000000000000000000000000000000 --- a/gdb-x86_64-i386-syscall-restart.patch +++ /dev/null @@ -1,123 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-x86_64-i386-syscall-restart.patch - -;; Fix syscall restarts for amd64->i386 biarch. -;;=push+jan - -http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html -Subject: [patch] Fix syscall restarts for amd64->i386 biarch - -Hi, - -tested only on recent Linux kernels, it should apply also on vanilla ones. -There were various changes of the kernels behavior in the past. - -FSF GDB HEAD state: -kernel debugger inferior state -x86_64 x86_64 x86_64 PASS -x86_64 x86_64 i386 FAIL without this patch, PASS with this patch -x86_64 i386 i386 PASS on recent kernels - (FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12) - (PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64) -i386 i386 i386 PASS - -Currently gdb.base/interrupt.exp fails on amd64 host running under ---target_board unix/-m32 with: - continue - Continuing. - Unknown error 512 - -: -/* - * These should never be seen by user programs. To return one of ERESTART* - * codes, signal_pending() MUST be set. Note that ptrace can observe these - * at syscall exit tracing, but they will never be left for the debugged user - * process to see. - */ - -"Unknown error 512" printed above is printed by the inferior itself, not by GDB. - -It is because GDB reads it as 0xfffffffffffffe00 but writes it back as -0xfffffe00. -+ /* Sign-extend %eax as during return from a syscall it is being checked -+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by -+ interrupt.exp. */ - -Quote of Roland McGrath from IRC: - -roland: in the user_regset model, there are 64-bit user_regset flavors and -32-bit user_regset flavors, so at the kabi level the (kernel) caller can say -what it means: calls on the 32-bit user_regset flavor will behave as if on -a 32-bit kernel/userland. in ptrace, there is no way for x86_64 ptrace calls -to say "i think of the inferior as being 32 bits, so act accordingly" (tho ppc -and/or sparc have ptr -roland: ace requests that do that iirc) -roland: ergo 64-bit ptrace callers must either save/restore full 64-bits so -the kernel's sign-extension choices are preserved, or else grok magic ways to -expand stored 32-bit register contents to 64-bit values to stuff via 64-bit -ptrace -[...] -roland: there is a "32-bit-flavored task", but it's not really true that it -has 32-bit registers. there is no 32-bit-only userland condition. any task -can always ljmp to the 64-bit code segment and run 64-bit insns including -a 64-bit syscall -roland: so a 64-bit debugger should see and be able to fiddle the full -registers. it can even change cs via ptrace to force the inferior into -running 32 or 64 bit code. - -Saving whole 64bits for i386 targets on x86_64 hosts does not much match the -GDB architecture as `struct type' for these registers still should be 32bit -etc. Therefore provided just this exception. - -The problem is reproducible only if one does an inferior call during the -interruption to do full inferior save/restore from GDB regcache. - -Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. - -Thanks, -Jan - -gdb/ -2009-11-29 Jan Kratochvil - - * amd64-nat.c (amd64_collect_native_gregset): Do not pre-clear %eax. - Sign extend it afterwards. - -diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c ---- a/gdb/amd64-nat.c -+++ b/gdb/amd64-nat.c -@@ -135,9 +135,9 @@ amd64_collect_native_gregset (const struct regcache *regcache, - { - num_regs = amd64_native_gregset32_num_regs; - -- /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and -+ /* Make sure %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and - %eip get zero-extended to 64 bits. */ -- for (i = 0; i <= I386_EIP_REGNUM; i++) -+ for (i = I386_ECX_REGNUM; i <= I386_EIP_REGNUM; i++) - { - if (regnum == -1 || regnum == i) - memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8); -@@ -163,4 +163,20 @@ amd64_collect_native_gregset (const struct regcache *regcache, - regcache->raw_collect (i, regs + offset); - } - } -+ -+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ { -+ /* Sign-extend %eax as during return from a syscall it is being checked -+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by -+ interrupt.exp. */ -+ -+ int i = I386_EAX_REGNUM; -+ -+ if (regnum == -1 || regnum == i) -+ { -+ void *ptr = regs + amd64_native_gregset_reg_offset (gdbarch, i); -+ -+ *(int64_t *) ptr = *(int32_t *) ptr; -+ } -+ } - } diff --git a/gdb.spec b/gdb.spec index 20ef824517a4510a33ea42c97cbd00f12cab63bf..b251bd54f3a635e95b4085f16f6555f7e5a713aa 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,6 +1,6 @@ Name: gdb -Version: 8.2 -Release: 6 +Version: 8.3.1 +Release: 7 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.xz @@ -45,142 +45,127 @@ Recommends: %{librpmso}()(64bit) Source1: gdb-gstack.man Source2: gdbinit -# patchs from redhat -Patch002: gdb-vla-intel-fortran-strides.patch -Patch003: gdb-vla-intel-fortran-vla-strings.patch -Patch004: gdb-vla-intel-stringbt-fix.patch -Patch005: gdb-6.3-ppc64syscall-20040622.patch -Patch006: gdb-6.3-ppc64displaysymbol-20041124.patch -Patch007: gdb-6.3-gstack-20050411.patch -Patch008: gdb-6.3-test-pie-20050107.patch -Patch009: gdb-6.3-test-self-20050110.patch -Patch010: gdb-6.3-test-dtorfix-20050121.patch -Patch011: gdb-6.3-test-movedir-20050125.patch -Patch012: gdb-6.3-threaded-watchpoints2-20050225.patch -Patch013: gdb-6.3-inferior-notification-20050721.patch -Patch014: gdb-6.3-inheritancetest-20050726.patch -Patch015: gdb-6.3-readnever-20050907.patch -Patch016: gdb-6.5-bz203661-emit-relocs.patch -Patch017: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch -Patch018: gdb-6.5-sharedlibrary-path.patch -Patch019: gdb-6.5-BEA-testsuite.patch -Patch020: gdb-6.5-last-address-space-byte-test.patch -Patch021: gdb-6.5-readline-long-line-crash-test.patch -Patch022: gdb-6.5-bz216711-clone-is-outermost.patch -Patch023: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch -Patch024: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch -Patch025: gdb-6.5-bz109921-DW_AT_decl_file-test.patch -Patch026: gdb-6.3-bz140532-ppc-unwinding-test.patch -Patch027: gdb-6.3-bz202689-exec-from-pthread-test.patch -Patch028: gdb-6.6-bz230000-power6-disassembly-test.patch -Patch029: gdb-6.6-bz229517-gcore-without-terminal.patch -Patch030: gdb-6.6-testsuite-timeouts.patch -Patch031: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch -Patch032: gdb-6.6-scheduler_locking-step-is-default.patch -Patch033: gdb-6.3-attach-see-vdso-test.patch -Patch034: gdb-6.5-bz243845-stale-testing-zombie-test.patch -Patch035: gdb-6.6-buildid-locate.patch -Patch036: gdb-6.6-buildid-locate-solib-missing-ids.patch -Patch037: gdb-6.6-buildid-locate-rpm.patch -Patch038: gdb-6.7-charsign-test.patch -Patch039: gdb-6.7-ppc-clobbered-registers-O2-test.patch -Patch040: gdb-6.7-testsuite-stable-results.patch -Patch041: gdb-6.5-ia64-libunwind-leak-test.patch -Patch042: gdb-6.5-missed-trap-on-step-test.patch -Patch043: gdb-6.5-gcore-buffer-limit-test.patch -Patch044: gdb-6.3-mapping-zero-inode-test.patch -Patch045: gdb-6.3-focus-cmd-prev-test.patch -Patch046: gdb-6.8-bz442765-threaded-exec-test.patch -Patch047: gdb-6.8-sparc64-silence-memcpy-check.patch -Patch048: gdb-6.5-section-num-fixup-test.patch -Patch049: gdb-6.8-bz436037-reg-no-longer-active.patch -Patch050: gdb-6.8-watchpoint-conditionals-test.patch -Patch051: gdb-6.8-bz466901-backtrace-full-prelinked.patch -Patch052: gdb-simultaneous-step-resume-breakpoint-test.patch -Patch053: gdb-core-open-vdso-warning.patch -Patch054: gdb-x86_64-i386-syscall-restart.patch -Patch055: gdb-bz533176-fortran-omp-step.patch -Patch056: gdb-follow-child-stale-parent.patch -Patch057: gdb-ccache-workaround.patch -Patch058: gdb-archer-pie-addons.patch -Patch059: gdb-archer-pie-addons-keep-disabled.patch -Patch060: gdb-lineno-makeup-test.patch -Patch061: gdb-ppc-power7-test.patch -Patch062: gdb-bz541866-rwatch-before-run.patch -Patch063: gdb-moribund-utrace-workaround.patch -Patch064: gdb-archer-next-over-throw-cxx-exec.patch -Patch065: gdb-bz601887-dwarf4-rh-test.patch -Patch066: gdb-6.6-buildid-locate-core-as-arg.patch -Patch067: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch -Patch068: gdb-test-bt-cfi-without-die.patch -Patch069: gdb-bz568248-oom-is-error.patch -Patch070: gdb-bz634108-solib_address.patch -Patch071: gdb-test-pid0-core.patch -Patch072: gdb-test-dw2-aranges.patch -Patch073: gdb-test-expr-cumulative-archer.patch -Patch074: gdb-physname-pr11734-test.patch -Patch075: gdb-physname-pr12273-test.patch -Patch076: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch -Patch077: gdb-test-ivy-bridge.patch -Patch078: gdb-runtest-pie-override.patch -Patch079: gdb-attach-fail-reasons-5of5.patch -Patch080: gdb-glibc-strstr-workaround.patch -Patch081: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch -Patch082: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch -Patch083: gdb-rhbz795424-bitpos-20of25.patch -Patch084: gdb-rhbz795424-bitpos-21of25.patch -Patch085: gdb-rhbz795424-bitpos-22of25.patch -Patch086: gdb-rhbz795424-bitpos-23of25.patch -Patch087: gdb-rhbz795424-bitpos-25of25.patch -Patch088: gdb-rhbz795424-bitpos-25of25-test.patch -Patch089: gdb-rhbz795424-bitpos-lazyvalue.patch -Patch090: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch -Patch091: gdb-gnat-dwarf-crash-3of3.patch -Patch092: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch -Patch093: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch -Patch094: gdb-archer-vla-tests.patch -Patch095: gdb-vla-intel-tests.patch -Patch096: gdb-btrobust.patch -Patch097: gdb-fortran-frame-string.patch -Patch098: gdb-python-gil.patch -Patch099: gdb-rhbz1156192-recursive-dlopen-test.patch -Patch100: gdb-jit-reader-multilib.patch -Patch101: gdb-rhbz1149205-catch-syscall-after-fork-test.patch -Patch102: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch -Patch103: gdb-rhbz1350436-type-printers-error.patch -Patch104: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch -Patch105: gdb-bz1219747-attach-kills.patch -Patch106: gdb-fedora-libncursesw.patch -Patch107: gdb-opcodes-clflushopt-test.patch -Patch108: gdb-dts-rhel6-python-compat.patch -Patch109: gdb-6.6-buildid-locate-rpm-scl.patch -Patch110: gdb-readline62-ask-more-rh.patch -Patch111: gdb-6.8-quit-never-aborts.patch -Patch112: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch -Patch113: gdb-container-rh-pkg.patch -Patch114: gdb-rhbz1325795-framefilters-test.patch -Patch115: gdb-linux_perf-bundle.patch -Patch116: gdb-libexec-add-index.patch -Patch117: gdb-rhbz1398387-tab-crash-test.patch -Patch118: gdb-testsuite-readline63-sigint.patch -Patch119: gdb-archer.patch -Patch120: gdb-vla-intel-fix-print-char-array.patch -Patch121: gdb-rhbz1553104-s390x-arch12-test.patch -Patch122: gdb-rhbz881849-ipv6-1of3.patch -Patch123: gdb-rhbz881849-ipv6-2of3.patch -Patch124: gdb-rhbz881849-ipv6-3of3.patch -Patch125: gdb-rhbz1187581-power8-regs-1of7.patch -Patch126: gdb-rhbz1187581-power8-regs-2of7.patch -Patch127: gdb-rhbz1187581-power8-regs-3of7.patch -Patch128: gdb-rhbz1187581-power8-regs-4of7.patch -Patch129: gdb-rhbz1187581-power8-regs-5of7.patch -Patch130: gdb-rhbz1187581-power8-regs-6of7.patch -Patch131: gdb-rhbz1187581-power8-regs-7of7.patch -Patch132: gdb-rhbz1491128-batch-mode-exit-status-1of2.patch -Patch133: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch -Patch134: gdb-use-pulongest-aarch64-linux-tdep.patch - -Patch6000: gdb-Detect-invalid-length-field-in-debug-frame-FDE-header.patch +# patch from Fedora +Patch2: gdb-vla-intel-fortran-strides.patch +Patch3: gdb-vla-intel-fortran-vla-strings.patch +Patch4: gdb-vla-intel-stringbt-fix.patch +Patch5: gdb-6.3-gstack-20050411.patch +Patch6: gdb-6.3-test-pie-20050107.patch +Patch7: gdb-6.3-test-self-20050110.patch +Patch8: gdb-6.3-test-dtorfix-20050121.patch +Patch9: gdb-6.3-test-movedir-20050125.patch +Patch10: gdb-6.3-threaded-watchpoints2-20050225.patch +Patch11: gdb-6.3-inferior-notification-20050721.patch +Patch12: gdb-6.3-inheritancetest-20050726.patch +Patch13: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +Patch14: gdb-6.5-sharedlibrary-path.patch +Patch15: gdb-6.5-BEA-testsuite.patch +Patch16: gdb-6.5-last-address-space-byte-test.patch +Patch17: gdb-6.5-readline-long-line-crash-test.patch +Patch18: gdb-6.5-bz216711-clone-is-outermost.patch +Patch19: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +Patch20: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +Patch21: gdb-6.5-bz109921-DW_AT_decl_file-test.patch +Patch22: gdb-6.3-bz140532-ppc-unwinding-test.patch +Patch23: gdb-6.3-bz202689-exec-from-pthread-test.patch +Patch24: gdb-6.6-bz230000-power6-disassembly-test.patch +Patch25: gdb-6.6-bz229517-gcore-without-terminal.patch +Patch26: gdb-6.6-testsuite-timeouts.patch +Patch27: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +Patch28: gdb-6.6-scheduler_locking-step-is-default.patch +Patch29: gdb-6.3-attach-see-vdso-test.patch +Patch30: gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch31: gdb-6.6-buildid-locate.patch +Patch32: gdb-6.6-buildid-locate-solib-missing-ids.patch +Patch33: gdb-6.6-buildid-locate-rpm.patch +Patch34: gdb-6.7-charsign-test.patch +Patch35: gdb-6.7-ppc-clobbered-registers-O2-test.patch +Patch36: gdb-6.7-testsuite-stable-results.patch +Patch37: gdb-6.5-ia64-libunwind-leak-test.patch +Patch38: gdb-6.5-missed-trap-on-step-test.patch +Patch39: gdb-6.5-gcore-buffer-limit-test.patch +Patch40: gdb-6.3-mapping-zero-inode-test.patch +Patch41: gdb-6.3-focus-cmd-prev-test.patch +Patch42: gdb-6.8-bz442765-threaded-exec-test.patch +Patch43: gdb-6.5-section-num-fixup-test.patch +Patch44: gdb-6.8-bz436037-reg-no-longer-active.patch +Patch45: gdb-6.8-bz466901-backtrace-full-prelinked.patch +Patch46: gdb-simultaneous-step-resume-breakpoint-test.patch +Patch47: gdb-core-open-vdso-warning.patch +Patch49: gdb-bz533176-fortran-omp-step.patch +Patch50: gdb-follow-child-stale-parent.patch +Patch51: gdb-ccache-workaround.patch +Patch52: gdb-archer-pie-addons.patch +Patch53: gdb-archer-pie-addons-keep-disabled.patch +Patch54: gdb-lineno-makeup-test.patch +Patch55: gdb-ppc-power7-test.patch +Patch56: gdb-bz541866-rwatch-before-run.patch +Patch57: gdb-moribund-utrace-workaround.patch +Patch58: gdb-archer-next-over-throw-cxx-exec.patch +Patch59: gdb-bz601887-dwarf4-rh-test.patch +Patch60: gdb-6.6-buildid-locate-core-as-arg.patch +Patch61: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +Patch62: gdb-test-bt-cfi-without-die.patch +Patch63: gdb-bz568248-oom-is-error.patch +Patch64: gdb-bz634108-solib_address.patch +Patch65: gdb-test-pid0-core.patch +Patch66: gdb-test-dw2-aranges.patch +Patch67: gdb-test-expr-cumulative-archer.patch +Patch68: gdb-physname-pr11734-test.patch +Patch69: gdb-physname-pr12273-test.patch +Patch70: gdb-test-ivy-bridge.patch +Patch71: gdb-runtest-pie-override.patch +Patch72: gdb-attach-fail-reasons-5of5.patch +Patch73: gdb-glibc-strstr-workaround.patch +Patch74: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +Patch75: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +Patch76: gdb-rhbz795424-bitpos-20of25.patch +Patch77: gdb-rhbz795424-bitpos-21of25.patch +Patch78: gdb-rhbz795424-bitpos-22of25.patch +Patch79: gdb-rhbz795424-bitpos-23of25.patch +Patch80: gdb-rhbz795424-bitpos-25of25.patch +Patch81: gdb-rhbz795424-bitpos-25of25-test.patch +Patch82: gdb-rhbz795424-bitpos-lazyvalue.patch +Patch83: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +Patch84: gdb-gnat-dwarf-crash-3of3.patch +Patch85: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +Patch86: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch +Patch87: gdb-archer-vla-tests.patch +Patch88: gdb-vla-intel-tests.patch +Patch89: gdb-btrobust.patch +Patch90: gdb-fortran-frame-string.patch +Patch91: gdb-rhbz1156192-recursive-dlopen-test.patch +Patch92: gdb-jit-reader-multilib.patch +Patch93: gdb-rhbz1149205-catch-syscall-after-fork-test.patch +Patch94: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +Patch95: gdb-rhbz1350436-type-printers-error.patch +Patch96: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +Patch97: gdb-bz1219747-attach-kills.patch +Patch98: gdb-fedora-libncursesw.patch +Patch99: gdb-opcodes-clflushopt-test.patch +Patch100: gdb-dts-rhel6-python-compat.patch +Patch101: gdb-6.6-buildid-locate-rpm-scl.patch +Patch102: gdb-readline62-ask-more-rh.patch +Patch103: gdb-6.8-quit-never-aborts.patch +Patch104: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +Patch105: gdb-container-rh-pkg.patch +Patch106: gdb-rhbz1325795-framefilters-test.patch +Patch107: gdb-linux_perf-bundle.patch +Patch108: gdb-libexec-add-index.patch +Patch109: gdb-rhbz1398387-tab-crash-test.patch +Patch110: gdb-testsuite-readline63-sigint.patch +Patch111: gdb-archer.patch +Patch112: gdb-vla-intel-fix-print-char-array.patch +Patch113: gdb-rhbz1553104-s390x-arch12-test.patch +Patch114: gdb-rhbz795424-bitpos-arrayview.patch +Patch115: gdb-rhbz1371380-gcore-elf-headers.patch +Patch116: gdb-rhbz1708192-parse_macro_definition-crash.patch +Patch117: gdb-rhbz1704406-disable-style-log-output-1of3.patch +Patch118: gdb-rhbz1704406-disable-style-log-output-2of3.patch +Patch119: gdb-rhbz1704406-disable-style-log-output-3of3.patch +Patch120: gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch +Patch121: gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch +# Fedora patch end BuildRequires: rpm-libs BuildRequires: readline-devel >= 6.2-4 @@ -429,6 +414,9 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/backtrace.py %{_infodir}/gdb.info* %changelog +* Wed Jan 8 2020 openEuler Buildteam - 8.3.1-7 +- Upgrade GDB version to 8.3.1 + * Tue Dec 24 2019 yuxiangyang - 8.2-6 - Type:bugfix - ID:NA