Accepting request 991863 from home:tomdevries:branches:devel:gcc-gdb-gdb-12-1-update
- Maintenance script qa.sh: * Add SLE-12/x86_64 to "known clean configs". * Add fail for PR29405. * Add fail for PR26915. - Patches added: * gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch - Maintenance script qa.sh: * Remove PR29247 internal-error. * Add SLE-15/aarch64 to "known clean configs". - Patches added: * gdb-fix-watchpoints-triggered.patch - Maintenance script qa.sh: * Add kfails for PR25038, PR29253, and PR29423. * Remove gdb.mi/mi-var-invalidate-shlib.exp kfails. - Mention qa-local.sh, qa-remote.sh and README.qa as sources. - Maintenance script qa-local.sh: * Use have_combo consistently. - Maintenance script qa.sh: * Add kfail_aarch64. * Add PR29419/PR29409 kfails. * Update PR29247 kfails. - Patches added: * make-gdb.ada-float-bits.exp-more-generic.patch * gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch - Actually apply fixup-gdb-test-bt-cfi-without-die.patch and fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch. - Also remove gdb-6.5-readline-long-line-crash-test.patch from patches list in gdb.spec. - Patches added: * powerpc-add-support-for-ieee-128-bit-format.patch * powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch * gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch * powerpc-fix-for-gdb.base-eh_return.exp.patch * fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch * gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch * fixup-gdb-test-bt-cfi-without-die.patch * fix-core-file-detach-crash-corefiles-29275.patch * gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch * gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch * gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch * fix-for-gdb.base-solib-search.exp-test.patch - Patch removed: * gdb-6.7-ppc-clobbered-registers-O2-test.patch * gdb-6.5-readline-long-line-crash-test.patch - Patches updated: * gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch * gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch - Maintenance script qa.sh: * Add PR28504 KFAILs. * Make .sum file matching less complex. * Add fedora test-case kfail. - Maintenance script qa-local.sh: * Fix incorrect path name. - Update comments in gdb.spec. - Patches added: * powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch - Patches updated: * gdb-testsuite-support-recording-of-getrandom.patch (add aarch64 part) - Maintenance script qa.sh: * Add i586 to known clean configs. - Patches added: * gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch * gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch * gdb-testsuite-support-recording-of-getrandom.patch - Patches updated: * gdb-record-handle-statx-system-call.patch - Maintenance script qa.sh: * Allow only two summary files, for i586. * Add i586 KFAILs. - Maintenance script qa-local.sh: * Add i586. - Maintenance script qa-local.sh: * Fix rpm pathname. - Maintenance script qa-remote.sh: * Skip stale config openSUSE_Leap_15.2. - Maintenance script qa.sh: * Drop known clean config: Leap 15.2 x86_64. - Maintenance script qa-local.sh: * Add cleanup step. * Add "build all configs without testsuite" step. * For "build all configs with testsuite" step, redirect output to log and produce PASS/FAIL line, and make sure buildroot is removed also in case of missing rpm. * Use "--clean --trust-all-projects" for osc build commands. * Drop openSUSE_Leap_15.2. - Maintenance script qa.sh: * Rename argument 6 to -local. * Add PR29247 KFAILs. * Update internal-error regexps. - New maintenance script qa-remote.sh. - Add "build all configs without testsuite" step in README.qa. - Patches added (backport from trunk): * gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch - README.qa: * Add remote qa entry. * Update local qa entry: * Add notes entry. * Other updates to match changes in qa-local.sh. - Fix installed but unpackaged /usr/share/info/ctf-spec.info.gz. - Rebase to 12.1 release (as in fedora 36 @ 89947a7): * DBX mode is deprecated, and will be removed in GDB 13. * GDB 12 is the last release of GDB that will support building against Python 2. From GDB 13, it will only be possible to build GDB itself with Python 3 support. * Improved C++ template support: GDB now treats functions/types involving C++ templates like it does function overloads. Users may omit parameter lists to set breakpoints on families of template functions, including types/functions composed of multiple template types: (gdb) break template_func(template_1, int) The above will set breakpoints at every function `template_func' where the first function parameter is any template type named `template_1' and the second function parameter is `int'. TAB completion also gains similar improvements. * New commands: maint set backtrace-on-fatal-signal on|off maint show backtrace-on-fatal-signal This setting is 'on' by default. When 'on' GDB will print a limited backtrace to stderr in the situation where GDB terminates with a fatal signal. This only supported on some platforms where the backtrace and backtrace_symbols_fd functions are available. set source open on|off show source open This setting, which is on by default, controls whether GDB will try to open source code files. Switching this off will stop GDB trying to open and read source code files, which can be useful if the files are located over a slow network connection. set varsize-limit show varsize-limit These are now deprecated aliases for "set max-value-size" and "show max-value-size". task apply [all | TASK-IDS...] [FLAG]... COMMAND Like "thread apply", but applies COMMAND to Ada tasks. watch [...] task ID Watchpoints can now be restricted to a specific Ada task. maint set internal-error backtrace on|off maint show internal-error backtrace maint set internal-warning backtrace on|off maint show internal-warning backtrace GDB can now print a backtrace of itself when it encounters either an internal-error, or an internal-warning. This is on by default for internal-error and off by default for internal-warning. set logging on|off Deprecated and replaced by "set logging enabled on|off". set logging enabled on|off show logging enabled These commands set or show whether logging is enabled or disabled. exit You can now exit GDB by using the new command "exit", in addition to the existing "quit" command. set debug threads on|off show debug threads Print additional debug messages about thread creation and deletion. set debug linux-nat on|off show debug linux-nat These new commands replaced the old 'set debug lin-lwp' and 'show debug lin-lwp' respectively. Turning this setting on prints debug messages relating to GDB's handling of native Linux inferiors. maint flush source-cache Flush the contents of the source code cache. maint set gnu-source-highlight enabled on|off maint show gnu-source-highlight enabled Whether GDB should use the GNU Source Highlight library for adding styling to source code. When off, the library will not be used, even when available. When GNU Source Highlight isn't used, or can't add styling to a particular source file, then the Python Pygments library will be used instead. set suppress-cli-notifications (on|off) show suppress-cli-notifications This controls whether printing the notifications is suppressed for CLI. CLI notifications occur when you change the selected context (i.e., the current inferior, thread and/or the frame), or when the program being debugged stops (e.g., because of hitting a breakpoint, completing source-stepping, an interrupt, etc.). set style disassembler enabled on|off show style disassembler enabled If GDB is compiled with Python support, and the Python Pygments package is available, then, when this setting is on, disassembler output will have styling applied. set ada source-charset show ada source-charset Set the character set encoding that is assumed for Ada symbols. Valid values for this follow the values that can be passed to the GNAT compiler via the '-gnati' option. The default is ISO-8859-1. * Changed commands: print Printing of floating-point values with base-modifying formats like /x has been changed to display the underlying bytes of the value in the desired base. This was GDB's documented behavior, but was never implemented correctly. maint packet This command can now print a reply, if the reply includes non-printable characters. Any non-printable characters are printed as escaped hex, e.g. \x?? where '??' is replaces with the value of the non-printable character. clone-inferior The clone-inferior command now ensures that the TTY, CMD and ARGS settings are copied from the original inferior to the new one. All modifications to the environment variables done using the 'set environment' or 'unset environment' commands are also copied to the new inferior. set debug lin-lwp on|off show debug lin-lwp These commands have been removed from GDB. The new command 'set debug linux-nat' and 'show debug linux-nat' should be used instead. info win This command now includes information about the width of the tui windows in its output. * GDB's Ada parser now supports an extension for specifying the exact byte contents of a floating-point literal. This can be useful for setting floating-point registers to a precise value without loss of precision. The syntax is an extension of the based literal syntax. Use, e.g., "16lf#0123abcd#" -- the number of "l"s controls the width of the floating-point type, and the "f" is the marker for floating point. * MI changes: ** The '-add-inferior' with no option flags now inherits the connection of the current inferior, this restores the behaviour of GDB as it was prior to GDB 10. ** The '-add-inferior' command now accepts a '--no-connection' option, which causes the new inferior to start without a connection. * Python API: ** New function gdb.add_history(), which takes a gdb.Value object and adds the value it represents to GDB's history list. An integer, the index of the new item in the history list, is returned. ** New function gdb.history_count(), which returns the number of values in GDB's value history. ** New gdb.events.gdb_exiting event. This event is called with a gdb.GdbExitingEvent object which has the read-only attribute 'exit_code', which contains the value of the GDB exit code. This event is triggered once GDB decides it is going to exit, but before GDB starts to clean up its internal state. ** New function gdb.architecture_names(), which returns a list containing all of the possible Architecture.name() values. Each entry is a string. ** New function gdb.Architecture.integer_type(), which returns an integer type given a size and a signed-ness. ** New gdb.TargetConnection object type that represents a connection (as displayed by the 'info connections' command). A sub-class, gdb.RemoteTargetConnection, is used to represent 'remote' and 'extended-remote' connections. ** The gdb.Inferior type now has a 'connection' property which is an instance of gdb.TargetConnection, the connection used by this inferior. This can be None if the inferior has no connection. ** New 'gdb.events.connection_removed' event registry, which emits a 'gdb.ConnectionEvent' when a connection is removed from GDB. This event has a 'connection' property, a gdb.TargetConnection object for the connection being removed. ** New gdb.connections() function that returns a list of all currently active connections. ** New gdb.RemoteTargetConnection.send_packet(PACKET) method. This is equivalent to the existing 'maint packet' CLI command; it allows a user specified packet to be sent to the remote target. ** New function gdb.host_charset(), returns a string, which is the name of the current host charset. ** New gdb.set_parameter(NAME, VALUE). This sets the gdb parameter NAME to VALUE. ** New gdb.with_parameter(NAME, VALUE). This returns a context manager that temporarily sets the gdb parameter NAME to VALUE, then resets it when the context is exited. ** The gdb.Value.format_string method now takes a 'styling' argument, which is a boolean. When true, the returned string can include escape sequences to apply styling. The styling will only be present if styling is otherwise turned on in GDB (see 'help set styling'). When false, which is the default if the argument is not given, then no styling is applied to the returned string. ** New read-only attribute gdb.InferiorThread.details, which is either a string, containing additional, target specific thread state information, or None, if there is no such additional information. ** New read-only attribute gdb.Type.is_scalar, which is True for scalar types, and False for all other types. ** New read-only attribute gdb.Type.is_signed. This attribute should only be read when Type.is_scalar is True, and will be True for signed types, and False for all other types. Attempting to read this attribute for non-scalar types will raise a ValueError. ** It is now possible to add GDB/MI commands implemented in Python. - Update libipt to v2.0.5. - Patches added: * gdb-6.3-rh-testversion-20041202.patch * gdb-6.5-BEA-testsuite.patch * gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch * gdb-6.7-charsign-test.patch * gdb-6.8-bz466901-backtrace-full-prelinked.patch * gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch * gdb-improved-eof-handling-when-using-readline-7.patch * gdb-libexec-add-index.patch * gdb-tdep-detect-get_pc_thunk-call-in-i386-prologue.patch * gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch * gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch * gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch * gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch * gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch * gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch * gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch * gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch * gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch * gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch - Patches dropped: * aarch64-make-gdbserver-register-set-selection-dynamic.patch * fix-build-with-current-gcc-el_explicit-location-always-non-null.patch * fix-gdb.base-sigstep.exp-test-for-ppc.patch * fix-gdb.multi-multi-term-settings.exp-race.patch * fixup-2-gdb-6.6-buildid-locate.patch * fixup-gdb-6.6-buildid-locate.patch * gdb-6.3-inferior-notification-20050721.patch * gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch * gdb-build-add-cxx_dialect-to-cxx.patch * gdb-build-make-c-exp.y-work-with-bison-3.8.patch * gdb-doc-fix-print-inferior-events-default.patch * gdb-exp-improve-error-reading-variable-message.patch * gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch * gdb-r_version-check.patch * gdb-rhbz1976887-field-location-kind.patch * gdb-rhbz2012976-paper-over-fortran-lex-problems.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-fix-segfault-in-search_one_symtab.patch * gdb-symtab-remove-compunit_call_site_htab.patch * gdb-symtab-use-unrelocated-addresses-in-call_site.patch * gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch * gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch * gdb-test-for-rhbz1976887.patch * gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch * gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch * gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch * gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch * gdb-testsuite-add-nopie-in-two-test-cases.patch * gdb-testsuite-detect-no-mpx-support.patch * gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch * gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch * gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch * gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch * gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch * gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch * gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch * gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch * gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch * gdb-testsuite-fix-gdb.gdb-selftest.exp.patch * gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.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-fix-gdb.threads-linux-dp.exp.patch * gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch * gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch * gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch * gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.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-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch * gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch * gdb-testsuite-make-gdb.base-annota1.exp-more-robust.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-update-test-gdb.base-step-over-syscall.exp.patch * gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch * gdb-tui-fix-breakpoint-display-functionality.patch * ibm-z-add-another-arch14-instruction.patch * ibm-z-remove-lpswey-parameter.patch - Patched updated: * gdb-6.3-gstack-20050411.patch * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch * gdb-6.6-buildid-locate-rpm-librpm-workaround.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-cli-add-ignore-errors-command.patch * gdb-container-rh-pkg.patch * gdb-core-open-vdso-warning.patch * gdb-fedora-libncursesw.patch * gdb-gcore-bash.patch * gdb-linux_perf-bundle.patch * gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch - Add BuildRequires python-xml. - Maintenance script qa.sh: * Add -sle-12 and -factory options. * Handle *.-fPIE.-pie.sum files. * Add KFAILs for PRs 26292, 29238, 25059, 29240, 29241, 29244, 29245, 29160, 29196. * Move PR27539 KFAILs from kfail_factory to kfail. - New maintenance script qa-local.sh. - New file README.qa. OBS-URL: https://build.opensuse.org/request/show/991863 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=325
This commit is contained in:
parent
2c87434182
commit
c8226c1e04
117
README.qa
Normal file
117
README.qa
Normal file
@ -0,0 +1,117 @@
|
||||
I. LOCAL QA.
|
||||
|
||||
|
||||
0. Notes.
|
||||
|
||||
Note that the configs are hardcoded in the script. F.i. atm SLE-11 is not
|
||||
included, because the config is unresolvable on devel:gcc/gdb. Also Leap
|
||||
15.2 is not included because of 'remote error: unknown repository type
|
||||
UNDEFINED"'.
|
||||
|
||||
The script tries to keep disk usage low by removing the buildroot after each
|
||||
build, but that requires sudo rights, so the first thing the script does is
|
||||
ask for sudo authentication.
|
||||
|
||||
|
||||
1. Cleanup.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-local.sh 1
|
||||
...
|
||||
|
||||
|
||||
2. Build.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-local.sh 2
|
||||
...
|
||||
|
||||
This builds gdb for each x86_64 config, without running the testsuite.
|
||||
|
||||
I did a timing run on my laptop (with 6 configs) and got:
|
||||
...
|
||||
real 66m17.689s
|
||||
user 149m31.925s
|
||||
sys 12m25.359s
|
||||
...
|
||||
so for a dual-core/4-SMT CPU, it's ~1h5m.
|
||||
|
||||
|
||||
3. Build & test.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-local.sh 3
|
||||
...
|
||||
|
||||
This builds gdb and produces test results for each x86_64 config.
|
||||
|
||||
I did a timing run on my laptop (with 6 configs) and got:
|
||||
...
|
||||
real 285m9.679s
|
||||
user 683m16.769s
|
||||
sys 133m58.287s
|
||||
...
|
||||
so for a dual-core/4-SMT CPU, it's ~4h45m.
|
||||
|
||||
The resulting testlogs (with 6 configs) is 1.4GB.
|
||||
|
||||
|
||||
4. Verify.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-local.sh 4
|
||||
...
|
||||
|
||||
This verifies the test results for each x86_64 config, using the qa.sh script.
|
||||
|
||||
|
||||
5. Cleanup.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ rm -Rf tmp-qa-local
|
||||
...
|
||||
l
|
||||
|
||||
|
||||
I. REMOTE QA.
|
||||
|
||||
|
||||
1. Cleanup.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-remote.sh 1
|
||||
...
|
||||
|
||||
|
||||
2. Get test results.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-remote.sh 2
|
||||
...
|
||||
|
||||
This downloads the remote test results.
|
||||
|
||||
|
||||
3. Verify.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ bash qa-remote.sh 3 <m>
|
||||
...
|
||||
with m running from 1 to 5.
|
||||
|
||||
This verifies the test results, using the qa.sh script.
|
||||
|
||||
4. Cleanup.
|
||||
|
||||
Do:
|
||||
...
|
||||
$ rm -Rf tmp-qa-remote
|
||||
...
|
@ -1,314 +0,0 @@
|
||||
[AArch64] Make gdbserver register set selection dynamic
|
||||
|
||||
The current register set selection mechanism for AArch64 is static, based
|
||||
on a pre-populated array of register sets.
|
||||
|
||||
This means that we might potentially probe register sets that are not
|
||||
available. This is OK if the kernel errors out during ptrace, but probing the
|
||||
tag_ctl register, for example, does not result in a ptrace error if the kernel
|
||||
supports the tagged address ABI but not MTE (PR 28355).
|
||||
|
||||
Making the register set selection dynamic, based on feature checks, solves
|
||||
this and simplifies the code a bit. It allows us to list all of the register
|
||||
sets only once, and pick and choose based on HWCAP/HWCAP2 or other properties.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
2021-11-03 Luis Machado <luis.machado@linaro.org>
|
||||
|
||||
PR gdb/28355
|
||||
|
||||
* arch/aarch64.h (struct aarch64_features): New struct.
|
||||
|
||||
gdbserver/ChangeLog:
|
||||
|
||||
2021-11-03 Luis Machado <luis.machado@linaro.org>
|
||||
|
||||
PR gdb/28355
|
||||
|
||||
* linux-aarch64-low.cc (is_sve_tdesc): Remove.
|
||||
(aarch64_target::low_arch_setup): Rework to adjust the register sets.
|
||||
(aarch64_regsets): Update to list all register sets.
|
||||
(aarch64_regsets_info, regs_info_aarch64): Replace NULL with nullptr.
|
||||
(aarch64_sve_regsets, aarch64_sve_regsets_info)
|
||||
(regs_info_aarch64_sve): Remove.
|
||||
(aarch64_adjust_register_sets): New.
|
||||
(aarch64_target::get_regs_info): Remove references to removed structs.
|
||||
(initialize_low_arch): Likewise.
|
||||
|
||||
---
|
||||
gdb/ChangeLog | 6 ++
|
||||
gdb/arch/aarch64.h | 9 ++
|
||||
gdbserver/ChangeLog | 14 ++++
|
||||
gdbserver/linux-aarch64-low.cc | 186 ++++++++++++++++++++++-------------------
|
||||
4 files changed, 130 insertions(+), 85 deletions(-)
|
||||
|
||||
diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
|
||||
index 0eb702c5b5e..95edb664b55 100644
|
||||
--- a/gdb/arch/aarch64.h
|
||||
+++ b/gdb/arch/aarch64.h
|
||||
@@ -22,6 +22,15 @@
|
||||
|
||||
#include "gdbsupport/tdesc.h"
|
||||
|
||||
+/* Holds information on what architectural features are available. This is
|
||||
+ used to select register sets. */
|
||||
+struct aarch64_features
|
||||
+{
|
||||
+ bool sve = false;
|
||||
+ bool pauth = false;
|
||||
+ bool mte = false;
|
||||
+};
|
||||
+
|
||||
/* Create the aarch64 target description. A non zero VQ value indicates both
|
||||
the presence of SVE and the Vector Quotient - the number of 128bit chunks in
|
||||
an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH
|
||||
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
|
||||
index daccfef746e..9a8cb4169a7 100644
|
||||
--- a/gdbserver/linux-aarch64-low.cc
|
||||
+++ b/gdbserver/linux-aarch64-low.cc
|
||||
@@ -196,16 +196,6 @@ is_64bit_tdesc (void)
|
||||
return register_size (regcache->tdesc, 0) == 8;
|
||||
}
|
||||
|
||||
-/* Return true if the regcache contains the number of SVE registers. */
|
||||
-
|
||||
-static bool
|
||||
-is_sve_tdesc (void)
|
||||
-{
|
||||
- struct regcache *regcache = get_thread_regcache (current_thread, 0);
|
||||
-
|
||||
- return tdesc_contains_feature (regcache->tdesc, "org.gnu.gdb.aarch64.sve");
|
||||
-}
|
||||
-
|
||||
static void
|
||||
aarch64_fill_gregset (struct regcache *regcache, void *buf)
|
||||
{
|
||||
@@ -680,40 +670,6 @@ aarch64_target::low_new_fork (process_info *parent,
|
||||
*child->priv->arch_private = *parent->priv->arch_private;
|
||||
}
|
||||
|
||||
-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */
|
||||
-#define AARCH64_HWCAP_PACA (1 << 30)
|
||||
-
|
||||
-/* Implementation of linux target ops method "low_arch_setup". */
|
||||
-
|
||||
-void
|
||||
-aarch64_target::low_arch_setup ()
|
||||
-{
|
||||
- unsigned int machine;
|
||||
- int is_elf64;
|
||||
- int tid;
|
||||
-
|
||||
- tid = lwpid_of (current_thread);
|
||||
-
|
||||
- is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
|
||||
-
|
||||
- if (is_elf64)
|
||||
- {
|
||||
- uint64_t vq = aarch64_sve_get_vq (tid);
|
||||
- unsigned long hwcap = linux_get_hwcap (8);
|
||||
- unsigned long hwcap2 = linux_get_hwcap2 (8);
|
||||
- bool pauth_p = hwcap & AARCH64_HWCAP_PACA;
|
||||
- /* MTE is AArch64-only. */
|
||||
- bool mte_p = hwcap2 & HWCAP2_MTE;
|
||||
-
|
||||
- current_process ()->tdesc
|
||||
- = aarch64_linux_read_description (vq, pauth_p, mte_p);
|
||||
- }
|
||||
- else
|
||||
- current_process ()->tdesc = aarch32_linux_read_description ();
|
||||
-
|
||||
- aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
|
||||
-}
|
||||
-
|
||||
/* Wrapper for aarch64_sve_regs_copy_to_reg_buf. */
|
||||
|
||||
static void
|
||||
@@ -730,21 +686,36 @@ aarch64_sve_regs_copy_from_regcache (struct regcache *regcache, void *buf)
|
||||
return aarch64_sve_regs_copy_from_reg_buf (regcache, buf);
|
||||
}
|
||||
|
||||
+/* Array containing all the possible register sets for AArch64/Linux. During
|
||||
+ architecture setup, these will be checked against the HWCAP/HWCAP2 bits for
|
||||
+ validity and enabled/disabled accordingly.
|
||||
+
|
||||
+ Their sizes are set to 0 here, but they will be adjusted later depending
|
||||
+ on whether each register set is available or not. */
|
||||
static struct regset_info aarch64_regsets[] =
|
||||
{
|
||||
+ /* GPR registers. */
|
||||
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
|
||||
- sizeof (struct user_pt_regs), GENERAL_REGS,
|
||||
+ 0, GENERAL_REGS,
|
||||
aarch64_fill_gregset, aarch64_store_gregset },
|
||||
+ /* Floating Point (FPU) registers. */
|
||||
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
|
||||
- sizeof (struct user_fpsimd_state), FP_REGS,
|
||||
+ 0, FP_REGS,
|
||||
aarch64_fill_fpregset, aarch64_store_fpregset
|
||||
},
|
||||
+ /* Scalable Vector Extension (SVE) registers. */
|
||||
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
|
||||
+ 0, EXTENDED_REGS,
|
||||
+ aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache
|
||||
+ },
|
||||
+ /* PAC registers. */
|
||||
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
|
||||
- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS,
|
||||
- NULL, aarch64_store_pauthregset },
|
||||
+ 0, OPTIONAL_REGS,
|
||||
+ nullptr, aarch64_store_pauthregset },
|
||||
+ /* Tagged address control / MTE registers. */
|
||||
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
|
||||
- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset,
|
||||
- aarch64_store_mteregset },
|
||||
+ 0, OPTIONAL_REGS,
|
||||
+ aarch64_fill_mteregset, aarch64_store_mteregset },
|
||||
NULL_REGSET
|
||||
};
|
||||
|
||||
@@ -752,47 +723,95 @@ static struct regsets_info aarch64_regsets_info =
|
||||
{
|
||||
aarch64_regsets, /* regsets */
|
||||
0, /* num_regsets */
|
||||
- NULL, /* disabled_regsets */
|
||||
+ nullptr, /* disabled_regsets */
|
||||
};
|
||||
|
||||
static struct regs_info regs_info_aarch64 =
|
||||
{
|
||||
- NULL, /* regset_bitmap */
|
||||
- NULL, /* usrregs */
|
||||
+ nullptr, /* regset_bitmap */
|
||||
+ nullptr, /* usrregs */
|
||||
&aarch64_regsets_info,
|
||||
};
|
||||
|
||||
-static struct regset_info aarch64_sve_regsets[] =
|
||||
+/* Given FEATURES, adjust the available register sets by setting their
|
||||
+ sizes. A size of 0 means the register set is disabled and won't be
|
||||
+ used. */
|
||||
+
|
||||
+static void
|
||||
+aarch64_adjust_register_sets (const struct aarch64_features &features)
|
||||
{
|
||||
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
|
||||
- sizeof (struct user_pt_regs), GENERAL_REGS,
|
||||
- aarch64_fill_gregset, aarch64_store_gregset },
|
||||
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
|
||||
- SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE), EXTENDED_REGS,
|
||||
- aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache
|
||||
- },
|
||||
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
|
||||
- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS,
|
||||
- NULL, aarch64_store_pauthregset },
|
||||
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
|
||||
- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset,
|
||||
- aarch64_store_mteregset },
|
||||
- NULL_REGSET
|
||||
-};
|
||||
+ struct regset_info *regset;
|
||||
|
||||
-static struct regsets_info aarch64_sve_regsets_info =
|
||||
- {
|
||||
- aarch64_sve_regsets, /* regsets. */
|
||||
- 0, /* num_regsets. */
|
||||
- NULL, /* disabled_regsets. */
|
||||
- };
|
||||
+ for (regset = aarch64_regsets; regset->size >= 0; regset++)
|
||||
+ {
|
||||
+ switch (regset->nt_type)
|
||||
+ {
|
||||
+ case NT_PRSTATUS:
|
||||
+ /* General purpose registers are always present. */
|
||||
+ regset->size = sizeof (struct user_pt_regs);
|
||||
+ break;
|
||||
+ case NT_FPREGSET:
|
||||
+ /* This is unavailable when SVE is present. */
|
||||
+ if (!features.sve)
|
||||
+ regset->size = sizeof (struct user_fpsimd_state);
|
||||
+ break;
|
||||
+ case NT_ARM_SVE:
|
||||
+ if (features.sve)
|
||||
+ regset->size = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE);
|
||||
+ break;
|
||||
+ case NT_ARM_PAC_MASK:
|
||||
+ if (features.pauth)
|
||||
+ regset->size = AARCH64_PAUTH_REGS_SIZE;
|
||||
+ break;
|
||||
+ case NT_ARM_TAGGED_ADDR_CTRL:
|
||||
+ if (features.mte)
|
||||
+ regset->size = AARCH64_LINUX_SIZEOF_MTE;
|
||||
+ break;
|
||||
+ default:
|
||||
+ gdb_assert_not_reached ("Unknown register set found.");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
||||
-static struct regs_info regs_info_aarch64_sve =
|
||||
- {
|
||||
- NULL, /* regset_bitmap. */
|
||||
- NULL, /* usrregs. */
|
||||
- &aarch64_sve_regsets_info,
|
||||
- };
|
||||
+/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */
|
||||
+#define AARCH64_HWCAP_PACA (1 << 30)
|
||||
+
|
||||
+/* Implementation of linux target ops method "low_arch_setup". */
|
||||
+
|
||||
+void
|
||||
+aarch64_target::low_arch_setup ()
|
||||
+{
|
||||
+ unsigned int machine;
|
||||
+ int is_elf64;
|
||||
+ int tid;
|
||||
+
|
||||
+ tid = lwpid_of (current_thread);
|
||||
+
|
||||
+ is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
|
||||
+
|
||||
+ if (is_elf64)
|
||||
+ {
|
||||
+ struct aarch64_features features;
|
||||
+
|
||||
+ uint64_t vq = aarch64_sve_get_vq (tid);
|
||||
+ features.sve = (vq > 0);
|
||||
+ /* A-profile PAC is 64-bit only. */
|
||||
+ features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA;
|
||||
+ /* A-profile MTE is 64-bit only. */
|
||||
+ features.mte = linux_get_hwcap2 (8) & HWCAP2_MTE;
|
||||
+
|
||||
+ current_process ()->tdesc
|
||||
+ = aarch64_linux_read_description (vq, features.pauth, features.mte);
|
||||
+
|
||||
+ /* Adjust the register sets we should use for this particular set of
|
||||
+ features. */
|
||||
+ aarch64_adjust_register_sets (features);
|
||||
+ }
|
||||
+ else
|
||||
+ current_process ()->tdesc = aarch32_linux_read_description ();
|
||||
+
|
||||
+ aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
|
||||
+}
|
||||
|
||||
/* Implementation of linux target ops method "get_regs_info". */
|
||||
|
||||
@@ -802,9 +821,7 @@ aarch64_target::get_regs_info ()
|
||||
if (!is_64bit_tdesc ())
|
||||
return ®s_info_aarch32;
|
||||
|
||||
- if (is_sve_tdesc ())
|
||||
- return ®s_info_aarch64_sve;
|
||||
-
|
||||
+ /* AArch64 64-bit registers. */
|
||||
return ®s_info_aarch64;
|
||||
}
|
||||
|
||||
@@ -3294,5 +3311,4 @@ initialize_low_arch (void)
|
||||
initialize_low_arch_aarch32 ();
|
||||
|
||||
initialize_regsets_info (&aarch64_regsets_info);
|
||||
- initialize_regsets_info (&aarch64_sve_regsets_info);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
Fix build with current GCC: EL_EXPLICIT(location) always non-NULL
|
||||
|
||||
Compiling GDB with current GCC (1b4a63593b) runs into this:
|
||||
|
||||
src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
|
||||
src/gdb/location.c:963:38: error: the address of 'event_location::<unnamed union>::explicit_loc' will never be NULL [-Werror=address]
|
||||
963 | return (EL_EXPLICIT (location) == NULL
|
||||
| ^
|
||||
src/gdb/location.c:57:30: note: 'event_location::<unnamed union>::explicit_loc' declared here
|
||||
57 | struct explicit_location explicit_loc;
|
||||
| ^~~~~~~~~~~~
|
||||
|
||||
GCC is right, EL_EXPLICIT is defined as returning the address of an
|
||||
union field:
|
||||
|
||||
/* An explicit location. */
|
||||
struct explicit_location explicit_loc;
|
||||
#define EL_EXPLICIT(P) (&((P)->u.explicit_loc))
|
||||
|
||||
and thus must always be non-NULL.
|
||||
|
||||
Change-Id: Ie74fee7834495a93affcefce03c06e4d83ad8191
|
||||
|
||||
---
|
||||
gdb/location.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gdb/location.c b/gdb/location.c
|
||||
index 827294e106a..1ee20069313 100644
|
||||
--- a/gdb/location.c
|
||||
+++ b/gdb/location.c
|
||||
@@ -960,12 +960,11 @@ event_location_empty_p (const struct event_location *location)
|
||||
return 0;
|
||||
|
||||
case EXPLICIT_LOCATION:
|
||||
- return (EL_EXPLICIT (location) == NULL
|
||||
- || (EL_EXPLICIT (location)->source_filename == NULL
|
||||
- && EL_EXPLICIT (location)->function_name == NULL
|
||||
- && EL_EXPLICIT (location)->label_name == NULL
|
||||
- && (EL_EXPLICIT (location)->line_offset.sign
|
||||
- == LINE_OFFSET_UNKNOWN)));
|
||||
+ return (EL_EXPLICIT (location)->source_filename == NULL
|
||||
+ && EL_EXPLICIT (location)->function_name == NULL
|
||||
+ && EL_EXPLICIT (location)->label_name == NULL
|
||||
+ && (EL_EXPLICIT (location)->line_offset.sign
|
||||
+ == LINE_OFFSET_UNKNOWN));
|
||||
|
||||
case PROBE_LOCATION:
|
||||
return EL_PROBE (location) == NULL;
|
@ -0,0 +1,270 @@
|
||||
Fix comparison of unsigned long int to int in record_linux_system_call.
|
||||
|
||||
The if statement in case gdb_sys_ioctl in function
|
||||
record_linux_system_call in file gdb/linux-record.c is as follows:
|
||||
|
||||
if (tmpulongest == tdep->ioctl_FIOCLEX
|
||||
|| tmpulongest == tdep->ioctl_FIONCLEX
|
||||
....
|
||||
|| tmpulongest == tdep->ioctl_TCSETSW
|
||||
...
|
||||
}
|
||||
|
||||
The PowerPC ioctl value for ioctl_TCSETW is 0x802c7415. The variable
|
||||
ioctl_TCSETW is defined in gdb/linux-record.h as an int. The TCSETW value
|
||||
has the MSB set to one so it is a negative integer. The comparison of the
|
||||
unsigned long value tmpulongest to a negative integer value for
|
||||
ioctl_TCSETSW fails.
|
||||
|
||||
This patch changes the declarations for the ioctl_* values in struct
|
||||
linux_record_tdep to unsigned long to fix the comparisons between
|
||||
tmpulongest and the tdep->ioctl_* values.
|
||||
|
||||
An additional test gdb.reverse/test_ioctl_TCSETSW.exp is added to verify
|
||||
the gdb record_linux_system_call() if statement for the ioctl TCSETSW
|
||||
succeeds.
|
||||
|
||||
This patch has been tested on Power 10 and Intel with no test failures.
|
||||
|
||||
---
|
||||
gdb/linux-record.h | 130 +++++++++++------------
|
||||
gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c | 38 +++++++
|
||||
gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp | 45 ++++++++
|
||||
3 files changed, 148 insertions(+), 65 deletions(-)
|
||||
|
||||
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
|
||||
index 219c67f888d..39d7d4b54d0 100644
|
||||
--- a/gdb/linux-record.h
|
||||
+++ b/gdb/linux-record.h
|
||||
@@ -92,71 +92,71 @@ struct linux_record_tdep
|
||||
int size_time_t;
|
||||
|
||||
/* The values of the second argument of system call "sys_ioctl". */
|
||||
- int ioctl_TCGETS;
|
||||
- int ioctl_TCSETS;
|
||||
- int ioctl_TCSETSW;
|
||||
- int ioctl_TCSETSF;
|
||||
- int ioctl_TCGETA;
|
||||
- int ioctl_TCSETA;
|
||||
- int ioctl_TCSETAW;
|
||||
- int ioctl_TCSETAF;
|
||||
- int ioctl_TCSBRK;
|
||||
- int ioctl_TCXONC;
|
||||
- int ioctl_TCFLSH;
|
||||
- int ioctl_TIOCEXCL;
|
||||
- int ioctl_TIOCNXCL;
|
||||
- int ioctl_TIOCSCTTY;
|
||||
- int ioctl_TIOCGPGRP;
|
||||
- int ioctl_TIOCSPGRP;
|
||||
- int ioctl_TIOCOUTQ;
|
||||
- int ioctl_TIOCSTI;
|
||||
- int ioctl_TIOCGWINSZ;
|
||||
- int ioctl_TIOCSWINSZ;
|
||||
- int ioctl_TIOCMGET;
|
||||
- int ioctl_TIOCMBIS;
|
||||
- int ioctl_TIOCMBIC;
|
||||
- int ioctl_TIOCMSET;
|
||||
- int ioctl_TIOCGSOFTCAR;
|
||||
- int ioctl_TIOCSSOFTCAR;
|
||||
- int ioctl_FIONREAD;
|
||||
- int ioctl_TIOCINQ;
|
||||
- int ioctl_TIOCLINUX;
|
||||
- int ioctl_TIOCCONS;
|
||||
- int ioctl_TIOCGSERIAL;
|
||||
- int ioctl_TIOCSSERIAL;
|
||||
- int ioctl_TIOCPKT;
|
||||
- int ioctl_FIONBIO;
|
||||
- int ioctl_TIOCNOTTY;
|
||||
- int ioctl_TIOCSETD;
|
||||
- int ioctl_TIOCGETD;
|
||||
- int ioctl_TCSBRKP;
|
||||
- int ioctl_TIOCTTYGSTRUCT;
|
||||
- int ioctl_TIOCSBRK;
|
||||
- int ioctl_TIOCCBRK;
|
||||
- int ioctl_TIOCGSID;
|
||||
- int ioctl_TCGETS2;
|
||||
- int ioctl_TCSETS2;
|
||||
- int ioctl_TCSETSW2;
|
||||
- int ioctl_TCSETSF2;
|
||||
- int ioctl_TIOCGPTN;
|
||||
- int ioctl_TIOCSPTLCK;
|
||||
- int ioctl_FIONCLEX;
|
||||
- int ioctl_FIOCLEX;
|
||||
- int ioctl_FIOASYNC;
|
||||
- int ioctl_TIOCSERCONFIG;
|
||||
- int ioctl_TIOCSERGWILD;
|
||||
- int ioctl_TIOCSERSWILD;
|
||||
- int ioctl_TIOCGLCKTRMIOS;
|
||||
- int ioctl_TIOCSLCKTRMIOS;
|
||||
- int ioctl_TIOCSERGSTRUCT;
|
||||
- int ioctl_TIOCSERGETLSR;
|
||||
- int ioctl_TIOCSERGETMULTI;
|
||||
- int ioctl_TIOCSERSETMULTI;
|
||||
- int ioctl_TIOCMIWAIT;
|
||||
- int ioctl_TIOCGICOUNT;
|
||||
- int ioctl_TIOCGHAYESESP;
|
||||
- int ioctl_TIOCSHAYESESP;
|
||||
- int ioctl_FIOQSIZE;
|
||||
+ ULONGEST ioctl_TCGETS;
|
||||
+ ULONGEST ioctl_TCSETS;
|
||||
+ ULONGEST ioctl_TCSETSW;
|
||||
+ ULONGEST ioctl_TCSETSF;
|
||||
+ ULONGEST ioctl_TCGETA;
|
||||
+ ULONGEST ioctl_TCSETA;
|
||||
+ ULONGEST ioctl_TCSETAW;
|
||||
+ ULONGEST ioctl_TCSETAF;
|
||||
+ ULONGEST ioctl_TCSBRK;
|
||||
+ ULONGEST ioctl_TCXONC;
|
||||
+ ULONGEST ioctl_TCFLSH;
|
||||
+ ULONGEST ioctl_TIOCEXCL;
|
||||
+ ULONGEST ioctl_TIOCNXCL;
|
||||
+ ULONGEST ioctl_TIOCSCTTY;
|
||||
+ ULONGEST ioctl_TIOCGPGRP;
|
||||
+ ULONGEST ioctl_TIOCSPGRP;
|
||||
+ ULONGEST ioctl_TIOCOUTQ;
|
||||
+ ULONGEST ioctl_TIOCSTI;
|
||||
+ ULONGEST ioctl_TIOCGWINSZ;
|
||||
+ ULONGEST ioctl_TIOCSWINSZ;
|
||||
+ ULONGEST ioctl_TIOCMGET;
|
||||
+ ULONGEST ioctl_TIOCMBIS;
|
||||
+ ULONGEST ioctl_TIOCMBIC;
|
||||
+ ULONGEST ioctl_TIOCMSET;
|
||||
+ ULONGEST ioctl_TIOCGSOFTCAR;
|
||||
+ ULONGEST ioctl_TIOCSSOFTCAR;
|
||||
+ ULONGEST ioctl_FIONREAD;
|
||||
+ ULONGEST ioctl_TIOCINQ;
|
||||
+ ULONGEST ioctl_TIOCLINUX;
|
||||
+ ULONGEST ioctl_TIOCCONS;
|
||||
+ ULONGEST ioctl_TIOCGSERIAL;
|
||||
+ ULONGEST ioctl_TIOCSSERIAL;
|
||||
+ ULONGEST ioctl_TIOCPKT;
|
||||
+ ULONGEST ioctl_FIONBIO;
|
||||
+ ULONGEST ioctl_TIOCNOTTY;
|
||||
+ ULONGEST ioctl_TIOCSETD;
|
||||
+ ULONGEST ioctl_TIOCGETD;
|
||||
+ ULONGEST ioctl_TCSBRKP;
|
||||
+ ULONGEST ioctl_TIOCTTYGSTRUCT;
|
||||
+ ULONGEST ioctl_TIOCSBRK;
|
||||
+ ULONGEST ioctl_TIOCCBRK;
|
||||
+ ULONGEST ioctl_TIOCGSID;
|
||||
+ ULONGEST ioctl_TCGETS2;
|
||||
+ ULONGEST ioctl_TCSETS2;
|
||||
+ ULONGEST ioctl_TCSETSW2;
|
||||
+ ULONGEST ioctl_TCSETSF2;
|
||||
+ ULONGEST ioctl_TIOCGPTN;
|
||||
+ ULONGEST ioctl_TIOCSPTLCK;
|
||||
+ ULONGEST ioctl_FIONCLEX;
|
||||
+ ULONGEST ioctl_FIOCLEX;
|
||||
+ ULONGEST ioctl_FIOASYNC;
|
||||
+ ULONGEST ioctl_TIOCSERCONFIG;
|
||||
+ ULONGEST ioctl_TIOCSERGWILD;
|
||||
+ ULONGEST ioctl_TIOCSERSWILD;
|
||||
+ ULONGEST ioctl_TIOCGLCKTRMIOS;
|
||||
+ ULONGEST ioctl_TIOCSLCKTRMIOS;
|
||||
+ ULONGEST ioctl_TIOCSERGSTRUCT;
|
||||
+ ULONGEST ioctl_TIOCSERGETLSR;
|
||||
+ ULONGEST ioctl_TIOCSERGETMULTI;
|
||||
+ ULONGEST ioctl_TIOCSERSETMULTI;
|
||||
+ ULONGEST ioctl_TIOCMIWAIT;
|
||||
+ ULONGEST ioctl_TIOCGICOUNT;
|
||||
+ ULONGEST ioctl_TIOCGHAYESESP;
|
||||
+ ULONGEST ioctl_TIOCSHAYESESP;
|
||||
+ ULONGEST ioctl_FIOQSIZE;
|
||||
|
||||
/* The values of the second argument of system call "sys_fcntl"
|
||||
and "sys_fcntl64". */
|
||||
diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c
|
||||
new file mode 100644
|
||||
index 00000000000..6365f968b30
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c
|
||||
@@ -0,0 +1,38 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2012-2022 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 <sys/ioctl.h>
|
||||
+#include <termios.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+/* The purpose of this test is to verify gdb record_linux_system_call()
|
||||
+ recognizes the call for ioctl TCSETSW. */
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+
|
||||
+ struct termios term;
|
||||
+ int result;
|
||||
+ int fd = 0;
|
||||
+
|
||||
+ /* The test just needs to generate an ioctl call for TCSETSW to see if gdb
|
||||
+ record detected it or not. Success or failure of the ioctl call is
|
||||
+ irrelevant. */
|
||||
+ result = tcsetattr(fd, TCSADRAIN, &term); /* TCSETSW call */
|
||||
+ result = 0; /* TCSETSW called */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
|
||||
new file mode 100644
|
||||
index 00000000000..86a62ebe5e5
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
|
||||
@@ -0,0 +1,45 @@
|
||||
+# Copyright 2008-2022 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/>.
|
||||
+#
|
||||
+# Test ioctl TCSETSW record for PowerPC.
|
||||
+#
|
||||
+
|
||||
+standard_testfile .c
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ untested "could not run to main"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# Recording of ioctls calls requires record full
|
||||
+gdb_test_no_output "record full"
|
||||
+
|
||||
+set stop [gdb_get_line_number "TCSETSW call"]
|
||||
+gdb_test "break $stop" ".*Breakpoint .*" "stop at TCSETSW"
|
||||
+gdb_test "continue" ".*Breakpoint .*" "at TCSETSW call"
|
||||
+
|
||||
+set test "handle TCSETSW"
|
||||
+gdb_test_multiple "step" $test {
|
||||
+ -re "Process record and replay target doesn't support ioctl request 0x.*$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re ".*result = 0.*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
161
fix-core-file-detach-crash-corefiles-29275.patch
Normal file
161
fix-core-file-detach-crash-corefiles-29275.patch
Normal file
@ -0,0 +1,161 @@
|
||||
Fix core-file -> detach -> crash (corefiles/29275)
|
||||
|
||||
After loading a core file, you're supposed to be able to use "detach"
|
||||
to unload the core file. That unfortunately regressed starting with
|
||||
GDB 11, with these commits:
|
||||
|
||||
1192f124a308 - gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses
|
||||
408f66864a1a - detach in all-stop with threads running
|
||||
|
||||
resulting in a GDB crash:
|
||||
|
||||
...
|
||||
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
|
||||
0x0000555555e842bf in maybe_set_commit_resumed_all_targets () at ../../src/gdb/infrun.c:2899
|
||||
2899 if (proc_target->commit_resumed_state)
|
||||
(top-gdb) bt
|
||||
#0 0x0000555555e842bf in maybe_set_commit_resumed_all_targets () at ../../src/gdb/infrun.c:2899
|
||||
#1 0x0000555555e848bf in scoped_disable_commit_resumed::reset (this=0x7fffffffd440) at ../../src/gdb/infrun.c:3023
|
||||
#2 0x0000555555e84a0c in scoped_disable_commit_resumed::reset_and_commit (this=0x7fffffffd440) at ../../src/gdb/infrun.c:3049
|
||||
#3 0x0000555555e739cd in detach_command (args=0x0, from_tty=1) at ../../src/gdb/infcmd.c:2791
|
||||
#4 0x0000555555c0ba46 in do_simple_func (args=0x0, from_tty=1, c=0x55555662a600) at ../../src/gdb/cli/cli-decode.c:95
|
||||
#5 0x0000555555c112b0 in cmd_func (cmd=0x55555662a600, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:2514
|
||||
#6 0x0000555556173b1f in execute_command (p=0x5555565c5916 "", from_tty=1) at ../../src/gdb/top.c:699
|
||||
|
||||
The code that crashes looks like:
|
||||
|
||||
static void
|
||||
maybe_set_commit_resumed_all_targets ()
|
||||
{
|
||||
scoped_restore_current_thread restore_thread;
|
||||
|
||||
for (inferior *inf : all_non_exited_inferiors ())
|
||||
{
|
||||
process_stratum_target *proc_target = inf->process_target ();
|
||||
|
||||
if (proc_target->commit_resumed_state)
|
||||
^^^^^^^^^^^
|
||||
|
||||
With 'proc_target' above being null. all_non_exited_inferiors filters
|
||||
out inferiors that have pid==0. We get here at the end of
|
||||
detach_command, after core_target::detach has already run, at which
|
||||
point the inferior _should_ have pid==0 and no process target. It is
|
||||
clear it no longer has a process target, but, it still has a pid!=0
|
||||
somehow.
|
||||
|
||||
The reason the inferior still has pid!=0, is that core_target::detach
|
||||
just unpushes, and relies on core_target::close to actually do the
|
||||
getting rid of the core and exiting the inferior. The problem with
|
||||
that is that detach_command grabs an extra strong reference to the
|
||||
process stratum target, so the unpush_target inside
|
||||
core_target::detach doesn't actually result in a call to
|
||||
core_target::close.
|
||||
|
||||
Fix this my moving the cleaning up the core inferior to a shared
|
||||
routine called by both core_target::close and core_target::detach. We
|
||||
still need to cleanup the inferior from within core_file::close
|
||||
because there are paths to it that want to get rid of the core without
|
||||
going through detach. E.g., "core-file" -> "run".
|
||||
|
||||
This commit includes a new test added to gdb.base/corefile.exp to
|
||||
cover the "core-file core" -> "detach" scenario.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29275
|
||||
|
||||
Change-Id: Ic42bdd03182166b19f598428b0dbc2ce6f67c893
|
||||
|
||||
---
|
||||
gdb/corelow.c | 27 +++++++++++++++++++++------
|
||||
gdb/testsuite/gdb.base/corefile.exp | 12 ++++++++++++
|
||||
2 files changed, 33 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
index 001c4f147fc..bdd7ddc59c2 100644
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -120,6 +120,9 @@ class core_target final : public process_stratum_target
|
||||
|
||||
private: /* per-core data */
|
||||
|
||||
+ /* Get rid of the core inferior. */
|
||||
+ void clear_core ();
|
||||
+
|
||||
/* The core's section table. Note that these target sections are
|
||||
*not* mapped in the current address spaces' set of target
|
||||
sections --- those should come only from pure executable or
|
||||
@@ -290,10 +293,8 @@ core_target::build_file_mappings ()
|
||||
/* An arbitrary identifier for the core inferior. */
|
||||
#define CORELOW_PID 1
|
||||
|
||||
-/* Close the core target. */
|
||||
-
|
||||
void
|
||||
-core_target::close ()
|
||||
+core_target::clear_core ()
|
||||
{
|
||||
if (core_bfd)
|
||||
{
|
||||
@@ -307,6 +308,14 @@ core_target::close ()
|
||||
|
||||
current_program_space->cbfd.reset (nullptr);
|
||||
}
|
||||
+}
|
||||
+
|
||||
+/* Close the core target. */
|
||||
+
|
||||
+void
|
||||
+core_target::close ()
|
||||
+{
|
||||
+ clear_core ();
|
||||
|
||||
/* Core targets are heap-allocated (see core_target_open), so here
|
||||
we delete ourselves. */
|
||||
@@ -592,9 +601,15 @@ core_target_open (const char *arg, int from_tty)
|
||||
void
|
||||
core_target::detach (inferior *inf, int from_tty)
|
||||
{
|
||||
- /* Note that 'this' is dangling after this call. unpush_target
|
||||
- closes the target, and our close implementation deletes
|
||||
- 'this'. */
|
||||
+ /* Get rid of the core. Don't rely on core_target::close doing it,
|
||||
+ because target_detach may be called with core_target's refcount > 1,
|
||||
+ meaning core_target::close may not be called yet by the
|
||||
+ unpush_target call below. */
|
||||
+ clear_core ();
|
||||
+
|
||||
+ /* Note that 'this' may be dangling after this call. unpush_target
|
||||
+ closes the target if the refcount reaches 0, and our close
|
||||
+ implementation deletes 'this'. */
|
||||
inf->unpush_target (this);
|
||||
|
||||
/* Clear the register cache and the frame cache. */
|
||||
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
|
||||
index 4ed92a02955..7f3d2efe3a2 100644
|
||||
--- a/gdb/testsuite/gdb.base/corefile.exp
|
||||
+++ b/gdb/testsuite/gdb.base/corefile.exp
|
||||
@@ -207,6 +207,16 @@ gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (
|
||||
|
||||
gdb_test "core" "No core file now."
|
||||
|
||||
+# Test that we can unload the core with the "detach" command.
|
||||
+
|
||||
+proc_with_prefix corefile_detach {} {
|
||||
+ clean_restart $::binfile
|
||||
+
|
||||
+ gdb_test "core-file $::corefile" "Core was generated by .*" "load core"
|
||||
+ gdb_test "detach" "No core file now\\." "detach core"
|
||||
+}
|
||||
+
|
||||
+corefile_detach
|
||||
|
||||
# Test a run (start) command will clear any loaded core file.
|
||||
|
||||
@@ -222,6 +232,8 @@ proc corefile_test_run {} {
|
||||
return
|
||||
}
|
||||
|
||||
+ clean_restart $::binfile
|
||||
+
|
||||
gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
|
||||
gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
|
||||
|
140
fix-for-gdb.base-solib-search.exp-test.patch
Normal file
140
fix-for-gdb.base-solib-search.exp-test.patch
Normal file
@ -0,0 +1,140 @@
|
||||
Fix for gdb.base/solib-search.exp test.
|
||||
|
||||
The variable right_lib_flags is not being set correctly to define RIGHT.
|
||||
The value RIGHT is needed to force the address of the library functions
|
||||
lib1_func3 and lib2_func4 to occur at different address in the wrong and
|
||||
right libraries.
|
||||
|
||||
With RIGHT defined correctly, functions lib1_func3 and lib2_func4 occur
|
||||
at different addresses the test runs correctly on Powerpc.
|
||||
|
||||
The test needs the lib2 addresses to be different in the right and
|
||||
wrong cases. That is the point of introducing function lib2_spacer
|
||||
with the ifdef RIGHT compiler directive.
|
||||
|
||||
On Intel, the ARRAY_SIZE of 1 versus 8192 is sufficient to get the
|
||||
dynamic linker to move the addresses of the library. You can also get
|
||||
the same effect on PowerPC but you must use a value much larger than
|
||||
8192.
|
||||
|
||||
The key thing is that the test was not properly setting RIGHT to
|
||||
defined to get the lib2_spacer function on Intel and Powerpc.
|
||||
|
||||
Without the patch, we have the Intel backtrace for the bad libraries:
|
||||
|
||||
backtrace
|
||||
#0 break_here () at /home/ ... /gdb/testsuite/gdb.base/solib-search.c:30
|
||||
#1 0x00007ffff7fae156 in ?? ()
|
||||
#2 0x00007fffffffc150 in ?? ()
|
||||
#3 0x00007ffff7fbb156 in ?? ()
|
||||
#4 0x00007fffffffc160 in ?? ()
|
||||
#5 0x00007ffff7fae146 in ?? ()
|
||||
#6 0x00007fffffffc170 in ?? ()
|
||||
#7 0x00007ffff7fbb146 in ?? ()
|
||||
#8 0x00007fffffffc180 in ?? ()
|
||||
#9 0x0000555555555156 in main () at /home/ ... /binutils-gdb/gdb/testsuite/gdb.base/solib-search.c:23
|
||||
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
|
||||
(gdb) PASS: gdb.base/solib-search.exp: backtrace (with wrong libs) (data collection)
|
||||
|
||||
The backtrace on Intel with the good libraries is:
|
||||
|
||||
backtrace
|
||||
#0 break_here () at /.../binutils-gdb/gdb/testsuite/gdb.base/solib-search.c:30
|
||||
#1 0x00007ffff7fae156 in lib2_func4 () at /.../binutils-gdb/gdb/testsuite/gdb.base/solib-search-lib2.c:49
|
||||
#2 0x00007ffff7fbb156 in lib1_func3 () at /.../gdb.base/solib-search-lib1.c:49
|
||||
#3 0x00007ffff7fae146 in lib2_func2 () at /.../testsuite/gdb.base/solib-search-lib2.c:30
|
||||
#4 0x00007ffff7fbb146 in lib1_func1 () at /.../gdb.base/solib-search-lib1.c:30
|
||||
#5 0x0000555555555156 in main () at /...solib-search.c:23
|
||||
(gdb) PASS: gdb.base/solib-search.exp: backtrace (with right libs) (data collection)
|
||||
PASS: gdb.base/solib-search.exp: backtrace (with right libs)
|
||||
|
||||
In one case the backtrace is correct and the other it
|
||||
is wrong on Intel. This is due to the fact that the ARRAY_SIZE caused
|
||||
the dynamic linker to move the library function addresses around. I
|
||||
believe it has to do with the default size of the data and code
|
||||
sections used by the dynamic linker.
|
||||
|
||||
So without the patch the backtrace on PowerPC looks like:
|
||||
|
||||
backtrace
|
||||
#0 break_here () at /.../solib-search.c:30
|
||||
#1 0x00007ffff7f007f4 in lib2_func4 () at /.../solib-search-lib2.c:49
|
||||
#2 0x00007ffff7f307f4 in lib1_func3 () at /.../solib-search-lib1.c:49
|
||||
#3 0x00007ffff7f007ac in lib2_func2 () at /.../solib-search-lib2.c:30
|
||||
#4 0x00007ffff7f307ac in lib1_func1 () at /.../solib-search-lib1.c:30
|
||||
#5 0x000000001000074c in main () at /.../solib-search.c:23
|
||||
|
||||
for both the good and bad libraries.
|
||||
|
||||
The patch fixes defining RIGHT in solib-search-lib1.c and solib-search-
|
||||
lib2.c. Note, without the patch the lib1_spacer and lib2_spacer
|
||||
functions do not show up in the object dump of the Intel or Powerpc
|
||||
libraries as it should. The patch fixes that by making sure RIGHT gets
|
||||
defined.
|
||||
|
||||
Now with the patch the backtrace for the bad library on PowerPC looks
|
||||
like:
|
||||
|
||||
backtrace
|
||||
#0 break_here () at /.../solib-search.c:30
|
||||
#1 0x00007ffff7f0083c in __glink_PLTresolve () from /.../solib-search-lib2.so
|
||||
Backtrace stopped: frame did not save the PC
|
||||
|
||||
And the backtrace for the good libraries on PowerPC looks like:
|
||||
|
||||
backtrace
|
||||
#0 break_here () at /.../solib-search.c:30
|
||||
#1 0x00007ffff7f0083c in lib2_func4 () at /.../solib-search-lib2.c:49
|
||||
#2 0x00007ffff7f3083c in lib1_func3 () at /.../solib-search-lib1.c:49
|
||||
#3 0x00007ffff7f007cc in lib2_func2 () at /.../solib-search-lib2.c:30
|
||||
#4 0x00007ffff7f307cc in lib1_func1 () at /.../solib-search-lib1.c:30
|
||||
#5 0x000000001000074c in main () at /.../solib-search.c:23
|
||||
(gdb) PASS: gdb.base/solib-search.exp: backtrace (with right libs) (data collection)
|
||||
PASS: gdb.base/solib-search.exp: backtrace (with right libs)
|
||||
|
||||
The issue then is on Power where the ARRAY_SIZE of 1 versus 8192 is not
|
||||
sufficient to cause the dymanic linker to allocate the libraries at
|
||||
different addresses. I don't claim to understand the specifics of how
|
||||
the dynamic linker works and what the default size is for the data and
|
||||
code sections are. My guess is by default PowerPC allocates a larger
|
||||
data size by default, which is large enough to hold array[8192]. The
|
||||
default size of the data section allocated by the dynamic linker on
|
||||
Intel is not large enough to hold array[8192] thus causing the code
|
||||
section on Intel to have to move when the large array is defined.
|
||||
|
||||
Note on PowerPC, if you make ARRAY_SIZE big enough, then you will cause
|
||||
the library addresses to occur at different addresses as the larger
|
||||
data section forces the code section to a different address. That was
|
||||
actually my original fix for the program until I spoke with Doug Evans
|
||||
who originally wrote the test. Doug noticed that RIGHT was not getting
|
||||
defined as he originally intended in the test.
|
||||
|
||||
With the patch to fix the definition of RIGHT, PowerPC has a bad and a
|
||||
good backtrace because the address of lib1_func3 and lib2_func4 both
|
||||
move because lib1_spacer and lib2_spacer are now defined
|
||||
before lib1_func3 and lib2_func4.
|
||||
|
||||
Without the patch, the lib1_spacer and lib2_spacer function doesn't show
|
||||
up in the binary for the correct or incorrect library on Intel or PowerPC.
|
||||
With the patch, RIGHT gets defined as originally intended for the test on
|
||||
both architectures and lib1_spacer and lib2_spacer function show up in the
|
||||
binaries on both architectures changing the other function addresses as
|
||||
intended thus causing the test work as intended on PowerPC.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/solib-search.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp
|
||||
index eaabe508bf0..202e79d85de 100644
|
||||
--- a/gdb/testsuite/gdb.base/solib-search.exp
|
||||
+++ b/gdb/testsuite/gdb.base/solib-search.exp
|
||||
@@ -54,7 +54,7 @@ set binfile2_lib [standard_output_file ${libname2}.so]
|
||||
|
||||
set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
|
||||
set wrong_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=1"
|
||||
-set right_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=8192 -DRIGHT"
|
||||
+set right_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=8192 additional_flags=-DRIGHT"
|
||||
|
||||
# Binary file.
|
||||
standard_testfile .c
|
@ -1,58 +0,0 @@
|
||||
Fix gdb.base/sigstep.exp test for ppc
|
||||
|
||||
The test stops at <signal_handler called> which is the call to the handler
|
||||
rather than in the handler as intended. This patch replaces the
|
||||
gdb_test "$enter_cmd to handler" with a gdb_test_multiple test. The multiple
|
||||
test looks for the stop at <signal_handler called>. If found, the command
|
||||
is issued again. The test passes if gdb stops in the handler as expected.
|
||||
|
||||
(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step
|
||||
from handler: continue to signal
|
||||
stepi
|
||||
<signal handler called>
|
||||
1: x/i $pc
|
||||
=> 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>: bctrl
|
||||
(gdb) stepi
|
||||
handler (sig=551) at sigstep.c:32
|
||||
32 {
|
||||
1: x/i $pc
|
||||
=> 0x10000097c <handler>: addis r2,r12,2
|
||||
(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler,
|
||||
step from handler: stepi to handler
|
||||
|
||||
Patch has been tested on x86_64-linux and ppc64le-linux with no test failures.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/sigstep.exp | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
|
||||
index ea254af5297..176918b67d6 100644
|
||||
--- a/gdb/testsuite/gdb.base/sigstep.exp
|
||||
+++ b/gdb/testsuite/gdb.base/sigstep.exp
|
||||
@@ -79,6 +79,7 @@ validate_backtrace
|
||||
proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
|
||||
global gdb_prompt inferior_exited_re
|
||||
global clear_done other_handler_location
|
||||
+ global decimal
|
||||
|
||||
set prefix "$enter_cmd to handler, $in_handler_prefix in handler, $exit_cmd from handler"
|
||||
|
||||
@@ -93,7 +94,16 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
|
||||
gdb_test "handle SIGVTALRM print pass stop"
|
||||
gdb_test "continue" "Program received signal.*" "continue to signal"
|
||||
}
|
||||
- gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler"
|
||||
+
|
||||
+ gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" {
|
||||
+ -re -wrap "\r\n<signal handler called>.*" {
|
||||
+ send_gdb "$enter_cmd\n"
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ -re -wrap "\r\n(Breakpoint $decimal, )?handler \\(sig=.*" {
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+ }
|
||||
|
||||
delete_breakpoints
|
||||
|
@ -1,182 +0,0 @@
|
||||
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)"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
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.
|
29
fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
29
fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
@ -0,0 +1,29 @@
|
||||
fixup-2-gdb-rhbz1553104-s390x-arch12-test
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/s390x-arch12.exp | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
index 246c1e1c69a..7939a2d6932 100644
|
||||
--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
@@ -31,4 +31,18 @@ gdb_exit
|
||||
gdb_start
|
||||
gdb_load $ofile
|
||||
|
||||
+set supported 0
|
||||
+gdb_test_multiple "show arch" "" {
|
||||
+ -re -wrap "\"s390:64-bit\".*" {
|
||||
+ set supported 1
|
||||
+ }
|
||||
+ -re -wrap "" {
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { ! $supported } {
|
||||
+ unsupported "No s390x support"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*"
|
@ -1,23 +0,0 @@
|
||||
fixup-gdb-6.6-buildid-locate.patch
|
||||
|
||||
---
|
||||
gdb/build-id.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
-extern void _initialize_build_id (void);
|
||||
+void _initialize_build_id ();
|
||||
|
||||
void
|
||||
-_initialize_build_id (void)
|
||||
+_initialize_build_id ()
|
||||
{
|
||||
add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
|
||||
_("\
|
38
fixup-gdb-test-bt-cfi-without-die.patch
Normal file
38
fixup-gdb-test-bt-cfi-without-die.patch
Normal file
@ -0,0 +1,38 @@
|
||||
fixup-gdb-test-bt-cfi-without-die.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/cfi-without-die.exp | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
index 5880d46f6d2..db1726646f8 100644
|
||||
--- a/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
@@ -37,19 +37,22 @@ if ![runto callback] then {
|
||||
fail "verify unwinding: Can't run to callback"
|
||||
return 0
|
||||
}
|
||||
-set test "verify unwinding breaks without CFI"
|
||||
-gdb_test_multiple "bt" $test {
|
||||
+
|
||||
+set as_expected 1
|
||||
+gdb_test_multiple "bt" "" {
|
||||
-re " in \[?\]\[?\] .*\r\n$gdb_prompt $" {
|
||||
# It may backtrace through some random frames even to main().
|
||||
- pass $test
|
||||
}
|
||||
-re " in main .*\r\n$gdb_prompt $" {
|
||||
- fail $test
|
||||
+ set as_expected 0
|
||||
}
|
||||
-re "\r\n$gdb_prompt $" {
|
||||
- pass $test
|
||||
}
|
||||
}
|
||||
+if { ! $as_expected } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
|
||||
object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != ""
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fe14d640ad78b741f6b2751612aa9e40f752daaf0b6459cd01a4133379413d6e
|
||||
size 29356796
|
BIN
gdb-12.1.tar.bz2
(Stored with Git LFS)
Normal file
BIN
gdb-12.1.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -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
|
||||
@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
@@ -1767,7 +1767,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 \
|
||||
@@ -1802,7 +1802,25 @@ install-guile:
|
||||
@@ -1816,7 +1816,25 @@ install-guile:
|
||||
install-python:
|
||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||
|
||||
@ -52,8 +52,8 @@ 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 \
|
||||
@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
fi
|
||||
@@ -1847,6 +1865,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
rm -f $(DESTDIR)$(bindir)/$$transformed_name
|
||||
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
+.PHONY: uninstall-gstack
|
||||
|
@ -1,324 +0,0 @@
|
||||
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);
|
||||
+}
|
@ -44,7 +44,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
|
||||
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
||||
@@ -1301,6 +1301,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
||||
|
||||
if (exp != nullptr && *exp)
|
||||
{
|
||||
|
@ -1,111 +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-readline-long-line-crash-test.patch
|
||||
|
||||
;; Fix readline segfault on excessively long hand-typed lines.
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
@@ -0,0 +1,96 @@
|
||||
+# Copyright 2006 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
|
||||
+
|
||||
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+#
|
||||
+# Tests for readline buffer overflow.
|
||||
+#
|
||||
+
|
||||
+if $tracelevel {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+global env
|
||||
+
|
||||
+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
|
||||
+
|
||||
+ set timeout 600
|
||||
+
|
||||
+ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
|
||||
+ set env(HISTSIZE) "10"
|
||||
+
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+
|
||||
+ set width 11
|
||||
+ gdb_test "set width $width" \
|
||||
+ "" \
|
||||
+ "Setting width to $width."
|
||||
+ #gdb_test "set height 1" \
|
||||
+ # "" \
|
||||
+ # "Setting height to 1."
|
||||
+ send_gdb "run X"
|
||||
+ set i 0
|
||||
+ # It crashes using `set width 7' on `set total 3560'.
|
||||
+ # Sometimes it corrupts screen on `set width 7'.
|
||||
+ # Bugreport used `set total 130001':
|
||||
+ # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
+ # Check also `timeout' above.
|
||||
+ set total 4200
|
||||
+ gdb_expect {
|
||||
+ -re X {
|
||||
+ incr i
|
||||
+ if {$i <= $total} {
|
||||
+ send_gdb "X"
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ -re "\[ \b\r\n\]" {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters, reason: EOF"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ default {
|
||||
+ fail "gdb sending total $total characters"
|
||||
+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
|
||||
+ gdb_clear_suppressed
|
||||
+ }
|
||||
+ }
|
||||
+ send_gdb "\r"
|
||||
+ gdb_test "" \
|
||||
+ "No executable file specified..*" \
|
||||
+ "All the characters transferred"
|
||||
+}
|
@ -6,29 +6,6 @@ Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
||||
;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||
;;=push+jan
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -708,6 +708,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
|
||||
+ librpm must not exit() an application on SIGINT
|
||||
+
|
||||
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
|
||||
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
|
||||
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
|
||||
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
|
||||
+int
|
||||
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
||||
and avoid their duplicities during a single inferior run. */
|
||||
|
||||
diff --git a/gdb/proc-service.list b/gdb/proc-service.list
|
||||
--- a/gdb/proc-service.list
|
||||
+++ b/gdb/proc-service.list
|
||||
|
@ -9,96 +9,10 @@ Subject: gdb-6.6-buildid-locate-rpm-scl.patch
|
||||
warning: Skipping deprecated .gdb_index section
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=953585
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -742,7 +742,11 @@ static int missing_rpm_list_entries;
|
||||
/* Returns the count of newly added rpms. */
|
||||
|
||||
static int
|
||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||
missing_rpm_enlist (const char *filename)
|
||||
+#else
|
||||
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||
+#endif
|
||||
{
|
||||
static int rpm_init_done = 0;
|
||||
rpmts ts;
|
||||
@@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename)
|
||||
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
||||
if (mi != NULL)
|
||||
{
|
||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||
for (;;)
|
||||
+#else
|
||||
+ if (!verify_vendor) for (;;)
|
||||
+#endif
|
||||
{
|
||||
Header h;
|
||||
char *debuginfo, **slot, *s, *s2;
|
||||
@@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename)
|
||||
xfree (debuginfo);
|
||||
count++;
|
||||
}
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+ else /* verify_vendor */
|
||||
+ {
|
||||
+ int vendor_pass = 0, vendor_fail = 0;
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ Header h;
|
||||
+ errmsg_t err;
|
||||
+ char *vendor;
|
||||
+
|
||||
+ h = rpmdbNextIterator_p (mi);
|
||||
+ if (h == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ vendor = headerFormat_p (h, "%{vendor}", &err);
|
||||
+ if (!vendor)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
|
||||
+ vendor_pass = 1;
|
||||
+ else
|
||||
+ vendor_fail = 1;
|
||||
+ xfree (vendor);
|
||||
+ }
|
||||
+ count = vendor_pass != 0 && vendor_fail == 0;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
rpmdbFreeIterator_p (mi);
|
||||
}
|
||||
@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename)
|
||||
return count;
|
||||
}
|
||||
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+missing_rpm_enlist (const char *filename)
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 0);
|
||||
+}
|
||||
+
|
||||
+extern int rpm_verify_vendor (const char *filename);
|
||||
+int
|
||||
+rpm_verify_vendor (const char *filename)
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 1);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static bool
|
||||
missing_rpm_list_compar (const char *ap, const char *bp)
|
||||
{
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename,
|
||||
@@ -2797,6 +2797,16 @@ read_gdb_index_from_buffer (const char *filename,
|
||||
"set use-deprecated-index-sections on". */
|
||||
if (version < 6 && !deprecated_ok)
|
||||
{
|
||||
@ -115,7 +29,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
static int warning_printed = 0;
|
||||
if (!warning_printed)
|
||||
{
|
||||
@@ -2812,6 +2822,10 @@ to use the section anyway."),
|
||||
@@ -2808,6 +2818,10 @@ to use the section anyway."),
|
||||
warning_printed = 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -232,457 +232,6 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "gdb_bfd.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "gdbcore.h"
|
||||
+#include "inferior.h"
|
||||
#include "objfiles.h"
|
||||
#include "observable.h"
|
||||
#include "symfile.h"
|
||||
@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
return result;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+
|
||||
+#include <rpm/rpmlib.h>
|
||||
+#include <rpm/rpmts.h>
|
||||
+#include <rpm/rpmdb.h>
|
||||
+#include <rpm/header.h>
|
||||
+#ifdef DLOPEN_LIBRPM
|
||||
+#include <dlfcn.h>
|
||||
+#endif
|
||||
+
|
||||
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
||||
+ and avoid their duplicities during a single inferior run. */
|
||||
+
|
||||
+static struct htab *missing_rpm_hash;
|
||||
+
|
||||
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
|
||||
+ all the rpms right before the nearest GDB prompt. It gets cleared after
|
||||
+ each such print (it is questionable if we should clear it after the print).
|
||||
+ */
|
||||
+
|
||||
+struct missing_rpm
|
||||
+ {
|
||||
+ struct missing_rpm *next;
|
||||
+ char rpm[1];
|
||||
+ };
|
||||
+static struct missing_rpm *missing_rpm_list;
|
||||
+static int missing_rpm_list_entries;
|
||||
+
|
||||
+/* Returns the count of newly added rpms. */
|
||||
+
|
||||
+static int
|
||||
+missing_rpm_enlist (const char *filename)
|
||||
+{
|
||||
+ static int rpm_init_done = 0;
|
||||
+ rpmts ts;
|
||||
+ rpmdbMatchIterator mi;
|
||||
+ int count = 0;
|
||||
+
|
||||
+#ifdef DLOPEN_LIBRPM
|
||||
+ /* Duplicate here the declarations to verify they match. The same sanity
|
||||
+ check is present also in `configure.ac'. */
|
||||
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
||||
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
|
||||
+ extern int rpmReadConfigFiles(const char * file, const char * target);
|
||||
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
|
||||
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
||||
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
|
||||
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
||||
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
|
||||
+ extern rpmts rpmtsCreate(void);
|
||||
+ static rpmts (*rpmtsCreate_p) (void);
|
||||
+ extern rpmts rpmtsFree(rpmts ts);
|
||||
+ static rpmts (*rpmtsFree_p) (rpmts ts);
|
||||
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
||||
+ const void * keyp, size_t keylen);
|
||||
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
|
||||
+ rpmTag rpmtag,
|
||||
+ const void *keyp,
|
||||
+ size_t keylen);
|
||||
+#else /* !DLOPEN_LIBRPM */
|
||||
+# define headerFormat_p headerFormat
|
||||
+# define rpmReadConfigFiles_p rpmReadConfigFiles
|
||||
+# define rpmdbFreeIterator_p rpmdbFreeIterator
|
||||
+# define rpmdbNextIterator_p rpmdbNextIterator
|
||||
+# define rpmtsCreate_p rpmtsCreate
|
||||
+# define rpmtsFree_p rpmtsFree
|
||||
+# define rpmtsInitIterator_p rpmtsInitIterator
|
||||
+#endif /* !DLOPEN_LIBRPM */
|
||||
+
|
||||
+ gdb_assert (filename != NULL);
|
||||
+
|
||||
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (is_target_filename (filename))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (filename[0] != '/')
|
||||
+ {
|
||||
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!rpm_init_done)
|
||||
+ {
|
||||
+ static int init_tried;
|
||||
+
|
||||
+ /* Already failed the initialization before? */
|
||||
+ if (init_tried)
|
||||
+ return 0;
|
||||
+ init_tried = 1;
|
||||
+
|
||||
+#ifdef DLOPEN_LIBRPM
|
||||
+ {
|
||||
+ void *h;
|
||||
+
|
||||
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
|
||||
+ if (!h)
|
||||
+ {
|
||||
+ warning (_("Unable to open \"%s\" (%s), "
|
||||
+ "missing debuginfos notifications will not be displayed"),
|
||||
+ DLOPEN_LIBRPM, dlerror ());
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
|
||||
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
|
||||
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
|
||||
+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
|
||||
+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
|
||||
+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
|
||||
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
|
||||
+ {
|
||||
+ warning (_("Opened library \"%s\" is incompatible (%s), "
|
||||
+ "missing debuginfos notifications will not be displayed"),
|
||||
+ DLOPEN_LIBRPM, dlerror ());
|
||||
+ if (dlclose (h))
|
||||
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
|
||||
+ dlerror ());
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* DLOPEN_LIBRPM */
|
||||
+
|
||||
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
|
||||
+ {
|
||||
+ warning (_("Error reading the rpm configuration files"));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ rpm_init_done = 1;
|
||||
+ }
|
||||
+
|
||||
+ ts = rpmtsCreate_p ();
|
||||
+
|
||||
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
||||
+ if (mi != NULL)
|
||||
+ {
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ Header h;
|
||||
+ char *debuginfo, **slot, *s, *s2;
|
||||
+ errmsg_t err;
|
||||
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
|
||||
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
|
||||
+ rpmdbMatchIterator mi_debuginfo;
|
||||
+
|
||||
+ h = rpmdbNextIterator_p (mi);
|
||||
+ if (h == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ /* Verify the debuginfo file is not already installed. */
|
||||
+
|
||||
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
|
||||
+ &err);
|
||||
+ if (!debuginfo)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||
+ s = strrchr (debuginfo, '-') - srcrpmlen;
|
||||
+ s2 = NULL;
|
||||
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
|
||||
+ {
|
||||
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
|
||||
+ }
|
||||
+ if (s2)
|
||||
+ {
|
||||
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
|
||||
+ }
|
||||
+ if (!s2)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ debuginfo);
|
||||
+ xfree (debuginfo);
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
+ memmove (s2 + debuginfolen, s2, s - s2);
|
||||
+ memcpy (s2, "-debuginfo", debuginfolen);
|
||||
+ /* s = `XXXX.%{arch}' */
|
||||
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
|
||||
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
|
||||
+ /* strlen ("XX") == srcrpmlen */
|
||||
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
|
||||
+ strlen (s + srcrpmlen + debuginfolen) + 1);
|
||||
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
|
||||
+
|
||||
+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
|
||||
+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
|
||||
+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
|
||||
+ xfree (debuginfo);
|
||||
+ if (mi_debuginfo)
|
||||
+ {
|
||||
+ rpmdbFreeIterator_p (mi_debuginfo);
|
||||
+ count = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
||||
+ debuginfo = headerFormat_p (h,
|
||||
+ "%{name}-%{version}-%{release}.%{arch}",
|
||||
+ &err);
|
||||
+ if (!debuginfo)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Base package name for `debuginfo-install'. We do not use the
|
||||
+ `yum' command directly as the line
|
||||
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
|
||||
+ would be more complicated than just:
|
||||
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
|
||||
+ Do not supply the rpm base name (derived from .src.rpm name) as
|
||||
+ debuginfo-install is unable to install the debuginfo package if
|
||||
+ the base name PKG binary rpm is not installed while for example
|
||||
+ PKG-libs would be installed (RH Bug 467901).
|
||||
+ FUTURE: After multiple debuginfo versions simultaneously installed
|
||||
+ get supported the support for the VERSION-RELEASE tags handling
|
||||
+ may need an update. */
|
||||
+
|
||||
+ if (missing_rpm_hash == NULL)
|
||||
+ {
|
||||
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
|
||||
+ should not deallocate the entries. */
|
||||
+
|
||||
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
|
||||
+ (int (*) (const void *, const void *)) streq,
|
||||
+ NULL, xcalloc, xfree);
|
||||
+ }
|
||||
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
|
||||
+ /* XCALLOC never returns NULL. */
|
||||
+ gdb_assert (slot != NULL);
|
||||
+ if (*slot == NULL)
|
||||
+ {
|
||||
+ struct missing_rpm *missing_rpm;
|
||||
+
|
||||
+ *slot = debuginfo;
|
||||
+
|
||||
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
|
||||
+ strcpy (missing_rpm->rpm, debuginfo);
|
||||
+ missing_rpm->next = missing_rpm_list;
|
||||
+ missing_rpm_list = missing_rpm;
|
||||
+ missing_rpm_list_entries++;
|
||||
+ }
|
||||
+ else
|
||||
+ xfree (debuginfo);
|
||||
+ count++;
|
||||
+ }
|
||||
+
|
||||
+ rpmdbFreeIterator_p (mi);
|
||||
+ }
|
||||
+
|
||||
+ rpmtsFree_p (ts);
|
||||
+
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+missing_rpm_list_compar (const char *ap, const char *bp)
|
||||
+{
|
||||
+ return strcoll (ap, bp) < 0;
|
||||
+}
|
||||
+
|
||||
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
|
||||
+ also return only NULL. */
|
||||
+
|
||||
+static void
|
||||
+missing_rpm_list_print (void)
|
||||
+{
|
||||
+ struct missing_rpm *list_iter;
|
||||
+
|
||||
+ if (missing_rpm_list_entries == 0)
|
||||
+ return;
|
||||
+
|
||||
+ std::vector<const char *> array (missing_rpm_list_entries);
|
||||
+ size_t idx = 0;
|
||||
+
|
||||
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
||||
+ list_iter = list_iter->next)
|
||||
+ {
|
||||
+ array[idx++] = list_iter->rpm;
|
||||
+ }
|
||||
+ gdb_assert (idx == missing_rpm_list_entries);
|
||||
+
|
||||
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
|
||||
+
|
||||
+ /* We zero out the number of missing RPMs here because of a nasty
|
||||
+ bug (see RHBZ 1801974).
|
||||
+
|
||||
+ When we call 'puts_unfiltered' below, if pagination is on and if
|
||||
+ the number of missing RPMs is big enough to trigger pagination,
|
||||
+ we will end up in an infinite recursion. The call chain looks
|
||||
+ like this:
|
||||
+
|
||||
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
|
||||
+ -> prompt_for_continue -> display_gdb_prompt ->
|
||||
+ debug_flush_missing -> missing_rpm_list_print ...
|
||||
+
|
||||
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
|
||||
+ *before* calling any print function. */
|
||||
+ missing_rpm_list_entries = 0;
|
||||
+
|
||||
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||
+ "dnf "
|
||||
+#endif
|
||||
+ "debuginfo-install");
|
||||
+ for (const char *el : array)
|
||||
+ {
|
||||
+ puts_unfiltered (" ");
|
||||
+ puts_unfiltered (el);
|
||||
+ }
|
||||
+ puts_unfiltered ("\n");
|
||||
+
|
||||
+ while (missing_rpm_list != NULL)
|
||||
+ {
|
||||
+ list_iter = missing_rpm_list;
|
||||
+ missing_rpm_list = list_iter->next;
|
||||
+ xfree (list_iter);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+missing_rpm_change (void)
|
||||
+{
|
||||
+ debug_flush_missing ();
|
||||
+
|
||||
+ gdb_assert (missing_rpm_list == NULL);
|
||||
+ if (missing_rpm_hash != NULL)
|
||||
+ {
|
||||
+ htab_delete (missing_rpm_hash);
|
||||
+ missing_rpm_hash = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+enum missing_exec
|
||||
+ {
|
||||
+ /* Init state. EXEC_BFD also still could be NULL. */
|
||||
+ MISSING_EXEC_NOT_TRIED,
|
||||
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
|
||||
+ MISSING_EXEC_NOT_FOUND,
|
||||
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
|
||||
+ or separate) or the main executable's RPM is now contained in
|
||||
+ MISSING_RPM_HASH. */
|
||||
+ MISSING_EXEC_ENLISTED
|
||||
+ };
|
||||
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
|
||||
+
|
||||
+#endif /* HAVE_LIBRPM */
|
||||
+
|
||||
+void
|
||||
+debug_flush_missing (void)
|
||||
+{
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ missing_rpm_list_print ();
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
|
||||
- Try to install the hash file ...
|
||||
+ yum --enablerepo='*debug*' install ...
|
||||
avoidance. */
|
||||
|
||||
struct missing_filepair
|
||||
@@ -752,11 +1119,17 @@ missing_filepair_change (void)
|
||||
/* All their memory came just from missing_filepair_OBSTACK. */
|
||||
missing_filepair_hash = NULL;
|
||||
}
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ missing_exec = MISSING_EXEC_NOT_TRIED;
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void
|
||||
debug_print_executable_changed (void)
|
||||
{
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ missing_rpm_change ();
|
||||
+#endif
|
||||
missing_filepair_change ();
|
||||
}
|
||||
|
||||
@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
|
||||
|
||||
*slot = missing_filepair;
|
||||
|
||||
- /* We do not collect and flush these messages as each such message
|
||||
- already requires its own separate lines. */
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
||||
+ {
|
||||
+ const char *execfilename = get_exec_file (0);
|
||||
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- _("Missing separate debuginfo for %s\n"), binary);
|
||||
- if (debug != NULL)
|
||||
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
|
||||
- debug);
|
||||
+ if (execfilename != NULL)
|
||||
+ {
|
||||
+ if (missing_rpm_enlist (execfilename) == 0)
|
||||
+ missing_exec = MISSING_EXEC_NOT_FOUND;
|
||||
+ else
|
||||
+ missing_exec = MISSING_EXEC_ENLISTED;
|
||||
+ }
|
||||
+ }
|
||||
+ if (missing_exec != MISSING_EXEC_ENLISTED)
|
||||
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
|
||||
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
|
||||
+#endif /* HAVE_LIBRPM */
|
||||
+ {
|
||||
+ /* We do not collect and flush these messages as each such message
|
||||
+ already requires its own separate lines. */
|
||||
+
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ _("Missing separate debuginfo for %s\n"), binary);
|
||||
+ if (debug != NULL)
|
||||
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
|
||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||
+ "dnf"
|
||||
+#else
|
||||
+ "yum"
|
||||
+#endif
|
||||
+ " --enablerepo='*debug*' install", debug);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* See build-id.h. */
|
||||
diff --git a/gdb/config.in b/gdb/config.in
|
||||
--- a/gdb/config.in
|
||||
+++ b/gdb/config.in
|
||||
@ -696,7 +245,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
|
||||
@@ -246,6 +249,9 @@
|
||||
@@ -259,6 +262,9 @@
|
||||
/* Define if you have the mpfr library. */
|
||||
#undef HAVE_LIBMPFR
|
||||
|
||||
@ -709,9 +258,9 @@ diff --git a/gdb/config.in b/gdb/config.in
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -771,6 +771,11 @@ PKG_CONFIG
|
||||
HAVE_NATIVE_GCORE_TARGET
|
||||
TARGET_OBS
|
||||
@@ -775,6 +775,11 @@ TARGET_OBS
|
||||
ENABLE_BFD_64_BIT_FALSE
|
||||
ENABLE_BFD_64_BIT_TRUE
|
||||
subdirs
|
||||
+RPM_LIBS
|
||||
+RPM_CFLAGS
|
||||
@ -721,7 +270,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
GDB_DATADIR
|
||||
DEBUGDIR
|
||||
MAKEINFO_EXTRA_FLAGS
|
||||
@@ -876,6 +881,7 @@ with_gdb_datadir
|
||||
@@ -880,6 +885,7 @@ with_gdb_datadir
|
||||
with_relocated_sources
|
||||
with_auto_load_dir
|
||||
with_auto_load_safe_path
|
||||
@ -729,7 +278,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
enable_targets
|
||||
enable_64_bit_bfd
|
||||
enable_gdbmi
|
||||
@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
|
||||
@@ -959,6 +965,8 @@ PKG_CONFIG_PATH
|
||||
PKG_CONFIG_LIBDIR
|
||||
DEBUGINFOD_CFLAGS
|
||||
DEBUGINFOD_LIBS
|
||||
@ -738,7 +287,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
YACC
|
||||
YFLAGS
|
||||
XMKMF'
|
||||
@@ -1625,6 +1633,8 @@ Optional Packages:
|
||||
@@ -1635,6 +1643,8 @@ Optional Packages:
|
||||
do not restrict auto-loaded files locations
|
||||
--with-debuginfod Enable debuginfo lookups with debuginfod
|
||||
(auto/yes/no)
|
||||
@ -747,7 +296,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
|
||||
@@ -1705,6 +1715,8 @@ Some influential environment variables:
|
||||
@@ -1715,6 +1725,8 @@ Some influential environment variables:
|
||||
C compiler flags for DEBUGINFOD, overriding pkg-config
|
||||
DEBUGINFOD_LIBS
|
||||
linker flags for DEBUGINFOD, overriding pkg-config
|
||||
@ -756,7 +305,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'.
|
||||
@@ -6616,6 +6628,494 @@ _ACEOF
|
||||
@@ -6634,6 +6646,494 @@ _ACEOF
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
|
||||
$as_echo "$with_auto_load_safe_path" >&6; }
|
||||
|
||||
@ -1457,15 +1006,15 @@ 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
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "gdbsupport/gdb_select.h"
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "gdbsupport/gdb-sigmask.h"
|
||||
#include "async-event.h"
|
||||
#include "bt-utils.h"
|
||||
+#include "symfile.h"
|
||||
|
||||
/* readline include files. */
|
||||
#include "readline/readline.h"
|
||||
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
|
||||
@@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt)
|
||||
/* Reset the nesting depth used when trace-commands is set. */
|
||||
reset_command_nest_depth ();
|
||||
|
||||
@ -1474,7 +1023,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
/* Do not call the python hook on an explicit prompt change as
|
||||
passed to this function, as this forms a secondary/local prompt,
|
||||
IE, displayed but not set. */
|
||||
@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
||||
@@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
||||
command_handler (cmd);
|
||||
|
||||
if (ui->prompt_state != PROMPTED)
|
||||
|
@ -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
|
||||
@@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
@@ -1250,14 +1250,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
}
|
||||
|
||||
{
|
||||
@ -45,7 +45,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
if (build_id != NULL)
|
||||
{
|
||||
char *name, *build_id_filename;
|
||||
@@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
@@ -1272,23 +1286,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
xfree (name);
|
||||
}
|
||||
else
|
||||
|
@ -33,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -24,13 +24,70 @@
|
||||
@@ -24,13 +24,71 @@
|
||||
#include "gdbsupport/gdb_vecs.h"
|
||||
#include "symfile.h"
|
||||
#include "objfiles.h"
|
||||
@ -46,6 +46,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+#include "gdb_bfd.h"
|
||||
+#include "gdbcmd.h"
|
||||
#include "gdbcore.h"
|
||||
+#include "inferior.h"
|
||||
+#include "objfiles.h"
|
||||
+#include "observable.h"
|
||||
+#include "symfile.h"
|
||||
@ -105,7 +106,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
{
|
||||
if (!bfd_check_format (abfd, bfd_object)
|
||||
&& !bfd_check_format (abfd, bfd_core))
|
||||
@@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -454,7 +455,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
/* See build-id.h. */
|
||||
|
||||
int
|
||||
@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
const struct bfd_build_id *found;
|
||||
int retval = 0;
|
||||
|
||||
@ -463,14 +464,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
|
||||
if (found == NULL)
|
||||
warning (_("File \"%s\" has no build-id, file skipped"),
|
||||
@@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
return retval;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+link_resolve (const char *symlink, int level)
|
||||
+{
|
||||
+ char buf[PATH_MAX + 1], *target, *retval;
|
||||
+ char buf[PATH_MAX + 1], *retval;
|
||||
+ gdb::unique_xmalloc_ptr<char> target;
|
||||
+ ssize_t got;
|
||||
+
|
||||
+ if (level > 10)
|
||||
@ -482,7 +484,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ buf[got] = '\0';
|
||||
+
|
||||
+ if (IS_ABSOLUTE_PATH (buf))
|
||||
+ target = xstrdup (buf);
|
||||
+ target = make_unique_xstrdup (buf);
|
||||
+ else
|
||||
+ {
|
||||
+ const std::string dir (ldirname (symlink));
|
||||
@ -496,8 +498,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ "%s", dir.c_str(), buf);
|
||||
+ }
|
||||
+
|
||||
+ retval = link_resolve (target, level + 1);
|
||||
+ xfree (target);
|
||||
+ retval = link_resolve (target.get (), level + 1);
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
@ -516,42 +517,49 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+
|
||||
if (separate_debug_file_debug)
|
||||
{
|
||||
- printf_unfiltered (_(" Trying %s..."), link.c_str ());
|
||||
+ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ());
|
||||
gdb_flush (gdb_stdout);
|
||||
- fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), link.c_str ());
|
||||
- gdb_flush (gdb_stdlog);
|
||||
+ fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ());
|
||||
+ gdb_flush (gdb_stdout);
|
||||
}
|
||||
|
||||
- /* lrealpath() is expensive even for the usually non-existent files. */
|
||||
- gdb::unique_xmalloc_ptr<char> filename;
|
||||
- if (access (link.c_str (), F_OK) == 0)
|
||||
- filename.reset (lrealpath (link.c_str ()));
|
||||
-
|
||||
- if (filename == NULL)
|
||||
- gdb::unique_xmalloc_ptr<char> filename_holder;
|
||||
- const char *filename = nullptr;
|
||||
- if (startswith (link, TARGET_SYSROOT_PREFIX))
|
||||
- filename = link.c_str ();
|
||||
- else if (access (link.c_str (), F_OK) == 0)
|
||||
+ for (unsigned seqno = 0;; seqno++)
|
||||
{
|
||||
- if (separate_debug_file_debug)
|
||||
- printf_unfiltered (_(" no, unable to compute real path\n"));
|
||||
- filename_holder.reset (lrealpath (link.c_str ()));
|
||||
- filename = filename_holder.get ();
|
||||
- }
|
||||
+ std::string link = orig_link;
|
||||
|
||||
- return {};
|
||||
- }
|
||||
- if (filename == NULL)
|
||||
- {
|
||||
- if (separate_debug_file_debug)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- _(" no, unable to compute real path\n"));
|
||||
+ if (seqno > 0)
|
||||
+ {
|
||||
+ /* 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. */
|
||||
+
|
||||
|
||||
- return {};
|
||||
- }
|
||||
+ 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);
|
||||
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget);
|
||||
+ ret_link = link;
|
||||
|
||||
- if (debug_bfd == NULL)
|
||||
- {
|
||||
- if (separate_debug_file_debug)
|
||||
- printf_unfiltered (_(" no, unable to open.\n"));
|
||||
- fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n"));
|
||||
+ struct stat statbuf_trash;
|
||||
+
|
||||
+ /* `access' automatically dereferences LINK. */
|
||||
@ -562,35 +570,42 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ }
|
||||
+
|
||||
+ /* lrealpath() is expensive even for the usually non-existent files. */
|
||||
+ gdb::unique_xmalloc_ptr<char> filename;
|
||||
+
|
||||
+ if (access (link.c_str (), F_OK) == 0)
|
||||
+ filename.reset (lrealpath (link.c_str ()));
|
||||
+ gdb::unique_xmalloc_ptr<char> filename_holder;
|
||||
+ const char *filename = nullptr;
|
||||
+ if (startswith (link, TARGET_SYSROOT_PREFIX))
|
||||
+ filename = link.c_str ();
|
||||
+ else if (access (link.c_str (), F_OK) == 0)
|
||||
+ {
|
||||
+ filename_holder.reset (lrealpath (link.c_str ()));
|
||||
+ filename = filename_holder.get ();
|
||||
+ }
|
||||
+
|
||||
+ if (filename == NULL)
|
||||
+ {
|
||||
+ if (separate_debug_file_debug)
|
||||
+ printf_unfiltered (_(" no, unable to compute real path\n"));
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ _(" no, unable to compute real path\n"));
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* We expect to be silent on the non-existing files. */
|
||||
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
|
||||
|
||||
- return {};
|
||||
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget);
|
||||
+
|
||||
+ if (debug_bfd == NULL)
|
||||
+ {
|
||||
+ if (separate_debug_file_debug)
|
||||
+ printf_unfiltered (_(" no, unable to open.\n"));
|
||||
+
|
||||
+ fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n"));
|
||||
|
||||
- return {};
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
|
||||
+ {
|
||||
+ if (separate_debug_file_debug)
|
||||
+ printf_unfiltered (_(" no, build-id does not match.\n"));
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ _(" no, build-id does not match.\n"));
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
@ -605,17 +620,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ if (ret_bfd != NULL)
|
||||
{
|
||||
if (separate_debug_file_debug)
|
||||
- printf_unfiltered (_(" no, build-id does not match.\n"));
|
||||
-
|
||||
- return {};
|
||||
+ printf_unfiltered (_(" yes!\n"));
|
||||
- fprintf_unfiltered (gdb_stdlog, _(" no, build-id does not match.\n"));
|
||||
+ fprintf_unfiltered (gdb_stdlog, _(" yes!\n"));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* If none of the real files is found report as missing file
|
||||
+ always the non-.%u-suffixed file. */
|
||||
+ std::string link0 = orig_link;
|
||||
+
|
||||
|
||||
- return {};
|
||||
+ /* If the symlink has target request to install the target.
|
||||
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
|
||||
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
|
||||
@ -632,7 +646,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
}
|
||||
|
||||
- if (separate_debug_file_debug)
|
||||
- printf_unfiltered (_(" yes!\n"));
|
||||
- fprintf_unfiltered (gdb_stdlog, _(" yes!\n"));
|
||||
+ if (link_return != NULL)
|
||||
+ {
|
||||
+ if (ret_bfd != NULL)
|
||||
@ -650,7 +664,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
}
|
||||
|
||||
/* Common code for finding BFDs of a given build-id. This function
|
||||
@@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
|
||||
@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
|
||||
|
||||
static gdb_bfd_ref_ptr
|
||||
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
@ -659,7 +673,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
{
|
||||
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
|
||||
cause "/.build-id/..." lookups. */
|
||||
@@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
if (size > 0)
|
||||
{
|
||||
size--;
|
||||
@ -680,8 +694,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
if (debug_bfd != NULL)
|
||||
return debug_bfd;
|
||||
|
||||
@@ -170,7 +673,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
|
||||
@@ -174,7 +678,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
if (!gdb_sysroot.empty ())
|
||||
{
|
||||
link = gdb_sysroot + link;
|
||||
- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
|
||||
@ -690,7 +704,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
if (debug_bfd != NULL)
|
||||
return debug_bfd;
|
||||
}
|
||||
@@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
@@ -183,30 +688,649 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -708,8 +722,440 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+
|
||||
+#include <rpm/rpmlib.h>
|
||||
+#include <rpm/rpmts.h>
|
||||
+#include <rpm/rpmdb.h>
|
||||
+#include <rpm/header.h>
|
||||
+#ifdef DLOPEN_LIBRPM
|
||||
+#include <dlfcn.h>
|
||||
+#endif
|
||||
+
|
||||
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
|
||||
+ librpm must not exit() an application on SIGINT
|
||||
+
|
||||
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
|
||||
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
|
||||
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
|
||||
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
|
||||
+int
|
||||
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
||||
+ and avoid their duplicities during a single inferior run. */
|
||||
+
|
||||
+static struct htab *missing_rpm_hash;
|
||||
+
|
||||
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
|
||||
+ all the rpms right before the nearest GDB prompt. It gets cleared after
|
||||
+ each such print (it is questionable if we should clear it after the print).
|
||||
+ */
|
||||
+
|
||||
+struct missing_rpm
|
||||
+ {
|
||||
+ struct missing_rpm *next;
|
||||
+ char rpm[1];
|
||||
+ };
|
||||
+static struct missing_rpm *missing_rpm_list;
|
||||
+static int missing_rpm_list_entries;
|
||||
+
|
||||
+/* Returns the count of newly added rpms. */
|
||||
+
|
||||
+static int
|
||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||
+missing_rpm_enlist (const char *filename)
|
||||
+#else
|
||||
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||
+#endif
|
||||
+{
|
||||
+ static int rpm_init_done = 0;
|
||||
+ rpmts ts;
|
||||
+ rpmdbMatchIterator mi;
|
||||
+ int count = 0;
|
||||
+
|
||||
+#ifdef DLOPEN_LIBRPM
|
||||
+ /* Duplicate here the declarations to verify they match. The same sanity
|
||||
+ check is present also in `configure.ac'. */
|
||||
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
||||
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
|
||||
+ extern int rpmReadConfigFiles(const char * file, const char * target);
|
||||
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
|
||||
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
||||
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
|
||||
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
||||
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
|
||||
+ extern rpmts rpmtsCreate(void);
|
||||
+ static rpmts (*rpmtsCreate_p) (void);
|
||||
+ extern rpmts rpmtsFree(rpmts ts);
|
||||
+ static rpmts (*rpmtsFree_p) (rpmts ts);
|
||||
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
||||
+ const void * keyp, size_t keylen);
|
||||
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
|
||||
+ rpmTag rpmtag,
|
||||
+ const void *keyp,
|
||||
+ size_t keylen);
|
||||
+#else /* !DLOPEN_LIBRPM */
|
||||
+# define headerFormat_p headerFormat
|
||||
+# define rpmReadConfigFiles_p rpmReadConfigFiles
|
||||
+# define rpmdbFreeIterator_p rpmdbFreeIterator
|
||||
+# define rpmdbNextIterator_p rpmdbNextIterator
|
||||
+# define rpmtsCreate_p rpmtsCreate
|
||||
+# define rpmtsFree_p rpmtsFree
|
||||
+# define rpmtsInitIterator_p rpmtsInitIterator
|
||||
+#endif /* !DLOPEN_LIBRPM */
|
||||
+
|
||||
+ gdb_assert (filename != NULL);
|
||||
+
|
||||
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (is_target_filename (filename))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (filename[0] != '/')
|
||||
+ {
|
||||
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!rpm_init_done)
|
||||
+ {
|
||||
+ static int init_tried;
|
||||
+
|
||||
+ /* Already failed the initialization before? */
|
||||
+ if (init_tried)
|
||||
+ return 0;
|
||||
+ init_tried = 1;
|
||||
+
|
||||
+#ifdef DLOPEN_LIBRPM
|
||||
+ {
|
||||
+ void *h;
|
||||
+
|
||||
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
|
||||
+ if (!h)
|
||||
+ {
|
||||
+ warning (_("Unable to open \"%s\" (%s), "
|
||||
+ "missing debuginfos notifications will not be displayed"),
|
||||
+ DLOPEN_LIBRPM, dlerror ());
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
|
||||
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
|
||||
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
|
||||
+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
|
||||
+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
|
||||
+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
|
||||
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
|
||||
+ {
|
||||
+ warning (_("Opened library \"%s\" is incompatible (%s), "
|
||||
+ "missing debuginfos notifications will not be displayed"),
|
||||
+ DLOPEN_LIBRPM, dlerror ());
|
||||
+ if (dlclose (h))
|
||||
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
|
||||
+ dlerror ());
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* DLOPEN_LIBRPM */
|
||||
+
|
||||
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
|
||||
+ {
|
||||
+ warning (_("Error reading the rpm configuration files"));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ rpm_init_done = 1;
|
||||
+ }
|
||||
+
|
||||
+ ts = rpmtsCreate_p ();
|
||||
+
|
||||
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
||||
+ if (mi != NULL)
|
||||
+ {
|
||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||
+ for (;;)
|
||||
+#else
|
||||
+ if (!verify_vendor) for (;;)
|
||||
+#endif
|
||||
+ {
|
||||
+ Header h;
|
||||
+ char *debuginfo, **slot, *s, *s2;
|
||||
+ errmsg_t err;
|
||||
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
|
||||
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
|
||||
+ rpmdbMatchIterator mi_debuginfo;
|
||||
+
|
||||
+ h = rpmdbNextIterator_p (mi);
|
||||
+ if (h == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ /* Verify the debuginfo file is not already installed. */
|
||||
+
|
||||
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
|
||||
+ &err);
|
||||
+ if (!debuginfo)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||
+ s = strrchr (debuginfo, '-') - srcrpmlen;
|
||||
+ s2 = NULL;
|
||||
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
|
||||
+ {
|
||||
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
|
||||
+ }
|
||||
+ if (s2)
|
||||
+ {
|
||||
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
|
||||
+ }
|
||||
+ if (!s2)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ debuginfo);
|
||||
+ xfree (debuginfo);
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
+ memmove (s2 + debuginfolen, s2, s - s2);
|
||||
+ memcpy (s2, "-debuginfo", debuginfolen);
|
||||
+ /* s = `XXXX.%{arch}' */
|
||||
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
|
||||
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
|
||||
+ /* strlen ("XX") == srcrpmlen */
|
||||
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
|
||||
+ strlen (s + srcrpmlen + debuginfolen) + 1);
|
||||
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
|
||||
+
|
||||
+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
|
||||
+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
|
||||
+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
|
||||
+ xfree (debuginfo);
|
||||
+ if (mi_debuginfo)
|
||||
+ {
|
||||
+ rpmdbFreeIterator_p (mi_debuginfo);
|
||||
+ count = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
||||
+ debuginfo = headerFormat_p (h,
|
||||
+ "%{name}-%{version}-%{release}.%{arch}",
|
||||
+ &err);
|
||||
+ if (!debuginfo)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Base package name for `debuginfo-install'. We do not use the
|
||||
+ `yum' command directly as the line
|
||||
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
|
||||
+ would be more complicated than just:
|
||||
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
|
||||
+ Do not supply the rpm base name (derived from .src.rpm name) as
|
||||
+ debuginfo-install is unable to install the debuginfo package if
|
||||
+ the base name PKG binary rpm is not installed while for example
|
||||
+ PKG-libs would be installed (RH Bug 467901).
|
||||
+ FUTURE: After multiple debuginfo versions simultaneously installed
|
||||
+ get supported the support for the VERSION-RELEASE tags handling
|
||||
+ may need an update. */
|
||||
+
|
||||
+ if (missing_rpm_hash == NULL)
|
||||
+ {
|
||||
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
|
||||
+ should not deallocate the entries. */
|
||||
+
|
||||
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
|
||||
+ (int (*) (const void *, const void *)) streq,
|
||||
+ NULL, xcalloc, xfree);
|
||||
+ }
|
||||
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
|
||||
+ /* XCALLOC never returns NULL. */
|
||||
+ gdb_assert (slot != NULL);
|
||||
+ if (*slot == NULL)
|
||||
+ {
|
||||
+ struct missing_rpm *missing_rpm;
|
||||
+
|
||||
+ *slot = debuginfo;
|
||||
+
|
||||
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
|
||||
+ strcpy (missing_rpm->rpm, debuginfo);
|
||||
+ missing_rpm->next = missing_rpm_list;
|
||||
+ missing_rpm_list = missing_rpm;
|
||||
+ missing_rpm_list_entries++;
|
||||
+ }
|
||||
+ else
|
||||
+ xfree (debuginfo);
|
||||
+ count++;
|
||||
+ }
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+ else /* verify_vendor */
|
||||
+ {
|
||||
+ int vendor_pass = 0, vendor_fail = 0;
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ Header h;
|
||||
+ errmsg_t err;
|
||||
+ char *vendor;
|
||||
+
|
||||
+ h = rpmdbNextIterator_p (mi);
|
||||
+ if (h == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ vendor = headerFormat_p (h, "%{vendor}", &err);
|
||||
+ if (!vendor)
|
||||
+ {
|
||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
+ err);
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
|
||||
+ vendor_pass = 1;
|
||||
+ else
|
||||
+ vendor_fail = 1;
|
||||
+ xfree (vendor);
|
||||
+ }
|
||||
+ count = vendor_pass != 0 && vendor_fail == 0;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ rpmdbFreeIterator_p (mi);
|
||||
+ }
|
||||
+
|
||||
+ rpmtsFree_p (ts);
|
||||
+
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+missing_rpm_enlist (const char *filename)
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 0);
|
||||
+}
|
||||
+
|
||||
+extern int rpm_verify_vendor (const char *filename);
|
||||
+int
|
||||
+rpm_verify_vendor (const char *filename)
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 1);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static bool
|
||||
+missing_rpm_list_compar (const char *ap, const char *bp)
|
||||
+{
|
||||
+ return strcoll (ap, bp) < 0;
|
||||
+}
|
||||
+
|
||||
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
|
||||
+ also return only NULL. */
|
||||
+
|
||||
+static void
|
||||
+missing_rpm_list_print (void)
|
||||
+{
|
||||
+ struct missing_rpm *list_iter;
|
||||
+
|
||||
+ if (missing_rpm_list_entries == 0)
|
||||
+ return;
|
||||
+
|
||||
+ std::vector<const char *> array (missing_rpm_list_entries);
|
||||
+ size_t idx = 0;
|
||||
+
|
||||
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
||||
+ list_iter = list_iter->next)
|
||||
+ {
|
||||
+ array[idx++] = list_iter->rpm;
|
||||
+ }
|
||||
+ gdb_assert (idx == missing_rpm_list_entries);
|
||||
+
|
||||
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
|
||||
+
|
||||
+ /* We zero out the number of missing RPMs here because of a nasty
|
||||
+ bug (see RHBZ 1801974).
|
||||
+
|
||||
+ When we call 'puts_unfiltered' below, if pagination is on and if
|
||||
+ the number of missing RPMs is big enough to trigger pagination,
|
||||
+ we will end up in an infinite recursion. The call chain looks
|
||||
+ like this:
|
||||
+
|
||||
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
|
||||
+ -> prompt_for_continue -> display_gdb_prompt ->
|
||||
+ debug_flush_missing -> missing_rpm_list_print ...
|
||||
+
|
||||
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
|
||||
+ *before* calling any print function. */
|
||||
+ missing_rpm_list_entries = 0;
|
||||
+
|
||||
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||
+ "dnf "
|
||||
+#endif
|
||||
+ "debuginfo-install");
|
||||
+ for (const char *el : array)
|
||||
+ {
|
||||
+ puts_unfiltered (" ");
|
||||
+ puts_unfiltered (el);
|
||||
+ }
|
||||
+ puts_unfiltered ("\n");
|
||||
+
|
||||
+ while (missing_rpm_list != NULL)
|
||||
+ {
|
||||
+ list_iter = missing_rpm_list;
|
||||
+ missing_rpm_list = list_iter->next;
|
||||
+ xfree (list_iter);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+missing_rpm_change (void)
|
||||
+{
|
||||
+ debug_flush_missing ();
|
||||
+
|
||||
+ gdb_assert (missing_rpm_list == NULL);
|
||||
+ if (missing_rpm_hash != NULL)
|
||||
+ {
|
||||
+ htab_delete (missing_rpm_hash);
|
||||
+ missing_rpm_hash = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+enum missing_exec
|
||||
+ {
|
||||
+ /* Init state. EXEC_BFD also still could be NULL. */
|
||||
+ MISSING_EXEC_NOT_TRIED,
|
||||
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
|
||||
+ MISSING_EXEC_NOT_FOUND,
|
||||
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
|
||||
+ or separate) or the main executable's RPM is now contained in
|
||||
+ MISSING_RPM_HASH. */
|
||||
+ MISSING_EXEC_ENLISTED
|
||||
+ };
|
||||
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
|
||||
+
|
||||
+#endif /* HAVE_LIBRPM */
|
||||
+
|
||||
+void
|
||||
+debug_flush_missing (void)
|
||||
+{
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ missing_rpm_list_print ();
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
|
||||
+ Try to install the hash file ...
|
||||
+ yum --enablerepo='*debug*' install ...
|
||||
+ avoidance. */
|
||||
+
|
||||
+struct missing_filepair
|
||||
@ -763,11 +1209,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ /* All their memory came just from missing_filepair_OBSTACK. */
|
||||
+ missing_filepair_hash = NULL;
|
||||
+ }
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ missing_exec = MISSING_EXEC_NOT_TRIED;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+debug_print_executable_changed (void)
|
||||
+{
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ missing_rpm_change ();
|
||||
+#endif
|
||||
+ missing_filepair_change ();
|
||||
+}
|
||||
+
|
||||
@ -834,14 +1286,38 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+
|
||||
+ *slot = missing_filepair;
|
||||
+
|
||||
+ /* We do not collect and flush these messages as each such message
|
||||
+ already requires its own separate lines. */
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
||||
+ {
|
||||
+ const char *execfilename = get_exec_file (0);
|
||||
+
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ _("Missing separate debuginfo for %s\n"), binary);
|
||||
+ if (debug != NULL)
|
||||
+ fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
|
||||
+ debug);
|
||||
+ if (execfilename != NULL)
|
||||
+ {
|
||||
+ if (missing_rpm_enlist (execfilename) == 0)
|
||||
+ missing_exec = MISSING_EXEC_NOT_FOUND;
|
||||
+ else
|
||||
+ missing_exec = MISSING_EXEC_ENLISTED;
|
||||
+ }
|
||||
+ }
|
||||
+ if (missing_exec != MISSING_EXEC_ENLISTED)
|
||||
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
|
||||
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
|
||||
+#endif /* HAVE_LIBRPM */
|
||||
+ {
|
||||
+ /* We do not collect and flush these messages as each such message
|
||||
+ already requires its own separate lines. */
|
||||
+
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ _("Missing separate debuginfo for %s\n"), binary);
|
||||
+ if (debug != NULL)
|
||||
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
|
||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||
+ "dnf"
|
||||
+#else
|
||||
+ "yum"
|
||||
+#endif
|
||||
+ " --enablerepo='*debug*' install", debug);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* See build-id.h. */
|
||||
@ -884,8 +1360,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
if (build_id != NULL)
|
||||
{
|
||||
if (separate_debug_file_debug)
|
||||
printf_unfiltered (_("\nLooking for separate debug info (build-id) for "
|
||||
"%s\n"), objfile_name (objfile));
|
||||
@@ -214,8 +1338,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||
_("\nLooking for separate debug info (build-id) for "
|
||||
"%s\n"), objfile_name (objfile));
|
||||
|
||||
+ char *build_id_filename_cstr = NULL;
|
||||
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
|
||||
@ -906,15 +1383,15 @@ 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,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||
@@ -228,3 +1365,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||
|
||||
return std::string ();
|
||||
}
|
||||
+
|
||||
+extern void _initialize_build_id (void);
|
||||
+void _initialize_build_id ();
|
||||
+
|
||||
+void
|
||||
+_initialize_build_id (void)
|
||||
+_initialize_build_id ()
|
||||
+{
|
||||
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
|
||||
+ _("\
|
||||
@ -1056,7 +1533,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
|
||||
@@ -21415,6 +21415,27 @@ information files.
|
||||
@@ -21524,6 +21524,27 @@ information files.
|
||||
|
||||
@end table
|
||||
|
||||
@ -1087,7 +1564,7 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
|
||||
--- a/gdb/dwarf2/index-cache.c
|
||||
+++ b/gdb/dwarf2/index-cache.c
|
||||
@@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
||||
@@ -97,7 +97,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
||||
return;
|
||||
|
||||
/* Get build id of objfile. */
|
||||
@ -1095,8 +1572,8 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
|
||||
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd);
|
||||
if (build_id == nullptr)
|
||||
{
|
||||
if (debug_index_cache)
|
||||
@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
||||
index_cache_debug ("objfile %s has no build id",
|
||||
@@ -114,7 +114,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
||||
|
||||
if (dwz != nullptr)
|
||||
{
|
||||
@ -1109,7 +1586,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
|
||||
@@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
|
||||
@@ -5476,7 +5476,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)
|
||||
{
|
||||
@ -1118,7 +1595,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
if (build_id == nullptr)
|
||||
return {};
|
||||
|
||||
@@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
|
||||
@@ -5489,7 +5489,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)
|
||||
{
|
||||
@ -1130,7 +1607,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
|
||||
@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
@@ -1270,7 +1270,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
&& objfile->separate_debug_objfile == NULL
|
||||
&& objfile->separate_debug_objfile_backlink == NULL)
|
||||
{
|
||||
@ -1141,7 +1618,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
|
||||
if (debugfile.empty ())
|
||||
debugfile = find_separate_debug_file_by_debuglink (objfile);
|
||||
@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
@@ -1285,7 +1287,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
else
|
||||
{
|
||||
has_dwarf2 = false;
|
||||
@ -1150,7 +1627,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
|
||||
if (build_id != nullptr)
|
||||
{
|
||||
@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
@@ -1310,6 +1312,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
has_dwarf2 = true;
|
||||
}
|
||||
}
|
||||
@ -1164,7 +1641,7 @@ 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
|
||||
@@ -237,7 +237,7 @@ validate_exec_file (int from_tty)
|
||||
@@ -238,7 +238,7 @@ validate_exec_file (int from_tty)
|
||||
current_exec_file = get_exec_file (0);
|
||||
|
||||
const bfd_build_id *exec_file_build_id
|
||||
@ -1173,7 +1650,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
|
||||
if (exec_file_build_id != nullptr)
|
||||
{
|
||||
/* Prepend the target prefix, to force gdb_bfd_open to open the
|
||||
@@ -250,7 +250,7 @@ validate_exec_file (int from_tty)
|
||||
@@ -251,7 +251,7 @@ validate_exec_file (int from_tty)
|
||||
if (abfd != nullptr)
|
||||
{
|
||||
const bfd_build_id *target_exec_file_build_id
|
||||
@ -1185,7 +1662,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
|
||||
@@ -812,6 +812,10 @@ struct objfile
|
||||
@@ -769,6 +769,10 @@ struct objfile
|
||||
bool skip_jit_symbol_lookup = false;
|
||||
};
|
||||
|
||||
@ -1228,7 +1705,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);
|
||||
@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
@@ -1248,9 +1249,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1286,7 +1763,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
|
||||
@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s)
|
||||
@@ -1199,7 +1199,7 @@ open_source_file (struct symtab *s)
|
||||
srcpath += s->filename;
|
||||
}
|
||||
|
||||
@ -1381,7 +1858,17 @@ 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
|
||||
@@ -2130,6 +2130,17 @@ proc default_gdb_start { } {
|
||||
@@ -141,7 +141,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.
|
||||
@@ -2200,6 +2201,17 @@ proc default_gdb_start { } {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,108 +0,0 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.7-ppc-clobbered-registers-O2-test.patch
|
||||
|
||||
;; Test PPC hiding of call-volatile parameter register.
|
||||
;;=fedoratest
|
||||
|
||||
2007-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to
|
||||
`powerpc*'.
|
||||
|
||||
Testcase for:
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
|
||||
|
||||
2007-10-21 Luis Machado <luisgpm@br.ibm.com>
|
||||
|
||||
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
|
||||
* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
|
||||
default dwarf2_frame_set_init_reg function.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+unsigned * __attribute__((noinline))
|
||||
+start_sequence (unsigned * x, unsigned * y)
|
||||
+{
|
||||
+ return (unsigned *)0xdeadbeef;
|
||||
+};
|
||||
+
|
||||
+unsigned __attribute__((noinline))
|
||||
+gen_movsd (unsigned * operand0, unsigned * operand1)
|
||||
+{
|
||||
+ return *start_sequence(operand0, operand1);
|
||||
+}
|
||||
+
|
||||
+int main(void)
|
||||
+{
|
||||
+ unsigned x, y;
|
||||
+
|
||||
+ x = 13;
|
||||
+ y = 14;
|
||||
+ return (int)gen_movsd (&x, &y);
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
|
||||
@@ -0,0 +1,54 @@
|
||||
+# Copyright 2006 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+#
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+# Test displaying call clobbered registers in optimized binaries for ppc.
|
||||
+# GDB should not show incorrect values.
|
||||
+
|
||||
+if ![istarget "powerpc*-*"] then {
|
||||
+ verbose "Skipping powerpc* call clobbered registers testing."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "ppc-clobbered-registers-O2"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+set compile_flags "debug additional_flags=-O2"
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } {
|
||||
+ unsupported "Testcase compile failed."
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ perror "Couldn't run to breakpoint"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \
|
||||
+ "Insert breakpoint at problematic function"
|
||||
+
|
||||
+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \
|
||||
+ "Run until problematic function"
|
||||
+
|
||||
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
|
||||
+ "Check value of call clobbered registers"
|
@ -1,48 +0,0 @@
|
||||
[gdb/ada] Fix assert in ada_is_unconstrained_packed_array_type
|
||||
|
||||
On openSUSE Leap 42.3, with system compiler gcc 4.8.5 I run into:
|
||||
...
|
||||
(gdb) print u_one_two_three^M
|
||||
src/gdb/gdbtypes.h:1050: internal-error: field: \
|
||||
Assertion `idx >= 0 && idx < num_fields ()' failed.^M
|
||||
...
|
||||
|
||||
We run into trouble while doing this in
|
||||
ada_is_unconstrained_packed_array_type:
|
||||
...
|
||||
1953 return TYPE_FIELD_BITSIZE (type, 0) > 0;
|
||||
...
|
||||
which tries to get field 0 from a type without fields:
|
||||
...
|
||||
(gdb) p type->num_fields ()
|
||||
$6 = 0
|
||||
...
|
||||
which is the case because the type is a typedef:
|
||||
...
|
||||
(gdb) p type->code ()
|
||||
$7 = TYPE_CODE_TYPEDEF
|
||||
...
|
||||
|
||||
Fix this by using the type referenced by the typedef instead.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28323
|
||||
|
||||
---
|
||||
gdb/ada-lang.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
|
||||
index b098991612d..9341c7b3677 100644
|
||||
--- a/gdb/ada-lang.c
|
||||
+++ b/gdb/ada-lang.c
|
||||
@@ -1927,6 +1927,8 @@ ada_is_unconstrained_packed_array_type (struct type *type)
|
||||
/* The structure's first field is a pointer to an array, so this
|
||||
fetches the array type. */
|
||||
type = TYPE_TARGET_TYPE (type->field (0).type ());
|
||||
+ if (type->code () == TYPE_CODE_TYPEDEF)
|
||||
+ type = ada_typedef_target_type (type);
|
||||
/* Now we can see if the array elements are packed. */
|
||||
return TYPE_FIELD_BITSIZE (type, 0) > 0;
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
[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
|
@ -1,37 +0,0 @@
|
||||
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. */
|
@ -69,7 +69,7 @@ gdb/testsuite/ChangeLog:
|
||||
4 files changed, 68 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
|
||||
index 56ae12a0c19..ce8af45a925 100644
|
||||
index 31d398cb13b..4eff591b3df 100644
|
||||
--- a/gdb/cli/cli-cmds.c
|
||||
+++ b/gdb/cli/cli-cmds.c
|
||||
@@ -39,6 +39,7 @@
|
||||
@ -80,8 +80,8 @@ index 56ae12a0c19..ce8af45a925 100644
|
||||
|
||||
#include "ui-out.h"
|
||||
#include "interps.h"
|
||||
@@ -2249,6 +2250,34 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch,
|
||||
gdbarch);
|
||||
@@ -2399,6 +2400,34 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch,
|
||||
return str_value_from_setting (*show_cmd->var, gdbarch);
|
||||
}
|
||||
|
||||
+/* Completer for "ignore-errors". */
|
||||
@ -115,7 +115,7 @@ index 56ae12a0c19..ce8af45a925 100644
|
||||
void _initialize_cli_cmds ();
|
||||
void
|
||||
_initialize_cli_cmds ()
|
||||
@@ -2625,4 +2654,10 @@ when GDB is started."), GDBINIT);
|
||||
@@ -2786,4 +2815,10 @@ when GDB is started."), GDBINIT).release ();
|
||||
c = add_cmd ("source", class_support, source_command,
|
||||
source_help_text, &cmdlist);
|
||||
set_cmd_completer (c, filename_completer);
|
||||
@ -127,10 +127,10 @@ index 56ae12a0c19..ce8af45a925 100644
|
||||
+ set_cmd_completer (c, ignore_errors_command_completer);
|
||||
}
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index 025d6bec42a..1700b0305c5 100644
|
||||
index 1cf3550885e..68e11585942 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -27508,7 +27508,8 @@ The lines in a command file are generally executed sequentially,
|
||||
@@ -27680,7 +27680,8 @@ The lines in a command file are generally executed sequentially,
|
||||
unless the order of execution is changed by one of the
|
||||
@emph{flow-control commands} described below. The commands are not
|
||||
printed as they are executed. An error in any command terminates
|
||||
@ -140,7 +140,7 @@ index 025d6bec42a..1700b0305c5 100644
|
||||
|
||||
@value{GDBN} first searches for @var{filename} in the current directory.
|
||||
If the file is not found there, and @var{filename} does not specify a
|
||||
@@ -27603,6 +27604,11 @@ the controlling expression.
|
||||
@@ -27775,6 +27776,11 @@ the controlling expression.
|
||||
@item end
|
||||
Terminate the block of commands that are the body of @code{if},
|
||||
@code{else}, or @code{while} flow-control commands.
|
||||
|
@ -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
|
||||
@@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid)
|
||||
@@ -14343,7 +14343,17 @@ remote_target::pid_to_exec_file (int pid)
|
||||
char *annex = NULL;
|
||||
|
||||
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
|
||||
|
@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
|
||||
|
||||
if [get_compiler_info] {
|
||||
return -1
|
||||
@@ -71,8 +72,26 @@ gdb_test "br foo2" \
|
||||
@@ -70,8 +71,26 @@ gdb_test "br foo2" \
|
||||
"Breakpoint.*: foo2. .2 locations..*" \
|
||||
"foo2 in mdlib"
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
[gdb/doc] Fix print inferior-events default
|
||||
|
||||
In the docs about print inferior-events we read:
|
||||
...
|
||||
By default, these messages will not be printed.
|
||||
...
|
||||
|
||||
That used to be the case, but is no longer so since commit f67c0c91715 "Enable
|
||||
'set print inferior-events' and improve detach/fork/kill/exit messages".
|
||||
|
||||
Fix this by updating the docs.
|
||||
|
||||
---
|
||||
gdb/doc/gdb.texinfo | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index 1700b0305c5..d53c9a03704 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -3395,7 +3395,7 @@ control use @w{@code{set print inferior-events}}:
|
||||
The @code{set print inferior-events} command allows you to enable or
|
||||
disable printing of messages when @value{GDBN} notices that new
|
||||
inferiors have started or that inferiors have exited or have been
|
||||
-detached. By default, these messages will not be printed.
|
||||
+detached. By default, these messages will be printed.
|
||||
|
||||
@kindex show print inferior-events
|
||||
@item show print inferior-events
|
@ -1,138 +0,0 @@
|
||||
[gdb/exp] Improve <error reading variable> message
|
||||
|
||||
When printing a variable x in a subroutine foo:
|
||||
...
|
||||
subroutine foo (x)
|
||||
integer(4) :: x (*)
|
||||
x(3) = 1
|
||||
end subroutine foo
|
||||
...
|
||||
where x is an array with unknown bounds, we get:
|
||||
...
|
||||
$ gdb -q -batch outputs/gdb.fortran/array-no-bounds/array-no-bounds \
|
||||
-ex "break foo" \
|
||||
-ex run \
|
||||
-ex "print x"
|
||||
Breakpoint 1 at 0x4005cf: file array-no-bounds.f90, line 18.
|
||||
|
||||
Breakpoint 1, foo (x=...) at array-no-bounds.f90:18
|
||||
18 x(3) = 1
|
||||
$1 = <error reading variable>
|
||||
...
|
||||
|
||||
Improve the error message by printing the details of the error, such that we
|
||||
have instead:
|
||||
...
|
||||
$1 = <error reading variable: failed to get range bounds>
|
||||
...
|
||||
|
||||
This is a change in gdb/valprint.c, and grepping through the sources reveals
|
||||
that this is a common pattern.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.fortran/array-no-bounds.exp | 44 +++++++++++++++++++++++++++
|
||||
gdb/testsuite/gdb.fortran/array-no-bounds.f90 | 30 ++++++++++++++++++
|
||||
gdb/valprint.c | 2 +-
|
||||
3 files changed, 75 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.exp b/gdb/testsuite/gdb.fortran/array-no-bounds.exp
|
||||
new file mode 100644
|
||||
index 00000000000..a686232cb0e
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/array-no-bounds.exp
|
||||
@@ -0,0 +1,44 @@
|
||||
+# Copyright 2021 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/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite. It contains test to ensure that
|
||||
+# array bounds accept LONGEST.
|
||||
+
|
||||
+if { [skip_fortran_tests] } { return -1 }
|
||||
+
|
||||
+standard_testfile .f90
|
||||
+load_lib fortran.exp
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
|
||||
+ {f90 debug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![fortran_runto_main] } {
|
||||
+ perror "Could not run to main."
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# Go to foo.
|
||||
+gdb_breakpoint foo
|
||||
+gdb_continue_to_breakpoint "foo"
|
||||
+
|
||||
+# Print x, and check that we get a useful error message.
|
||||
+gdb_test "p x" \
|
||||
+ " = <error reading variable: failed to get range bounds>"
|
||||
+
|
||||
+# Print x using @ syntax.
|
||||
+gdb_test "p x(1)@5" \
|
||||
+ " = \\(0, 0, 0, 0, 0\\)"
|
||||
diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.f90 b/gdb/testsuite/gdb.fortran/array-no-bounds.f90
|
||||
new file mode 100644
|
||||
index 00000000000..7b9ca998fff
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/array-no-bounds.f90
|
||||
@@ -0,0 +1,30 @@
|
||||
+! Copyright 2021 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/>.
|
||||
+
|
||||
+subroutine foo (x)
|
||||
+ integer(4) :: x (*)
|
||||
+ x(3) = 1
|
||||
+end subroutine foo
|
||||
+
|
||||
+program test
|
||||
+ interface
|
||||
+ subroutine foo (x)
|
||||
+ integer(4) :: x (*)
|
||||
+ end subroutine
|
||||
+ end interface
|
||||
+ integer(4) :: x (5)
|
||||
+ x(:) = 0
|
||||
+ call foo (x)
|
||||
+end program
|
||||
diff --git a/gdb/valprint.c b/gdb/valprint.c
|
||||
index 324055da93f..05740c838ad 100644
|
||||
--- a/gdb/valprint.c
|
||||
+++ b/gdb/valprint.c
|
||||
@@ -1050,7 +1050,7 @@ do_val_print (struct value *value, struct ui_file *stream, int recurse,
|
||||
catch (const gdb_exception_error &except)
|
||||
{
|
||||
fprintf_styled (stream, metadata_style.style (),
|
||||
- _("<error reading variable>"));
|
||||
+ _("<error reading variable: %s>"), except.what ());
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@@ -9544,6 +9544,7 @@ if test x"$prefer_curses" = xyes; then
|
||||
@@ -9567,6 +9567,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 :
|
||||
@@ -9568,7 +9569,7 @@ return waddstr ();
|
||||
@@ -9591,7 +9592,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
|
||||
@@ -9642,6 +9643,7 @@ case $host_os in
|
||||
@@ -9665,6 +9666,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 :
|
||||
@@ -9666,7 +9668,7 @@ return tgetent ();
|
||||
@@ -9689,7 +9691,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
|
||||
@@ -736,7 +736,8 @@ if test x"$prefer_curses" = xyes; then
|
||||
@@ -713,7 +713,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
|
||||
@@ -778,7 +779,8 @@ case $host_os in
|
||||
@@ -755,7 +756,8 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
|
64
gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch
Normal file
64
gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch
Normal file
@ -0,0 +1,64 @@
|
||||
gdb: fix for gdb.base/eof-exit.exp test failures
|
||||
|
||||
This fix relates to PR gdb/29032, this makes the test more stable by
|
||||
ensuring that the Ctrl-D is only sent once the prompt has been
|
||||
displayed. This issue was also discussed on the mailing list here:
|
||||
|
||||
https://sourceware.org/pipermail/gdb-patches/2022-April/187670.html
|
||||
|
||||
The problem identified in the bug report is that sometimes the Ctrl-D
|
||||
(that the test sends to GDB) arrives while GDB is processing a
|
||||
command. When this happens the Ctrl-D is handled differently than if
|
||||
the Ctrl-D is sent while GDB is waiting for input at a prompt.
|
||||
|
||||
The original intent of the test was that the Ctrl-D be sent while GDB
|
||||
was waiting at a prompt, and that is the case the occurs most often,
|
||||
but, when the Ctrl-D arrives during command processing, then GDB will
|
||||
ignore the Ctrl-D, and the test will fail.
|
||||
|
||||
This commit ensures the Ctrl-D is always sent while GDB is waiting at
|
||||
a prompt, which makes this test stable.
|
||||
|
||||
But, that still leaves an open question, what should happen when the
|
||||
Ctrl-D arrives while GDB is processing a command? This commit doesn't
|
||||
attempt to answer that question, which is while bug PR gdb/29032 will
|
||||
not be closed once this commit is merged.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29032
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/eof-exit.exp | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
index d604d029974..53a3b56dce8 100644
|
||||
--- a/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
+++ b/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
@@ -25,9 +25,27 @@ proc run_test {} {
|
||||
#
|
||||
# Send a newline character, which will cause GDB to redisplay the
|
||||
# prompt.
|
||||
+ #
|
||||
+ # We then consume the newline characters, and then make use of
|
||||
+ # expect's -notransfer option to ensure that the prompt has been
|
||||
+ # displayed, but to leave the prompt in expect's internal buffer.
|
||||
+ # This is important as the following test wants to check how GDB
|
||||
+ # displays the 'quit' message relative to the prompt, this is much
|
||||
+ # easier to do if the prompt is still in expect's buffers.
|
||||
+ #
|
||||
+ # The other special thing we do here is avoid printing a 'PASS'
|
||||
+ # result. The reason for this is so that the GDB output in the
|
||||
+ # log file will match what a user should see, this makes it much
|
||||
+ # easier to debug issues. Obviously we could print a 'PASS' here
|
||||
+ # as the text printed by expect is not considered part of GDB's
|
||||
+ # output, so the pattern matching will work just fine... but, the
|
||||
+ # log file becomes much harder to read.
|
||||
send_gdb "\n"
|
||||
gdb_test_multiple "" "discard newline" {
|
||||
-re "^\r\n" {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ -notransfer -re "^\[^\n\]*$::gdb_prompt $" {
|
||||
}
|
||||
}
|
||||
|
47
gdb-fix-watchpoints-triggered.patch
Normal file
47
gdb-fix-watchpoints-triggered.patch
Normal file
@ -0,0 +1,47 @@
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
index 1e524b5942f..459bc13f398 100644
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -4916,6 +4916,7 @@ watchpoints_triggered (const target_waitstatus &ws)
|
||||
affected by this data address as triggered, and all others as not
|
||||
triggered. */
|
||||
|
||||
+ size_t triggered_cnt = 0;
|
||||
for (breakpoint *b : all_breakpoints ())
|
||||
if (is_hardware_watchpoint (b))
|
||||
{
|
||||
@@ -4932,6 +4933,7 @@ watchpoints_triggered (const target_waitstatus &ws)
|
||||
if (newaddr == start)
|
||||
{
|
||||
w->watchpoint_triggered = watch_triggered_yes;
|
||||
+ triggered_cnt++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4941,11 +4943,26 @@ watchpoints_triggered (const target_waitstatus &ws)
|
||||
loc->length))
|
||||
{
|
||||
w->watchpoint_triggered = watch_triggered_yes;
|
||||
+ triggered_cnt++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ if (triggered_cnt == 0)
|
||||
+ {
|
||||
+ /* The target could report the data address. But none of the
|
||||
+ watchpoints was affected by this data address, so mark all
|
||||
+ watchpoints as unknown. */
|
||||
+ for (breakpoint *b : all_breakpoints ())
|
||||
+ if (is_hardware_watchpoint (b))
|
||||
+ {
|
||||
+ struct watchpoint *w = (struct watchpoint *) b;
|
||||
+
|
||||
+ w->watchpoint_triggered = watch_triggered_unknown;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
[gdb/fortran] Handle DW_AT_string_length with loclistptr
|
||||
|
||||
Fixes PR26910 - "[fortran] Printing dynamic string with DW_AT_string_length
|
||||
of class loclistpr fails".
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=26910
|
||||
|
||||
---
|
||||
gdb/dwarf2/read.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 05a50515ce4..798585dd380 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -18175,14 +18175,30 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
||||
}
|
||||
else if (attr->form_is_constant ())
|
||||
prop->set_const_val (attr->constant_value (0));
|
||||
- else
|
||||
+ else if (attr->form_is_section_offset ())
|
||||
{
|
||||
- dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form),
|
||||
- dwarf2_name (die, cu));
|
||||
- return 0;
|
||||
+ switch (attr->name)
|
||||
+ {
|
||||
+ case DW_AT_string_length:
|
||||
+ baton = XOBNEW (obstack, struct dwarf2_property_baton);
|
||||
+ baton->property_type = default_type;
|
||||
+ fill_in_loclist_baton (cu, &baton->loclist, attr);
|
||||
+ prop->set_loclist (baton);
|
||||
+ gdb_assert (prop->baton () != NULL);
|
||||
+ break;
|
||||
+ default:
|
||||
+ goto invalid;
|
||||
+ }
|
||||
}
|
||||
+ else
|
||||
+ goto invalid;
|
||||
|
||||
return 1;
|
||||
+
|
||||
+ invalid:
|
||||
+ dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form),
|
||||
+ dwarf2_name (die, cu));
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* See read.h. */
|
@ -6,5 +6,5 @@ index b9770ea415..3149f6e1fe 100644
|
||||
-#!/usr/bin/env bash
|
||||
+#!/bin/bash
|
||||
|
||||
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
||||
|
||||
|
85
gdb-improved-eof-handling-when-using-readline-7.patch
Normal file
85
gdb-improved-eof-handling-when-using-readline-7.patch
Normal file
@ -0,0 +1,85 @@
|
||||
gdb: improved EOF handling when using readline 7
|
||||
|
||||
In this commit:
|
||||
|
||||
commit a6b413d24ccc5d76179bab866834e11fd6fec294
|
||||
Date: Fri Mar 11 14:44:03 2022 +0000
|
||||
|
||||
gdb: work around prompt corruption caused by bracketed-paste-mode
|
||||
|
||||
a change was made to GDB to work around bug PR gdb/28833. The
|
||||
consequence of this work around is that, when bracketed paste mode is
|
||||
enabled in readline, and GDB is quit by sending EOF, then the output
|
||||
will look like this:
|
||||
|
||||
(gdb)
|
||||
quit
|
||||
|
||||
The ideal output, which is what we get when bracketed paste mode is
|
||||
off, is this:
|
||||
|
||||
(gdb) quit
|
||||
|
||||
The reason we need to make this change is explained in the original
|
||||
commit referenced above. What isn't mentioned in the above commit, is
|
||||
that the change that motivated this work around was only added in
|
||||
readline 8, older versions of readline don't require the change.
|
||||
|
||||
In later commits in this series I will add a fix to GDB's in-tree copy
|
||||
of readline (this fix is back-ported from upstream readline), and then
|
||||
I will change GDB so that, when using the (patched) in-tree readline,
|
||||
we can have the ideal output in all cases.
|
||||
|
||||
However, GDB can be built against the system readline. When this is
|
||||
done, and the system readline is version 8, then we will still have to
|
||||
use the work around (two line) style output.
|
||||
|
||||
But, if GDB is built against the system readline, and the system
|
||||
readline is an older version 7 readline, then there's no reason why we
|
||||
can't have the ideal output, after all, readline 7 doesn't include the
|
||||
change that we need to work around.
|
||||
|
||||
This commit changes GDB so that, when using readline 7 we get the
|
||||
ideal output in all cases. This change is trivial (a simple check
|
||||
against the readline version number) so I think this should be fine to
|
||||
include.
|
||||
|
||||
For testing this commit, you need to configure GDB including the
|
||||
'--with-system-readline' flag, and build GDB on a system that uses
|
||||
readline 7, for example 'Ubuntu 18.04'. Then run the test
|
||||
'gdb.base/eof-exit.exp', you should expect everything to PASS.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833
|
||||
|
||||
---
|
||||
gdb/event-top.c | 3 ++-
|
||||
gdb/testsuite/gdb.base/eof-exit.exp | 2 +-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
index c1a95a4b748..7ddb3e8aee6 100644
|
||||
--- a/gdb/event-top.c
|
||||
+++ b/gdb/event-top.c
|
||||
@@ -783,7 +783,8 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
||||
we first print '\n' to move to the next line, and then print the
|
||||
quit. This isn't ideal, but avoids corrupting the prompt. */
|
||||
const char *value = rl_variable_value ("enable-bracketed-paste");
|
||||
- if (value != nullptr && strcmp (value, "on") == 0)
|
||||
+ if (value != nullptr && strcmp (value, "on") == 0
|
||||
+ && ((rl_readline_version >> 8) & 0xff) > 0x07)
|
||||
printf_unfiltered ("\n");
|
||||
printf_unfiltered ("quit\n");
|
||||
execute_command ("quit", 1);
|
||||
diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
index c88aced9f35..e04c38bf8d7 100644
|
||||
--- a/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
+++ b/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
@@ -67,7 +67,7 @@ proc run_test {} {
|
||||
# line after the 'quit', this catches that case.
|
||||
fail $gdb_test_name
|
||||
}
|
||||
- -re "$::gdb_prompt quit\[^\n\]*\r\n\[^\n\]*$" {
|
||||
+ -re "$::gdb_prompt \[^\n\r\]*quit\[^\n\]*\r\n\[^\n\]*$" {
|
||||
pass $gdb_test_name
|
||||
}
|
||||
eof {
|
@ -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
|
||||
@@ -135,7 +135,7 @@ AC_DEFUN([GDB_AC_COMMON], [
|
||||
@@ -156,7 +156,7 @@ AC_DEFUN([GDB_AC_COMMON], [
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <linux/perf_event.h>
|
||||
#ifndef PERF_ATTR_SIZE_VER5
|
||||
|
@ -1,547 +0,0 @@
|
||||
From c0154a4a21a3aed01ef53877af05cf0109a0b124 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Mon, 16 Aug 2021 16:17:25 -0700
|
||||
Subject: [PATCH] gdb: Don't assume r_ldsomap when r_version > 1 on Linux
|
||||
|
||||
The r_ldsomap field is specific to Solaris (part of librtld_db), and
|
||||
should never be accessed for Linux. glibc is planning to add a field
|
||||
to support multiple namespaces. But there will be no r_ldsomap when
|
||||
r_version is bumped to 2. Add linux_[ilp32|lp64]_fetch_link_map_offsets
|
||||
to set r_ldsomap_offset to -1 and use them for Linux targets.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28236
|
||||
---
|
||||
gdb/aarch64-linux-tdep.c | 2 +-
|
||||
gdb/alpha-linux-tdep.c | 2 +-
|
||||
gdb/amd64-linux-tdep.c | 4 +--
|
||||
gdb/arc-linux-tdep.c | 2 +-
|
||||
gdb/arm-linux-tdep.c | 2 +-
|
||||
gdb/cris-linux-tdep.c | 2 +-
|
||||
gdb/csky-linux-tdep.c | 2 +-
|
||||
gdb/hppa-linux-tdep.c | 2 +-
|
||||
gdb/i386-linux-tdep.c | 2 +-
|
||||
gdb/ia64-linux-tdep.c | 2 +-
|
||||
gdb/linux-tdep.c | 60 +++++++++++++++++++++++++++++++++++++
|
||||
gdb/linux-tdep.h | 5 ++++
|
||||
gdb/m32r-linux-tdep.c | 2 +-
|
||||
gdb/m68k-linux-tdep.c | 2 +-
|
||||
gdb/microblaze-linux-tdep.c | 2 +-
|
||||
gdb/mips-linux-tdep.c | 6 ++--
|
||||
gdb/mn10300-linux-tdep.c | 2 +-
|
||||
gdb/nios2-linux-tdep.c | 2 +-
|
||||
gdb/or1k-linux-tdep.c | 2 +-
|
||||
gdb/ppc-linux-tdep.c | 4 +--
|
||||
gdb/riscv-linux-tdep.c | 4 +--
|
||||
gdb/s390-linux-tdep.c | 4 +--
|
||||
gdb/sh-linux-tdep.c | 2 +-
|
||||
gdb/sparc-linux-tdep.c | 2 +-
|
||||
gdb/sparc64-linux-tdep.c | 2 +-
|
||||
gdb/tilegx-linux-tdep.c | 4 +--
|
||||
gdb/xtensa-linux-tdep.c | 2 +-
|
||||
27 files changed, 97 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
|
||||
index 63c200b47f7..b1225438d9d 100644
|
||||
--- a/gdb/aarch64-linux-tdep.c
|
||||
+++ b/gdb/aarch64-linux-tdep.c
|
||||
@@ -1795,7 +1795,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
linux_init_abi (info, gdbarch, 1);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_lp64_fetch_link_map_offsets);
|
||||
+ linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
|
||||
index c2cffc13c20..0a00fc1f310 100644
|
||||
--- a/gdb/alpha-linux-tdep.c
|
||||
+++ b/gdb/alpha-linux-tdep.c
|
||||
@@ -374,7 +374,7 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
|
||||
index ac6843c1fdd..715add8a7b0 100644
|
||||
--- a/gdb/amd64-linux-tdep.c
|
||||
+++ b/gdb/amd64-linux-tdep.c
|
||||
@@ -2042,7 +2042,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* Register DTrace handlers. */
|
||||
set_gdbarch_dtrace_parse_probe_argument (gdbarch, amd64_dtrace_parse_probe_argument);
|
||||
@@ -2256,7 +2256,7 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
}
|
||||
|
||||
void _initialize_amd64_linux_tdep ();
|
||||
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
|
||||
index cf18b8d6b03..448fa370a36 100644
|
||||
--- a/gdb/arc-linux-tdep.c
|
||||
+++ b/gdb/arc-linux-tdep.c
|
||||
@@ -732,7 +732,7 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux uses SVR4-style shared libraries, with 32-bit ints, longs
|
||||
and pointers (ILP32). */
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
}
|
||||
|
||||
/* Suppress warning from -Wmissing-prototypes. */
|
||||
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
|
||||
index 773a93384f7..c0dfc5fcf3e 100644
|
||||
--- a/gdb/arm-linux-tdep.c
|
||||
+++ b/gdb/arm-linux-tdep.c
|
||||
@@ -1763,7 +1763,7 @@ arm_linux_init_abi (struct gdbarch_info info,
|
||||
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* Single stepping. */
|
||||
set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
|
||||
diff --git a/gdb/cris-linux-tdep.c b/gdb/cris-linux-tdep.c
|
||||
index 4c1a4529986..68a12dbe0e9 100644
|
||||
--- a/gdb/cris-linux-tdep.c
|
||||
+++ b/gdb/cris-linux-tdep.c
|
||||
@@ -43,7 +43,7 @@ cris_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
svr4_fetch_objfile_link_map);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
}
|
||||
|
||||
diff --git a/gdb/csky-linux-tdep.c b/gdb/csky-linux-tdep.c
|
||||
index e38ec652561..3a52a87b647 100644
|
||||
--- a/gdb/csky-linux-tdep.c
|
||||
+++ b/gdb/csky-linux-tdep.c
|
||||
@@ -239,7 +239,7 @@ csky_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
|
||||
index 4bdaa1dfaee..52c642f0c7f 100644
|
||||
--- a/gdb/hppa-linux-tdep.c
|
||||
+++ b/gdb/hppa-linux-tdep.c
|
||||
@@ -501,7 +501,7 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
tdep->in_solib_call_trampoline = hppa_in_solib_call_trampoline;
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
|
||||
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
|
||||
index c0df916ce6d..1c065eecb4d 100644
|
||||
--- a/gdb/i386-linux-tdep.c
|
||||
+++ b/gdb/i386-linux-tdep.c
|
||||
@@ -1044,7 +1044,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
|
||||
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
||||
diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
|
||||
index a17ec590002..71767ddf83e 100644
|
||||
--- a/gdb/ia64-linux-tdep.c
|
||||
+++ b/gdb/ia64-linux-tdep.c
|
||||
@@ -237,7 +237,7 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
index 637d3d36a0b..ae2f7c14f6d 100644
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "gdbsupport/gdb_optional.h"
|
||||
#include "gcore.h"
|
||||
#include "gcore-elf.h"
|
||||
+#include "solib-svr4.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -2724,3 +2725,62 @@ more information about this file, refer to the manpage of proc(5) and core(5).")
|
||||
NULL, show_dump_excluded_mappings,
|
||||
&setlist, &showlist);
|
||||
}
|
||||
+
|
||||
+/* Fetch (and possibly build) an appropriate `link_map_offsets' for
|
||||
+ ILP32/LP64 Linux systems which don't have the r_ldsomap field. */
|
||||
+
|
||||
+link_map_offsets *
|
||||
+linux_ilp32_fetch_link_map_offsets ()
|
||||
+{
|
||||
+ static link_map_offsets lmo;
|
||||
+ static link_map_offsets *lmp = nullptr;
|
||||
+
|
||||
+ if (lmp == nullptr)
|
||||
+ {
|
||||
+ lmp = &lmo;
|
||||
+
|
||||
+ lmo.r_version_offset = 0;
|
||||
+ lmo.r_version_size = 4;
|
||||
+ lmo.r_map_offset = 4;
|
||||
+ lmo.r_brk_offset = 8;
|
||||
+ lmo.r_ldsomap_offset = -1;
|
||||
+
|
||||
+ /* Everything we need is in the first 20 bytes. */
|
||||
+ lmo.link_map_size = 20;
|
||||
+ lmo.l_addr_offset = 0;
|
||||
+ lmo.l_name_offset = 4;
|
||||
+ lmo.l_ld_offset = 8;
|
||||
+ lmo.l_next_offset = 12;
|
||||
+ lmo.l_prev_offset = 16;
|
||||
+ }
|
||||
+
|
||||
+ return lmp;
|
||||
+}
|
||||
+
|
||||
+link_map_offsets *
|
||||
+linux_lp64_fetch_link_map_offsets ()
|
||||
+{
|
||||
+ static link_map_offsets lmo;
|
||||
+ static link_map_offsets *lmp = nullptr;
|
||||
+
|
||||
+ if (lmp == nullptr)
|
||||
+ {
|
||||
+ lmp = &lmo;
|
||||
+
|
||||
+ lmo.r_version_offset = 0;
|
||||
+ lmo.r_version_size = 4;
|
||||
+ lmo.r_map_offset = 8;
|
||||
+ lmo.r_brk_offset = 16;
|
||||
+ lmo.r_ldsomap_offset = -1;
|
||||
+
|
||||
+ /* Everything we need is in the first 40 bytes. */
|
||||
+ lmo.link_map_size = 40;
|
||||
+ lmo.l_addr_offset = 0;
|
||||
+ lmo.l_name_offset = 8;
|
||||
+ lmo.l_ld_offset = 16;
|
||||
+ lmo.l_next_offset = 24;
|
||||
+ lmo.l_prev_offset = 32;
|
||||
+ }
|
||||
+
|
||||
+ return lmp;
|
||||
+}
|
||||
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
|
||||
index 28b60e46579..b5c1184bb09 100644
|
||||
--- a/gdb/linux-tdep.h
|
||||
+++ b/gdb/linux-tdep.h
|
||||
@@ -98,4 +98,9 @@ extern CORE_ADDR linux_get_hwcap (struct target_ops *target);
|
||||
error, 0 is returned. */
|
||||
extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target);
|
||||
|
||||
+/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
|
||||
+ for ILP32 and LP64 Linux systems. */
|
||||
+extern struct link_map_offsets *linux_ilp32_fetch_link_map_offsets ();
|
||||
+extern struct link_map_offsets *linux_lp64_fetch_link_map_offsets ();
|
||||
+
|
||||
#endif /* linux-tdep.h */
|
||||
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
|
||||
index 24807de0b2b..af0b5c01d04 100644
|
||||
--- a/gdb/m32r-linux-tdep.c
|
||||
+++ b/gdb/m32r-linux-tdep.c
|
||||
@@ -461,7 +461,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* Core file support. */
|
||||
set_gdbarch_iterate_over_regset_sections
|
||||
diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c
|
||||
index 7543a35e611..ad4d75adb4d 100644
|
||||
--- a/gdb/m68k-linux-tdep.c
|
||||
+++ b/gdb/m68k-linux-tdep.c
|
||||
@@ -408,7 +408,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
|
||||
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
||||
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
|
||||
index 17cdc2516d4..e9ce7cd7fe0 100644
|
||||
--- a/gdb/microblaze-linux-tdep.c
|
||||
+++ b/gdb/microblaze-linux-tdep.c
|
||||
@@ -124,7 +124,7 @@ microblaze_linux_init_abi (struct gdbarch_info info,
|
||||
|
||||
/* Shared library handling. */
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* Trampolines. */
|
||||
tramp_frame_prepend_unwinder (gdbarch,
|
||||
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
|
||||
index 1ceed5250fe..ce287f6a354 100644
|
||||
--- a/gdb/mips-linux-tdep.c
|
||||
+++ b/gdb/mips-linux-tdep.c
|
||||
@@ -1542,7 +1542,7 @@ mips_linux_init_abi (struct gdbarch_info info,
|
||||
set_gdbarch_get_longjmp_target (gdbarch,
|
||||
mips_linux_get_longjmp_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
tramp_frame_prepend_unwinder (gdbarch, µmips_linux_o32_sigframe);
|
||||
tramp_frame_prepend_unwinder (gdbarch,
|
||||
µmips_linux_o32_rt_sigframe);
|
||||
@@ -1554,7 +1554,7 @@ mips_linux_init_abi (struct gdbarch_info info,
|
||||
set_gdbarch_get_longjmp_target (gdbarch,
|
||||
mips_linux_get_longjmp_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
set_gdbarch_long_double_bit (gdbarch, 128);
|
||||
/* These floatformats should probably be renamed. MIPS uses
|
||||
the same 128-bit IEEE floating point format that IA-64 uses,
|
||||
@@ -1570,7 +1570,7 @@ mips_linux_init_abi (struct gdbarch_info info,
|
||||
set_gdbarch_get_longjmp_target (gdbarch,
|
||||
mips64_linux_get_longjmp_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_lp64_fetch_link_map_offsets);
|
||||
set_gdbarch_long_double_bit (gdbarch, 128);
|
||||
/* These floatformats should probably be renamed. MIPS uses
|
||||
the same 128-bit IEEE floating point format that IA-64 uses,
|
||||
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
|
||||
index 1a2e0493118..7c68d1116c5 100644
|
||||
--- a/gdb/mn10300-linux-tdep.c
|
||||
+++ b/gdb/mn10300-linux-tdep.c
|
||||
@@ -709,7 +709,7 @@ am33_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_iterate_over_regset_sections
|
||||
(gdbarch, am33_iterate_over_regset_sections);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe);
|
||||
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe);
|
||||
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
|
||||
index 661c8b38f72..bd86146c878 100644
|
||||
--- a/gdb/nios2-linux-tdep.c
|
||||
+++ b/gdb/nios2-linux-tdep.c
|
||||
@@ -226,7 +226,7 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
svr4_fetch_objfile_link_map);
|
||||
diff --git a/gdb/or1k-linux-tdep.c b/gdb/or1k-linux-tdep.c
|
||||
index 1c3f8db7492..2ad55f0d9ec 100644
|
||||
--- a/gdb/or1k-linux-tdep.c
|
||||
+++ b/gdb/or1k-linux-tdep.c
|
||||
@@ -143,7 +143,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
linux_init_abi (info, gdbarch, 0);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
|
||||
index 1e94922f25a..e62f45a35d8 100644
|
||||
--- a/gdb/ppc-linux-tdep.c
|
||||
+++ b/gdb/ppc-linux-tdep.c
|
||||
@@ -2035,7 +2035,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
|
||||
/* Shared library handling. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* Setting the correct XML syscall filename. */
|
||||
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC);
|
||||
@@ -2087,7 +2087,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
|
||||
/* Shared library handling. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* Setting the correct XML syscall filename. */
|
||||
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64);
|
||||
diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c
|
||||
index 49dc75bb618..7351e1901d6 100644
|
||||
--- a/gdb/riscv-linux-tdep.c
|
||||
+++ b/gdb/riscv-linux-tdep.c
|
||||
@@ -187,8 +187,8 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
(riscv_isa_xlen (gdbarch) == 4
|
||||
- ? svr4_ilp32_fetch_link_map_offsets
|
||||
- : svr4_lp64_fetch_link_map_offsets));
|
||||
+ ? linux_ilp32_fetch_link_map_offsets
|
||||
+ : linux_lp64_fetch_link_map_offsets));
|
||||
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
|
||||
index 1f40e10e3d3..04e3fc640d2 100644
|
||||
--- a/gdb/s390-linux-tdep.c
|
||||
+++ b/gdb/s390-linux-tdep.c
|
||||
@@ -1158,7 +1158,7 @@ s390_linux_init_abi_31 (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
s390_linux_init_abi_any (info, gdbarch);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390);
|
||||
}
|
||||
|
||||
@@ -1174,7 +1174,7 @@ s390_linux_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
s390_linux_init_abi_any (info, gdbarch);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_lp64_fetch_link_map_offsets);
|
||||
+ linux_lp64_fetch_link_map_offsets);
|
||||
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390X);
|
||||
}
|
||||
|
||||
diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
|
||||
index 700df35bc3b..8315d46fddf 100644
|
||||
--- a/gdb/sh-linux-tdep.c
|
||||
+++ b/gdb/sh-linux-tdep.c
|
||||
@@ -189,7 +189,7 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
||||
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
|
||||
index 8d8efb49911..4ad77e24d82 100644
|
||||
--- a/gdb/sparc-linux-tdep.c
|
||||
+++ b/gdb/sparc-linux-tdep.c
|
||||
@@ -436,7 +436,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux has SVR4-style shared libraries... */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
/* ...which means that we need some special handling when doing
|
||||
prologue analysis. */
|
||||
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
|
||||
index ea692ac00ef..e63fa87c69b 100644
|
||||
--- a/gdb/sparc64-linux-tdep.c
|
||||
+++ b/gdb/sparc64-linux-tdep.c
|
||||
@@ -383,7 +383,7 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux has SVR4-style shared libraries... */
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* ...which means that we need some special handling when doing
|
||||
prologue analysis. */
|
||||
diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
|
||||
index 382e7f6d908..353497a3434 100644
|
||||
--- a/gdb/tilegx-linux-tdep.c
|
||||
+++ b/gdb/tilegx-linux-tdep.c
|
||||
@@ -121,10 +121,10 @@ tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||
if (arch_size == 32)
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_ilp32_fetch_link_map_offsets);
|
||||
+ linux_ilp32_fetch_link_map_offsets);
|
||||
else
|
||||
set_solib_svr4_fetch_link_map_offsets (gdbarch,
|
||||
- svr4_lp64_fetch_link_map_offsets);
|
||||
+ linux_lp64_fetch_link_map_offsets);
|
||||
|
||||
/* Enable TLS support. */
|
||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||
diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
|
||||
index 2eba9aaa21d..c9e2519b1e7 100644
|
||||
--- a/gdb/xtensa-linux-tdep.c
|
||||
+++ b/gdb/xtensa-linux-tdep.c
|
||||
@@ -113,7 +113,7 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
linux_init_abi (info, gdbarch, 0);
|
||||
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
+ (gdbarch, linux_ilp32_fetch_link_map_offsets);
|
||||
|
||||
set_gdbarch_gdb_signal_from_target (gdbarch,
|
||||
xtensa_linux_gdb_signal_from_target);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
From 4eb629d50d449a079d3f5e22f26f45855939164f Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Mon, 16 Aug 2021 08:18:18 -0700
|
||||
Subject: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
|
||||
|
||||
Update gdbserver to check r_version < 1 instead of r_version != 1 so
|
||||
that r_version can be bumped for a new field in the glibc debugger
|
||||
interface to support multiple namespaces. Since so far, the gdbserver
|
||||
only reads fields defined for r_version == 1, it is compatible with
|
||||
r_version >= 1.
|
||||
|
||||
All future glibc debugger interface changes will be backward compatible.
|
||||
If there is ever the need for backward incompatible change to the glibc
|
||||
debugger interface, a new DT_XXX element will be provided to access the
|
||||
new incompatible interface.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11839
|
||||
---
|
||||
gdbserver/linux-low.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
|
||||
index 5c6191d941c..fc7a995351d 100644
|
||||
--- a/gdbserver/linux-low.cc
|
||||
+++ b/gdbserver/linux-low.cc
|
||||
@@ -6845,7 +6845,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
|
||||
if (linux_read_memory (priv->r_debug + lmo->r_version_offset,
|
||||
(unsigned char *) &r_version,
|
||||
sizeof (r_version)) != 0
|
||||
- || r_version != 1)
|
||||
+ || r_version < 1)
|
||||
{
|
||||
warning ("unexpected r_debug version %d", r_version);
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
@ -41,10 +41,10 @@ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28461
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
|
||||
index 4dfd3cfa599..9dc25284642 100644
|
||||
index 0a84bad6983..0af1ef2a9e0 100644
|
||||
--- a/gdb/linux-record.c
|
||||
+++ b/gdb/linux-record.c
|
||||
@@ -1043,6 +1043,12 @@ Do you want to stop the program?"),
|
||||
@@ -1046,6 +1046,12 @@ Do you want to stop the program?"),
|
||||
return -1;
|
||||
break;
|
||||
|
||||
@ -58,14 +58,14 @@ index 4dfd3cfa599..9dc25284642 100644
|
||||
if (record_mem_at_reg (regcache, tdep->arg1,
|
||||
tdep->size_old_utsname))
|
||||
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
|
||||
index f2e6bdc6e42..35225071a95 100644
|
||||
index 07f0c5a2604..219c67f888d 100644
|
||||
--- a/gdb/linux-record.h
|
||||
+++ b/gdb/linux-record.h
|
||||
@@ -509,6 +509,7 @@ enum gdb_syscall {
|
||||
gdb_sys_epoll_create1 = 329,
|
||||
@@ -510,6 +510,7 @@ enum gdb_syscall {
|
||||
gdb_sys_dup3 = 330,
|
||||
gdb_sys_pipe2 = 331,
|
||||
+ gdb_sys_statx = 383,
|
||||
gdb_sys_inotify_init1 = 332,
|
||||
+ gdb_sys_statx = 383,
|
||||
gdb_sys_socket = 500,
|
||||
gdb_sys_connect = 501,
|
||||
gdb_sys_accept = 502,
|
||||
|
@ -1,30 +0,0 @@
|
||||
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"),
|
@ -1,185 +0,0 @@
|
||||
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"
|
||||
|
||||
|
@ -1,110 +0,0 @@
|
||||
[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;
|
||||
|
@ -1,317 +0,0 @@
|
||||
[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)
|
@ -1,68 +0,0 @@
|
||||
[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;
|
||||
|
@ -1,175 +0,0 @@
|
||||
[gdb/symtab] Fix segfault in search_one_symtab
|
||||
|
||||
PR28539 describes a segfault in lambda function search_one_symtab due to
|
||||
psymbol_functions::expand_symtabs_matching calling expansion_notify with a
|
||||
nullptr symtab:
|
||||
...
|
||||
struct compunit_symtab *symtab =
|
||||
psymtab_to_symtab (objfile, ps);
|
||||
|
||||
if (expansion_notify != NULL)
|
||||
if (!expansion_notify (symtab))
|
||||
return false;
|
||||
...
|
||||
|
||||
This happens as follows. The partial symtab ps is a dwarf2_include_psymtab
|
||||
for some header file:
|
||||
...
|
||||
(gdb) p ps.filename
|
||||
$5 = 0x64fcf80 "/usr/include/c++/11/bits/stl_construct.h"
|
||||
...
|
||||
|
||||
The includer of ps is a shared symtab for a partial unit, with as user:
|
||||
...
|
||||
(gdb) p ps.includer().user.filename
|
||||
$11 = 0x64fc9f0 \
|
||||
"/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp"
|
||||
...
|
||||
|
||||
The call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently
|
||||
the shared symtab), but returns nullptr because:
|
||||
...
|
||||
struct dwarf2_include_psymtab : public partial_symtab
|
||||
{
|
||||
...
|
||||
compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
...
|
||||
|
||||
Fix this by returning the Decl.cpp symtab instead, which fixes the segfault
|
||||
in the PR.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28539
|
||||
|
||||
---
|
||||
gdb/dwarf2/read.c | 5 +-
|
||||
.../gdb.dwarf2/dw2-symtab-includes-lookup.exp | 101 +++++++++++++++++++++
|
||||
2 files changed, 105 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index e73c0855fc1..ea6c6344247 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -5756,7 +5756,10 @@ struct dwarf2_include_psymtab : public partial_symtab
|
||||
|
||||
compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override
|
||||
{
|
||||
- return nullptr;
|
||||
+ compunit_symtab *cust = includer ()->get_compunit_symtab (objfile);
|
||||
+ while (cust != nullptr && cust->user != nullptr)
|
||||
+ cust = cust->user;
|
||||
+ return cust;
|
||||
}
|
||||
|
||||
private:
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
|
||||
new file mode 100644
|
||||
index 00000000000..7228f85c9bb
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
|
||||
@@ -0,0 +1,101 @@
|
||||
+# Copyright 2021 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/>.
|
||||
+
|
||||
+# Lookup a type in a partial unit with DW_AT_stmt_list.
|
||||
+#
|
||||
+# The test-case is setup such that the partial symtab expansion route is
|
||||
+# .h partial symtab -> shared partial symtab -> toplevel symtab.
|
||||
+#
|
||||
+# That is, the partial symtabs (as displayed by maint print objfiles) are:
|
||||
+#
|
||||
+# ../sysdeps/x86_64/crtn.S at 0x3d944e0^M
|
||||
+# elf-init.c at 0x3d94440^M
|
||||
+# dw2-symtab-includes.h at 0x3d7c7a0^M
|
||||
+# <unknown> at 0x31ef870^M
|
||||
+# bla.c at 0x33985f0^M
|
||||
+# ../sysdeps/x86_64/crti.S at 0x33e9a00^M
|
||||
+# init.c at 0x33fa600^M
|
||||
+# ../sysdeps/x86_64/start.S at 0x33f3fd0^M
|
||||
+#
|
||||
+# and the expansion of dw2-symtab-includes.h triggers the expansion of its
|
||||
+# includer <unknown>, which triggers expansion of user bla.c.
|
||||
+#
|
||||
+# The problem in PR28539 was that after expansion of dw2-symtab-includes.h
|
||||
+# the expansion_notify function in psymbol_functions::expand_symtabs_matching
|
||||
+# should be called with the bla.c symtab, but instead it got called with
|
||||
+# nullptr, which caused a segfault.
|
||||
+
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+if {![dwarf2_support]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile main.c .S
|
||||
+
|
||||
+# Create the DWARF.
|
||||
+set asm_file [standard_output_file $srcfile2]
|
||||
+Dwarf::assemble $asm_file {
|
||||
+ declare_labels partial_label lines_label
|
||||
+ global srcdir subdir srcfile
|
||||
+
|
||||
+ cu {} {
|
||||
+ partial_label: partial_unit {
|
||||
+ {stmt_list ${lines_label} DW_FORM_sec_offset}
|
||||
+ } {
|
||||
+ DW_TAG_base_type {
|
||||
+ {DW_AT_byte_size 4 DW_FORM_sdata}
|
||||
+ {DW_AT_encoding @DW_ATE_signed}
|
||||
+ {DW_AT_name myint}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ cu {} {
|
||||
+ compile_unit {
|
||||
+ {language @DW_LANG_C}
|
||||
+ {DW_AT_name bla.c}
|
||||
+ } {
|
||||
+ imported_unit {
|
||||
+ {import $partial_label ref_addr}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ lines {version 2} lines_label {
|
||||
+ include_dir "${srcdir}/${subdir}"
|
||||
+ file_name "dw2-symtab-includes.h" 1
|
||||
+ program {
|
||||
+ {DW_LNS_advance_line 1}
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" $testfile \
|
||||
+ "${asm_file} ${srcfile}" {}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Check that no symtabs are expanded.
|
||||
+set test "no symtabs expanded"
|
||||
+if { [readnow] } {
|
||||
+ unsupported $test
|
||||
+ return -1
|
||||
+}
|
||||
+gdb_test_no_output "maint info symtabs" $test
|
||||
+
|
||||
+# Lookup myint. Regression test for PR28539.
|
||||
+gdb_test "ptype myint" "type = myint"
|
@ -1,133 +0,0 @@
|
||||
[gdb/symtab] Remove COMPUNIT_CALL_SITE_HTAB
|
||||
|
||||
Remove macro COMPUNIT_CALL_SITE_HTAB, and provide access to the htab using
|
||||
member functions:
|
||||
- compunit_symtab::find_call_site
|
||||
- compunit_symtab::set_call_site_htab
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Co-Authored-By: Tom de Vries <tdevries@suse.de>
|
||||
|
||||
---
|
||||
gdb/block.c | 10 +++++-----
|
||||
gdb/dwarf2/read.c | 2 +-
|
||||
gdb/symtab.c | 24 ++++++++++++++++++++++++
|
||||
gdb/symtab.h | 9 +++++++--
|
||||
4 files changed, 37 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gdb/block.c b/gdb/block.c
|
||||
index 4cb95731396..90c0c5b3250 100644
|
||||
--- a/gdb/block.c
|
||||
+++ b/gdb/block.c
|
||||
@@ -225,15 +225,15 @@ struct call_site *
|
||||
call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
{
|
||||
struct compunit_symtab *cust;
|
||||
- void **slot = NULL;
|
||||
+ call_site *cs = nullptr;
|
||||
|
||||
/* -1 as tail call PC can be already after the compilation unit range. */
|
||||
cust = find_pc_compunit_symtab (pc - 1);
|
||||
|
||||
- if (cust != NULL && COMPUNIT_CALL_SITE_HTAB (cust) != NULL)
|
||||
- slot = htab_find_slot (COMPUNIT_CALL_SITE_HTAB (cust), &pc, NO_INSERT);
|
||||
+ if (cust != nullptr)
|
||||
+ cs = cust->find_call_site (pc);
|
||||
|
||||
- if (slot == NULL)
|
||||
+ if (cs == nullptr)
|
||||
{
|
||||
struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (pc);
|
||||
|
||||
@@ -247,7 +247,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
: msym.minsym->print_name ()));
|
||||
}
|
||||
|
||||
- return (struct call_site *) *slot;
|
||||
+ return cs;
|
||||
}
|
||||
|
||||
/* Return the blockvector immediately containing the innermost lexical block
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 892d31dddf3..d3742bbce8c 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -9457,7 +9457,7 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
|
||||
if (gcc_4_minor >= 5)
|
||||
cust->epilogue_unwind_valid = 1;
|
||||
|
||||
- cust->call_site_htab = cu->call_site_htab;
|
||||
+ cust->set_call_site_htab (cu->call_site_htab);
|
||||
}
|
||||
|
||||
per_objfile->set_symtab (cu->per_cu, cust);
|
||||
diff --git a/gdb/symtab.c b/gdb/symtab.c
|
||||
index fa3f42207ec..1d30c8fc7a8 100644
|
||||
--- a/gdb/symtab.c
|
||||
+++ b/gdb/symtab.c
|
||||
@@ -331,6 +331,30 @@ search_domain_name (enum search_domain e)
|
||||
|
||||
/* See symtab.h. */
|
||||
|
||||
+call_site *
|
||||
+compunit_symtab::find_call_site (CORE_ADDR pc) const
|
||||
+{
|
||||
+ if (m_call_site_htab == nullptr)
|
||||
+ return nullptr;
|
||||
+
|
||||
+ void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT);
|
||||
+ if (slot == nullptr)
|
||||
+ return nullptr;
|
||||
+
|
||||
+ return (call_site *) *slot;
|
||||
+}
|
||||
+
|
||||
+/* See symtab.h. */
|
||||
+
|
||||
+void
|
||||
+compunit_symtab::set_call_site_htab (htab_t call_site_htab)
|
||||
+{
|
||||
+ gdb_assert (m_call_site_htab == nullptr);
|
||||
+ m_call_site_htab = call_site_htab;
|
||||
+}
|
||||
+
|
||||
+/* See symtab.h. */
|
||||
+
|
||||
struct symtab *
|
||||
compunit_primary_filetab (const struct compunit_symtab *cust)
|
||||
{
|
||||
diff --git a/gdb/symtab.h b/gdb/symtab.h
|
||||
index 471ae9ef448..78ac84527ae 100644
|
||||
--- a/gdb/symtab.h
|
||||
+++ b/gdb/symtab.h
|
||||
@@ -1443,6 +1443,12 @@ struct symtab
|
||||
|
||||
struct compunit_symtab
|
||||
{
|
||||
+ /* Set m_call_site_htab. */
|
||||
+ void set_call_site_htab (htab_t call_site_htab);
|
||||
+
|
||||
+ /* Find call_site info for PC. */
|
||||
+ call_site *find_call_site (CORE_ADDR pc) const;
|
||||
+
|
||||
/* Unordered chain of all compunit symtabs of this objfile. */
|
||||
struct compunit_symtab *next;
|
||||
|
||||
@@ -1497,7 +1503,7 @@ struct compunit_symtab
|
||||
unsigned int epilogue_unwind_valid : 1;
|
||||
|
||||
/* struct call_site entries for this compilation unit or NULL. */
|
||||
- htab_t call_site_htab;
|
||||
+ htab_t m_call_site_htab;
|
||||
|
||||
/* The macro table for this symtab. Like the blockvector, this
|
||||
is shared between different symtabs in a given compilation unit.
|
||||
@@ -1530,7 +1536,6 @@ struct compunit_symtab
|
||||
#define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section)
|
||||
#define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid)
|
||||
#define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid)
|
||||
-#define COMPUNIT_CALL_SITE_HTAB(cust) ((cust)->call_site_htab)
|
||||
#define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table)
|
||||
|
||||
/* A range adapter to allowing iterating over all the file tables
|
@ -1,194 +0,0 @@
|
||||
[gdb/symtab] Use unrelocated addresses in call_site
|
||||
|
||||
Consider test-case gdb.trace/entry-values.exp with target board
|
||||
unix/-fPIE/-pie.
|
||||
|
||||
Using this command we have an abbreviated version, and can see the correct
|
||||
@entry values for foo:
|
||||
...
|
||||
$ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \
|
||||
-ex start \
|
||||
-ex "break foo" \
|
||||
-ex "set print entry-values both" \
|
||||
-ex continue
|
||||
Temporary breakpoint 1 at 0x679
|
||||
|
||||
Temporary breakpoint 1, 0x0000555555554679 in main ()
|
||||
Breakpoint 2 at 0x55555555463e
|
||||
|
||||
Breakpoint 2, 0x000055555555463e in foo (i=0, i@entry=2, j=2, j@entry=3)
|
||||
...
|
||||
|
||||
Now, let's try the same again, but run directly to foo rather than stopping at
|
||||
main:
|
||||
...
|
||||
$ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \
|
||||
-ex "break foo" \
|
||||
-ex "set print entry-values both" \
|
||||
-ex run
|
||||
Breakpoint 1 at 0x63e
|
||||
|
||||
Breakpoint 1, 0x000055555555463e in foo (i=0, i@entry=<optimized out>, \
|
||||
j=2, j@entry=<optimized out>)
|
||||
...
|
||||
|
||||
So, what explains the difference? Noteworthy, this is a dwarf assembly
|
||||
test-case, with debug info for foo and bar, but not for main.
|
||||
|
||||
In the first case:
|
||||
- we run to main
|
||||
- this does not trigger expanding debug info, because there's none for main
|
||||
- we set a breakpoint at foo
|
||||
- this triggers expanding debug info. Relocated addresses are used in
|
||||
call_site info (because the exec is started)
|
||||
- we continue to foo, and manage to find the call_site info
|
||||
|
||||
In the second case:
|
||||
- we set a breakpoint at foo
|
||||
- this triggers expanding debug info. Unrelocated addresses are used in
|
||||
call_site info (because the exec is not started)
|
||||
- we run to foo
|
||||
- this triggers objfile_relocate1, but it doesn't update the call_site
|
||||
info addresses
|
||||
- we don't manage to find the call_site info
|
||||
|
||||
We could fix this by adding the missing call_site relocation in
|
||||
objfile_relocate1.
|
||||
|
||||
This solution however is counter-trend in the sense that we're trying to
|
||||
work towards the situation where when starting two instances of an executable,
|
||||
we need only one instance of debug information, implying the use of
|
||||
unrelocated addresses.
|
||||
|
||||
So, fix this instead by using unrelocated addresses in call_site info.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
This fixes all remaining unix/-fno-PIE/-no-pie vs unix/-fPIE/-pie
|
||||
regressions, like f.i. PR24892.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24892
|
||||
|
||||
Co-Authored-By: Tom de Vries <tdevries@suse.de>
|
||||
|
||||
---
|
||||
gdb/dwarf2/loc.c | 9 ++++++++-
|
||||
gdb/dwarf2/read.c | 4 +++-
|
||||
gdb/gdbtypes.c | 5 ++++-
|
||||
gdb/gdbtypes.h | 10 +++++-----
|
||||
gdb/symtab.c | 6 +++++-
|
||||
5 files changed, 25 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
|
||||
index 83b5fe1ac88..ba94780cc75 100644
|
||||
--- a/gdb/dwarf2/loc.c
|
||||
+++ b/gdb/dwarf2/loc.c
|
||||
@@ -979,7 +979,14 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
|
||||
}
|
||||
|
||||
case FIELD_LOC_KIND_PHYSADDR:
|
||||
- return FIELD_STATIC_PHYSADDR (call_site->target);
|
||||
+ {
|
||||
+ dwarf2_per_objfile *per_objfile = call_site->per_objfile;
|
||||
+ compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
|
||||
+ int sect_idx = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
||||
+ CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
|
||||
+
|
||||
+ return FIELD_STATIC_PHYSADDR (call_site->target) + delta;
|
||||
+ }
|
||||
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__, _("invalid call site target kind"));
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 59ce3cf2b45..e73c0855fc1 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -13309,6 +13309,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
}
|
||||
pc = attr->as_address () + baseaddr;
|
||||
pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc);
|
||||
+ pc -= baseaddr;
|
||||
|
||||
if (cu->call_site_htab == NULL)
|
||||
cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash,
|
||||
@@ -13465,7 +13466,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
sect_offset_str (die->sect_off), objfile_name (objfile));
|
||||
else
|
||||
{
|
||||
- lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
|
||||
+ lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr)
|
||||
+ - baseaddr);
|
||||
SET_FIELD_PHYSADDR (call_site->target, lowpc);
|
||||
}
|
||||
}
|
||||
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
|
||||
index 1b3ed1b32ed..f1efbb98720 100644
|
||||
--- a/gdb/gdbtypes.c
|
||||
+++ b/gdb/gdbtypes.c
|
||||
@@ -6307,7 +6307,10 @@ objfile_type (struct objfile *objfile)
|
||||
CORE_ADDR
|
||||
call_site::pc () const
|
||||
{
|
||||
- return m_pc;
|
||||
+ compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu);
|
||||
+ CORE_ADDR delta
|
||||
+ = this->per_objfile->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (cust)];
|
||||
+ return m_unrelocated_pc + delta;
|
||||
}
|
||||
|
||||
void _initialize_gdbtypes ();
|
||||
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
index a071188ffa1..8b1fd75bccf 100644
|
||||
--- a/gdb/gdbtypes.h
|
||||
+++ b/gdb/gdbtypes.h
|
||||
@@ -1777,19 +1777,19 @@ struct call_site
|
||||
{
|
||||
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)
|
||||
+ : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc)
|
||||
{}
|
||||
|
||||
static int
|
||||
eq (const call_site *a, const call_site *b)
|
||||
{
|
||||
- return core_addr_eq (&a->m_pc, &b->m_pc);
|
||||
+ return core_addr_eq (&a->m_unrelocated_pc, &b->m_unrelocated_pc);
|
||||
}
|
||||
|
||||
static hashval_t
|
||||
hash (const call_site *a)
|
||||
{
|
||||
- return core_addr_hash (&a->m_pc);
|
||||
+ return core_addr_hash (&a->m_unrelocated_pc);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1831,8 +1831,8 @@ struct call_site
|
||||
dwarf2_per_objfile *const per_objfile = nullptr;
|
||||
|
||||
private:
|
||||
- /* Address of the first instruction after this call. */
|
||||
- const CORE_ADDR m_pc;
|
||||
+ /* Unrelocated address of the first instruction after this call. */
|
||||
+ const CORE_ADDR m_unrelocated_pc;
|
||||
|
||||
public:
|
||||
/* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */
|
||||
diff --git a/gdb/symtab.c b/gdb/symtab.c
|
||||
index 14cc2b5bd8d..17607fb447b 100644
|
||||
--- a/gdb/symtab.c
|
||||
+++ b/gdb/symtab.c
|
||||
@@ -337,7 +337,11 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
|
||||
if (m_call_site_htab == nullptr)
|
||||
return nullptr;
|
||||
|
||||
- struct call_site call_site_local (pc, nullptr, nullptr);
|
||||
+ CORE_ADDR delta
|
||||
+ = this->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)];
|
||||
+ CORE_ADDR unrelocated_pc = pc - delta;
|
||||
+
|
||||
+ struct call_site call_site_local (unrelocated_pc, nullptr, nullptr);
|
||||
void **slot
|
||||
= htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT);
|
||||
if (slot == nullptr)
|
@ -1,169 +0,0 @@
|
||||
[gdb/tdep] Fix avx512 -m32 support in gdbserver
|
||||
|
||||
PR27257 reports a problem that can be reproduced as follows:
|
||||
- use x86_64 machine with avx512 support
|
||||
- compile a hello world with -m32 to a.out
|
||||
- start a gdbserver session with a.out
|
||||
- use gdb to connect to the gdbserver session
|
||||
|
||||
This makes us run into:
|
||||
...
|
||||
Listening on port 2346
|
||||
Remote debugging from host ::1, port 34940
|
||||
src/gdbserver/regcache.cc:257: \
|
||||
A problem internal to GDBserver has been detected.
|
||||
Unknown register zmm16h requested
|
||||
...
|
||||
|
||||
The problem is that i387_xsave_to_cache in gdbserver/i387-fp.cc can't find a
|
||||
register zmm16h in the register cache.
|
||||
|
||||
To understand how this happens, first some background.
|
||||
|
||||
SSE has 16 128-bit wide xmm registers.
|
||||
|
||||
AVX extends the SSE registers set as follows:
|
||||
- it extends the 16 existing 128-bit wide xmm registers to 256-bit wide ymm
|
||||
registers.
|
||||
|
||||
AVX512 extends the AVX register set as follows:
|
||||
- it extends the 16 existing 256-bit wide ymm registers to 512-bit wide zmm
|
||||
registers.
|
||||
- it adds 16 additional 512-bit wide zmm registers (with corresponding ymm and
|
||||
xmm subregisters added as well)
|
||||
|
||||
However, in 32-bit mode, there are only 8 xmm/ymm/zmm registers.
|
||||
|
||||
The problem we're running into is that gdbserver/i387-fp.cc uses these
|
||||
constants to describe the size of the register file:
|
||||
...
|
||||
static const int num_avx512_zmmh_low_registers = 16;
|
||||
static const int num_avx512_zmmh_high_registers = 16;
|
||||
static const int num_avx512_ymmh_registers = 16;
|
||||
static const int num_avx512_xmm_registers = 16;
|
||||
...
|
||||
which are all incorrect for the 32-bit case.
|
||||
|
||||
Fix this by replacing the constants with variables that have the appropriate
|
||||
values in 64-bit and 32-bit mode.
|
||||
|
||||
Tested on x86_64-linux with native and unix/-m32.
|
||||
|
||||
---
|
||||
gdbserver/i387-fp.cc | 50 +++++++++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 37 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc
|
||||
index 6d9b62ed8ce..9b07ded592d 100644
|
||||
--- a/gdbserver/i387-fp.cc
|
||||
+++ b/gdbserver/i387-fp.cc
|
||||
@@ -23,10 +23,6 @@
|
||||
static const int num_mpx_bnd_registers = 4;
|
||||
static const int num_mpx_cfg_registers = 2;
|
||||
static const int num_avx512_k_registers = 8;
|
||||
-static const int num_avx512_zmmh_low_registers = 16;
|
||||
-static const int num_avx512_zmmh_high_registers = 16;
|
||||
-static const int num_avx512_ymmh_registers = 16;
|
||||
-static const int num_avx512_xmm_registers = 16;
|
||||
static const int num_pkeys_registers = 1;
|
||||
|
||||
/* Note: These functions preserve the reserved bits in control registers.
|
||||
@@ -256,14 +252,22 @@ void
|
||||
i387_cache_to_xsave (struct regcache *regcache, void *buf)
|
||||
{
|
||||
struct i387_xsave *fp = (struct i387_xsave *) buf;
|
||||
+ bool amd64 = register_size (regcache->tdesc, 0) == 8;
|
||||
int i;
|
||||
unsigned long val, val2;
|
||||
unsigned long long xstate_bv = 0;
|
||||
unsigned long long clear_bv = 0;
|
||||
char raw[64];
|
||||
char *p;
|
||||
+
|
||||
/* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */
|
||||
- int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8;
|
||||
+ int num_xmm_registers = amd64 ? 16 : 8;
|
||||
+ /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */
|
||||
+ int num_avx512_zmmh_low_registers = num_xmm_registers;
|
||||
+ /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/
|
||||
+ int num_avx512_zmmh_high_registers = amd64 ? 16 : 0;
|
||||
+ int num_avx512_ymmh_registers = amd64 ? 16 : 0;
|
||||
+ int num_avx512_xmm_registers = amd64 ? 16 : 0;
|
||||
|
||||
/* The supported bits in `xstat_bv' are 8 bytes. Clear part in
|
||||
vector registers if its bit in xstat_bv is zero. */
|
||||
@@ -452,7 +456,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
|
||||
/* Check if any of ZMM16H-ZMM31H registers are changed. */
|
||||
if ((x86_xcr0 & X86_XSTATE_ZMM))
|
||||
{
|
||||
- int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h");
|
||||
+ int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0
|
||||
+ ? -1
|
||||
+ : find_regno (regcache->tdesc, "zmm16h"));
|
||||
|
||||
for (i = 0; i < num_avx512_zmmh_high_registers; i++)
|
||||
{
|
||||
@@ -469,7 +475,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
|
||||
/* Check if any XMM_AVX512 registers are changed. */
|
||||
if ((x86_xcr0 & X86_XSTATE_ZMM))
|
||||
{
|
||||
- int xmm_avx512_regnum = find_regno (regcache->tdesc, "xmm16");
|
||||
+ int xmm_avx512_regnum = (num_avx512_xmm_registers == 0
|
||||
+ ? -1
|
||||
+ : find_regno (regcache->tdesc, "xmm16"));
|
||||
|
||||
for (i = 0; i < num_avx512_xmm_registers; i++)
|
||||
{
|
||||
@@ -486,7 +494,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
|
||||
/* Check if any YMMH_AVX512 registers are changed. */
|
||||
if ((x86_xcr0 & X86_XSTATE_ZMM))
|
||||
{
|
||||
- int ymmh_avx512_regnum = find_regno (regcache->tdesc, "ymm16h");
|
||||
+ int ymmh_avx512_regnum = (num_avx512_ymmh_registers == 0
|
||||
+ ? -1
|
||||
+ : find_regno (regcache->tdesc, "ymm16h"));
|
||||
|
||||
for (i = 0; i < num_avx512_ymmh_registers; i++)
|
||||
{
|
||||
@@ -710,12 +720,20 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
|
||||
{
|
||||
struct i387_xsave *fp = (struct i387_xsave *) buf;
|
||||
struct i387_fxsave *fxp = (struct i387_fxsave *) buf;
|
||||
+ bool amd64 = register_size (regcache->tdesc, 0) == 8;
|
||||
int i, top;
|
||||
unsigned long val;
|
||||
unsigned long long clear_bv;
|
||||
gdb_byte *p;
|
||||
- /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */
|
||||
- int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8;
|
||||
+
|
||||
+ /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */
|
||||
+ int num_xmm_registers = amd64 ? 16 : 8;
|
||||
+ /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */
|
||||
+ int num_avx512_zmmh_low_registers = num_xmm_registers;
|
||||
+ /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/
|
||||
+ int num_avx512_zmmh_high_registers = amd64 ? 16 : 0;
|
||||
+ int num_avx512_ymmh_registers = amd64 ? 16 : 0;
|
||||
+ int num_avx512_xmm_registers = amd64 ? 16 : 0;
|
||||
|
||||
/* The supported bits in `xstat_bv' are 8 bytes. Clear part in
|
||||
vector registers if its bit in xstat_bv is zero. */
|
||||
@@ -845,9 +863,15 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
|
||||
|
||||
if ((x86_xcr0 & X86_XSTATE_ZMM) != 0)
|
||||
{
|
||||
- int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h");
|
||||
- int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h");
|
||||
- int xmm16_regnum = find_regno (regcache->tdesc, "xmm16");
|
||||
+ int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0
|
||||
+ ? -1
|
||||
+ : find_regno (regcache->tdesc, "zmm16h"));
|
||||
+ int ymm16h_regnum = (num_avx512_ymmh_registers == 0
|
||||
+ ? -1
|
||||
+ : find_regno (regcache->tdesc, "ymm16h"));
|
||||
+ int xmm16_regnum = (num_avx512_xmm_registers == 0
|
||||
+ ? -1
|
||||
+ : find_regno (regcache->tdesc, "xmm16"));
|
||||
|
||||
if ((clear_bv & X86_XSTATE_ZMM) != 0)
|
||||
{
|
@ -1,53 +0,0 @@
|
||||
[gdb/tdep, rs6000] Don't skip system call in skip_prologue
|
||||
|
||||
I ran into a case where a breakpoint on _exit never triggered, because it was
|
||||
set past the end of the _exit prologue, past the end of the exit_group system
|
||||
call (which does not return).
|
||||
|
||||
More concretely, the breakpoint was set at the last insn show here:
|
||||
...
|
||||
Dump of assembler code for function _exit:
|
||||
0x00007ffff7e42ea0 <+0>: 12 00 4c 3c addis r2,r12,18
|
||||
0x00007ffff7e42ea4 <+4>: 60 43 42 38 addi r2,r2,17248
|
||||
0x00007ffff7e42ea8 <+8>: 00 00 00 60 nop
|
||||
0x00007ffff7e42eac <+12>: f8 ff e1 fb std r31,-8(r1)
|
||||
0x00007ffff7e42eb0 <+16>: 78 1b 7f 7c mr r31,r3
|
||||
0x00007ffff7e42eb4 <+20>: f0 ff c1 fb std r30,-16(r1)
|
||||
0x00007ffff7e42eb8 <+24>: ea 00 00 38 li r0,234
|
||||
0x00007ffff7e42ebc <+28>: a0 8b 22 e9 ld r9,-29792(r2)
|
||||
0x00007ffff7e42ec0 <+32>: 78 fb e3 7f mr r3,r31
|
||||
0x00007ffff7e42ec4 <+36>: 14 6a c9 7f add r30,r9,r13
|
||||
0x00007ffff7e42ec8 <+40>: 02 00 00 44 sc
|
||||
0x00007ffff7e42ecc <+44>: 26 00 00 7c mfcr r0
|
||||
0x00007ffff7e42ed0 <+48>: 00 10 09 74 andis. r9,r0,4096
|
||||
...
|
||||
|
||||
Fix this by treating system calls the same as branches in skip_prologue:
|
||||
by default, don't skip, such that the breakpoint is set at 0x00007ffff7e42eb8
|
||||
instead.
|
||||
|
||||
Tested on ppc64le-linux, on a power 8 machine.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527
|
||||
|
||||
---
|
||||
gdb/rs6000-tdep.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
|
||||
index 826f0266ed8..9ac5db57898 100644
|
||||
--- a/gdb/rs6000-tdep.c
|
||||
+++ b/gdb/rs6000-tdep.c
|
||||
@@ -2137,6 +2137,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
|
||||
/* Never skip branches. */
|
||||
break;
|
||||
|
||||
+ /* Test based on opcode and mask values of
|
||||
+ powerpc_opcodes[svc..svcla] in opcodes/ppc-opc.c. */
|
||||
+ if ((op & 0xffff0000) == 0x44000000)
|
||||
+ /* Never skip system calls. */
|
||||
+ break;
|
||||
+
|
||||
if (num_skip_non_prologue_insns++ > max_skip_non_prologue_insns)
|
||||
/* Do not scan too many insns, scanning insns is expensive with
|
||||
remote targets. */
|
@ -3,14 +3,15 @@
|
||||
Regenerate syscalls/{ppc64,ppc}-linux.xml on a system with 5.14 kernel.
|
||||
|
||||
---
|
||||
gdb/syscalls/ppc-linux.xml | 139 ++++++++++++++++++++++++++++++++++++++-
|
||||
gdb/syscalls/ppc-linux.xml.in | 140 ++++++++++++++++++++++++++++++++++++++-
|
||||
gdb/syscalls/ppc64-linux.xml | 140 ++++++++++++++++++++++++++++++++++++---
|
||||
gdb/syscalls/ppc64-linux.xml.in | 141 +++++++++++++++++++++++++++++++++++++---
|
||||
4 files changed, 538 insertions(+), 22 deletions(-)
|
||||
gdb/syscalls/ppc-linux.xml | 139 +++++++++++++++++++++++++++++-
|
||||
gdb/syscalls/ppc-linux.xml.in | 140 +++++++++++++++++++++++++++++-
|
||||
gdb/syscalls/ppc64-linux.xml | 140 ++++++++++++++++++++++++++++--
|
||||
gdb/syscalls/ppc64-linux.xml.in | 141 +++++++++++++++++++++++++++++--
|
||||
gdb/testsuite/gdb.base/catch-syscall.exp | 6 +-
|
||||
5 files changed, 541 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/gdb/syscalls/ppc-linux.xml b/gdb/syscalls/ppc-linux.xml
|
||||
index 909240b62cc..4f48179b758 100644
|
||||
index 328b889839a..34ba8bd4e49 100644
|
||||
--- a/gdb/syscalls/ppc-linux.xml
|
||||
+++ b/gdb/syscalls/ppc-linux.xml
|
||||
@@ -6,8 +6,8 @@
|
||||
@ -179,7 +180,7 @@ index 909240b62cc..4f48179b758 100644
|
||||
+ <syscall name="landlock_restrict_self" number="446"/>
|
||||
</syscalls_info>
|
||||
diff --git a/gdb/syscalls/ppc-linux.xml.in b/gdb/syscalls/ppc-linux.xml.in
|
||||
index 2d68e7dc220..f1315930d60 100644
|
||||
index 0c1003e311b..61c7c585453 100644
|
||||
--- a/gdb/syscalls/ppc-linux.xml.in
|
||||
+++ b/gdb/syscalls/ppc-linux.xml.in
|
||||
@@ -8,11 +8,12 @@
|
||||
@ -352,7 +353,7 @@ index 2d68e7dc220..f1315930d60 100644
|
||||
+ <syscall name="landlock_restrict_self" number="446"/>
|
||||
</syscalls_info>
|
||||
diff --git a/gdb/syscalls/ppc64-linux.xml b/gdb/syscalls/ppc64-linux.xml
|
||||
index c0015694704..cb2d372cffe 100644
|
||||
index 2e46cac0684..838f73bc25e 100644
|
||||
--- a/gdb/syscalls/ppc64-linux.xml
|
||||
+++ b/gdb/syscalls/ppc64-linux.xml
|
||||
@@ -6,8 +6,8 @@
|
||||
@ -515,7 +516,7 @@ index c0015694704..cb2d372cffe 100644
|
||||
+ <syscall name="landlock_restrict_self" number="446"/>
|
||||
</syscalls_info>
|
||||
diff --git a/gdb/syscalls/ppc64-linux.xml.in b/gdb/syscalls/ppc64-linux.xml.in
|
||||
index 884f8380bca..af1a7b31c60 100644
|
||||
index 2a96a8d34b8..4ed80e0a41b 100644
|
||||
--- a/gdb/syscalls/ppc64-linux.xml.in
|
||||
+++ b/gdb/syscalls/ppc64-linux.xml.in
|
||||
@@ -8,11 +8,12 @@
|
||||
@ -681,3 +682,20 @@ index 884f8380bca..af1a7b31c60 100644
|
||||
+ <syscall name="landlock_add_rule" number="445"/>
|
||||
+ <syscall name="landlock_restrict_self" number="446"/>
|
||||
</syscalls_info>
|
||||
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
index 939cf4876b6..3e6ed94be96 100644
|
||||
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
@@ -621,9 +621,9 @@ proc test_catch_syscall_multi_arch {} {
|
||||
|
||||
set arch1 "powerpc:common"
|
||||
set arch2 "powerpc:common64"
|
||||
- set syscall1_name "openat"
|
||||
- set syscall2_name "unlinkat"
|
||||
- set syscall_number 286
|
||||
+ set syscall1_name "fstatat64"
|
||||
+ set syscall2_name "newfstatat"
|
||||
+ set syscall_number 291
|
||||
test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \
|
||||
$syscall2_name $syscall_number
|
||||
|
||||
|
@ -1,592 +0,0 @@
|
||||
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 11:14:51 +0200
|
||||
Subject: gdb-test-for-rhbz1976887.patch
|
||||
|
||||
;; Backport test for RHBZ 1976887 (Kevin Buettner).
|
||||
|
||||
Test case reproducing PR28030 bug
|
||||
|
||||
The original reproducer for PR28030 required use of a specific
|
||||
compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR,
|
||||
though it seems probable that other gcc versions might also be able to
|
||||
reproduce the bug as well. This commit introduces a test case which,
|
||||
using the DWARF assembler, provides a reproducer which is independent
|
||||
of the compiler version. (Well, it'll work with whatever compilers
|
||||
the DWARF assembler works with.)
|
||||
|
||||
To the best of my knowledge, it's also the first test case which uses
|
||||
the DWARF assembler to provide debug info for a shared object. That
|
||||
being the case, I provided more than the usual commentary which should
|
||||
allow this case to be used as a template when a combo shared
|
||||
library / DWARF assembler test case is required in the future.
|
||||
|
||||
I provide some details regarding the bug in a comment near the
|
||||
beginning of locexpr-dml.exp.
|
||||
|
||||
This problem was difficult to reproduce; I found myself constantly
|
||||
referring to the backtrace while trying to figure out what (else) I
|
||||
might be missing while trying to create a reproducer. Below is a
|
||||
partial backtrace which I include for posterity.
|
||||
|
||||
#0 internal_error (
|
||||
file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575,
|
||||
fmt=0xc520c0 "Unexpected type field location kind: %d")
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51
|
||||
#1 0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930,
|
||||
type=0x274c260, copied_types=0x30bb290)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575
|
||||
#2 0x00000000006ef382 in copy_type_recursive (objfile=0x1635930,
|
||||
type=0x274ca10, copied_types=0x30bb290)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602
|
||||
#3 0x0000000000a7409a in preserve_one_value (value=0x24269f0,
|
||||
objfile=0x1635930, copied_types=0x30bb290)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529
|
||||
#4 0x000000000072012a in gdbscm_preserve_values (
|
||||
extlang=0xc55720 <extension_language_guile>, objfile=0x1635930,
|
||||
copied_types=0x30bb290)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94
|
||||
#5 0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930,
|
||||
copied_types=0x30bb290)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568
|
||||
#6 0x0000000000a7428d in preserve_values (objfile=0x1635930)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579
|
||||
#7 0x000000000082d514 in objfile::~objfile (this=0x1635930,
|
||||
__in_chrg=<optimized out>)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549
|
||||
#8 0x0000000000831cc8 in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x1654580)
|
||||
at /usr/include/c++/11/bits/shared_ptr_base.h:348
|
||||
#9 0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168
|
||||
#10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=<optimized out>)
|
||||
at /usr/include/c++/11/bits/shared_ptr_base.h:705
|
||||
#11 0x000000000082feee in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x190bb80, __in_chrg=<optimized out>)
|
||||
at /usr/include/c++/11/bits/shared_ptr_base.h:1154
|
||||
#12 0x000000000082ff0a in std::shared_ptr<objfile>::~shared_ptr (
|
||||
this=0x190bb80, __in_chrg=<optimized out>)
|
||||
at /usr/include/c++/11/bits/shared_ptr.h:122
|
||||
#13 0x000000000085ed7e in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x114bc00,
|
||||
__p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168
|
||||
#14 0x000000000085e88d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=...,
|
||||
__p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531
|
||||
#15 0x000000000085e50c in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x114bc00, __position=
|
||||
std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
|
||||
at /usr/include/c++/11/bits/stl_list.h:1925
|
||||
#16 0x000000000085df0e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x114bc00, __position=
|
||||
std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
|
||||
at /usr/include/c++/11/bits/list.tcc:158
|
||||
#17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0,
|
||||
objfile=0x1635930)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210
|
||||
#18 0x000000000082d3ae in objfile::unlink (this=0x1635930)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487
|
||||
#19 0x000000000082e68c in objfile_purge_solibs ()
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875
|
||||
#20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236
|
||||
#21 0x00000000009a37fe in target_pre_inferior (from_tty=1)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496
|
||||
#22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1,
|
||||
run_how=RUN_NORMAL)
|
||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437
|
||||
|
||||
I'll note a few points regarding this backtrace:
|
||||
|
||||
Frame #1 is where the internal error occurs. It's caused by an
|
||||
unhandled case for FIELD_LOC_KIND_DWARF_BLOCK. The fix for this bug
|
||||
adds support for this case.
|
||||
|
||||
Frame #22 - it's a partial backtrace - shows that GDB is attempting to
|
||||
(re)run the program. You can see the exact command sequence that was
|
||||
used for reproducing this problem in the PR (at
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a
|
||||
nutshell, after starting the program and advancing to the appropriate
|
||||
source line, GDB was asked to step into libstdc++; a "finish" command
|
||||
was issued, returning a value. The fact that a value was returned is
|
||||
very important. GDB was then used to step back into libstdc++. A
|
||||
breakpoint was set on a source line in the library after which a "run"
|
||||
command was issued.
|
||||
|
||||
Frame #19 shows a call to objfile_purge_solibs. It's aptly named.
|
||||
|
||||
Frame #7 is a call to the destructor for one of the objfile solibs; it
|
||||
turned out to be the one for libstdc++.
|
||||
|
||||
Frames #6 thru #3 show various value preservation frames. If you look
|
||||
at preserve_values() in gdb/value.c, the value history is preserved
|
||||
first, followed by internal variables, followed by values for the
|
||||
extension languages (python and guile).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
|
||||
@@ -0,0 +1,48 @@
|
||||
+/* Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include "locexpr-data-member-location.h"
|
||||
+
|
||||
+struct A g_A = {3, 4};
|
||||
+struct B g_B = { {8, 9}, 10, 11 };
|
||||
+
|
||||
+B *
|
||||
+foo ()
|
||||
+{ /* foo prologue */
|
||||
+ asm ("foo_label: .globl foo_label");
|
||||
+ return &g_B; /* foo return */
|
||||
+} /* foo end */
|
||||
+
|
||||
+B *
|
||||
+bar (B *v)
|
||||
+{ /* bar prologue */
|
||||
+ asm ("bar_label: .globl bar_label");
|
||||
+ return v; /* bar return */
|
||||
+} /* bar end */
|
||||
+
|
||||
+/* Some of the DWARF assembler procs (e.g. function_range) compile
|
||||
+ this file, expecting it to be a complete program with a main()
|
||||
+ function. When IS_SHAREDLIB is NOT defined, we have main() as
|
||||
+ defined below. */
|
||||
+
|
||||
+#ifndef IS_SHAREDLIB
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ B *b = foo ();
|
||||
+}
|
||||
+#endif
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include "locexpr-data-member-location.h"
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ B *v1;
|
||||
+ v1 = bar (foo ());
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
|
||||
@@ -0,0 +1,349 @@
|
||||
+# Copyright 2021 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/>.
|
||||
+
|
||||
+# This test case uses the DWARF assembler to reproduce the problem
|
||||
+# described by PR28030. The bug turned out to be that
|
||||
+# FIELD_LOC_KIND_DWARF_BLOCK was not handled when recursively copying
|
||||
+# a value's type when preserving the value history during the freeing
|
||||
+# up of objfiles associated with a shared object. (Yes, figuring out
|
||||
+# how to make this happen in a concise test case turned out to be
|
||||
+# challenging.)
|
||||
+#
|
||||
+# The following elements proved to be necessary for reproducing the
|
||||
+# problem:
|
||||
+#
|
||||
+# 1) A location expression needed to be used with
|
||||
+# DW_AT_data_member_location rather than a simple offset.
|
||||
+# Moreover, this location expression needed to use opcodes
|
||||
+# which GDB's DWARF reader could not convert to a simple
|
||||
+# offset. (Note, however, that GDB could probably be improved
|
||||
+# to handle the opcodes chosen for this test; if decode_locdesc()
|
||||
+# in dwarf2/read.c is ever updated to handle both DW_OP_pick and
|
||||
+# DW_OP_drop, then this test could end up passing even if
|
||||
+# the bug it's intended to test has not been fixed.)
|
||||
+#
|
||||
+# 2) The debug info containing the above DWARF info needed
|
||||
+# to be associated with a shared object since the problem
|
||||
+# occurred while GDB was preserving values during the
|
||||
+# purging of shared objects.
|
||||
+#
|
||||
+# 3) After performing some simple gdb commands, the program is
|
||||
+# run again. In the course of running the objfile destructor
|
||||
+# associated with the shared object, values are preserved
|
||||
+# along with their types. As noted earlier, it was during
|
||||
+# the recursive type copy that the bug was observed.
|
||||
+#
|
||||
+# Therefore, due to #2 above, this test case creates debug info
|
||||
+# which is then used by a shared object.
|
||||
+
|
||||
+# This test can't be run on targets lacking shared library support.
|
||||
+if [skip_shlib_tests] {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+if ![dwarf2_support] {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# gdb_test_file_name is the name of this file without the .exp
|
||||
+# extension. Use it to form basenames for the main program
|
||||
+# and shared object.
|
||||
+set main_basename ${::gdb_test_file_name}-main
|
||||
+set lib_basename ${::gdb_test_file_name}-lib
|
||||
+
|
||||
+# We're generating DWARF assembly for the shared object; therefore,
|
||||
+# the source file for the library / shared object must be listed first
|
||||
+# (in the standard_testfile invocation) since ${srcfile} is used by
|
||||
+# get_func_info (for determining the start, end, and length of a
|
||||
+# function).
|
||||
+#
|
||||
+# The output of Dwarf::assemble will be placed in $lib_basename.S
|
||||
+# which will be ${srcfile3} after the execution of standard_testfile.
|
||||
+
|
||||
+standard_testfile $lib_basename.c $main_basename.c $lib_basename.S
|
||||
+
|
||||
+set libsrc "${::srcdir}/${::subdir}/${::srcfile}"
|
||||
+set lib_so [standard_output_file ${lib_basename}.so]
|
||||
+set asm_file [standard_output_file ${::srcfile3}]
|
||||
+
|
||||
+# We need to know the size of some types in order to write some of the
|
||||
+# debugging info that we're about to generate. For that, we ask GDB
|
||||
+# by debugging the shared object associated with this test case.
|
||||
+
|
||||
+# Compile the shared library: -DIS_SHAREDLIB prevents main() from
|
||||
+# being defined. Note that debugging symbols will be present for
|
||||
+# this compilation.
|
||||
+if {[gdb_compile_shlib $libsrc $lib_so \
|
||||
+ {additional_flags=-DIS_SHAREDLIB debug}] != ""} {
|
||||
+ untested "failed to compile shared library"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Start a fresh GDB and load the shared library.
|
||||
+clean_restart $lib_so
|
||||
+
|
||||
+# Using our running GDB session, determine sizes of several types.
|
||||
+set long_size [get_sizeof "long" -1]
|
||||
+set addr_size [get_sizeof "void *" -1]
|
||||
+set struct_A_size [get_sizeof "g_A" -1]
|
||||
+set struct_B_size [get_sizeof "g_B" -1]
|
||||
+
|
||||
+if { $long_size == -1 || $addr_size == -1 \
|
||||
+ || $struct_A_size == -1 || $struct_B_size == -1} {
|
||||
+ perror "Can't determine type sizes"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Retrieve struct offset of MBR in struct TP
|
||||
+proc get_offsetof { tp mbr } {
|
||||
+ return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1]
|
||||
+}
|
||||
+
|
||||
+# Use running GDB session to get struct offsets
|
||||
+set A_a [get_offsetof A a]
|
||||
+set A_x [get_offsetof A x]
|
||||
+set B_a [get_offsetof B a]
|
||||
+set B_b [get_offsetof B b]
|
||||
+set B_x2 [get_offsetof B x2]
|
||||
+
|
||||
+# Create the DWARF.
|
||||
+Dwarf::assemble ${asm_file} {
|
||||
+ declare_labels L
|
||||
+
|
||||
+ # Find start, end, and length of functions foo and bar.
|
||||
+ # These calls to get_func_info will create and set variables
|
||||
+ # foo_start, bar_start, foo_end, bar_end, foo_len, and
|
||||
+ # bar_len.
|
||||
+ #
|
||||
+ # In order to get the right answers, get_func_info (and,
|
||||
+ # underneath, function_range) should use the same compiler flags
|
||||
+ # as those used to make a shared object. For any targets that get
|
||||
+ # this far, -fpic is probably correct.
|
||||
+ #
|
||||
+ # Also, it should be noted that IS_SHAREDLIB is NOT defined as one
|
||||
+ # of the additional flags. Not defining IS_SHAREDLIB will cause a
|
||||
+ # main() to be defined for the compilation of the shared library
|
||||
+ # source file which happens as a result of using get_func_info;
|
||||
+ # this is currently required in order to this facility.
|
||||
+ set flags {additional_flags=-fpic debug}
|
||||
+ get_func_info foo $flags
|
||||
+ get_func_info bar $flags
|
||||
+
|
||||
+ cu {} {
|
||||
+ DW_TAG_compile_unit {
|
||||
+ {DW_AT_language @DW_LANG_C_plus_plus}
|
||||
+ {name ${::srcfile}}
|
||||
+ {stmt_list $L DW_FORM_sec_offset}
|
||||
+ } {
|
||||
+ declare_labels int_label class_A_label class_B_label \
|
||||
+ B_ptr_label
|
||||
+
|
||||
+ int_label: DW_TAG_base_type {
|
||||
+ {DW_AT_byte_size ${::long_size} DW_FORM_udata}
|
||||
+ {DW_AT_encoding @DW_ATE_signed}
|
||||
+ {DW_AT_name "int"}
|
||||
+ }
|
||||
+
|
||||
+ class_A_label: DW_TAG_class_type {
|
||||
+ {DW_AT_name "A"}
|
||||
+ {DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata}
|
||||
+ } {
|
||||
+ DW_TAG_member {
|
||||
+ {DW_AT_name "a"}
|
||||
+ {DW_AT_type :$int_label}
|
||||
+ {DW_AT_data_member_location ${::A_a} DW_FORM_udata}
|
||||
+ }
|
||||
+ DW_TAG_member {
|
||||
+ {DW_AT_name "x"}
|
||||
+ {DW_AT_type :$int_label}
|
||||
+ {DW_AT_data_member_location ${::A_x} DW_FORM_udata}
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ class_B_label: DW_TAG_class_type {
|
||||
+ {DW_AT_name "B"}
|
||||
+ {DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata}
|
||||
+ } {
|
||||
+ # While there are easier / better ways to specify an
|
||||
+ # offset used by DW_AT_data_member_location than that
|
||||
+ # used below, we need a location expression here in
|
||||
+ # order to reproduce the bug. Moreover, this location
|
||||
+ # expression needs to use opcodes that aren't handled
|
||||
+ # by decode_locdesc() in dwarf2/read.c; if we use
|
||||
+ # opcodes that _are_ handled by that function, the
|
||||
+ # location expression will be converted into a simple
|
||||
+ # offset - which will then (again) not reproduce the
|
||||
+ # bug. At the time that this test was written,
|
||||
+ # neither DW_OP_pick nor DW_OP_drop were being handled
|
||||
+ # by decode_locdesc(); this is why those opcodes were
|
||||
+ # chosen.
|
||||
+ DW_TAG_inheritance {
|
||||
+ {DW_AT_type :$class_A_label}
|
||||
+ {DW_AT_data_member_location {
|
||||
+ DW_OP_constu ${::B_a}
|
||||
+ DW_OP_plus
|
||||
+ DW_OP_pick 0
|
||||
+ DW_OP_drop} SPECIAL_expr}
|
||||
+ {DW_AT_accessibility 1 DW_FORM_data1}
|
||||
+ }
|
||||
+ DW_TAG_member {
|
||||
+ {DW_AT_name "b"}
|
||||
+ {DW_AT_type :$int_label}
|
||||
+ {DW_AT_data_member_location ${::B_b} DW_FORM_udata}
|
||||
+ }
|
||||
+ DW_TAG_member {
|
||||
+ {DW_AT_name "x2"}
|
||||
+ {DW_AT_type :$int_label}
|
||||
+ {DW_AT_data_member_location ${::B_x2} DW_FORM_udata}
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ B_ptr_label: DW_TAG_pointer_type {
|
||||
+ {DW_AT_type :$class_B_label}
|
||||
+ {DW_AT_byte_size ${::addr_size} DW_FORM_sdata}
|
||||
+ }
|
||||
+
|
||||
+ DW_TAG_variable {
|
||||
+ {DW_AT_name "g_A"}
|
||||
+ {DW_AT_type :$class_A_label}
|
||||
+ {DW_AT_external 1 flag}
|
||||
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_A"]} \
|
||||
+ SPECIAL_expr}
|
||||
+ }
|
||||
+
|
||||
+ DW_TAG_variable {
|
||||
+ {DW_AT_name "g_B"}
|
||||
+ {DW_AT_type :$class_B_label}
|
||||
+ {DW_AT_external 1 flag}
|
||||
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_B"]} \
|
||||
+ SPECIAL_expr}
|
||||
+ }
|
||||
+
|
||||
+ # We can't use MACRO_AT for the definitions of foo and bar
|
||||
+ # because it doesn't provide a way to pass the appropriate
|
||||
+ # flags. Therefore, we list the name, low_pc, and high_pc
|
||||
+ # explicitly.
|
||||
+ DW_TAG_subprogram {
|
||||
+ {DW_AT_name foo}
|
||||
+ {DW_AT_low_pc $foo_start DW_FORM_addr}
|
||||
+ {DW_AT_high_pc $foo_end DW_FORM_addr}
|
||||
+ {DW_AT_type :${B_ptr_label}}
|
||||
+ {DW_AT_external 1 flag}
|
||||
+ }
|
||||
+
|
||||
+ DW_TAG_subprogram {
|
||||
+ {DW_AT_name bar}
|
||||
+ {DW_AT_low_pc $bar_start DW_FORM_addr}
|
||||
+ {DW_AT_high_pc $bar_end DW_FORM_addr}
|
||||
+ {DW_AT_type :${B_ptr_label}}
|
||||
+ {DW_AT_external 1 flag}
|
||||
+ } {
|
||||
+ DW_TAG_formal_parameter {
|
||||
+ {DW_AT_name v}
|
||||
+ {DW_AT_type :${B_ptr_label}}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ lines {version 2} L {
|
||||
+ include_dir "${::srcdir}/${::subdir}"
|
||||
+ file_name "${::srcfile}" 1
|
||||
+
|
||||
+ # Generate a line table program.
|
||||
+ program {
|
||||
+ {DW_LNE_set_address $foo_start}
|
||||
+ {line [gdb_get_line_number "foo prologue"]}
|
||||
+ {DW_LNS_copy}
|
||||
+ {DW_LNE_set_address foo_label}
|
||||
+ {line [gdb_get_line_number "foo return"]}
|
||||
+ {DW_LNS_copy}
|
||||
+ {line [gdb_get_line_number "foo end"]}
|
||||
+ {DW_LNS_copy}
|
||||
+ {DW_LNE_set_address $foo_end}
|
||||
+ {DW_LNS_advance_line 1}
|
||||
+ {DW_LNS_copy}
|
||||
+ {DW_LNE_end_sequence}
|
||||
+
|
||||
+ {DW_LNE_set_address $bar_start}
|
||||
+ {line [gdb_get_line_number "bar prologue"]}
|
||||
+ {DW_LNS_copy}
|
||||
+ {DW_LNE_set_address bar_label}
|
||||
+ {line [gdb_get_line_number "bar return"]}
|
||||
+ {DW_LNS_copy}
|
||||
+ {line [gdb_get_line_number "bar end"]}
|
||||
+ {DW_LNS_copy}
|
||||
+ {DW_LNE_set_address $bar_end}
|
||||
+ {DW_LNS_advance_line 1}
|
||||
+ {DW_LNS_copy}
|
||||
+ {DW_LNE_end_sequence}
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Compile the shared object again, but this time include / use the
|
||||
+# DWARF info that we've created above. Note that (again)
|
||||
+# -DIS_SHAREDLIB is used to prevent inclusion of main() in the shared
|
||||
+# object. Also note the use of the "nodebug" option. Any debugging
|
||||
+# information that we need will be provided by the DWARF info created
|
||||
+# above.
|
||||
+if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \
|
||||
+ {additional_flags=-DIS_SHAREDLIB nodebug}] != ""} {
|
||||
+ untested "failed to compile shared library"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Compile the main program for use with the shared object.
|
||||
+if [prepare_for_testing "failed to prepare" ${testfile} \
|
||||
+ ${::srcfile2} [list debug shlib=$lib_so]] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Do whatever is necessary to make sure that the shared library is
|
||||
+# loaded for remote targets.
|
||||
+gdb_load_shlib ${lib_so}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ fail "can't run to main"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Step into foo so that we can finish out of it.
|
||||
+gdb_test "step" "foo .. at .* foo end.*" "step into foo"
|
||||
+
|
||||
+# Finishing out of foo will create a value that will later need to
|
||||
+# be preserved when restarting the program.
|
||||
+gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo"
|
||||
+
|
||||
+# Dereferencing and printing the return value isn't necessary
|
||||
+# for reproducing the bug, but we should make sure that the
|
||||
+# return value is what we expect it to be.
|
||||
+gdb_test "p *$" { = {<A> = {a = 8, x = 9}, b = 10, x2 = 11}} \
|
||||
+ "dereference return value"
|
||||
+
|
||||
+# The original PR28030 reproducer stepped back into the shared object,
|
||||
+# so we'll do the same here:
|
||||
+gdb_test "step" "bar \\(.*" "step into bar"
|
||||
+
|
||||
+# We don't want a clean restart here since that will be too clean.
|
||||
+# The original reproducer for PR28030 set a breakpoint in the shared
|
||||
+# library and then restarted via "run". The command below does roughly
|
||||
+# the same thing. It's at this step that an internal error would
|
||||
+# occur for PR28030. The "message" argument tells runto to turn on
|
||||
+# the printing of PASSes while runto is doing its job.
|
||||
+runto "bar" message
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+typedef struct A {
|
||||
+ long a;
|
||||
+ long x;
|
||||
+} A;
|
||||
+
|
||||
+typedef struct B {
|
||||
+ A a;
|
||||
+ long b;
|
||||
+ long x2;
|
||||
+} B;
|
||||
+
|
||||
+extern B *foo ();
|
||||
+extern B *bar (B *v);
|
@ -1,348 +0,0 @@
|
||||
[gdb/testsuite] Add gdb.arch/ppc64-break-on-_exit.exp
|
||||
|
||||
Add a regression test-case for commit a50bdb99afe "[gdb/tdep, rs6000] Don't
|
||||
skip system call in skip_prologue":
|
||||
- set a breakpoint on a local copy of glibc's _exit, and
|
||||
- verify that it triggers.
|
||||
|
||||
The test-case uses an assembly file by default, but also has the possibility
|
||||
to use a C source file instead.
|
||||
|
||||
Tested on ppc64le-linux. Verified that the test-case fails without
|
||||
aforementioned commit, and passes with the commit. Both with assembly
|
||||
and C source.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c | 27 +++++
|
||||
gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c | 112 +++++++++++++++++++++
|
||||
gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp | 56 +++++++++++
|
||||
gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s | 108 ++++++++++++++++++++
|
||||
4 files changed, 303 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c
|
||||
new file mode 100644
|
||||
index 00000000000..77253140e36
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This file is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2021 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>
|
||||
+
|
||||
+__thread int __libc_errno;
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ _exit (22);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c
|
||||
new file mode 100644
|
||||
index 00000000000..8638a7a6b70
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c
|
||||
@@ -0,0 +1,112 @@
|
||||
+/* This file is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2021 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/>. */
|
||||
+
|
||||
+/* This file was generated from glibc's 2.31 _exit.c, by doing a glibc build
|
||||
+ on ppc64le-linux, copying the command line, adding -g0 -save-temps and
|
||||
+ recuding the _exit.i file. */
|
||||
+
|
||||
+void _exit (int status);
|
||||
+
|
||||
+extern __thread int __libc_errno;
|
||||
+
|
||||
+void
|
||||
+_exit (int status)
|
||||
+{
|
||||
+ while (1)
|
||||
+ {
|
||||
+ ({
|
||||
+ long int sc_err __attribute__ ((unused));
|
||||
+ long int sc_ret
|
||||
+ = ({
|
||||
+ register long int r0 __asm__ ("r0");
|
||||
+ register long int r3 __asm__ ("r3");
|
||||
+ register long int r4 __asm__ ("r4");
|
||||
+ register long int r5 __asm__ ("r5");
|
||||
+ register long int r6 __asm__ ("r6");
|
||||
+ register long int r7 __asm__ ("r7");
|
||||
+ register long int r8 __asm__ ("r8");
|
||||
+ long int arg1 = (long int) (status);
|
||||
+
|
||||
+ r0 = 234;
|
||||
+
|
||||
+ extern void __illegally_sized_syscall_arg1 (void);
|
||||
+ if (__builtin_classify_type (status) != 5 && sizeof (status) > 8)
|
||||
+ __illegally_sized_syscall_arg1 ();
|
||||
+
|
||||
+ r3 = arg1;
|
||||
+ __asm__ __volatile__ ("sc\n\t" "mfcr %0\n\t" "0:"
|
||||
+ : "=&r" (r0), "=&r" (r3), "=&r" (r4),
|
||||
+ "=&r" (r5), "=&r" (r6), "=&r" (r7),
|
||||
+ "=&r" (r8) : "0" (r0), "1" (r3)
|
||||
+ : "r9", "r10", "r11", "r12", "cr0", "ctr", "memory");
|
||||
+ sc_err = r0;
|
||||
+
|
||||
+ r3;
|
||||
+ });
|
||||
+
|
||||
+ if (((void) (sc_ret), __builtin_expect ((sc_err) & (1 << 28), 0)))
|
||||
+ {
|
||||
+ (__libc_errno = ((sc_ret)));
|
||||
+ sc_ret = -1L;
|
||||
+ }
|
||||
+
|
||||
+ sc_ret;
|
||||
+ });
|
||||
+
|
||||
+ ({
|
||||
+ long int sc_err __attribute__ ((unused));
|
||||
+ long int sc_ret
|
||||
+ = ({
|
||||
+ register long int r0 __asm__ ("r0");
|
||||
+ register long int r3 __asm__ ("r3");
|
||||
+ register long int r4 __asm__ ("r4");
|
||||
+ register long int r5 __asm__ ("r5");
|
||||
+ register long int r6 __asm__ ("r6");
|
||||
+ register long int r7 __asm__ ("r7");
|
||||
+ register long int r8 __asm__ ("r8");
|
||||
+ long int arg1 = (long int) (status);
|
||||
+
|
||||
+ r0 = 1;
|
||||
+
|
||||
+ extern void __illegally_sized_syscall_arg1 (void);
|
||||
+ if (__builtin_classify_type (status) != 5 && sizeof (status) > 8)
|
||||
+ __illegally_sized_syscall_arg1 ();
|
||||
+
|
||||
+ r3 = arg1;
|
||||
+ __asm__ __volatile__ ("sc\n\t" "mfcr %0\n\t" "0:"
|
||||
+ : "=&r" (r0), "=&r" (r3), "=&r" (r4),
|
||||
+ "=&r" (r5), "=&r" (r6), "=&r" (r7),
|
||||
+ "=&r" (r8) : "0" (r0), "1" (r3)
|
||||
+ : "r9", "r10", "r11", "r12", "cr0", "ctr", "memory");
|
||||
+ sc_err = r0;
|
||||
+
|
||||
+ r3;
|
||||
+ });
|
||||
+
|
||||
+ if (((void) (sc_ret), __builtin_expect ((sc_err) & (1 << 28), 0)))
|
||||
+ {
|
||||
+ (__libc_errno = ((sc_ret)));
|
||||
+ sc_ret = -1L;
|
||||
+ }
|
||||
+
|
||||
+ sc_ret;
|
||||
+ });
|
||||
+
|
||||
+
|
||||
+ asm (".long 0");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
|
||||
new file mode 100644
|
||||
index 00000000000..b2fef8e8b76
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
|
||||
@@ -0,0 +1,56 @@
|
||||
+# Copyright 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Set a breakpoint on a local copy of glibc's _exit, and verify that it
|
||||
+# triggers. The function does a syscall immediately after the prologue, and
|
||||
+# if the breakpoint is set past the syscall due to faulty prologue skipping,
|
||||
+# the breakpoint will not trigger.
|
||||
+#
|
||||
+# In particular, we're trying to excercise the instruction analysis
|
||||
+# functionality of prologue skipping. If non-minimal symbols are
|
||||
+# read, then that functionality might not be used because f.i.
|
||||
+# line-info is used instead. So, we use nodebug.
|
||||
+
|
||||
+if {![istarget "powerpc*"] || ![is_lp64_target]} {
|
||||
+ unsupported "Not powerpc64"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set flags { nodebug }
|
||||
+if { 1 } {
|
||||
+ standard_testfile .s -main.c
|
||||
+} else {
|
||||
+ standard_testfile .c -main.c
|
||||
+ lappend flags optimize=-O2
|
||||
+ lappend flags additional_flags=-fno-stack-protector
|
||||
+ lappend flags additional_flags=-mlong-double-128
|
||||
+ lappend flags additional_flags=-fpic
|
||||
+ lappend flags additional_flags=-ftls-model=initial-exec
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" ${testfile} \
|
||||
+ [list $srcfile $srcfile2] $flags] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint "_exit"
|
||||
+
|
||||
+# If the skip_prologue analysis of _exit is too eager, we may not hit the
|
||||
+# breakpoint.
|
||||
+gdb_continue_to_breakpoint "_exit" "_exit \\(\\).*"
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s
|
||||
new file mode 100644
|
||||
index 00000000000..37a9ace2aff
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s
|
||||
@@ -0,0 +1,108 @@
|
||||
+/* This file is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2021 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/>. */
|
||||
+
|
||||
+/* This file was generated from ppc64-break-on-_exit.c. */
|
||||
+
|
||||
+ .file "ppc64-break-on-_exit.c"
|
||||
+ .abiversion 2
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .p2align 4,,15
|
||||
+ .globl _exit
|
||||
+ .type _exit, @function
|
||||
+_exit:
|
||||
+.LCF0:
|
||||
+0: addis 2,12,.TOC.-.LCF0@ha
|
||||
+ addi 2,2,.TOC.-.LCF0@l
|
||||
+ .localentry _exit,.-_exit
|
||||
+ addis 9,2,__libc_errno@got@tprel@ha
|
||||
+ std 31,-8(1)
|
||||
+ mr 31,3
|
||||
+ std 30,-16(1)
|
||||
+ li 0,234
|
||||
+ ld 9,__libc_errno@got@tprel@l(9)
|
||||
+ mr 3,31
|
||||
+ add 30,9,__libc_errno@tls
|
||||
+#APP
|
||||
+ # 28 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1
|
||||
+ sc
|
||||
+ mfcr 0
|
||||
+ 0:
|
||||
+ # 0 "" 2
|
||||
+#NO_APP
|
||||
+ andis. 9,0,0x1000
|
||||
+ mr 9,3
|
||||
+ li 0,1
|
||||
+ mr 3,31
|
||||
+ bne 0,.L13
|
||||
+ .p2align 4,,15
|
||||
+.L2:
|
||||
+#APP
|
||||
+ # 67 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1
|
||||
+ sc
|
||||
+ mfcr 0
|
||||
+ 0:
|
||||
+ # 0 "" 2
|
||||
+#NO_APP
|
||||
+ andis. 9,0,0x1000
|
||||
+ bne 0,.L14
|
||||
+.L3:
|
||||
+#APP
|
||||
+ # 87 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1
|
||||
+ .long 0
|
||||
+ # 0 "" 2
|
||||
+#NO_APP
|
||||
+.L15:
|
||||
+ li 0,234
|
||||
+ mr 3,31
|
||||
+#APP
|
||||
+ # 28 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1
|
||||
+ sc
|
||||
+ mfcr 0
|
||||
+ 0:
|
||||
+ # 0 "" 2
|
||||
+#NO_APP
|
||||
+ andis. 9,0,0x1000
|
||||
+ mr 9,3
|
||||
+ li 0,1
|
||||
+ mr 3,31
|
||||
+ beq 0,.L2
|
||||
+.L13:
|
||||
+ stw 9,0(30)
|
||||
+#APP
|
||||
+ # 67 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1
|
||||
+ sc
|
||||
+ mfcr 0
|
||||
+ 0:
|
||||
+ # 0 "" 2
|
||||
+#NO_APP
|
||||
+ andis. 9,0,0x1000
|
||||
+ beq 0,.L3
|
||||
+ .p2align 4,,15
|
||||
+.L14:
|
||||
+ stw 3,0(30)
|
||||
+#APP
|
||||
+ # 87 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1
|
||||
+ .long 0
|
||||
+ # 0 "" 2
|
||||
+#NO_APP
|
||||
+ b .L15
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,0,0,2,0,0
|
||||
+ .size _exit,.-_exit
|
||||
+ .ident "GCC: (SUSE Linux) 7.5.0"
|
||||
+ .section .note.GNU-stack,"",@progbits
|
@ -1,131 +0,0 @@
|
||||
[gdb/testsuite] Add gdb.opt/break-on-_exit.exp
|
||||
|
||||
Add a test-case to excercise the problem scenario reported in PR28527 and
|
||||
fixed in commit a50bdb99afe "[gdb/tdep, rs6000] Don't skip system call in
|
||||
skip_prologue":
|
||||
- set a breakpoint on _exit, and
|
||||
- verify that it triggers.
|
||||
|
||||
Note that this is not a regression test for that commit. Since the actual
|
||||
code in _exit may vary across os instances, we cannot guarantee that the
|
||||
problem will always trigger with this test-case.
|
||||
|
||||
Rather, this test-case is a version of the original test-case
|
||||
(gdb.threads/process-dies-while-detaching.exp) that is minimal while still
|
||||
reproducing the problem reported in PR28527, in that same setting.
|
||||
|
||||
The benefit of this test-case is that it exercise real-life code and may
|
||||
expose similar problems in other settings. Also, it provides a much easier
|
||||
test-case to investigate in case a similar problem occurs.
|
||||
|
||||
Tested on x86_64-linux and ppc64le-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.opt/break-on-_exit.c | 26 +++++++++++++
|
||||
gdb/testsuite/gdb.opt/break-on-_exit.exp | 66 ++++++++++++++++++++++++++++++++
|
||||
2 files changed, 92 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.c b/gdb/testsuite/gdb.opt/break-on-_exit.c
|
||||
new file mode 100644
|
||||
index 00000000000..d8da66193a8
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/break-on-_exit.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2021 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)
|
||||
+{
|
||||
+ _exit (0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.exp b/gdb/testsuite/gdb.opt/break-on-_exit.exp
|
||||
new file mode 100644
|
||||
index 00000000000..38476412862
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/break-on-_exit.exp
|
||||
@@ -0,0 +1,66 @@
|
||||
+# Copyright 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+# Set a breakpoint on libc's _exit, and verify that it triggers. The function
|
||||
+# tends to do a syscall immediately after the prologue, and if the breakpoint is
|
||||
+# set past the syscall due to faulty prologue skipping, the breakpoint will not
|
||||
+# trigger.
|
||||
+#
|
||||
+# In particular, we're trying to excercise the instruction analysis
|
||||
+# functionality of prologue skipping. If the non-minimal symbols are
|
||||
+# read for libc, then that functionality might not be used because f.i.
|
||||
+# line-info is used instead. Also, if the minimal symbols are not read
|
||||
+# for libc, then the breakpoint is set on the exec-local _exit@plt instead,
|
||||
+# and that functionality will also not be used.
|
||||
+#
|
||||
+# We may get the required setup in case of a libc with misssing separate
|
||||
+# debuginfo, but we want the same effect if that debuginfo is installed.
|
||||
+#
|
||||
+# So, we use -readnever to read minimal symbols, but not non-miminal symbols.
|
||||
+#
|
||||
+# Because the code at _exit may be and usually is optimized, the test is in
|
||||
+# the gdb.opt directory.
|
||||
+
|
||||
+standard_testfile
|
||||
+
|
||||
+# See if we have target board readnow.exp or similar.
|
||||
+if { [lsearch -exact $GDBFLAGS -readnow] != -1 \
|
||||
+ || [lsearch -exact $GDBFLAGS --readnow] != -1 } {
|
||||
+ untested "--readnever not allowed in combination with --readnow"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+save_vars { GDBFLAGS } {
|
||||
+ append GDBFLAGS " -readnever"
|
||||
+
|
||||
+ if {[prepare_for_testing "failed to prepare" $testfile $srcfile nodebug]} {
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint "_exit"
|
||||
+
|
||||
+# Give some background information about the breakpoint(s) and corresponding
|
||||
+# the shared lib(s).
|
||||
+gdb_test "info breakpoints"
|
||||
+gdb_test "info shared"
|
||||
+
|
||||
+# If the skip_prologue analysis of _exit is too eager, we may not hit the
|
||||
+# breakpoint.
|
||||
+gdb_continue_to_breakpoint "_exit" "_exit \\(\\) .*"
|
@ -1,81 +0,0 @@
|
||||
[gdb/testsuite] Add gdb.testsuite/dump-system-info.exp
|
||||
|
||||
When interpreting the testsuite results, it's often relevant what kind of
|
||||
machine the testsuite ran on. On a local machine one can just do
|
||||
/proc/cpuinfo, but in case of running tests using a remote system
|
||||
that distributes test runs to other remote systems that are not directly
|
||||
accessible, that's not possible.
|
||||
|
||||
Fix this by dumping /proc/cpuinfo into the gdb.log, as well as lsb_release -a
|
||||
and uname -a.
|
||||
|
||||
We could do this at the start of each test run, by putting it into unix.exp
|
||||
or some such. However, this might be too verbose, so we choose to put it into
|
||||
its own test-case, such that it get triggered in a full testrun, but not when
|
||||
running one or a subset of tests.
|
||||
|
||||
We put the test-case into the gdb.testsuite directory, which is currently the
|
||||
only place in the testsuite where we do not test gdb. [ Though perhaps this
|
||||
could be put into a new gdb.info directory, since the test-case doesn't
|
||||
actually test the testsuite. ]
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.testsuite/dump-system-info.exp | 48 ++++++++++++++++++++++++
|
||||
1 file changed, 48 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
|
||||
new file mode 100644
|
||||
index 00000000000..bf181469bd5
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
|
||||
@@ -0,0 +1,48 @@
|
||||
+# Copyright 2021 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/>.
|
||||
+
|
||||
+# The purpose of this test-case is to dump /proc/cpuinfo and similar system
|
||||
+# info into gdb.log.
|
||||
+
|
||||
+# Check if /proc/cpuinfo is available.
|
||||
+set res [remote_exec target "test -r /proc/cpuinfo"]
|
||||
+set status [lindex $res 0]
|
||||
+set output [lindex $res 1]
|
||||
+
|
||||
+if { $status == 0 && $output == "" } {
|
||||
+ verbose -log "Cpuinfo available, dumping:"
|
||||
+ remote_exec target "cat /proc/cpuinfo"
|
||||
+} else {
|
||||
+ verbose -log "Cpuinfo not available"
|
||||
+}
|
||||
+
|
||||
+set res [remote_exec target "lsb_release -a"]
|
||||
+set status [lindex $res 0]
|
||||
+set output [lindex $res 1]
|
||||
+
|
||||
+if { $status == 0 } {
|
||||
+ verbose -log "lsb_release -a availabe, dumping:\n$output"
|
||||
+} else {
|
||||
+ verbose -log "lsb_release -a not available"
|
||||
+}
|
||||
+
|
||||
+set res [remote_exec target "uname -a"]
|
||||
+set status [lindex $res 0]
|
||||
+set output [lindex $res 1]
|
||||
+
|
||||
+if { $status == 0 } {
|
||||
+ verbose -log "uname -a availabe, dumping:\n$output"
|
||||
+} else {
|
||||
+ verbose -log "uname -a not available"
|
||||
+}
|
@ -1,59 +0,0 @@
|
||||
[gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp
|
||||
|
||||
On OBS I ran into:
|
||||
...
|
||||
(gdb) shell diff -s outputs/gdb.base/signals-state-child/standalone.txt \
|
||||
outputs/gdb.base/signals-state-child/gdb.txt^M
|
||||
diff: outputs/gdb.base/signals-state-child/standalone.txt: \
|
||||
No such file or directory^M
|
||||
(gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical
|
||||
...
|
||||
|
||||
I managed to reproduce this by adding "sleep (5)" at the start of main in
|
||||
signals-state-child.c.
|
||||
|
||||
Fix this by waiting on the result of the spawned command.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/signals-state-child.exp | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp
|
||||
index 0984033811b..81589375f22 100644
|
||||
--- a/gdb/testsuite/gdb.base/signals-state-child.exp
|
||||
+++ b/gdb/testsuite/gdb.base/signals-state-child.exp
|
||||
@@ -69,9 +69,11 @@ set res [remote_spawn target "$binfile-standalone"]
|
||||
if { $res < 0 || $res == "" } {
|
||||
untested "spawning $binfile-standalone failed"
|
||||
return 1
|
||||
-} else {
|
||||
- pass "collect standalone signals state"
|
||||
}
|
||||
+
|
||||
+set wait_status [remote_wait target 60]
|
||||
+set have_standalone [expr [lindex $wait_status 0] == 0]
|
||||
+gdb_assert { $have_standalone } "collect standalone signals state"
|
||||
remote_close target
|
||||
|
||||
# Now run the program through gdb, and dump its initial signal actions
|
||||
@@ -86,6 +88,12 @@ if { ! [ runto_main ] } then {
|
||||
|
||||
gdb_continue_to_end "collect signals state under gdb"
|
||||
|
||||
+set test "signals states are identical"
|
||||
+if { ! $have_standalone } {
|
||||
+ untested $test
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
if {!$purely_local} {
|
||||
# Copy file from target to host through build.
|
||||
remote_download host [remote_upload target gdb.txt] gdb.txt
|
||||
@@ -95,4 +103,4 @@ if {!$purely_local} {
|
||||
# Diff the .txt files. They should be identical.
|
||||
gdb_test "shell diff -s $standalone_txt $gdb_txt" \
|
||||
"Files .* are identical.*" \
|
||||
- "signals states are identical"
|
||||
+ $test
|
@ -1,51 +0,0 @@
|
||||
[gdb/testsuite] Add nopie in two test-cases
|
||||
|
||||
When running test-case gdb.dwarf2/dw2-restrict.exp on openSUSE Leap 15.2 with
|
||||
gcc-PIE installed (switching compiler default to -fPIE/-pie), I get:
|
||||
...
|
||||
gdb compile failed, ld: outputs/gdb.dwarf2/dw2-restrict/dw2-restrict0.o: \
|
||||
warning: relocation in read-only section `.text'
|
||||
ld: warning: creating DT_TEXTREL in a PIE
|
||||
UNTESTED: gdb.dwarf2/dw2-restrict.exp: failed to prepare
|
||||
...
|
||||
|
||||
This is due to using a hardcoded .S file that was generated with -fno-PIE.
|
||||
|
||||
Fix this by adding the missing nopie.
|
||||
|
||||
Likewise in gdb.arch/amd64-tailcall-noret.exp.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp | 2 ++
|
||||
gdb/testsuite/gdb.dwarf2/dw2-restrict.exp | 3 ++-
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
|
||||
index c68abce61e3..fb1d5695a11 100644
|
||||
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
|
||||
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
|
||||
@@ -25,6 +25,8 @@ if [info exists COMPILE] {
|
||||
return
|
||||
}
|
||||
|
||||
+lappend opts nopie
|
||||
+
|
||||
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
|
||||
return -1
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
|
||||
index 6f98b6cfb18..2a46510c7a3 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
|
||||
@@ -27,7 +27,8 @@ if {![istarget x86_64-*] || ![is_lp64_target]} {
|
||||
|
||||
standard_testfile .S
|
||||
|
||||
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} {
|
||||
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
|
||||
+ {nodebug nopie}]} {
|
||||
return -1
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
gdb/testsuite: address test failures in gdb.mi/mi-multi-commands.exp
|
||||
|
||||
The gdb.mi/mi-multi-commands.exp test was added in commit:
|
||||
|
||||
commit d08cbc5d3203118da5583296e49273cf82378042
|
||||
Date: Wed Dec 22 12:57:44 2021 +0000
|
||||
|
||||
gdb: unbuffer all input streams when not using readline
|
||||
|
||||
And then tweaked in commit:
|
||||
|
||||
commit 144459531dd68a1287905079aaa131b777a8cc82
|
||||
Date: Mon Feb 7 20:35:58 2022 +0000
|
||||
|
||||
gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp test
|
||||
|
||||
The second of these commits was intended to address periodic test
|
||||
failures that I was seeing, and this change did fix some problems,
|
||||
but, unfortunately, introduced other issues.
|
||||
|
||||
The problem is that the test relies on sending two commands to GDB in
|
||||
a single write. As the characters that make these two commands arrive
|
||||
they are echoed to GDB's console. However, there is a race between
|
||||
how quickly the characters are echoed and how quickly GDB decides to
|
||||
act on the incoming commands.
|
||||
|
||||
Usually, both commands are echoed in full before GDB acts on the first
|
||||
command, but sometimes this is not the case, and GDB can execute the
|
||||
first command before both commands are fully echoed to the console.
|
||||
In this case, the output of the first command will be mixed in with
|
||||
the echoing of the second command.
|
||||
|
||||
This mixing of the command echoing and the first command output is
|
||||
what was causing failures in the original version of the test.
|
||||
|
||||
The second commit relaxed the expected output pattern a little, but
|
||||
was still susceptible to failures, so this commit further relaxes the
|
||||
pattern.
|
||||
|
||||
Now, we look for the first command output with no regard to what is
|
||||
before, or after the command. Then we look for the first mi prompt to
|
||||
indicate that the first command has completed.
|
||||
|
||||
I believe that this change should make the test more stable than it
|
||||
was before.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.mi/mi-multi-commands.exp | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
|
||||
index 12b1b482f9a..d00e0aaea8b 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
|
||||
@@ -100,9 +100,12 @@ proc run_test { args } {
|
||||
set seen_second_message false
|
||||
|
||||
gdb_test_multiple "" "look for first command output, command length $i" -prompt "$mi_gdb_prompt" {
|
||||
- -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"\r\n" {
|
||||
- pass $gdb_test_name
|
||||
+ -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"" {
|
||||
set seen_first_message true
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ -re "\r\n$mi_gdb_prompt" {
|
||||
+ gdb_assert $seen_first_message $gdb_test_name
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
[gdb/testsuite] Detect change instead of init in gdb.mi/mi-var-block.exp
|
||||
|
||||
On openSUSE Tumbleweed with target board unix/-m32, I run into:
|
||||
...
|
||||
PASS: gdb.mi/mi-var-block.exp: step at do_block_test 2
|
||||
Expecting: ^(-var-update \*[^M
|
||||
]+)?(\^done,changelist=\[{name="foo",in_scope="true",type_changed="false",has_more="0"},
|
||||
{name="cb",in_scope="true",type_changed="false",has_more="0"}\][^M
|
||||
]+[(]gdb[)] ^M
|
||||
[ ]*)
|
||||
-var-update *^M
|
||||
^done,changelist=[{name="foo",in_scope="true",type_changed="false",has_more="0"}]^M
|
||||
(gdb) ^M
|
||||
FAIL: gdb.mi/mi-var-block.exp: update all vars: cb foo changed (unexpected output)
|
||||
...
|
||||
|
||||
The problem is that the test-case attempts to detect a change in the cb
|
||||
variable caused by this initialization:
|
||||
...
|
||||
void
|
||||
do_block_tests ()
|
||||
{
|
||||
int cb = 12;
|
||||
...
|
||||
but that only works if the stack location happens to be unequal to 12 before
|
||||
the initialization.
|
||||
|
||||
Fix this by first initializing to 0, and then changing the value to 12:
|
||||
...
|
||||
- int cb = 12;
|
||||
+ int cb = 0;
|
||||
+ cb = 12;
|
||||
...
|
||||
and detecting that change.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29195
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.mi/mi-var-block.exp | 5 +++++
|
||||
gdb/testsuite/gdb.mi/var-cmd.c | 3 ++-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp
|
||||
index cb94936fa86..b0707eb3530 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-var-block.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-var-block.exp
|
||||
@@ -40,6 +40,11 @@ mi_gdb_load ${binfile}
|
||||
|
||||
mi_runto do_block_tests
|
||||
|
||||
+# step to "cb = 12;"
|
||||
+mi_step_to "do_block_tests" "" "var-cmd.c" \
|
||||
+ [gdb_get_line_number "cb = 12;"] \
|
||||
+ "step at do_block_test 0"
|
||||
+
|
||||
# Test: c_variable-3.2
|
||||
# Desc: create cb and foo
|
||||
mi_create_varobj "cb" "cb" "create local variable cb"
|
||||
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
|
||||
index fddb0d39a5e..f3312788a80 100644
|
||||
--- a/gdb/testsuite/gdb.mi/var-cmd.c
|
||||
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
|
||||
@@ -207,7 +207,8 @@ subroutine1 (int i, long *l)
|
||||
void
|
||||
do_block_tests ()
|
||||
{
|
||||
- int cb = 12;
|
||||
+ int cb = 0;
|
||||
+ cb = 12;
|
||||
|
||||
{
|
||||
int foo;
|
@ -1,54 +0,0 @@
|
||||
[gdb/testsuite] Detect 'No MPX support'
|
||||
|
||||
On openSUSE Leap 15.3, mpx support has been disabled for m32, so I run into:
|
||||
...
|
||||
(gdb) run ^M
|
||||
Starting program: outputs/gdb.arch/i386-mpx/i386-mpx ^M
|
||||
[Thread debugging using libthread_db enabled]^M
|
||||
Using host libthread_db library "/lib64/libthread_db.so.1".^M
|
||||
No MPX support^M
|
||||
...
|
||||
and eventually into all sort of fails in this and other mpx test-cases.
|
||||
|
||||
Fix this by detecting the "No MPX support" message in have_mpx.
|
||||
|
||||
Tested on x86_64-linux with target boards unix and unix/-m32.
|
||||
|
||||
---
|
||||
gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
index 8b62d73ca9a..306e746168b 100644
|
||||
--- a/gdb/testsuite/lib/gdb.exp
|
||||
+++ b/gdb/testsuite/lib/gdb.exp
|
||||
@@ -8089,6 +8089,29 @@ gdb_caching_proc have_mpx {
|
||||
|
||||
remote_file build delete $obj
|
||||
|
||||
+ if { $status == 0 } {
|
||||
+ verbose "$me: returning $status" 2
|
||||
+ return $status
|
||||
+ }
|
||||
+
|
||||
+ # Compile program with -mmpx -fcheck-pointer-bounds, try to trigger
|
||||
+ # 'No MPX support', in other words, see if kernel supports mpx.
|
||||
+ set src { int main (void) { return 0; } }
|
||||
+ set comp_flags {}
|
||||
+ append comp_flags " additional_flags=-mmpx"
|
||||
+ append comp_flags " additional_flags=-fcheck-pointer-bounds"
|
||||
+ if {![gdb_simple_compile $me-2 $src executable $comp_flags]} {
|
||||
+ return 0
|
||||
+ }
|
||||
+
|
||||
+ set result [remote_exec target $obj]
|
||||
+ set status [lindex $result 0]
|
||||
+ set output [lindex $result 1]
|
||||
+ set status [expr ($status == 0) \
|
||||
+ && ![string equal $output "No MPX support\r\n"]]
|
||||
+
|
||||
+ remote_file build delete $obj
|
||||
+
|
||||
verbose "$me: returning $status" 2
|
||||
return $status
|
||||
}
|
@ -1,153 +0,0 @@
|
||||
[gdb/testsuite] Disable inferior output in gdb.base/foll-vfork.exp
|
||||
|
||||
Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but
|
||||
which makes the regexp matching more difficult (see commit 1f28b70def1
|
||||
"[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp").
|
||||
|
||||
Disable the inferior output using '#if DEBUG'.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/foll-vfork-exit.c | 14 ++++++++++++--
|
||||
gdb/testsuite/gdb.base/foll-vfork.c | 9 ++++++++-
|
||||
gdb/testsuite/gdb.base/foll-vfork.exp | 17 +++++++++++------
|
||||
gdb/testsuite/gdb.base/vforked-prog.c | 7 ++++++-
|
||||
4 files changed, 37 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c
|
||||
index 6c263cdc057..15e272afe82 100644
|
||||
--- a/gdb/testsuite/gdb.base/foll-vfork-exit.c
|
||||
+++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c
|
||||
@@ -29,12 +29,22 @@ main ()
|
||||
pid = vfork (); /* VFORK */
|
||||
if (pid == 0)
|
||||
{
|
||||
- printf ("I'm the child!\n");
|
||||
+ const char *s = "I'm the child!";
|
||||
+#if DEBUG
|
||||
+ printf ("%s\n", s);
|
||||
+#else
|
||||
+ const char *volatile v = s;
|
||||
+#endif
|
||||
_exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
- printf ("I'm the proud parent of child #%d!\n", pid);
|
||||
+ const char *s = "I'm the proud parent of child";
|
||||
+#if DEBUG
|
||||
+ printf ("%s #%d!\n", s, pid);
|
||||
+#else
|
||||
+ const char *volatile v = s;
|
||||
+#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
diff --git a/gdb/testsuite/gdb.base/foll-vfork.c b/gdb/testsuite/gdb.base/foll-vfork.c
|
||||
index 2f6661d1a0b..b7e332e146b 100644
|
||||
--- a/gdb/testsuite/gdb.base/foll-vfork.c
|
||||
+++ b/gdb/testsuite/gdb.base/foll-vfork.c
|
||||
@@ -40,12 +40,19 @@ main (int argc, char ** argv)
|
||||
memcpy (prog + len - 10, "vforked-prog", 12);
|
||||
prog[len + 2] = 0;
|
||||
|
||||
+#if DEBUG
|
||||
printf ("I'm the child!\n");
|
||||
+#endif
|
||||
execlp (prog, prog, (char *) 0);
|
||||
perror ("exec failed");
|
||||
_exit (1);
|
||||
}
|
||||
else {
|
||||
- printf ("I'm the proud parent of child #%d!\n", pid);
|
||||
+ const char *s = "I'm the proud parent of child";
|
||||
+#if DEBUG
|
||||
+ printf ("%s #%d!\n", s, pid);
|
||||
+#else
|
||||
+ const char *volatile v = s;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
|
||||
index a781a5c2087..fc710167f7d 100644
|
||||
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
|
||||
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
|
||||
@@ -32,9 +32,14 @@ if [gdb_debug_enabled] {
|
||||
return 0
|
||||
}
|
||||
|
||||
+# Set DEBUG to 0 or 1 in sources.
|
||||
+set debug 0
|
||||
+
|
||||
standard_testfile
|
||||
|
||||
-set compile_options debug
|
||||
+set compile_options {}
|
||||
+lappend compile_options debug
|
||||
+lappend compile_options additional_flags=-DDEBUG=$debug
|
||||
|
||||
if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} {
|
||||
untested "failed to compile main testcase"
|
||||
@@ -126,7 +131,7 @@ proc vfork_parent_follow_to_bp {} {
|
||||
|
||||
gdb_test_no_output "set follow-fork parent"
|
||||
|
||||
- set bp_location [gdb_get_line_number "printf (\"I'm the proud parent of child"]
|
||||
+ set bp_location [gdb_get_line_number "I'm the proud parent of child"]
|
||||
gdb_test "break ${srcfile}:${bp_location}" ".*" "break, vfork to bp"
|
||||
|
||||
set test "continue to bp"
|
||||
@@ -176,7 +181,7 @@ proc vfork_and_exec_child_follow_to_main_bp {} {
|
||||
|
||||
gdb_test_no_output "set follow-fork child"
|
||||
|
||||
- set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
|
||||
+ set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}]
|
||||
|
||||
set test "continue to bp"
|
||||
gdb_test_multiple "continue" $test {
|
||||
@@ -278,7 +283,7 @@ proc tcatch_vfork_then_child_follow_exec {} {
|
||||
continue_to_vfork
|
||||
|
||||
set linenum1 [gdb_get_line_number "pid = vfork ();"]
|
||||
- set linenum2 [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
|
||||
+ set linenum2 [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}]
|
||||
|
||||
set test "finish"
|
||||
gdb_test_multiple "finish" $test {
|
||||
@@ -356,7 +361,7 @@ proc vfork_relations_in_info_inferiors { variant } {
|
||||
if { $variant == "exec" } {
|
||||
global srcfile2
|
||||
|
||||
- set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
|
||||
+ set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}]
|
||||
set test "continue to bp"
|
||||
gdb_test_multiple "continue" $test {
|
||||
-re ".*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " {
|
||||
@@ -487,7 +492,7 @@ set testfile "foll-vfork-exit"
|
||||
set srcfile ${testfile}.c
|
||||
set binfile [standard_output_file ${testfile}]
|
||||
|
||||
-if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
|
||||
+if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} {
|
||||
untested "failed to build $testfile"
|
||||
return
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.base/vforked-prog.c b/gdb/testsuite/gdb.base/vforked-prog.c
|
||||
index 936c6e6032d..999efa8ce0d 100644
|
||||
--- a/gdb/testsuite/gdb.base/vforked-prog.c
|
||||
+++ b/gdb/testsuite/gdb.base/vforked-prog.c
|
||||
@@ -19,6 +19,11 @@
|
||||
|
||||
int main (void)
|
||||
{
|
||||
- printf("Hello from vforked-prog...\n");
|
||||
+ const char *s = "Hello from vforked-prog";
|
||||
+#if DEBUG
|
||||
+ printf ("%s...\n", s);
|
||||
+#else
|
||||
+ const char *volatile v = s;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
gdb/testsuite: don't error when trying to unset last_spawn_tty_name
|
||||
|
||||
In spawn_capture_tty_name (lib/gdb.exp) we either set or unset
|
||||
last_spawn_tty_name depending on whether spawn_out(slave,name) exists
|
||||
or not.
|
||||
|
||||
One situation that might cause spawn_out(slave,name) to not exists is
|
||||
if the spawn function is called with the argument -leaveopen, which is
|
||||
how it is called when processes are created as part of a pipeline, the
|
||||
created process has no tty, instead its output is written to a file
|
||||
descriptor.
|
||||
|
||||
If a pipeline is created consisting of multiple processes then there
|
||||
will be multiple sequential calls to spawn, all using -leaveopen. The
|
||||
first of these calls is fine, spawn_out(slave,name) is not set, and so
|
||||
in spawn_capture_tty_name we unset last_spawn_tty_name. However, on
|
||||
the second call to spawn, spawn_out(slave,name) is still not set and
|
||||
so in spawn_capture_tty_name we again try to unset
|
||||
last_spawn_tty_name, this now throws an error (as last_spawn_tty_name
|
||||
is already unset).
|
||||
|
||||
Fix this issue by using -nocomplain with the call to unset in
|
||||
spawn_capture_tty_name.
|
||||
|
||||
Before this commit I was seeing gdb.base/gnu-debugdata.exp report 1
|
||||
pass, and 1 unsupported test. After this commit I now see 16 passes
|
||||
from this test script.
|
||||
|
||||
I have also improved the code that used to do this:
|
||||
|
||||
if { [info exists spawn_out] } {
|
||||
set ::last_spawn_tty_name $spawn_out(slave,name)
|
||||
} else {
|
||||
...
|
||||
}
|
||||
|
||||
The problem here is that we check for the existence of spawn_out, and
|
||||
then unconditionally read spawn_out(slave,name). A situation could
|
||||
arise where some other element of spawn_out is set,
|
||||
e.g. spawn_out(foo), in which case we would enter the if block and try
|
||||
to read a non-existent variable. After this commit we now check
|
||||
specifically for spawn_out(slave,name).
|
||||
|
||||
Finally, it is worth noting that before this issue was fixed runtest
|
||||
itself, or rather the expect process behind runtest, would segfault
|
||||
while exiting. I haven't looked at all into what the problem is here
|
||||
that caused expect to crash, as fixing the bug in GDB's testing
|
||||
scripts made the segfault go away.
|
||||
|
||||
---
|
||||
gdb/testsuite/lib/gdb.exp | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
index 7a8332dd573..8b62d73ca9a 100644
|
||||
--- a/gdb/testsuite/lib/gdb.exp
|
||||
+++ b/gdb/testsuite/lib/gdb.exp
|
||||
@@ -2010,10 +2010,20 @@ proc gdb_file_cmd { arg } {
|
||||
proc spawn_capture_tty_name { args } {
|
||||
set result [uplevel builtin_spawn $args]
|
||||
upvar spawn_out spawn_out
|
||||
- if { [info exists spawn_out] } {
|
||||
+ if { [info exists spawn_out(slave,name)] } {
|
||||
set ::last_spawn_tty_name $spawn_out(slave,name)
|
||||
} else {
|
||||
- unset ::last_spawn_tty_name
|
||||
+ # If a process is spawned as part of a pipe line (e.g. passing
|
||||
+ # -leaveopen to the spawn proc) then the spawned process is no
|
||||
+ # assigned a tty and spawn_out(slave,name) will not be set.
|
||||
+ # In that case we want to ensure that last_spawn_tty_name is
|
||||
+ # not set.
|
||||
+ #
|
||||
+ # If the previous process spawned was also not assigned a tty
|
||||
+ # (e.g. multiple processed chained in a pipeline) then
|
||||
+ # last_spawn_tty_name will already be unset, so, if we don't
|
||||
+ # use -nocomplain here we would otherwise get an error.
|
||||
+ unset -nocomplain ::last_spawn_tty_name
|
||||
}
|
||||
return $result
|
||||
}
|
430
gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch
Normal file
430
gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch
Normal file
@ -0,0 +1,430 @@
|
||||
[gdb/testsuite] Enable some test-cases for x86_64 -m32
|
||||
|
||||
When trying to run test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux
|
||||
with target board unix/-m32, it's skipped.
|
||||
|
||||
Fix this by using is_x86_like_target instead of istarget "i?86-*linux*".
|
||||
|
||||
This exposes a number of duplicates, fix those by making the test names unique.
|
||||
|
||||
Likewise in a couple of other test-cases.
|
||||
|
||||
Tested on x86_64-linux with target boards unix/-m32.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.reverse/i386-precsave.exp | 2 +-
|
||||
gdb/testsuite/gdb.reverse/i386-reverse.exp | 2 +-
|
||||
gdb/testsuite/gdb.reverse/i387-env-reverse.exp | 121 +++++++------
|
||||
gdb/testsuite/gdb.reverse/i387-stack-reverse.exp | 214 +++++++++++------------
|
||||
4 files changed, 166 insertions(+), 173 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.reverse/i386-precsave.exp b/gdb/testsuite/gdb.reverse/i386-precsave.exp
|
||||
index e3fc940f5d0..54580474430 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/i386-precsave.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/i386-precsave.exp
|
||||
@@ -25,7 +25,7 @@ if ![supports_process_record] {
|
||||
}
|
||||
|
||||
|
||||
-if ![istarget "i?86-*linux*"] then {
|
||||
+if ![is_x86_like_target] then {
|
||||
verbose "Skipping i386 reverse tests."
|
||||
return
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.exp b/gdb/testsuite/gdb.reverse/i386-reverse.exp
|
||||
index 68e964e863c..15c18dad205 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/i386-reverse.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.exp
|
||||
@@ -24,7 +24,7 @@ if ![supports_reverse] {
|
||||
}
|
||||
|
||||
|
||||
-if ![istarget "i?86-*linux*"] then {
|
||||
+if ![is_x86_like_target] then {
|
||||
verbose "Skipping i386 reverse tests."
|
||||
return
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
|
||||
index 43c493dcca9..a0a79c22ed0 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
|
||||
@@ -16,7 +16,7 @@
|
||||
# This file is part of the gdb testsuite.
|
||||
|
||||
|
||||
-if ![istarget "i?86-*linux*"] then {
|
||||
+if ![is_x86_like_target] then {
|
||||
verbose "Skipping i387 reverse float tests."
|
||||
return
|
||||
}
|
||||
@@ -52,82 +52,79 @@ gdb_test "until $location" ".*$srcfile:$location.*" \
|
||||
"rewind to beginning of main"
|
||||
gdb_test_no_output "set exec-dir forward" "set forward direction"
|
||||
|
||||
-# Test FPU env particularly ftag and fstatus reigters.
|
||||
+with_test_prefix "forward" {
|
||||
+ # Test FPU env particularly ftag and fstatus reigters.
|
||||
|
||||
-set location [gdb_get_line_number "TEST ENV"]
|
||||
-gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \
|
||||
- "begin testing fpu env"
|
||||
+ set location [gdb_get_line_number "TEST ENV"]
|
||||
+ gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \
|
||||
+ "begin testing fpu env"
|
||||
|
||||
-gdb_test "n" "asm.*fsave.*" "save FPU env in memory"
|
||||
-gdb_test "n" "asm.*frstor.*" "restore FPU env"
|
||||
-gdb_test "n" "asm.*fstsw.*" "store status word in EAX"
|
||||
-gdb_test "n" "asm.*fld1.*" "push st0"
|
||||
+ gdb_test "n" "asm.*fsave.*" "save FPU env in memory"
|
||||
+ gdb_test "n" "asm.*frstor.*" "restore FPU env"
|
||||
+ gdb_test "n" "asm.*fstsw.*" "store status word in EAX"
|
||||
+ gdb_test "n" "asm.*fld1.*" "push st0"
|
||||
|
||||
-gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*" "verify eax == 0x8040000"
|
||||
-gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0"
|
||||
-gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff"
|
||||
+ gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*" "verify eax == 0x8040000"
|
||||
+ gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0"
|
||||
+ gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff"
|
||||
|
||||
-gdb_test "stepi" "asm.*fldl2t.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800"
|
||||
-gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff"
|
||||
+ gdb_test "stepi" "asm.*fldl2t.*" "step to fldl2t"
|
||||
+ gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800"
|
||||
+ gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff"
|
||||
|
||||
-gdb_test "stepi" "asm.*fldl2e.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000"
|
||||
-gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff"
|
||||
+ gdb_test "stepi" "asm.*fldl2e.*" "step to fldl2e"
|
||||
+ gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000"
|
||||
+ gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff"
|
||||
|
||||
-gdb_test "stepi" "asm.*fldpi.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800"
|
||||
-gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff"
|
||||
+ gdb_test "stepi" "asm.*fldpi.*" "step to fldpi"
|
||||
+ gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800"
|
||||
+ gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff"
|
||||
|
||||
-gdb_test "stepi" "asm.*fldlg2.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000"
|
||||
-gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff"
|
||||
+ gdb_test "stepi" "asm.*fldlg2.*" "step to fldlg2"
|
||||
+ gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000"
|
||||
+ gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff"
|
||||
|
||||
-gdb_test "stepi" "asm.*fldln2.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800"
|
||||
-gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f"
|
||||
+ gdb_test "stepi" "asm.*fldln2.*" "step to fldln2"
|
||||
+ gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800"
|
||||
+ gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f"
|
||||
|
||||
-gdb_test "stepi" "asm.*fldz.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000"
|
||||
-gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf"
|
||||
+ gdb_test "stepi" "asm.*fldz.*" "step to fldz"
|
||||
+ gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000"
|
||||
+ gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf"
|
||||
|
||||
-gdb_test "stepi" "asm.*nop.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x800.*\[ \t\]+.*" "verify fstat == 0x800"
|
||||
-gdb_test "info register ftag" "ftag *0x7.*\[ \t\]+.*" "verify ftag == 0x7"
|
||||
-
|
||||
-
|
||||
-# move backward and ehck we get the same registers back.
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldz.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000"
|
||||
-gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800"
|
||||
-gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000"
|
||||
-gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800"
|
||||
-gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000"
|
||||
-gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff"
|
||||
+ gdb_test "stepi" "asm.*nop.*" "step to nop"
|
||||
+ gdb_test "info register fstat" "fstat *0x800.*\[ \t\]+.*" "verify fstat == 0x800"
|
||||
+ gdb_test "info register ftag" "ftag *0x7.*\[ \t\]+.*" "verify ftag == 0x7"
|
||||
+}
|
||||
|
||||
-gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800"
|
||||
-gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff"
|
||||
+# Move backward and check we get the same registers back.
|
||||
|
||||
-gdb_test "reverse-stepi" "asm.*fld1.*" "push st0"
|
||||
-gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0"
|
||||
-gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff"
|
||||
+with_test_prefix "backward" {
|
||||
+ gdb_test "reverse-stepi" "asm.*fldz.*" "step to fldz"
|
||||
+ gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000"
|
||||
+ gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf"
|
||||
|
||||
+ gdb_test "reverse-stepi" "asm.*fldln2.*" "step to fldln2"
|
||||
+ gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800"
|
||||
+ gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f"
|
||||
|
||||
+ gdb_test "reverse-stepi" "asm.*fldlg2.*" "step to fldlg2"
|
||||
+ gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000"
|
||||
+ gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff"
|
||||
|
||||
+ gdb_test "reverse-stepi" "asm.*fldpi.*" "step to fldpi"
|
||||
+ gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800"
|
||||
+ gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff"
|
||||
|
||||
+ gdb_test "reverse-stepi" "asm.*fldl2e.*" "step tp fldl2d"
|
||||
+ gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000"
|
||||
+ gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff"
|
||||
|
||||
+ gdb_test "reverse-stepi" "asm.*fldl2t.*" "step to fldl2t"
|
||||
+ gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800"
|
||||
+ gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff"
|
||||
|
||||
+ gdb_test "reverse-stepi" "asm.*fld1.*" "step to fld1"
|
||||
+ gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0"
|
||||
+ gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
|
||||
index 9f8ff74da2b..cadd4f76035 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
|
||||
@@ -16,7 +16,7 @@
|
||||
# This file is part of the gdb testsuite.
|
||||
|
||||
|
||||
-if ![istarget "i?86-*linux*"] then {
|
||||
+if ![is_x86_like_target] then {
|
||||
verbose "Skipping i387 reverse float tests."
|
||||
return
|
||||
}
|
||||
@@ -48,112 +48,108 @@ gdb_test "until $location" ".*$srcfile:$location.*" \
|
||||
"rewind to beginning of main"
|
||||
gdb_test_no_output "set exec-dir forward" "set forward direction"
|
||||
|
||||
-# Test FPU stack. FPU stack includes st0, st1, st2, st3, st4,
|
||||
-# st5, st6, st7. We push 8 values to FPU stack in record mode
|
||||
-# and see whether all are getting recorded.
|
||||
-
|
||||
-set location [gdb_get_line_number "test st0 register"]
|
||||
-gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \
|
||||
- "begin test st0"
|
||||
-gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1"
|
||||
-gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
||||
-
|
||||
-
|
||||
-gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
||||
-gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*"
|
||||
-gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1"
|
||||
-
|
||||
-gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*"
|
||||
-gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
|
||||
-gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
|
||||
-gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1"
|
||||
-
|
||||
-gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
||||
-gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
|
||||
-gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*"
|
||||
-gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*"
|
||||
-gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1"
|
||||
-
|
||||
-gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
||||
-gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
|
||||
-gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
|
||||
-gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*"
|
||||
-gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
|
||||
-gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1"
|
||||
-
|
||||
-gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
||||
-gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
|
||||
-gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
|
||||
-gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
|
||||
-gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
|
||||
-gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
|
||||
-gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1"
|
||||
-
|
||||
-gdb_test "stepi" "asm.*fld1.*" "push st0 == 0"
|
||||
-gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0"
|
||||
-gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
|
||||
-gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
|
||||
-gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
|
||||
-gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
|
||||
-gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*"
|
||||
-gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1"
|
||||
-
|
||||
-gdb_test "stepi" "asm.*nop.*" "push st0 == 0"
|
||||
-gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
||||
-gdb_test "info register st1" "st1 *0\[ \t\]+.*" "verify st1 == 0"
|
||||
-gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*"
|
||||
-gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*"
|
||||
-gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*"
|
||||
-gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*"
|
||||
-gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*"
|
||||
-gdb_test "info register st7" "st7 *1.*" "verify st7 == 1"
|
||||
-
|
||||
-# Now step backward, and check that st0 value reverts to zero.
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7"
|
||||
-gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0"
|
||||
-gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
|
||||
-gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
|
||||
-gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
|
||||
-gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
|
||||
-gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*"
|
||||
-gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
||||
-gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
|
||||
-gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
|
||||
-gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
|
||||
-gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
|
||||
-gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
|
||||
-gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
||||
-gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
|
||||
-gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
|
||||
-gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*"
|
||||
-gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
|
||||
-gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
||||
-gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
|
||||
-gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*"
|
||||
-gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*"
|
||||
-gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*"
|
||||
-gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
|
||||
-gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
|
||||
-gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1"
|
||||
-
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
||||
-gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*"
|
||||
-gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1"
|
||||
-
|
||||
-gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1"
|
||||
-gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
+with_test_prefix "forward" {
|
||||
+ # Test FPU stack. FPU stack includes st0, st1, st2, st3, st4,
|
||||
+ # st5, st6, st7. We push 8 values to FPU stack in record mode
|
||||
+ # and see whether all are getting recorded.
|
||||
+
|
||||
+ set location [gdb_get_line_number "test st0 register"]
|
||||
+ gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \
|
||||
+ "begin test st0"
|
||||
+ gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1"
|
||||
+ gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
||||
+ gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*"
|
||||
+ gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*"
|
||||
+ gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
|
||||
+ gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
|
||||
+ gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
||||
+ gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
|
||||
+ gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*"
|
||||
+ gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*"
|
||||
+ gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
||||
+ gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
|
||||
+ gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
|
||||
+ gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*"
|
||||
+ gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
|
||||
+ gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
||||
+ gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
|
||||
+ gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
|
||||
+ gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
|
||||
+ gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
|
||||
+ gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
|
||||
+ gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*fld1.*" "push st0 == 0"
|
||||
+ gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0"
|
||||
+ gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
|
||||
+ gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
|
||||
+ gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
|
||||
+ gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
|
||||
+ gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*"
|
||||
+ gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1"
|
||||
+
|
||||
+ gdb_test "stepi" "asm.*nop.*" "push st0 == 1, again"
|
||||
+ gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1, again"
|
||||
+ gdb_test "info register st1" "st1 *0\[ \t\]+.*" "verify st1 == 0"
|
||||
+ gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*"
|
||||
+ gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*"
|
||||
+ gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*"
|
||||
+ gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*"
|
||||
+ gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*"
|
||||
+ gdb_test "info register st7" "st7 *1.*" "verify st7 == 1"
|
||||
+}
|
||||
|
||||
+with_test_prefix "backward" {
|
||||
+ # Now step backward, and check that st0 value reverts to zero.
|
||||
+ gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7"
|
||||
+ gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0"
|
||||
+ gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*"
|
||||
+ gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*"
|
||||
+ gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*"
|
||||
+ gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*"
|
||||
+ gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*"
|
||||
+ gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1"
|
||||
+
|
||||
+ gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*"
|
||||
+ gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*"
|
||||
+ gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*"
|
||||
+ gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*"
|
||||
+ gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*"
|
||||
+ gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*"
|
||||
+ gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1"
|
||||
+
|
||||
+ gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*"
|
||||
+ gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*"
|
||||
+ gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*"
|
||||
+ gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*"
|
||||
+ gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*"
|
||||
+ gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1"
|
||||
+
|
||||
+ gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*"
|
||||
+ gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*"
|
||||
+ gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*"
|
||||
+ gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*"
|
||||
+ gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1"
|
||||
+
|
||||
+ gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*"
|
||||
+ gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*"
|
||||
+ gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*"
|
||||
+ gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1"
|
||||
+
|
||||
+ gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*"
|
||||
+ gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*"
|
||||
+ gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1"
|
||||
+
|
||||
+ gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1"
|
||||
+ gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1"
|
||||
+}
|
@ -1,70 +0,0 @@
|
||||
[gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp
|
||||
|
||||
Factor out new proc dump_info in test-case gdb.testsuite/dump-system-info.exp,
|
||||
and in the process:
|
||||
- fix a few typos
|
||||
- remove unnecessary "test -r /proc/cpuinfo"
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Co-Authored-By: Pedro Alves <pedro@palves.net>
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.testsuite/dump-system-info.exp | 42 +++++++++---------------
|
||||
1 file changed, 16 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
|
||||
index bf181469bd5..1831479265c 100644
|
||||
--- a/gdb/testsuite/gdb.testsuite/dump-system-info.exp
|
||||
+++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
|
||||
@@ -15,34 +15,24 @@
|
||||
# The purpose of this test-case is to dump /proc/cpuinfo and similar system
|
||||
# info into gdb.log.
|
||||
|
||||
-# Check if /proc/cpuinfo is available.
|
||||
-set res [remote_exec target "test -r /proc/cpuinfo"]
|
||||
-set status [lindex $res 0]
|
||||
-set output [lindex $res 1]
|
||||
|
||||
-if { $status == 0 && $output == "" } {
|
||||
- verbose -log "Cpuinfo available, dumping:"
|
||||
- remote_exec target "cat /proc/cpuinfo"
|
||||
-} else {
|
||||
- verbose -log "Cpuinfo not available"
|
||||
-}
|
||||
-
|
||||
-set res [remote_exec target "lsb_release -a"]
|
||||
-set status [lindex $res 0]
|
||||
-set output [lindex $res 1]
|
||||
+proc dump_info {cmd {what ""}} {
|
||||
|
||||
-if { $status == 0 } {
|
||||
- verbose -log "lsb_release -a availabe, dumping:\n$output"
|
||||
-} else {
|
||||
- verbose -log "lsb_release -a not available"
|
||||
-}
|
||||
+ if {$what == ""} {
|
||||
+ set what $cmd
|
||||
+ }
|
||||
|
||||
-set res [remote_exec target "uname -a"]
|
||||
-set status [lindex $res 0]
|
||||
-set output [lindex $res 1]
|
||||
+ set res [remote_exec target $cmd]
|
||||
+ set status [lindex $res 0]
|
||||
+ set output [lindex $res 1]
|
||||
|
||||
-if { $status == 0 } {
|
||||
- verbose -log "uname -a availabe, dumping:\n$output"
|
||||
-} else {
|
||||
- verbose -log "uname -a not available"
|
||||
+ if { $status == 0 } {
|
||||
+ verbose -log "$what available, dumping:\n$output"
|
||||
+ } else {
|
||||
+ verbose -log "$what not available"
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+dump_info "cat /proc/cpuinfo" "Cpuinfo"
|
||||
+dump_info "uname -a"
|
||||
+dump_info "lsb_release -a"
|
@ -1,117 +0,0 @@
|
||||
[gdb/testsuite] Fix assembly comments in gdb.dwarf2/clang-debug-names.exp.tcl
|
||||
|
||||
On openSUSE Leap 15.2 aarch64 I ran into:
|
||||
...
|
||||
clang-debug-names-debug.S:72: \
|
||||
Error: junk at end of line, first unrecognized character is `#'
|
||||
...
|
||||
due to:
|
||||
...
|
||||
71 .Ldebug_names_start:
|
||||
72 .short 5 # Header: version
|
||||
...
|
||||
|
||||
Fix this by using the /* ... */ comment style instead:
|
||||
...
|
||||
$ sed -i 's% #\([^"]*\)%/*\1 */%' clang-debug-names.exp.tcl
|
||||
...
|
||||
|
||||
Tested on aarch64-linux and x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl | 76 +++++++++++-----------
|
||||
1 file changed, 38 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl
|
||||
index 6c2858aef0a..4700024c788 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl
|
||||
@@ -31,50 +31,50 @@ set debug_names \
|
||||
[list \
|
||||
" .4byte .Ldebug_names_end - .Ldebug_names_start" \
|
||||
".Ldebug_names_start:" \
|
||||
- " .short 5 # Header: version" \
|
||||
- " .short 0 # Header: padding" \
|
||||
- " .long 1 # Header: compilation unit count" \
|
||||
- " .long 0 # Header: local type unit count" \
|
||||
- " .long 0 # Header: foreign type unit count" \
|
||||
- " .long 2 # Header: bucket count" \
|
||||
- " .long 2 # Header: name count" \
|
||||
+ " .short 5 /* Header: version */" \
|
||||
+ " .short 0 /* Header: padding */" \
|
||||
+ " .long 1 /* Header: compilation unit count */" \
|
||||
+ " .long 0 /* Header: local type unit count */" \
|
||||
+ " .long 0 /* Header: foreign type unit count */" \
|
||||
+ " .long 2 /* Header: bucket count */" \
|
||||
+ " .long 2 /* Header: name count */" \
|
||||
" .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 " \
|
||||
- " # Header: abbreviation table size" \
|
||||
- " .long 8 # Header: augmentation string size" \
|
||||
- " .ascii \"LLVM0700\" # Header: augmentation string" \
|
||||
- " .long .Lcu1_begin # Compilation unit 0" \
|
||||
- " .long 1 # Bucket 0" \
|
||||
- " .long 0 # Bucket 1" \
|
||||
- " .long 193495088 # Hash in Bucket 0" \
|
||||
- " .long 2090499946 # Hash in Bucket 0" \
|
||||
- " .long $int_str_label # String in Bucket 0: int" \
|
||||
- " .long $main_str_label # String in Bucket 0: main" \
|
||||
- " .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0" \
|
||||
- " .long .Lnames0-.Lnames_entries0 # Offset in Bucket 0" \
|
||||
+ " /* Header: abbreviation table size */" \
|
||||
+ " .long 8 /* Header: augmentation string size */" \
|
||||
+ " .ascii \"LLVM0700\" /* Header: augmentation string */" \
|
||||
+ " .long .Lcu1_begin /* Compilation unit 0 */" \
|
||||
+ " .long 1 /* Bucket 0 */" \
|
||||
+ " .long 0 /* Bucket 1 */" \
|
||||
+ " .long 193495088 /* Hash in Bucket 0 */" \
|
||||
+ " .long 2090499946 /* Hash in Bucket 0 */" \
|
||||
+ " .long $int_str_label /* String in Bucket 0: int */" \
|
||||
+ " .long $main_str_label /* String in Bucket 0: main */" \
|
||||
+ " .long .Lnames1-.Lnames_entries0/* Offset in Bucket 0 */" \
|
||||
+ " .long .Lnames0-.Lnames_entries0/* Offset in Bucket 0 */" \
|
||||
".Lnames_abbrev_start0:" \
|
||||
- " .byte 46 # Abbrev code" \
|
||||
- " .byte 46 # DW_TAG_subprogram" \
|
||||
- " .byte 3 # DW_IDX_die_offset" \
|
||||
- " .byte 19 # DW_FORM_ref4" \
|
||||
- " .byte 0 # End of abbrev" \
|
||||
- " .byte 0 # End of abbrev" \
|
||||
- " .byte 36 # Abbrev code" \
|
||||
- " .byte 36 # DW_TAG_base_type" \
|
||||
- " .byte 3 # DW_IDX_die_offset" \
|
||||
- " .byte 19 # DW_FORM_ref4" \
|
||||
- " .byte 0 # End of abbrev" \
|
||||
- " .byte 0 # End of abbrev" \
|
||||
- " .byte 0 # End of abbrev list" \
|
||||
+ " .byte 46 /* Abbrev code */" \
|
||||
+ " .byte 46 /* DW_TAG_subprogram */" \
|
||||
+ " .byte 3 /* DW_IDX_die_offset */" \
|
||||
+ " .byte 19 /* DW_FORM_ref4 */" \
|
||||
+ " .byte 0 /* End of abbrev */" \
|
||||
+ " .byte 0 /* End of abbrev */" \
|
||||
+ " .byte 36 /* Abbrev code */" \
|
||||
+ " .byte 36 /* DW_TAG_base_type */" \
|
||||
+ " .byte 3 /* DW_IDX_die_offset */" \
|
||||
+ " .byte 19 /* DW_FORM_ref4 */" \
|
||||
+ " .byte 0 /* End of abbrev */" \
|
||||
+ " .byte 0 /* End of abbrev */" \
|
||||
+ " .byte 0 /* End of abbrev list */" \
|
||||
".Lnames_abbrev_end0:" \
|
||||
".Lnames_entries0:" \
|
||||
".Lnames1:" \
|
||||
- " .byte 36 # Abbreviation code" \
|
||||
- " .long $int_die_label - .Lcu1_begin # DW_IDX_die_offset" \
|
||||
- " .long 0 # End of list: int" \
|
||||
+ " .byte 36 /* Abbreviation code */" \
|
||||
+ " .long $int_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \
|
||||
+ " .long 0 /* End of list: int */" \
|
||||
".Lnames0:" \
|
||||
- " .byte 46 # Abbreviation code" \
|
||||
- " .long $main_die_label - .Lcu1_begin # DW_IDX_die_offset" \
|
||||
- " .long 0 # End of list: main" \
|
||||
+ " .byte 46 /* Abbreviation code */" \
|
||||
+ " .long $main_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \
|
||||
+ " .long 0 /* End of list: main */" \
|
||||
" .p2align 2" \
|
||||
".Ldebug_names_end:"]
|
||||
|
@ -1,245 +0,0 @@
|
||||
[gdb/testsuite] Fix data alignment in gdb.arch/i386-{avx,sse}.exp
|
||||
|
||||
When running test-case gdb.arch/i386-avx.exp with clang I ran into:
|
||||
...
|
||||
(gdb) PASS: gdb.arch/i386-avx.exp: set first breakpoint in main
|
||||
continue^M
|
||||
Continuing.^M
|
||||
^M
|
||||
Program received signal SIGSEGV, Segmentation fault.^M
|
||||
0x000000000040052b in main (argc=1, argv=0x7fffffffd3c8) at i386-avx.c:54^M
|
||||
54 asm ("vmovaps 0(%0), %%ymm0\n\t"^M
|
||||
(gdb) FAIL: gdb.arch/i386-avx.exp: continue to breakpoint: \
|
||||
continue to first breakpoint in main
|
||||
...
|
||||
|
||||
The problem is that the vmovaps insn requires an 256-bit (or 32-byte aligned
|
||||
address), and it's only 16-byte aligned:
|
||||
...
|
||||
(gdb) p /x $rax
|
||||
$1 = 0x601030
|
||||
...
|
||||
|
||||
Fix this by copying to a sufficiently aligned address.
|
||||
|
||||
Likewise in gdb.arch/i386-sse.exp.
|
||||
|
||||
Tested on x86_64-linux, with both gcc and clang.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/i386-avx.c | 9 +-
|
||||
gdb/testsuite/gdb.arch/i386-sse.c | 10 ++-
|
||||
gdb/testsuite/lib/precise-aligned-alloc.c | 131 ++++++++++++++++++++++++++++++
|
||||
3 files changed, 148 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c
|
||||
index 4e938399a24..255ff5ee6f5 100644
|
||||
--- a/gdb/testsuite/gdb.arch/i386-avx.c
|
||||
+++ b/gdb/testsuite/gdb.arch/i386-avx.c
|
||||
@@ -25,7 +25,7 @@ typedef struct {
|
||||
} v8sf_t;
|
||||
|
||||
|
||||
-v8sf_t data[] =
|
||||
+v8sf_t data_orig[] =
|
||||
{
|
||||
{ { 0.0, 0.125, 0.25, 0.375, 0.50, 0.625, 0.75, 0.875 } },
|
||||
{ { 1.0, 1.125, 1.25, 1.375, 1.50, 1.625, 1.75, 1.875 } },
|
||||
@@ -47,10 +47,15 @@ v8sf_t data[] =
|
||||
#endif
|
||||
};
|
||||
|
||||
+#include "../lib/precise-aligned-alloc.c"
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
+ void *allocated_ptr;
|
||||
+ v8sf_t *data
|
||||
+ = precise_aligned_dup (32, sizeof (data_orig), &allocated_ptr, data_orig);
|
||||
+
|
||||
asm ("vmovaps 0(%0), %%ymm0\n\t"
|
||||
"vmovaps 32(%0), %%ymm1\n\t"
|
||||
"vmovaps 64(%0), %%ymm2\n\t"
|
||||
@@ -107,5 +112,7 @@ main (int argc, char **argv)
|
||||
|
||||
puts ("Bye!"); /* second breakpoint here */
|
||||
|
||||
+ free (allocated_ptr);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c
|
||||
index a5941a4071e..c78a510c1a7 100644
|
||||
--- a/gdb/testsuite/gdb.arch/i386-sse.c
|
||||
+++ b/gdb/testsuite/gdb.arch/i386-sse.c
|
||||
@@ -25,7 +25,7 @@ typedef struct {
|
||||
} v4sf_t;
|
||||
|
||||
|
||||
-v4sf_t data[] =
|
||||
+v4sf_t data_orig[] =
|
||||
{
|
||||
{ { 0.0, 0.25, 0.50, 0.75 } },
|
||||
{ { 1.0, 1.25, 1.50, 1.75 } },
|
||||
@@ -62,9 +62,15 @@ have_sse (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#include "../lib/precise-aligned-alloc.c"
|
||||
+
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
+ void *allocated_ptr;
|
||||
+ v4sf_t *data
|
||||
+ = precise_aligned_dup (16, sizeof (data_orig), &allocated_ptr, data_orig);
|
||||
+
|
||||
if (have_sse ())
|
||||
{
|
||||
asm ("movaps 0(%0), %%xmm0\n\t"
|
||||
@@ -124,5 +130,7 @@ main (int argc, char **argv)
|
||||
puts ("Bye!"); /* second breakpoint here */
|
||||
}
|
||||
|
||||
+ free (allocated_ptr);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
diff --git a/gdb/testsuite/lib/precise-aligned-alloc.c b/gdb/testsuite/lib/precise-aligned-alloc.c
|
||||
new file mode 100644
|
||||
index 00000000000..88a2e445b59
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/lib/precise-aligned-alloc.c
|
||||
@@ -0,0 +1,131 @@
|
||||
+/* This test file is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2021 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 <stdlib.h>
|
||||
+#include <assert.h>
|
||||
+#include <string.h>
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+/* Local version of C11's aligned_alloc, but with free_pointer PARAMETER since
|
||||
+ possibly we cannot free the returned value.
|
||||
+ We're not using aligned_alloc here, to allow pre-C11 usage. */
|
||||
+
|
||||
+static void *
|
||||
+my_aligned_alloc (size_t alignment, size_t size, void **free_pointer)
|
||||
+{
|
||||
+ void *p;
|
||||
+ void *p_orig;
|
||||
+ void *p_end;
|
||||
+ size_t mask;
|
||||
+
|
||||
+#if 0
|
||||
+ /* Use C11's aligned_alloc to do the allocation. */
|
||||
+ p = aligned_alloc (alignment, size);
|
||||
+ assert (p != NULL);
|
||||
+ p_orig = p;
|
||||
+ p_end = p + size;
|
||||
+#else
|
||||
+ /* Allocate extra to ensure alignment. */
|
||||
+ size_t alloc_size = size + alignment;
|
||||
+
|
||||
+ /* Use malloc to do the allocation. */
|
||||
+ p = malloc (alloc_size);
|
||||
+ assert (p != NULL);
|
||||
+ p_orig = p;
|
||||
+ p_end = p + alloc_size;
|
||||
+
|
||||
+ /* Align p. */
|
||||
+ mask = (alignment - 1);
|
||||
+ if (((uintptr_t)p & mask) == 0)
|
||||
+ ;
|
||||
+ else
|
||||
+ {
|
||||
+ p = (void*)((uintptr_t)p & ~mask);
|
||||
+ p += alignment;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ /* Verify p is within bounds, and points to large enough area. */
|
||||
+ assert (p >= p_orig);
|
||||
+ assert (p + size <= p_end);
|
||||
+
|
||||
+ /* Verify required alignment. */
|
||||
+ mask = (alignment - 1);
|
||||
+ assert (((uintptr_t)p & mask) == 0);
|
||||
+
|
||||
+ if (free_pointer != NULL)
|
||||
+ *free_pointer = p_orig;
|
||||
+
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
+/* Allocate SIZE memory with ALIGNMENT, and return it. If FREE_POINTER,
|
||||
+ return in it the corresponding pointer to be passed to free.
|
||||
+
|
||||
+ Do the alignment precisely, in other words, if an alignment of 4 is
|
||||
+ requested, make sure the pointer is 4-byte aligned, but not 8-byte
|
||||
+ aligned. In other words, make sure the pointer is not overaligned.
|
||||
+
|
||||
+ The benefit of using precise alignment is that accidentally specifying
|
||||
+ a too low alignment will not be compensated by accidental
|
||||
+ overalignment. */
|
||||
+
|
||||
+static void *
|
||||
+precise_aligned_alloc (size_t alignment, size_t size, void **free_pointer)
|
||||
+{
|
||||
+ /* Allocate extra to compenate for "p += alignment". */
|
||||
+ size_t alloc_size = size + alignment;
|
||||
+ /* Align extra, to be able to do precise align. */
|
||||
+ void *p = my_aligned_alloc (alignment * 2, alloc_size, free_pointer);
|
||||
+ assert (p != NULL);
|
||||
+ void *p_orig = p;
|
||||
+ void *p_end = p + alloc_size;
|
||||
+
|
||||
+ p += alignment;
|
||||
+
|
||||
+ /* Verify p is without bounds, and points to large enough area. */
|
||||
+ assert (p >= p_orig);
|
||||
+ assert (p + size <= p_end);
|
||||
+
|
||||
+ /* Verify required alignment. */
|
||||
+ size_t mask = (alignment - 1);
|
||||
+ assert (((uintptr_t)p & mask) == 0);
|
||||
+
|
||||
+ /* Verify required alignment is precise. */
|
||||
+ mask = ((2 * alignment) - 1);
|
||||
+ assert (((uintptr_t)p & mask) != 0);
|
||||
+
|
||||
+ if (free_pointer != NULL)
|
||||
+ *free_pointer = p_orig;
|
||||
+
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
+/* Duplicate data SRC of size SIZE to a newly allocated, precisely aligned
|
||||
+ location with alignment ALIGNMENT. */
|
||||
+
|
||||
+static void *
|
||||
+precise_aligned_dup (size_t alignment, size_t size, void **free_pointer,
|
||||
+ void *src)
|
||||
+{
|
||||
+ void *p = precise_aligned_alloc (alignment, size, free_pointer);
|
||||
+
|
||||
+ memcpy (p, src, size);
|
||||
+
|
||||
+ return p;
|
||||
+}
|
@ -1,48 +0,0 @@
|
||||
[gdb/testsuite] Fix FAIL in gdb.base/annota1.exp
|
||||
|
||||
On openSUSE tumbleweed I run into:
|
||||
...
|
||||
FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
|
||||
...
|
||||
due to a message related to libthread_db:
|
||||
...
|
||||
^Z^Zstarting^M
|
||||
[Thread debugging using libthread_db enabled]^M
|
||||
Using host libthread_db library "/lib64/libthread_db.so.1".^M
|
||||
^M
|
||||
^Z^Zframes-invalid^M
|
||||
...
|
||||
which is not matched by the regexp.
|
||||
|
||||
Fix this by updating the regexp.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/annota1.exp | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
|
||||
index 6e30c164ec9..046e942a321 100644
|
||||
--- a/gdb/testsuite/gdb.base/annota1.exp
|
||||
+++ b/gdb/testsuite/gdb.base/annota1.exp
|
||||
@@ -138,6 +138,10 @@ set warning_gdb_index_re \
|
||||
"to use the section anyway\\."]
|
||||
set reading_re \
|
||||
"Reading \[^\r\n\]+"
|
||||
+set libthread_db_re \
|
||||
+ [multi_line \
|
||||
+ "\\\[Thread debugging using libthread_db enabled\\\]" \
|
||||
+ "Using host libthread_db library \[^\r\n\]+"]
|
||||
|
||||
set run_re \
|
||||
[list \
|
||||
@@ -145,7 +149,7 @@ set run_re \
|
||||
"\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
|
||||
"\(\r\n$warning_gdb_index_re\)?" \
|
||||
"\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
|
||||
- "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
|
||||
+ "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \
|
||||
"\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
|
||||
"\032\032breakpoint 1\r\n\r\n" \
|
||||
"Breakpoint 1, \r\n" \
|
@ -1,175 +0,0 @@
|
||||
[gdb/testsuite] Fix FAIL in gdb.tui/basic.exp
|
||||
|
||||
On openSUSE Leap 15.2 aarch64 I ran into:
|
||||
...
|
||||
FAIL: gdb.tui/basic.exp: check main is where we expect on the screen
|
||||
...
|
||||
while this is passing on x86_64.
|
||||
|
||||
On x86_64-linux we have at the initial screen dump for "list -q main":
|
||||
...
|
||||
0 +-/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.tui/tui-layout.c--+
|
||||
1 | 15 You should have received a copy of the GNU General Public |
|
||||
2 | 16 along with this program. If not, see <http://www.gnu.org/|
|
||||
3 | 17 |
|
||||
4 | 18 int |
|
||||
5 | 19 main () |
|
||||
6 | 20 { |
|
||||
7 | 21 return 0; |
|
||||
8 | 22 } |
|
||||
9 | 23 |
|
||||
...
|
||||
but on aarch64:
|
||||
...
|
||||
0 +-/home/tdevries/gdb/src/gdb/testsuite/gdb.tui/tui-layout.c--------------+
|
||||
1 | 16 along with this program. If not, see <http://www.gnu.org/|
|
||||
2 | 17 |
|
||||
3 | 18 int |
|
||||
4 | 19 main () |
|
||||
5 | 20 { |
|
||||
6 | 21 return 0; |
|
||||
7 | 22 } |
|
||||
8 | 23 |
|
||||
9 | 24 |
|
||||
...
|
||||
|
||||
The cause of the diffferent placement is that we have as line number for main
|
||||
on x86_64:
|
||||
...
|
||||
$ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main"
|
||||
Line 20 of "tui-layout.c" starts at address 0x4004a7 <main> \
|
||||
and ends at 0x4004ab <main+4>.
|
||||
...
|
||||
and on aarch64 instead:
|
||||
...
|
||||
$ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main"
|
||||
Line 21 of "tui-layout.c" starts at address 0x4005f4 <main> \
|
||||
and ends at 0x4005f8 <main+4>.
|
||||
...
|
||||
|
||||
Fix this by using a new source file main-one-line.c, that implements the
|
||||
entire main function on a single line, in order to force the compiler to use
|
||||
that line number.
|
||||
|
||||
Also try to do less hard-coding in the test-case.
|
||||
|
||||
Tested on x86_64-linux and aarch64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.tui/basic.exp | 46 ++++++++++++++++++++++++-----------
|
||||
gdb/testsuite/gdb.tui/main-one-line.c | 18 ++++++++++++++
|
||||
2 files changed, 50 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp
|
||||
index 25a11b2b285..afc770f0073 100644
|
||||
--- a/gdb/testsuite/gdb.tui/basic.exp
|
||||
+++ b/gdb/testsuite/gdb.tui/basic.exp
|
||||
@@ -17,7 +17,11 @@
|
||||
|
||||
tuiterm_env
|
||||
|
||||
-standard_testfile tui-layout.c
|
||||
+# Use main-one-line.c to get the line info at a predictable location without
|
||||
+# resorting to a dwarf assembly test-case.
|
||||
+standard_testfile main-one-line.c
|
||||
+
|
||||
+set main_line [gdb_get_line_number "int main"]
|
||||
|
||||
if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
|
||||
return -1
|
||||
@@ -34,7 +38,8 @@ gdb_assert {![string match "No Source Available" $text]} \
|
||||
"initial source listing"
|
||||
|
||||
Term::command "list -q main"
|
||||
-Term::check_contents "list -q main" "21 *return 0"
|
||||
+set main_re "int main \\(\\) { return 0; }"
|
||||
+Term::check_contents "list -q main" "$main_line *$main_re"
|
||||
|
||||
# Get the first source line.
|
||||
set line [Term::get_line 1]
|
||||
@@ -49,16 +54,28 @@ if {[Term::wait_for [string_to_regexp $line]] \
|
||||
fail "scroll up"
|
||||
}
|
||||
|
||||
-# Check the horizontal scrolling. First confirm that 'main ()' is
|
||||
-# where we expect it to be. This relies on the current way we
|
||||
-# position source code on the screen, which might change in the
|
||||
-# future. The important part of this test is detecting the left/right
|
||||
-# scrolling, not which line main is actually on.
|
||||
-set line_num 6
|
||||
-set line [Term::get_line $line_num]
|
||||
-gdb_assert {[regexp -- "19\[\\t \]+main \\(\\)" $line]} \
|
||||
+# Get the actual screen line that main is on.
|
||||
+set main_screen_line -1
|
||||
+for { set i 1 } { $i <= $Term::_cols } { incr i } {
|
||||
+ set line [Term::get_line $i]
|
||||
+ if { [regexp -- "$main_line\[\\t \]+$main_re" $line] } {
|
||||
+ set main_screen_line $i
|
||||
+ break
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Confirm that 'main ()' is where we expect it to be. This relies on the
|
||||
+# current way we position source code on the screen, which might change in
|
||||
+# the future.
|
||||
+gdb_assert { $main_screen_line == 7 } \
|
||||
"check main is where we expect on the screen"
|
||||
-set regexp "19\[\\t \]+ain \\(\\)"
|
||||
+if { $main_screen_line == -1 } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Check the horizontal scrolling.
|
||||
+set shifted_main_re [string range $main_re 1 end]
|
||||
+set regexp "$main_line\[\\t \]+$shifted_main_re"
|
||||
# Send a right arrow.
|
||||
send_gdb "\033\[C"
|
||||
if {[Term::wait_for $regexp]} {
|
||||
@@ -66,11 +83,11 @@ if {[Term::wait_for $regexp]} {
|
||||
} else {
|
||||
fail "scroll right"
|
||||
}
|
||||
-set line [Term::get_line $line_num]
|
||||
+set line [Term::get_line $main_screen_line]
|
||||
# Send a down arrow.
|
||||
send_gdb "\033\[B"
|
||||
if {[Term::wait_for $regexp] \
|
||||
- && [Term::get_line [expr {$line_num - 1}]] == $line} {
|
||||
+ && [Term::get_line [expr {$main_screen_line - 1}]] == $line} {
|
||||
pass "scroll down"
|
||||
} else {
|
||||
fail "scroll down"
|
||||
@@ -84,7 +101,8 @@ Term::check_contents "asm window shows main" "$hex <main>"
|
||||
Term::check_box "asm box" 0 0 80 15
|
||||
|
||||
Term::command "layout split"
|
||||
-Term::check_contents "split layout contents" "21 *return 0.*$hex <main>"
|
||||
+Term::check_contents "split layout contents" \
|
||||
+ "$main_line *$main_re.*$hex <main>"
|
||||
|
||||
Term::check_box "source box in split layout" 0 0 80 7
|
||||
Term::check_box "asm box in split layout" 0 6 80 9
|
||||
diff --git a/gdb/testsuite/gdb.tui/main-one-line.c b/gdb/testsuite/gdb.tui/main-one-line.c
|
||||
new file mode 100644
|
||||
index 00000000000..fb88c667637
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.tui/main-one-line.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2021 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/>. */
|
||||
+
|
||||
+int main () { return 0; }
|
@ -1,64 +0,0 @@
|
||||
[gdb/testsuite] Fix FAIL in gdb.tui/corefile-run.exp
|
||||
|
||||
When running test-case gdb.tui/corefile-run.exp on openSUSE Tumbleweed,
|
||||
I run into:
|
||||
...
|
||||
PASS: gdb.tui/corefile-run.exp: load corefile
|
||||
FAIL: gdb.tui/corefile-run.exp: run until the end
|
||||
...
|
||||
|
||||
What's going on is easier to see when also doing dump_screen if
|
||||
check_contents passes, and inspecting state at the preceding PASS:
|
||||
...
|
||||
+-------------------------------------------------------------------------+
|
||||
exec No process In: L?? PC: ??
|
||||
[New LWP 16629]
|
||||
[Thread debugging using libthread_db enabled]
|
||||
Using host libthread_db library "/lib64/libthread_db.so.1".
|
||||
Core was generated by `/data/gdb_versions/devel/build/gdb/testsuite/output
|
||||
s/gdb.tui/corefile-run/corefi'.
|
||||
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
|
||||
#0 main ()
|
||||
--Type <RET> for more, q to quit, c to continue without paging--
|
||||
...
|
||||
|
||||
The problem is that we're getting a pagination prompt, and the subsequent run
|
||||
command is interpreted as an answer to that prompt.
|
||||
|
||||
Fix this by:
|
||||
- detecting the gdb prompt in response to "load corefile", such that
|
||||
we detect the failure earlier, and
|
||||
- doing a "set pagination off" in Term::clean_restart.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.tui/corefile-run.exp | 2 +-
|
||||
gdb/testsuite/lib/tuiterm.exp | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp
|
||||
index d53149fb648..b3da6d1e67c 100644
|
||||
--- a/gdb/testsuite/gdb.tui/corefile-run.exp
|
||||
+++ b/gdb/testsuite/gdb.tui/corefile-run.exp
|
||||
@@ -55,7 +55,7 @@ gdb_assert {![string match "No Source Available" $text]} \
|
||||
"initial source listing"
|
||||
|
||||
Term::command "core-file $core"
|
||||
-Term::check_contents "load corefile" "21 *return 0"
|
||||
+Term::check_contents "load corefile" "21 *return 0.*$gdb_prompt .*"
|
||||
|
||||
Term::command "run"
|
||||
Term::check_contents "run until the end" \
|
||||
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
|
||||
index 222583f291f..ad5cbb72ea5 100644
|
||||
--- a/gdb/testsuite/lib/tuiterm.exp
|
||||
+++ b/gdb/testsuite/lib/tuiterm.exp
|
||||
@@ -595,6 +595,7 @@ namespace eval Term {
|
||||
} else {
|
||||
::clean_restart $executable
|
||||
}
|
||||
+ ::gdb_test_no_output "set pagination off"
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.ada/big_packed_array.exp xfail for -m32
|
||||
|
||||
With test-case gdb.ada/big_packed_array.exp and target board unix/-m32 I run
|
||||
into:
|
||||
...
|
||||
(gdb) print bad^M
|
||||
$2 = (0 => 0 <repeats 24 times>, 160)^M
|
||||
(gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad
|
||||
...
|
||||
|
||||
The problem is that while the variable is an array of 196 bits (== 24.5 bytes),
|
||||
the debug information describes it as 25 unsigned char. This is PR
|
||||
gcc/101643, and the test-case contains an xfail for this, which catches only:
|
||||
...
|
||||
(gdb) print bad^M
|
||||
$2 = (0 => 0 <repeats 25 times>)^M
|
||||
...
|
||||
|
||||
Fix this by updating the xfail pattern.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.ada/big_packed_array.exp | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
|
||||
index 32ff0dd3e1c..e62f053166b 100644
|
||||
--- a/gdb/testsuite/gdb.ada/big_packed_array.exp
|
||||
+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
|
||||
@@ -43,6 +43,7 @@ foreach_with_prefix scenario {all minimal} {
|
||||
|
||||
set re "= \\(false <repeats 196 times>\\)"
|
||||
set re_xfail "= \\(0 => 0 <repeats 25 times>\\)"
|
||||
+ set re_xfail2 "= \\(0 => 0 <repeats 24 times>, ($decimal)\\)"
|
||||
gdb_test_multiple "print bad" "" {
|
||||
-re -wrap $re {
|
||||
pass $gdb_test_name
|
||||
@@ -54,5 +55,14 @@ foreach_with_prefix scenario {all minimal} {
|
||||
}
|
||||
fail $gdb_test_name
|
||||
}
|
||||
+ -re -wrap $re_xfail2 {
|
||||
+ set last $expect_out(1,string)
|
||||
+ if { $have_xfail && [string is integer $last] \
|
||||
+ && [expr ($last & 0xf) == 0] } {
|
||||
+ # gcc/101643
|
||||
+ setup_xfail *-*-*
|
||||
+ }
|
||||
+ fail $gdb_test_name
|
||||
+ }
|
||||
}
|
||||
}
|
77
gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch
Normal file
77
gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch
Normal file
@ -0,0 +1,77 @@
|
||||
[gdb/testsuite] Fix gdb.ada/literals.exp with aarch64
|
||||
|
||||
On aarch64-linux, I run into:
|
||||
...
|
||||
(gdb) print 16#ffffffffffffffff#^M
|
||||
$7 = 18446744073709551615^M
|
||||
(gdb) FAIL: gdb.ada/literals.exp: print 16#ffffffffffffffff#
|
||||
...
|
||||
while on x86_64-linux instead, I get:
|
||||
...
|
||||
(gdb) print 16#ffffffffffffffff#^M
|
||||
$7 = -1^M
|
||||
(gdb) PASS: gdb.ada/literals.exp: print 16#ffffffffffffffff#
|
||||
...
|
||||
|
||||
We can easily reproduce this on x86_64-linux using:
|
||||
...
|
||||
$ gdb -q -batch -ex "set lang ada" -ex "set arch i386" \
|
||||
-ex "print 16#ffffffffffffffff#"
|
||||
$1 = -1
|
||||
$ gdb -q -batch -ex "set lang ada" -ex "set arch aarch64" \
|
||||
-ex "print 16#ffffffffffffffff#"
|
||||
$1 = 18446744073709551615
|
||||
...
|
||||
|
||||
With i386, we have:
|
||||
...
|
||||
(gdb) p int_bits
|
||||
$3 = 32
|
||||
(gdb) p long_bits
|
||||
$4 = 32
|
||||
(gdb) p long_long_bits
|
||||
$5 = 64
|
||||
...
|
||||
and so in processInt we hit the fits-in-unsigned-long-long case where we use
|
||||
as type long long:
|
||||
...
|
||||
/* Note: Interprets ULLONG_MAX as -1. */
|
||||
yylval.typed_val.type = type_long_long (par_state);
|
||||
...
|
||||
|
||||
With aarch64, we have instead:
|
||||
...
|
||||
(gdb) p int_bits
|
||||
$1 = 32
|
||||
(gdb) p long_bits
|
||||
$2 = 64
|
||||
(gdb) p long_long_bits
|
||||
$3 = 64
|
||||
...
|
||||
and so in processInt we hit the fits-in-unsigned-long case where we use
|
||||
as type unsigned long:
|
||||
...
|
||||
yylval.typed_val.type
|
||||
= builtin_type (par_state->gdbarch ())->builtin_unsigned_long;
|
||||
...
|
||||
|
||||
Fix this by updating the test-case to accept 18446744073709551615 as well.
|
||||
|
||||
Tested on x86_64-linux and aarch64-linux.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29416
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.ada/literals.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.ada/literals.exp b/gdb/testsuite/gdb.ada/literals.exp
|
||||
index a6ac89b540f..744a6bc573c 100644
|
||||
--- a/gdb/testsuite/gdb.ada/literals.exp
|
||||
+++ b/gdb/testsuite/gdb.ada/literals.exp
|
||||
@@ -36,4 +36,4 @@ gdb_test "print 16#f#e1" " = 240"
|
||||
gdb_test "print 16#1#e10" " = 1099511627776"
|
||||
|
||||
gdb_test "print/x 16#7fffffffffffffff#" " = 0x7fffffffffffffff"
|
||||
-gdb_test "print 16#ffffffffffffffff#" " = -1"
|
||||
+gdb_test "print 16#ffffffffffffffff#" " = (-1|18446744073709551615)"
|
@ -1,57 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.arch/i386-pkru.exp on linux
|
||||
|
||||
When running test-case gdb.arch/i386-pkru.exp on a machine with "Memory
|
||||
Protection Keys for Userspace" support, we run into:
|
||||
...
|
||||
(gdb) PASS: gdb.arch/i386-pkru.exp: probe PKRU support
|
||||
print $pkru^M
|
||||
$2 = 1431655764^M
|
||||
(gdb) FAIL: gdb.arch/i386-pkru.exp: pkru register
|
||||
...
|
||||
|
||||
The test-case expects the $pkru register to have the default value 0, matching
|
||||
the "init state" of 0 defined by the XSAVE hardware.
|
||||
|
||||
Since linux kernel version v4.9 containing commit acd547b29880 ("x86/pkeys:
|
||||
Default to a restrictive init PKRU"), the register is set to 0x55555554 by
|
||||
default (which matches the printed decimal value above).
|
||||
|
||||
Fix the FAIL by accepting this value for linux.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/i386-pkru.exp | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp
|
||||
index 5732bba6e97..2ee8ee72fa3 100644
|
||||
--- a/gdb/testsuite/gdb.arch/i386-pkru.exp
|
||||
+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp
|
||||
@@ -20,6 +20,15 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
|
||||
return
|
||||
}
|
||||
|
||||
+set default_pkru_re 0x0
|
||||
+if { [istarget *-*-linux*] } {
|
||||
+ # Starting with v4.9, the linux kernel contains commit acd547b29880
|
||||
+ # ("x86/pkeys: Default to a restrictive init PKRU"), which sets the
|
||||
+ # pkru register to 0x55555554 by default.
|
||||
+ set default_pkru_re (0x0|0x55555554)
|
||||
+}
|
||||
+
|
||||
+
|
||||
set comp_flags "-I${srcdir}/../nat/"
|
||||
|
||||
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
|
||||
@@ -51,9 +60,7 @@ if { !$supports_pkru } {
|
||||
}
|
||||
|
||||
# Test pkru register at startup
|
||||
-# set test_string "0"
|
||||
-
|
||||
-gdb_test "print \$pkru" "= 0" "pkru register"
|
||||
+gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register"
|
||||
|
||||
# Read values from pseudo registers.
|
||||
gdb_breakpoint [ gdb_get_line_number "break here 1" ]
|
@ -1,43 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.base/annota1.exp with pie
|
||||
|
||||
Since commit 359efc2d894 ("[gdb/testsuite] Make gdb.base/annota1.exp more
|
||||
robust") we see this fail with target board unix/-fPIE/-pie:
|
||||
...
|
||||
FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
|
||||
...
|
||||
|
||||
The problem is that the commit makes the number and order of matched
|
||||
annotations fixed, while between target boards unix and unix/-fPIE/-pie there
|
||||
is a difference:
|
||||
...
|
||||
\032\032post-prompt
|
||||
Starting program: outputs/gdb.base/annota1/annota1
|
||||
|
||||
+\032\032breakpoints-invalid
|
||||
+
|
||||
\032\032starting
|
||||
|
||||
\032\032frames-invalid
|
||||
...
|
||||
|
||||
Fix this by optionally matching the additional annotation.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/annota1.exp | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
|
||||
index 019c8048fd0..b9f80cbb6ed 100644
|
||||
--- a/gdb/testsuite/gdb.base/annota1.exp
|
||||
+++ b/gdb/testsuite/gdb.base/annota1.exp
|
||||
@@ -159,6 +159,8 @@ set run_re \
|
||||
"\r\n\032\032post-prompt\r\n" \
|
||||
"Starting program: $binexp \r\n" \
|
||||
$optional_re \
|
||||
+ "\(\r\n\032\032breakpoints-invalid\r\n\)?" \
|
||||
+ $optional_re \
|
||||
"\r\n\032\032starting\r\n" \
|
||||
$optional_re \
|
||||
"\r\n\032\032frames-invalid\r\n" \
|
@ -0,0 +1,88 @@
|
||||
[gdb/testsuite] Fix gdb.base/catch-syscall.exp with --with-expat=no
|
||||
|
||||
When doing a gdb build with --with-expat=no, I run into:
|
||||
...
|
||||
(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
|
||||
continue to breakpoint: before pipe call
|
||||
catch syscall pipe^M
|
||||
Unknown syscall name 'pipe'.^M
|
||||
(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
|
||||
catch syscall pipe
|
||||
catch syscall pipe2^M
|
||||
Unknown syscall name 'pipe2'.^M
|
||||
(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
|
||||
catch syscall pipe2
|
||||
continue^M
|
||||
Continuing.^M
|
||||
[Detaching after vfork from child process 18538]^M
|
||||
[Inferior 1 (process 18537) exited normally]^M
|
||||
(gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: continue
|
||||
...
|
||||
|
||||
This is a regression since recent commit 5463a15c18b ("[gdb/testsuite] Handle
|
||||
pipe2 syscall in gdb.base/catch-syscall.exp").
|
||||
|
||||
Fix this by using pipe/pipe2 syscall numbers instead.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/catch-syscall.exp | 16 ++++++++++------
|
||||
1 file changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
index 1260a64270f..d8b6898b3e0 100644
|
||||
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
@@ -705,10 +705,12 @@ proc setup_all_syscalls {} {
|
||||
# SYS_pipe doesn't exist on aarch64 kernel.
|
||||
set test "check SYS_pipe"
|
||||
set have_SYS_pipe 0
|
||||
+ set SYS_pipe -1
|
||||
gdb_test_multiple "p pipe_syscall" $test {
|
||||
- -re -wrap " = $decimal" {
|
||||
+ -re -wrap " = ($decimal)" {
|
||||
pass $test
|
||||
set have_SYS_pipe 1
|
||||
+ set SYS_pipe $expect_out(1,string)
|
||||
}
|
||||
-re -wrap "No symbol .*" {
|
||||
pass $test
|
||||
@@ -717,10 +719,12 @@ proc setup_all_syscalls {} {
|
||||
|
||||
set test "check SYS_pipe2"
|
||||
set have_SYS_pipe2 0
|
||||
+ set SYS_pipe2 -1
|
||||
gdb_test_multiple "p pipe2_syscall" $test {
|
||||
- -re -wrap " = $decimal" {
|
||||
+ -re -wrap " = ($decimal)" {
|
||||
pass $test
|
||||
set have_SYS_pipe2 1
|
||||
+ set SYS_pipe2 $expect_out(1,string)
|
||||
}
|
||||
-re -wrap "No symbol .*" {
|
||||
pass $test
|
||||
@@ -736,19 +740,19 @@ proc setup_all_syscalls {} {
|
||||
gdb_test "break $line"
|
||||
gdb_continue_to_breakpoint "before pipe call"
|
||||
if { $have_SYS_pipe } {
|
||||
- gdb_test "catch syscall pipe"
|
||||
+ gdb_test "catch syscall $SYS_pipe"
|
||||
}
|
||||
if { $have_SYS_pipe2 } {
|
||||
- gdb_test "catch syscall pipe2"
|
||||
+ gdb_test "catch syscall $SYS_pipe2"
|
||||
}
|
||||
set ok 0
|
||||
gdb_test_multiple "continue" "" {
|
||||
- -re -wrap "Catchpoint $decimal \\(call to syscall pipe\\).*" {
|
||||
+ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe|$SYS_pipe)\\).*" {
|
||||
lappend all_syscalls pipe
|
||||
pass $gdb_test_name
|
||||
set ok 1
|
||||
}
|
||||
- -re -wrap "Catchpoint $decimal \\(call to syscall pipe2\\).*" {
|
||||
+ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe2|$SYS_pipe)\\).*" {
|
||||
lappend all_syscalls pipe2
|
||||
pass $gdb_test_name
|
||||
set ok 1
|
@ -0,0 +1,65 @@
|
||||
[gdb/testsuite] Fix gdb.base/catch-syscall.exp without --enable-targets
|
||||
|
||||
When doing a gdb build without --enable-targets, I run into:
|
||||
...
|
||||
(gdb) UNSUPPORTED: gdb.base/catch-syscall.exp: multiple targets: \
|
||||
s390:31-bit vs s390:64-bit: set architecture s390:64-bit
|
||||
delete breakpoints^M
|
||||
(gdb) info breakpoints^M
|
||||
No breakpoints or watchpoints.^M
|
||||
(gdb) break -qualified main^M
|
||||
No symbol table is loaded. Use the "file" command.^M
|
||||
Make breakpoint pending on future shared library load? (y or [n]) n^M
|
||||
(gdb) FAIL: gdb.base/catch-syscall.exp: gdb_breakpoint: set breakpoint at main
|
||||
...
|
||||
|
||||
The problem is that due to recent commit e21d8399303 ("[gdb/testsuite] Remove
|
||||
target limits in gdb.base/catch-syscall.exp") "clean_restart $binfile" no
|
||||
longer is called at the end of test_catch_syscall_multi_arch.
|
||||
|
||||
Fix this by moving "clean_restart $binfile" back to
|
||||
test_catch_syscall_multi_arch.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/catch-syscall.exp | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
index fed0e7b774c..1260a64270f 100644
|
||||
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
@@ -568,7 +568,7 @@ proc test_catch_syscall_with_wrong_args_noxml {} {
|
||||
proc test_catch_syscall_multi_arch_1 {
|
||||
arch1 arch2 syscall1_name syscall2_name syscall_number
|
||||
} {
|
||||
- global decimal binfile
|
||||
+ global decimal
|
||||
|
||||
with_test_prefix "multiple targets: $arch1 vs $arch2" {
|
||||
# We are not interested in loading any binary here, and in
|
||||
@@ -605,12 +605,12 @@ proc test_catch_syscall_multi_arch_1 {
|
||||
gdb_test "catch syscall $syscall_number" \
|
||||
"Catchpoint $decimal \\(syscall .${syscall2_name}. \\\[${syscall_number}\\\]\\)" \
|
||||
"insert catch syscall on syscall $syscall_number -- $syscall2_name on $arch2"
|
||||
-
|
||||
- clean_restart $binfile
|
||||
}
|
||||
}
|
||||
|
||||
proc test_catch_syscall_multi_arch {} {
|
||||
+ global binfile
|
||||
+
|
||||
set arch1 "i386"
|
||||
set arch2 "i386:x86-64"
|
||||
set syscall1_name "exit"
|
||||
@@ -650,6 +650,8 @@ proc test_catch_syscall_multi_arch {} {
|
||||
set syscall_number 142
|
||||
test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \
|
||||
$syscall2_name $syscall_number
|
||||
+
|
||||
+ clean_restart $binfile
|
||||
}
|
||||
|
||||
proc do_syscall_tests_without_xml {} {
|
@ -1,48 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.base/dcache-flush.exp
|
||||
|
||||
When running test-case gdb.base/dcache-flush.exp on ubuntu 18.04.5, I run into:
|
||||
...
|
||||
(gdb) PASS: gdb.base/dcache-flush.exp: p var2
|
||||
info dcache^M
|
||||
Dcache 4096 lines of 64 bytes each.^M
|
||||
Contains data for Thread 0x7ffff7fc6b80 (LWP 3551)^M
|
||||
Line 0: address 0x7fffffffd4c0 [47 hits]^M
|
||||
Line 1: address 0x7fffffffd500 [31 hits]^M
|
||||
Line 2: address 0x7fffffffd5c0 [7 hits]^M
|
||||
Cache state: 3 active lines, 85 hits^M
|
||||
(gdb) FAIL: gdb.base/dcache-flush.exp: check dcache before flushing
|
||||
...
|
||||
The regexp expects "Contains data for process $decimal".
|
||||
|
||||
This is another case of thread_db_target::pid_to_str being used.
|
||||
|
||||
Fix this by updating the regexp.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/dcache-flush.exp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp
|
||||
index 4ac10b9fab1..ff59b2bb7ae 100644
|
||||
--- a/gdb/testsuite/gdb.base/dcache-flush.exp
|
||||
+++ b/gdb/testsuite/gdb.base/dcache-flush.exp
|
||||
@@ -34,7 +34,7 @@ gdb_test "p var2" " = 3"
|
||||
gdb_test "info dcache" \
|
||||
[multi_line \
|
||||
"Dcache $decimal lines of $decimal bytes each." \
|
||||
- "Contains data for process $decimal" \
|
||||
+ "Contains data for (process $decimal|Thread \[^\r\n\]*)" \
|
||||
"Line 0: address $hex \[$decimal hits\].*" \
|
||||
"Cache state: $decimal active lines, $decimal hits" ] \
|
||||
"check dcache before flushing"
|
||||
@@ -58,7 +58,7 @@ with_test_prefix "refilling" {
|
||||
gdb_test "info dcache" \
|
||||
[multi_line \
|
||||
"Dcache $decimal lines of $decimal bytes each." \
|
||||
- "Contains data for process $decimal" \
|
||||
+ "Contains data for (process $decimal|Thread \[^\r\n\]*)" \
|
||||
"Line 0: address $hex \[$decimal hits\].*" \
|
||||
"Cache state: $decimal active lines, $decimal hits" ] \
|
||||
"check dcache before refilling"
|
@ -0,0 +1,82 @@
|
||||
[gdb/testsuite] Fix gdb.dwarf2/dw2-out-of-range-end-of-seq.exp on aarch64
|
||||
|
||||
On aarch64-linux, with test-case gdb.dwarf2/dw2-out-of-range-end-of-seq.exp I
|
||||
run into:
|
||||
...
|
||||
(gdb) run ^M
|
||||
Starting program: dw2-out-of-range-end-of-seq ^M
|
||||
^M
|
||||
Program received signal SIGILL, Illegal instruction.^M
|
||||
main () at src/gdb/testsuite/gdb.dwarf2/main.c:1^M
|
||||
1 /* This testcase is part of GDB, the GNU debugger.^M
|
||||
(gdb) FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: runto: run to main
|
||||
...
|
||||
|
||||
There are two problems here:
|
||||
- the test-case contains a hardcoded "DW_LNS_advance_pc 1" which causes the
|
||||
breakpoint pointing in the middle of an insn
|
||||
- the FAIL triggers on aarch64-linux, but not on x86_64-linux, because the
|
||||
test-case uses 'main_label' as the address of the first and only valid entry
|
||||
in the line table, and:
|
||||
- on aarch64-linux, there's no prologue, so main_label and main coincide,
|
||||
while
|
||||
- on x86_64-linux, there's a prologue, so main_label is different from main.
|
||||
|
||||
Fix these problems by:
|
||||
- eliminating the use of "DW_LNS_advance_pc 1", and using
|
||||
"DW_LNE_set_address $main_end" instead, and
|
||||
- eliminating the use of main_label, using "DW_LNE_set_address $main_start"
|
||||
instead.
|
||||
|
||||
Tested on both x86_64-linux and aarch64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
|
||||
index f60f622067e..749755fc771 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
|
||||
@@ -35,10 +35,16 @@ if !$gcc_compiled {
|
||||
|
||||
standard_testfile main.c -dw.S
|
||||
|
||||
+set func_info_vars [get_func_info main]
|
||||
+
|
||||
set asm_file [standard_output_file $srcfile2]
|
||||
Dwarf::assemble $asm_file {
|
||||
declare_labels Llines
|
||||
global srcdir subdir srcfile
|
||||
+ global func_info_vars
|
||||
+ foreach var $func_info_vars {
|
||||
+ global $var
|
||||
+ }
|
||||
|
||||
cu {} {
|
||||
compile_unit {
|
||||
@@ -48,7 +54,9 @@ Dwarf::assemble $asm_file {
|
||||
} {
|
||||
subprogram {
|
||||
{external 1 flag}
|
||||
- {MACRO_AT_func {main}}
|
||||
+ {name main}
|
||||
+ {low_pc $main_start}
|
||||
+ {high_pc $main_end addr}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,11 +66,11 @@ Dwarf::assemble $asm_file {
|
||||
file_name "$srcfile" 1
|
||||
|
||||
program {
|
||||
- {DW_LNE_set_address main_label}
|
||||
+ {DW_LNE_set_address $main_start}
|
||||
{line 1}
|
||||
{DW_LNS_copy}
|
||||
|
||||
- {DW_LNS_advance_pc 1}
|
||||
+ {DW_LNE_set_address $main_end}
|
||||
{DW_LNE_end_sequence}
|
||||
|
||||
{DW_LNE_set_address 0}
|
@ -1,44 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.gdb/selftest.exp
|
||||
|
||||
With a gdb build with CFLAGS "-O2 -g -flto=auto", I run into:
|
||||
...
|
||||
#7 gdb_main (args=0x7fffffffd220) at src/gdb/main.c:1368^M
|
||||
#8 main (argc=<optimized out>, argv=<optimized out>) at src/gdb/gdb.c:32^M
|
||||
(gdb) FAIL: gdb.gdb/selftest.exp: backtrace through signal handler
|
||||
...
|
||||
which means that this regexp in proc test_with_self fails:
|
||||
...
|
||||
-re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
...
|
||||
|
||||
The problem is that gdb_main has been inlined into main, and consequently the
|
||||
backtrace uses:
|
||||
...
|
||||
#x <fn> ...
|
||||
...
|
||||
instead of
|
||||
...
|
||||
#x <address> in <fn> ...
|
||||
...
|
||||
|
||||
Fix this by updating the regexp to not require "in" before " main".
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.gdb/selftest.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
index bee3010bca1..35b06e53e90 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"
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.guile/scm-type.exp with gcc 4.8
|
||||
|
||||
With gcc 7.5.0, I get:
|
||||
...
|
||||
(gdb) guile (print (type-range (field-type (type-field (value-type \
|
||||
(value-dereference f)) "items"))))^M
|
||||
= (0 0)^M
|
||||
(gdb) PASS: gdb.guile/scm-type.exp: lang_cpp: test_range: \
|
||||
on flexible array member: $cmd
|
||||
...
|
||||
but with gcc 4.8.5, I get instead:
|
||||
...
|
||||
(gdb) guile (print (type-range (field-type (type-field (value-type \
|
||||
(value-dereference f)) "items"))))^M
|
||||
= (0 -1)^M
|
||||
(gdb) FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: \
|
||||
on flexible array member: $cmd
|
||||
...
|
||||
|
||||
There's a difference in debug info. With gcc 4.8.5, we have:
|
||||
...
|
||||
<2><224>: Abbrev Number: 15 (DW_TAG_member)
|
||||
<225> DW_AT_name : items
|
||||
<22b> DW_AT_type : <0x231>
|
||||
<1><231>: Abbrev Number: 4 (DW_TAG_array_type)
|
||||
<232> DW_AT_type : <0x105>
|
||||
<2><23a>: Abbrev Number: 16 (DW_TAG_subrange_type)
|
||||
<23b> DW_AT_type : <0x11a>
|
||||
<23f> DW_AT_upper_bound : 0xffffffffffffffff
|
||||
...
|
||||
and with gcc 7.5.0, we have instead:
|
||||
...
|
||||
<2><89f>: Abbrev Number: 12 (DW_TAG_member)
|
||||
<8a0> DW_AT_name : items
|
||||
<8a6> DW_AT_type : <0x8ac>
|
||||
<1><8ac>: Abbrev Number: 17 (DW_TAG_array_type)
|
||||
<8ad> DW_AT_type : <0x29d>
|
||||
<2><8b5>: Abbrev Number: 41 (DW_TAG_subrange_type)
|
||||
<2><8b6>: Abbrev Number: 0
|
||||
...
|
||||
|
||||
As mentioned in commit 858c8f2c1b9 "gdb/testsuite: adjust
|
||||
gdb.python/flexible-array-member.exp expected pattern":
|
||||
...
|
||||
Ideally, GDB would present a consistent and documented value for an
|
||||
array member declared with size 0, regardless of how the debug info
|
||||
looks like.
|
||||
...
|
||||
|
||||
As in gdb.python/flexible-array-member.exp, change the test to accept the two
|
||||
values.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.guile/scm-type.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp
|
||||
index ccde98ca224..e5eaab365cc 100644
|
||||
--- a/gdb/testsuite/gdb.guile/scm-type.exp
|
||||
+++ b/gdb/testsuite/gdb.guile/scm-type.exp
|
||||
@@ -267,7 +267,7 @@ proc test_range {} {
|
||||
gdb_scm_test_silent_cmd "guile (define f (history-ref 0))" \
|
||||
"get value (f) from history"
|
||||
gdb_test "guile (print (type-range (field-type (type-field (value-type (value-dereference f)) \"items\"))))" \
|
||||
- "= \\(0 0\\)"
|
||||
+ "= \\(0 (0|-1)\\)"
|
||||
gdb_test "guile (print (value-subscript (value-field (value-dereference f) \"items\") 0))" \
|
||||
"= 111"
|
||||
gdb_test "guile (print (value-subscript (value-field (value-dereference f) \"items\") 1))" \
|
@ -0,0 +1,52 @@
|
||||
[gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12
|
||||
|
||||
When running test-case gdb.opt/clobbered-registers-O2.exp with gcc-12, I run
|
||||
into:
|
||||
...
|
||||
(gdb) PASS: gdb.opt/clobbered-registers-O2.exp: backtracing
|
||||
print operand0^M
|
||||
$1 = (unsigned int *) 0x7fffffffd070^M
|
||||
(gdb) print *operand0^M
|
||||
$2 = 4195541^M
|
||||
(gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0
|
||||
...
|
||||
|
||||
The problem is that starting gcc-12, the assignments to x and y in main are
|
||||
optimized away:
|
||||
...
|
||||
int main(void)
|
||||
{
|
||||
unsigned x, y;
|
||||
|
||||
x = 13;
|
||||
y = 14;
|
||||
return (int)gen_movsd (&x, &y);
|
||||
...
|
||||
|
||||
Fix this by making x and y volatile.
|
||||
|
||||
Note that the test-case intends to check the handling of debug info for
|
||||
optimized code in function gen_movsd, so inhibiting optimization in main
|
||||
doesn't interfere with that.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29161
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.opt/clobbered-registers-O2.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
|
||||
index 7776024eb90..83cf2267d1e 100644
|
||||
--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
|
||||
+++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
|
||||
@@ -33,7 +33,7 @@ gen_movsd (unsigned * operand0, unsigned * operand1)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
- unsigned x, y;
|
||||
+ volatile unsigned x, y;
|
||||
|
||||
x = 13;
|
||||
y = 14;
|
@ -1,50 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.python/py-events.exp
|
||||
|
||||
With test-case gdb.python/py-events.exp on ubuntu 18.04.5 we run into:
|
||||
...
|
||||
(gdb) info threads^M
|
||||
Id Target Id Frame ^M
|
||||
* 1 Thread 0x7ffff7fc3740 (LWP 31467) "py-events" do_nothing () at \
|
||||
src/gdb/testsuite/gdb.python/py-events-shlib.c:19^M
|
||||
(gdb) FAIL: gdb.python/py-events.exp: get current thread
|
||||
...
|
||||
|
||||
The info thread commands uses "Thread" instead of "process" because
|
||||
libpthread is already loaded:
|
||||
...
|
||||
new objfile name: /lib/x86_64-linux-gnu/libdl.so.2^M
|
||||
[Thread debugging using libthread_db enabled]^M
|
||||
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".^M
|
||||
event type: new_objfile^M
|
||||
new objfile name: /lib/x86_64-linux-gnu/libpthread.so.0^M
|
||||
...
|
||||
and consequently thread_db_target::pid_to_str is used.
|
||||
|
||||
Fix this by parsing the "Thread" expression.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.python/py-events.exp | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
|
||||
index 753709361f5..d6dc9fd4252 100644
|
||||
--- a/gdb/testsuite/gdb.python/py-events.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-events.exp
|
||||
@@ -82,9 +82,13 @@ delete_breakpoints
|
||||
# Test inferior call events
|
||||
|
||||
gdb_test_multiple "info threads" "get current thread" {
|
||||
- -re "\[^\n\r\]*process (\[0-9\]+)\[^\n\r\]*do_nothing.*$gdb_prompt $" {
|
||||
+ -re -wrap "process ($decimal)\[^\n\r\]*do_nothing.*" {
|
||||
set process_id $expect_out(1,string)
|
||||
- pass "get current thread"
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+ -re -wrap "Thread $hex \\(LWP ($decimal)\\)\[^\n\r\]*do_nothing.*" {
|
||||
+ set process_id $expect_out(1,string)
|
||||
+ pass $gdb_test_name
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
[gdb/testsuite] Fix gdb.reverse/i387-env-reverse.exp for -pie
|
||||
|
||||
When running test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux with
|
||||
target board unix/-m32/-fPIE/-pie, we run into:
|
||||
...
|
||||
(gdb) PASS: gdb.reverse/i387-env-reverse.exp: push st0
|
||||
info register eax^M
|
||||
eax 0x56550000 1448411136^M
|
||||
(gdb) FAIL: gdb.reverse/i387-env-reverse.exp: verify eax == 0x8040000
|
||||
...
|
||||
|
||||
The problem is that the tested instruction (fstsw) only sets $ax, not $eax.
|
||||
|
||||
Fix this by verifying $ax instead of $eax.
|
||||
|
||||
Tested on x86_64-linux with target boards unix/-m32 and unix/-m32/-fPIE/-pie.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.reverse/i387-env-reverse.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
|
||||
index a0a79c22ed0..53fee0986df 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
|
||||
@@ -64,7 +64,7 @@ with_test_prefix "forward" {
|
||||
gdb_test "n" "asm.*fstsw.*" "store status word in EAX"
|
||||
gdb_test "n" "asm.*fld1.*" "push st0"
|
||||
|
||||
- gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*" "verify eax == 0x8040000"
|
||||
+ gdb_test "info register ax" "ax *0x0.*\[ \t\]+.*" "verify eax == 0x0"
|
||||
gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0"
|
||||
gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff"
|
||||
|
@ -0,0 +1,37 @@
|
||||
[gdb/testsuite] Fix gdb.reverse/test_ioctl_TCSETSW.exp with libc debuginfo
|
||||
|
||||
When running test-case gdb.reverse/test_ioctl_TCSETSW.exp with glibc debuginfo
|
||||
installed, I run into:
|
||||
...
|
||||
(gdb) PASS: gdb.reverse/test_ioctl_TCSETSW.exp: at TCSETSW call
|
||||
step^M
|
||||
__tcsetattr (fd=0, optional_actions=1, termios_p=0x7fffffffcf50) at \
|
||||
../sysdeps/unix/sysv/linux/tcsetattr.c:45^M
|
||||
45 {^M
|
||||
(gdb) FAIL: gdb.reverse/test_ioctl_TCSETSW.exp: handle TCSETSW
|
||||
...
|
||||
|
||||
The problem is that the step is expected to step over the call to tcsetattr,
|
||||
but due to glibc debuginfo being installed, we step into the call.
|
||||
|
||||
Fix this by using next instead of step.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
|
||||
index 86a62ebe5e5..4a81a618efc 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
|
||||
@@ -35,7 +35,7 @@ gdb_test "break $stop" ".*Breakpoint .*" "stop at TCSETSW"
|
||||
gdb_test "continue" ".*Breakpoint .*" "at TCSETSW call"
|
||||
|
||||
set test "handle TCSETSW"
|
||||
-gdb_test_multiple "step" $test {
|
||||
+gdb_test_multiple "next" $test {
|
||||
-re "Process record and replay target doesn't support ioctl request 0x.*$gdb_prompt $" {
|
||||
fail $test
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.server/server-kill.exp with -m32
|
||||
|
||||
When running test-case gdb.server/server-kill.exp with target board unix/-m32,
|
||||
I run into:
|
||||
...
|
||||
0xf7fd6b20 in _start () from /lib/ld-linux.so.2^M
|
||||
(gdb) Executing on target: kill -9 13082 (timeout = 300)
|
||||
builtin_spawn -ignore SIGHUP kill -9 13082^M
|
||||
bt^M
|
||||
(gdb) FAIL: gdb.server/server-kill.exp: kill_pid_of=server: test_unwind_syms: bt
|
||||
...
|
||||
|
||||
The test-case expects the backtrace command to trigger remote communication,
|
||||
which then should result in a "Remote connection closed" or similar.
|
||||
|
||||
However, no remote communication is triggered, because we hit the "Check that
|
||||
this frame is unwindable" case in get_prev_frame_always_1.
|
||||
|
||||
We don't hit this problem in the kill_pid_of=inferior case, because there we
|
||||
run to main before doing the backtrace.
|
||||
|
||||
Fix this by doing the same in the kill_pid_of=server case.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.server/server-kill.exp | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp
|
||||
index 655821cc6f9..4125e5bf92d 100644
|
||||
--- a/gdb/testsuite/gdb.server/server-kill.exp
|
||||
+++ b/gdb/testsuite/gdb.server/server-kill.exp
|
||||
@@ -69,11 +69,13 @@ proc prepare {} {
|
||||
|
||||
gdbserver_run ""
|
||||
|
||||
- if { $::kill_pid_of == "inferior" } {
|
||||
- # Continue past server_pid assignment.
|
||||
- gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"]
|
||||
- gdb_continue_to_breakpoint "after server_pid assignment"
|
||||
+ # Continue past server_pid assignment. We do this for both scenarios,
|
||||
+ # to avoid doing a backtrace from _start, which may not trigger remote
|
||||
+ # communication.
|
||||
+ gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"]
|
||||
+ gdb_continue_to_breakpoint "after server_pid assignment"
|
||||
|
||||
+ if { $::kill_pid_of == "inferior" } {
|
||||
# Get the pid of GDBServer.
|
||||
set test "p server_pid"
|
||||
set server_pid 0
|
@ -1,49 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.threads/check-libthread-db.exp with glibc 2.34
|
||||
|
||||
When running test-case gdb.threads/check-libthread-db.exp on openSUSE
|
||||
Tumbleweed (with glibc 2.34) I get:
|
||||
...
|
||||
(gdb) continue^M
|
||||
Continuing.^M
|
||||
[Thread debugging using libthread_db enabled]^M
|
||||
Using host libthread_db library "/lib64/libthread_db.so.1".^M
|
||||
Stopped due to shared library event:^M
|
||||
Inferior loaded /lib64/libm.so.6^M
|
||||
/lib64/libc.so.6^M
|
||||
(gdb) FAIL: gdb.threads/check-libthread-db.exp: user-initiated check: continue
|
||||
...
|
||||
|
||||
The check expect the inferior to load libpthread, but since glibc 2.34
|
||||
libpthread has been integrated into glibc, and consequently it's no longer
|
||||
a dependency:
|
||||
...
|
||||
$ ldd outputs/gdb.threads/check-libthread-db/check-libthread-db
|
||||
linux-vdso.so.1 (0x00007ffe4cae4000)
|
||||
libm.so.6 => /lib64/libm.so.6 (0x00007f167c77c000)
|
||||
libc.so.6 => /lib64/libc.so.6 (0x00007f167c572000)
|
||||
/lib64/ld-linux-x86-64.so.2 (0x00007f167c86e000)
|
||||
...
|
||||
|
||||
Fix this by updating the regexp to expect libpthread or libc.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.threads/check-libthread-db.exp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.exp b/gdb/testsuite/gdb.threads/check-libthread-db.exp
|
||||
index 6ecf40db6a9..423c29978c8 100644
|
||||
--- a/gdb/testsuite/gdb.threads/check-libthread-db.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/check-libthread-db.exp
|
||||
@@ -58,7 +58,9 @@ with_test_prefix "user-initiated check" {
|
||||
|
||||
# User-initiated check with NPTL possibly uninitialized.
|
||||
gdb_test "continue" \
|
||||
- ".*Stopped due to shared library event.*Inferior loaded .*libpthread.*"
|
||||
+ [multi_line \
|
||||
+ "Stopped due to shared library event:" \
|
||||
+ " Inferior loaded .*(libpthread|libc).*"]
|
||||
|
||||
gdb_test_sequence "maint check libthread-db" \
|
||||
"libpthread.so possibly not initialized" \
|
@ -0,0 +1,44 @@
|
||||
[gdb/testsuite] Fix gdb.threads/killed-outside.exp on aarch64
|
||||
|
||||
On aarch64 (and likewise on arm), I run into:
|
||||
...
|
||||
(gdb) PASS: gdb.threads/killed-outside.exp: get pid of inferior
|
||||
Executing on target: kill -9 11516 (timeout = 300)
|
||||
builtin_spawn -ignore SIGHUP kill -9 11516^M
|
||||
continue^M
|
||||
Continuing.^M
|
||||
Unable to fetch general registers: No such process.^M
|
||||
(gdb) [Thread 0xfffff7d511e0 (LWP 11518) exited]^M
|
||||
^M
|
||||
Program terminated with signal SIGKILL, Killed.^M
|
||||
The program no longer exists.^M
|
||||
FAIL: gdb.threads/killed-outside.exp: prompt after first continue (timeout)
|
||||
...
|
||||
due to a mismatch between the actual "No such process" line and the expected
|
||||
one:
|
||||
...
|
||||
set no_such_process_msg "Couldn't get registers: No such process\."
|
||||
...
|
||||
|
||||
Fix this by updating the regexp.
|
||||
|
||||
Tested on aarch64-linux, and x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.threads/killed-outside.exp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/killed-outside.exp b/gdb/testsuite/gdb.threads/killed-outside.exp
|
||||
index 3d4543e088c..7fa6b26c685 100644
|
||||
--- a/gdb/testsuite/gdb.threads/killed-outside.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/killed-outside.exp
|
||||
@@ -37,7 +37,8 @@ remote_exec target "kill -9 ${testpid}"
|
||||
# Give it some time to die.
|
||||
sleep 2
|
||||
|
||||
-set no_such_process_msg "Couldn't get registers: No such process\."
|
||||
+set regs_msg "(Couldn't get registers|Unable to fetch general registers.)"
|
||||
+set no_such_process_msg "$regs_msg: No such process\."
|
||||
set killed_msg "Program terminated with signal SIGKILL, Killed\."
|
||||
set no_longer_exists_msg "The program no longer exists\."
|
||||
set not_being_run_msg "The program is not being run\."
|
@ -1,53 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.threads/linux-dp.exp
|
||||
|
||||
On openSUSE Tumbleweed with glibc-debuginfo installed I get:
|
||||
...
|
||||
(gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print
|
||||
where^M
|
||||
#0 print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M
|
||||
#1 0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M
|
||||
#2 0x00007ffff7d56b37 in start_thread (arg=<optimized out>) \
|
||||
at pthread_create.c:435^M
|
||||
#3 0x00007ffff7ddb640 in clone3 () \
|
||||
at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81^M
|
||||
(gdb) PASS: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit
|
||||
...
|
||||
while without debuginfo installed I get instead:
|
||||
...
|
||||
(gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print
|
||||
where^M
|
||||
#0 print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M
|
||||
#1 0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M
|
||||
#2 0x00007ffff7d56b37 in start_thread () from /lib64/libc.so.6^M
|
||||
#3 0x00007ffff7ddb640 in clone3 () from /lib64/libc.so.6^M
|
||||
(gdb) FAIL: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit
|
||||
...
|
||||
|
||||
The problem is that the regexp used:
|
||||
...
|
||||
"\(from .*libpthread\|at pthread_create\|in pthread_create\)"
|
||||
...
|
||||
expects the 'from' part to match libpthread, but in glibc 2.34 libpthread has
|
||||
been merged into libc.
|
||||
|
||||
Fix this by updating the regexp.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.threads/linux-dp.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp
|
||||
index 099971dca39..b01e87fa9ea 100644
|
||||
--- a/gdb/testsuite/gdb.threads/linux-dp.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/linux-dp.exp
|
||||
@@ -226,7 +226,7 @@ gdb_continue_to_breakpoint "thread 5's print"
|
||||
# If you do have debug info, the output obviously depends more on the
|
||||
# exact library in use; under NPTL, you get:
|
||||
# #2 0x0012b7fc in start_thread (arg=0x21) at pthread_create.c:264
|
||||
-gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create\).*" \
|
||||
+gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create|from .*libc\\.\).*" \
|
||||
"first thread-specific breakpoint hit"
|
||||
|
||||
# Make sure it's catching the right thread. Try hitting the
|
@ -1,62 +0,0 @@
|
||||
[gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp
|
||||
|
||||
On OBS I ran into a failure in test-case gdb.threads/thread-specific-bp.exp:
|
||||
...
|
||||
(gdb) PASS: gdb.threads/thread-specific-bp.exp: non-stop: continue to end
|
||||
info breakpoint^M
|
||||
Num Type Disp Enb Address What^M
|
||||
1 breakpoint keep y 0x0000555555555167 in main at $src:36^M
|
||||
breakpoint already hit 1 time^M
|
||||
2 breakpoint keep y 0x0000555555555151 in start at $src:23^M
|
||||
breakpoint already hit 1 time^M
|
||||
3 breakpoint keep y 0x0000555555555167 in main at $src:36 thread 2^M
|
||||
stop only in thread 2^M
|
||||
4 breakpoint keep y 0x000055555555515c in end at $src:29^M
|
||||
breakpoint already hit 1 time^M
|
||||
(gdb) [Thread 0x7ffff7db1640 (LWP 19984) exited]^M
|
||||
Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M
|
||||
FAIL: gdb.threads/thread-specific-bp.exp: non-stop: \
|
||||
thread-specific breakpoint was deleted (timeout)
|
||||
...
|
||||
|
||||
Fix this by waiting for the "[Thread 0x7ffff7db1640 (LWP 19984) exited]"
|
||||
message before issuing the "info breakpoint command".
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.threads/thread-specific-bp.exp | 21 ++++++++++++++++++---
|
||||
1 file changed, 18 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp
|
||||
index c59a65b3150..50f90edea55 100644
|
||||
--- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp
|
||||
@@ -88,9 +88,24 @@ proc check_thread_specific_breakpoint {mode} {
|
||||
set cmd "continue"
|
||||
}
|
||||
set test "continue to end"
|
||||
- gdb_test_multiple "$cmd" $test {
|
||||
- -re "Breakpoint .* end .* at .*\r\n$gdb_prompt " {
|
||||
- pass $test
|
||||
+ set thread_exited 0
|
||||
+ set prompt 0
|
||||
+ gdb_test_multiple "$cmd" $test -lbl {
|
||||
+ -re "(^|\r\n)\\\[Thread \[^\r\n\]* exited](?=\r\n)" {
|
||||
+ if { $prompt } {
|
||||
+ pass $gdb_test_name
|
||||
+ } else {
|
||||
+ set thread_exited 1
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ }
|
||||
+ -re "\r\n$gdb_prompt " {
|
||||
+ if { $thread_exited } {
|
||||
+ pass $gdb_test_name
|
||||
+ } else {
|
||||
+ set prompt 1
|
||||
+ exp_continue
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
gdb/testsuite: fix occasional failure in gdb.mi/mi-multi-commands.exp
|
||||
|
||||
In bug PR gdb/29036, another failure was reported for the test
|
||||
gdb.mi/mi-multi-commands.exp. This test sends two commands to GDB as
|
||||
a single write, and then checks that both commands are executed.
|
||||
|
||||
The problem that was encountered here is that the output of the first
|
||||
command, which looks like this:
|
||||
|
||||
^done,value="\"FIRST COMMAND\""
|
||||
|
||||
Is actually produced in parts, first the '^done' is printed, then the
|
||||
',value="\"FIRST COMMAND\"" is printed.
|
||||
|
||||
What was happening is that some characters from the second command
|
||||
were being echoed after the '^done' had been printed, but before the
|
||||
value part had been printed. To avoid this issue I've relaxed the
|
||||
pattern that checks for the first command a little. With this fix in
|
||||
place the occasional failure in this test is no longer showing up.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29036
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.mi/mi-multi-commands.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
|
||||
index d00e0aaea8b..58187b15815 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
|
||||
@@ -100,7 +100,7 @@ proc run_test { args } {
|
||||
set seen_second_message false
|
||||
|
||||
gdb_test_multiple "" "look for first command output, command length $i" -prompt "$mi_gdb_prompt" {
|
||||
- -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"" {
|
||||
+ -re "\\^done.*,value=\"\\\\\"FIRST COMMAND\\\\\"\"" {
|
||||
set seen_first_message true
|
||||
exp_continue
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
[gdb/testsuite] Fix port detection in gdb.debuginfod/fetch_src_and_symbols.exp
|
||||
|
||||
On OBS I ran into this failure with test-case
|
||||
gdb.debuginfod/fetch_src_and_symbols.exp:
|
||||
...
|
||||
Failed to listen for connections: Address already in use^M
|
||||
[Thu Oct 21 11:48:49 2021] (559/559): started http server on IPv6 port=8000^M
|
||||
...
|
||||
FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: find port timeout
|
||||
...
|
||||
|
||||
The test-case is trying to start debuginfod on a port to see if it's
|
||||
available, and it handles either this message:
|
||||
"started http server on IPv4 IPv6 port=$port"
|
||||
meaning success, or:
|
||||
"failed to bind to port"
|
||||
meaning failure, in which case the debuginfod instance is killed, and we try
|
||||
the next port.
|
||||
|
||||
The test-case only uses the v4 address 127.0.0.1, so fix this by:
|
||||
- accepting "started http server on IPv4 port=$port"
|
||||
- rejecting "started http server on IPv6 port=$port"
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
||||
index 81d4791eb6d..bb0c0c7ff29 100644
|
||||
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
||||
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
||||
@@ -180,12 +180,17 @@ proc local_url { } {
|
||||
spawn debuginfod -vvvv -d $db -p $port -F $debugdir
|
||||
expect {
|
||||
"started http server on IPv4 IPv6 port=$port" { set found 1 }
|
||||
- "failed to bind to port" { kill_wait_spawned_process $spawn_id }
|
||||
+ "started http server on IPv4 port=$port" { set found 1 }
|
||||
+ "started http server on IPv6 port=$port" {}
|
||||
+ "failed to bind to port" {}
|
||||
timeout {
|
||||
fail "find port timeout"
|
||||
return -1
|
||||
}
|
||||
}
|
||||
+ if { ! $found } {
|
||||
+ kill_wait_spawned_process $spawn_id
|
||||
+ }
|
||||
}
|
||||
|
||||
set metrics [list "ready 1" \
|
@ -1,45 +0,0 @@
|
||||
[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp
|
||||
|
||||
On OBS I ran into:
|
||||
...
|
||||
(gdb) PASS: gdb.base/foll-vfork.exp: exit: \
|
||||
vfork relations in info inferiors: continue to child exit
|
||||
info inferiors^M
|
||||
Num Description Connection Executable ^M
|
||||
1 <null> foll-vfork-exit ^M
|
||||
* 2 <null> foll-vfork-exit ^M
|
||||
(gdb) I'm the proud parent of child #5044!^M
|
||||
FAIL: gdb.base/foll-vfork.exp: exit: vfork relations in info inferiors: \
|
||||
vfork relation no longer appears in info inferiors (timeout)
|
||||
...
|
||||
|
||||
Fix this by removing the '$' anchor in the corresponding '$gdb_prompt $'
|
||||
regexps.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/foll-vfork.exp | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
|
||||
index 577bd4d573b..a781a5c2087 100644
|
||||
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
|
||||
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
|
||||
@@ -374,13 +374,13 @@ proc vfork_relations_in_info_inferiors { variant } {
|
||||
|
||||
set test "vfork relation no longer appears in info inferiors"
|
||||
gdb_test_multiple "info inferiors" $test {
|
||||
- -re "is vfork child of inferior 1.*$gdb_prompt $" {
|
||||
+ -re "is vfork child of inferior 1.*$gdb_prompt " {
|
||||
fail $test
|
||||
}
|
||||
- -re "is vfork parent of inferior 2.*$gdb_prompt $" {
|
||||
+ -re "is vfork parent of inferior 2.*$gdb_prompt " {
|
||||
fail $test
|
||||
}
|
||||
- -re "$gdb_prompt $" {
|
||||
+ -re "$gdb_prompt " {
|
||||
pass $test
|
||||
}
|
||||
}
|
@ -1,176 +0,0 @@
|
||||
[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie
|
||||
|
||||
When running test-case gdb.base/step-indirect-call-thunk.exp with target board
|
||||
unix/-m32/-fPIE/-pie, I run into:
|
||||
...
|
||||
(gdb) stepi^M
|
||||
0x5655552e 22 { /* inc.1 */^M
|
||||
(gdb) stepi^M
|
||||
0x56555530 22 { /* inc.1 */^M
|
||||
(gdb) stepi^M
|
||||
0x565555f7 in __x86.get_pc_thunk.ax ()^M
|
||||
(gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
|
||||
...
|
||||
|
||||
In contrast, with unix/-m32 we have instead:
|
||||
...
|
||||
(gdb) stepi^M
|
||||
0x08048407 22 { /* inc.1 */^M
|
||||
(gdb) stepi^M
|
||||
23 return x + 1; /* inc.2 */^M
|
||||
(gdb) stepi^M
|
||||
0x0804840c 23 return x + 1; /* inc.2 */^M
|
||||
(gdb) stepi^M
|
||||
24 } /* inc.3 */^M
|
||||
(gdb) stepi^M
|
||||
0x08048410 24 } /* inc.3 */^M
|
||||
(gdb) stepi^M
|
||||
0x0804848f in __x86_return_thunk ()^M
|
||||
(gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
|
||||
...
|
||||
|
||||
The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a
|
||||
PIC helper function for x86_64-linux.
|
||||
|
||||
Fix this by insn-stepping through it.
|
||||
|
||||
Likewise in a few other test-cases.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/step-indirect-call-thunk.exp | 5 ++++-
|
||||
gdb/testsuite/gdb.base/step-test.exp | 4 +++-
|
||||
gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp | 6 ++++--
|
||||
gdb/testsuite/gdb.reverse/step-precsave.exp | 10 ++++++++++
|
||||
gdb/testsuite/gdb.reverse/step-reverse.exp | 10 ++++++++++
|
||||
5 files changed, 31 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
|
||||
index d84a0232265..18f5bdcbe9a 100644
|
||||
--- a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
|
||||
+++ b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
|
||||
@@ -65,9 +65,12 @@ gdb_test "step" "inc\.2.*" "step through call thunk into inc"
|
||||
gdb_test "step" "inc\.3.*" "step inside inc"
|
||||
gdb_test "step" "thrice\.4.*" "step through return thunk back into thrice"
|
||||
|
||||
+set alphanum_re "\[a-zA-Z0-9\]"
|
||||
+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)"
|
||||
+
|
||||
# We can use instruction stepping to step into thunks.
|
||||
stepi_until "thrice" "indirect_thunk" "stepi into call thunk"
|
||||
stepi_until "indirect_thunk" "inc." "stepi out of call thunk into inc"
|
||||
-stepi_until "inc" "return_thunk" "stepi into return thunk"
|
||||
+stepi_until "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk"
|
||||
stepi_until "return_thunk" "thrice" \
|
||||
"stepi out of return thunk back into thrice"
|
||||
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
|
||||
index 8664b3eda22..5f480e07edd 100644
|
||||
--- a/gdb/testsuite/gdb.base/step-test.exp
|
||||
+++ b/gdb/testsuite/gdb.base/step-test.exp
|
||||
@@ -128,8 +128,10 @@ test_i "stepi into function" "stepi" \
|
||||
# Continue to step until we reach the function's body. This makes it
|
||||
# more likely that we've actually completed the prologue, so "finish"
|
||||
# will work.
|
||||
+set alphanum_re "\[a-zA-Z0-9\]"
|
||||
+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)"
|
||||
test_i "stepi into function's first source line" "stepi" \
|
||||
- ".*${decimal}.*int callee" \
|
||||
+ "(${decimal}.*int callee|$pic_thunk_re)" \
|
||||
".*${decimal}.*myglob.*; return 0;"
|
||||
|
||||
# Have to be careful here, if the finish does not work,
|
||||
diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
|
||||
index dad43d78e6b..1f43206074f 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
|
||||
@@ -86,7 +86,9 @@ gdb_test "reverse-next" "apply\.2.*" \
|
||||
step_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk"
|
||||
step_until "stepi" "indirect_thunk" "inc" \
|
||||
"stepi out of call thunk into inc"
|
||||
-step_until "stepi" "inc" "return_thunk" "stepi into return thunk"
|
||||
+set alphanum_re "\[a-zA-Z0-9\]"
|
||||
+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)"
|
||||
+step_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk"
|
||||
step_until "stepi" "return_thunk" "apply" \
|
||||
"stepi out of return thunk back into apply"
|
||||
|
||||
@@ -94,7 +96,7 @@ step_until "reverse-stepi" "apply" "return_thunk" \
|
||||
"reverse-stepi into return thunk"
|
||||
step_until "reverse-stepi" "return_thunk" "inc" \
|
||||
"reverse-stepi out of return thunk into inc"
|
||||
-step_until "reverse-stepi" "inc" "indirect_thunk" \
|
||||
+step_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \
|
||||
"reverse-stepi into call thunk"
|
||||
step_until "reverse-stepi" "indirect_thunk" "apply" \
|
||||
"reverse-stepi out of call thunk into apply"
|
||||
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
|
||||
index 43f6ab3a11a..e85cdabfb73 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
|
||||
@@ -124,6 +124,8 @@ gdb_test_multiple "stepi" "$test_message" {
|
||||
|
||||
# stepi into a function call
|
||||
|
||||
+set alphanum_re "\[a-zA-Z0-9\]"
|
||||
+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)"
|
||||
set test_message "stepi into function call"
|
||||
gdb_test_multiple "stepi" "$test_message" {
|
||||
-re "ARRIVED IN CALLEE.*$gdb_prompt $" {
|
||||
@@ -143,6 +145,10 @@ gdb_test_multiple "stepi" "$test_message" {
|
||||
send_gdb "stepi\n"
|
||||
exp_continue
|
||||
}
|
||||
+ -re "$pic_thunk_re.*$gdb_prompt $" {
|
||||
+ send_gdb "stepi\n"
|
||||
+ exp_continue
|
||||
+ }
|
||||
}
|
||||
|
||||
# stepi thru return of a function call
|
||||
@@ -216,6 +222,10 @@ gdb_test_multiple "stepi" "$test_message" {
|
||||
send_gdb "stepi\n"
|
||||
exp_continue
|
||||
}
|
||||
+ -re "$pic_thunk_re.*$gdb_prompt $" {
|
||||
+ send_gdb "stepi\n"
|
||||
+ exp_continue
|
||||
+ }
|
||||
-re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" {
|
||||
send_gdb "stepi\n"
|
||||
exp_continue
|
||||
diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp
|
||||
index 335ccfbd399..32c18faaaa6 100644
|
||||
--- a/gdb/testsuite/gdb.reverse/step-reverse.exp
|
||||
+++ b/gdb/testsuite/gdb.reverse/step-reverse.exp
|
||||
@@ -87,6 +87,8 @@ gdb_test_multiple "stepi" "$test_message" {
|
||||
|
||||
# stepi into a function call
|
||||
|
||||
+set alphanum_re "\[a-zA-Z0-9\]"
|
||||
+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)"
|
||||
set test_message "stepi into function call"
|
||||
gdb_test_multiple "stepi" "$test_message" {
|
||||
-re "ARRIVED IN CALLEE.*$gdb_prompt $" {
|
||||
@@ -106,6 +108,10 @@ gdb_test_multiple "stepi" "$test_message" {
|
||||
send_gdb "stepi\n"
|
||||
exp_continue
|
||||
}
|
||||
+ -re "$pic_thunk_re.*$gdb_prompt $" {
|
||||
+ send_gdb "stepi\n"
|
||||
+ exp_continue
|
||||
+ }
|
||||
}
|
||||
|
||||
# stepi thru return of a function call
|
||||
@@ -179,6 +185,10 @@ gdb_test_multiple "stepi" "$test_message" {
|
||||
send_gdb "stepi\n"
|
||||
exp_continue
|
||||
}
|
||||
+ -re "$pic_thunk_re.*$gdb_prompt $" {
|
||||
+ send_gdb "stepi\n"
|
||||
+ exp_continue
|
||||
+ }
|
||||
-re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" {
|
||||
send_gdb "stepi\n"
|
||||
exp_continue
|
@ -0,0 +1,50 @@
|
||||
gdb/testsuite: fix test failure when building against readline v7
|
||||
|
||||
The test added in the commit:
|
||||
|
||||
commit a6b413d24ccc5d76179bab866834e11fd6fec294
|
||||
Date: Fri Mar 11 14:44:03 2022 +0000
|
||||
|
||||
gdb: work around prompt corruption caused by bracketed-paste-mode
|
||||
|
||||
Was not written with readline 7 in mind, only readline 8+. Between
|
||||
readline 7 and 8 the escape sequence used to disable bracketed paste
|
||||
mode changed, an additional '\r' character was added to the end. In
|
||||
fact, it was the addition of this '\r' character that triggered the
|
||||
issue for which the above commit is part of the solution.
|
||||
|
||||
Anyway, the test tries to spot the case where the output from GDB is
|
||||
not perfect, but does have the above work around applied. However,
|
||||
the pattern in the test assumes that the problematic '\r' will be
|
||||
present, and this is only true for readline 8+. With readline 7 the
|
||||
test was failing.
|
||||
|
||||
In this commit I generalise the pattern a little so that the test will
|
||||
still KFAIL with readline 7.
|
||||
|
||||
It's a little unfortunate that the test is KFAILing with readline 7,
|
||||
as without the problematic '\r' there's actually no reason that GDB
|
||||
couldn't "do the right thing" in this case, in which case, the test
|
||||
would PASS, but that would require changes within GDB itself.
|
||||
|
||||
My preference then is that initially we patch the test to get it
|
||||
KFAILing, then in a separate commit I can modify GDB so that it can
|
||||
PASS with readline 7.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/eof-exit.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
index 53a3b56dce8..c88aced9f35 100644
|
||||
--- a/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
+++ b/gdb/testsuite/gdb.base/eof-exit.exp
|
||||
@@ -56,7 +56,7 @@ proc run_test {} {
|
||||
-re "$::gdb_prompt \[^\n\]*\r\[^\n\]*quit" {
|
||||
fail "$gdb_test_name (misplaced \\r)"
|
||||
}
|
||||
- -re "$::gdb_prompt \[^\n\]*\r\[^\n\]*\r\nquit\r\n" {
|
||||
+ -re "$::gdb_prompt (?:\[^\n\]*\r)?\[^\n\]*\r\nquit\r\n" {
|
||||
# For versions of readline that don't include the
|
||||
# RL_STATE_EOF patch, then the 'quit' is printed on the
|
||||
# subsequent line.
|
@ -1,43 +1,7 @@
|
||||
[gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync.exp
|
||||
|
||||
In OBS, on aarch64-linux, with a gdb 11.1 based package, I run into:
|
||||
...
|
||||
(gdb) builtin_spawn -pty^M
|
||||
new-ui mi /dev/pts/5^M
|
||||
New UI allocated^M
|
||||
(gdb) =thread-group-added,id="i1"^M
|
||||
(gdb) ERROR: MI channel failed
|
||||
warning: Error detected on fd 11^M
|
||||
thread 1.1^M
|
||||
Unknown thread 1.1.^M
|
||||
(gdb) UNRESOLVED: gdb.mi/user-selected-context-sync.exp: mode=non-stop: \
|
||||
test_cli_inferior: reset selection to thread 1.1
|
||||
...
|
||||
with many more UNRESOLVED following.
|
||||
|
||||
The ERROR is a common problem, filed as
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=28561 .
|
||||
|
||||
But the many UNRESOLVEDs are due to not checking whether the setup as done in
|
||||
the test_setup function succeeds or not.
|
||||
|
||||
Fix this by:
|
||||
- making test_setup return an error upon failure
|
||||
- handling test_setup error at the call site
|
||||
- adding a "setup done" pass/fail to be turned into an unresolved
|
||||
in case of error during setup.
|
||||
|
||||
Tested on x86_64-linux, by manually triggering the error in
|
||||
mi_gdb_start_separate_mi_tty.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.mi/user-selected-context-sync.exp | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||||
index 2f1a4884a21..d4e72190d2a 100644
|
||||
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||||
Index: gdb-12.1/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||||
===================================================================
|
||||
--- gdb-12.1.orig/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||||
+++ gdb-12.1/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||||
@@ -393,7 +393,7 @@ proc_with_prefix test_setup { mode } {
|
||||
}
|
||||
|
||||
@ -47,16 +11,16 @@ index 2f1a4884a21..d4e72190d2a 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ proc_with_prefix test_setup { mode } {
|
||||
@@ -402,7 +402,7 @@ proc_with_prefix test_setup { mode } {
|
||||
mi_gdb_load $binfile
|
||||
|
||||
if { [mi_runto_main] < 0 } {
|
||||
fail "can't run to main"
|
||||
- return
|
||||
+ return -1
|
||||
}
|
||||
|
||||
# When using mi_expect_stop, we don't expect a prompt after the *stopped
|
||||
@@ -444,6 +444,8 @@ proc_with_prefix test_setup { mode } {
|
||||
@@ -443,6 +443,8 @@ proc_with_prefix test_setup { mode } {
|
||||
# Prepare the second inferior for the test.
|
||||
test_continue_to_start $mode 2
|
||||
}
|
||||
@ -65,7 +29,7 @@ index 2f1a4884a21..d4e72190d2a 100644
|
||||
}
|
||||
|
||||
# Reset the selection to frame #0 of thread THREAD.
|
||||
@@ -1253,7 +1255,12 @@ proc_with_prefix test_cli_in_mi_frame { mode cli_in_mi_mode } {
|
||||
@@ -1300,7 +1302,12 @@ proc_with_prefix test_cli_in_mi_frame {
|
||||
}
|
||||
|
||||
foreach_with_prefix mode { "all-stop" "non-stop" } {
|
||||
|
@ -0,0 +1,62 @@
|
||||
[gdb/testsuite] Handle older python in gdb.python/py-send-packet.py
|
||||
|
||||
With python 3.4, I run into:
|
||||
...
|
||||
Traceback (most recent call last):^M
|
||||
File "<string>", line 1, in <module>^M
|
||||
File
|
||||
"outputs/gdb.python/py-send-packet/py-send-packet.py", line 128, in \
|
||||
run_set_global_var_test^M
|
||||
res = conn.send_packet(b"X%x,4:\x02\x02\x02\x02" % addr)^M
|
||||
TypeError: Could not convert Python object: b'X%x,4:\x02\x02\x02\x02'.^M
|
||||
Error while executing Python code.^M
|
||||
...
|
||||
while with python 3.6 this works fine.
|
||||
|
||||
Fix this by avoiding the byte literal (with prefix b), and use instead:
|
||||
...
|
||||
bytes(("X%x,4:" % addr).encode('ascii') + bytearray([0x2, 0x2, 0x2, 0x2])).
|
||||
...
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.python/py-send-packet.py | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-send-packet.py b/gdb/testsuite/gdb.python/py-send-packet.py
|
||||
index 4966688a922..f58deed1019 100644
|
||||
--- a/gdb/testsuite/gdb.python/py-send-packet.py
|
||||
+++ b/gdb/testsuite/gdb.python/py-send-packet.py
|
||||
@@ -122,6 +122,15 @@ def check_global_var(expected_val):
|
||||
if val != expected_val:
|
||||
raise gdb.GdbError("global_var is 0x%x, expected 0x%x" % (val, expected_val))
|
||||
|
||||
+# Return a bytes object representing an 'X' packet with
|
||||
+# address ADDR and bytes L.
|
||||
+def bytes_xpacket (addr, l):
|
||||
+ # Implement b"X%x,4:\xff\xff\xff\xff" % addr in a way that works
|
||||
+ # across python versions.
|
||||
+ res = ("X%x,4:" % addr).encode('ascii') + bytearray(l)
|
||||
+ # Force it to type bytes.
|
||||
+ res = bytes(res)
|
||||
+ return res
|
||||
|
||||
# Set the 'X' packet to the remote target to set a global variable.
|
||||
# Checks that we can send byte values.
|
||||
@@ -133,7 +142,7 @@ def run_set_global_var_test():
|
||||
res = conn.send_packet("X%x,4:\x01\x01\x01\x01" % addr)
|
||||
assert isinstance(res, bytes)
|
||||
check_global_var(0x01010101)
|
||||
- res = conn.send_packet(b"X%x,4:\x02\x02\x02\x02" % addr)
|
||||
+ res = conn.send_packet(bytes_xpacket(addr, [0x2, 0x2, 0x2, 0x2]))
|
||||
assert isinstance(res, bytes)
|
||||
check_global_var(0x02020202)
|
||||
if sys.version_info[0] > 2:
|
||||
@@ -149,7 +158,7 @@ def run_set_global_var_test():
|
||||
assert saw_error
|
||||
check_global_var(0x02020202)
|
||||
# Now we pass a bytes object, which will work.
|
||||
- res = conn.send_packet(b"X%x,4:\xff\xff\xff\xff" % addr)
|
||||
+ res = conn.send_packet(bytes_xpacket(addr, [0xff, 0xff, 0xff, 0xff]))
|
||||
check_global_var(0xFFFFFFFF)
|
||||
else:
|
||||
# On Python 2 we need to force the creation of a Unicode
|
@ -15,7 +15,8 @@ The current glibc on Tumbleweed is 2.35, which contains commit
|
||||
"linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2
|
||||
is used instead of syscall pipe.
|
||||
|
||||
Fix this by detecting whether syscall pipe or pipe2 is used before running the tests.
|
||||
Fix this by detecting whether syscall pipe or pipe2 is used before running the
|
||||
tests.
|
||||
|
||||
Tested on x86_64-linux, specifically on:
|
||||
- openSUSE Tumbleweed (with glibc 2.35), and
|
||||
@ -26,19 +27,14 @@ On openSUSE Tumbleweed + target board unix/-m32, this exposes:
|
||||
(gdb) catch syscall pipe2^M
|
||||
Unknown syscall name 'pipe2'.^M
|
||||
...
|
||||
so make the test robust against this by using the syscall number instead,
|
||||
while still noting that the syscall name pipe2 is not recognized:
|
||||
...
|
||||
FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: catch syscall pipe2
|
||||
...
|
||||
which will be fixed in a folllow-up patch.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/catch-syscall.c | 3 +-
|
||||
gdb/testsuite/gdb.base/catch-syscall.exp | 100 ++++++++++++++++++++++++++++---
|
||||
2 files changed, 93 insertions(+), 10 deletions(-)
|
||||
gdb/testsuite/gdb.base/catch-syscall.c | 3 +-
|
||||
gdb/testsuite/gdb.base/catch-syscall.exp | 69 ++++++++++++++++++++++++++++----
|
||||
2 files changed, 64 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/catch-syscall.c b/gdb/testsuite/gdb.base/catch-syscall.c
|
||||
index 0ab96318d3e..8c252a06b20 100644
|
||||
@ -55,56 +51,14 @@ index 0ab96318d3e..8c252a06b20 100644
|
||||
#endif
|
||||
int write_syscall = SYS_write;
|
||||
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
index a5dfd02411b..cc76a2cf61d 100644
|
||||
index a5dfd02411b..1427dfece6d 100644
|
||||
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
|
||||
@@ -185,7 +185,11 @@ proc insert_catch_syscall_with_many_args { syscalls numbers } {
|
||||
set filter_str ""
|
||||
|
||||
foreach name $syscalls number $numbers {
|
||||
- set filter_str "${filter_str}'${name}' \\\[${number}\\\] "
|
||||
+ if { [string is integer $name] } {
|
||||
+ append filter_str "${name} "
|
||||
+ } else {
|
||||
+ append filter_str "'${name}' \\\[${number}\\\] "
|
||||
+ }
|
||||
}
|
||||
|
||||
set filter_str [ string trimright $filter_str " " ]
|
||||
@@ -662,42 +666,120 @@ proc fill_all_syscalls_numbers {} {
|
||||
global all_syscalls_numbers last_syscall_number unknown_syscall_number all_syscalls
|
||||
|
||||
foreach syscall $all_syscalls {
|
||||
- lappend all_syscalls_numbers [get_integer_valueof "${syscall}_syscall" -1]
|
||||
+ if { [string is integer $syscall] } {
|
||||
+ lappend all_syscalls_numbers $syscall
|
||||
+ } else {
|
||||
+ lappend all_syscalls_numbers [get_integer_valueof "${syscall}_syscall" -1]
|
||||
+ }
|
||||
}
|
||||
|
||||
set last_syscall_number [get_integer_valueof "exit_group_syscall" -1]
|
||||
@@ -669,35 +669,90 @@ proc fill_all_syscalls_numbers {} {
|
||||
set unknown_syscall_number [get_integer_valueof "unknown_syscall" -1]
|
||||
}
|
||||
|
||||
-# Set up the vector all_syscalls.
|
||||
+# Catch syscall with NAME, or if gdb doesn't support that (yet), try NR
|
||||
+# instead.
|
||||
+
|
||||
+proc catch_syscall_name_or_nr { name nr } {
|
||||
+ global decimal
|
||||
+
|
||||
+ gdb_test_multiple "catch syscall $name" "" {
|
||||
+ -re -wrap "Catchpoint $decimal \\(syscall '$name' \\\[$nr\\\]\\)" {
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+ -re -wrap "Unknown syscall name '$name'\." {
|
||||
+ fail $gdb_test_name
|
||||
+ gdb_test "catch syscall $nr" "Catchpoint $decimal \\(syscall $nr\\)"
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Set up the vector all_syscalls. Returns 1 upon success, 0 upon failure.
|
||||
|
||||
proc setup_all_syscalls {} {
|
||||
@ -125,24 +79,10 @@ index a5dfd02411b..cc76a2cf61d 100644
|
||||
+ set have_SYS_pipe 0
|
||||
gdb_test_multiple "p pipe_syscall" $test {
|
||||
- -re " = .*$gdb_prompt $" {
|
||||
+ -re -wrap " = ($decimal)" {
|
||||
+ pass $test
|
||||
+ set have_SYS_pipe 1
|
||||
+ set SYS_pipe $expect_out(1,string)
|
||||
+ }
|
||||
+ -re -wrap "No symbol .*" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "check SYS_pipe2"
|
||||
+ set have_SYS_pipe2 0
|
||||
+ gdb_test_multiple "p pipe2_syscall" $test {
|
||||
+ -re -wrap " = ($decimal)" {
|
||||
+ -re -wrap " = $decimal" {
|
||||
pass $test
|
||||
- lappend all_syscalls "pipe"
|
||||
+ set have_SYS_pipe2 1
|
||||
+ set SYS_pipe2 $expect_out(1,string)
|
||||
+ set have_SYS_pipe 1
|
||||
}
|
||||
- -re "No symbol .*$gdb_prompt $" {
|
||||
+ -re -wrap "No symbol .*" {
|
||||
@ -152,6 +92,18 @@ index a5dfd02411b..cc76a2cf61d 100644
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "check SYS_pipe2"
|
||||
+ set have_SYS_pipe2 0
|
||||
+ gdb_test_multiple "p pipe2_syscall" $test {
|
||||
+ -re -wrap " = $decimal" {
|
||||
+ pass $test
|
||||
+ set have_SYS_pipe2 1
|
||||
+ }
|
||||
+ -re -wrap "No symbol .*" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if { $have_SYS_pipe == 0 && $have_SYS_pipe2 == 0 } {
|
||||
+ return 0
|
||||
+ }
|
||||
@ -161,20 +113,20 @@ index a5dfd02411b..cc76a2cf61d 100644
|
||||
+ gdb_test "break $line"
|
||||
+ gdb_continue_to_breakpoint "before pipe call"
|
||||
+ if { $have_SYS_pipe } {
|
||||
+ catch_syscall_name_or_nr pipe $SYS_pipe
|
||||
+ gdb_test "catch syscall pipe"
|
||||
+ }
|
||||
+ if { $have_SYS_pipe2 } {
|
||||
+ catch_syscall_name_or_nr pipe2 $SYS_pipe2
|
||||
+ gdb_test "catch syscall pipe2"
|
||||
+ }
|
||||
+ set ok 0
|
||||
+ gdb_test_multiple "continue" "" {
|
||||
+ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe|$SYS_pipe)\\).*" {
|
||||
+ lappend all_syscalls $expect_out(1,string)
|
||||
+ -re -wrap "Catchpoint $decimal \\(call to syscall pipe\\).*" {
|
||||
+ lappend all_syscalls pipe
|
||||
+ pass $gdb_test_name
|
||||
+ set ok 1
|
||||
+ }
|
||||
+ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe2|$SYS_pipe2)\\).*" {
|
||||
+ lappend all_syscalls $expect_out(1,string)
|
||||
+ -re -wrap "Catchpoint $decimal \\(call to syscall pipe2\\).*" {
|
||||
+ lappend all_syscalls pipe2
|
||||
+ pass $gdb_test_name
|
||||
+ set ok 1
|
||||
+ }
|
||||
|
36
gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch
Normal file
36
gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch
Normal file
@ -0,0 +1,36 @@
|
||||
[gdb/testsuite] Handle quotes in gdb_py_module_available
|
||||
|
||||
On openSUSE Leap 42.3 with python 3.4, I run into:
|
||||
...
|
||||
(gdb) python import pygments^M
|
||||
Traceback (most recent call last):^M
|
||||
File "<string>", line 1, in <module>^M
|
||||
ImportError: No module named 'pygments'^M
|
||||
Error while executing Python code.^M
|
||||
(gdb) FAIL: gdb.base/style.exp: python import pygments
|
||||
ERROR: unexpected output from python import
|
||||
...
|
||||
because gdb_py_module_available doesn't handle the single quotes around the
|
||||
module name in the ImportError.
|
||||
|
||||
Fix this by allowing the single quotes.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/lib/gdb-python.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp
|
||||
index d5039bbd099..c7a3907dd2b 100644
|
||||
--- a/gdb/testsuite/lib/gdb-python.exp
|
||||
+++ b/gdb/testsuite/lib/gdb-python.exp
|
||||
@@ -61,7 +61,7 @@ proc gdb_py_module_available { name } {
|
||||
-re -wrap "ModuleNotFoundError: No module named '${name}'.*" {
|
||||
set available false
|
||||
}
|
||||
- -re -wrap "ImportError: No module named ${name}.*" {
|
||||
+ -re -wrap "ImportError: No module named '?${name}.*'?" {
|
||||
set available false
|
||||
}
|
||||
-re -wrap "python import ${name}" {
|
@ -1,68 +0,0 @@
|
||||
[gdb/testsuite] Handle recursive internal problem in gdb_internal_error_resync
|
||||
|
||||
I came across this problem when testing gdb.base/gdb-sigterm.exp
|
||||
on a machine with a pre-release version of glib-2.34 installed:
|
||||
|
||||
A problem internal to GDB has been detected,
|
||||
further debugging may prove unreliable.
|
||||
Quit this debugging session? (y or n) Recursive internal problem.
|
||||
FAIL: gdb.base/gdb-sigterm.exp: expect eof #0 (GDB internal error)
|
||||
Resyncing due to internal error.
|
||||
ERROR: : spawn id exp11 not open
|
||||
while executing
|
||||
"expect {
|
||||
-i exp11 -timeout 10
|
||||
-re "Quit this debugging session\\? \\(y or n\\) $" {
|
||||
send_gdb "n\n" answer
|
||||
incr count
|
||||
}
|
||||
-re "Create..."
|
||||
("uplevel" body line 1)
|
||||
invoked from within
|
||||
"uplevel $body" NONE : spawn id exp11 not open
|
||||
ERROR: Could not resync from internal error (timeout)
|
||||
gdb.base/gdb-sigterm.exp: expect eof #0: stepped 9 times
|
||||
UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes
|
||||
|
||||
I don't have a problem with the latter ERROR nor the UNRESOLVED
|
||||
messages. However the first ERROR regarding the exp11 spawn id
|
||||
not being open is not especially useful.
|
||||
|
||||
This commit handles the "Recursive internal problem" case, avoiding
|
||||
the problematic ERROR shown above.
|
||||
|
||||
With this commit in place, the log messages look like this instead:
|
||||
|
||||
A problem internal to GDB has been detected,
|
||||
further debugging may prove unreliable.
|
||||
Quit this debugging session? (y or n) Recursive internal problem.
|
||||
FAIL: gdb.base/gdb-sigterm.exp: expect eof #15 (GDB internal error)
|
||||
Resyncing due to internal error.
|
||||
ERROR: Could not resync from internal error (recursive internal problem)
|
||||
gdb.base/gdb-sigterm.exp: expect eof #15: stepped 12 times
|
||||
UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* lib/gdb.exp (gdb_internal_error_resync): Handle "Recursive
|
||||
internal problem".
|
||||
|
||||
---
|
||||
gdb/testsuite/lib/gdb.exp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
index dbf4016aca1..7a8332dd573 100644
|
||||
--- a/gdb/testsuite/lib/gdb.exp
|
||||
+++ b/gdb/testsuite/lib/gdb.exp
|
||||
@@ -756,6 +756,10 @@ proc gdb_internal_error_resync {} {
|
||||
set count 0
|
||||
while {$count < 10} {
|
||||
gdb_expect {
|
||||
+ -re "Recursive internal problem\\." {
|
||||
+ perror "Could not resync from internal error (recursive internal problem)"
|
||||
+ return 0
|
||||
+ }
|
||||
-re "Quit this debugging session\\? \\(y or n\\) $" {
|
||||
send_gdb "n\n" answer
|
||||
incr count
|
@ -1,164 +0,0 @@
|
||||
[gdb/testsuite] Handle runto fail in gdb.mi/mi-var-cp.exp
|
||||
|
||||
On OBS I ran into:
|
||||
...
|
||||
PASS: gdb.mi/mi-var-cp.exp: run to mi-var-cp.cc:81 (set breakpoint)
|
||||
UNRESOLVED: gdb.mi/mi-var-cp.exp: unable to start target
|
||||
...
|
||||
followed by 81 FAILs and two more UNRESOLVEDs.
|
||||
|
||||
I didn't manage to reproduce this, but I did notice that the initial
|
||||
problem causing the UNRESOLVED caused all subsequent UNRESOLVEDs and FAILs.
|
||||
|
||||
I emulated the problem by commenting out the send_gdb "run\n" in
|
||||
mi_run_cmd_full.
|
||||
|
||||
Fix this by:
|
||||
- handling mi_run_cmd failure in mi_get_inline_test
|
||||
- handling mi_run_inline_test failure in gdb.mi/mi-var-cp.exp, and
|
||||
other test-cases using mi_get_inline_test
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.mi/mi-var-child.exp | 4 +++-
|
||||
gdb/testsuite/gdb.mi/mi-var-cmd.exp | 18 ++++++++++++++----
|
||||
gdb/testsuite/gdb.mi/mi-var-cp.exp | 18 +++++++++++++-----
|
||||
gdb/testsuite/gdb.mi/mi-var-rtti.exp | 22 +++++++++++++++-------
|
||||
gdb/testsuite/lib/mi-support.exp | 6 +++++-
|
||||
5 files changed, 50 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp
|
||||
index 8632fe26cf8..63cea065c3f 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-var-child.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-var-child.exp
|
||||
@@ -1205,7 +1205,9 @@ mi_varobj_update * {psnp->ptrs.0.next.next.long_ptr} \
|
||||
|
||||
mi_prepare_inline_tests $srcfile
|
||||
|
||||
-mi_run_inline_test child_deletion
|
||||
+if { [mi_run_inline_test child_deletion] < 0 } {
|
||||
+ return -1
|
||||
+}
|
||||
|
||||
|
||||
mi_gdb_exit
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
|
||||
index fe0826d480d..fbf57aa25ac 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
|
||||
@@ -587,14 +587,24 @@ proc set_frozen {varobjs flag} {
|
||||
}
|
||||
|
||||
mi_prepare_inline_tests $srcfile
|
||||
-mi_run_inline_test frozen
|
||||
|
||||
-mi_run_inline_test bitfield
|
||||
+set inline_tests {
|
||||
+ frozen
|
||||
+ bitfield
|
||||
+}
|
||||
+
|
||||
+# Needs to be last, following tests rely on this.
|
||||
+lappend inline_tests floating
|
||||
+
|
||||
+foreach inline_test $inline_tests {
|
||||
+ if { [mi_run_inline_test $inline_test] < 0 } {
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
|
||||
# Since the inline test framework does not really work with
|
||||
-# function calls, first to inline tests and then do the reminder
|
||||
+# function calls, first to inline tests and then do the remainder
|
||||
# manually.
|
||||
-mi_run_inline_test floating
|
||||
set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"]
|
||||
mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \
|
||||
"inside breakpoint inside callee"
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp
|
||||
index 4e8abe8d961..8fdd0f863a7 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-var-cp.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp
|
||||
@@ -38,11 +38,19 @@ mi_gdb_load ${binfile}
|
||||
|
||||
mi_prepare_inline_tests $srcfile
|
||||
|
||||
-mi_run_inline_test reference_update
|
||||
-mi_run_inline_test base_in_reference
|
||||
-mi_run_inline_test reference_to_pointer
|
||||
-mi_run_inline_test reference_to_struct
|
||||
-mi_run_inline_test path_expression
|
||||
+set inline_tests {
|
||||
+ reference_update
|
||||
+ base_in_reference
|
||||
+ reference_to_pointer
|
||||
+ reference_to_struct
|
||||
+ path_expression
|
||||
+}
|
||||
+
|
||||
+foreach inline_test $inline_tests {
|
||||
+ if { [mi_run_inline_test $inline_test] < 0 } {
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
|
||||
set lineno [gdb_get_line_number "/* anonymous_structs_and_unions */"]
|
||||
mi_create_breakpoint "$srcfile:$lineno" \
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp
|
||||
index b574e5c4edb..a0a2e132aaf 100644
|
||||
--- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp
|
||||
@@ -109,13 +109,21 @@ proc check_new_derived_with_rtti {var_name var_type testname} {
|
||||
"delete varobj for ${var_name} (with RTTI) in $testname"
|
||||
}
|
||||
|
||||
-mi_run_inline_test use_rtti_for_ptr
|
||||
-mi_run_inline_test use_rtti_for_ref
|
||||
-mi_run_inline_test use_rtti_for_ptr_child
|
||||
-mi_run_inline_test use_rtti_for_ref_child
|
||||
-mi_run_inline_test use_rtti_with_multiple_inheritence
|
||||
-mi_run_inline_test type_update_when_use_rtti
|
||||
-mi_run_inline_test skip_type_update_when_not_use_rtti
|
||||
+set inline_tests {
|
||||
+ use_rtti_for_ptr
|
||||
+ use_rtti_for_ref
|
||||
+ use_rtti_for_ptr_child
|
||||
+ use_rtti_for_ref_child
|
||||
+ use_rtti_with_multiple_inheritence
|
||||
+ type_update_when_use_rtti
|
||||
+ skip_type_update_when_not_use_rtti
|
||||
+}
|
||||
+
|
||||
+foreach inline_test $inline_tests {
|
||||
+ if { [mi_run_inline_test $inline_test] < 0 } {
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
|
||||
mi_gdb_exit
|
||||
return 0
|
||||
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
|
||||
index 288c651d4d4..28e23b11005 100644
|
||||
--- a/gdb/testsuite/lib/mi-support.exp
|
||||
+++ b/gdb/testsuite/lib/mi-support.exp
|
||||
@@ -1945,7 +1945,9 @@ proc mi_run_inline_test { testcase } {
|
||||
if {$first==1} {
|
||||
# Start the program afresh.
|
||||
mi_tbreak "$mi_autotest_source:$line"
|
||||
- mi_run_cmd
|
||||
+ if { [mi_run_cmd] < 0 } {
|
||||
+ return -1
|
||||
+ }
|
||||
set line_now [mi_get_stop_line "$testcase: step to $line"]
|
||||
set first 0
|
||||
} elseif {$line_now!=$line} {
|
||||
@@ -1972,6 +1974,8 @@ proc mi_run_inline_test { testcase } {
|
||||
# will need more experience to be sure.
|
||||
eval $statements
|
||||
}
|
||||
+
|
||||
+ return 0
|
||||
}
|
||||
|
||||
proc get_mi_thread_list {name} {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user