Commit Graph

35 Commits

Author SHA1 Message Date
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Tom Tromey 0d12e84cfc Don't include gdbarch.h from defs.h
I touched symtab.h and was surprised to see how many files were
rebuilt.  I looked into it a bit, and found that defs.h includes
gdbarch.h, which in turn includes many things.

gdbarch.h is only needed by a minority ofthe files in gdb, so this
patch removes the include from defs.h and updates the fallout.

I did "wc -l" on the files in build/gdb/.deps; this patch reduces the
line count from 139935 to 137030; so there are definitely future
build-time savings here.

Note that while I configured with --enable-targets=all, it's possible
that some *-nat.c file needs an update.  I could not test all of
these.  The buildbot caught a few problems along these lines.

gdb/ChangeLog
2019-07-10  Tom Tromey  <tom@tromey.com>

	* defs.h: Don't include gdbarch.h.
	* aarch64-ravenscar-thread.c, aarch64-tdep.c, alpha-bsd-tdep.h,
	alpha-linux-tdep.c, alpha-mdebug-tdep.c, arch-utils.h, arm-tdep.h,
	ax-general.c, btrace.c, buildsym-legacy.c, buildsym.h, c-lang.c,
	cli/cli-decode.h, cli/cli-dump.c, cli/cli-script.h,
	cli/cli-style.h, coff-pe-read.h, compile/compile-c-support.c,
	compile/compile-cplus.h, compile/compile-loc2c.c, corefile.c,
	cp-valprint.c, cris-linux-tdep.c, ctf.c, d-lang.c, d-namespace.c,
	dcache.c, dicos-tdep.c, dictionary.c, disasm-selftests.c,
	dummy-frame.c, dummy-frame.h, dwarf2-frame-tailcall.c,
	dwarf2expr.c, expression.h, f-lang.c, frame-base.c,
	frame-unwind.c, frv-linux-tdep.c, gdbarch-selftests.c, gdbtypes.h,
	go-lang.c, hppa-nbsd-tdep.c, hppa-obsd-tdep.c, i386-dicos-tdep.c,
	i386-tdep.h, ia64-vms-tdep.c, interps.h, language.c,
	linux-record.c, location.h, m2-lang.c, m32r-linux-tdep.c,
	mem-break.c, memattr.c, mn10300-linux-tdep.c, nios2-linux-tdep.c,
	objfiles.h, opencl-lang.c, or1k-linux-tdep.c, p-lang.c,
	parser-defs.h, ppc-tdep.h, probe.h, python/py-record-btrace.c,
	record-btrace.c, record.h, regcache-dump.c, regcache.h,
	riscv-fbsd-tdep.c, riscv-linux-tdep.c, rust-exp.y,
	sh-linux-tdep.c, sh-nbsd-tdep.c, source-cache.c,
	sparc-nbsd-tdep.c, sparc-obsd-tdep.c, sparc-ravenscar-thread.c,
	sparc64-fbsd-tdep.c, std-regs.c, target-descriptions.h,
	target-float.c, tic6x-linux-tdep.c, tilegx-linux-tdep.c, top.c,
	tracefile.c, trad-frame.c, type-stack.h, ui-style.c, utils.c,
	utils.h, valarith.c, valprint.c, varobj.c, x86-tdep.c,
	xml-support.h, xtensa-linux-tdep.c, cli/cli-cmds.h: Update.
	* s390-linux-nat.c, procfs.c, inf-ptrace.c: Likewise.
2019-07-10 14:53:53 -06:00
Tom Tromey 268a13a5a3 Rename common to gdbsupport
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.
2019-07-09 07:45:38 -06:00
Tom Tromey 1a5c25988e Normalize include guards in gdb
While working on my other scripts to deal with gdb headers, I noticed
that some files were missing include guards.  I wrote a script to add
the missing ones, but found that using the obvious names for the
guards ran into clashes -- for example, gdb/nat/linux-nat.h used
"LINUX_NAT_H", but this was also the script's choice for
gdb/linux-nat.h.

So, I changed the script to normalize all include guards in gdb.  This
patch is the result.

As usual the script is available here:

    https://github.com/tromey/gdb-refactoring-scripts

Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the
buildbot.

gdb/ChangeLog
2019-02-07  Tom Tromey  <tom@tromey.com>

	* yy-remap.h: Add include guard.
	* xtensa-tdep.h: Add include guard.
	* xcoffread.h: Rename include guard.
	* varobj-iter.h: Add include guard.
	* tui/tui.h: Rename include guard.
	* tui/tui-winsource.h: Rename include guard.
	* tui/tui-wingeneral.h: Rename include guard.
	* tui/tui-windata.h: Rename include guard.
	* tui/tui-win.h: Rename include guard.
	* tui/tui-stack.h: Rename include guard.
	* tui/tui-source.h: Rename include guard.
	* tui/tui-regs.h: Rename include guard.
	* tui/tui-out.h: Rename include guard.
	* tui/tui-layout.h: Rename include guard.
	* tui/tui-io.h: Rename include guard.
	* tui/tui-hooks.h: Rename include guard.
	* tui/tui-file.h: Rename include guard.
	* tui/tui-disasm.h: Rename include guard.
	* tui/tui-data.h: Rename include guard.
	* tui/tui-command.h: Rename include guard.
	* tic6x-tdep.h: Add include guard.
	* target/waitstatus.h: Rename include guard.
	* target/wait.h: Rename include guard.
	* target/target.h: Rename include guard.
	* target/resume.h: Rename include guard.
	* target-float.h: Rename include guard.
	* stabsread.h: Add include guard.
	* rs6000-tdep.h: Add include guard.
	* riscv-fbsd-tdep.h: Add include guard.
	* regformats/regdef.h: Rename include guard.
	* record.h: Rename include guard.
	* python/python.h: Rename include guard.
	* python/python-internal.h: Rename include guard.
	* python/py-stopevent.h: Rename include guard.
	* python/py-ref.h: Rename include guard.
	* python/py-record.h: Rename include guard.
	* python/py-record-full.h: Rename include guard.
	* python/py-record-btrace.h: Rename include guard.
	* python/py-instruction.h: Rename include guard.
	* python/py-events.h: Rename include guard.
	* python/py-event.h: Rename include guard.
	* procfs.h: Add include guard.
	* proc-utils.h: Add include guard.
	* p-lang.h: Add include guard.
	* or1k-tdep.h: Rename include guard.
	* observable.h: Rename include guard.
	* nto-tdep.h: Rename include guard.
	* nat/x86-linux.h: Rename include guard.
	* nat/x86-linux-dregs.h: Rename include guard.
	* nat/x86-gcc-cpuid.h: Add include guard.
	* nat/x86-dregs.h: Rename include guard.
	* nat/x86-cpuid.h: Rename include guard.
	* nat/ppc-linux.h: Rename include guard.
	* nat/mips-linux-watch.h: Rename include guard.
	* nat/linux-waitpid.h: Rename include guard.
	* nat/linux-ptrace.h: Rename include guard.
	* nat/linux-procfs.h: Rename include guard.
	* nat/linux-osdata.h: Rename include guard.
	* nat/linux-nat.h: Rename include guard.
	* nat/linux-namespaces.h: Rename include guard.
	* nat/linux-btrace.h: Rename include guard.
	* nat/glibc_thread_db.h: Rename include guard.
	* nat/gdb_thread_db.h: Rename include guard.
	* nat/gdb_ptrace.h: Rename include guard.
	* nat/fork-inferior.h: Rename include guard.
	* nat/amd64-linux-siginfo.h: Rename include guard.
	* nat/aarch64-sve-linux-sigcontext.h: Rename include guard.
	* nat/aarch64-sve-linux-ptrace.h: Rename include guard.
	* nat/aarch64-linux.h: Rename include guard.
	* nat/aarch64-linux-hw-point.h: Rename include guard.
	* mn10300-tdep.h: Add include guard.
	* mips-linux-tdep.h: Add include guard.
	* mi/mi-parse.h: Rename include guard.
	* mi/mi-out.h: Rename include guard.
	* mi/mi-main.h: Rename include guard.
	* mi/mi-interp.h: Rename include guard.
	* mi/mi-getopt.h: Rename include guard.
	* mi/mi-console.h: Rename include guard.
	* mi/mi-common.h: Rename include guard.
	* mi/mi-cmds.h: Rename include guard.
	* mi/mi-cmd-break.h: Rename include guard.
	* m2-lang.h: Add include guard.
	* location.h: Rename include guard.
	* linux-record.h: Rename include guard.
	* linux-nat.h: Add include guard.
	* linux-fork.h: Add include guard.
	* i386-darwin-tdep.h: Rename include guard.
	* hppa-linux-offsets.h: Add include guard.
	* guile/guile.h: Rename include guard.
	* guile/guile-internal.h: Rename include guard.
	* gnu-nat.h: Rename include guard.
	* gdb-stabs.h: Rename include guard.
	* frv-tdep.h: Add include guard.
	* f-lang.h: Add include guard.
	* event-loop.h: Add include guard.
	* darwin-nat.h: Rename include guard.
	* cp-abi.h: Rename include guard.
	* config/sparc/nm-sol2.h: Rename include guard.
	* config/nm-nto.h: Rename include guard.
	* config/nm-linux.h: Add include guard.
	* config/i386/nm-i386gnu.h: Rename include guard.
	* config/djgpp/nl_types.h: Rename include guard.
	* config/djgpp/langinfo.h: Rename include guard.
	* compile/gcc-cp-plugin.h: Add include guard.
	* compile/gcc-c-plugin.h: Add include guard.
	* compile/compile.h: Rename include guard.
	* compile/compile-object-run.h: Rename include guard.
	* compile/compile-object-load.h: Rename include guard.
	* compile/compile-internal.h: Rename include guard.
	* compile/compile-cplus.h: Rename include guard.
	* compile/compile-c.h: Rename include guard.
	* common/xml-utils.h: Rename include guard.
	* common/x86-xstate.h: Rename include guard.
	* common/version.h: Rename include guard.
	* common/vec.h: Rename include guard.
	* common/tdesc.h: Rename include guard.
	* common/selftest.h: Rename include guard.
	* common/scoped_restore.h: Rename include guard.
	* common/scoped_mmap.h: Rename include guard.
	* common/scoped_fd.h: Rename include guard.
	* common/safe-iterator.h: Rename include guard.
	* common/run-time-clock.h: Rename include guard.
	* common/refcounted-object.h: Rename include guard.
	* common/queue.h: Rename include guard.
	* common/ptid.h: Rename include guard.
	* common/print-utils.h: Rename include guard.
	* common/preprocessor.h: Rename include guard.
	* common/pathstuff.h: Rename include guard.
	* common/observable.h: Rename include guard.
	* common/netstuff.h: Rename include guard.
	* common/job-control.h: Rename include guard.
	* common/host-defs.h: Rename include guard.
	* common/gdb_wait.h: Rename include guard.
	* common/gdb_vecs.h: Rename include guard.
	* common/gdb_unlinker.h: Rename include guard.
	* common/gdb_unique_ptr.h: Rename include guard.
	* common/gdb_tilde_expand.h: Rename include guard.
	* common/gdb_sys_time.h: Rename include guard.
	* common/gdb_string_view.h: Rename include guard.
	* common/gdb_splay_tree.h: Rename include guard.
	* common/gdb_setjmp.h: Rename include guard.
	* common/gdb_ref_ptr.h: Rename include guard.
	* common/gdb_optional.h: Rename include guard.
	* common/gdb_locale.h: Rename include guard.
	* common/gdb_assert.h: Rename include guard.
	* common/filtered-iterator.h: Rename include guard.
	* common/filestuff.h: Rename include guard.
	* common/fileio.h: Rename include guard.
	* common/environ.h: Rename include guard.
	* common/common-utils.h: Rename include guard.
	* common/common-types.h: Rename include guard.
	* common/common-regcache.h: Rename include guard.
	* common/common-inferior.h: Rename include guard.
	* common/common-gdbthread.h: Rename include guard.
	* common/common-exceptions.h: Rename include guard.
	* common/common-defs.h: Rename include guard.
	* common/common-debug.h: Rename include guard.
	* common/cleanups.h: Rename include guard.
	* common/buffer.h: Rename include guard.
	* common/btrace-common.h: Rename include guard.
	* common/break-common.h: Rename include guard.
	* cli/cli-utils.h: Rename include guard.
	* cli/cli-style.h: Rename include guard.
	* cli/cli-setshow.h: Rename include guard.
	* cli/cli-script.h: Rename include guard.
	* cli/cli-interp.h: Rename include guard.
	* cli/cli-decode.h: Rename include guard.
	* cli/cli-cmds.h: Rename include guard.
	* charset-list.h: Add include guard.
	* buildsym-legacy.h: Rename include guard.
	* bfin-tdep.h: Add include guard.
	* ax.h: Rename include guard.
	* arm-linux-tdep.h: Add include guard.
	* arm-fbsd-tdep.h: Add include guard.
	* arch/xtensa.h: Rename include guard.
	* arch/tic6x.h: Add include guard.
	* arch/i386.h: Add include guard.
	* arch/arm.h: Rename include guard.
	* arch/arm-linux.h: Rename include guard.
	* arch/arm-get-next-pcs.h: Rename include guard.
	* arch/amd64.h: Add include guard.
	* arch/aarch64-insn.h: Rename include guard.
	* arch-utils.h: Rename include guard.
	* annotate.h: Add include guard.
	* amd64-darwin-tdep.h: Rename include guard.
	* aarch64-linux-tdep.h: Add include guard.
	* aarch64-fbsd-tdep.h: Add include guard.
	* aarch32-linux-nat.h: Add include guard.

gdb/gdbserver/ChangeLog
2019-02-07  Tom Tromey  <tom@tromey.com>

	* x86-tdesc.h: Rename include guard.
	* x86-low.h: Add include guard.
	* wincecompat.h: Rename include guard.
	* win32-low.h: Add include guard.
	* utils.h: Rename include guard.
	* tracepoint.h: Rename include guard.
	* tdesc.h: Rename include guard.
	* target.h: Rename include guard.
	* server.h: Rename include guard.
	* remote-utils.h: Rename include guard.
	* regcache.h: Rename include guard.
	* nto-low.h: Rename include guard.
	* notif.h: Add include guard.
	* mem-break.h: Rename include guard.
	* lynx-low.h: Add include guard.
	* linux-x86-tdesc.h: Add include guard.
	* linux-s390-tdesc.h: Add include guard.
	* linux-ppc-tdesc-init.h: Add include guard.
	* linux-low.h: Add include guard.
	* linux-aarch64-tdesc.h: Add include guard.
	* linux-aarch32-low.h: Add include guard.
	* inferiors.h: Rename include guard.
	* i387-fp.h: Rename include guard.
	* hostio.h: Rename include guard.
	* gdbthread.h: Rename include guard.
	* gdb_proc_service.h: Rename include guard.
	* event-loop.h: Rename include guard.
	* dll.h: Rename include guard.
	* debug.h: Rename include guard.
	* ax.h: Rename include guard.
2019-02-07 03:27:23 -07:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
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.
2019-01-01 10:01:51 +04:00
Simon Marchi 6e1e1966ba Pass inferior down to target_detach and to_detach
The to_detach target_ops method implementations are currently expected
to work on current_inferior/inferior_ptid.  In order to make things more
explicit, and remove some "shadow" parameter passing through globals,
this patch adds an "inferior" parameter to to_detach.  Implementations
will be expected to use this instead of relying on the global.  However,
to keep things simple, this patch only does the minimum that is
necessary to add the parameter.  The following patch gives an example of
how one such implementation would be adapted.  If the approach is deemed
good, we can then look into adapting more implementations.  Until then,
they'll continue to work as they do currently.

gdb/ChangeLog:

	* target.h (struct target_ops) <to_detach>: Add inferior
	parameter.
	(target_detach): Likewise.
	* target.c (dispose_inferior): Pass inferior down.
	(target_detach): Pass inferior down.  Assert that it is equal to
	the current inferior.
	* aix-thread.c (aix_thread_detach): Pass inferior down.
	* corefile.c (core_file_command): Pass current_inferior() down.
	* corelow.c (core_detach): Add inferior parameter.
	* darwin-nat.c (darwin_detach): Likewise.
	* gnu-nat.c (gnu_detach): Likewise.
	* inf-ptrace.c (inf_ptrace_detach): Likewise.
	* infcmd.c (detach_command): Pass current_inferior() down to
	target_detach.
	* infrun.c (follow_fork_inferior): Pass parent_inf to
	target_detach.
	(handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to
	target_detach.
	* linux-nat.c (linux_nat_detach): Add inferior parameter.
	* linux-thread-db.c (thread_db_detach): Likewise.
	* nto-procfs.c (procfs_detach): Likewise.
	* procfs.c (procfs_detach): Likewise.
	* record.c (record_detach): Likewise.
	* record.h (struct inferior): Forward-declare.
	(record_detach): Add inferior parameter.
	* remote-sim.c (gdbsim_detach): Likewise.
	* remote.c (remote_detach_1): Likewise.
	(remote_detach): Likewise.
	(extended_remote_detach): Likewise.
	* sol-thread.c (sol_thread_detach): Likewise.
	* target-debug.h (target_debug_print_inferior_p): New macro.
	* target-delegates.c: Re-generate.
	* top.c (kill_or_detach): Pass inferior down to target_detach.
	* windows-nat.c (windows_detach): Add inferior parameter.
2018-01-19 11:47:57 -05:00
Simon Marchi 6bd6f3b656 Remove args from target detach
I was looking into adding a parameter to target_detach, and was
wondering what the args parameter was.  It seems like in the distant
past, it was possible to specify a signal number when detaching.  That
signal was injected in the process before it was detached.  There is an
example of code handling this in linux_nat_detach.  With today's GDB, I
can't get this to work.  Doing "detach 15" (15 == SIGTERM) doesn't work,
because detach is a prefix command and doesn't recognize the sub-command
15.  Doing "detach inferiors 15" doesn't work because it expects a list
of inferior id to detach.  Therefore, I don't think there's a way of
invoking detach_command with a non-NULL args.  I also didn't find any
documentation related to this feature.

I assume that this feature stopped working when detach was made a prefix
command, which is in f73adfeb8b (sorry,
there's no commit title) from 2006.  Given that this feature was broken
for such a long time and we haven't heard anything (AFAIK, I did not
find any related bug), I think it's safe to remove it, as well as the
args parameter to target_detach.  If someone wants to re-introduce it, I
would suggest rethinking the user interface, and in particular would
suggest using signal name instead of numbers.

I tried to fix all the impacted code, but I might have forgotten some
spots.  It shouldn't be hard to fix if that's the case.  I also couldn't
build-test everything I changed, especially the nto and solaris stuff.

gdb/ChangeLog:

	* target.h (struct target_ops) <to_detach>: Remove args
	parameter.
	(target_detach): Likewise.
	* target.c (dispose_inferior): Adjust.
	(target_detach): Remove args parameter, adjust.
	* aix-thread.c (aix_thread_detach): Adjust.
	* corefile.c (core_file_command): Adjust.
	* corelow.c (core_detach): Adjust.
	* darwin-nat.c (darwin_detach): Adjust.
	* gnu-nat.c (gnu_detach): Adjust.
	* inf-ptrace.c (inf_ptrace_detach): Adjust.
	* infcmd.c (detach_command): Adjust
	* infrun.c (follow_fork_inferior): Adjust.
	(handle_vfork_child_exec_or_exit): Adjust.
	* linux-fork.c (linux_fork_detach): Remove args parameter.
	* linux-fork.h (linux_fork_detach): Likewise.
	* linux-nat.c (linux_nat_detach): Likewise, and adjust.
	* linux-thread-db.c (thread_db_detach): Likewise.
	* nto-procfs.c (procfs_detach): Likewise.
	* procfs.c (procfs_detach): Likewise.
	(do_detach): Remove signo parameter.
	* record.c (record_detach): Remove args parameter.
	* record.h (record_detach): Likewise.
	* remote-sim.c (gdbsim_detach): Likewise.
	* remote.c (remote_detach_1): Likewise.
	(remote_detach): Likewise.
	(extended_remote_detach): Likewise.
	* sol-thread.c (sol_thread_detach): Likewise.
	* target-delegates.c: Re-generate.
	* top.c (struct qt_args) <args>: Remove field.
	(kill_or_detach): Don't pass args.
	(quit_force): Don't set args.
	* windows-nat.c (windows_detach): Remove args parameter.
2018-01-19 11:47:24 -05:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Yao Qi accd0bcdfe const-fy function parameter struct address_space *aspace
This patch changes the parameter "struct address_space *aspace" to "const
address_space *aspace" in many functions.

gdb:

2017-10-26  Yao Qi  <yao.qi@linaro.org>

	* breakpoint.c (breakpoint_location_address_match): Change
	"struct address_space *" to "const address_space".
	(breakpoint_location_address_range_overlap): Likewise.
	(breakpoint_here_p): Likewise.
	(breakpoint_in_range_p): Likewise.
	(moribund_breakpoint_here_p): Likewise.
	(bp_location_inserted_here_p): Likewise.
	(software_breakpoint_inserted_here_p): Likewise.
	(hardware_breakpoint_inserted_here_p): Likewise.
	(hardware_watchpoint_inserted_in_range): Likewise.
	(bpstat_check_location): Likewise.
	(bpstat_stop_status): Likewise.
	(breakpoint_address_match): Likewise.
	(breakpoint_address_match_range): Likewise.
	(breakpoint_location_address_match): Likewise.
	(breakpoint_location_address_range_overlap): Likewise.
	(insert_single_step_breakpoint): Likewise.
	(breakpoint_has_location_inserted_here): Likewise.
	(single_step_breakpoint_inserted_here_p): Likewise.
	(pc_at_non_inline_function): Likewise.
	* breakpoint.h (bpstat_stop_status): Update declaration.
	(breakpoint_here_p): Likewise.
	(breakpoint_in_range_p): Likewise.
	(moribund_breakpoint_here_p): Likewise.
	(breakpoint_inserted_here_p): Likewise.
	(software_breakpoint_inserted_here_p): Likewise.
	(hardware_breakpoint_inserted_here_p): Likewise.
	(breakpoint_has_location_inserted_here): Likewise.
	(single_step_breakpoint_inserted_here_p): Likewise.
	(hardware_watchpoint_inserted_in_range): Likewise.
	(breakpoint_address_match): Likewise.
	(insert_single_step_breakpoint): Likewise.
	(pc_at_non_inline_function): Likewise.
	* gdbthread.h (thread_has_single_step_breakpoint_here): Likewise.
	* record.c (record_check_stopped_by_breakpoint): Likewise.
	* record.h (record_check_stopped_by_breakpoint): Likewise.
	* thread.c (thread_has_single_step_breakpoint_here): Likewise.
2017-10-26 09:46:16 +01:00
Tim Wiederhake b158a20f26 Add method to query current recording method to target_ops.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>

gdb/ChangeLog

	* record-btrace.c (record_btrace_record_method): New function.
	(init_record_btrace_ops): Initialize to_record_method.
	* record-full.c (record_full_record_method): New function.
	(init_record_full_ops, init_record_full_core_ops): Add
	record_full_record_method.
	* record.h (enum record_method): New enum.
	* target-debug.h (target_debug_print_enum_record_method: New define.
	* target-delegates.c: Regenerate.
	* target.c (target_record_method): New function.
	* target.h: Include record.h.
	(struct target_ops) <to_record_method>: New field.
	(target_record_method): New export.

Change-Id: I05daa70e4e08a19901e848c731bb7d60cd87cc5a
2017-02-14 10:57:56 +01:00
Tim Wiederhake 45b196c590 Add record_start and record_stop functions.
Signed-off-by: Tim Wiederhake <tim.wiederhake@intel.com>

gdb/ChangeLog

	* record.h (record_start, record_stop): New export.
	* record.c (record_start, record_stop): New function.

Change-Id: If235d4bde8ec61dab6dbd23e087430e66d2e91a7
2017-02-14 10:57:56 +01:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
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.
2017-01-01 10:52:34 +04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Pedro Alves 8d297bbf60 Type-safe wrapper for enum flags
This patch fixes C++ build errors like this:

/home/pedro/gdb/mygit/cxx-convertion/src/gdb/linux-tdep.c:1126:35: error: invalid conversion from ‘int’ to ‘filterflags’ [-fpermissive]
       | COREFILTER_HUGETLB_PRIVATE);
                                   ^

This is a case of enums used as bit flags.  Unlike "regular" enums,
these values are supposed to be or'ed together.  However, in C++, the
type of "(ENUM1 | ENUM2)" is int, and you then can't assign an int to
an enum variable without a cast.  That means that this:

  enum foo_flags flags = 0;

  if (...)
    flags |= FOO_FLAG1;
  if (...)
    flags |= FOO_FLAG2;

... would have to be written as:

  enum foo_flags flags = (enum foo_flags) 0;

  if (...)
    flags = (enum foo_flags) (flags | FOO_FLAG1);
  if (...)
    flags = (enum foo_flags) (flags | FOO_FLAG2);

which is ... ugly.  Alternatively, we'd have to use an int for the
variable's type, which isn't ideal either.

This patch instead adds an "enum flags" class.  "enum flags" are
exactly the enums where the values are bits that are meant to be ORed
together.

This allows writing code like the below, while with raw enums this
would fail to compile without casts to enum type at the assignments to
'f':

  enum some_flag
  {
     flag_val1 = 1 << 1,
     flag_val2 = 1 << 2,
     flag_val3 = 1 << 3,
     flag_val4 = 1 << 4,
  };
  DEF_ENUM_FLAGS_TYPE(enum some_flag, some_flags)

  some_flags f = flag_val1 | flag_val2;
  f |= flag_val3;

It's also possible to assign literal zero to an enum flags variable
(meaning, no flags), dispensing either adding an awkward explicit "no
value" value to the enumeration or the cast to assignments from 0.
For example:

  some_flags f = 0;
  f |= flag_val3 | flag_val4;

Note that literal integers other than zero do fail to compile:

  some_flags f = 1; // error

C is still supported -- DEF_ENUM_FLAGS_TYPE is just a typedef in that
case.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

	* btrace.h: Include common/enum-flags.h.
	(btrace_insn_flags): Define.
	(struct btrace_insn) <flags>: Change type.
	(btrace_function_flags): Define.
	(struct btrace_function) <flags>: Change type.
	(btrace_thread_flags): Define.
	(struct btrace_thread_info) <flags>: Change type.
	* c-exp.y (token_flags): Rename to ...
	(token_flag): ... this.
	(token_flags): Define.
	(struct token) <flags>: Change type.
	* common/enum-flags.h: New file.
	* compile/compile-c-types.c (convert_qualified): Change type of
	'quals' local.
	* compile/compile-internal.h: Include "common/enum-flags.h".
	(gcc_qualifiers_flags): Define.
	* completer.c (enum reg_completer_targets): Rename to ...
	(enum reg_completer_target): ... this.
	(reg_completer_targets): Define.
	(reg_or_group_completer_1): Change type of 'targets' parameter.
	* disasm.c (do_mixed_source_and_assembly_deprecated): Change type
	of 'psl_flags' local.
	(do_mixed_source_and_assembly): Change type of 'psl_flags' local.
	* infrun.c: Include "common/enum-flags.h".
	(enum step_over_what): Rename to ...
	(enum step_over_what_flag): ... this.
	(step_over_what): Change type.
	(start_step_over): Change type of 'step_what' local.
	(thread_still_needs_step_over): Now returns a step_over_what.
	Adjust.
	(keep_going_pass_signal): Change type of 'step_what' local.
	* linux-tdep.c: Include "common/enum-flags.h".
	(enum filterflags): Rename to ...
	(enum filter_flag): ... this.
	(filter_flags): Define.
	(dump_mapping_p): Change type of 'filterflags' parameter.
	(linux_find_memory_regions_full): Change type of 'filterflags'
	local.
	(linux_find_memory_regions_full): Pass the address of an unsigned
	int to sscanf instead of the address of an enum.
	* record-btrace.c (btrace_print_lines): Change type of local
	'psl_flags'.
	(btrace_call_history): Replace 'flags' parameter
	with 'int_flags' parameter.  Adjust.
	(record_btrace_call_history, record_btrace_call_history_range)
	(record_btrace_call_history_from): Rename 'flags' parameter to
	'int_flags'.  Use record_print_flags.
	* record.h: Include "common/enum-flags.h".
	(record_print_flags): Define.
	* source.c: Include "common/enum-flags.h".
	(print_source_lines_base, print_source_lines): Change type of
	flags parameter.
	* symtab.h: Include "common/enum-flags.h".
	(enum print_source_lines_flags): Rename to ...
	(enum print_source_lines_flag): ... this.
	(print_source_lines_flags): Define.
	(print_source_lines): Change prototype.
2015-11-17 13:31:29 +00:00
Pedro Alves 9e8915c6ce record-full/record-btrace: software/hardware breakpoint trap
This adjusts the record targets to tell the core whether a trap was
caused by a breakpoint.  Targets that can do this should report
breakpoint traps with the PC already adjusted, so this removes the
re-incrementing record-full was doing.

These targets need to be adjusted before process_stratum targets
beneath are, otherwise target_supports_stopped_by_sw_breakpoint,
etc. would fall through to the target beneath while
recording/replaying, and the core would get confused.

Tested on x86-64 Fedora 20, native and gdbserver.

gdb/ChangeLog:
2015-03-04  Pedro Alves  <palves@redhat.com>

	* btrace.h: Include target/waitstatus.h.
	(struct btrace_thread_info) <stop_reason>: New field.
	* record-btrace.c (record_btrace_step_thread): Use
	record_check_stopped_by_breakpoint instead of breakpoint_here_p.
	(record_btrace_decr_pc_after_break): Delete.
	(record_btrace_stopped_by_sw_breakpoint)
	(record_btrace_supports_stopped_by_sw_breakpoint)
	(record_btrace_stopped_by_hw_breakpoint)
	(record_btrace_supports_stopped_by_hw_breakpoint): New functions.
	(init_record_btrace_ops): Install them.
	* record-full.c (record_full_hw_watchpoint): Delete and replace
	with ...
	(record_full_stop_reason): ... this throughout.
	(record_full_exec_insn): Adjust.
	(record_full_wait_1): Adjust.  No longer re-increment the PC.
	(record_full_wait_1): Adjust.  Use
	record_check_stopped_by_breakpoint instead of breakpoint_here_p.
	(record_full_stopped_by_watchpoint): Adjust.
	(record_full_stopped_by_sw_breakpoint)
	(record_full_supports_stopped_by_sw_breakpoint)
	(record_full_supports_stopped_by_sw_breakpoint)
	(record_full_stopped_by_hw_breakpoint)
	(record_full_supports_stopped_by_hw_breakpoint): New functions.
	(init_record_full_ops, init_record_full_core_ops): Install them.
	* record.c (record_check_stopped_by_breakpoint): New function.
	* record.h: Include target/waitstatus.h.
	(record_check_stopped_by_breakpoint): New declaration.
2015-03-04 20:41:15 +00:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Tom Tromey c2bcbb1d04 constify get_bookmark and goto_bookmark
This makes arguments to to_get_bookmark and to_goto_bookmark const and
fixes the fallout.  Tested by rebuilding.  The only thing of note is
the new split between cmd_record_goto and record_goto -- basically
separating the CLI function from a new internal API, to allow const
propagation.

2014-06-26  Tom Tromey  <tromey@redhat.com>

	* record-full.c (record_full_get_bookmark): Make "args" const.
	(record_full_goto_bookmark): Make "raw_bookmark" const.
	* record.c (record_goto): New function.
	(cmd_record_goto): Use it.  Now static.
	* record.h (record_goto): Declare.
	(cmd_record_goto): Remove declaration.
	* target-delegates.c: Rebuild.
	* target.h (struct target_ops) <to_get_bookmark,
	to_goto_bookmark>: Make parameter const.
2014-06-26 09:14:16 -06:00
Tom Tromey fee354eeef constify to_disconnect
This constifies an parameter of to_disconnect and updates
target_disconnect as well.

2014-06-16  Tom Tromey  <tromey@redhat.com>

	* target.h (struct target_ops) <to_disconnect>: Make parameter
	const.
	(target_disconnect): Update.
	* target.c (target_disconnect): Make "args" const.
	* target-delegates.c: Rebuild.
	* remote.c (remote_disconnect): Update.
	* record.h (record_disconnect): Update.
	* record.c (record_disconnect): Update.
	* inf-child.c (inf_child_disconnect): Update.
2014-06-16 10:29:17 -06:00
Markus Metzger 0b722aec57 record-btrace: extend unwinder
Extend the always failing unwinder to provide the PC based on the call
structure detected in the branch trace.

The unwinder supports normal frames and tailcall frames.
Inline frames are not supported.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* record.h (record_btrace_frame_unwind)
	(record_btrace_tailcall_frame_unwind): New declarations.
	* dwarf2-frame: Include record.h
	(dwarf2_frame_cfa): Throw an error for btrace frames.
	* record-btrace.c: Include hashtab.h.
	(btrace_get_bfun_name): New.
	(btrace_call_history): Call btrace_get_bfun_name.
	(struct btrace_frame_cache): New.
	(bfcache): New.
	(bfcache_hash, bfcache_eq, bfcache_new): New.
	(btrace_get_frame_function): New.
	(record_btrace_frame_unwind_stop_reason): Allow unwinding.
	(record_btrace_frame_this_id): Compute own id.
	(record_btrace_frame_prev_register): Provide PC, throw_error
	for all other registers.
	(record_btrace_frame_sniffer): Detect btrace frames.
	(record_btrace_tailcall_frame_sniffer): New.
	(record_btrace_frame_dealloc_cache): New.
	(record_btrace_frame_unwind): Add new functions.
	(record_btrace_tailcall_frame_unwind): New.
	(_initialize_record_btrace): Allocate cache.
	* btrace.c (btrace_clear): Call reinit_frame_cache.
	* NEWS: Announce it.

testsuite/
	* gdb.btrace/record_goto.exp: Add backtrace test.
	* gdb.btrace/tailcall.exp: Add backtrace test.
2014-01-16 13:09:42 +01:00
Markus Metzger 8710b7097e record-btrace: optionally indent function call history
Add a new modifier /c to the "record function-call-history" command to
indent the function name based on its depth in the call stack.

Also reorder the optional fields to have the indentation at the very beginning.
Prefix the insn range (/i modifier) with "inst ".
Prefix the source line (/l modifier) with "at ".
Change the range syntax from "begin-end" to "begin,end" to allow copy&paste to
the "record instruction-history" and "list" commands.

Adjust the respective tests and add new tests for the /c modifier.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* record.h (enum record_print_flag)
	<record_print_indent_calls>: New.
	* record.c (get_call_history_modifiers): Recognize /c modifier.
	(_initialize_record): Document /c modifier.
	* record-btrace.c (btrace_call_history): Add btinfo parameter.
	Reorder fields.  Optionally indent the function name.  Update
	all users.
	* NEWS: Announce changes.

testsuite/
	* gdb.btrace/function_call_history.exp: Fix expected field
	order for "record function-call-history".
	Add new tests for "record function-call-history /c".
	* gdb.btrace/exception.cc: New.
	* gdb.btrace/exception.exp: New.
	* gdb.btrace/tailcall.exp: New.
	* gdb.btrace/x86-tailcall.S: New.
	* gdb.btrace/x86-tailcall.c: New.
	* gdb.btrace/unknown_functions.c: New.
	* gdb.btrace/unknown_functions.exp: New.
	* gdb.btrace/Makefile.in (EXECUTABLES): Add new.

doc/
	* gdb.texinfo (Process Record and Replay): Document new /c
	modifier accepted by "record function-call-history".
	Add /i modifier to "record function-call-history" example.
2014-01-16 13:03:41 +01:00
Pedro Alves 8213266aea Fix "is a record target open" checks.
RECORD_IS_USED and record_full_open look at current_target.to_stratum
to determine whether a record target is in use.  This is wrong because
arch_stratum is greater than record_stratum, so if an arch_stratum
target is pushed, RECORD_IS_USED and record_full_open will miss it.

To fix this, we can use the existing find_record_target instead, which
looks up for a record stratum target across the target stack.  Since
that means exporting find_record_target in record.h, RECORD_IS_USED
ends up redundant, so the patch eliminates it.

That exercise then reveals other issues:

- adjust_pc_after_break is gating record_full_... calls based on
RECORD_IS_USED.  But, record_full_ calls shouldn't be made when
recording with the record-btrace target.  So this adds a new
record_full_is_used predicate to be used in that spot.

- record_full_open says "Process record target already running", even
if the recording target is record-btrace ("process record" is the
original complete name of the record-full target).  record_btrace_open
only says "The process is already being recorded." and does not
suggest "record stop", like record-full does.  The patch factors out
and merges that error to a new record_preopen function that all record
targets call in their open routine.

Tested on x86_64 Fedora 17.

gdb/
2014-01-14  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* infrun.c (use_displaced_stepping): Use find_record_target
	instead of RECORD_IS_USED.
	(adjust_pc_after_break): Use record_full_is_used instead of
	RECORD_IS_USED.
	* record-btrace.c (record_btrace_open): Call record_preopen
	instead of checking RECORD_IS_USED.
	* record-full.c (record_full_shortname)
	(record_full_core_shortname): New globals.
	(record_full_is_used): New function.
	(find_full_open): Call record_preopen instead of checking
	RECORD_IS_USED.
	(init_record_full_ops): Set the target's shortname to
	record_full_shortname.
	(init_record_full_core_ops): Set the target's shortname to
	record_full_core_shortname.
	* record-full.h (record_full_is_used): Declare.
	* record.c (find_record_target): Make extern.
	(record_preopen): New function.
	* record.h (RECORD_IS_USED): Delete macro.
	(find_record_target, record_preopen): Declare functions.
2014-01-14 16:12:19 +00:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Tom Tromey 52554a0e32 constify to_detach
This patch constifies the target_ops method to_detach.

This is a small cleanup, but also, I think, a bug-prevention fix,
since gdb already acts as if the "args" argument here was const.

In particular, top.c:quit_force calls kill_or_detach via
iterate_over_inferiors.  kill_or_detach calls target_detach, passing
the same argument each time.  So, if one of these methods was not
const-correct, then kill_or_detach would change its behavior in a
strange way.

I could not build every target I modified in this patch.  I've
inspected them all by hand, though.  Many targets do not use the
"args" parameter; a couple pass it to atoi; and a few pass it on to
the to_detach method of the target beneath.  The only code that
required a real change was in linux-nat.c, and that only needed the
introduction of a temporary variable for const-correctness.

2013-11-08  Tom Tromey  <tromey@redhat.com>

	* aix-thread.c (aix_thread_detach): Update.
	* corelow.c (core_detach): Update.
	* darwin-nat.c (darwin_detach): Update.
	* dec-thread.c (dec_thread_detach): Update.
	* gnu-nat.c (gnu_detach): Update.
	* go32-nat.c (go32_detach): Update.
	* inf-ptrace.c (inf_ptrace_detach): Update.
	* inf-ttrace.c (inf_ttrace_detach): Update.
	* linux-fork.c (linux_fork_detach): Update.
	* linux-fork.h (linux_fork_detach): Update.
	* linux-nat.c (linux_nat_detach): Update.  Introduce "tem"
	local for const-correctness.
	* linux-thread-db.c (thread_db_detach): Update.
	* monitor.c (monitor_detach): Update.
	* nto-procfs.c (procfs_detach): Update.
	* procfs.c (procfs_detach): Update.
	* record.c (record_detach): Update.
	* record.h (record_detach): Update.
	* remote-m32r-sdi.c (m32r_detach): Update.
	* remote-mips.c (mips_detach): Update.
	* remote-sim.c (gdbsim_detach): Update.
	* remote.c (remote_detach_1, remote_detach)
	(extended_remote_detach): Update.
	* sol-thread.c (sol_thread_detach): Update.
	* target.c (target_detach): Make "args" const.
	(init_dummy_target): Update.
	* target.h (struct target_ops) <to_detach>: Make argument const.
	(target_detach): Likewise.
	* windows-nat.c (windows_detach): Update.
2013-11-08 09:38:41 -07:00
Markus Metzger 1e038f67a9 record: upcase record_print_flag enumeration constants
* record.h (record_print_flag) <record_print_src_line,
	record_print_insn_range>: Rename into ...
	(record_print_flag) <record_print_src_line,
	record_print_insn_range>: ... this.  Update all users.
2013-09-02 15:06:11 +00:00
Markus Metzger 15984c13c7 Add command to print the function names from recorded instructions.
This command provides a quick high-level overview over the recorded execution
log at function granularity without having to reverse-step.

gdb/
	* target.c (target_call_history, target_call_history_from,
	target_call_history_range): New.
	* target.h (target_ops) <to_call_history, to_call_history_from,
	to_call_history_range>: New fields.
	(target_call_history, target_call_history_from,
	target_call_history_range): New declaration.
	* record.c (get_call_history_modifiers, cmd_record_call_history,
	record_call_history_size): New.
	(_initialize_record): Add the "record function-call-history" command.
	Add "set/show record function-call-history-size" commands.
	* record.h (record_print_flag): New.
2013-03-11 08:50:05 +00:00
Markus Metzger 7c1687a966 Provide default target methods for record targets that are likely to be shared
between different record targets.

gdb/
	* record.h (record_disconnect): New.
	(record_detach): New.
	(record_mourn_inferior): New.
	(record_kill): New.
	* record-full.c (record_disconnect, record_detach,
	record_mourn_inferior, record_kill): Move to...
	* record.c: ...here.
	(DEBUG): New.
	(record_stop): New.
	(record_unpush): New.
	(cmd_record_stop): Call record_stop. Replace unpush_target
	call with record_unpush call.
	(record_disconnect, record_detach): Assert that the target
	is of record stratum. Call record_unpush, record_stop, and
	DEBUG.
	(record_mourn_inferior, record_kill): Assert that the target
	is of record stratum. Call record_unpush and DEBUG.
2013-03-11 08:47:10 +00:00
Markus Metzger d02ed0bbfa Split record.h into record.h and record-full.h.
Split record.c into record.c and record-full.c.

The split leaves the command part in record.c and moves the target part into
record-full.c.

gdb/
	* record.h: Split into this and ...
	* record-full.h: ... this.
	* record.c: Split into this and ...
	* record-full.c: ... this.
	* target.h (target_ops): Add new fields to_info_record,
	to_save_record, to_delete_record, to_record_is_replaying,
	to_goto_record_begin, to_goto_record_end, to_goto_record.
	(target_info_record): New.
	(target_save_record): New.
	(target_supports_delete_record): New.
	(target_delete_record): New.
	(target_record_is_replaying): New.
	(target_goto_record_begin): New.
	(target_goto_record_end): New.
	(target_goto_record): New.
	* target.c (target_info_record): New.
	(target_save_record): New.
	(target_supports_delete_record): New.
	(target_delete_record): New.
	(target_record_is_replaying): New.
	(target_goto_record_begin): New.
	(target_goto_record_end): New.
	(target_goto_record): New.
	* record.h: Declare struct cmd_list_element.
	(record_cmdlist): New declaration.
	(set_record_cmdlist): New declaration.
	(show_record_cmdlist): New declaration.
	(info_record_cmdlist): New declaration.
	(cmd_record_goto): New declaration.
	* record.c: Remove unnecessary includes.
	Include inferior.h.
	(cmd_record_goto): Remove declaration.
	(record_cmdlist): Now extern. Initialize.
	(set_record_cmdlist): Now extern. Initialize.
	(show_record_cmdlist): Now extern. Initialize.
	(info_record_cmdlist): Now extern. Initialize.
	(find_record_target): New.
	(require_record_target): New.
	(cmd_record_start): Update.
	(cmd_record_delete): Remove target-specific code.
	Call target_delete_record.
	(cmd_record_stop): Unpush any record target.
	(set_record_insn_max_num): Move to record-full.c
	(set_record_command): Add comment.
	(show_record_command): Add comment.
	(info_record_command): Update comment.
	Remove target-specific code.
	Call the record target's to_info_record.
	(cmd_record_start): New.
	(cmd_record_goto): Now extern.
	Remove target-specific code.
	Call target_goto_begin,  target_goto_end, or target_goto.
	(_initialize_record): Move record target ops initialization to
	record-full.c.
	Change "record" command help text.
	Move "record restore", "record set", and "record show" commands to
	record-full.c.
	* Makefile.in (SFILES): Add record-full.c.
	(HFILES_NO_SRCDIR): Add record-full.h.
	(COMMON_OBS): Add record-full.o.
	* amd64-linux-tdep.c: Include record-full.h instead of record.h.
	* arm-tdep.c: Include record-full.h.
	* i386-linux-tdep.c: Include record-full.h instead of record.h.
	* i386-tdep.c: Include record-full.h.
	* infrun.c: Include record-full.h.
	* linux-record.c: Include record-full.h.
	* moxie-tdep.c: Include record-full.h.
	* record-full.c: Include record-full.h.
	Change module comment.
	(set_record_full_cmdlist): New.
	(show_record_full_cmdlist): New.
	(record_full_cmdlist): New.
	(record_goto_insn): New declaration.
	(record_save): New declaration.
	(record_check_insn_num): Change query string.
	(record_info): New.
	(record_delete): New.
	(record_is_replaying): New.
	(record_goto_entry): New.
	(record_goto_begin): New.
	(record_goto_end): New.
	(record_goto): New.
	(init_record_ops): Update.
	(init_record_core_ops): Update.
	(cmd_record_save): Rename to record_save. Remove target and arg checks.
	(cmd_record_start): New.
	(set_record_insn_max_num): Moved from record.c
	(set_record_full_command): New.
	(show_record_full_command): New.
	(_initialize_record_full): New.
2013-03-11 08:42:55 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Yao Qi ccce17b060 gdb/
* dwarf2loc.c (entry_values_debug): Add 'unsigned'.
	(_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* dwarf2loc.h: Update the declaration of 'entry_values_debug'.
	* dwarf2read.c (dwarf2_die_debug): Add 'unsigned'.
	(_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'.
	(_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* frame.c (frame_debug): Add 'unsigned'.
	(_intialize_frame): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* frame.h: Update the declaration of 'frame_debug'.
	* gdbtypes.c (overload_debug): Add 'unsigned'.
	(_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* inferior.h: Update declaration of 'debug_infrun'.
	* infrun.c (debug_infrun): Add 'unsigned'.
	(_initialize_infrun): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* jit.c (jit_debug): Add 'unsigned'.
	(_initialize_jit): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* linux-nat.c (debug_linux_nat): Add 'unsigned'.
	(_initialize_linux_nat): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* linux-thread-db.c (libthread_db_debug): Add 'unsigned'.
	(_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* machoread.c (mach_o_debug_level): Add 'unsigned'.
	(_initialize_machoread): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'.
	* microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'.
	(_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd
	intead of add_setshow_zinteger_cmd.
	* mips-tdep.c (mips_debug): Add 'unsigned'.
	(_initialize_mips_tdep): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* monitor.c (monitor_debug): Add 'unsigned'.
	(_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* observer.c (observer_debug): Add 'unsigned'.
	(_initialize_observer): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* parse.c (expressiondebug): Add 'unsigned'.
	(_initialize_parse): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* record.c (record_debug): Add 'unsigned'.
	(_initialize_record): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* record.h: Update the declaration of 'record_debug'.
	* stap-probe.c (stap_expression_debug): Add 'unsigned'.
	(_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* serial.c (global_serial_debug_p): Add 'unsigned'.
	(_initialize_serial): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'.
	(_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* solib-frv.c (solib_frv_debug): Add 'unsigned'.
	(_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* target.c (targetdebug): Add 'unsigned'.
	(initialize_targets): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* valops.c (overload_debug): Add 'unsigned'.
	* varobj.c (varobjdebug): Add 'unsigned'.
	(_initialize_varobj): Call add_setshow_zuinteger_cmd instead of
	add_setshow_zinteger_cmd.
	* xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'.
	(_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.

	* arch-utils.h: Remove the declaration of 'gdbarch_debug'.
	* gdbarch.sh (gdbarch_debug): Add 'unsigned'.
	(extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd
	instead of add_setshow_zinteger_cmd.
	* gdbarch.c, gdbarch.h: Re-generated.
2012-08-02 09:36:40 +00:00
Pedro Alves 4ffa4fc748 2012-07-20 Pedro Alves <palves@redhat.com>
* i386-tdep.c (i386_record_modrm, i386_record_lea_modrm_addr)
	(i386_process_record): Use record_read_memory.
	* record.c (record_read_memory): New function.
	(record_arch_list_add_mem, record_exec_insn): Use
	record_read_memory.
	* record.h (record_read_memory): Declare.
2012-07-20 11:22:32 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Hui Zhu bb08c43207 2010-06-22 Hui Zhu <teawater@gmail.com>
* i386-tdep.c (i386_record_lea_modrm): Change warning to query.
	(i386_process_record): Ditto.
	* record.c (record_memory_query): New variable.
	(_initialize_record): New command "set record memory-query".
	* record.h (record_memory_query): New extern.

2010-06-22  Hui Zhu  <teawater@gmail.com>

	* gdb.texinfo: (Process Record and Replay): Add documentation
	for command "set record memory-query".
2010-06-22 02:15:46 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Hui Zhu 69d05d3898 Process record and replay target.
* Makefile.in (SFILES): Add record.c.
(COMMON_OBS): Add record.o.
* record.c, record.h: New file.
2009-04-30 02:58:37 +00:00