summaryrefslogtreecommitdiff
path: root/gdb/build-id.h
Commit message (Collapse)AuthorAgeFilesLines
* gdb: defer warnings when loading separate debug filesAlexandra Hájková2023-02-011-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when GDB loads debug information from a separate debug file, there are a couple of warnings that could be produced if things go wrong. In find_separate_debug_file_by_buildid (build-id.c) GDB can give a warning if the separate debug file doesn't include any actual debug information, and in separate_debug_file_exists (symfile.c) we can warn if the CRC checksum in the separate debug file doesn't match the checksum in the original executable. The problem here is that, when looking up debug information, GDB will try several different approaches, lookup by build-id, lookup by debug-link, and then a lookup from debuginfod. GDB can potentially give a warning from an earlier attempt, and then succeed with a later attempt. In the cases I have run into this is primarily a warning about some out of date debug information on my machine, but then GDB finds the correct information using debuginfod. This can be confusing to a user, they will see warnings from GDB when really everything is working just fine. For example: warning: the debug information found in "/usr/lib/debug//lib64/ld-2.32.so.debug" \ does not match "/lib64/ld-linux-x86-64.so.2" (CRC mismatch). This diagnostic was printed on Fedora 33 even when the correct debuginfo was downloaded. In this patch I propose that we defer any warnings related to looking up debug information from a separate debug file. If any of the approaches are successful then GDB will not print any of the warnings. As far as the user is concerned, everything "just worked". Only if GDB completely fails to find any suitable debug information will the warnings be printed. The crc_mismatch test compiles two executables: crc_mismatch and crc_mismatch-2 and then strips them of debuginfo creating separate debug files. The test then replaces crc_mismatch-2.debug with crc_mismatch.debug to trigger "CRC mismatch" warning. A local debuginfod server is setup to supply the correct debug file, now when GDB looks up the debug info no warning is given. The build-id-no-debug-warning.exp is similar to the previous test. It triggers the "separate debug info file has no debug info" warning by replacing the build-id based .debug file with the stripped binary and then loading it to GDB. It then also sets up local debuginfod server with the correct debug file to download to make sure no warnings are emitted.
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-011-1/+1
| | | | | | | This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
* Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker2022-01-011-1/+1
| | | | | | | | This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
* Update copyright year range in all GDB filesJoel Brobecker2021-01-011-1/+1
| | | | | | | | | This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
* Update copyright year range in all GDB files.Joel Brobecker2020-01-011-1/+1
| | | | | | gdb/ChangeLog: Update copyright year range in all GDB files.
* Core file build-id supportKeith Seitz2019-12-071-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses new BFD support for detecting build-ids in core files. After this patch, it is possible to run gdb with only the core file, and gdb will automatically load the executable and debug info [example from tests]: $ gdb -nx -q (gdb) core-file corefile-buildid.core [New LWP 29471] Reading symbols from gdb.base/corefile-buildid/debugdir-exec/.build-id/36/fe5722c5a7ca3ac746a84e223c6a2a69193a24... Core was generated by `outputs/gdb.base/coref'. Program terminated with signal SIGABRT, Aborted. (gdb) This work is based on functionality available in Fedora originally written by Jan Kratochvil. Regression tested on buildbot. gdb/ChangeLog: 2019-12-07 Keith Seitz <keiths@redhat.com> * build-id.c (build_id_bfd_get): Permit bfd_core, too. (build_id_to_debug_bfd): Make static, rewriting to use build_id_to_bfd_suffix. (build_id_to_bfd_suffix): Copy of build_id_to_debug_bfd, adding `suffix' parameter. Append SUFFIX to file names when searching for matching files. (build_id_to_debug_bfd): Use build_id_to_bfd_suffix. (build_id_to_exec_bfd): Likewise. * build-id.h (build_id_to_debug_bfd): Clarify that function searches for BFD of debug info file. (build_id_to_exec_bfd): Declare. * corelow.c: Include build-id.h. (locate_exec_from_corefile_build_id): New function. (core_target_open): If no executable BFD is found, search for a core file BFD using build-id. gdb/testsuite/ChangeLog: 2019-12-07 Keith Seitz <keiths@redhat.com> * gdb.base/corefile-buildid-shlib-shr.c: New file. * gdb.base/corefile-buildid-shlib.c: New file. * gdb.base/corefile-buildid.c: New file. * gdb.base/corefile-buildid.exp: New file. Change-Id: I15e9e8e58f10c68b5cae55e2eba58df1e8aef529
* Rename common to gdbsupportTom Tromey2019-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
* Revert the header-sorting patchTom Tromey2019-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
* Sort includes for files gdb/[a-f]*.[chyl].Tom Tromey2019-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
* Update copyright year range in all GDB files.Joel Brobecker2019-01-011-1/+1
| | | | | | | | | | | | | | | | This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
* Add DWARF index cacheSimon Marchi2018-08-071-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New in v3: - Remove things related to the dwarf-5 format. - Fix compilation on mingw (scoped_mmap.c). GDB can generate indexes for DWARF debug information, which, when integrated in the original binary, can speed up loading object files. This can be done using the gdb-add-index script or directly by the linker itself. However, not many people know about this. And even among those who do, because it requires additional steps, I don't know a lot of people who actually go through that trouble. To help make using the DWARF index more transparent, this patch introduces a DWARF index cache. When enabled, loading an index-less binary in GDB will automatically save an index file in ~/.cache/gdb. When loading that same object file again, the index file will be looked up and used to load the DWARF index. You therefore get the benefit of the DWARF index without having to do additional manual steps or modifying your build system. When an index section is already present in the file, GDB will prefer that one over looking up the cache. When doing my edit-compile-debug cycle, I often debug multiple times the same build, so the cache helps reducing the load time of the debug sessions after the first one. - The saved index file is exactly the same as the output of the "save gdb-index" command. It is therefore the exact same content that would be found in the .gdb_index or .debug_names section. We just leave it as a standalone file instead of merging it in the binary. - The cache is just a directory with files named after the object file's build-id. It is not possible to save/load the index for an object file without build-id in the cache. - The cache uses the gdb index format. The problem with the dwarf-5 format is that we can generate an addendum to the .debug_str section that you're supposed to integrate to the original binary. This complicates a little bit loading the data from the cached index files, so I would leave this for later. - The size taken up by ~/.cache/gdb is not limited. I was thinking we could add configurable limit (like ccache does), but that would come after. Also, maybe a command to flush the cache. - The cache is disabled by default. I think once it's been out there and tested for a while, it could be turned on by default, so that everybody can enjoy it. - The code was made to follow the XDG specification: if the XDG_CACHE_HOME environment variable, it is used, otherwise it falls back to ~/.cache/gdb. It is possible to change it using "set index-cache directory". On other OSes than GNU/Linux, ~/.cache may not be the best place to put such data. On macOS it should probably default to ~/Library/Caches/... On Windows, %LocalAppData%/... I don't intend to do this part, but further patches are welcome. - I think that we need to be careful that multiple instances of GDB don't interfere with each other (not far fetched at all if you run GDB in some automated script) and the cache is always coherent (either the file is not found, or it is found and entirely valid). Writing the file directly to its final location seems like a recipe for failure. One GDB could read a file in the index while it is being written by another GDB. To mitigate this, I made write_psymtabs_to_index write to temporary files and rename them once it's done. Two GDB instances writing the index for the same file should not step on each other's toes (the last file to be renamed will stay). A GDB looking up a file will only see a complete file or no file. Also, if GDB crashes while generating the index file, it will leave a work-in-progress file, but it won't be picked up by other instances looking up in the cache. gdb/ChangeLog: * common/pathstuff.h (get_standard_cache_dir): New. * common/pathstuff.c (get_standard_cache_dir): New. * build-id.h (build_id_to_string): New. * dwarf-index-common.h (INDEX4_SUFFIX, INDEX5_SUFFIX, DEBUG_STR_SUFFIX): Move to here. * dwarf-index-write.c (INDEX4_SUFFIX, INDEX5_SUFFIX, DEBUG_STR_SUFFIX): Move from there. (write_psymtabs_to_index): Make non-static, add basename parameter. Write to temporary files, rename when done. (save_gdb_index_command): Adjust call to write_psymtabs_to_index. * dwarf2read.h (dwarf2_per_objfile) <index_cache_res>: New field. * dwarf2read.c (dwz_file) <index_cache_res>: New field. (get_gdb_index_contents_from_cache): New. (get_gdb_index_contents_from_cache_dwz): New. (dwarf2_initialize_objfile): Read index from cache. (dwarf2_build_psymtabs): Save to index. * dwarf-index-cache.h: New file. * dwarf-index-cache.c: New file. * dwarf-index-write.h: New file. gdb/testsuite/ChangeLog: * boards/index-cache-gdb.exp: New file. * gdb.dwarf2/index-cache.exp: New file. * gdb.dwarf2/index-cache.c: New file. * gdb.base/maint.exp: Check if we are using the index cache.
* Make find_separate_debug_file* return std::stringSimon Marchi2018-03-081-4/+4
| | | | | | | | | | | | | | | | | | | | | This patch makes the find_separate_debug_file* functions return std::string, which allows to get rid of some manual memory management and one cleanup. gdb/ChangeLog: * build-id.c (find_separate_debug_file_by_buildid): Return std::string. * build-id.h (find_separate_debug_file_by_buildid): Return std::string. * coffread.c (coff_symfile_read): Adjust to std::string. * elfread.c (elf_symfile_read): Adjust to std::string. * symfile.c (separate_debug_file_exists): Change parameter to std::string. (find_separate_debug_file): Return std::string. (find_separate_debug_file_by_debuglink): Return std::string. * symfile.h (find_separate_debug_file_by_debuglink): Return std::string.
* Update copyright year range in all GDB filesJoel Brobecker2018-01-021-1/+1
| | | | | | gdb/ChangeLog: Update copyright year range in all GDB files
* Use class to manage BFD reference countsTom Tromey2017-01-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new specialization of gdb::ref_ptr that can be used to manage BFD reference counts. Then it changes most places in gdb to use this new class, rather than explicit reference-counting or cleanups. This patch removes make_cleanup_bfd_unref. If you look you will see a couple of spots using "release" where a use of gdb_bfd_ref_ptr would be cleaner. These will be fixed in the next patch. I think this patch fixes some latent bugs. For example, it seems to me that previously objfpy_add_separate_debug_file leaked a BFD. I'm not 100% certain that the macho_symfile_read_all_oso change is correct. The existing code here is hard for me to follow. One goal of this sort of automated reference counting, though, is to make it more difficult to make logic errors; so hopefully the code is clear now. 2017-01-10 Tom Tromey <tom@tromey.com> * windows-tdep.c (windows_xfer_shared_library): Update. * windows-nat.c (windows_make_so): Update. * utils.h (make_cleanup_bfd_unref): Remove. * utils.c (do_bfd_close_cleanup, make_cleanup_bfd_unref): Remove. * symfile.h (symfile_bfd_open) (find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr. * symfile.c (read_symbols, symbol_file_add) (separate_debug_file_exists): Update. (symfile_bfd_open): Return gdb_bfd_ref_ptr. (generic_load, reread_symbols): Update. * symfile-mem.c (symbol_file_add_from_memory): Update. * spu-linux-nat.c (spu_bfd_open): Return gdb_bfd_ref_ptr. (spu_symbol_file_add_from_memory): Update. * solist.h (struct target_so_ops) <bfd_open>: Return gdb_bfd_ref_ptr. (solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr. * solib.c (solib_bfd_fopen, solib_bfd_open): Return gdb_bfd_ref_ptr. (solib_map_sections, reload_shared_libraries_1): Update. * solib-svr4.c (enable_break): Update. * solib-spu.c (spu_bfd_fopen): Return gdb_bfd_ref_ptr. * solib-frv.c (enable_break2): Update. * solib-dsbt.c (enable_break): Update. * solib-darwin.c (gdb_bfd_mach_o_fat_extract): Return gdb_bfd_ref_ptr. (darwin_solib_get_all_image_info_addr_at_init): Update. (darwin_bfd_open): Return gdb_bfd_ref_ptr. * solib-aix.c (solib_aix_bfd_open): Return gdb_bfd_ref_ptr. * record-full.c (record_full_save): Update. * python/py-objfile.c (objfpy_add_separate_debug_file): Update. * procfs.c (insert_dbx_link_bpt_in_file): Update. * minidebug.c (find_separate_debug_file_in_section): Return gdb_bfd_ref_ptr. * machoread.c (macho_add_oso_symfile): Change abfd to gdb_bfd_ref_ptr. (macho_symfile_read_all_oso): Update. (macho_check_dsym): Return gdb_bfd_ref_ptr. (macho_symfile_read): Update. * jit.c (bfd_open_from_target_memory): Return gdb_bfd_ref_ptr. (jit_bfd_try_read_symtab): Update. * gdb_bfd.h (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr) (gdb_bfd_openw, gdb_bfd_openr_iovec) (gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return gdb_bfd_ref_ptr. (gdb_bfd_ref_policy): New struct. (gdb_bfd_ref_ptr): New typedef. * gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr) (gdb_bfd_openw, gdb_bfd_openr_iovec) (gdb_bfd_openr_next_archived_file, gdb_bfd_fdopenr): Return gdb_bfd_ref_ptr. * gcore.h (create_gcore_bfd): Return gdb_bfd_ref_ptr. * gcore.c (create_gcore_bfd): Return gdb_bfd_ref_ptr. (gcore_command): Update. * exec.c (exec_file_attach): Update. * elfread.c (elf_symfile_read): Update. * dwarf2read.c (dwarf2_get_dwz_file): Update. (try_open_dwop_file, open_dwo_file): Return gdb_bfd_ref_ptr. (open_and_init_dwo_file): Update. (open_dwp_file): Return gdb_bfd_ref_ptr. (open_and_init_dwp_file): Update. * corelow.c (core_open): Update. * compile/compile-object-load.c (compile_object_load): Update. * common/gdb_ref_ptr.h (ref_ptr::operator->): New operator. * coffread.c (coff_symfile_read): Update. * cli/cli-dump.c (bfd_openr_or_error, bfd_openw_or_error): Return gdb_bfd_ref_ptr. Rename. (dump_bfd_file, restore_command): Update. * build-id.h (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr. * build-id.c (build_id_to_debug_bfd): Return gdb_bfd_ref_ptr. (find_separate_debug_file_by_buildid): Update.
* update copyright year range in GDB filesJoel Brobecker2017-01-011-1/+1
| | | | | | | | | This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
* GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker2016-01-011-1/+1
| | | | | | gdb/ChangeLog: Update year range in copyright notice of all files.
* Allow gdb to find debug symbols file by build-id for PE file format alsoJon Turney2015-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This promotes BFD's struct elf_build_id to the generic struct bfd_build_id, populated when an ELF or PE BFD is read. gdb is updated to use that, and to use the build-id to find symbols for PE files also. There is currently no generic way to extract the build-id from an object file, perhaps an option to objdump to do this might make sense? On x86_64-pc-cygwin, gdb's sepdebug.exp changes: -# of unsupported tests 1 +# of expected passes 90 I don't seem to get consistent testsuite runs on i686-linux-gnu, but there don't appear to be any regressions. bfd/ChangeLog: 2015-06-10 Jon Turney <jon.turney@dronecode.org.uk> * elf-bfd.h : Remove struct elf_build_id. * bfd.c : Add struct bfd_build_id. * bfd-in2.h: Regenerate. * elf.c (elfobj_grok_gnu_build_id): Update to use bfd_build_id. * libpei.h: Add protoype and macros for bfd_XXi_slurp_codeview_record. * peXXigen.c (_bfd_XXi_slurp_codeview_record): Make public * peicode.h (pe_bfd_read_buildid): Add. (pe_bfd_object_p): Use pe_bfd_read_buildid(). gdb/ChangeLog: 2015-06-10 Jon Turney <jon.turney@dronecode.org.uk> * build-id.c: Don't include elf-bfd.h. (build_id_bfd_get): Use bfd_build_id. (build_id_verify): Ditto. * build-id.h: Ditto. (find_separate_debug_file_by_buildid): Ditto. * python/py-objfile.c: Don't include elf-bfd.h. (objfpy_get_build_id) Use bfd_build_id. (objfpy_build_id_matches, objfpy_lookup_objfile_by_build_id): Ditto. * coffread.c: Include build-id.h. (coff_symfile_read): Try find_separate_debug_file_by_buildid. gdb/doc/ChangeLog: 2015-06-10 Jon Turney <jon.turney@dronecode.org.uk> * gdb.texinfo (Separate Debug Files): Document that PE is also supported. gdb/testsuite/ChangeLog: 2015-06-10 Jon Turney <jon.turney@dronecode.org.uk> * gdb.base/sepdebug.exp: Add EXEEXT where needed. * lib/gdb.exp (get_build_id): Teach how to extract build-id from a PE file. * lib/future.exp (gdb_find_objdump): Add gdb_find_objdump. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker2015-01-011-1/+1
| | | | | | gdb/ChangeLog: Update year range in copyright notice of all files.
* New python attribute gdb.Objfile.build_id.Doug Evans2014-12-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | gdb/ChangeLog: * NEWS: Mention gdb.Objfile.build_id. * build-id.c (build_id_bfd_get): Make non-static. * build-id.h (build_id_bfd_get): Add declaration. * python/py-objfile.c: #include "build-id.h", "elf-bfd.h". (OBJFPY_REQUIRE_VALID): New macro. (objfpy_get_build_id): New function. (objfile_getset): Add "build_id". * utils.c (make_hex_string): New function. * utils.h (make_hex_string): Add declaration. gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document Objfile.build_id. gdb/testsuite/ChangeLog: * lib/gdb.exp (get_build_id): New function. (build_id_debug_filename_get): Rewrite to use it. * gdb.python/py-objfile.exp: Add test for objfile.build_id.
* Update Copyright year range in all files maintained by GDB.Joel Brobecker2014-01-011-1/+1
|
* fix PR symtab/15597Tom Tromey2013-10-081-0/+44
This patch fixes gdb PR symtab/15597. The bug is that the .gnu_debugaltlink section includes the build-id of the alt file, but gdb does not use it. This patch fixes the problem by changing gdb to do what it ought to always have done: verify the build id of the file found using the filename in .gnu_debugaltlink; and if that does not match, try to find the correct debug file using the build-id and debug-file-directory. This patch touches BFD. Previously, gdb had its own code for parsing .gnu_debugaltlink; I changed it to use the BFD functions after those were introduced. However, the BFD functions are incorrect -- they assume that .gnu_debugaltlink is formatted like .gnu_debuglink. However, it it is not. Instead, it consists of a file name followed by the build-id -- no alignment, and the build-id is not a CRC. Fixing this properly is a bit of a pain. But, because separate_alt_debug_file_exists just has a FIXME for the build-id case, I did not fix it properly. Instead I introduced a hack. This leaves BFD working just as well as it did before my patch. I'm willing to do something better here but I could use some guidance as to what. It seems that the build-id code in BFD is largely punted on. FWIW gdb is the only user of bfd_get_alt_debug_link_info outside of BFD itself. I moved the build-id logic out of elfread.c and into a new file. This seemed cleanest to me. Writing a test case was a bit of a pain. I added a couple new features to the DWARF assembler to handle this. Built and regtested on x86-64 Fedora 18. * bfd-in2.h: Rebuild. * opncls.c (bfd_get_alt_debug_link_info): Add buildid_len parameter. Change type of buildid_out. Update. (get_alt_debug_link_info_shim): New function. (bfd_follow_gnu_debuglink): Use it. * Makefile.in (SFILES): Add build-id.c. (HFILES_NO_SRCDIR): Add build-id.h. * build-id.c: New file, largely from elfread.c. Modified most functions. * build-id.h: New file. * dwarf2read.c (dwarf2_get_dwz_file): Update for change to bfd_get_alt_debug_link_info. Verify dwz file's build-id. Search for dwz file using build-id. * elfread.c (build_id_bfd_get, build_id_verify) (build_id_to_debug_filename, find_separate_debug_file): Remove. * gdb.dwarf2/dwzbuildid.exp: New file. * lib/dwarf.exp (Dwarf::_section): Add "flags" and "type" parameters. (Dwarf::_defer_output): Change "section" parameter to "section_spec"; update. (Dwarf::gnu_debugaltlink, Dwarf::_note, Dwarf::build_id): New procs.