Accepting request 927907 from home:tomdevries:branches:devel:gcc-gdb-gdb-11-1-update

- Maintenance scripts:
  * Add KFAILs in qa.sh.
  * Add missing '-a' in gdb.log greps in qa.sh.
- Disable big endian powerpc.
- Maintenance scripts:
  * Fix patch filtering in clean.sh.
  * Add KFAIL in qa.sh.
- Patches added:
  * gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch
  * gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch
  * gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch
  * gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch
  * gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch
  * gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch
  * gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch
  * gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch
  * gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch
  * gdb-tui-fix-breakpoint-display-functionality.patch
  * gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch
- Patches dropped:
  * fix-gdb.threads-linux-dp.exp.patch
- Added maintenance script:
  * qa.sh
- Drop 32bit packages for s390x.
- Fix SLE-15 s390x: unresolvable, nothing provides
  glibc-devel-static-32bit.
- Disable test-case gdb.base/break-interp.exp for SLE-11.
  It causes a
  "glibc detected *** expect: double free or corruption (out)" in
  expect and a subsequent runtest abort.  This might be the cause
  of the package build failure due to
  "Job seems to be stuck here, killed. (after 8hrs of inactivity)"
- Patches added:
  * gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch
  * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch
  * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch
  * fix-gdb.multi-multi-term-settings.exp-race.patch
  * gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch
- Rebase to 11.1 release (as in fedora 35 @ 9cd9368):
  * GDB now supports general memory tagging functionality if the
    underlying architecture supports the proper primitives and hooks.
    Currently this is enabled only for AArch64 MTE.
  * GDB will now look for the .gdbinit file in a config directory
    before looking for ~/.gdbinit.  The file is searched for in
    the following locations: $XDG_CONFIG_HOME/gdb/gdbinit,
    $HOME/.config/gdb/gdbinit, $HOME/.gdbinit.
  * GDB will now load and process commands from
    ~/.config/gdb/gdbearlyinit or ~/.gdbearlyinit if these files
    are present.  These files are processed earlier than any of
    the other initialization files and can affect parts of GDB's
    startup that previously had already been completed before the
    initialization files were read, for example styling of the
    initial GDB greeting.
  * GDB now has two new options "--early-init-command" and
    "--early-init-eval-command" with corresponding short options
    "-eix" and "-eiex" that allow options (that would normally
    appear in a gdbearlyinit file) to be passed on the command
    line.
  * set startup-quietly on|off
    show startup-quietly
    When 'on', this causes GDB to act as if "-silent" were passed
    on the command line.  This command needs to be added to an
    early initialization file (e.g. ~/.config/gdb/gdbearlyinit)
    in order to affect GDB.
  * For RISC-V targets, the target feature
    "org.gnu.gdb.riscv.vector" is now understood by GDB, and can
    be used to describe the vector registers of a target.
  * TUI windows now support mouse actions.  The mouse wheel
    scrolls the appropriate window.
  * Key combinations that do not have a specific action on the
    focused window are passed to GDB.  For example, you now can
    use Ctrl-Left/Ctrl-Right to move between words in the command
    window regardless of which window is in focus.  Previously
    you would need to focus on the command window for such key
    combinations to work.
  * set python ignore-environment on|off
    show python ignore-environment
      When 'on', this causes GDB's builtin Python to ignore any
      environment variables that would otherwise affect how Python
      behaves.  This command needs to be added to an early
      initialization file (e.g. ~/.config/gdb/gdbearlyinit) in
      order to affect GDB.
  * set python dont-write-bytecode auto|on|off
    show python dont-write-bytecode
      When 'on', this causes GDB's builtin Python to not write any
      byte-code (.pyc files) to disk.  This command needs to be
      added to an early initialization file
      (e.g. ~/.config/gdb/gdbearlyinit) in order to affect GDB.
      When 'off' byte-code will always be written.
      When set to 'auto' (the default) Python will check the
      PYTHONDONTWRITEBYTECODE environment variable.
  * break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]
        [-force-condition] [if CONDITION]
      This command would previously refuse setting a breakpoint if
      the CONDITION expression is invalid at a location.  It now
      accepts and defines the breakpoint if there is at least one
      location at which the CONDITION is valid.  The locations
      for which the CONDITION is invalid, are automatically
      disabled.  If CONDITION is invalid at all of the locations,
      setting the breakpoint is still rejected.  However, the
      '-force-condition' flag can be used in this case for forcing
      GDB to define the breakpoint, making all the current
      locations automatically disabled.  This may be useful if the
      user knows the condition will become meaningful at a future
      location, e.g. due to a shared library load.
- Update libipt to v2.0.4.  Dropped obsoleted patch:
  * v1.5-libipt-static.patch
- Obsoleted fedora patches dropped:
  * gdb-moribund-utrace-workaround.patch
  * gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch
  * gdb-vla-intel-fix-print-char-array.patch
  * gdb-vla-intel-fortran-strides.patch
  * gdb-vla-intel-fortran-vla-strings.patch
  * gdb-vla-intel-stringbt-fix.patch
  * gdb-vla-intel-tests.patch
- Obsoleted fedora fixup patches dropped:
  * fixup-2-gdb-archer-vla-tests.patch
  * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch
  * fixup-3-gdb-archer-vla-tests.patch
  * fixup-gdb-6.3-test-pie-20050107.patch
  * fixup-gdb-6.3-threaded-watchpoints2-20050225.patch
  * fixup-gdb-6.5-sharedlibrary-path.patch
  * fixup-gdb-6.8-bz442765-threaded-exec-test.patch
  * fixup-gdb-archer-vla-tests.patch
  * fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch
  * fixup-gdb-btrobust.patch
  * fixup-gdb-bz634108-solib_address.patch
  * fixup-gdb-dts-rhel6-python-compat.patch
  * fixup-gdb-gnat-dwarf-crash-3of3.patch
  * fixup-gdb-rhbz1156192-recursive-dlopen-test.patch
  * fixup-gdb-test-ivy-bridge.patch
  * fixup-gdb-vla-intel-fortran-vla-strings.patch
  * fixup-gdb-vla-intel-tests.patch
- Obsoleted patches dropped:
  * amd64-linux-siginfo-include-order.patch
  * gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch
  * gdb-support-dw-lle-start-end.patch
  * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch
  * gdb-symtab-fix-language-of-frame-without-debug-info.patch
  * gdb-symtab-read-cu-base-address-for-enqueued-cu.patch
  * gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch
  * gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch
  * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch
  * gdb-testsuite-disable-selftests-for-factory.patch
  * gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch
  * gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch
  * gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch
  * gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch
  * gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch
  * gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch
  * gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch
  * gdb-testsuite-gdb-base-morestack-exp-no-clang.patch
  * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch
  * gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch
  * gdb-testsuite-ignore-debuginfod_urls.patch
  * gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch
  * gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch
  * gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch
  * gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch
- Fedora patches updated:
  * gdb-6.3-bz140532-ppc-unwinding-test.patch
  * gdb-6.3-bz202689-exec-from-pthread-test.patch
  * gdb-6.3-gstack-20050411.patch
  * gdb-6.3-inheritancetest-20050726.patch
  * gdb-6.3-mapping-zero-inode-test.patch
  * gdb-6.3-test-dtorfix-20050121.patch
  * gdb-6.3-test-movedir-20050125.patch
  * gdb-6.3-threaded-watchpoints2-20050225.patch
  * gdb-6.5-bz109921-DW_AT_decl_file-test.patch
  * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
  * gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
  * gdb-6.5-bz243845-stale-testing-zombie-test.patch
  * gdb-6.5-ia64-libunwind-leak-test.patch
  * gdb-6.5-last-address-space-byte-test.patch
  * gdb-6.5-readline-long-line-crash-test.patch
  * gdb-6.5-section-num-fixup-test.patch
  * gdb-6.5-sharedlibrary-path.patch
  * gdb-6.6-buildid-locate-rpm-scl.patch
  * gdb-6.6-buildid-locate-rpm.patch
  * gdb-6.6-buildid-locate-solib-missing-ids.patch
  * gdb-6.6-buildid-locate.patch
  * gdb-6.6-bz229517-gcore-without-terminal.patch
  * gdb-6.6-bz230000-power6-disassembly-test.patch
  * gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
  * gdb-6.8-bz442765-threaded-exec-test.patch
  * gdb-bz601887-dwarf4-rh-test.patch
  * gdb-bz634108-solib_address.patch
  * gdb-ccache-workaround.patch
  * gdb-container-rh-pkg.patch
  * gdb-fedora-libncursesw.patch
  * gdb-fortran-frame-string.patch
  * gdb-glibc-strstr-workaround.patch
  * gdb-lineno-makeup-test.patch
  * gdb-linux_perf-bundle.patch
  * gdb-physname-pr11734-test.patch
  * gdb-ppc-power7-test.patch
  * gdb-rhbz1156192-recursive-dlopen-test.patch
  * gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
  * gdb-rhbz1350436-type-printers-error.patch
  * gdb-rhbz1398387-tab-crash-test.patch
  * gdb-test-dw2-aranges.patch
  * gdb-test-ivy-bridge.patch
  * gdb-test-pid0-core.patch
- Patches updated:
  * gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch
  * gdb-gcore-bash.patch
- Fedora patches added:
  * gdb-6.3-attach-see-vdso-test.patch
  * gdb-6.3-inferior-notification-20050721.patch
  * gdb-6.5-gcore-buffer-limit-test.patch
  * gdb-6.5-missed-trap-on-step-test.patch
  * gdb-rhbz1976887-field-location-kind.patch
  * gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
  * gdb-test-for-rhbz1976887.patch
- Fedora fixup patches added:
  * fixup-2-gdb-6.6-buildid-locate.patch
  * fixup-gdb-glibc-strstr-workaround.patch
  * fixup-gdb-linux_perf-bundle.patch
  * fixup-gdb-rhbz1325795-framefilters-test.patch
  * fixup-gdb-rhbz1553104-s390x-arch12-test.patch
- Patches added:
  * fix-gdb.mi-new-ui-mi-sync.exp.patch
  * fix-gdb.threads-linux-dp.exp.patch
  * gdb-add-index.sh-fix-bashism.patch
  * gdb-build-add-cxx_dialect-to-cxx.patch
  * gdb-build-make-c-exp.y-work-with-bison-3.8.patch
  * gdb-python-finishbreakpoint-update.patch
  * gdb-symtab-add-call_site_eq-and-call_site_hash.patch
  * gdb-symtab-c-ify-call_site.patch
  * gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch
  * gdb-symtab-remove-compunit_call_site_htab.patch
  * gdb-symtab-use-unrelocated-addresses-in-call_site.patch
  * gdb-testsuite-add-nopie-in-two-test-cases.patch
  * gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch
  * gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch
  * gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch
  * gdb-testsuite-fix-gdb.gdb-selftest.exp.patch
  * gdb-testsuite-fix-gdb.python-py-events.exp.patch
  * gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch
  * gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch
  * gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch
  * gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch
  * gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch
  * gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch
  * gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch
- Fedora patches replaced:
  * fixup-gdb-6.6-buildid-locate.patch
- Added maintenance scripts:
  * import-patches.sh
  * clean.sh

OBS-URL: https://build.opensuse.org/request/show/927907
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=289
This commit is contained in:
Michael Matz 2021-10-28 13:16:07 +00:00 committed by Git OBS Bridge
parent 62d7a6a514
commit 4ee4cc5016
182 changed files with 6784 additions and 15971 deletions

View File

@ -1,59 +0,0 @@
From 8488c357ce4fc309d49c7b0224cf9574b68e8116 Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Thu, 18 Feb 2021 22:46:58 -0700
Subject: [PATCH] amd64-linux-siginfo.c: Adjust include order to avoid gnulib
error
On Fedora rawhide, after updating to glibc-2.33, I'm seeing the
following build failure:
CXX nat/amd64-linux-siginfo.o
In file included from /usr/include/bits/sigstksz.h:24,
from /usr/include/signal.h:315,
from ../gnulib/import/signal.h:52,
from /ironwood1/sourceware-git/rawhide-gnulib/bld/../../worktree-gnulib/gdbserver/../gdb/nat/amd64-linux-siginfo.c:20:
../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
663 | #error "Please include config.h first."
| ^~~~~
glibc-2.33 has changed signal.h to now include <bits/sigstksz.h> which,
in turn, includes <unistd.h>. For a gdb build, this causes the gnulib
version of unistd.h to be pulled in first. The build failure shown
above happens because gnulib's config.h has not been included before
the include of <signal.h>.
The fix is simple - we just rearrange the order of the header file
includes to make sure that gdbsupport/commondefs.h is included before
attempting to include signal.h. Note that gdbsupport/commondefs.h
includes <gnulib/config.h>.
Build and regression tested on Fedora 33. On Fedora rawhide, GDB
builds again.
gdb/ChangeLog:
* nat/amd64-linux-siginfo.c: Include "gdbsupport/common-defs.h"
(which in turn includes <gnulib/config.h>) before include
of <signal.h>.
---
gdb/ChangeLog | 6 ++++++
gdb/nat/amd64-linux-siginfo.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 0c932814ec8..e2d2db6e112 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -17,8 +17,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <signal.h>
#include "gdbsupport/common-defs.h"
+#include <signal.h>
#include "amd64-linux-siginfo.h"
#define GDB_SI_SIZE 128
--
2.32.0

46
clean.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/sh
dryrun=false
while [ $# -gt 0 ]; do
case $1 in
-dryrun|--dryrun|-dry-run|--dry-run)
dryrun=true
;;
*)
echo "Don't know how to handle arg: $1"
exit 1
esac
shift
done
first=true
for f in *.patch; do
if grep -q "^Patch.*[ \t]$f" gdb.spec; then
continue
fi
if $dryrun; then
if $first; then
echo "Patches not mentioned in gdb.spec:"
fi
first=false
echo "$f"
continue
fi
( set -x; osc remove -f "$f" )
done
files=$(echo ./*~)
if [ "$files" != "./*~" ]; then
if $dryrun; then
echo "Backup files:"
echo "$files"
else
for f in $files; do
( set -x; rm -f "$f" )
done
fi
fi

View File

@ -0,0 +1,23 @@
Fix gdb.mi/new-ui-mi-sync.exp
---
gdb/testsuite/gdb.mi/new-ui-mi-sync.exp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
index 887bd60abcd..18072d4e668 100644
--- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
+++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
@@ -83,7 +83,11 @@ proc do_test {sync_command} {
# in the separate MI UI. Note the "run" variant usually triggers
# =thread-group-started/=thread-created/=library-loaded as well.
with_spawn_id $gdb_main_spawn_id {
- gdb_test "add-inferior" "Added inferior 2 on connection .*"
+ gdb_test_multiple "add-inferior" "" {
+ -re "\r\nAdded inferior 2 on connection .*\[\r\n\]+$gdb_prompt " {
+ pass $gdb_test_name
+ }
+ }
}
# Interrupt the program.

View File

@ -0,0 +1,182 @@
Fix gdb.multi/multi-term-settings.exp race
The gdb.multi/multi-term-settings.exp testcase sometimes fails like so:
Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.multi/multi-term-settings.exp ...
FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT)
It's easier to reproduce if you stress the machine at the same time, like e.g.:
$ stress -c 24
Looking at gdb.log, we see:
(gdb) attach 60422
Attaching to program: build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings, process 60422
[New Thread 60422.60422]
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.31.so...
Reading symbols from /lib64/ld-linux-x86-64.so.2...
(No debugging symbols found in /lib64/ld-linux-x86-64.so.2)
0x00007f2fc2485334 in __GI___clock_nanosleep (clock_id=<optimized out>, clock_id@entry <mailto:clock_id@entry>=0, flags=flags@entry <mailto:flags@entry>=0, req=req@entry <mailto:req@entry>=0x7ffe23126940, rem=rem@entry <mailto:rem@entry>=0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
78 ../sysdeps/unix/sysv/linux/clock_nanosleep.c: No such file or directory.
(gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: inf2: attach
set schedule-multiple on
(gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: set schedule-multiple on
info inferiors
Num Description Connection Executable
1 process 60404 1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings
* 2 process 60422 1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings
(gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: info inferiors
pid=60422, count=46
pid=60422, count=47
pid=60422, count=48
pid=60422, count=49
pid=60422, count=50
pid=60422, count=51
pid=60422, count=52
pid=60422, count=53
pid=60422, count=54
pid=60422, count=55
pid=60422, count=56
pid=60422, count=57
pid=60422, count=58
pid=60422, count=59
pid=60422, count=60
pid=60422, count=61
pid=60422, count=62
pid=60422, count=63
pid=60422, count=64
pid=60422, count=65
pid=60422, count=66
pid=60422, count=67
pid=60422, count=68
pid=60422, count=69
pid=60404, count=54
pid=60404, count=55
pid=60404, count=56
pid=60404, count=57
pid=60404, count=58
PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: continue
Quit
(gdb) FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT)
If you look at the testcase's sources, you'll see that the intention
is to resumes the program with "continue", wait to see a few of those
"pid=..., count=..." lines, and then interrupt the program with
Ctrl-C. But somehow, that resulted in GDB printing "Quit", instead of
the Ctrl-C stopping the program with SIGINT.
Here's what is happening:
#1 - those "pid=..., count=..." lines we see above weren't actually
output by the inferior after it has been continued (see #1).
Note that "inf1_how" and "inf2_how" are "attach". What happened
is that those "pid=..., count=..." lines were output by the
inferiors _before_ they were attached to. We see them at that
point instead of earlier, because that's where the testcase
reads from the inferiors' spawn_ids.
#2 - The testcase mistakenly thinks those "pid=..., count=..." lines
happened after the continue was processed by GDB, meaning it has
waited enough, and so sends the Ctrl-C. GDB hasn't yet passed
the terminal to the inferior, so the Ctrl-C results in that
Quit.
The fix here is twofold:
#1 - flush inferior output right after attaching
#2 - consume the "Continuing" printed by "continue", indicating the
inferior has the terminal. This is the same as done throughout
the testsuite to handle this exact problem of sending Ctrl-C too
soon.
gdb/testsuite/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net <mailto:pedro@palves.net>>
* gdb.multi/multi-term-settings.exp (create_inferior): Flush
inferior output.
(coretest): Use $gdb_test_name. After issuing "continue", wait
for "Continuing".
Change-Id: Iba7671dfe1eee6b98d29cfdb05a1b9aa2f9defb9
---
gdb/testsuite/gdb.multi/multi-term-settings.exp | 40 +++++++++++++++++++++----
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.multi/multi-term-settings.exp b/gdb/testsuite/gdb.multi/multi-term-settings.exp
index 20ec03d94b3..dcc6f2ece0f 100644
--- a/gdb/testsuite/gdb.multi/multi-term-settings.exp
+++ b/gdb/testsuite/gdb.multi/multi-term-settings.exp
@@ -95,6 +95,22 @@ proc create_inferior {which_inf inf_how} {
if {[gdb_test "attach $testpid" \
"Attaching to program: .*, process $testpid.*(in|at).*" \
"attach"] == 0} {
+
+ # The program is now stopped, but if testing against
+ # gdbserver, then the inferior's output emmitted before it
+ # stopped isn't flushed unless we explicitly do so,
+ # because it is on a different spawn_id. Do it now, to
+ # avoid confusing tests further below.
+ gdb_test_multiple "" "flush inferior output" {
+ -timeout 1
+ -i $test_spawn_id -re "pid=" {
+ exp_continue
+ }
+ timeout {
+ pass $gdb_test_name
+ }
+ }
+
return $test_spawn_id
}
} else {
@@ -179,9 +195,9 @@ proc coretest {inf1_how inf2_how} {
uplevel 1 {
if {$count1 >= 3 && $count2 >= 3} {
if $expect_ttou {
- fail "$test (expected SIGTTOU)"
+ fail "$gdb_test_name (expected SIGTTOU)"
} else {
- pass $test
+ pass $gdb_test_name
}
} else {
exp_continue
@@ -195,8 +211,20 @@ proc coretest {inf1_how inf2_how} {
set count1 0
set count2 0
- set test "continue"
- gdb_test_multiple $test $test {
+ # We're going to interrupt with Ctrl-C. For this to work we must
+ # be sure to consume the "Continuing." message first, or GDB may
+ # still own the terminal. Also, note that in the attach case, we
+ # flushed inferior output right after attaching, so that we're
+ # sure that the "pid=" lines we see are emitted by the inferior
+ # after it is continued, instead of having been emitted before it
+ # was attached to.
+ gdb_test_multiple "continue" "continue, hand over terminal" {
+ -re "Continuing" {
+ pass $gdb_test_name
+ }
+ }
+
+ gdb_test_multiple "" "continue" {
-i $infs_spawn_ids -re "pid=$pid1, count=" {
incr count1
pass_or_exp_continue
@@ -207,9 +235,9 @@ proc coretest {inf1_how inf2_how} {
}
-i $gdb_spawn_id -re "received signal SIGTTOU.*$gdb_prompt " {
if $expect_ttou {
- pass "$test (expected SIGTTOU)"
+ pass "$gdb_test_name (expected SIGTTOU)"
} else {
- fail "$test (SIGTTOU)"
+ fail "$gdb_test_name (SIGTTOU)"
}
}
}

View File

@ -0,0 +1,20 @@
fixup-2-gdb-6.6-buildid-locate.patch
---
gdb/testsuite/lib/gdb.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index e2ce31cc553..2b94f79d132 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -131,7 +131,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nx" \
"-data-directory $BUILD_DATA_DIRECTORY" \
{-iex "set height 0"} \
- {-iex "set width 0"}]]
+ {-iex "set width 0"} \
+ {-iex "set build-id-verbose 0"}]]
}
# The variable gdb_prompt is a regexp which matches the gdb prompt.

View File

@ -1,41 +0,0 @@
fixup-2-gdb-archer-vla-tests
Fixup gdb-archer-vla-tests.patch
---
gdb/testsuite/gdb.opt/fortran-string.exp | 11 +++++++++--
gdb/testsuite/gdb.opt/fortran-string.f90 | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp
index 90a2bdf..5255424 100644
--- a/gdb/testsuite/gdb.opt/fortran-string.exp
+++ b/gdb/testsuite/gdb.opt/fortran-string.exp
@@ -34,6 +34,13 @@ if ![runto $srcfile:[gdb_get_line_number "s = s"]] then {
continue
}
-gdb_test "frame" ".*s='foo'.*"
-gdb_test "ptype s" "type = character\\*3"
+gdb_test "info args" ".*s = 'foo'.*"
+gdb_test_multiple "ptype s" "" {
+ -re -wrap "type = character \\(3\\)" {
+ pass $gdb_test_name
+ }
+ -re -wrap "type = character\\*3" {
+ pass $gdb_test_name
+ }
+}
gdb_test "p s" "\\$\[0-9\]* = 'foo'"
diff --git a/gdb/testsuite/gdb.opt/fortran-string.f90 b/gdb/testsuite/gdb.opt/fortran-string.f90
index e48d520..e3bb6ad 100644
--- a/gdb/testsuite/gdb.opt/fortran-string.f90
+++ b/gdb/testsuite/gdb.opt/fortran-string.f90
@@ -21,6 +21,7 @@
subroutine f(s)
character*(*) s
s = s
+ print *, s
end
program main

View File

@ -1,51 +0,0 @@
Fixup gdb-rhbz1156192-recursive-dlopen-test.patch
- Fix __malloc_check usage to fix "free: invalid pointer" error with
GLIBC_TUNABLES=glibc.malloc.check=3.
- Handle older libc, for which we run into glibc PR17702:
Inconsistency detected by ld.so: dl-open.c: 222: dl_open_worker: Assertion \
`_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT' failed!
---
gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c | 1 +
.../gdb.base/gdb-rhbz1156192-recursive-dlopen.exp | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
index 17b29904ef..7696666c16 100644
--- a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
@@ -94,6 +94,7 @@ custom_malloc_hook (size_t size, const void *caller)
/* Called recursively. */
result = malloc (size);
/* Restore new hooks. */
+ old_malloc_hook = __malloc_hook;
__malloc_hook = custom_malloc_hook;
return result;
}
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
index 6e4d3621a3..28e6e465ee 100644
--- a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
@@ -49,6 +49,21 @@ if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \
return -1
}
+set supported 0
+gdb_test_multiple "run" "initial trial run" {
+ -re -wrap "exited normally.*" {
+ set supported 1
+ pass $gdb_test_name
+ }
+ -re -wrap "exited with code.*" {
+ untested "failed at $gdb_test_name"
+ }
+}
+
+if { $supported == 0 } {
+ return -1
+}
+
proc do_test { has_libfoo has_libbar } {
global hex binfile_lib2 binfile_lib1 gdb_prompt
set libbar_match "[string_to_regexp $binfile_lib2]"

View File

@ -1,24 +0,0 @@
diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp
index ef404244028..70afbcc3bc9 100644
--- a/gdb/testsuite/gdb.cp/gdb9593.exp
+++ b/gdb/testsuite/gdb.cp/gdb9593.exp
@@ -141,9 +141,16 @@ gdb_test "step" \
".*function1 ().*" \
"step into finish, for until"
-gdb_test "until" \
- ".*function1 ().*" \
- "until with no argument 1"
+gdb_test_multiple "until" "until with no argument 1" {
+ -re -wrap ".*function1 ().*" {
+ pass $gdb_test_name
+ }
+ -re -wrap ".*$hex\t80\t \}" {
+ # PR gcc/97774 - "Incorrect line info for try/catch"
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97774
+ xfail $gdb_test_name
+ }
+}
set line [gdb_get_line_number "marker for until" $testfile.cc]

View File

@ -1,90 +0,0 @@
fixup-gdb-6.3-test-pie-20050107.patch
---
gdb/testsuite/gdb.pie/attach.exp | 4 ++--
gdb/testsuite/gdb.pie/break.exp | 2 +-
gdb/testsuite/gdb.pie/corefile.exp | 15 +++++++--------
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/gdb/testsuite/gdb.pie/attach.exp b/gdb/testsuite/gdb.pie/attach.exp
index 648c92608c3..2af242618de 100644
--- a/gdb/testsuite/gdb.pie/attach.exp
+++ b/gdb/testsuite/gdb.pie/attach.exp
@@ -148,13 +148,13 @@ proc do_attach_tests {} {
-re "Load new symbol table from.*y or n.*$" {
send_gdb "y\n"
gdb_expect {
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $"\
{pass "(re)set file, before attach1"}
-re "$gdb_prompt $" {fail "(re)set file, before attach1"}
timeout {fail "(timeout) (re)set file, before attach1"}
}
}
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $"\
{pass "set file, before attach1"}
-re "$gdb_prompt $" {fail "set file, before attach1"}
timeout {fail "(timeout) set file, before attach1"}
diff --git a/gdb/testsuite/gdb.pie/break.exp b/gdb/testsuite/gdb.pie/break.exp
index 97b87397c27..3e07d6a8b31 100644
--- a/gdb/testsuite/gdb.pie/break.exp
+++ b/gdb/testsuite/gdb.pie/break.exp
@@ -319,7 +319,7 @@ if ![runto_main] then { fail "break tests suppressed" }
send_gdb "catch\n"
gdb_expect {
- -re "Catch requires an event name.*$gdb_prompt $"\
+ -re "List of catch subcommands:.*$gdb_prompt $"\
{pass "catch requires an event name"}
-re "$gdb_prompt $"\
{fail "catch requires an event name"}
diff --git a/gdb/testsuite/gdb.pie/corefile.exp b/gdb/testsuite/gdb.pie/corefile.exp
index ca4b01be3eb..2194ccc926c 100644
--- a/gdb/testsuite/gdb.pie/corefile.exp
+++ b/gdb/testsuite/gdb.pie/corefile.exp
@@ -83,11 +83,10 @@ if { $found == 0 } {
}
}
-# Try to clean up after ourselves.
-remote_file build delete [file join $coredir coremmap.data]
-remote_exec build "rmdir $coredir"
-
if { $found == 0 } {
+ # Try to clean up after ourselves.
+ remote_file build delete [file join $coredir coremmap.data]
+ remote_exec build "rmdir $coredir"
warning "can't generate a core file - core tests suppressed - check ulimit -c"
return 0
}
@@ -110,13 +109,13 @@ if { $found == 0 } {
gdb_exit
if $verbose>1 then {
- send_user "Spawning $GDB -nw $GDBFLAGS -core=[standard_output_file corefile]\n"
+ send_user "Spawning $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS -core=[standard_output_file corefile]\n"
}
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
verbose "Timeout is now $timeout seconds" 2
-eval "spawn $GDB -nw $GDBFLAGS -core=[standard_output_file corefile]"
+eval "spawn $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS -core=[standard_output_file corefile]"
expect {
-re "Couldn't find .* registers in core file.*$gdb_prompt $" {
fail "args: -core=corefile (couldn't find regs)"
@@ -143,11 +142,11 @@ expect {
close;
if $verbose>1 then {
- send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=[standard_output_file corefile]\n"
+ send_user "Spawning $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=[standard_output_file corefile]\n"
}
-eval "spawn $GDB -nw $GDBFLAGS $binfile -core=[standard_output_file corefile]";
+eval "spawn $GDB -nw $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=[standard_output_file corefile]";
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: execfile -core=corefile"

View File

@ -1,22 +0,0 @@
Fixup
---
gdb/testsuite/gdb.threads/watchthreads-threaded.exp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
index e9cdd59771c..29c470292af 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
@@ -85,9 +85,9 @@ for {set i 0} {$i < 30} {incr i} {
{ set args_2 1; set test_flag 1 }
-re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
{ set args_3 1; set test_flag 1 }
- -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
{ set args_2 [expr $args_2+1]; set test_flag 1 }
- -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
{ set args_3 [expr $args_3+1]; set test_flag 1 }
}
# If we fail above, don't bother continuing loop

View File

@ -1,41 +0,0 @@
[gdb/testsuite] Fixup gdb.threads/tls-sepdebug.exp
On factory, due to --as-needed we end up with a tls-sepdebug-main without
dependency on tls-sepdebug-shared.so:
...
$ ldd tls-sepdebug-main
linux-vdso.so.1 (0x00007fffe7fcf000)
libc.so.6 => /lib64/libc.so.6 (0x00007f205f05f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f205f232000)
...
Fix this by actually using the variable var (defined in
tls-sepdebug-shared.so) in tls-sepdebug-main.
Likewise, we end up without a dependency on libpthread.so.0, which we need to
read tls vars. Add a call to pthread_testcancel, as in
gdb.threads/tls-var-main.c
---
gdb/testsuite/gdb.threads/tls-sepdebug-main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
index ea5d0174d6a..87803f6d27e 100644
--- a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
@@ -19,7 +19,13 @@
Please email any bugs, comments, and/or additions to this file to:
bug-gdb@prep.ai.mit.edu */
+#include <pthread.h>
+
+extern __thread int var;
+
int main()
{
- return 0;
+ /* Ensure we link against pthreads even with --as-needed. */
+ pthread_testcancel();
+ return var;
}

View File

@ -1,20 +1,23 @@
[gdb/testsuite] Fixup buildid-locate
fixup-gdb-6.6-buildid-locate.patch
---
gdb/testsuite/gdb.base/gdbinit-history.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
gdb/build-id.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index baa1b49153..1e9eabbb73 100644
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -181,7 +181,8 @@ proc test_empty_history_filename { } {
global env
global gdb_prompt
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 830098688d5..a1920ab5a09 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -1314,10 +1314,10 @@ find_separate_debug_file_by_buildid (struct objfile *objfile,
return std::string ();
}
- set common_history [list "set height 0" "set width 0"]
+ set common_history [list "set height 0" "set width 0" \
+ "set build-id-verbose 0"]
-extern void _initialize_build_id (void);
+void _initialize_build_id ();
set test_dir [standard_output_file history_test]
remote_exec host "mkdir -p $test_dir"
void
-_initialize_build_id (void)
+_initialize_build_id ()
{
add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
_("\

View File

@ -1,19 +0,0 @@
Fixup gdb-6.8-bz442765-threaded-exec-test.patch
---
gdb/testsuite/gdb.threads/threaded-exec.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
index 8c43162b36e..23f6339d8ff 100644
--- a/gdb/testsuite/gdb.threads/threaded-exec.exp
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
@@ -37,7 +37,7 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile_nothreads}
-gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0
+gdb_run_cmd [list ${binfile_nothreads} ${binfile_threads} 0]
gdb_test_multiple {} "Program exited" {
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {

View File

@ -1,26 +0,0 @@
Fixup gdb-archer-vla-tests.patch
---
gdb/testsuite/gdb.pascal/arrays.exp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp
index 22acdb86d87..6a176732599 100644
--- a/gdb/testsuite/gdb.pascal/arrays.exp
+++ b/gdb/testsuite/gdb.pascal/arrays.exp
@@ -89,11 +89,15 @@ gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
setup_xfail "*-*-*"
+} else {
+ setup_kfail "*-*-*" pascal/26106
}
gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
setup_xfail "*-*-*"
+} else {
+ setup_kfail "*-*-*" pascal/26855
}
gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"

View File

@ -1,29 +0,0 @@
Fixup gdb.base/gnu-ifunc-strstr-workaround.exp
---
gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
index 4aa710b914..889f8c6f58 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
@@ -43,6 +43,10 @@ gdb_test_multiple $test $test {
untested "$test (no DWARF)"
return 0
}
+ -re "type = <unknown return type> \\(\\)\r\n$gdb_prompt $" {
+ untested "$test (no DWARF)"
+ return 0
+ }
}
set addr ""
@@ -111,5 +115,5 @@ gdb_test_multiple "print strstr" $test {
}
}
-gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
-gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
+gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
+gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"}

View File

@ -1,28 +0,0 @@
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index 300a5be840d..68cb7d8d7e7 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -277,9 +277,20 @@ gdb_test_multiple "bt 1" $test {
# Now verify that we can see a quit.
gdb_test_no_output "python name_error = KeyboardInterrupt" \
"Change ErrorFilter to throw KeyboardInterrupt"
-gdb_test "bt 1" "Quit" "bt 1 with KeyboardInterrupt"
-
-
+set re1 [multi_line \
+ "Python Exception <class 'KeyboardInterrupt'> whoops: " \
+ "\\(More stack frames follow\.\.\.\\)"]
+set re2 [multi_line \
+ "Python Exception <type 'exceptions.KeyboardInterrupt'> whoops: " \
+ "\\(More stack frames follow\.\.\.\\)"]
+gdb_test_multiple "bt 1" "" {
+ -re -wrap $re1 {
+ pass $gdb_test_name
+ }
+ -re -wrap $re2 {
+ pass $gdb_test_name
+ }
+}
# Test with no debuginfo
# We cannot use prepare_for_testing as we have to set the safe-patch

View File

@ -1,16 +0,0 @@
Fixup gdb-bz634108-solib_address.patch
---
gdb/testsuite/gdb.python/rh634108-solib_address.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
index c0451cf09ed..99e6aaba831 100644
--- a/gdb/testsuite/gdb.python/rh634108-solib_address.exp
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
@@ -21,4 +21,4 @@ gdb_start
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
-gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists"
+gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists"

View File

@ -1,49 +0,0 @@
Fixup gdb-dts-rhel6-python-compat.patch
---
gdb/python/lib/gdb/command/backtrace.py | 12 +++++++++---
gdb/testsuite/gdb.base/help.exp | 4 +++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index eeea9093e8..5059b6518a 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -81,13 +81,19 @@ Use of the 'raw' qualifier avoids any filtering by loadable modules.
# FIXME: provide option to start at selected frame
# However, should still number as if starting from newest
newest_frame = gdb.newest_frame()
- iter = itertools.imap (FrameWrapper,
- FrameIterator (newest_frame))
+ if sys.version_info.major >= 3:
+ iter = map (FrameWrapper, FrameIterator (newest_frame))
+ else:
+ iter = itertools.imap (FrameWrapper,
+ FrameIterator (newest_frame))
if filter:
iter = gdb.backtrace.create_frame_filter (iter)
# Now wrap in an iterator that numbers the frames.
- iter = itertools.izip (itertools.count (0), iter)
+ if sys.version_info.major >= 3:
+ iter = zip (itertools.count (0), iter)
+ else:
+ iter = itertools.izip (itertools.count (0), iter)
# Reverse if the user wanted that.
if self.reverse.value:
diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
index 0b6893cf79..af5fb232ce 100644
--- a/gdb/testsuite/gdb.base/help.exp
+++ b/gdb/testsuite/gdb.base/help.exp
@@ -129,7 +129,9 @@ gdb_test "apropos apropos" "apropos -- Search for commands matching a REGEXP.*"
# Test apropos for commands having aliases.
gdb_test "apropos Print backtrace of all stack frames, or innermost COUNT frames\." \
- "backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames\."
+ [multi_line \
+ "backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames\." \
+ "new-backtrace -- Print backtrace of all stack frames, or innermost COUNT frames\."]
# Test help for commands having aliases.
gdb_test "help bt" "backtrace, where, bt\[\r\n\]+Print backtrace of all stack frames, or innermost COUNT frames\..*"

View File

@ -0,0 +1,19 @@
fixup-gdb-glibc-strstr-workaround.patch
---
gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
index 889f8c6f584..052bd84d420 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
@@ -68,7 +68,7 @@ gdb_test_multiple $test $test {
set addr $expect_out(1,string)
pass "$test (fixed glibc)"
}
- -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <(__GI_)?strstr>\r\n$gdb_prompt $" {
untested "$test (gnu-ifunc not in use by glibc)"
return 0
}

View File

@ -1,51 +0,0 @@
Fixup gdb-gnat-dwarf-crash-3of3.patch
---
gdb/testsuite/gdb.threads/attach-stopped.exp | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 7c06d849b14..097e8b2a683 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -63,10 +63,10 @@ proc corefunc { threadtype } {
set test "$threadtype: set file, before attach1 to stopped process"
gdb_test_multiple "file $binfile" "$test" {
-re "Load new symbol table from.*y or n. $" {
- gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*" \
"$test (re-read)"
}
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $" {
pass "$test"
}
}
@@ -93,15 +93,23 @@ proc corefunc { threadtype } {
sleep 2
if [catch {open /proc/${testpid}/status r} fileid] {
- set line2 "NOTFOUND"
+ set line "NOTFOUND"
} else {
- gets $fileid line1;
- gets $fileid line2;
+ while { 1 } {
+ if { [gets $fileid line] < 0 } {
+ set line "EOF"
+ break
+ }
+ if {[string match "State:*" $line]} {
+ break
+ }
+ }
close $fileid;
}
set test "$threadtype: attach1, exit leaves process stopped"
- if {[string match "*(stopped)*" $line2]} {
+ verbose -log "line: $line"
+ if {[string match "*(stopped)*" $line]} {
pass $test
} else {
fail $test

View File

@ -0,0 +1,24 @@
diff --git a/gdb/gdb.c b/gdb/gdb.c
index 82e9e6da210..b5e28445630 100644
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -20,19 +20,11 @@
#include "main.h"
#include "interps.h"
-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
-extern "C" void __libipt_init(void);
-#endif
-
int
main (int argc, char **argv)
{
struct captured_main_args args;
-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
- __libipt_init();
-#endif
-
memset (&args, 0, sizeof args);
args.argc = argc;
args.argv = argv;

View File

@ -1,18 +0,0 @@
Fixup gdb-rhbz1156192-recursive-dlopen-test.patch
---
gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
index 2c32676e504..6e4d3621a3e 100644
--- a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
@@ -101,6 +101,7 @@ proc test_stop_on_solib_events { } {
gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
gdb_run_cmd
+ gdb_test "" "Wait for first prompt"
foreach l $solib_event_order {
incr pass
with_test_prefix "pass #$pass" {

View File

@ -0,0 +1,19 @@
fixup-gdb-rhbz1325795-framefilters-test.patch
---
gdb/testsuite/gdb.python/py-framefilter-thread.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.python/py-framefilter-thread.exp b/gdb/testsuite/gdb.python/py-framefilter-thread.exp
index 71f97463372..156a4d7bbf3 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-thread.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-thread.exp
@@ -39,7 +39,7 @@ gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"]
gdb_continue_to_breakpoint "Backtrace end breakpoint"
# #2 0x00007ffff75f228d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M
-gdb_test "bt no-filters" " in (\\.?_*clone|thread_start) \[^\r\n\]*" "bt no-filters"
+gdb_test "bt no-filters" " in (\\.?_*clone3?|thread_start) \[^\r\n\]*" "bt no-filters"
# #2 0x00007ffff75f228d in 941595343737041 () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M
# vs.

View File

@ -0,0 +1,19 @@
fixup-gdb-rhbz1553104-s390x-arch12-test.patch
---
gdb/testsuite/gdb.arch/s390x-arch12.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
index 4e902ff960d..246c1e1c69a 100644
--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
@@ -20,7 +20,7 @@
set testfile "s390x-arch12"
set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
-set ofile "${srcdir}/${subdir}/${testfile}.o"
+set ofile [standard_output_file ${testfile}.o]
if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
untested "failed uudecode"

View File

@ -1,19 +0,0 @@
Fix gdb-test-ivy-bridge.patch
---
gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp
index d1b1f27db4..ee4b8d4162 100644
--- a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp
+++ b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp
@@ -20,7 +20,7 @@ if {![istarget "x86_64-*-*"]} then {
set testfile amd64-ivy-bridge
set test compilation
if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m64 -nostdlib"]] {
- fail $test
+ unsupported $test
return -1
}
pass $test

View File

@ -1,340 +0,0 @@
fixup gdb-vla-intel-fortran-vla-strings.patch
---
gdb/f-typeprint.c | 2 +-
gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp | 4 +--
gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 5 +++
gdb/testsuite/gdb.fortran/pointer-to-pointer.exp | 6 +++-
gdb/testsuite/gdb.fortran/pointers.exp | 42 ++++++++++++------------
gdb/testsuite/gdb.fortran/print_type.exp | 18 +++++-----
gdb/testsuite/gdb.fortran/vla-strings.exp | 12 +++----
gdb/testsuite/gdb.fortran/vla-value.exp | 8 ++---
8 files changed, 53 insertions(+), 44 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 9c746fa91c3..c33bd68fe0f 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -250,7 +250,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_REF:
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
arrayprint_recurse_level, false);
- fprintf_filtered (stream, ")");
+ fprintf_filtered (stream, " )");
break;
case TYPE_CODE_FUNC:
diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
index 2f6b17c6dc5..35a4fd78e19 100644
--- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
@@ -179,7 +179,7 @@ gdb_test "print foo.three_ptr'length" \
" = 3"
gdb_test "ptype foo.three_ptr" \
- " = access array \\(<>\\) of integer"
+ " = access array \\(1 \.\. 3\\) of integer"
# foo.three_ptr_tdef.all
@@ -289,7 +289,7 @@ gdb_test "print foo.five_ptr'length" \
" = 5"
gdb_test "ptype foo.five_ptr" \
- " = access array \\(<>\\) of integer"
+ " = access array \\(2 \.\. 6\\) of integer"
# foo.five_ptr_tdef.all
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
index edf2508537d..617c6a36292 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
@@ -54,6 +54,7 @@ proc run_tests { lang } {
if { $lang == "c" || $lang == "c++" } {
gdb_test "set language c" \
"Warning: the current language does not match this frame."
+ setup_kfail *-*-* bsc#1178580
} else {
gdb_test_no_output "set language $lang"
}
@@ -156,6 +157,10 @@ proc run_tests { lang } {
"g = ${g_pattern}" \
"_e = 6" ]
+ if { $lang == "c" || $lang == "c++" } {
+ setup_kfail *-*-* bsc#1178580
+ }
+
gdb_test "info args" $args_pattern \
"info args in frame #7"
}
diff --git a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
index 4c643c29903..c93300746de 100644
--- a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
+++ b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
@@ -43,7 +43,11 @@ set l_buffer_type [multi_line \
"Type l_buffer" \
" $real4 :: alpha\\(:\\)" \
"End Type l_buffer" ]
+set l_buffer_type_2 [multi_line \
+ "Type l_buffer" \
+ " $real4 :: alpha\\(5\\)" \
+ "End Type l_buffer" ]
-gdb_test "ptype buffer" "type = PTR TO -> \\( ${l_buffer_type} \\)"
+gdb_test "ptype buffer" "type = PTR TO -> \\( ${l_buffer_type_2} \\)"
gdb_test "ptype *buffer" "type = ${l_buffer_type}"
gdb_test "ptype buffer%alpha" "type = $real4 \\(5\\)"
diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp
index 916897005f2..ddcc1036765 100644
--- a/gdb/testsuite/gdb.fortran/pointers.exp
+++ b/gdb/testsuite/gdb.fortran/pointers.exp
@@ -35,28 +35,28 @@ set complex [fortran_complex4]
gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
gdb_continue_to_breakpoint "Before pointer assignment"
-gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) 0x0" "print logp, not associated"
+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) 0x0" "print logp, not associated"
gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated"
-gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) 0x0" "print comp, not associated"
+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) 0x0" "print comp, not associated"
gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated"
-gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) 0x0" "print charp, not associated"
+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) 0x0" "print charp, not associated"
gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated"
-gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) 0x0" "print charap, not associated"
+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) 0x0" "print charap, not associated"
gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated"
-gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" "print intp, not associated"
+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" "print intp, not associated"
gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated"
set test "print intap, not associated"
gdb_test_multiple "print intap" $test {
- -re " = \\(PTR TO -> \\( $int \\(:,:\\)\\)\\) <not associated>\r\n$gdb_prompt $" {
+ -re " = \\(PTR TO -> \\( $int \\(:,:\\) \\)\\) <not associated>\r\n$gdb_prompt $" {
pass $test
}
-re " = <not associated>\r\n$gdb_prompt $" {
pass $test
}
}
-gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) 0x0" "print realp, not associated"
+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated"
gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated"
-gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0"
+gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0"
set test "print cyclicp1, not associated"
gdb_test_multiple "print cyclicp1" $test {
-re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" {
@@ -68,10 +68,10 @@ gdb_test_multiple "print cyclicp1" $test {
}
set test "print cyclicp1%p, not associated"
gdb_test_multiple "print cyclicp1%p" $test {
- -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) 0x0\r\n$gdb_prompt $" {
+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" {
pass $test
}
- -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) <not associated>\r\n$gdb_prompt $" {
+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) <not associated>\r\n$gdb_prompt $" {
pass $test
}
}
@@ -84,15 +84,15 @@ gdb_test "print *(twop)%ivla2" "= <not allocated>"
gdb_breakpoint [gdb_get_line_number "After value assignment"]
gdb_continue_to_breakpoint "After value assignment"
-gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) $hex\( <.*>\)?"
+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) $hex\( <.*>\)?"
gdb_test "print *logp" "= \\.TRUE\\."
-gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) $hex\( <.*>\)?"
+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) $hex\( <.*>\)?"
gdb_test "print *comp" "= \\(1,2\\)"
-gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) $hex\( <.*>\)?"
+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) $hex\( <.*>\)?"
gdb_test "print *charp" "= 'a'"
-gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\( <.*>\)?"
+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\( <.*>\)?"
gdb_test "print *charap" "= 'abc'"
-gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) $hex\( <.*>\)?"
+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) $hex\( <.*>\)?"
gdb_test "print *intp" "= 10"
set test_name "print intap, associated"
gdb_test_multiple "print intap" $test_name {
@@ -114,16 +114,16 @@ gdb_test_multiple "print intvlap" $test_name {
pass $test_name
}
}
-gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) $hex\( <.*>\)?"
+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) $hex\( <.*>\)?"
gdb_test "print *realp" "= 3\\.14000\\d+"
-gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two\\)\\) $hex\( <.*>\)?"
+gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two \\)\\) $hex\( <.*>\)?"
gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)"
set test_name "print arrayOfPtr(3)%p"
gdb_test_multiple $test_name $test_name {
- -re "= \\(PTR TO -> \\( Type two\\)\\) <not associated>\r\n$gdb_prompt $" {
+ -re "= \\(PTR TO -> \\( Type two \\)\\) <not associated>\r\n$gdb_prompt $" {
pass $test_name
}
- -re "= \\(PTR TO -> \\( Type two\\)\\) 0x0\r\n$gdb_prompt $" {
+ -re "= \\(PTR TO -> \\( Type two \\)\\) 0x0\r\n$gdb_prompt $" {
pass $test_name
}
}
@@ -137,7 +137,7 @@ gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name {
}
}
gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)"
-gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer\\)\\) $hex\( <.*>\)?"
+gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?"
gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array"
gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla"
-gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\)\\)\\) $hex <pointers\\+\\d+>" "Print program counter"
+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\) \\)\\) $hex <pointers\\+\\d+>" "Print program counter"
diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp
index 5a4aa35d7cb..529a78e5b89 100755
--- a/gdb/testsuite/gdb.fortran/print_type.exp
+++ b/gdb/testsuite/gdb.fortran/print_type.exp
@@ -43,7 +43,7 @@ set complex [fortran_complex4]
# matches the string TYPE.
proc check_pointer_type { var_name type } {
gdb_test "ptype ${var_name}" \
- "type = PTR TO -> \\( ${type}\\)"
+ "type = PTR TO -> \\( ${type} \\)"
}
gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
@@ -88,7 +88,7 @@ gdb_test "ptype twop" \
[multi_line "type = PTR TO -> \\( Type two" \
" $int, allocatable :: ivla1\\(:\\)" \
" $int, allocatable :: ivla2\\(:,:\\)" \
- "End Type two\\)"]
+ "End Type two \\)"]
gdb_breakpoint [gdb_get_line_number "After value assignment"]
@@ -101,18 +101,18 @@ gdb_test "ptype intv" "type = $int"
gdb_test "ptype inta" "type = $int \\(10,2\\)"
gdb_test "ptype realv" "type = $real"
-gdb_test "ptype logp" "type = PTR TO -> \\( $logical\\)"
-gdb_test "ptype comp" "type = PTR TO -> \\( $complex\\)"
-gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1\\)"
-gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3\\)"
-gdb_test "ptype intp" "type = PTR TO -> \\( $int\\)"
+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)"
+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)"
+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)"
+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)"
+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)"
set test "ptype intap"
gdb_test_multiple $test $test {
-re "type = $int \\(10,2\\)\r\n$gdb_prompt $" {
pass $test
}
- -re "type = PTR TO -> \\( $int \\(10,2\\)\\)\r\n$gdb_prompt $" {
+ -re "type = PTR TO -> \\( $int \\(10,2\\) \\)\r\n$gdb_prompt $" {
pass $test
}
}
-gdb_test "ptype realp" "type = PTR TO -> \\( $real\\)"
+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp
index 5d0662823a0..484fdcb652a 100644
--- a/gdb/testsuite/gdb.fortran/vla-strings.exp
+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp
@@ -32,7 +32,7 @@ gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
gdb_continue_to_breakpoint "var_char-allocated-1"
set test "whatis var_char first time"
gdb_test_multiple "whatis var_char" $test {
- -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" {
+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" {
pass $test
}
-re "type = character\\*10\r\n$gdb_prompt $" {
@@ -41,7 +41,7 @@ gdb_test_multiple "whatis var_char" $test {
}
set test "ptype var_char first time"
gdb_test_multiple "ptype var_char" $test {
- -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" {
+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" {
pass $test
}
-re "type = character\\*10\r\n$gdb_prompt $" {
@@ -59,7 +59,7 @@ gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
gdb_continue_to_breakpoint "var_char-filled-1"
set test "print var_char, var_char-filled-1"
gdb_test_multiple "print var_char" $test {
- -re "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\r\n$gdb_prompt $" {
+ -re "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\r\n$gdb_prompt $" {
gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1"
pass $test
}
@@ -69,7 +69,7 @@ gdb_test_multiple "print var_char" $test {
}
set test "ptype var_char, var_char-filled-1"
gdb_test_multiple "ptype var_char" $test {
- -re "type = PTR TO -> \\( character\\*3\\)\r\n$gdb_prompt $" {
+ -re "type = PTR TO -> \\( character\\*3 \\)\r\n$gdb_prompt $" {
pass $test
}
-re "type = character\\*3\r\n$gdb_prompt $" {
@@ -84,7 +84,7 @@ gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
gdb_continue_to_breakpoint "var_char-filled-2"
set test "print var_char, var_char-filled-2"
gdb_test_multiple "print var_char" $test {
- -re "= \\(PTR TO -> \\( character\\*6\\)\\) $hex\r\n$gdb_prompt $" {
+ -re "= \\(PTR TO -> \\( character\\*6 \\)\\) $hex\r\n$gdb_prompt $" {
gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2"
pass $test
}
@@ -94,7 +94,7 @@ gdb_test_multiple "print var_char" $test {
}
set test "ptype var_char, var_char-filled-2"
gdb_test_multiple "ptype var_char" $test {
- -re "type = PTR TO -> \\( character\\*6\\)\r\n$gdb_prompt $" {
+ -re "type = PTR TO -> \\( character\\*6 \\)\r\n$gdb_prompt $" {
pass $test
}
-re "type = character\\*6\r\n$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
index 49f22e7904e..be0a2d47fdf 100644
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -37,7 +37,7 @@ gdb_breakpoint [gdb_get_line_number "vla1-init"]
gdb_continue_to_breakpoint "vla1-init"
gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
gdb_test "print &vla1" \
- " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\)\\\)\\\) $hex" \
+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\) \\\)\\\) $hex" \
"print non-allocated &vla1"
gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \
"print member in non-allocated vla1 (1)"
@@ -58,7 +58,7 @@ with_timeout_factor 15 {
"step over value assignment of vla1"
}
gdb_test "print &vla1" \
- " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\)\\\)\\\) $hex" \
+ " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\) \\\)\\\) $hex" \
"print allocated &vla1"
gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
@@ -78,7 +78,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \
# Try to access values in undefined pointer to VLA (dangling)
gdb_test "print pvla" " = <not associated>" "print undefined pvla"
gdb_test "print &pvla" \
- " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\) \\\)\\\) $hex" \
"print non-associated &pvla"
gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \
"print undefined pvla(1,3,8)"
@@ -87,7 +87,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated
gdb_breakpoint [gdb_get_line_number "pvla-associated"]
gdb_continue_to_breakpoint "pvla-associated"
gdb_test "print &pvla" \
- " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \
+ " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\) \\\)\\\) $hex" \
"print associated &pvla"
gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"

View File

@ -1,157 +0,0 @@
Fixup gdb-vla-intel-tests.patch
---
gdb/testsuite/gdb.fortran/ptr-indentation.exp | 2 +-
gdb/testsuite/gdb.fortran/ptype-on-functions.exp | 2 +-
gdb/testsuite/gdb.fortran/vla-ptr-info.exp | 2 +-
gdb/testsuite/gdb.fortran/vla-stringsold.exp | 36 ++++++++++++------------
gdb/testsuite/gdb.fortran/whatis_type.exp | 4 +--
5 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
index 5e459fdb62e..209809a2922 100644
--- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
@@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1"
gdb_test "ptype tinsta" \
[multi_line "type = Type tuserdef" \
" $int :: i" \
- " PTR TO -> \\( $real :: ptr\\)" \
+ " PTR TO -> \\( $real :: ptr \\)" \
"End Type tuserdef"]
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index 761432ea82e..93e984af243 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -42,7 +42,7 @@ gdb_test "ptype say_numbers" \
"type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)"
gdb_test "ptype fun_ptr" \
- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)"
+ "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)"
gdb_test "ptype say_string" \
"type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)"
diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
index ca8541bf92f..7ead9191b93 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
@@ -33,5 +33,5 @@ set real4 [fortran_real4]
# Check the status of a pointer to a dynamic array.
gdb_breakpoint [gdb_get_line_number "pvla-associated"]
gdb_continue_to_breakpoint "pvla-associated"
-gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\)\\)\\) ${hex}" \
+gdb_test "print &pvla" " = \\(PTR TO -> \\( $real4 \\(10,10,10\\) \\)\\) ${hex}" \
"print pvla pointer information"
diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
index 7d7876d71ab..c1bf7ef763a 100644
--- a/gdb/testsuite/gdb.fortran/vla-stringsold.exp
+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
@@ -31,11 +31,11 @@ if ![runto MAIN__] then {
gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
gdb_continue_to_breakpoint "var_char-allocated-1"
gdb_test "print var_char" \
- " = \\(PTR TO -> \\( character\\*10\\)\\) ${hex}" \
+ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \
"print var_char after allocated first time"
-gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10\\)" \
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \
"whatis var_char first time"
-gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10\\)" \
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \
"ptype var_char first time"
gdb_test "next" "\\d+.*var_char = 'foo'.*" \
"next to allocation status of var_char"
@@ -44,13 +44,13 @@ gdb_test "print l" " = .TRUE." "print allocation status first time"
gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
gdb_continue_to_breakpoint "var_char-filled-1"
gdb_test "print var_char" \
- " = \\(PTR TO -> \\( character\\*3\\)\\) ${hex}" \
+ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \
"print var_char after filled first time"
gdb_test "print *var_char" " = 'foo'" \
"print *var_char after filled first time"
-gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3\\)" \
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \
"whatis var_char after filled first time"
-gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3\\)" \
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \
"ptype var_char after filled first time"
gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
@@ -58,44 +58,44 @@ gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
gdb_continue_to_breakpoint "var_char-filled-2"
gdb_test "print var_char" \
- " = \\(PTR TO -> \\( character\\*6\\)\\) ${hex}" \
+ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \
"print var_char after allocated second time"
gdb_test "print *var_char" " = 'foobar'" \
"print *var_char after allocated second time"
-gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6\\)" \
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \
"whatis var_char second time"
-gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6\\)" \
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \
"ptype var_char second time"
gdb_breakpoint [gdb_get_line_number "var_char-empty"]
gdb_continue_to_breakpoint "var_char-empty"
gdb_test "print var_char" \
- " = \\(PTR TO -> \\( character\\*0\\)\\) ${hex}" \
+ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \
"print var_char after set empty"
gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
-gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0\\)" \
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \
"whatis var_char after set empty"
-gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0\\)" \
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \
"ptype var_char after set empty"
gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
gdb_continue_to_breakpoint "var_char-allocated-3"
gdb_test "print var_char" \
- " = \\(PTR TO -> \\( character\\*21\\)\\) ${hex}" \
+ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \
"print var_char after allocated third time"
-gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21\\)" \
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \
"whatis var_char after allocated third time"
-gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21\\)" \
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \
"ptype var_char after allocated third time"
gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
gdb_continue_to_breakpoint "var_char_p-associated"
gdb_test "print var_char_p" \
- " = \\(PTR TO -> \\( character\\*7\\)\\) ${hex}" \
+ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \
"print var_char_p after associated"
gdb_test "print *var_char_p" " = 'johndoe'" \
"print *var_char_ after associated"
-gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7\\)" \
+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
"whatis var_char_p after associated"
-gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7\\)" \
+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
"ptype var_char_p after associated"
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index e2a56a63410..4b0cbf9c28d 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2"
gdb_test "whatis t2v" "type = Type t2"
gdb_test "whatis t3" "type = Type t3"
gdb_test "whatis t3v" "type = Type t3"
-gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)"
+gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)"
gdb_test "ptype t1" \
[multi_line "type = Type t1" \
@@ -73,4 +73,4 @@ gdb_test "ptype t3p" \
[multi_line "type = PTR TO -> \\( Type t3" \
" $int :: t3_i" \
" Type t2 :: t2_n" \
- "End Type t3\\)"]
+ "End Type t3 \\)"]

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:707fcf55bb2ce2bb4afdfa3ec922063d7bf9fed5e91943be6f36e7cad8e98a88
size 31081288

3
gdb-11.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fe14d640ad78b741f6b2751612aa9e40f752daaf0b6459cd01a4133379413d6e
size 29356796

View File

@ -0,0 +1,120 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.c
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include <unistd.h>
+
+int main ()
+{
+ pause ();
+ return 1;
+}
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp
@@ -0,0 +1,77 @@
+# Copyright 2007
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+# This test only works on Linux
+if { ![istarget "*-*-linux-gnu*"] } {
+ return 0
+}
+
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile "attach-see-vdso"
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
+
+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
+#
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } {
+ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+# Start the program running and then wait for a bit, to be sure
+# that it can be attached to.
+
+set testpid [eval exec $binfile &]
+
+# Avoid some race:
+sleep 2
+
+# Start with clean gdb
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+# Never call: gdb_load ${binfile}
+# as the former problem would not reproduce otherwise.
+
+set test "attach"
+gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" {
+ pass "$test"
+ }
+}
+
+gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO"
+
+# Exit and detach the process.
+
+gdb_exit
+
+# Make sure we don't leave a process around to confuse
+# the next test run (and prevent the compile by keeping
+# the text file busy), in case the "set should_exit" didn't
+# work.
+
+remote_exec build "kill -9 ${testpid}"

View File

@ -81,7 +81,7 @@ new file mode 100644
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu

View File

@ -16,7 +16,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
@@ -1726,7 +1726,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
@ -25,7 +25,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 \
@@ -1775,7 +1775,25 @@ install-guile:
@@ -1802,7 +1802,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
@ -52,7 +52,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 \
@@ -1798,6 +1816,18 @@ uninstall: force $(CONFIG_UNINSTALL)
@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
fi
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do

View File

@ -0,0 +1,324 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jeff Johnston <jjohnstn@redhat.com>
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 <jjohnstn@redhat.com>
* gdb.base/attach-32.exp: New test for attaching in 32-bit
mode on 64-bit systems.
* gdb.base/attach-32.c: Ditto.
* gdb.base/attach-32b.c: Ditto.
2007-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set.
diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.c
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
+ is exited when & if the variable 'should_exit' is non-zero. (It
+ is initialized to zero in this program, so the loop will never
+ exit unless/until gdb sets the variable to non-zero.)
+ */
+#include <stdio.h>
+
+int should_exit = 0;
+
+int main ()
+{
+ int local_i = 0;
+
+ while (! should_exit)
+ {
+ local_i++;
+ }
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attach-32.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32.exp
@@ -0,0 +1,246 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */
+
+# On HP-UX 11.0, this test is causing a process running the program
+# "attach" to be left around spinning. Until we figure out why, I am
+# commenting out the test to avoid polluting tiamat (our 11.0 nightly
+# test machine) with these processes. RT
+#
+# Setting the magic bit in the target app should work. I added a
+# "kill", and also a test for the R3 register warning. JB
+if { ![istarget "x86_64*-*linux*"]
+ && ![istarget "powerpc64*-*linux*"]} {
+ return 0
+}
+
+# are we on a target board
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile "attach-32"
+set srcfile ${testfile}.c
+set srcfile2 ${testfile}b.c
+set binfile [standard_output_file ${testfile}]
+set binfile2 [standard_output_file ${testfile}b]
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
+
+#execute_anywhere "rm -f ${binfile} ${binfile2}"
+remote_exec build "rm -f ${binfile} ${binfile2}"
+# For debugging this test
+#
+#log_user 1
+
+# build the first test case
+#
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32"]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Build the in-system-call test
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable [list debug "additional_flags=-m32"]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+proc do_attach_tests {} {
+ global gdb_prompt
+ global binfile
+ global escapedbinfile
+ global srcfile
+ global testfile
+ global objdir
+ global subdir
+ global timeout
+ global testpid
+
+ # Verify that we can "see" the variable "should_exit" in the
+ # program, and that it is zero.
+
+ gdb_test "print should_exit" " = 0" "after attach-32, print should_exit"
+
+ # Verify that we can modify the variable "should_exit" in the
+ # program.
+
+ gdb_test "set should_exit=1" "" "after attach-32, set should_exit"
+
+ # Verify that the modification really happened.
+
+ send_gdb "tbreak 19\n"
+ gdb_expect {
+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" {
+ pass "after attach-32, set tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
+ fail "after attach-32, set tbreak postloop"
+ }
+ timeout {
+ fail "(timeout) after attach-32, set tbreak postloop"
+ }
+ }
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "main.*at.*$srcfile:19.*$gdb_prompt $" {
+ pass "after attach-32, reach tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
+ fail "after attach-32, reach tbreak postloop"
+ }
+ timeout {
+ fail "(timeout) after attach-32, reach tbreak postloop"
+ }
+ }
+
+ # Allow the test process to exit, to cleanup after ourselves.
+
+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach-32, exit"
+
+ # Make sure we don't leave a process around to confuse
+ # the next test run (and prevent the compile by keeping
+ # the text file busy), in case the "set should_exit" didn't
+ # work.
+
+ remote_exec build "kill -9 ${testpid}"
+
+ # Start the program running and then wait for a bit, to be sure
+ # that it can be attached to.
+
+ set testpid [eval exec $binfile &]
+ exec sleep 2
+ if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+ }
+
+ # Verify that we can attach to the process, and find its a.out
+ # when we're cd'd to some directory that doesn't contain the
+ # a.out. (We use the source path set by the "dir" command.)
+
+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
+ "set source path"
+
+ gdb_test "cd /tmp" "Working directory /tmp." \
+ "cd away from process working directory"
+
+ # Explicitly flush out any knowledge of the previous attachment.
+
+ set test "before attach-32-3, flush symbols"
+ gdb_test_multiple "symbol" "$test" {
+ -re "Discard symbol table from.*y or n. $" {
+ gdb_test "y" "No symbol file now." \
+ "$test"
+ }
+ -re "No symbol file now.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ gdb_test "exec" "No executable file now." \
+ "before attach-32-3, flush exec"
+
+ gdb_test "attach $testpid" \
+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \
+ "attach-32 when process' a.out not in cwd"
+
+ set test "after attach-32-3, exit"
+ gdb_test_multiple "kill" "$test" {
+ -re "Kill the program being debugged.*y or n. $" {
+ gdb_test "y" "" "$test"
+ }
+ }
+
+ # Another "don't leave a process around"
+ remote_exec build "kill -9 ${testpid}"
+}
+
+proc do_call_attach_tests {} {
+ global gdb_prompt
+ global binfile2
+ global testpid
+
+ # See if other registers are problems
+
+ set test "info other register"
+ gdb_test_multiple "i r r3" "$test" {
+ -re "warning: reading register.*$gdb_prompt $" {
+ fail "$test"
+ }
+ -re "r3.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ # Get rid of the process
+
+ gdb_test "p should_exit = 1"
+ gdb_test "c" {\[Inferior .* exited normally\]}
+
+ # Be paranoid
+
+ remote_exec build "kill -9 ${testpid}"
+}
+
+
+# Start with a fresh gdb
+
+gdb_exit
+set testpid [eval exec $binfile &]
+exec sleep 3
+if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_reinitialize_dir $srcdir/$subdir
+
+# This is a test of gdb's ability to attach to a running process.
+
+do_attach_tests
+
+# Test attaching when the target is inside a system call
+
+gdb_exit
+set testpid [eval exec $binfile2 &]
+exec sleep 3
+if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_reinitialize_dir $srcdir/$subdir
+do_call_attach_tests
+
+return 0
diff --git a/gdb/testsuite/gdb.base/attach-32b.c b/gdb/testsuite/gdb.base/attach-32b.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-32b.c
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
+ is exited when & if the variable 'should_exit' is non-zero. (It
+ is initialized to zero in this program, so the loop will never
+ exit unless/until gdb sets the variable to non-zero.)
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int should_exit = 0;
+
+int main ()
+{
+ int local_i = 0;
+
+ sleep( 10 ); /* System call causes register fetch to fail */
+ /* This is a known HPUX "feature" */
+ while (! should_exit)
+ {
+ local_i++;
+ }
+ return (0);
+}

View File

@ -17,7 +17,7 @@ diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/b146835.cc
@@ -0,0 +1,32 @@
@@ -0,0 +1,31 @@
+#include "b146835.h"
+#include <iostream>
+
@ -49,7 +49,6 @@ new file mode 100644
+ F f;
+ f.foo();
+}
+
diff --git a/gdb/testsuite/gdb.cp/b146835.exp b/gdb/testsuite/gdb.cp/b146835.exp
new file mode 100644
--- /dev/null

View File

@ -16,7 +16,7 @@ diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.c
@@ -0,0 +1,10 @@
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "move-dir.h"
@ -26,7 +26,6 @@ new file mode 100644
+ printf ("%s\n", hw);;
+ other();
+}
+
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
new file mode 100644
--- /dev/null
@ -93,11 +92,10 @@ diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/move-dir.h
@@ -0,0 +1,7 @@
@@ -0,0 +1,6 @@
+#include <stdlib.h>
+
+void other() {
+ const char* ostring = "other";
+ printf ("%s\n", ostring);;
+}
+

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Elena Zannoni <ezannoni@redhat.com>
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 <ezannoni@redhat.com>
* gdb.gdb/selftest.exp: Make sure that the debug directory is
set up properly.
* gdb.gdb/complaints.exp: Ditto.
* gdb.gdb/xfullpath.exp: Ditto.
* gdb.gdb/observer.exp: Ditto.
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -152,18 +152,18 @@ proc do_self_tests {function body} {
}
# Remove any old copy lying around.
- remote_file host delete $xgdb
+ #remote_file host delete $xgdb
gdb_start
- set file [remote_download host $GDB_FULLPATH $xgdb]
+ #set file [remote_download host $GDB_FULLPATH $xgdb]
- set result [selftest_setup $file $function]
+ set result [selftest_setup $GDB_FULLPATH $function]
if {$result == 0} then {
set result [uplevel $body]
}
gdb_exit
- catch "remote_file host delete $file"
+ #catch "remote_file host delete $file"
if {$result < 0} then {
warning "Couldn't test self"

View File

@ -54,7 +54,7 @@ diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/g
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
@@ -0,0 +1,66 @@
@@ -0,0 +1,65 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
@ -120,7 +120,6 @@ new file mode 100644
+
+ pthread_exit(NULL);
+}
+
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
new file mode 100644
--- /dev/null
@ -213,9 +212,9 @@ new file mode 100644
+ { set args_2 1; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
+ { set args_3 1; set test_flag 1 }
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ { set args_2 [expr $args_2+1]; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ { set args_3 [expr $args_3+1]; set test_flag 1 }
+ }
+ # If we fail above, don't bother continuing loop

View File

@ -44,17 +44,17 @@ 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
@@ -1210,6 +1210,10 @@ print_command_1 (const char *args, int voidprint)
@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
if (exp != nullptr && *exp)
{
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
+ function descriptors. */
+ if (target_has_execution && strcmp (exp, "errno") == 0)
+ if (target_has_execution () && strcmp (exp, "errno") == 0)
+ exp = "*(*(int *(*)(void)) __errno_location) ()";
expression_up expr = parse_expression (exp);
val = evaluate_expression (expr.get ());
}
/* VOIDPRINT is true to indicate that we do want to print a void
value, so invert it for parse_expression. */
expression_up expr = parse_expression (exp, nullptr, !voidprint);
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
new file mode 100644
--- /dev/null

View File

@ -45,7 +45,7 @@ diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
@@ -0,0 +1,54 @@
@@ -0,0 +1,59 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -62,6 +62,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}

View File

@ -1,27 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
@@ -3169,6 +3169,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
msymbol->linkage_name ()); */
;
/* fall through */
+ /* `msymbol' trampoline may be located before its .text symbol
+ but this text symbol may be the address we were looking for.
+ Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop.
+ Red Hat Bug 218379. */
+ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc));
+ /* fall through */
else
{
/* Detect an obvious case of infinite recursion. If this

View File

@ -10,7 +10,7 @@ diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.bas
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
@@ -0,0 +1,75 @@
@@ -0,0 +1,76 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -28,8 +28,9 @@ new file mode 100644
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# are we on a target board
+if [is_remote target] then {
+ return 0
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+# Start the program running and then wait for a bit, to be sure

View File

@ -0,0 +1,154 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
@@ -0,0 +1,37 @@
+/* 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 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <unistd.h>
+#include <stdlib.h>
+
+#define MEGS 64
+
+int main()
+{
+ void *mem;
+
+ mem = malloc (MEGS * 1024ULL * 1024ULL);
+
+ for (;;)
+ sleep (1);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
@@ -0,0 +1,99 @@
+# 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile gcore-excessive-memory
+set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh]
+set corefile [standard_output_file ${testfile}.core]
+set binfile [standard_output_file ${testfile}]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+set f [open "|getconf PAGESIZE" "r"]
+gets $f pagesize
+close $f
+
+set pid_of_bin [eval exec $binfile &]
+sleep 2
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
+
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
+gdb_test "up 99" "in main .*" "verify we can get to main"
+
+proc memory_v_pages_get {} {
+ global pid_of_gdb pagesize
+ set fd [open "/proc/$pid_of_gdb/statm"]
+ gets $fd line
+ close $fd
+ # number of pages of virtual memory
+ scan $line "%d" drs
+ return $drs
+}
+
+set pages_found [memory_v_pages_get]
+
+# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'.
+set mb_gcore_reserve 4
+verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve"
+set kb_found [expr $pages_found * $pagesize / 1024]
+set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024]
+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
+
+# Create the ulimit wrapper.
+set f [open $shfile "w"]
+puts $f "#! /bin/sh"
+puts $f "ulimit -v $kb_permit"
+puts $f "exec $GDB \"\$@\""
+close $f
+remote_exec host "chmod +x $shfile"
+
+gdb_exit
+set GDBold $GDB
+set GDB "$shfile"
+gdb_start
+set GDB $GDBold
+
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
+
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
+gdb_test "up 99" "in main .*" "verify we can get to main"
+
+verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file"
+
+verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+# Cleanup.
+exec kill -9 $pid_of_bin

View File

@ -44,7 +44,7 @@ diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unw
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unwind-leak.exp
@@ -0,0 +1,83 @@
@@ -0,0 +1,88 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -61,6 +61,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile unwind-leak
+set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh]

View File

@ -0,0 +1,95 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.c
@@ -0,0 +1,30 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+static int var;
+
+int main()
+{
+ var = 1;
+ var = 2;
+ var = 3;
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.exp b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
@@ -0,0 +1,44 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile watchpoint-during-step
+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}
+
+runto_main
+
+gdb_breakpoint [gdb_get_line_number "var = 2"]
+gdb_continue_to_breakpoint "Find the first var set"
+
+gdb_test "step" ".*var = 3;" "Step to the next var set"
+
+gdb_test "watch var" "atchpoint .*: var" "Set the watchpoint"
+
+# Here is the target point. Be careful to not have breakpoint set on the line
+# 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"

View File

@ -12,7 +12,7 @@ diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.ba
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp
@@ -0,0 +1,104 @@
@@ -0,0 +1,96 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -46,20 +46,12 @@ new file mode 100644
+
+global env
+
+save_vars { env(INPUTRC) env(GDBHISTFILE) env(HISTSIZE) TERM timeout } {
+save_vars { 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
+
+ # 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
+
+ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"

View File

@ -68,7 +68,7 @@ diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/datalib.exp
@@ -0,0 +1,51 @@
@@ -0,0 +1,56 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -85,6 +85,11 @@ new file mode 100644
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile datalib
+set srcfilemain ${testfile}-main.c
+set srcfilelib ${testfile}-lib.c

View File

@ -33,7 +33,7 @@ diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.t
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
@@ -0,0 +1,25 @@
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
@ -55,9 +55,15 @@ new file mode 100644
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <pthread.h>
+
+extern __thread int var;
+
+int main()
+{
+ return 0;
+ /* Ensure we link against pthreads even with --as-needed. */
+ pthread_testcancel();
+ return var;
+}
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
new file mode 100644
@ -90,7 +96,7 @@ diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.thre
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -0,0 +1,87 @@
@@ -0,0 +1,94 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -107,6 +113,13 @@ new file mode 100644
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This test uses gdb_exit and gdb_start, which are not supported
+# on non-extended-remote sessions.
+if {[use_gdb_stub]} {
+ untested "skipping test because of stub"
+ return 0
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}

View File

@ -1,196 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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. ]
On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote:
> Not an exhaustive list, but if we go down the path of converting "gdb
> corefile" to "gdb -c corefile", then we also need to think about "file
> corefile" being converted to "core corefile" [or "target core
> corefile", "core" is apparently deprecated in favor of "target core"]
> and "target exec corefile" -> "target core corefile". Presumably
> "file corefile" (and "target exec corefile") would discard the
> currently selected executable. But maybe not. Will that be confusing
> for users? I don't know.
While thinking about it overriding some GDB _commands_ was not my intention.
There is a general assumption if I have a shell COMMAND and some FILE I can do
$ COMMAND FILE
and COMMAND will appropriately load the FILE.
FSF GDB currently needs to specify also the executable file for core files
which already inhibits this intuitive expectation. OTOH with the build-id
locating patch which could allow such intuitive start notneeding the
executable file. Still it currently did not work due to the required "-c":
$ COMMAND -c COREFILE
Entering "file", "core-file" or "attach" commands is already explicit enough
so that it IMO should do what the command name says without any
autodetections. The second command line argument
(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
neither "attach" accepts a core file nor "core-file" accepts a PID.
The patch makes sense only with the build-id patchset so this is not submit
for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending
bfd_check_format_matches) as the patch below is its natural extension.
Sorry for the delay,
Jan
2010-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* exceptions.h (enum errors <IS_CORE_ERROR>): New.
* exec.c: Include exceptions.h.
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
* main.c (exec_or_core_file_attach): New.
(captured_main <optind < argc>): Set also corearg.
(captured_main <strcmp (execarg, symarg) == 0>): New variable func.
Call exec_or_core_file_attach if COREARG matches EXECARG. Call
symbol_file_add_main only if CORE_BFD remained NULL.
Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
2010-01-20 Doug Evans <dje@google.com>
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -18,6 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
+#include "exceptions.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
@@ -495,12 +497,27 @@ exec_file_attach (const char *filename, int from_tty)
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
+ int is_core;
+
+ /* If the user accidentally did "gdb core", print a useful
+ error message. Check it only after bfd_object has been checked as
+ a valid executable may get recognized for example also as
+ "trad-core". */
+ is_core = bfd_check_format (exec_bfd, bfd_core);
+
/* Make sure to close exec_bfd, or else "run" might try to use
it. */
exec_close ();
- error (_("\"%ps\": not in executable format: %s"),
- styled_string (file_name_style.style (), scratch_pathname),
- gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
+
+ if (is_core != 0)
+ throw_error (IS_CORE_ERROR,
+ _("\"%s\" is a core file.\n"
+ "Please specify an executable to debug."),
+ scratch_pathname);
+ else
+ error (_("\"%ps\": not in executable format: %s"),
+ styled_string (file_name_style.style (), scratch_pathname),
+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}
if (build_section_table (exec_bfd, &sections, &sections_end))
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -524,6 +524,34 @@ struct cmdarg
char *string;
};
+/* Call exec_file_attach. If it detected FILENAME is a core file call
+ core_file_command. Print the original exec_file_attach error only if
+ core_file_command failed to find a matching executable. */
+
+static void
+exec_or_core_file_attach (const char *filename, int from_tty)
+{
+ gdb_assert (exec_bfd == NULL);
+
+ try
+ {
+ exec_file_attach (filename, from_tty);
+ }
+ catch (gdb_exception_error &e)
+ {
+ if (e.error == IS_CORE_ERROR)
+ {
+ core_file_command ((char *) filename, from_tty);
+
+ /* Iff the core file found its executable suppress the error message
+ from exec_file_attach. */
+ if (exec_bfd != NULL)
+ return;
+ }
+ throw_exception (std::move (e));
+ }
+}
+
static void
captured_main_1 (struct captured_main_args *context)
{
@@ -959,6 +987,8 @@ captured_main_1 (struct captured_main_args *context)
{
symarg = argv[optind];
execarg = argv[optind];
+ if (optind + 1 == argc && corearg == NULL)
+ corearg = argv[optind];
optind++;
}
@@ -1114,12 +1144,25 @@ captured_main_1 (struct captured_main_args *context)
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{
+ catch_command_errors_const_ftype *func;
+
+ /* Call exec_or_core_file_attach only if the file was specified as
+ a command line argument (and not an a command line option). */
+ if (corearg != NULL && strcmp (corearg, execarg) == 0)
+ {
+ func = exec_or_core_file_attach;
+ corearg = NULL;
+ }
+ else
+ func = exec_file_attach;
+
/* 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! */
- 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. */
+ 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/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
--- a/gdbsupport/common-exceptions.h
+++ b/gdbsupport/common-exceptions.h
@@ -106,6 +106,9 @@ enum errors {
"_ERROR" is appended to the name. */
MAX_COMPLETIONS_REACHED_ERROR,
+ /* Attempt to load a core file as executable. */
+ IS_CORE_ERROR,
+
/* Add more errors here. */
NR_ERRORS
};

View File

@ -98,7 +98,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -3025,6 +3025,16 @@ read_gdb_index_from_buffer (const char *filename,
@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename,
"set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok)
{
@ -115,7 +115,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
static int warning_printed = 0;
if (!warning_printed)
{
@@ -3036,6 +3046,10 @@ to use the section anyway."),
@@ -2812,6 +2822,10 @@ to use the section anyway."),
warning_printed = 1;
}
return 0;

View File

@ -133,7 +133,7 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
@ -154,7 +154,7 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
@ -336,7 +336,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+ /* Already failed the initialization before? */
+ if (init_tried)
+ return 0;
+ return 0;
+ init_tried = 1;
+
+#ifdef DLOPEN_LIBRPM
@ -696,7 +696,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
@@ -247,6 +250,9 @@
@@ -246,6 +249,9 @@
/* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR
@ -709,7 +709,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
@@ -769,6 +769,11 @@ PKG_CONFIG
@@ -771,6 +771,11 @@ PKG_CONFIG
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
@ -721,7 +721,7 @@ diff --git a/gdb/configure b/gdb/configure
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
@@ -873,6 +878,7 @@ with_gdb_datadir
@@ -876,6 +881,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
@ -729,7 +729,7 @@ diff --git a/gdb/configure b/gdb/configure
enable_targets
enable_64_bit_bfd
enable_gdbmi
@@ -949,6 +955,8 @@ PKG_CONFIG_PATH
@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS
@ -738,7 +738,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC
YFLAGS
XMKMF'
@@ -1621,6 +1629,8 @@ Optional Packages:
@@ -1625,6 +1633,8 @@ Optional Packages:
do not restrict auto-loaded files locations
--with-debuginfod Enable debuginfo lookups with debuginfod
(auto/yes/no)
@ -747,7 +747,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
@@ -1702,6 +1712,8 @@ Some influential environment variables:
@@ -1705,6 +1715,8 @@ Some influential environment variables:
C compiler flags for DEBUGINFOD, overriding pkg-config
DEBUGINFOD_LIBS
linker flags for DEBUGINFOD, overriding pkg-config
@ -756,7 +756,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'.
@@ -6666,6 +6678,494 @@ _ACEOF
@@ -6616,6 +6628,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
@ -1148,7 +1148,7 @@ diff --git a/gdb/configure b/gdb/configure
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@ -1166,7 +1166,7 @@ diff --git a/gdb/configure b/gdb/configure
+
+ HAVE_LIBRPM=false
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+else
@ -1254,7 +1254,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
@@ -143,6 +143,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
@ -1457,7 +1457,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -42,6 +42,7 @@
@@ -41,6 +41,7 @@
#include "gdbsupport/gdb_select.h"
#include "gdbsupport/gdb-sigmask.h"
#include "async-event.h"
@ -1465,7 +1465,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
/* readline include files. */
#include "readline/readline.h"
@@ -364,6 +365,8 @@ display_gdb_prompt (const char *new_prompt)
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
@ -1489,11 +1489,11 @@ 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
@@ -560,6 +560,7 @@ extern void generic_load (const char *args, int from_tty);
@@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty);
/* 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);
+extern void debug_flush_missing (void);
#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
/* From dwarf2read.c */
/* From minidebug.c. */

View File

@ -14,7 +14,7 @@ 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
@@ -1340,14 +1340,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
}
{
@ -38,13 +38,14 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+ not do any build-id checking of the libraries. There may be missing
+ build-ids dumped in the core file and we would map all the libraries
+ to the only existing file loaded that time - the executable. */
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ if (current_program_space->symfile_object_file != NULL
+ && (current_program_space->symfile_object_file->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ build_id = build_id_addr_get (li->l_ld);
if (build_id != NULL)
{
char *name, *build_id_filename;
@@ -1362,23 +1375,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name);
}
else
@ -60,8 +61,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
- instead) if the on-disk files no longer match the
- running program version. */
-
- if (symfile_objfile != NULL
- && (symfile_objfile->flags
- if (current_program_space->symfile_object_file != NULL
- && (current_program_space->symfile_object_file->flags
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
- newobj->so_name[0] = 0;
- }

View File

@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate.patch
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -121,7 +121,7 @@ static inline char *
@@ -115,7 +115,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
@ -21,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -126,7 +126,7 @@ static inline char *
@@ -120,7 +120,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
@ -540,18 +540,18 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* 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. */
+
+ string_appendf (link, ".%u", seqno);
+ }
- /* We expect to be silent on the non-existing files. */
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget);
+ string_appendf (link, ".%u", seqno);
+ }
+ ret_link = link;
- if (debug_bfd == NULL)
- {
- if (separate_debug_file_debug)
- printf_unfiltered (_(" no, unable to open.\n"));
+ ret_link = link;
+
+ struct stat statbuf_trash;
+
+ /* `access' automatically dereferences LINK. */
@ -574,11 +574,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+ continue;
+ }
- return {};
+
+ /* We expect to be silent on the non-existing files. */
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
+
- return {};
+ if (debug_bfd == NULL)
+ {
+ if (separate_debug_file_debug)
@ -890,7 +890,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ char *build_id_filename_cstr = NULL;
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
- build_id->data));
+ build_id->data,
+ build_id->data,
+ (!build_id_filename_return ? NULL : &build_id_filename_cstr)));
+ if (build_id_filename_return)
+ {
@ -906,7 +906,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 ()),
@@ -223,3 +897,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string ();
}
@ -926,7 +926,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ show_build_id_verbose,
+ &setlist, &showlist);
+
+ gdb::observers::executable_changed.attach (debug_print_executable_changed);
+ gdb::observers::executable_changed.attach (debug_print_executable_changed,
+ "build-id");
+}
diff --git a/gdb/build-id.h b/gdb/build-id.h
--- a/gdb/build-id.h
@ -950,7 +951,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len,
- const bfd_byte *build_id);
+ const bfd_byte *build_id,
+ char **link_return);
+ char **link_return = NULL);
+
+extern char *build_id_to_filename (const struct bfd_build_id *build_id,
+ char **link_return);
@ -978,9 +979,9 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
diff --git a/gdb/coffread.c b/gdb/coffread.c
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -709,7 +709,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -710,7 +710,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))
if (!objfile->has_partial_symbols ())
{
- std::string debugfile = find_separate_debug_file_by_buildid (objfile);
+ std::string debugfile = find_separate_debug_file_by_buildid (objfile,
@ -1002,7 +1003,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
#include "inferior.h"
#include "infrun.h"
#include "symtab.h"
@@ -362,6 +366,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
@@ -356,6 +360,8 @@ add_to_thread_list (asection *asect, asection *reg_sect)
switch_to_thread (thr); /* Yes, make it current. */
}
@ -1011,7 +1012,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
@@ -398,19 +404,25 @@ core_file_command (const char *filename, int from_tty)
@@ -392,19 +398,26 @@ core_file_command (const char *filename, int from_tty)
static void
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
{
@ -1031,16 +1032,17 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
symbol_file_add_main (bfd_get_filename (execbfd.get ()),
symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
+ if (symfile_objfile != NULL)
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
+ if (current_program_space->symfile_object_file != NULL)
+ current_program_space->symfile_object_file->flags |=
+ OBJF_BUILD_ID_CORE_LOADED;
}
+ else
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
}
/* See gdbcore.h. */
@@ -1189,4 +1201,11 @@ _initialize_corelow ()
maintenance_print_core_file_backed_mappings,
@@ -1209,4 +1222,11 @@ _initialize_corelow ()
maintenance_print_core_file_backed_mappings,
_("Print core file's file-backed mappings."),
&maintenanceprintlist);
+
@ -1054,7 +1056,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
@@ -21074,6 +21074,27 @@ information files.
@@ -21415,6 +21415,27 @@ information files.
@end table
@ -1107,16 +1109,7 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2218,7 +2218,7 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd)
}
if (dwz_bfd == NULL)
- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL);
if (dwz_bfd == nullptr)
{
@@ -5980,7 +5980,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
@@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
{
@ -1125,7 +1118,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
if (build_id == nullptr)
return {};
@@ -5993,7 +5993,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
@@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{
@ -1137,7 +1130,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1298,7 +1298,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
&& objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL)
{
@ -1148,7 +1141,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1313,7 +1315,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
else
{
has_dwarf2 = false;
@ -1157,7 +1150,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (build_id != nullptr)
{
@@ -1338,6 +1340,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
has_dwarf2 = true;
}
}
@ -1171,16 +1164,16 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -264,7 +264,7 @@ validate_exec_file (int from_tty)
reopen_exec_file ();
@@ -237,7 +237,7 @@ validate_exec_file (int from_tty)
current_exec_file = get_exec_file (0);
- const bfd_build_id *exec_file_build_id = build_id_bfd_get (exec_bfd);
+ const bfd_build_id *exec_file_build_id = build_id_bfd_shdr_get (exec_bfd);
const bfd_build_id *exec_file_build_id
- = build_id_bfd_get (current_program_space->exec_bfd ());
+ = build_id_bfd_shdr_get (current_program_space->exec_bfd ());
if (exec_file_build_id != nullptr)
{
/* Prepend the target prefix, to force gdb_bfd_open to open the
@@ -277,7 +277,7 @@ validate_exec_file (int from_tty)
@@ -250,7 +250,7 @@ validate_exec_file (int from_tty)
if (abfd != nullptr)
{
const bfd_build_id *target_exec_file_build_id
@ -1192,7 +1185,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -714,6 +714,10 @@ struct objfile
@@ -812,6 +812,10 @@ struct objfile
bool skip_jit_symbol_lookup = false;
};
@ -1235,7 +1228,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);
@@ -1338,9 +1339,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue;
}
@ -1277,8 +1270,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+ instead) if the on-disk files no longer match the
+ running program version. */
+
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags
+ if (current_program_space->symfile_object_file != NULL
+ && (current_program_space->symfile_object_file->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ newobj->so_name[0] = 0;
+ }
@ -1293,7 +1286,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
diff --git a/gdb/source.c b/gdb/source.c
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1165,7 +1165,7 @@ open_source_file (struct symtab *s)
@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s)
srcpath += s->filename;
}
@ -1305,9 +1298,9 @@ diff --git a/gdb/source.c b/gdb/source.c
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -550,12 +550,18 @@ void expand_symtabs_matching
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname);
@@ -332,12 +332,18 @@ bool expand_symtabs_matching
void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
bool need_fullname);
+
/* Target-agnostic function to load the sections of an executable into memory.
@ -1321,9 +1314,9 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
+extern void debug_print_missing (const char *binary, const char *debug);
+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
+
/* From dwarf2read.c */
/* From minidebug.c. */
/* Names for a dwarf2 debugging section. The field NORMAL is the normal
extern gdb_bfd_ref_ptr find_separate_debug_file_in_section (struct objfile *);
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@ -1361,6 +1354,19 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi
+ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
+ pass $wholetest
+}
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -185,7 +185,8 @@ proc test_empty_history_filename { } {
global env
global gdb_prompt
- set common_history [list "set height 0" "set width 0"]
+ set common_history [list "set height 0" "set width 0" \
+ "set build-id-verbose 0"]
set test_dir [standard_output_file history_test]
remote_exec host "mkdir -p $test_dir"
diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
@ -1375,7 +1381,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
@@ -2011,6 +2011,17 @@ proc default_gdb_start { } {
@@ -2130,6 +2130,17 @@ proc default_gdb_start { } {
}
}
@ -1396,7 +1402,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -308,6 +308,16 @@ proc default_mi_gdb_start { args } {
@@ -322,6 +322,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}

View File

@ -175,7 +175,7 @@ diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.thr
+gdb_load ${binfile_nothreads}
-gdb_run_cmd
+gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0
+gdb_run_cmd [list ${binfile_nothreads} ${binfile_threads} 0]
gdb_test_multiple {} "Program exited" {
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {

View File

@ -1,78 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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.
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
should have been detached with SIGSTOP (as they are accidentally left running
on the debugger termination).
diff --git a/gdb/defs.h b/gdb/defs.h
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -177,6 +177,10 @@ extern void default_quit_handler (void);
/* Flag that function quit should call quit_force. */
extern volatile int sync_quit_force_run;
+#ifdef NEED_DETACH_SIGSTOP
+extern int quit_flag_cleanup;
+#endif
+
extern void quit (void);
/* Helper for the QUIT macro. */
diff --git a/gdb/extension.c b/gdb/extension.c
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -769,6 +769,11 @@ check_quit_flag (void)
{
int result = 0;
+#ifdef NEED_DETACH_SIGSTOP
+ if (quit_flag_cleanup)
+ return 0;
+#endif
+
for (const struct extension_language_defn *extlang : extension_languages)
{
if (extlang->ops != nullptr
diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1770,7 +1770,13 @@ quit_force (int *exit_arg, int from_tty)
else if (return_child_result)
exit_code = return_child_result_value;
+#ifndef NEED_DETACH_SIGSTOP
/* We want to handle any quit errors and exit regardless. */
+#else
+ /* We want to handle any quit errors and exit regardless but we should never
+ get user-interrupted to properly detach the inferior. */
+ quit_flag_cleanup = 1;
+#endif
/* Get out of tfind mode, and kill or detach all inferiors. */
try
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -103,6 +103,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
static bool debug_timestamp = false;
+#ifdef NEED_DETACH_SIGSTOP
+/* Nonzero means we are already processing the quitting cleanups and we should
+ no longer get aborted. */
+
+int quit_flag_cleanup;
+#endif
+
/* True means that strings with character values >0x7F should be printed
as octal escapes. False means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */

View File

@ -0,0 +1,21 @@
[gdb-add-index.sh] Fix bashism
---
gdb/contrib/gdb-add-index.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index 734110caa3b..00d3ae8b0ae 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -38,7 +38,9 @@ fi
file="$1"
if test -L "$file"; then
- if ! command -v readlink >/dev/null 2>&1; then
+ target=$(readlink "$file")
+ st=$?
+ if [ $st -eq 127 ]; then
echo "$myname: 'readlink' missing. Failed to follow symlink $1." 1>&2
exit 1
fi

View File

@ -1,89 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
@@ -15431,6 +15431,50 @@ static struct cmd_list_element *enablebreaklist = NULL;
cmd_list_element *commands_cmd_element = nullptr;
+void
+breakpoints_relocate (struct objfile *objfile, section_offsets &delta)
+{
+ struct bp_location *bl, **blp_tmp;
+ int changed = 0;
+
+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
+
+ ALL_BP_LOCATIONS (bl, blp_tmp)
+ {
+ struct obj_section *osect;
+
+ /* BL->SECTION can be correctly NULL for breakpoints with multiple
+ locations expanded through symtab. */
+
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
+ {
+ CORE_ADDR relocated_address;
+ CORE_ADDR delta_offset;
+
+ delta_offset = delta[osect->the_bfd_section->index];
+ if (delta_offset == 0)
+ continue;
+ relocated_address = bl->address + delta_offset;
+
+ if (obj_section_addr (osect) <= relocated_address
+ && relocated_address < obj_section_endaddr (osect))
+ {
+ if (bl->inserted)
+ remove_breakpoint (bl);
+
+ bl->address += delta_offset;
+ bl->requested_address += delta_offset;
+
+ changed = 1;
+ }
+ }
+ }
+
+ if (changed)
+ std::sort (bp_locations, bp_locations + bp_locations_count,
+ bp_location_is_less_than);
+}
+
void _initialize_breakpoint ();
void
_initialize_breakpoint ()
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1691,6 +1691,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);
+extern void breakpoints_relocate (struct objfile *objfile,
+ section_offsets &delta);
+
/* Print the specified breakpoint. */
extern void print_breakpoint (breakpoint *bp);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -742,6 +742,11 @@ objfile_relocate1 (struct objfile *objfile,
obj_section_addr (s));
}
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
+ their addresses match. */
+ if (objfile->separate_debug_objfile_backlink == NULL)
+ breakpoints_relocate (objfile, delta);
+
/* Data changed. */
return 1;
}

View File

@ -1,39 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
@@ -649,6 +649,7 @@ enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /**< bitpos */
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
FIELD_LOC_KIND_PHYSNAME, /**< physname */
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
@@ -699,6 +700,7 @@ union field_location
field. Otherwise, physname is the mangled label of the
static field. */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
CORE_ADDR physaddr;
const char *physname;
diff --git a/gdb/value.c b/gdb/value.c
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2850,7 +2850,8 @@ value_static_field (struct type *type, int fieldno)
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (type->field (fieldno).type (),
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
+ + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
break;
case FIELD_LOC_KIND_PHYSNAME:
{

File diff suppressed because it is too large Load Diff

View File

@ -1,187 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
GIT snapshot:
commit 718a1618b2f691a7f407213bb50f100ac59f91c3
tromey/python
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -80,6 +80,7 @@ PYTHON_FILE_LIST = \
gdb/unwinder.py \
gdb/xmethod.py \
gdb/command/__init__.py \
+ gdb/command/ignore_errors.py \
gdb/command/explore.py \
gdb/command/backtrace.py \
gdb/command/frame_filters.py \
@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \
gdb/function/as_string.py \
gdb/function/caller_is.py \
gdb/function/strfns.py \
+ gdb/function/in_scope.py \
gdb/printer/__init__.py \
gdb/printer/bound_registers.py
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
--- a/gdb/gdb-gdb.gdb.in
+++ b/gdb/gdb-gdb.gdb.in
@@ -1,5 +1,15 @@
echo Setting up the environment for debugging gdb.\n
+# Set up the Python library and "require" command.
+python
+from os.path import abspath
+gdb.datadir = abspath ('@srcdir@/python/lib')
+gdb.pythonlibdir = gdb.datadir
+gdb.__path__ = [gdb.datadir + '/gdb']
+sys.path.insert(0, gdb.datadir)
+end
+source @srcdir@/python/lib/gdb/__init__.py
+
if !$gdb_init_done
set variable $gdb_init_done = 1
diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/command/ignore_errors.py
@@ -0,0 +1,37 @@
+# Ignore errors in user commands.
+
+# Copyright (C) 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 <http://www.gnu.org/licenses/>.
+
+import gdb
+
+class IgnoreErrorsCommand (gdb.Command):
+ """Execute a single command, ignoring all errors.
+Only one-line commands are supported.
+This is primarily useful in scripts."""
+
+ def __init__ (self):
+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
+ gdb.COMMAND_OBSCURE,
+ # FIXME...
+ gdb.COMPLETE_COMMAND)
+
+ def invoke (self, arg, from_tty):
+ try:
+ gdb.execute (arg, from_tty)
+ except:
+ pass
+
+IgnoreErrorsCommand ()
diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/function/in_scope.py
@@ -0,0 +1,47 @@
+# In-scope function.
+
+# Copyright (C) 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 <http://www.gnu.org/licenses/>.
+
+import gdb
+
+class InScope (gdb.Function):
+ """Return True if all the given variables or macros are in scope.
+Takes one argument for each variable name to be checked."""
+
+ def __init__ (self):
+ super (InScope, self).__init__ ("in_scope")
+
+ def invoke (self, *vars):
+ if len (vars) == 0:
+ raise (TypeError, "in_scope takes at least one argument")
+
+ # gdb.Value isn't hashable so it can't be put in a map.
+ # Convert to string first.
+ wanted = set (map (lambda x: x.string (), vars))
+ found = set ()
+ block = gdb.selected_frame ().block ()
+ while block:
+ for sym in block:
+ if (sym.is_argument or sym.is_constant
+ or sym.is_function or sym.is_variable):
+ if sym.name in wanted:
+ found.add (sym.name)
+
+ block = block.superblock
+
+ return wanted == found
+
+InScope ()
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
@@ -95,6 +95,8 @@ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.r
gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
+gdb_test "python print ('result = %s' % (f0.block ()))" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
+
# Can read SP register.
gdb_test "python print ('result = %s' % (gdb.selected_frame ().read_register ('sp') == gdb.parse_and_eval ('\$sp')))" \
" = True" \
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
@@ -419,6 +419,15 @@ proc test_value_after_death {} {
"print value's type"
}
+# Regression test for a cast failure. The bug was that if we cast a
+# value to its own type, gdb could crash. This happened because we
+# could end up double-freeing a struct value.
+proc test_cast_regression {} {
+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test"
+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test"
+ gdb_test "python print(v)" "5" "print value for cast test"
+}
+
# 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.
@@ -606,6 +615,7 @@ test_value_in_inferior
test_value_from_buffer
test_inferior_function_call
test_value_after_death
+test_cast_regression
# Test either C or C++ values.

View File

@ -1,356 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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,
and here is the last bit for new SELinux 'deny_ptrace':
https://bugzilla.redhat.com/show_bug.cgi?id=786878
As even PTRACE_TRACEME fails in such case it needs to install hook for even
that event.
Thanks,
Jan
gdb/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include
selinux/selinux.h.
(linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings.
(linux_ptrace_create_warnings): New.
* common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check selinux/selinux.h and the selinux library.
* inf-ptrace.c (inf_ptrace_me): Check the ptrace result.
* linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap
to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings.
gdb/gdbserver/
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check selinux/selinux.h and the selinux library.
* linux-low.c (linux_traceme): New function.
(linux_create_inferior, linux_tracefork_child): Call it instead of
direct ptrace.
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -253,6 +253,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -388,6 +391,9 @@
/* Define to 1 if you have the `scm_new_smob' function. */
#undef HAVE_SCM_NEW_SMOB
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -16861,6 +16861,64 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
# except that the argument to --with-sysroot is optional.
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1900,6 +1900,10 @@ case $host_os in
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1103,7 +1103,16 @@ linux_nat_target::create_inferior (const char *exec_file,
/* Make sure we report all signals during startup. */
pass_signals ({});
- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
+ try
+ {
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ std::string result = linux_ptrace_create_warnings ();
+
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message->c_str ());
+ }
}
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -25,6 +25,10 @@
#include <sys/procfs.h>
#endif
+#ifdef HAVE_SELINUX_SELINUX_H
+# include <selinux/selinux.h>
+#endif /* HAVE_SELINUX_SELINUX_H */
+
/* Stores the ptrace options supported by the running kernel.
A value of -1 means we did not check for features yet. A value
of 0 means there are no supported features. */
@@ -50,6 +54,8 @@ linux_ptrace_attach_fail_reason (pid_t pid)
"terminated"),
(int) pid);
+ result += linux_ptrace_create_warnings ();
+
return result;
}
@@ -586,6 +592,25 @@ linux_ptrace_init_warnings (void)
linux_ptrace_test_ret_to_nx ();
}
+/* Print all possible reasons we could fail to create a traced process. */
+
+std::string
+linux_ptrace_create_warnings ()
+{
+ std::string result;
+
+#ifdef HAVE_LIBSELINUX
+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
+ forbidden. */
+ if (security_get_boolean_active ("deny_ptrace") == 1)
+ string_appendf (result,
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
+ "you can disable this process attach protection by: "
+ "(gdb) shell sudo setsebool deny_ptrace=0\n"));
+#endif /* HAVE_LIBSELINUX */
+ return result;
+}
+
/* Extract extended ptrace event from wait status. */
int
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -184,6 +184,7 @@ extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
extern void linux_ptrace_init_warnings (void);
+extern std::string linux_ptrace_create_warnings ();
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/gdbserver/config.in b/gdbserver/config.in
--- a/gdbserver/config.in
+++ b/gdbserver/config.in
@@ -143,6 +143,9 @@
/* Define if you have the ipt library. */
#undef HAVE_LIBIPT
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define if the target supports branch tracing. */
#undef HAVE_LINUX_BTRACE
@@ -249,6 +252,9 @@
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setns' function. */
#undef HAVE_SETNS
diff --git a/gdbserver/configure b/gdbserver/configure
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -10683,6 +10683,64 @@ if $want_ipa ; then
fi
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac
--- a/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -401,6 +401,10 @@ if $want_ipa ; then
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(srv_xmlbuiltin)
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -932,7 +932,16 @@ linux_ptrace_fun ()
{
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
(PTRACE_TYPE_ARG4) 0) < 0)
- trace_start_error_with_name ("ptrace");
+ {
+ int save_errno = errno;
+
+ std::string msg (linux_ptrace_create_warnings ());
+
+ msg += _("Cannot trace created process");
+
+ errno = save_errno;
+ trace_start_error_with_name (msg.c_str ());
+ }
if (setpgid (0, 0) < 0)
trace_start_error_with_name ("setpgid");

View File

@ -1,114 +0,0 @@
[gdb/breakpoint] Fix assert in jit_event_handler
Consider a minimal test-case test.c:
...
int main (void) { return 0; }
...
which we can compile into llvm byte code using clang:
...
$ clang -g -S -emit-llvm --target=x86_64-unknown-unknown-elf test.c
...
and then run using lli, which uses the llvm jit:
...
$ lli test.ll
...
If we run this under gdb, we run into an assert:
...
$ gdb -q -batch -ex run --args /usr/bin/lli test.ll
Dwarf Error: Cannot not find DIE at 0x18a936e7 \
[from module libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
src/gdb/jit.c:1178: internal-error: \
void jit_event_handler(gdbarch*, objfile*): \
Assertion `jiter->jiter_data != nullptr' failed.
...
This is caused by the following.
When running jit_breakpoint_re_set_internal, we first handle
libLLVM.so.10.debug, and set a jit breakpoint.
Next we handle libLLVM.so.10:
...
(gdb) p the_objfile.original_name
$42 = 0x2494170 "libLLVM.so.10"
...
but the minimal symbols we find are from libLLVM.so.10.debug:
...
(gdb) p reg_symbol.objfile.original_name
$43 = 0x38e7c50 "libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug"
(gdb) p desc_symbol.objfile.original_name
$44 = 0x38e7c50 "libLLVM.so.10-10.0.1-lp152.30.4.x86_64.debug"
...
and consequently, the objf_data is the one from libLLVM.so.10.debug:
...
jiter_objfile_data *objf_data
= get_jiter_objfile_data (reg_symbol.objfile);
...
and so we hit this:
...
if (objf_data->cached_code_address == addr)
continue;
...
and no second jit breakpoint is inserted.
Subsequently, the jit breakpoint is triggered and handled, but when finding
the symbol for the breakpoint address we get:
...
(gdb) p jit_bp_sym.objfile.original_name
$52 = 0x2494170 "libLLVM.so.10"
...
The assert 'jiter->jiter_data != nullptr' triggers because it checks
libLLVM.so.10 while the one with jiter_data setup is libLLVM.so.10.debug.
This fixes the assert:
...
jiter_objfile_data *objf_data
- = get_jiter_objfile_data (reg_symbol.objfile);
- = get_jiter_objfile_data (the_objfile);
...
but consequently we'll have two jit breakpoints, so we also make sure we don't
set a jit breakpoint on separate debug objects like libLLVM.so.10.debug.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-05-21 Tom de Vries <tdevries@suse.de>
PR breakpoint/27889
* jit.c (jit_breakpoint_re_set_internal): Skip separate debug
objects. Call get_jiter_objfile_data with the_objfile.
---
gdb/jit.c | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/gdb/jit.c b/gdb/jit.c
index 296b436c796..be10f197fd6 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -807,6 +807,10 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
{
for (objfile *the_objfile : pspace->objfiles ())
{
+ /* Skip separate debug objects. */
+ if (the_objfile->separate_debug_objfile_backlink != nullptr)
+ continue;
+
if (the_objfile->skip_jit_symbol_lookup)
continue;
@@ -833,7 +837,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
}
jiter_objfile_data *objf_data
- = get_jiter_objfile_data (reg_symbol.objfile);
+ = get_jiter_objfile_data (the_objfile);
objf_data->register_code = reg_symbol.minsym;
objf_data->descriptor = desc_symbol.minsym;

View File

@ -1,53 +0,0 @@
[gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint
The test-case nextoverthrow.exp is failing on targets with unstripped libc.
This is a regression since commit 1940319c0ef "[gdb] Fix internal-error in
process_event_stop_test".
The problem is that this code in create_exception_master_breakpoint:
...
for (objfile *sepdebug = obj->separate_debug_objfile;
sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile)
if (create_exception_master_breakpoint_hook (sepdebug))
...
iterates over all the separate debug object files, but fails to handle the
case that obj itself has the debug info we're looking for.
Fix this by using the separate_debug_objfiles () range instead, which does
iterate both over obj and the obj->separate_debug_objfile chain.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-02-05 Tom de Vries <tdevries@suse.de>
PR breakpoints/27330
* breakpoint.c (create_exception_master_breakpoint): Handle case that
glibc object file has debug info.
---
gdb/breakpoint.c | 9 ++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 7ead1529ad1..a94bb2e3540 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3474,11 +3474,10 @@ create_exception_master_breakpoint (void)
if (create_exception_master_breakpoint_probe (obj))
continue;
- /* Iterate over separate debug objects and try an _Unwind_DebugHook
- kind breakpoint. */
- for (objfile *sepdebug = obj->separate_debug_objfile;
- sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile)
- if (create_exception_master_breakpoint_hook (sepdebug))
+ /* Iterate over main and separate debug objects and try an
+ _Unwind_DebugHook kind breakpoint. */
+ for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+ if (create_exception_master_breakpoint_hook (debug_objfile))
break;
}
}

View File

@ -1,45 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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.
--
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
@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
htab_eq_pointer,
NULL));
+ int count_printed = 0;
while (true)
{
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
{
if (PyErr_Occurred ())
{
- 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;
}
@@ -1245,7 +1246,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)
- gdbpy_print_stack_or_quit ();
+ gdbpy_print_stack ();
+ count_printed++;
}
return success;

View File

@ -0,0 +1,193 @@
[gdb/build] Add CXX_DIALECT to CXX
Say we use a gcc version that (while supporting c++11) does not support c++11
by default, and needs an -std setting to enable it.
If gdb would use the default AX_CXX_COMPILE_STDCXX from autoconf-archive, then
we'd have:
...
CXX="g++ -std=gnu++11"
...
That mechanism however has the following problem (quoting from commit
0bcda685399):
...
the top level Makefile passes CXX down to subdirs, and that overrides whatever
gdb/Makefile may set CXX to. The result would be that a make invocation from
the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a
make invocation at the top level would not.
...
Commit 0bcda685399 fixes this by using a custom AX_CXX_COMPILE_STDCXX which
does:
...
CXX=g++
CXX_DIALECT=-std=gnu++11
...
The problem reported in PR28318 is that using the custom instead of the
default AX_CXX_COMPILE_STDCXX makes the configure test for std::thread
support fail.
We could simply add $CXX_DIALECT to the test for std::thread support, but
that would have to be repeated for each added c++ support test.
Instead, fix this by doing:
...
CXX="g++ -std=gnu++11"
CXX_DIALECT=-std=gnu++11
...
This is somewhat awkward, since it results in -std=gnu++11 occuring twice in
some situations:
...
$ touch src/gdb/dwarf2/read.c
$ ( cd build/gdb; make V=1 dwarf2/read.o )
g++-4.8 -std=gnu++11 -x c++ -std=gnu++11 ...
...
However, both settings are needed:
- the switch in CXX for the std::thread tests (and other tests)
- the switch in CXX_DIALECT so it can be appended in Makefiles, to
counteract the fact that the top-level Makefile overrides CXX
The code added in gdb/ax_cxx_compile_stdcxx.m4 is copied from the default
AX_CXX_COMPILE_STDCXX from autoconf-archive.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28318
gdb/ChangeLog:
2021-10-04 Tom de Vries <tdevries@suse.de>
PR build/28318
* ax_cxx_compile_stdcxx.m4: Add CXX_DIALECT to CXX.
* configure: Regenerate.
gdbserver/ChangeLog:
2021-10-04 Tom de Vries <tdevries@suse.de>
PR build/28318
* configure: Regenerate.
gdbsupport/ChangeLog:
2021-10-04 Tom de Vries <tdevries@suse.de>
PR build/28318
* configure: Regenerate.
---
gdb/ax_cxx_compile_stdcxx.m4 | 8 ++++++++
gdb/configure | 8 ++++++++
gdbserver/configure | 8 ++++++++
gdbsupport/configure | 8 ++++++++
7 files changed, 48 insertions(+)
diff --git a/gdb/ax_cxx_compile_stdcxx.m4 b/gdb/ax_cxx_compile_stdcxx.m4
index 413755a2e88..29d8e10bcc4 100644
--- a/gdb/ax_cxx_compile_stdcxx.m4
+++ b/gdb/ax_cxx_compile_stdcxx.m4
@@ -94,6 +94,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
@@ -118,6 +122,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
diff --git a/gdb/configure b/gdb/configure
index 5d89635c043..6d4c2b17ed2 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -5841,6 +5841,10 @@ eval ac_res=\$$cachevar
$as_echo "$ac_res" >&6; }
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
@@ -6160,6 +6164,10 @@ eval ac_res=\$$cachevar
$as_echo "$ac_res" >&6; }
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
diff --git a/gdbserver/configure b/gdbserver/configure
index b227167e270..f05c1a9b976 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -5625,6 +5625,10 @@ eval ac_res=\$$cachevar
$as_echo "$ac_res" >&6; }
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
@@ -5944,6 +5948,10 @@ eval ac_res=\$$cachevar
$as_echo "$ac_res" >&6; }
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
diff --git a/gdbsupport/configure b/gdbsupport/configure
index a9dd02c5b72..ae6047865ae 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -6520,6 +6520,10 @@ eval ac_res=\$$cachevar
$as_echo "$ac_res" >&6; }
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi
@@ -6839,6 +6843,10 @@ eval ac_res=\$$cachevar
$as_echo "$ac_res" >&6; }
if eval test x\$$cachevar = xyes; then
CXX_DIALECT="$switch"
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
ac_success=yes
break
fi

View File

@ -1,153 +0,0 @@
Index: gdb-10.1/gdb/config.in
===================================================================
--- gdb-10.1.orig/gdb/config.in
+++ gdb-10.1/gdb/config.in
@@ -734,9 +734,6 @@
/* Define if <thread_db.h> has the TD_VERSION error code. */
#undef THREAD_DB_HAS_TD_VERSION
-/* Define to 1 if the regex included in libiberty should be used. */
-#undef USE_INCLUDED_REGEX
-
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
Index: gdb-10.1/gdb/configure
===================================================================
--- gdb-10.1.orig/gdb/configure
+++ gdb-10.1/gdb/configure
@@ -912,7 +912,6 @@ enable_source_highlight
with_intel_pt
with_libipt_prefix
with_libipt_type
-with_included_regex
with_sysroot
with_system_gdbinit
with_system_gdbinit_dir
@@ -1663,10 +1662,6 @@ Optional Packages:
--with-libipt-prefix[=DIR] search for libipt in DIR/include and DIR/lib
--without-libipt-prefix don't search for libipt in includedir and libdir
--with-libipt-type=TYPE type of library to search for (auto/static/shared)
- --without-included-regex
- don't use included regex; this is the default on
- systems with version 2 of the GNU C library (use
- with caution on other system)
--with-sysroot[=DIR] search for usr/lib et al within DIR
--with-system-gdbinit=PATH
automatically load a system-wide gdbinit file
@@ -16006,57 +16001,6 @@ if test "$ac_cv_func_setpgrp_void" = yes
fi
fi
-# Assume we'll default to using the included libiberty regex.
-gdb_use_included_regex=yes
-
-# However, if the system regex is GNU regex, then default to *not*
-# using the included regex.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU regex" >&5
-$as_echo_n "checking for GNU regex... " >&6; }
-if ${gdb_cv_have_gnu_regex+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <gnu-versions.h>
-int
-main ()
-{
-#define REGEX_INTERFACE_VERSION 1
-#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
-# error "Version mismatch"
-#endif
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- gdb_cv_have_gnu_regex=yes
-else
- gdb_cv_have_gnu_regex=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_gnu_regex" >&5
-$as_echo "$gdb_cv_have_gnu_regex" >&6; }
-if test "$gdb_cv_have_gnu_regex" = yes; then
- gdb_use_included_regex=no
-fi
-
-
-# Check whether --with-included-regex was given.
-if test "${with_included_regex+set}" = set; then :
- withval=$with_included_regex; gdb_with_regex=$withval
-else
- gdb_with_regex=$gdb_use_included_regex
-fi
-
-if test "$gdb_with_regex" = yes; then
-
-$as_echo "#define USE_INCLUDED_REGEX 1" >>confdefs.h
-
-fi
-
# Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
ac_fn_c_check_member "$LINENO" "struct thread" "td_pcb" "ac_cv_member_struct_thread_td_pcb" "#include <sys/param.h>
#include <sys/proc.h>
Index: gdb-10.1/gdb/configure.ac
===================================================================
--- gdb-10.1.orig/gdb/configure.ac
+++ gdb-10.1/gdb/configure.ac
@@ -1514,35 +1514,6 @@ if test "$ac_cv_func_setpgrp_void" = yes
fi
fi
-# Assume we'll default to using the included libiberty regex.
-gdb_use_included_regex=yes
-
-# However, if the system regex is GNU regex, then default to *not*
-# using the included regex.
-AC_CACHE_CHECK(
- [for GNU regex],
- [gdb_cv_have_gnu_regex],
- [AC_TRY_COMPILE(
- [#include <gnu-versions.h>],
- [#define REGEX_INTERFACE_VERSION 1
-#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
-# error "Version mismatch"
-#endif],
- gdb_cv_have_gnu_regex=yes,
- gdb_cv_have_gnu_regex=no)])
-if test "$gdb_cv_have_gnu_regex" = yes; then
- gdb_use_included_regex=no
-fi
-
-AC_ARG_WITH(included-regex,
- AS_HELP_STRING([--without-included-regex], [don't use included regex; this is the default on systems with version 2 of the GNU C library (use with caution on other system)]),
- gdb_with_regex=$withval,
- gdb_with_regex=$gdb_use_included_regex)
-if test "$gdb_with_regex" = yes; then
- AC_DEFINE(USE_INCLUDED_REGEX, 1,
- [Define to 1 if the regex included in libiberty should be used.])
-fi
-
# Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
[#include <sys/param.h>
Index: gdb-10.1/gdb/gdb_regex.h
===================================================================
--- gdb-10.1.orig/gdb/gdb_regex.h
+++ gdb-10.1/gdb/gdb_regex.h
@@ -19,13 +19,7 @@
#ifndef GDB_REGEX_H
#define GDB_REGEX_H 1
-#ifdef USE_INCLUDED_REGEX
# include "xregex.h"
-#else
-/* Request 4.2 BSD regex functions. */
-# define _REGEX_RE_COMP
-# include <regex.h>
-#endif
/* A compiled regex. This is mainly a wrapper around regex_t. The
the constructor throws on regcomp error and the destructor is

View File

@ -0,0 +1,37 @@
Make c-exp.y work with Bison 3.8+
When using Bison 3.8, we get this error:
../../gdb/c-exp.y:3455:1: error: void c_print_token(FILE*, int, YYSTYPE) defined but not used [-Werror=unused-function]
That's because bison 3.8 removed YYPRINT support:
https://savannah.gnu.org/forum/forum.php?forum_id=10047
Accordingly, this patch only defines that function for Bison < 3.8.
---
gdb/c-exp.y | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 93b10f05b7d..9b4b88accfe 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -167,7 +167,7 @@ static struct stoken operator_stoken (const char *);
static struct stoken typename_stoken (const char *);
static void check_parameter_typelist (std::vector<struct type *> *);
-#ifdef YYBISON
+#if defined(YYBISON) && YYBISON < 30800
static void c_print_token (FILE *file, int type, YYSTYPE value);
#define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE)
#endif
@@ -3446,7 +3446,8 @@ c_parse (struct parser_state *par_state)
return result;
}
-#ifdef YYBISON
+#if defined(YYBISON) && YYBISON < 30800
+
/* This is called via the YYPRINT macro when parser debugging is
enabled. It prints a token's value. */

View File

@ -1,178 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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,
in some cases with deleted main executable GDB will want to kill the inferior.
$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$!
$ rm /tmp/sleep
$ gdb /tmp/sleep $p
GNU gdb (GDB) 7.10.50.20151016-cvs
/tmp/sleep: No such file or directory.
Attaching to process 9694
/tmp/sleep (deleted): No such file or directory.
A program is being debugged already. Kill it? (y or n) _
The first attachment of "/tmp/sleep" commandline argument errors at:
267 if (scratch_chan < 0)
268 perror_with_name (filename);
1051 if (catch_command_errors_const (exec_file_attach, execarg,
1052 !batch_flag))
Then GDB tries to attach to the process $p:
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
This succeeds and since this moment GDB has a valid inferior. But despite that
the lines
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
still fail because consequently attach_command() fails to find the associated
executable file:
267 if (scratch_chan < 0)
268 perror_with_name (filename);
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
and therefore GDB executes the following:
(gdb) bt
2179 if (have_inferiors ())
2180 {
2181 if (!from_tty
2182 || !have_live_inferiors ()
2183 || query (_("A program is being debugged already. Kill it? ")))
2184 iterate_over_inferiors (dispose_inferior, NULL);
2185 else
2186 error (_("Program not killed."));
2187 }
1084 catch_command_errors (core_file_command, pid_or_core_arg,
1085 !batch_flag);
No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu.
Thanks,
Jan
gdb/ChangeLog
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* main.c (captured_main): Run core_file_command for pid_or_core_arg
only if not have_inferiors ().
gdb/testsuite/ChangeLog
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach-kills.c: New.
* gdb.base/attach-kills.exp: New.
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1199,7 +1199,10 @@ captured_main_1 (struct captured_main_args *context)
{
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 ())
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
+++ b/gdb/testsuite/gdb.base/attach-kills.c
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+int
+main (void)
+{
+ sleep (600);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/attach-kills.exp b/gdb/testsuite/gdb.base/attach-kills.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-kills.exp
@@ -0,0 +1,49 @@
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { ![can_spawn_for_attach] } {
+ return 0
+}
+
+standard_testfile
+
+if { [build_executable ${testfile}.exp $testfile] == -1 } {
+ return -1
+}
+
+# Start the program running and then wait for a bit, to be sure
+# that it can be attached to.
+
+set test_spawn_id [spawn_wait_for_attach $binfile]
+set testpid [spawn_id_get_pid $test_spawn_id]
+
+remote_exec target "cp -pf -- $binfile $binfile-copy"
+remote_exec target "rm -f -- $binfile"
+
+set test "start gdb"
+set res [gdb_spawn_with_cmdline_opts \
+ "-iex \"set height 0\" -iex \"set width 0\" /DoEsNoTeXySt $testpid"]
+if { $res != 0} {
+ fail "$test (spawn)"
+ kill_wait_spawned_process $test_spawn_id
+ return -1
+}
+gdb_test_multiple "" $test {
+ -re "\r\nAttaching to .*\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+kill_wait_spawned_process $test_spawn_id

View File

@ -38,4 +38,4 @@ new file mode 100644
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists"
+gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists"

View File

@ -9,8 +9,8 @@ Subject: gdb-ccache-workaround.patch
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
@@ -25,6 +25,14 @@ if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
lappend options additional_flags=-g3
@@ -27,6 +27,14 @@ if { [test_compiler_info "gcc-*"] } {
lappend options additional_flags=-fdebug-macro
}
+# Workaround ccache making lineno non-zero for command-line definitions.

View File

@ -1,56 +0,0 @@
diff -Nrup a/gnulib/import/m4/alloca.m4 b/gnulib/import/m4/alloca.m4
--- a/gnulib/import/m4/alloca.m4 2019-11-18 18:49:20.000000000 -0700
+++ b/gnulib/import/m4/alloca.m4 2020-01-11 01:07:36.200483085 -0700
@@ -89,7 +89,7 @@ AC_CACHE_CHECK([stack direction for C al
[ac_cv_c_stack_direction],
[AC_RUN_IFELSE([AC_LANG_SOURCE(
[AC_INCLUDES_DEFAULT
-int
+__attribute__ (noinline,noclone)) int
find_stack_direction (int *addr, int depth)
{
int dir, dummy = 0;
diff -Nrup a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
--- a/libiberty/aclocal.m4 2019-01-19 09:01:34.000000000 -0700
+++ b/libiberty/aclocal.m4 2020-01-09 22:00:27.183312982 -0700
@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then
fi
AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN([find_stack_direction ()
+[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction ()
{
static char *addr = 0;
auto char dummy;
diff --git a/config/intdiv0.m4 b/config/intdiv0.m4
index 55dddcf1..ba906efc 100644
--- a/config/intdiv0.m4
+++ b/config/intdiv0.m4
@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig;
exit (sig != SIGFPE);
}
-int x = 1;
-int y = 0;
-int z;
-int nan;
+volatile int x = 1;
+volatile int y = 0;
+volatile int z;
+volatile int nan;
int main ()
{
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index f1ce7601..fc20d228 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then
for v in $vars; do
AC_MSG_CHECKING([for $v])
AC_CACHE_VAL(libiberty_cv_var_$v,
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])],
[eval "libiberty_cv_var_$v=yes"],
[eval "libiberty_cv_var_$v=no"])])
if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then

View File

@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch
diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14031,7 +14031,17 @@ remote_target::pid_to_exec_file (int pid)
@@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)

View File

@ -1,69 +0,0 @@
[gdb] Don't return non-existing path in debuginfod_source_query
When setting env var DEBUGINFOD_URLS to " " and running the testsuite, we run
into these regressions:
...
FAIL: gdb.base/list-missing-source.exp: info source
FAIL: gdb.base/source-dir.exp: info source before setting directory search list
...
Setting var DEBUGINFOD_URLS to " " allows the debuginfod query function
debuginfod_source_query to get past its early exit.
The function debuginfod_source_query is documented as: "If the file is
successfully retrieved, its path on the local machine is stored in DESTNAME".
However, in case we get back -ENOENT from libdebuginfod, we still set
DESTNAME:
....
if (fd.get () < 0 && fd.get () != -ENOENT)
printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
safe_strerror (-fd.get ()),
styled_string (file_name_style.style (), srcpath));
else
*destname = make_unique_xstrdup (srcpath);
return fd;
...
Fix this by making debuginfod_source_query fit it's documentation and only
setting DESTNAME when successfully retrieving a file. Likewise in
debuginfod_debuginfo_query.
gdb/ChangeLog:
2020-11-16 Tom de Vries <tdevries@suse.de>
* debuginfod-support.c (debuginfod_source_query)
(debuginfod_debuginfo_query): Only set DESTNAME if successful.
---
gdb/debuginfod-support.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 0dc88c2c2a1..1282fc0e9da 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -120,7 +120,8 @@ debuginfod_source_query (const unsigned char *build_id,
printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
safe_strerror (-fd.get ()),
styled_string (file_name_style.style (), srcpath));
- else
+
+ if (fd.get () >= 0)
destname->reset (xstrdup (srcpath));
debuginfod_end (c);
@@ -154,8 +155,10 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
safe_strerror (-fd.get ()),
styled_string (file_name_style.style (), filename));
- destname->reset (dname);
+ if (fd.get () >= 0)
+ destname->reset (dname);
debuginfod_end (c);
+
return fd;
}
#endif

View File

@ -1,315 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -71,6 +71,8 @@ PYTHON_FILE_LIST = \
gdb/__init__.py \
gdb/FrameDecorator.py \
gdb/FrameIterator.py \
+ gdb/FrameWrapper.py \
+ gdb/backtrace.py \
gdb/frames.py \
gdb/printing.py \
gdb/prompt.py \
@@ -79,6 +81,7 @@ PYTHON_FILE_LIST = \
gdb/xmethod.py \
gdb/command/__init__.py \
gdb/command/explore.py \
+ gdb/command/backtrace.py \
gdb/command/frame_filters.py \
gdb/command/pretty_printers.py \
gdb/command/prompt.py \
diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/FrameWrapper.py
@@ -0,0 +1,122 @@
+# Wrapper API for frames.
+
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+# FIXME: arguably all this should be on Frame somehow.
+class FrameWrapper:
+ def __init__ (self, frame):
+ self.frame = frame;
+
+ def write_symbol (self, stream, sym, block):
+ if len (sym.linkage_name):
+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
+ sym = nsym
+
+ stream.write (sym.print_name + "=")
+ try:
+ val = self.read_var (sym)
+ if val != None:
+ val = str (val)
+ # FIXME: would be nice to have a more precise exception here.
+ except RuntimeError as text:
+ val = text
+ if val == None:
+ stream.write ("???")
+ else:
+ stream.write (str (val))
+
+ def print_frame_locals (self, stream, func):
+
+ try:
+ block = self.frame.block()
+ except RuntimeError:
+ block = None
+
+ while block != None:
+ if block.is_global or block.is_static:
+ break
+
+ for sym in block:
+ if sym.is_argument:
+ continue;
+
+ self.write_symbol (stream, sym, block)
+ stream.write ('\n')
+
+ def print_frame_args (self, stream, func):
+
+ try:
+ block = self.frame.block()
+ except RuntimeError:
+ block = None
+
+ while block != None:
+ if block.function != None:
+ break
+ block = block.superblock
+
+ first = True
+ for sym in block:
+ if not sym.is_argument:
+ continue;
+
+ if not first:
+ stream.write (", ")
+
+ self.write_symbol (stream, sym, block)
+ first = False
+
+ # FIXME: this should probably just be a method on gdb.Frame.
+ # But then we need stream wrappers.
+ def describe (self, stream, full):
+ if self.type () == gdb.DUMMY_FRAME:
+ stream.write (" <function called from gdb>\n")
+ elif self.type () == gdb.SIGTRAMP_FRAME:
+ stream.write (" <signal handler called>\n")
+ else:
+ sal = self.find_sal ()
+ pc = self.pc ()
+ name = self.name ()
+ if not name:
+ name = "??"
+ if pc != sal.pc or not sal.symtab:
+ stream.write (" 0x%08x in" % pc)
+ stream.write (" " + name + " (")
+
+ func = self.function ()
+ self.print_frame_args (stream, func)
+
+ stream.write (")")
+
+ if sal.symtab and sal.symtab.filename:
+ stream.write (" at " + sal.symtab.filename)
+ stream.write (":" + str (sal.line))
+
+ if not self.name () or (not sal.symtab or not sal.symtab.filename):
+ lib = gdb.solib_name (pc)
+ if lib:
+ stream.write (" from " + lib)
+
+ stream.write ("\n")
+
+ if full:
+ self.print_frame_locals (stream, func)
+
+ def __getattr__ (self, name):
+ return getattr (self.frame, name)
diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/backtrace.py
@@ -0,0 +1,42 @@
+# Filtering backtrace.
+
+# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import itertools
+
+# Our only exports.
+__all__ = ['push_frame_filter', 'create_frame_filter']
+
+old_frame_filter = None
+
+def push_frame_filter (constructor):
+ """Register a new backtrace filter class with the 'backtrace' command.
+The filter will be passed an iterator as an argument. The iterator
+will return gdb.Frame-like objects. The filter should in turn act as
+an iterator returning such objects."""
+ global old_frame_filter
+ if old_frame_filter == None:
+ old_frame_filter = constructor
+ else:
+ old_frame_filter = lambda iterator, filter = frame_filter: constructor (filter(iterator))
+
+def create_frame_filter (iter):
+ global old_frame_filter
+ if old_frame_filter is None:
+ return iter
+ return old_frame_filter (iter)
+
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -0,0 +1,106 @@
+# New backtrace command.
+
+# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import gdb.backtrace
+import itertools
+from gdb.FrameIterator import FrameIterator
+from gdb.FrameWrapper import FrameWrapper
+import sys
+
+class ReverseBacktraceParameter (gdb.Parameter):
+ """The new-backtrace command can show backtraces in 'reverse' order.
+This means that the innermost frame will be printed last.
+Note that reverse backtraces are more expensive to compute."""
+
+ set_doc = "Enable or disable reverse backtraces."
+ show_doc = "Show whether backtraces will be printed in reverse order."
+
+ def __init__(self):
+ gdb.Parameter.__init__ (self, "reverse-backtrace",
+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN)
+ # Default to compatibility with gdb.
+ self.value = False
+
+class FilteringBacktrace (gdb.Command):
+ """Print backtrace of all stack frames, or innermost COUNT frames.
+With a negative argument, print outermost -COUNT frames.
+Use of the 'full' qualifier also prints the values of the local variables.
+Use of the 'raw' qualifier avoids any filtering by loadable modules.
+"""
+
+ def __init__ (self):
+ # FIXME: this is not working quite well enough to replace
+ # "backtrace" yet.
+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK)
+ self.reverse = ReverseBacktraceParameter()
+
+ def reverse_iter (self, iter):
+ result = []
+ for item in iter:
+ result.append (item)
+ result.reverse()
+ return result
+
+ def final_n (self, iter, x):
+ result = []
+ for item in iter:
+ result.append (item)
+ return result[x:]
+
+ def invoke (self, arg, from_tty):
+ i = 0
+ count = 0
+ filter = True
+ full = False
+
+ for word in arg.split (" "):
+ if word == '':
+ continue
+ elif word == 'raw':
+ filter = False
+ elif word == 'full':
+ full = True
+ else:
+ count = int (word)
+
+ # FIXME: provide option to start at selected frame
+ # However, should still number as if starting from newest
+ newest_frame = gdb.newest_frame()
+ iter = itertools.imap (FrameWrapper,
+ FrameIterator (newest_frame))
+ if filter:
+ iter = gdb.backtrace.create_frame_filter (iter)
+
+ # Now wrap in an iterator that numbers the frames.
+ iter = itertools.izip (itertools.count (0), iter)
+
+ # Reverse if the user wanted that.
+ if self.reverse.value:
+ iter = self.reverse_iter (iter)
+
+ # Extract sub-range user wants.
+ if count < 0:
+ iter = self.final_n (iter, count)
+ elif count > 0:
+ iter = itertools.islice (iter, 0, count)
+
+ for pair in iter:
+ sys.stdout.write ("#%-2d" % pair[0])
+ pair[1].describe (sys.stdout, full)
+
+FilteringBacktrace()

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -9649,6 +9649,7 @@ if test x"$prefer_curses" = xyes; then
@@ -9544,6 +9544,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 +20,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 :
@@ -9673,7 +9674,7 @@ return waddstr ();
@@ -9568,7 +9569,7 @@ return waddstr ();
return 0;
}
_ACEOF
@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -9747,6 +9748,7 @@ case $host_os in
@@ -9642,6 +9643,7 @@ case $host_os in
esac
# These are the libraries checked by Readline.
@ -37,7 +37,7 @@ 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 :
@@ -9771,7 +9773,7 @@ return tgetent ();
@@ -9666,7 +9668,7 @@ return tgetent ();
return 0;
}
_ACEOF
@ -49,7 +49,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
@@ -712,7 +712,8 @@ if test x"$prefer_curses" = xyes; then
@@ -736,7 +736,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,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -754,7 +755,8 @@ case $host_os in
@@ -778,7 +779,8 @@ case $host_os in
esac
# These are the libraries checked by Readline.

View File

@ -1,27 +0,0 @@
diff --git a/gdb/exec.c b/gdb/exec.c
index 676f3dc3f7d..7693236019b 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -482,9 +482,8 @@ exec_file_attach (const char *filename, int from_tty)
if (!exec_bfd)
{
- error (_("\"%ps\": could not open as an executable file: %s."),
- styled_string (file_name_style.style (), scratch_pathname),
- bfd_errmsg (bfd_get_error ()));
+ error (_("\"%s\": could not open as an executable file: %s."),
+ scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
/* gdb_realpath_keepfile resolves symlinks on the local
@@ -515,8 +514,8 @@ exec_file_attach (const char *filename, int from_tty)
"Please specify an executable to debug."),
scratch_pathname);
else
- error (_("\"%ps\": not in executable format: %s"),
- styled_string (file_name_style.style (), scratch_pathname),
+ error (_("\"%s\": not in executable format: %s"),
+ scratch_pathname,
gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}

View File

@ -1,267 +0,0 @@
[gdb] Fix internal-error in process_event_stop_test
The function create_exception_master_breakpoint in gdb/breakpoint.c attempts
to set a master exception breakpoint in each objfile. It tries this using
a libgcc/unwind probe, and if that fails then using the
_Unwind_DebugHook symbol:
...
for (objfile *objfile : current_program_space->objfiles ())
{
/* Try using probes. */
if (/* successful */)
continue;
/* Try using _Unwind_DebugHook */
}
...
The preference scheme works ok both if the objfile has debug info, and if it's
stripped.
But it doesn't work when the objfile has a .gnu_debuglink to a .debug file
(and the .debug file is present). What happens is that:
- we first encounter objfile libgcc.debug
- we try using probes, and this fails
- so we try _Unwind_DebugHook, which succeeds
- next we encounter objfile libgcc
- we try using probes, and this succeeds.
So, we end up with a master exception breakpoint in both libgcc (using probes)
and libgcc.debug (using _Unwind_DebugHook).
This eventually causes:
...
(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3
next^M
src/gdb/infrun.c:6384: internal-error: \
void process_event_stop_test(execution_control_state*): \
Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \
failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next
past catch (GDB internal error)
...
To trigger this internal-error, we need to use gcc-10 or later to compile the
test-case, such that it contains the fix for gcc PR97774 - "Incorrect line
info for try/catch".
Fix this by only trying to install the master exception breakpoint in
libgcc.debug using the _Unwind_DebugHook method, if the install using probes
in libgcc failed.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-01-08 Tom de Vries <tdevries@suse.de>
PR gdb/26881
* breakpoint.c (create_exception_master_breakpoint_probe)
(create_exception_master_breakpoint_hook): Factor out
of ...
(create_exception_master_breakpoint): ... here. Only try to install
the master exception breakpoint in objfile.debug using the
_Unwind_DebugHook method, if the install using probes in objfile
failed.
---
gdb/breakpoint.c | 164 +++++++++++++++++++++++++++++++++----------------------
2 files changed, 110 insertions(+), 65 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f304c0c3559..7ead1529ad1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3360,92 +3360,126 @@ create_std_terminate_master_breakpoint (void)
}
}
-/* Install a master breakpoint on the unwinder's debug hook. */
+/* Install a master breakpoint on the unwinder's debug hook for OBJFILE using a
+ probe. Return true if a breakpoint was installed. */
-static void
-create_exception_master_breakpoint (void)
+static bool
+create_exception_master_breakpoint_probe (objfile *objfile)
{
- const char *const func_name = "_Unwind_DebugHook";
+ struct breakpoint *b;
+ struct gdbarch *gdbarch;
+ struct breakpoint_objfile_data *bp_objfile_data;
- for (objfile *objfile : current_program_space->objfiles ())
- {
- struct breakpoint *b;
- struct gdbarch *gdbarch;
- struct breakpoint_objfile_data *bp_objfile_data;
- CORE_ADDR addr;
- struct explicit_location explicit_loc;
+ bp_objfile_data = get_breakpoint_objfile_data (objfile);
- bp_objfile_data = get_breakpoint_objfile_data (objfile);
+ /* We prefer the SystemTap probe point if it exists. */
+ if (!bp_objfile_data->exception_searched)
+ {
+ std::vector<probe *> ret
+ = find_probes_in_objfile (objfile, "libgcc", "unwind");
- /* We prefer the SystemTap probe point if it exists. */
- if (!bp_objfile_data->exception_searched)
+ if (!ret.empty ())
{
- std::vector<probe *> ret
- = find_probes_in_objfile (objfile, "libgcc", "unwind");
+ /* We are only interested in checking one element. */
+ probe *p = ret[0];
- if (!ret.empty ())
+ if (!p->can_evaluate_arguments ())
{
- /* We are only interested in checking one element. */
- probe *p = ret[0];
-
- if (!p->can_evaluate_arguments ())
- {
- /* We cannot use the probe interface here, because it does
- not know how to evaluate arguments. */
- ret.clear ();
- }
+ /* We cannot use the probe interface here, because it does
+ not know how to evaluate arguments. */
+ ret.clear ();
}
- bp_objfile_data->exception_probes = ret;
- bp_objfile_data->exception_searched = 1;
}
+ bp_objfile_data->exception_probes = ret;
+ bp_objfile_data->exception_searched = 1;
+ }
- if (!bp_objfile_data->exception_probes.empty ())
- {
- gdbarch = objfile->arch ();
+ if (bp_objfile_data->exception_probes.empty ())
+ return false;
- for (probe *p : bp_objfile_data->exception_probes)
- {
- b = create_internal_breakpoint (gdbarch,
- p->get_relocated_address (objfile),
- bp_exception_master,
- &internal_breakpoint_ops);
- b->location = new_probe_location ("-probe-stap libgcc:unwind");
- b->enable_state = bp_disabled;
- }
+ gdbarch = objfile->arch ();
- continue;
- }
+ for (probe *p : bp_objfile_data->exception_probes)
+ {
+ b = create_internal_breakpoint (gdbarch,
+ p->get_relocated_address (objfile),
+ bp_exception_master,
+ &internal_breakpoint_ops);
+ b->location = new_probe_location ("-probe-stap libgcc:unwind");
+ b->enable_state = bp_disabled;
+ }
- /* Otherwise, try the hook function. */
+ return true;
+}
- if (msym_not_found_p (bp_objfile_data->exception_msym.minsym))
- continue;
+/* Install a master breakpoint on the unwinder's debug hook for OBJFILE using
+ _Unwind_DebugHook. Return true if a breakpoint was installed. */
- gdbarch = objfile->arch ();
+static bool
+create_exception_master_breakpoint_hook (objfile *objfile)
+{
+ const char *const func_name = "_Unwind_DebugHook";
+ struct breakpoint *b;
+ struct gdbarch *gdbarch;
+ struct breakpoint_objfile_data *bp_objfile_data;
+ CORE_ADDR addr;
+ struct explicit_location explicit_loc;
- if (bp_objfile_data->exception_msym.minsym == NULL)
- {
- struct bound_minimal_symbol debug_hook;
+ bp_objfile_data = get_breakpoint_objfile_data (objfile);
- debug_hook = lookup_minimal_symbol (func_name, NULL, objfile);
- if (debug_hook.minsym == NULL)
- {
- bp_objfile_data->exception_msym.minsym = &msym_not_found;
- continue;
- }
+ if (msym_not_found_p (bp_objfile_data->exception_msym.minsym))
+ return false;
- bp_objfile_data->exception_msym = debug_hook;
+ gdbarch = objfile->arch ();
+
+ if (bp_objfile_data->exception_msym.minsym == NULL)
+ {
+ struct bound_minimal_symbol debug_hook;
+
+ debug_hook = lookup_minimal_symbol (func_name, NULL, objfile);
+ if (debug_hook.minsym == NULL)
+ {
+ bp_objfile_data->exception_msym.minsym = &msym_not_found;
+ return false;
}
- addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
- addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
- current_top_target ());
- b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
- &internal_breakpoint_ops);
- initialize_explicit_location (&explicit_loc);
- explicit_loc.function_name = ASTRDUP (func_name);
- b->location = new_explicit_location (&explicit_loc);
- b->enable_state = bp_disabled;
+ bp_objfile_data->exception_msym = debug_hook;
+ }
+
+ addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
+ current_top_target ());
+ b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
+ &internal_breakpoint_ops);
+ initialize_explicit_location (&explicit_loc);
+ explicit_loc.function_name = ASTRDUP (func_name);
+ b->location = new_explicit_location (&explicit_loc);
+ b->enable_state = bp_disabled;
+
+ return true;
+}
+
+/* Install a master breakpoint on the unwinder's debug hook. */
+
+static void
+create_exception_master_breakpoint (void)
+{
+ for (objfile *obj : current_program_space->objfiles ())
+ {
+ /* Skip separate debug object. */
+ if (obj->separate_debug_objfile_backlink)
+ continue;
+
+ /* Try a probe kind breakpoint. */
+ if (create_exception_master_breakpoint_probe (obj))
+ continue;
+
+ /* Iterate over separate debug objects and try an _Unwind_DebugHook
+ kind breakpoint. */
+ for (objfile *sepdebug = obj->separate_debug_objfile;
+ sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile)
+ if (create_exception_master_breakpoint_hook (sepdebug))
+ break;
}
}

View File

@ -1,105 +0,0 @@
[gdb/testsuite] Fix section matching in find_pc_sect_compunit_symtab
When running test-case gdb.base/list-ambiguous.exp with target board readnow,
we run into:
...
FAIL: gdb.base/list-ambiguous.exp: list ambiguous_fun
...
The test-case contains two static functions ambiguous_fun, one in
list-ambiguous0.c and one in list-ambiguous1.c.
The list command is supposed to show both, but only the one from
list-ambiguous0.c is shown.
This is due to the section check in find_pc_sect_compunit_symtab. It checks
whether the candidate compunit_symtab contains a symbol that has the required
section. This check is only done for GLOBAL_BLOCK symbols.
The check succeeds for the compunit_symtab for list-ambiguous0.c, because it
contains main, but it fails for list-ambiguous0.c because it has no global
symbols.
Fix this by extending the section check to STATIC_BLOCK symbols.
Tested on x86_64-linux.
gdb/ChangeLog:
2020-10-27 Tom de Vries <tdevries@suse.de>
* symtab.c (find_pc_sect_compunit_symtab): Include STATIC_BLOCK
symbols in section check.
gdb/testsuite/ChangeLog:
2020-10-27 Tom de Vries <tdevries@suse.de>
* gdb.base/list-ambiguous-readnow.exp: New file.
---
gdb/symtab.c | 18 ++++++++++-----
.../gdb.base/list-ambiguous-readnow.exp | 22 +++++++++++++++++++
4 files changed, 43 insertions(+), 6 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
diff --git a/gdb/symtab.c b/gdb/symtab.c
index eda33a7eb4f..f6e24758009 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2954,13 +2954,19 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
struct symbol *sym = NULL;
struct block_iterator iter;
- ALL_BLOCK_SYMBOLS (global_block, iter, sym)
+ for (int b_index = GLOBAL_BLOCK;
+ b_index <= STATIC_BLOCK && sym == NULL;
+ ++b_index)
{
- fixup_symbol_section (sym, obj_file);
- if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file,
- sym),
- section))
- break;
+ const struct block *b = BLOCKVECTOR_BLOCK (bv, b_index);
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ fixup_symbol_section (sym, obj_file);
+ if (matching_obj_sections (SYMBOL_OBJ_SECTION (obj_file,
+ sym),
+ section))
+ break;
+ }
}
if (sym == NULL)
continue; /* No symbol in this symtab matches
diff --git a/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
new file mode 100644
index 00000000000..347a71ba52a
--- /dev/null
+++ b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
@@ -0,0 +1,22 @@
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Run list-ambiguous.exp with -readnow.
+
+save_vars { GDBFLAGS } {
+ append GDBFLAGS " -readnow"
+
+ source $srcdir/$subdir/list-ambiguous.exp
+}
--
2.26.2

View File

@ -1,11 +1,5 @@
Fix selftest FAILs with gdb build with -O2 -flto
---
gdb/complaints.h | 5 +++--
gdb/main.c | 5 +++++
gdb/testsuite/gdb.gdb/selftest.exp | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gdb/complaints.h b/gdb/complaints.h
index 6ad056d257..cac09ff573 100644
--- a/gdb/complaints.h
@ -39,16 +33,3 @@ index 19bbb92388..9d35f9baa8 100644
static void
captured_main (void *data)
{
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index 43043e58ea..992d79f5cf 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -143,7 +143,7 @@ proc test_with_self { } {
setup_xfail "i*86-pc-linuxaout-gnu"
set description "backtrace through signal handler"
gdb_test_multiple "backtrace" "$description" {
- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+ -re "#0.*(read|poll).* main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
}

View File

@ -1,28 +0,0 @@
[gdb] Fix use of invalid pointer in remote_async_inferior_event_handler
As proposed by palves here (
https://sourceware.org/bugzilla/show_bug.cgi?id=26614#c20 ).
---
gdb/remote.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index ba9e6d6e9b..556de6033f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14163,9 +14163,13 @@ remote_async_serial_handler (struct serial *scb, void *context)
static void
remote_async_inferior_event_handler (gdb_client_data data)
{
+ remote_target *remote = (remote_target *) data;
+ /* Hold a strong reference to the remote target while handling an
+ event, since that could result in closing the connection. */
+ auto remote_ref = target_ops_ref::new_reference (remote);
+
inferior_event_handler (INF_REG_EVENT);
- remote_target *remote = (remote_target *) data;
remote_state *rs = remote->get_remote_state ();
/* inferior_event_handler may have consumed an event pending on the

View File

@ -1,14 +0,0 @@
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 7467e518d06..fc9bd7a15f3 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -117,7 +117,8 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
LONGEST lowerbound, upperbound;
LONGEST i;
- get_discrete_bounds (range_type, &lowerbound, &upperbound);
+ if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
+ lowerbound = 0, upperbound = -1;
if (nss != ndimensions)
{

View File

@ -6,5 +6,5 @@ index b9770ea415..3149f6e1fe 100644
-#!/usr/bin/env bash
+#!/bin/bash
# Copyright (C) 2003-2020 Free Software Foundation, Inc.
# Copyright (C) 2003-2021 Free Software Foundation, Inc.

View File

@ -10,7 +10,7 @@ diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsu
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
@@ -0,0 +1,115 @@
@@ -0,0 +1,119 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -56,6 +56,10 @@ new file mode 100644
+ untested "$test (no DWARF)"
+ return 0
+ }
+ -re "type = <unknown return type> \\(\\)\r\n$gdb_prompt $" {
+ untested "$test (no DWARF)"
+ return 0
+ }
+}
+
+set addr ""
@ -124,5 +128,5 @@ 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"}
+gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
+gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"}

View File

@ -1,219 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
PR 16581:
GDB crash on inherit_abstract_dies infinite recursion
https://sourceware.org/bugzilla/show_bug.cgi?id=16581
fixed crash from an infinite recursion. But in rare cases the new code can
now gdb_assert() due to weird DWARF file.
I do not yet fully understand why the DWARF is as it is but just GDB should
never crash due to invalid DWARF anyway. The "invalid" DWARF I see only in
Fedora GCC build, not in FSF GCC build, more info at:
https://bugzilla.redhat.com/show_bug.cgi?id=1069382
http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
Thanks,
Jan
--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="complaint.patch"
gdb/
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (process_die): Change gdb_assert to complaint.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -10162,6 +10162,13 @@ class process_die_scope
static void
process_die (struct die_info *die, struct dwarf2_cu *cu)
{
+ if (die->in_process)
+ {
+ complaint (_("DIE at 0x%s attempted to be processed twice"),
+ sect_offset_str (die->sect_off));
+ return;
+ }
+
process_die_scope scope (die, cu);
switch (die->tag)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -190,6 +190,12 @@ struct linux_nat_target *linux_target;
/* Does the current host support PTRACE_GETREGSET? */
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
+#ifdef NEED_DETACH_SIGSTOP
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
+static pid_t pid_was_stopped;
+
+#endif
+
static unsigned int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -1044,6 +1050,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
if (linux_proc_pid_is_stopped (pid))
{
linux_nat_debug_printf ("Attaching to a stopped process");
+#ifdef NEED_DETACH_SIGSTOP
+ pid_was_stopped = ptid.pid ();
+#endif
/* 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)
return gdb_signal_to_host (signo);
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
+ many TIDs are left unstopped). See RH Bug 496732. */
+ if (lp->ptid.pid () == pid_was_stopped)
+ {
+ int err;
+
+ errno = 0;
+ err = kill_lwp (lp->ptid.lwp (), SIGSTOP);
+ if (debug_linux_nat)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SC: lwp kill %d %s\n",
+ err,
+ errno ? safe_strerror (errno) : "ERRNO-OK");
+ }
+ }
+
+#endif
return 0;
}
@@ -1502,6 +1530,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
detach_one_lwp (main_lwp, &signo);
detach_success (inf);
+
+#ifdef NEED_DETACH_SIGSTOP
+ pid_was_stopped = 0;
+#endif
}
}
@@ -1744,6 +1776,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
return;
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* At this point, we are going to resume the inferior and if we
+ have attached to a stopped process, we no longer should leave
+ it as stopped if the user detaches. PTID variable has PID set to LWP
+ while we need to check the real PID here. */
+
+ if (!step && lp && pid_was_stopped == lp->ptid.pid ())
+ pid_was_stopped = 0;
+
+#endif
if (resume_many)
iterate_over_lwps (ptid, [=] (struct lwp_info *info)
{
@@ -3617,6 +3659,10 @@ linux_nat_target::mourn_inferior ()
/* Let the arch-specific native code know this process is gone. */
linux_target->low_forget_process (pid);
+#ifdef NEED_DETACH_SIGSTOP
+
+ pid_was_stopped = 0;
+#endif
}
/* Convert a native/host siginfo object, into/from the siginfo in the
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -56,7 +56,65 @@ proc corefunc { threadtype } {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
- # Verify that we can attach to the stopped process.
+ # Verify that we can attach to the process by first giving its
+ # executable name via the file command, and using attach with the
+ # process ID.
+
+ set test "$threadtype: set file, before attach1 to stopped process"
+ gdb_test_multiple "file $binfile" "$test" {
+ -re "Load new symbol table from.*y or n. $" {
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ "$test (re-read)"
+ }
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ set test "$threadtype: attach1 to stopped, after setting file"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
+ if {[string equal $threadtype threaded]} {
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
+ } else {
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
+ }
+
+ # Exit and detach the process.
+
+ gdb_exit
+
+ # Avoid some race:
+ sleep 2
+
+ if [catch {open /proc/${testpid}/status r} fileid] {
+ set line2 "NOTFOUND"
+ } else {
+ gets $fileid line1;
+ gets $fileid line2;
+ close $fileid;
+ }
+
+ set test "$threadtype: attach1, exit leaves process stopped"
+ if {[string match "*(stopped)*" $line2]} {
+ pass $test
+ } else {
+ fail $test
+ }
+
+ # At this point, the process should still be stopped
+
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ # Verify that we can attach to the process just by giving the
+ # process ID.
set test "$threadtype: attach2 to stopped, after setting file"
gdb_test_multiple "attach $testpid" "$test" {

View File

@ -1,43 +0,0 @@
Handle no upper bound in value_subscript
Fixes PR26875 - "Incorrect value printed for address of first element of
zero-length array".
https://sourceware.org/bugzilla/show_bug.cgi?id=26875
---
gdb/valarith.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 0221bc6e939..32b908d6e5b 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -151,18 +151,24 @@ value_subscript (struct value *array, LONGEST index)
{
struct type *range_type = tarray->index_type ();
LONGEST lowerbound, upperbound;
+ bool upperbound_p = true;
+
+ if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
+ {
+ lowerbound = range_type->bounds ()->low.const_val ();
+ upperbound_p = false;
+ }
- get_discrete_bounds (range_type, &lowerbound, &upperbound);
if (VALUE_LVAL (array) != lval_memory)
return value_subscripted_rvalue (array, index, lowerbound);
if (c_style == 0)
{
- if (index >= lowerbound && index <= upperbound)
+ if (index >= lowerbound && upperbound_p && index <= upperbound)
return value_subscripted_rvalue (array, index, lowerbound);
/* Emit warning unless we have an array of unknown size.
An array of unknown size has lowerbound 0 and upperbound -1. */
- if (upperbound > -1)
+ if (upperbound_p && upperbound > -1)
warning (_("array or string index out of range"));
/* fall doing C stuff */
c_style = 1;

View File

@ -1,46 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
@@ -9968,10 +9968,12 @@ _ACEOF
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
- TARGET_PTR="unsigned long"
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
+# content is the same for multilib distributions.
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
TARGET_PTR="unsigned long long"
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
+ TARGET_PTR="unsigned long"
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
TARGET_PTR="unsigned __int128"
else
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -803,10 +803,12 @@ AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned __int128)
-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
- TARGET_PTR="unsigned long"
-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
+# Try to keep TARGET_PTR the same across archs so that jit-reader.h file
+# content is the same for multilib distributions.
+if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
TARGET_PTR="unsigned long long"
+elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
+ TARGET_PTR="unsigned long"
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
TARGET_PTR="unsigned __int128"
else

View File

@ -213,7 +213,7 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -145,7 +145,7 @@ AC_DEFUN([GDB_AC_COMMON], [
@@ -135,7 +135,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5

View File

@ -1,25 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
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
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
@@ -11948,6 +11948,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
= 3 * (thread_count (proc_target) + 1);
else
old_loc->events_till_retirement = 1;
+ /* Red Hat Bug 590623. */
+ old_loc->events_till_retirement *= 10;
old_loc->owner = NULL;
moribund_locations.push_back (old_loc);

View File

@ -12,7 +12,7 @@ diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-1.cc
@@ -0,0 +1,30 @@
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
@ -42,12 +42,11 @@ new file mode 100644
+ p->foo ();
+ return 0;
+}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734-2.cc b/gdb/testsuite/gdb.cp/pr11734-2.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-2.cc
@@ -0,0 +1,27 @@
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
@ -74,12 +73,11 @@ new file mode 100644
+pr11734::foo(void)
+{
+}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734-3.cc b/gdb/testsuite/gdb.cp/pr11734-3.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-3.cc
@@ -0,0 +1,27 @@
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
@ -106,12 +104,11 @@ new file mode 100644
+pr11734::foo (int a)
+{
+}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734-4.cc b/gdb/testsuite/gdb.cp/pr11734-4.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734-4.cc
@@ -0,0 +1,27 @@
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
@ -138,7 +135,6 @@ new file mode 100644
+pr11734::foo (char *a)
+{
+}
+
diff --git a/gdb/testsuite/gdb.cp/pr11734.exp b/gdb/testsuite/gdb.cp/pr11734.exp
new file mode 100644
--- /dev/null
@ -203,7 +199,7 @@ diff --git a/gdb/testsuite/gdb.cp/pr11734.h b/gdb/testsuite/gdb.cp/pr11734.h
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/pr11734.h
@@ -0,0 +1,28 @@
@@ -0,0 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
@ -231,4 +227,3 @@ new file mode 100644
+ void foo (int);
+ void foo (char *);
+};
+

View File

@ -1,72 +0,0 @@
PowerPC remove 512 bytes region limit if 2nd DAWR is avaliable.
Power 10 introduces the 2nd DAWR (second watchpoint) and also removed
a restriction that limit the watch region to 512 bytes.
2020-11-08 Rogerio A. Cardoso <rcardoso@linux.ibm.com>
/gdb
* ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define.
(region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before
set region.
---
gdb/ppc-linux-nat.c | 26 ++++++++++++++++++--------
2 files changed, 23 insertions(+), 8 deletions(-)
Index: gdb-10.1/gdb/ppc-linux-nat.c
===================================================================
--- gdb-10.1.orig/gdb/ppc-linux-nat.c
+++ gdb-10.1/gdb/ppc-linux-nat.c
@@ -138,6 +138,11 @@ struct ppc_hw_breakpoint
#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10
#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
+/* Feature defined on Linux kernel v5.1: Second watchpoint support. */
+#ifndef PPC_DEBUG_FEATURE_DATA_BP_ARCH_31
+#define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 0x20
+#endif /* PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 */
+
/* The version of the PowerPC HWDEBUG kernel interface that we will use, if
available. */
#define PPC_DEBUG_CURRENT_VERSION 1
@@ -2108,9 +2113,10 @@ ppc_linux_nat_target::region_ok_for_hw_w
watchpoints. */
if (m_dreg_interface.hwdebug_p ())
{
- int region_size;
const struct ppc_debug_info &hwdebug_info = (m_dreg_interface
.hwdebug_info ());
+ int region_size = hwdebug_info.data_bp_alignment;
+ int region_align = region_size;
/* Embedded DAC-based processors, like the PowerPC 440 have ranged
watchpoints and can watch any access within an arbitrary memory
@@ -2122,15 +2128,19 @@ ppc_linux_nat_target::region_ok_for_hw_w
return 2;
/* Check if the processor provides DAWR interface. */
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
- /* DAWR interface allows to watch up to 512 byte wide ranges which
- can't cross a 512 byte boundary. */
- region_size = 512;
- else
- region_size = hwdebug_info.data_bp_alignment;
+ {
+ /* DAWR interface allows to watch up to 512 byte wide ranges. */
+ region_size = 512;
+ /* DAWR interface allows to watch up to 512 byte wide ranges which
+ can't cross a 512 byte bondary on machines that doesn't have a
+ second DAWR (P9 or less). */
+ if (!(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_ARCH_31))
+ region_align = 512;
+ }
/* Server processors provide one hardware watchpoint and addr+len should
fall in the watchable region provided by the ptrace interface. */
- if (region_size
- && (addr + len > (addr & ~(region_size - 1)) + region_size))
+ if (region_align
+ && (addr + len > (addr & ~(region_align - 1)) + region_size))
return 0;
}
/* addr+len must fall in the 8 byte watchable region for DABR-based

View File

@ -0,0 +1,453 @@
[gdb/python] FinishBreakPoint update
I.
Consider the python gdb.FinishBreakpoint class, an extension of the
gdb.Breakpoint class.
It sets a temporary breakpoint on the return address of a frame.
This type of breakpoints is thread-specific.
II.
If the FinishBreakpoint is hit, it is deleted, and the method return_value
can be used to get the value returned by the function.
Let's demonstrate this:
...
$ cat -n test.c
1 int foo (int a) { return a + 2; }
2 int main () { return foo (1); }
$ gcc -g test.c
$ gdb -q -batch a.out -ex "set trace-commands on" -ex "tbreak foo" -ex run \
-ex "python bp = gdb.FinishBreakpoint()" -ex "info breakpoints" \
-ex continue -ex "info breakpoints" -ex "python print (bp.return_value)"
+tbreak foo
Temporary breakpoint 1 at 0x40049e: file test.c, line 1.
+run
Temporary breakpoint 1, foo (a=1) at test.c:1
1 int foo (int a) { return a + 2; }
+python bp = gdb.FinishBreakpoint()
Temporary breakpoint 2 at 0x4004b4: file test.c, line 2.
+info breakpoints
Num Type Disp Enb Address What
2 breakpoint del y 0x004004b4 in main at test.c:2 thread 1
stop only in thread 1
+continue
Temporary breakpoint 2, 0x004004b4 in main () at test.c:2
2 int main () { return foo (1); }
+info breakpoints
No breakpoints or watchpoints.
+python print (bp.return_value)
3
...
III.
Another possibility is that the FinishBreakpoint is not hit, because the
function did not terminate, f.i. because of longjmp, C++ exceptions, or GDB
return command.
Let's demonstrate this, using C++ exceptions:
...
$ cat -n test.c
1 int foo (int a) { throw 1; return a + 2; }
2 int main () {
3 try { return foo (1); } catch (...) {};
4 return 1;
5 }
$ g++ -g test.c
$ gdb -q -batch a.out -ex "set trace-commands on" -ex "tbreak foo" -ex run \
-ex "python bp = gdb.FinishBreakpoint()" -ex "info breakpoints" \
-ex continue -ex "info breakpoints" -ex "python print (bp.return_value)"
+tbreak foo
Temporary breakpoint 1 at 0x400712: file test.c, line 1.
+run
Temporary breakpoint 1, foo (a=1) at test.c:1
1 int foo (int a) { throw 1; return a + 2; }
+python bp = gdb.FinishBreakpoint()
Temporary breakpoint 2 at 0x400742: file test.c, line 3.
+info breakpoints
Num Type Disp Enb Address What
2 breakpoint del y 0x00400742 in main() at test.c:3 thread 1
stop only in thread 1
+continue
[Inferior 1 (process 25269) exited with code 01]
Thread-specific breakpoint 2 deleted - thread 1 no longer in the thread list.
+info breakpoints
No breakpoints or watchpoints.
+python print (bp.return_value)
None
...
Indeed, we do not hit the FinishBreakpoint. Instead, it's deleted when the
thread disappears, like any other thread-specific breakpoint.
I think this is a bug: the deletion is meant to be handled by FinishBreakpoint
itself.
IV.
Fix aforementioned bug by:
- adding an observer of the thread_exit event in FinishBreakpoint
- making sure that this observer is called before the
remove_threaded_breakpoints observer of that same event.
This changes the behaviour to:
...
+continue
[Inferior 1 (process 30256) exited with code 01]
+info breakpoints
No breakpoints or watchpoints.
+python print (bp.return_value)
None
...
V.
An out_of_scope callback can be defined to make this more verbose:
...
$ cat fbp.py
class FBP(gdb.FinishBreakpoint):
def __init__(self):
gdb.FinishBreakpoint.__init__(self)
def out_of_scope(self):
try:
frame = gdb.selected_frame ()
sal = frame.find_sal ()
print ("out_of_scope triggered at %s:%s"
% (sal.symtab.fullname(), sal.line))
except gdb.error as e:
print ("out_of_scope triggered at thread/inferior exit")
...
and using that gets us:
...
+continue
[Inferior 1 (process 30742) exited with code 01]
out_of_scope triggered at thread/inferior exit
+info breakpoints
No breakpoints or watchpoints.
+python print (bp.return_value)
None
...
VI.
This out_of_scope event can be triggered earlier than inferior/thread exit.
Let's demonstrate this:
...
$ cat -n test.c
1 int bar (int a) { throw 1; return a + 2; }
2 int foo (int a) {
3 int res = a;
4 try
5 {
6 res += bar (1);
7 }
8 catch (...)
9 {
10 }
11 return res;
12 }
13 int main () {
14 int res = 0;
15 res += foo (1);
16 res += 2;
17 return res * 2;
18 }
$ g++ -g test.c
$ gdb -q -batch -ex "source fbp.py" a.out -ex "set trace-commands on" \
-ex "tbreak bar" -ex run -ex "python bp = FBP()" -ex "info breakpoints" \
-ex "tbreak 16" -ex continue -ex "info breakpoints" \
-ex "python print (bp.return_value)"
+tbreak bar
Temporary breakpoint 1 at 0x400712: file test.c, line 1.
+run
Temporary breakpoint 1, bar (a=1) at test.c:1
1 int bar (int a) { throw 1; return a + 2; }
+python bp = FBP()
Temporary breakpoint 2 at 0x40074f: file test.c, line 6.
+info breakpoints
Num Type Disp Enb Address What
2 breakpoint del y 0x0040074f in foo(int) at test.c:6 thread 1
stop only in thread 1
+tbreak 16
Temporary breakpoint 3 at 0x400784: file test.c, line 16.
+continue
Temporary breakpoint 3, main () at test.c:16
16 res += 2;
out_of_scope triggered at /home/vries/gdb_versions/devel/test.c:16
+info breakpoints
No breakpoints or watchpoints.
+python print (bp.return_value)
None
...
Note that the out_of_scope event triggers at the breakpoint we set at
test.c:16. If we'd set that breakpoint at line 17, the out_of_scope event
would trigger at line 17 instead.
Also note that it can't be triggered earlier, say by setting the breakpoint in
foo at line 11. We would get instead "out_of_scope triggered at
thread/inferior exit".
VII.
Now consider a reduced version of
src/gdb/testsuite/gdb.python/py-finish-breakpoint2.cc:
...
$ cat -n test.c
1 #include <iostream>
2
3 void
4 throw_exception_1 (int e)
5 {
6 throw new int (e);
7 }
8
9 int
10 main (void)
11 {
12 int i;
13 try
14 {
15 throw_exception_1 (10);
16 }
17 catch (const int *e)
18 {
19 std::cerr << "Exception #" << *e << std::endl;
20 }
21 i += 1;
22
23 return i;
24 }
$ g++ -g test.c
...
Now let's try to see if the FinishBreakPoint triggers:
...
$ gdb -q -batch -ex "source fbp.py" a.out -ex "set trace-commands on" \
-ex "tbreak throw_exception_1" -ex run -ex "python bp = FBP()" \
-ex "info breakpoints" -ex continue -ex "info breakpoints" \
-ex "python print (bp.return_value)"
+tbreak throw_exception_1
Temporary breakpoint 1 at 0x400bd5: file test.c, line 6.
+run
Temporary breakpoint 1, throw_exception_1 (e=10) at test.c:6
6 throw new int (e);
+python bp = FBP()
Temporary breakpoint 2 at 0x400c2f: file test.c, line 21.
+info breakpoints
Num Type Disp Enb Address What
2 breakpoint del y 0x00400c2f in main() at test.c:21 thread 1
stop only in thread 1
+continue
Exception #10
Temporary breakpoint 2, main () at test.c:21
21 i += 1;
+info breakpoints
No breakpoints or watchpoints.
+python print (bp.return_value)
None
...
Surprisingly, it did. The explanation is that FinishBreakPoint is really a
frame-return-address breakpoint, and that address happens to be at line 21,
which is still executed after the throw in throw_exception_1.
Interestingly, with -m32 the FinishBreakPoint doesn't trigger, because the
frame-return-address happens to be an instruction which is part of line 15.
VIII.
In conclusion, the FinishBreakpoint is a frame-return-address breakpoint.
After being set, either:
- it triggers, or
- an out-of-scope event will be generated.
If an out-of-scope event is generated, it will be due to incomplete function
termination.
OTOH, incomplete function termination does not guarantee an out-of-scope event
instead of hitting the breakpoint.
IX.
The documentation states that 'A finish breakpoint is a temporary breakpoint
set at the return address of a frame, based on the finish command'.
It's indeed somewhat similar to the finish command, at least in the sense that
both may stop at the frame-return-address.
But the finish command can accurately detect function termination.
And the finish command will stop at any other address that is the first
address not in the original function.
The documentation needs updating to accurately describe what it does.
X.
A better implementation of a finish breakpoint would be one that borrows from
the finish command implementation. That one:
- installs a thread_fsm, and
- continues
A finish breakpoint would do the same minus the continue, but it requires gdb
to handle multiple thread_fsms at a time (because other commands may wish to
install their own thread_fsm), which AFAICT is not supported yet.
XI.
This patch repairs a minor part of the functionality, and updates
documentation and test-cases to match actual behaviour.
The question remains how useful the functionality is, as it is now
( see f.i. discussion at
https://sourceware.org/pipermail/gdb-patches/2021-January/175290.html ).
Perhaps it would be better to deprecate this in a follow-up patch in some form
or another, say by disabling it by default and introducing a maintenance
command that switches it on, with the warning that it is deprecated.
Tested on x86_64-linux with native and target board unix/-m32, by rebuilding
and running the test-cases:
- gdb.python/py-finish-breakpoint.exp
- gdb.python/py-finish-breakpoint2.exp
---
gdb/breakpoint.c | 10 ++++++++++
gdb/doc/python.texi | 6 ++++--
gdb/python/py-finishbreakpoint.c | 21 +++++++++++++++++++++
gdb/testsuite/gdb.python/py-finish-breakpoint2.exp | 16 +++++++++++++---
4 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index dbbea6b8bff..64a9a3d394f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15452,6 +15452,10 @@ initialize_breakpoint_ops (void)
static struct cmd_list_element *enablebreaklist = NULL;
+#if HAVE_PYTHON
+extern gdb::observers::token bpfinishpy_handle_thread_exit_observer_token;
+#endif
+
/* See breakpoint.h. */
cmd_list_element *commands_cmd_element = nullptr;
@@ -16065,6 +16069,12 @@ This is useful for formatted output in user-defined commands."));
gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed,
"breakpoint");
+#if HAVE_PYTHON
+ gdb::observers::thread_exit.attach
+ (remove_threaded_breakpoints, "breakpoint",
+ { &bpfinishpy_handle_thread_exit_observer_token });
+#else
gdb::observers::thread_exit.attach (remove_threaded_breakpoints,
"breakpoint");
+#endif
}
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index f4865b3d6a6..17a67800ba2 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5698,7 +5698,7 @@ attribute is @code{None}. This attribute is writable.
@tindex gdb.FinishBreakpoint
A finish breakpoint is a temporary breakpoint set at the return address of
-a frame, based on the @code{finish} command. @code{gdb.FinishBreakpoint}
+a frame. @code{gdb.FinishBreakpoint}
extends @code{gdb.Breakpoint}. The underlying breakpoint will be disabled
and deleted when the execution will run out of the breakpoint scope (i.e.@:
@code{Breakpoint.stop} or @code{FinishBreakpoint.out_of_scope} triggered).
@@ -5717,7 +5717,9 @@ details about this argument.
In some circumstances (e.g.@: @code{longjmp}, C@t{++} exceptions, @value{GDBN}
@code{return} command, @dots{}), a function may not properly terminate, and
thus never hit the finish breakpoint. When @value{GDBN} notices such a
-situation, the @code{out_of_scope} callback will be triggered.
+situation, the @code{out_of_scope} callback will be triggered. Note
+though that improper function termination does not guarantee that the
+finish breakpoint is not hit.
You may want to sub-class @code{gdb.FinishBreakpoint} and override this
method:
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 1d8373d807e..a881103fdad 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -398,6 +398,24 @@ bpfinishpy_handle_exit (struct inferior *inf)
bpfinishpy_detect_out_scope_cb (bp, nullptr);
}
+/* Attached to `thread_exit' notifications, triggers all the necessary out of
+ scope notifications. */
+
+static void
+bpfinishpy_handle_thread_exit (struct thread_info *tp, int ignore)
+{
+ gdbpy_enter enter_py (target_gdbarch (), current_language);
+
+ for (breakpoint *bp : all_breakpoints_safe ())
+ {
+ if (tp->global_num == bp->thread)
+ bpfinishpy_detect_out_scope_cb (bp, nullptr);
+ }
+}
+
+extern gdb::observers::token bpfinishpy_handle_thread_exit_observer_token;
+gdb::observers::token bpfinishpy_handle_thread_exit_observer_token;
+
/* Initialize the Python finish breakpoint code. */
int
@@ -414,6 +432,9 @@ gdbpy_initialize_finishbreakpoints (void)
"py-finishbreakpoint");
gdb::observers::inferior_exit.attach (bpfinishpy_handle_exit,
"py-finishbreakpoint");
+ gdb::observers::thread_exit.attach
+ (bpfinishpy_handle_thread_exit,
+ bpfinishpy_handle_thread_exit_observer_token, "py-finishbreakpoint");
return 0;
}
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
index 58e086ad3b4..46c39d0d108 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
@@ -50,10 +50,20 @@ gdb_test "continue" "Breakpoint .*throw_exception_1.*" "run to exception 1"
gdb_test "python print (len(gdb.breakpoints()))" "3" "check BP count"
gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" \
"init ExceptionFinishBreakpoint" "set FinishBP after the exception"
-gdb_test "continue" ".*stopped at ExceptionFinishBreakpoint.*" "check FinishBreakpoint in catch()"
-gdb_test "python print (len(gdb.breakpoints()))" "3" "check finish BP removal"
-gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" "continue to second exception"
+gdb_test_multiple "continue" "continue after setting FinishBreakpoint" {
+ -re -wrap ".*stopped at ExceptionFinishBreakpoint.*" {
+ pass "$gdb_test_name (scenario 1, triggered)"
+ gdb_test "python print (len(gdb.breakpoints()))" "3" \
+ "check finish BP removal"
+ gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" \
+ "continue to second exception"
+ }
+ -re -wrap ".*Breakpoint.* throw_exception_1.*" {
+ pass "$gdb_test_name (scenario 2, not triggered)"
+ }
+}
+
gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" \
"init ExceptionFinishBreakpoint" "set FinishBP after the exception again"
gdb_test "continue" ".*exception did not finish.*" "FinishBreakpoint with exception thrown not caught"

View File

@ -81,7 +81,7 @@ diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/tes
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
@@ -0,0 +1,124 @@
@@ -0,0 +1,125 @@
+/* Testcase for recursive dlopen calls.
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
@ -178,6 +178,7 @@ new file mode 100644
+ /* Called recursively. */
+ result = malloc (size);
+ /* Restore new hooks. */
+ old_malloc_hook = __malloc_hook;
+ __malloc_hook = custom_malloc_hook;
+ return result;
+}
@ -210,7 +211,7 @@ diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/t
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
@@ -0,0 +1,137 @@
@@ -0,0 +1,157 @@
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
@ -226,8 +227,12 @@ new file mode 100644
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_shlib_tests] } {
+ return 0
+if {[skip_shlib_tests]} {
+ untested "skipping shlib tests"
+ return 0
+} elseif {[use_gdb_stub]} {
+ untested "skipping tests because of stub"
+ return 0
+}
+
+# Library foo
@ -262,6 +267,21 @@ new file mode 100644
+ return -1
+}
+
+set supported 0
+gdb_test_multiple "run" "initial trial run" {
+ -re -wrap "exited normally.*" {
+ set supported 1
+ pass $gdb_test_name
+ }
+ -re -wrap "exited with code.*" {
+ untested "failed at $gdb_test_name"
+ }
+}
+
+if { $supported == 0 } {
+ return -1
+}
+
+proc do_test { has_libfoo has_libbar } {
+ global hex binfile_lib2 binfile_lib1 gdb_prompt
+ set libbar_match "[string_to_regexp $binfile_lib2]"
@ -314,6 +334,7 @@ new file mode 100644
+ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
+
+ gdb_run_cmd
+ gdb_test "" "Wait for first prompt"
+ foreach l $solib_event_order {
+ incr pass
+ with_test_prefix "pass #$pass" {

View File

@ -42,22 +42,24 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.pytho
diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
--- a/gdb/testsuite/gdb.python/py-typeprint.py
+++ b/gdb/testsuite/gdb.python/py-typeprint.py
@@ -15,7 +15,7 @@
@@ -15,8 +15,7 @@
import gdb
-
-class Recognizer(object):
+class StringRecognizer(object):
def __init__(self):
self.enabled = True
@@ -30,6 +30,26 @@ class StringTypePrinter(object):
@@ -32,7 +31,27 @@ class StringTypePrinter(object):
self.enabled = True
def instantiate(self):
- return Recognizer()
+ return StringRecognizer()
gdb.type_printers.append(StringTypePrinter())
+
+class OtherRecognizer(object):

View File

@ -0,0 +1,30 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Wed, 29 Sep 2021 10:58:50 +0200
Subject: gdb-rhbz1976887-field-location-kind.patch
;;Backport upstream patch which fixes internal-error: Unexpected
;;type field location kind (RHBZ 1976887).
gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCK
The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for
switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error
under some circumstances.
Fixes bug 28030.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5571,6 +5571,10 @@ copy_type_recursive (struct objfile *objfile,
xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
i)));
break;
+ case FIELD_LOC_KIND_DWARF_BLOCK:
+ SET_FIELD_DWARF_BLOCK (new_type->field (i),
+ TYPE_FIELD_DWARF_BLOCK (type, i));
+ break;
default:
internal_error (__FILE__, __LINE__,
_("Unexpected type field location kind: %d"),

View File

@ -0,0 +1,185 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Mon, 11 Oct 2021 11:22:04 -0700
Subject: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
;; Backport gdb.fortran testsuite changes in order to avoid Fortran
;; lexical analyzer bug.
[gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp
When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed
(with glibc 2.34) I run into:
...
(gdb) ^M
PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array
Expecting: ^(-var-create array \* array[^M
]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M
]+[(]gdb[)] ^M
[ ]*)
-var-create array * array^M
&"Attempt to use a type name as an expression.\n"^M
^error,msg="-var-create: unable to create variable object"^M
(gdb) ^M
FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output)
...
The problem is that the name array is used both:
- as the name for a local variable
- as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included
by nss/nss_files/files-hosts.c.
Fix this by ignoring the shared lib symbols.
Likewise in a couple of other fortran tests.
Tested on x86_64-linux.
diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp
--- a/gdb/testsuite/gdb.fortran/allocated.exp
+++ b/gdb/testsuite/gdb.fortran/allocated.exp
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# Set all the breakpoints.
for { set i 1 } { $i < 6 } { incr i } {
gdb_breakpoint [gdb_get_line_number "Breakpoint $i"]
diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Stop Here"]
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -55,11 +55,17 @@ proc run_test { repack } {
clean_restart ${binfile}
+ # Avoid shared lib symbols.
+ gdb_test_no_output "set auto-solib-add off"
+
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+ # Avoid libc symbols, in particular the 'array' type.
+ gdb_test_no_output "nosharedlibrary"
+
gdb_test_no_output "set fortran repack-array-slices $repack"
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
@@ -25,12 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
gdb_breakpoint [gdb_get_line_number "Test Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -27,16 +27,17 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+# Avoid shared lib symbols.
+gdb_test_no_output "set auto-solib-add off"
if ![fortran_runto_main] then {
perror "couldn't run to main"
continue
}
+# Avoid libc symbols, in particular the 'array' type.
+gdb_test_no_output "nosharedlibrary"
+
# Try to set breakpoint at the last write statement.
set bp_location [gdb_get_line_number "str(:)"]
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -36,8 +36,14 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+# Avoid shared lib symbols.
+mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
+
mi_runto prog_array
+# Avoid libc symbols, in particular the 'array' type.
+mi_gdb_test "nosharedlibrary" ".*\\^done"
+
mi_create_varobj "array" "array" "create local variable array"

View File

@ -1,88 +0,0 @@
Save/restore file offset while reading notes in core file
A recent bug (RH BZ 1931344) has exposed a bug in the core file
build-ID support that I introduced a while ago. It is pretty
easy to demonstate the problem following a simplified procedure
outlined in that bug:
[shell1]
shell1$ /usr/libexec/qemu-kvm
[shell2]
shell2$ pkill -SEGV -x qemu-kvm
[shell1]
Segmentation fault (core dumped)
Load this core file into GDB without specifying an executable
(an unfortunate Fedora/RHEL-ism), and GDB will inform the user
to install debuginfo for the "missing" executable:
$ gdb -nx -q core.12345
...
Missing separate debuginfo for the main executable file
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/e2/e9c66d3117fb2bbb5b2be122f04f2664e5df54
Core was generated by `/usr/libexec/qemu-kvm'.
Program terminated with signal SIGSEGV, Segmentation fault.
...
The suggested build-ID is actaully for gmp not qemu-kvm. The problem
lies in _bfd_elf_core_find_build_id, where we loop over program headers
looking for note segments:
/* Read in program headers and parse notes. */
for (i = 0; i < i_ehdr.e_phnum; ++i, ++i_phdr)
{
Elf_External_Phdr x_phdr;
if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
goto fail;
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
if (i_phdr->p_type == PT_NOTE && i_phdr->p_filesz > 0)
{
elf_read_notes (abfd, offset + i_phdr->p_offset,
i_phdr->p_filesz, i_phdr->p_align);
if (abfd->build_id != NULL)
return TRUE;
}
elf_read_notes uses bfd_seek to forward the stream to the location of
the note segment. When control returns to _bfd_elf_core_fild_build_id,
the stream is no longer in the location looking at program headers, and
all subsequent reads will read from the wrong file offset.
To fix this, this patch marks the stream location and ensures
that it is restored after elf_read_notes is called.
bfd/ChangeLog
2021-03-26 Keith Seitz <keiths@redhat.com>
* elfcore.h (_bfd_elf_core_find_build_id): Seek file
offset of program headers after calling elf_read_notes.
---
bfd/elfcore.h | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 3015e582ef0..4e6383415f7 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -410,6 +410,13 @@ NAME(_bfd_elf, core_find_build_id)
{
elf_read_notes (abfd, offset + i_phdr->p_offset,
i_phdr->p_filesz, i_phdr->p_align);
+
+ /* Make sure ABFD returns to processing the program headers. */
+ if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff
+ + (i + 1) * sizeof (x_phdr)),
+ SEEK_SET) != 0)
+ goto fail;
+
if (abfd->build_id != NULL)
return TRUE;
}

View File

@ -1,45 +0,0 @@
From 80d1206d7fea6eb756183e2825abdfd0f00cd976 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Mon, 21 Jun 2021 11:38:23 +0200
Subject: [PATCH] gdb: Support DW_LLE_start_end
Without that it is impossible to debug on riscv64.
gdb/
PR symtab/27999
* dwarf2/loc.c (decode_debug_loclists_addresses): Support
DW_LLE_start_end.
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index b7e30e3cb4a..d57cdc165ba 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -255,9 +255,27 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
*new_ptr = loc_ptr;
return DEBUG_LOC_OFFSET_PAIR;
+ case DW_LLE_start_end:
+ if (loc_ptr + 2 * addr_size > buf_end)
+ return DEBUG_LOC_BUFFER_OVERFLOW;
+
+ if (signed_addr_p)
+ *low = extract_signed_integer (loc_ptr, addr_size, byte_order);
+ else
+ *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+
+ loc_ptr += addr_size;
+ if (signed_addr_p)
+ *high = extract_signed_integer (loc_ptr, addr_size, byte_order);
+ else
+ *high = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+
+ loc_ptr += addr_size;
+ *new_ptr = loc_ptr;
+ return DEBUG_LOC_START_END;
+
/* Following cases are not supported yet. */
case DW_LLE_startx_endx:
- case DW_LLE_start_end:
case DW_LLE_default_location:
default:
return DEBUG_LOC_INVALID_ENTRY;

View File

@ -0,0 +1,110 @@
[gdb/symtab] Add call_site_eq and call_site_hash
In commit b4c919f7525 "[gdb/symtab] Fix htab_find_slot call in
read_call_site_scope" , I removed the comment:
...
It must be the first field as we overload core_addr_hash and core_addr_eq for
it.
...
for field pc of struct call_site.
However, this was not tested, and when indeed moving field pc to the second
location, we run into a testsuite failure in gdb.trace/entry-values.exp.
This is caused by core_addr_eq (the eq_f function for the htab) being
called with a pointer to the pc field (as passed into htab_find_slot) and a
pointer to a hash table element. Now that pc is no longer the first field,
the pointer to hash table element no longer points to the pc field.
This could be fixed by simply reinstating the comment, but we're trying to
get rid of this kind of tricks that make refactoring more difficult.
Instead, fix this by:
- reverting commit b4c919f7525, apart from the comment removal, such that
we're passing a pointer to element to htab_find_slot
- updating the htab_find_slot call in compunit_symtab::find_call_site
in a similar manner
- adding a call_site_eq and call_site_hash, and using these in the hash table
instead of core_addr_eq and core_addr_hash.
Tested on x86_64-linux, both with and without a trigger patch that moves pc to
the second location in struct call_site.
---
gdb/dwarf2/read.c | 7 ++++---
gdb/gdbtypes.h | 15 +++++++++++++++
gdb/symtab.c | 5 ++++-
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index d3742bbce8c..7def1e246c4 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -13287,7 +13287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR pc, baseaddr;
struct attribute *attr;
- struct call_site *call_site;
+ struct call_site *call_site, call_site_local;
void **slot;
int nparams;
struct die_info *child_die;
@@ -13312,10 +13312,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc);
if (cu->call_site_htab == NULL)
- cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq,
+ cu->call_site_htab = htab_create_alloc_ex (16, call_site_hash, call_site_eq,
NULL, &objfile->objfile_obstack,
hashtab_obstack_allocate, NULL);
- slot = htab_find_slot (cu->call_site_htab, &pc, INSERT);
+ call_site_local.pc = pc;
+ slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
if (*slot != NULL)
{
complaint (_("Duplicate PC %s for DW_TAG_call_site "
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f2e077c70a2..77d1e66a6b1 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1806,6 +1806,21 @@ struct call_site
struct call_site_parameter parameter[1];
};
+static inline int
+call_site_eq (const void *a_, const void *b_)
+{
+ const struct call_site *a = (const call_site *)a_;
+ const struct call_site *b = (const call_site *)b_;
+ return core_addr_eq (&a->pc, &b->pc);
+}
+
+static inline hashval_t
+call_site_hash (const void *a_)
+{
+ const struct call_site *a = (const call_site *)a_;
+ return core_addr_hash (&a->pc);
+}
+
/* The type-specific info for TYPE_CODE_FIXED_POINT types. */
struct fixed_point_type_info
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 1d30c8fc7a8..fe430edadb2 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -334,10 +334,13 @@ search_domain_name (enum search_domain e)
call_site *
compunit_symtab::find_call_site (CORE_ADDR pc) const
{
+ struct call_site call_site_local;
if (m_call_site_htab == nullptr)
return nullptr;
- void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT);
+ call_site_local.pc = pc;
+ void **slot
+ = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT);
if (slot == nullptr)
return nullptr;

View File

@ -0,0 +1,317 @@
[gdb/symtab] C++-ify call_site
- add constructor
- add member function call_site::pc ()
Tested on x86_64-linux.
Co-Authored-By: Tom de Vries <tdevries@suse.de>
---
gdb/dwarf2/frame-tailcall.c | 4 +--
gdb/dwarf2/loc.c | 18 ++++++------
gdb/dwarf2/read.c | 27 +++++++++---------
gdb/gdbtypes.c | 9 ++++++
gdb/gdbtypes.h | 67 +++++++++++++++++++++++++++++----------------
gdb/symtab.c | 3 +-
6 files changed, 77 insertions(+), 51 deletions(-)
diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c
index f112b4ecca4..9fe498b0924 100644
--- a/gdb/dwarf2/frame-tailcall.c
+++ b/gdb/dwarf2/frame-tailcall.c
@@ -240,14 +240,14 @@ pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache)
gdb_assert (next_levels >= 0);
if (next_levels < chain->callees)
- return chain->call_site[chain->length - next_levels - 1]->pc;
+ return chain->call_site[chain->length - next_levels - 1]->pc ();
next_levels -= chain->callees;
/* Otherwise CHAIN->CALLEES are already covered by CHAIN->CALLERS. */
if (chain->callees != chain->length)
{
if (next_levels < chain->callers)
- return chain->call_site[chain->callers - next_levels - 1]->pc;
+ return chain->call_site[chain->callers - next_levels - 1]->pc ();
next_levels -= chain->callers;
}
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index d57cdc165ba..83b5fe1ac88 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -920,10 +920,10 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
{
struct bound_minimal_symbol msym;
- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
+ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
_("DW_AT_call_target is not specified at %s in %s"),
- paddress (call_site_gdbarch, call_site->pc),
+ paddress (call_site_gdbarch, call_site->pc ()),
(msym.minsym == NULL ? "???"
: msym.minsym->print_name ()));
@@ -932,12 +932,12 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
{
struct bound_minimal_symbol msym;
- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
+ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
_("DW_AT_call_target DWARF block resolving "
"requires known frame which is currently not "
"available at %s in %s"),
- paddress (call_site_gdbarch, call_site->pc),
+ paddress (call_site_gdbarch, call_site->pc ()),
(msym.minsym == NULL ? "???"
: msym.minsym->print_name ()));
@@ -966,11 +966,11 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
msym = lookup_minimal_symbol (physname, NULL, NULL);
if (msym.minsym == NULL)
{
- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
+ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
_("Cannot find function \"%s\" for a call site target "
"at %s in %s"),
- physname, paddress (call_site_gdbarch, call_site->pc),
+ physname, paddress (call_site_gdbarch, call_site->pc ()),
(msym.minsym == NULL ? "???"
: msym.minsym->print_name ()));
@@ -1076,7 +1076,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
static void
tailcall_dump (struct gdbarch *gdbarch, const struct call_site *call_site)
{
- CORE_ADDR addr = call_site->pc;
+ CORE_ADDR addr = call_site->pc ();
struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (addr - 1);
fprintf_unfiltered (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr),
@@ -1252,7 +1252,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
if (target_call_site)
{
- if (addr_hash.insert (target_call_site->pc).second)
+ if (addr_hash.insert (target_call_site->pc ()).second)
{
/* Successfully entered TARGET_CALL_SITE. */
@@ -1271,7 +1271,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
call_site = chain.back ();
chain.pop_back ();
- size_t removed = addr_hash.erase (call_site->pc);
+ size_t removed = addr_hash.erase (call_site->pc ());
gdb_assert (removed == 1);
target_call_site = call_site->tail_call_next;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 7def1e246c4..59ce3cf2b45 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -13287,7 +13287,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR pc, baseaddr;
struct attribute *attr;
- struct call_site *call_site, call_site_local;
void **slot;
int nparams;
struct die_info *child_die;
@@ -13312,10 +13311,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc);
if (cu->call_site_htab == NULL)
- cu->call_site_htab = htab_create_alloc_ex (16, call_site_hash, call_site_eq,
- NULL, &objfile->objfile_obstack,
+ cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash,
+ call_site::eq, NULL,
+ &objfile->objfile_obstack,
hashtab_obstack_allocate, NULL);
- call_site_local.pc = pc;
+ struct call_site call_site_local (pc, nullptr, nullptr);
slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
if (*slot != NULL)
{
@@ -13345,14 +13345,16 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
nparams++;
}
- call_site
- = ((struct call_site *)
- obstack_alloc (&objfile->objfile_obstack,
- sizeof (*call_site)
- + (sizeof (*call_site->parameter) * (nparams - 1))));
+ struct call_site *call_site
+ = new (XOBNEWVAR (&objfile->objfile_obstack,
+ struct call_site,
+ sizeof (*call_site) + sizeof (call_site->parameter[0]) * nparams))
+ struct call_site (pc, cu->per_cu, per_objfile);
*slot = call_site;
- memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter));
- call_site->pc = pc;
+
+ /* We never call the destructor of call_site, so we must ensure it is
+ trivially destructible. */
+ gdb_static_assert(std::is_trivially_destructible<struct call_site>::value);
if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu)
|| dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
@@ -13473,9 +13475,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
"block nor reference, for DIE %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
- call_site->per_cu = cu->per_cu;
- call_site->per_objfile = per_objfile;
-
for (child_die = die->child;
child_die && child_die->tag;
child_die = child_die->sibling)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 05ce646bc59..1b3ed1b32ed 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -37,6 +37,7 @@
#include "cp-support.h"
#include "bcache.h"
#include "dwarf2/loc.h"
+#include "dwarf2/read.h"
#include "gdbcore.h"
#include "floatformat.h"
#include "f-lang.h"
@@ -6301,6 +6302,14 @@ objfile_type (struct objfile *objfile)
return objfile_type;
}
+/* See gdbtypes.h. */
+
+CORE_ADDR
+call_site::pc () const
+{
+ return m_pc;
+}
+
void _initialize_gdbtypes ();
void
_initialize_gdbtypes ()
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 77d1e66a6b1..a071188ffa1 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1775,52 +1775,71 @@ struct call_site_parameter
struct call_site
{
- /* Address of the first instruction after this call. */
-
- CORE_ADDR pc;
+ call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile)
+ : per_cu (per_cu), per_objfile (per_objfile), m_pc (pc)
+ {}
+
+ static int
+ eq (const call_site *a, const call_site *b)
+ {
+ return core_addr_eq (&a->m_pc, &b->m_pc);
+ }
+
+ static hashval_t
+ hash (const call_site *a)
+ {
+ return core_addr_hash (&a->m_pc);
+ }
+
+ static int
+ eq (const void *a, const void *b)
+ {
+ return eq ((const call_site *)a, (const call_site *)b);
+ }
+
+ static hashval_t
+ hash (const void *a)
+ {
+ return hash ((const call_site *)a);
+ }
+
+ /* Return the address of the first instruction after this call. */
+
+ CORE_ADDR pc () const;
/* * List successor with head in FUNC_TYPE.TAIL_CALL_LIST. */
- struct call_site *tail_call_next;
+ struct call_site *tail_call_next = nullptr;
/* * Describe DW_AT_call_target. Missing attribute uses
FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */
- struct call_site_target target;
+ struct call_site_target target {};
/* * Size of the PARAMETER array. */
- unsigned parameter_count;
+ unsigned parameter_count = 0;
/* * CU of the function where the call is located. It gets used
for DWARF blocks execution in the parameter array below. */
- dwarf2_per_cu_data *per_cu;
+ dwarf2_per_cu_data *const per_cu = nullptr;
/* objfile of the function where the call is located. */
- dwarf2_per_objfile *per_objfile;
+ dwarf2_per_objfile *const per_objfile = nullptr;
+ private:
+ /* Address of the first instruction after this call. */
+ const CORE_ADDR m_pc;
+
+ public:
/* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */
- struct call_site_parameter parameter[1];
+ struct call_site_parameter parameter[];
};
-static inline int
-call_site_eq (const void *a_, const void *b_)
-{
- const struct call_site *a = (const call_site *)a_;
- const struct call_site *b = (const call_site *)b_;
- return core_addr_eq (&a->pc, &b->pc);
-}
-
-static inline hashval_t
-call_site_hash (const void *a_)
-{
- const struct call_site *a = (const call_site *)a_;
- return core_addr_hash (&a->pc);
-}
-
/* The type-specific info for TYPE_CODE_FIXED_POINT types. */
struct fixed_point_type_info
diff --git a/gdb/symtab.c b/gdb/symtab.c
index fe430edadb2..14cc2b5bd8d 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -334,11 +334,10 @@ search_domain_name (enum search_domain e)
call_site *
compunit_symtab::find_call_site (CORE_ADDR pc) const
{
- struct call_site call_site_local;
if (m_call_site_htab == nullptr)
return nullptr;
- call_site_local.pc = pc;
+ struct call_site call_site_local (pc, nullptr, nullptr);
void **slot
= htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT);
if (slot == nullptr)

View File

@ -0,0 +1,68 @@
[gdb/symtab] Fix htab_find_slot call in read_call_site_scope
In read_call_site_scope we have:
...
call_site_local.pc = pc;
slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
...
The call passes a call_site pointer as element. OTOH, the hashtab is created
using hash_f == core_addr_hash and eq_f == core_addr_eq, so the element
will be accessed through a CORE_ADDR pointer.
This is not wrong (at least in C), given that pc is the first field in
call_site.
Nevertheless, as in call_site_for_pc, make the htab_find_slot call match the
used hash_f and eq_f by using &pc instead:
...
slot = htab_find_slot (cu->call_site_htab, &pc, INSERT);
...
Tested on x86_64-linux.
Co-Authored-By: Tom de Vries <tdevries@suse.de>
---
gdb/dwarf2/read.c | 5 ++---
gdb/gdbtypes.h | 4 +---
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 0ce39eb9274..892d31dddf3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -13287,7 +13287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct gdbarch *gdbarch = objfile->arch ();
CORE_ADDR pc, baseaddr;
struct attribute *attr;
- struct call_site *call_site, call_site_local;
+ struct call_site *call_site;
void **slot;
int nparams;
struct die_info *child_die;
@@ -13315,8 +13315,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq,
NULL, &objfile->objfile_obstack,
hashtab_obstack_allocate, NULL);
- call_site_local.pc = pc;
- slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
+ slot = htab_find_slot (cu->call_site_htab, &pc, INSERT);
if (*slot != NULL)
{
complaint (_("Duplicate PC %s for DW_TAG_call_site "
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 0cc00e74a20..f2e077c70a2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1775,9 +1775,7 @@ struct call_site_parameter
struct call_site
{
- /* * Address of the first instruction after this call. It must be
- the first field as we overload core_addr_hash and core_addr_eq
- for it. */
+ /* Address of the first instruction after this call. */
CORE_ADDR pc;

Some files were not shown because too many files have changed in this diff Show More