- Fedora patch fixups update: * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch - Fedora patch fixups added: * fixup-gdb-test-ivy-bridge.patch - Add xz to BuildRequires for testsuite flavour. - Add note on mpfr-devel for SLE-11. - Backport from master: * gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch - Patch to be upstreamed: * gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch - Patch updated: * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch - Patch updated: * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch - Patch to be upstreamed: * gdb-testsuite-gdb-base-morestack-exp-no-clang.patch * gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch * gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch * gdb-tui-enable-work-around-libncurses-segfault.patch - Backport from master dropped: * gdb-testsuite-fix-unbalanced-braces-in-gdb-tui-new-layout-exp.patch - Fedora patch fixups updated: * fixup-2-gdb-archer-vla-tests.patch - Fedora patch fixups added: * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch - Testsuite patch: * gdb-testsuite-disable-selftests-for-factory.patch - Backport from master: * gdb-symtab-read-cu-base-address-for-enqueued-cu.patch * gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch * gdb-fix-section-matching-in-find_pc_sect_compunit.patch * gdb-symtab-fix-language-of-frame-without-debug-info.patch - Patch to be upstreamed: * gdb-symtab-set-default-dwarf-max-cache-age-1000.patch - BuildRequire curl for debuginfod test-case. - Patch to be upstreamed: * gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch * gdb-fix-assert-in-process-event-stop-test.patch * gdb-fix-filename-in-not-in-executable-format-error.patch * gdb-handle-no-upper-bound-in-value-subscript.patch * gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch - Testsuite patch: * gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch - Fedora patch fixups added: * fixup-gdb-rhbz1156192-recursive-dlopen-test.patch - Fedora patch fixups updated: * fixup-gdb-btrobust.patch * fixup-2-gdb-archer-vla-tests.patch - Add missing patch command for: * gdb-fortran-fix-print-dynamic-array.patch - Fix patch application on SLE-11: * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch - Disable xz-devel and binutils-gold for SLE-10. - More enabling of gdbserver for riscv64. - Backport from master: * gdb-testsuite-fix-unbalanced-braces-in-gdb-tui-new-layout-exp.patch * gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch * gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch - Patch to be upstreamed: * gdb-fortran-fix-print-dynamic-array.patch - Enable gdbserver for riscv64. - Restrict BuildRequires libdebuginfod to Factory and supporting archs. - Rebase to 10.1 release (as in fedora 33 @ 6c8ccd6). * Debuginfod support. * Multi-target debugging support. * Multithreaded symbol loading enabled by default. * New command set exec-file-mismatch. * New command tui new-layout. * Alias command can now specify default args for an alias. - Update libipt to v2.0.2. - Fedora-specific patches dropped: * gdb-6.8-bz466901-backtrace-full-prelinked.patch - Broken/obsolete fedora patches dropped: * gdb-bz533176-fortran-omp-step.patch * gdb-6.5-BEA-testsuite.patch * gdb-6.7-charsign-test.patch - Obsoleted fedora patches dropped: * gdb-6.3-attach-see-vdso-test.patch * gdb-6.3-inferior-notification-20050721.patch * gdb-6.5-gcore-buffer-limit-test.patch * gdb-6.5-missed-trap-on-step-test.patch * gdb-rhbz1818011-bfd-gcc10-error.patch - Fedora patches updated: * gdb-6.3-gstack-20050411.patch * gdb-6.3-test-self-20050110.patch * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch * gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch * gdb-6.6-buildid-locate-core-as-arg.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-6.7-testsuite-stable-results.patch * gdb-6.8-quit-never-aborts.patch * gdb-archer-pie-addons-keep-disabled.patch * gdb-archer-pie-addons.patch * gdb-archer-vla-tests.patch * gdb-attach-fail-reasons-5of5.patch * gdb-bz1219747-attach-kills.patch * gdb-bz533176-fortran-omp-step.patch * gdb-container-rh-pkg.patch * gdb-fedora-libncursesw.patch * gdb-gnat-dwarf-crash-3of3.patch * gdb-jit-reader-multilib.patch * gdb-linux_perf-bundle.patch * gdb-moribund-utrace-workaround.patch * gdb-runtest-pie-override.patch * gdb-vla-intel-fix-print-char-array.patch * gdb-vla-intel-fortran-strides.patch * gdb-vla-intel-fortran-vla-strings.patch * gdb-vla-intel-stringbt-fix.patch * gdb-vla-intel-tests.patch - Fedora patches added: * gdb-config.patch - Obsoleted patched dropped: * gdb-testsuite-avoid-pagination-in-attach-32.exp.patch * gdb-fix-toplevel-types-with-fdebug-types-section.patch * gdb-fix-range-loop-index-in-find_method.patch * gdb-fix-python3.9-related-runtime-problems.patch * gdb-fix-unused-function-error.patch * gdb-fix-the-thread-pool.c-compilation.patch * gdb-aarch64-fix-erroneous-use-of-spu-architecture-bfd.patch * gdb-fix-debug-agent-odr-bool-int.patch * gdbserver-fix-build-with-make-3.81.patch * gdb-threads-fix-hang-in-stop_all_threads-after-killing-inferior.patch - Fedora patch fixups added: * fixup-gdb-6.3-test-pie-20050107.patch * fixup-gdb-6.5-sharedlibrary-path.patch * fixup-gdb-6.6-buildid-locate.patch * fixup-gdb-6.8-bz442765-threaded-exec-test.patch * fixup-gdb-archer-vla-tests.patch * fixup-gdb-base-gnu-ifunc-strstr-workaround-exp.patch * fixup-gdb-btrobust.patch * fixup-gdb-bz634108-solib_address.patch * fixup-gdb-dts-rhel6-python-compat.patch * fixup-gdb-gnat-dwarf-crash-3of3.patch * fixup-gdb-vla-intel-fortran-vla-strings.patch * fixup-gdb-vla-intel-tests.patch * fixup-gdb-6.3-threaded-watchpoints2-20050225.patch - Patches renamed: * gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch to fixup-2-gdb-archer-vla-tests.patch - Patches updated: * gdb-testsuite-ada-pie.patch - Backport from master: * gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch OBS-URL: https://build.opensuse.org/request/show/851545 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=263
197 lines
6.7 KiB
Diff
197 lines
6.7 KiB
Diff
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
Subject: gdb-6.6-buildid-locate-core-as-arg.patch
|
|
|
|
;;=push+jan
|
|
|
|
http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html
|
|
|
|
[ Fixed up since the mail. ]
|
|
|
|
On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote:
|
|
> Not an exhaustive list, but if we go down the path of converting "gdb
|
|
> corefile" to "gdb -c corefile", then we also need to think about "file
|
|
> corefile" being converted to "core corefile" [or "target core
|
|
> corefile", "core" is apparently deprecated in favor of "target core"]
|
|
> and "target exec corefile" -> "target core corefile". Presumably
|
|
> "file corefile" (and "target exec corefile") would discard the
|
|
> currently selected executable. But maybe not. Will that be confusing
|
|
> for users? I don't know.
|
|
|
|
While thinking about it overriding some GDB _commands_ was not my intention.
|
|
|
|
There is a general assumption if I have a shell COMMAND and some FILE I can do
|
|
$ COMMAND FILE
|
|
and COMMAND will appropriately load the FILE.
|
|
|
|
FSF GDB currently needs to specify also the executable file for core files
|
|
which already inhibits this intuitive expectation. OTOH with the build-id
|
|
locating patch which could allow such intuitive start notneeding the
|
|
executable file. Still it currently did not work due to the required "-c":
|
|
$ COMMAND -c COREFILE
|
|
|
|
Entering "file", "core-file" or "attach" commands is already explicit enough
|
|
so that it IMO should do what the command name says without any
|
|
autodetections. The second command line argument
|
|
(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
|
|
neither "attach" accepts a core file nor "core-file" accepts a PID.
|
|
|
|
The patch makes sense only with the build-id patchset so this is not submit
|
|
for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending
|
|
bfd_check_format_matches) as the patch below is its natural extension.
|
|
|
|
Sorry for the delay,
|
|
Jan
|
|
|
|
2010-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
* exceptions.h (enum errors <IS_CORE_ERROR>): New.
|
|
* exec.c: Include exceptions.h.
|
|
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
|
|
* main.c (exec_or_core_file_attach): New.
|
|
(captured_main <optind < argc>): Set also corearg.
|
|
(captured_main <strcmp (execarg, symarg) == 0>): New variable func.
|
|
Call exec_or_core_file_attach if COREARG matches EXECARG. Call
|
|
symbol_file_add_main only if CORE_BFD remained NULL.
|
|
|
|
Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
|
|
2010-01-20 Doug Evans <dje@google.com>
|
|
|
|
* exec.c (exec_file_attach): Print a more useful error message if the
|
|
user did "gdb core".
|
|
|
|
diff --git a/gdb/exec.c b/gdb/exec.c
|
|
--- a/gdb/exec.c
|
|
+++ b/gdb/exec.c
|
|
@@ -18,6 +18,8 @@
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include "defs.h"
|
|
+#include "arch-utils.h"
|
|
+#include "exceptions.h"
|
|
#include "frame.h"
|
|
#include "inferior.h"
|
|
#include "target.h"
|
|
@@ -495,12 +497,27 @@ exec_file_attach (const char *filename, int from_tty)
|
|
|
|
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
|
|
{
|
|
+ int is_core;
|
|
+
|
|
+ /* If the user accidentally did "gdb core", print a useful
|
|
+ error message. Check it only after bfd_object has been checked as
|
|
+ a valid executable may get recognized for example also as
|
|
+ "trad-core". */
|
|
+ is_core = bfd_check_format (exec_bfd, bfd_core);
|
|
+
|
|
/* Make sure to close exec_bfd, or else "run" might try to use
|
|
it. */
|
|
exec_close ();
|
|
- error (_("\"%ps\": not in executable format: %s"),
|
|
- styled_string (file_name_style.style (), scratch_pathname),
|
|
- gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
|
|
+
|
|
+ if (is_core != 0)
|
|
+ throw_error (IS_CORE_ERROR,
|
|
+ _("\"%s\" is a core file.\n"
|
|
+ "Please specify an executable to debug."),
|
|
+ scratch_pathname);
|
|
+ else
|
|
+ error (_("\"%ps\": not in executable format: %s"),
|
|
+ styled_string (file_name_style.style (), scratch_pathname),
|
|
+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
|
|
}
|
|
|
|
if (build_section_table (exec_bfd, §ions, §ions_end))
|
|
diff --git a/gdb/main.c b/gdb/main.c
|
|
--- a/gdb/main.c
|
|
+++ b/gdb/main.c
|
|
@@ -524,6 +524,34 @@ struct cmdarg
|
|
char *string;
|
|
};
|
|
|
|
+/* Call exec_file_attach. If it detected FILENAME is a core file call
|
|
+ core_file_command. Print the original exec_file_attach error only if
|
|
+ core_file_command failed to find a matching executable. */
|
|
+
|
|
+static void
|
|
+exec_or_core_file_attach (const char *filename, int from_tty)
|
|
+{
|
|
+ gdb_assert (exec_bfd == NULL);
|
|
+
|
|
+ try
|
|
+ {
|
|
+ exec_file_attach (filename, from_tty);
|
|
+ }
|
|
+ catch (gdb_exception_error &e)
|
|
+ {
|
|
+ if (e.error == IS_CORE_ERROR)
|
|
+ {
|
|
+ core_file_command ((char *) filename, from_tty);
|
|
+
|
|
+ /* Iff the core file found its executable suppress the error message
|
|
+ from exec_file_attach. */
|
|
+ if (exec_bfd != NULL)
|
|
+ return;
|
|
+ }
|
|
+ throw_exception (std::move (e));
|
|
+ }
|
|
+}
|
|
+
|
|
static void
|
|
captured_main_1 (struct captured_main_args *context)
|
|
{
|
|
@@ -959,6 +987,8 @@ captured_main_1 (struct captured_main_args *context)
|
|
{
|
|
symarg = argv[optind];
|
|
execarg = argv[optind];
|
|
+ if (optind + 1 == argc && corearg == NULL)
|
|
+ corearg = argv[optind];
|
|
optind++;
|
|
}
|
|
|
|
@@ -1114,12 +1144,25 @@ captured_main_1 (struct captured_main_args *context)
|
|
&& symarg != NULL
|
|
&& strcmp (execarg, symarg) == 0)
|
|
{
|
|
+ catch_command_errors_const_ftype *func;
|
|
+
|
|
+ /* Call exec_or_core_file_attach only if the file was specified as
|
|
+ a command line argument (and not an a command line option). */
|
|
+ if (corearg != NULL && strcmp (corearg, execarg) == 0)
|
|
+ {
|
|
+ func = exec_or_core_file_attach;
|
|
+ corearg = NULL;
|
|
+ }
|
|
+ else
|
|
+ func = exec_file_attach;
|
|
+
|
|
/* The exec file and the symbol-file are the same. If we can't
|
|
open it, better only print one error message.
|
|
- catch_command_errors returns non-zero on success! */
|
|
- ret = catch_command_errors (exec_file_attach, execarg,
|
|
- !batch_flag);
|
|
- if (ret != 0)
|
|
+ catch_command_errors returns non-zero on success!
|
|
+ Do not load EXECARG as a symbol file if it has been already processed
|
|
+ as a core file. */
|
|
+ ret = catch_command_errors (func, execarg, !batch_flag);
|
|
+ if (ret != 0 && core_bfd == NULL)
|
|
ret = catch_command_errors (symbol_file_add_main_adapter,
|
|
symarg, !batch_flag);
|
|
}
|
|
diff --git a/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
|
|
--- a/gdbsupport/common-exceptions.h
|
|
+++ b/gdbsupport/common-exceptions.h
|
|
@@ -106,6 +106,9 @@ enum errors {
|
|
"_ERROR" is appended to the name. */
|
|
MAX_COMPLETIONS_REACHED_ERROR,
|
|
|
|
+ /* Attempt to load a core file as executable. */
|
|
+ IS_CORE_ERROR,
|
|
+
|
|
/* Add more errors here. */
|
|
NR_ERRORS
|
|
};
|