Since bfd dropped support for SH-5, there's no point in keeping it in
GDB either.
This restores --enable-targets=all builds.
gdb/ChangeLog:
2018-04-16 Pedro Alves <palves@redhat.com>
* MAINTAINERS (sh): Remove.
* Makefile.in (ALL_TARGET_OBS): Remove sh64-tdep.o.
(HFILES_NO_SRCDIR): Remove sh64-tdep.h.
(ALLDEPFILES): Remove sh64-tdep.c.
* NEWS: Mentions that support for SH-5/SH64 is removed.
* configure.tgt (sh*-*-linux*): Remove reference to sh64-tdep.o.
(sh*-*-openbsd*): Ditto.
(sh64-*-elf*): Remove.
(sh*): Remove.
* regcache.c (cooked_write_test): Remove bfd_mach_sh5 case.
* sh-linux-tdep.c: Remove reference to bfd_mach_sh5.
* sh-tdep.c: No longer include "sh64-tdep.h".
(sh_gdbarch_init): Remove reference to bfd_mach_sh5.
* sh64-tdep.c, sh64-tdep.h: Remove files.
Support for m88k was fully removed from bfd, which broke gdb
--enable-targets=all builds:
> gdb/m88k-tdep.c: In function void _initialize_m88k_tdep():
> gdb/m88k-tdep.c:867:21: error: bfd_arch_m88k was not declared in this scope
> gdbarch_register (bfd_arch_m88k, m88k_gdbarch_init, NULL);
There's no point in keeping GDB support for OpenBSD/m88k with no bfd
support, so this commit simply removes the port.
gdb/ChangeLog:
2018-04-16 Pedro Alves <palves@redhat.com>
* MAINTAINERS: Remove m88k.
* Makefile.in (ALL_TARGET_OBS): Remove m88k-tdep.o.
(HFILES_NO_SRCDIR): Remove m88k-tdep.h.
(ALLDEPFILES): Remove m88k-bsd-nat.c and m88k-tdep.c.
* NEWS: Mention that support for OpenBSD/m88k was removed.
* configure.host (m88*-*-*): Remove support.
* configure.nat (m88k-*-*): Remove support.
* configure.tgt (m88*-*-openbsd*): Remove.
* m88k-bsd-nat.c, m88k-tdep.c, m88k-tdep.h: Delete.
We get this error when doing a build with a single amd64 target (the
default when doing just ./configure on x86-64 GNU/Linux):
/home/simark/src/binutils-gdb/gdb/i386-tdep.c:4431: error: undefined reference to 'x86_in_indirect_branch_thunk(unsigned long, char const**, int, int)'
/home/simark/src/binutils-gdb/gdb/amd64-tdep.c:3045: error: undefined reference to 'x86_in_indirect_branch_thunk(unsigned long, char const**, int, int)'
The problem is that commit
1d509aa625 ("infrun: step through indirect branch thunks")
missed adding x86-tdep.o to the list of object file included in an amd64
or i386 build. The problem is not seen with --enable-targets=all
because that file is included in ALL_TARGET_OBS.
Built-tested using:
* --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
* --host=armv7-rpi2-linux-gnueabihf --target=x86_64-pc-linux-gnu
gdb/ChangeLog:
* configure.tgt (x86_tobjs): New variable.
(amd64_tobjs, i386_tobjs): Use it.
Since only the first 32 bits of input operand are used for tpause and
umwait, the REX.W bit is skipped. Both 32-bit registers and 64-bit
registers are allowed.
gas/
* testsuite/gas/i386/x86-64-waitpkg.s: Add 32-bit registers
tests for tpause and umwait.
* testsuite/gas/i386/x86-64-waitpkg-intel.d: Updated.
* testsuite/gas/i386/x86-64-waitpkg.d: Likewise.
opcodes/
* i386-dis.c (prefix_table): Replace Em with Edq on tpause and
umwait.
* i386-opc.tbl: Allow 32-bit registers for tpause and umwait in
64-bit mode.
* i386-tbl.h: Regenerated.
When checking a R_ARM_TARGET[12] relocation, we need a valid target
pointer, but the garbage collection code was passing a NULL instead.
gold/
PR gold/23046
* gc.h (gc_process_relocs): Pass target to
scan.global_reloc_may_be_function_pointer.
max-page-size only matters for demand paged executables or shared
libraries, and the ideal size is the largest value used by your
operating system. Values larger than necessary just waste file space
and memory. common-page-size also affects file and memory size,
trading a possible small increase in file size for a decrease in
memory size when the operating system is using a common-page-size
page. With a powerpc max-page-size of 64k and common-page-size of 4k
many executables will use no more memory pages when the system page
size is 4k than an executable linked with -z max-page-size=0x1000,
yet will still run on a system using 64k pages. However, when running
on a system using 64k pages relro protection will not be completely
effective.
Due to the relro problem, powerpc binutils has been using a default
common-page-size of 64k since 2014-12-18 (git commit 04c6a44c7),
leading to complaints about increased file and memory sizes. People
not using relro do have a valid reason to complain..
So this patch introduces an extra back-end value to use as the default
for common-page-size when generating relro executables, and enables
the support for powerpc. Non relro executables will now be generated
with a default common-page-size of 4k.
bfd/
* elf-bfd.h (struct elf_backend_data): Add relropagesize.
* elfxx-target.h (ELF_RELROPAGESIZE): Provide default and
sanity test.
(elfNN_bed): Init relropagesize.
* bfd.c (bfd_emul_get_commonpagesize): Add boolean param to
select relropagesize.
* elf32-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
(ELF_MINPAGESIZE): Don't define.
* elf64-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
* bfd-in2.h: Regenerate.
ld/
* ldmain.c (main): Move config.maxpagesize and
config.commonpagesize initialization to..
* ldemul.c (after_parse_default): ..here.
* testsuite/ld-powerpc/ppc476-shared.d: Pass -z common-page-size.
* testsuite/ld-powerpc/ppc476-shared2.d: Likewise.
The default max-page-size on ppc32 has been 64k since 1995-02-15 (git
commit bcbe2c71). There was a change committed 2003-07-12 to chose a
4k page if __QNXTARGET__ is defined, but that particular commit was
from an earlier posted patch
https://sourceware.org/ml/binutils/2003-07/msg00211.html that only
made the change effective for arm, rather than the later one
https://sourceware.org/ml/binutils/2003-07/msg00220.html that also
changed powerpc and sh..
Since the __QNXTARGET__ #ifdef in elf32-ppc.c is ineffective unless
the user defines it in his or her CFLAGS, I'm removing that code.
* elf32-ppc.c (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Don't depend
on __QNXTARGET__ define.
Enabling shared lib tests showed the powerpc-lynxos target is broken,
and has been for a long time. The breakage happened in a 2005-05-07
patch of mine, git commit 3b36f7e62, I think. There have been no bug
reports I recall so it seems the target is dead. powerpc-windiss is
similarly broken.
This patch fixes the breakage, and puts the targets on the obsolete
list.
bfd/
* config.bfd: Add powerpc-*-lynxos* and powerpc-*-windiss*
to obsolete list.
ld/
* emulparams/elf32ppcwindiss.sh: Rewrite to use elf32ppc.sh.
* emulparams/ppclynx.sh: Likewise.
The GDB commands "info variables", "info functions", and "info types" show
the appropriate list of definitions matching the given pattern. They also
group them by source files. But no line numbers within these source files
are shown.
The line number information is particularly useful to the user when a
simple "grep" doesn't readily point to a definition. This is often the
case when the definition involves a macro, occurs within a namespace, or
when the identifier appears very frequently in the source file.
This patch enriches the printout of these commands by the line numbers and
adjusts affected test cases to the changed output where necessary. The
new output looks like this:
(gdb) i variables
All defined variables:
File foo.c:
3: const char * const foo;
1: int x;
The line number is followed by a colon and a tab character, which is then
followed by the symbol definition. If no line number is available, the
tab is printed out anyhow, so definitions line up.
gdb/ChangeLog:
* symtab.c (print_symbol_info): Precede the symbol definition by
the line number when available.
* NEWS: Advertise this enhancement.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Mention the fact that "info
variables/functions/types" show source files and line numbers.
gdb/testsuite/ChangeLog:
* gdb.ada/info_types.exp: Adjust expected output to the line
numbers now printed by "info var/func/type".
* gdb.base/completion.exp: Likewise.
* gdb.base/included.exp: Likewise.
* gdb.cp/cp-relocate.exp: Likewise.
* gdb.cp/cplusfuncs.exp: Likewise.
* gdb.cp/namespace.exp: Likewise.
* gdb.dwarf2/dw2-case-insensitive.exp: Likewise.
Add new set/show commands to set the processor that is used for enabling
errata workarounds when decoding branch trace.
The general format is "<vendor>:<identifier>" but we also allow two
special values "auto" and "none".
The default is "auto", which is the current behaviour of having GDB
determine the processor on which the trace was recorded.
If that cpu is not known to the trace decoder, e.g. when using an old
decoder on a new system, decode may fail with "unknown cpu". In most
cases it should suffice to 'downgrade' decode to assume an older cpu.
Unfortunately, we can't do this automatically.
The other special value, "none", disables errata workarounds.
gdb/
* NEWS (New options): announce set/show record btrace cpu.
* btrace.c: Include record-btrace.h.
(btrace_compute_ftrace_pt): Skip enabling errata workarounds if
the vendor is unknown.
(btrace_compute_ftrace_1): Add cpu parameter. Update callers.
Maybe overwrite the btrace configuration's cpu.
(btrace_compute_ftrace): Add cpu parameter. Update callers.
(btrace_fetch): Add cpu parameter. Update callers.
(btrace_maint_update_pt_packets): Call record_btrace_get_cpu.
Maybe overwrite the btrace configuration's cpu. Skip enabling
errata workarounds if the vendor is unknown.
* python/py-record-btrace.c: Include record-btrace.h.
(recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history)
(recpy_bt_function_call_history): Call record_btrace_get_cpu.
* record-btrace.c (record_btrace_cpu_state_kind): New.
(record_btrace_cpu): New.
(set_record_btrace_cpu_cmdlist): New.
(record_btrace_get_cpu): New.
(require_btrace_thread, record_btrace_info)
(record_btrace_resume_thread): Call record_btrace_get_cpu.
(cmd_set_record_btrace_cpu_none): New.
(cmd_set_record_btrace_cpu_auto): New.
(cmd_set_record_btrace_cpu): New.
(cmd_show_record_btrace_cpu): New.
(_initialize_record_btrace): Initialize set/show record btrace cpu
commands.
* record-btrace.h (record_btrace_get_cpu): New.
testsuite/
* gdb.btrace/cpu.exp: New.
doc/
* gdb.texinfo: Document set/show record btrace cpu.
Alan Hayward pointed out a typo in the output of "set record btrace" that
I took from "set record". Fix the original.
gdb/
* record.c (set_record_command): Fix typo in message.
Instead of giving a message that "set record btrace" needs a sub-command,
GDB crashed. Fix it. A regression test comes with the next patch.
gdb/
* record-btrace.c (cmd_set_record_btrace): Print sub-commands.
With version 7.3 GCC supports new options
-mindirect-branch=<choice>
-mfunction-return=<choice>
The choices are:
keep behaves as before
thunk jumps through a thunk
thunk-external jumps through an external thunk
thunk-inline jumps through an inlined thunk
For thunk and thunk-external, GDB would, on a call to the thunk, step into
the thunk and then resume to its caller assuming that this is an
undebuggable function. On a return thunk, GDB would stop inside the
thunk.
Make GDB step through such thunks instead.
Before:
Temporary breakpoint 1, main ()
at gdb.base/step-indirect-call-thunk.c:37
37 x = apply (inc, 41);
(gdb) s
apply (op=0x80483e6 <inc>, x=41)
at gdb.base/step-indirect-call-thunk.c:29
29 return op (x);
(gdb)
30 }
After:
Temporary breakpoint 1, main ()
at gdb.base/step-indirect-call-thunk.c:37
37 x = apply (inc, 41);
(gdb) s
apply (op=0x80483e6 <inc>, x=41)
at gdb.base/step-indirect-call-thunk.c:29
29 return op (x);
(gdb)
inc (x=41) at gdb.base/step-indirect-call-thunk.c:23
23 return x + 1;
This is independent of the step-mode. In order to step into the thunk,
you would need to use stepi.
When stepping over an indirect call thunk, GDB would first step through
the thunk, then recognize that it stepped into a sub-routine and resume to
the caller (of the thunk). Not sure whether this is worth optimizing.
Thunk detection is implemented via gdbarch. I implemented the methods for
IA. Other architectures may run into unexpected fails.
The tests assume a fixed number of instruction steps to reach a thunk.
This depends on the compiler as well as the architecture. They may need
adjustments when we add support for more architectures. Or we can simply
drop those tests that cover being able to step into thunks using
instruction stepping.
When using an older GCC, the tests will fail to build and will be reported
as untested:
Running .../gdb.base/step-indirect-call-thunk.exp ...
gdb compile failed, \
gcc: error: unrecognized command line option '-mindirect-branch=thunk'
gcc: error: unrecognized command line option '-mfunction-return=thunk'
=== gdb Summary ===
# of untested testcases 1
gdb/
* infrun.c (process_event_stop_test): Call
gdbarch_in_indirect_branch_thunk.
* gdbarch.sh (in_indirect_branch_thunk): New.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* x86-tdep.h: New.
* x86-tdep.c: New.
* Makefile.in (ALL_TARGET_OBS): Add x86-tdep.o.
(HFILES_NO_SRCDIR): Add x86-tdep.h.
(ALLDEPFILES): Add x86-tdep.c.
* arch-utils.h (default_in_indirect_branch_thunk): New.
* arch-utils.c (default_in_indirect_branch_thunk): New.
* i386-tdep: Include x86-tdep.h.
(i386_in_indirect_branch_thunk): New.
(i386_elf_init_abi): Set in_indirect_branch_thunk gdbarch
function.
* amd64-tdep: Include x86-tdep.h.
(amd64_in_indirect_branch_thunk): New.
(amd64_init_abi): Set in_indirect_branch_thunk gdbarch function.
testsuite/
* gdb.base/step-indirect-call-thunk.exp: New.
* gdb.base/step-indirect-call-thunk.c: New.
* gdb.reverse/step-indirect-call-thunk.exp: New.
* gdb.reverse/step-indirect-call-thunk.c: New.
Since moving Rust enum handling into dwarf2read.c, some old code for
handling univariant enums in rust-lang.c has been obsolete. This
patch removes this code.
Tested on x86-64 Fedora 26, using rustc 1.23 (1.24 emits incorrect
DWARF for enums and so can't be used for this test).
2018-04-12 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_print_struct_def): Remove univariant code.
(rust_evaluate_subexp): Likewise.
This commit fixes a bit of rot in procfs.c caused by recent changes.
Specifically, the target_ops::to_detach change to pass down 'inferior
*' missed updating a forward declation, and the change to use
scoped_fd in more places missed removing one do_cleanups call.
src/gdb/procfs.c: In function ‘target_ops* procfs_target()’:
src/gdb/procfs.c:167:16: error: invalid conversion from ‘void (*)(target_ops*, const char*, int)’ to ‘void (*)(target_ops*, inferior*, int)’ [-fpermissive]
t->to_detach = procfs_detach;
^
src/gdb/procfs.c: In function ‘ssd* proc_get_LDT_entry(procinfo*, int)’:
src/gdb/procfs.c:1624:17: error: ‘old_chain’ was not declared in this scope
do_cleanups (old_chain);
^
src/gdb/procfs.c: At global scope:
src/gdb/procfs.c:90:13: error: ‘void procfs_detach(target_ops*, const char*, int)’ declared ‘static’ but never defined [-Werror=unused-function]
static void procfs_detach (struct target_ops *, const char *, int);
^
src/gdb/procfs.c:1923:1: error: ‘void procfs_detach(target_ops*, inferior*, int)’ defined but not used [-Werror=unused-function]
procfs_detach (struct target_ops *ops, inferior *inf, int from_tty)
^
gdb/ChangeLog:
2018-04-12 Pedro Alves <palves@redhat.com>
* procfs.c (procfs_detach): Make forward declaration's prototype
match definition's protototype.
(proc_get_LDT_entry): Remove stale do_cleanups call.
Commit
b2e586e ("Defer breakpoint reset when cloning progspace for fork
child")
fixed following fork childs when the executable is position-independent.
This patch adds a little test for it.
gdb/testsuite/ChangeLog:
* gdb.base/pie-fork.c: New file.
* gdb.base/pie-fork.exp: New file.
Building with --coverage pointed out that there was no Rust test for
initializing a structure using the ".." initializer. This patch adds
such a test.
Regression tested on x86-64 Fedora 26.
2018-04-11 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Add test for ".." struct initializer.