Yao Qi [Wed, 17 Jan 2018 11:19:03 +0000 (11:19 +0000)]
Relax gdb.compile/compile.exp to match the address printed for frame
One test in gdb.compile/compile.exp passes on one fedora builder,
bt
#0 0x00007ffff7ff43f6 in _gdb_expr (__regs=0x7ffff7ff2000) at gdb
command line:1^M
#1 <function called from gdb>^M
#2 main () at /home/gdb-buildbot/fedora-x86-64-1/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.compile/compile.c:106^M
(gdb) PASS: gdb.compile/compile.exp: bt
but fails on my machine with gcc trunk,
bt^M
#0 _gdb_expr (__regs=0x7ffff7ff3000) at gdb command line:1^M
#1 <function called from gdb>^M
#2 main () at gdb/testsuite/gdb.compile/compile.c:106^M
(gdb) FAIL: gdb.compile/compile.exp: bt
The test should be tweaked to match both cases (pc in the start of line
vs pc in the middle of line). Note that I am not clear that why libcc1
emits debug info this way so that the address is in the middle of line.
gdb/testsuite:
2018-01-17 Yao Qi <yao.qi@linaro.org>
* gdb.compile/compile.exp: Match the address printed for
frame in the output of command "bt".
Alan Modra [Wed, 17 Jan 2018 10:54:32 +0000 (21:24 +1030)]
Warning fix
* elf64-ppc.c (ppc64_elf_build_stubs): Silence gcc warning.
Alan Modra [Wed, 17 Jan 2018 03:49:08 +0000 (14:19 +1030)]
PowerPC PLT speculative execution barriers
Spectre variant 2 mitigation for PowerPC and PowerPC64.
bfd/
* elf32-ppc.c (GLINK_ENTRY_SIZE): Handle speculation barrier.
(CRSETEQ, BEQCTRM): Define.
(is_nonpic_glink_stub): Don't check bctr.
(ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
(ppc_elf_relax_section): Size speculation barrier.
(output_bctr): New function.
(write_glink_stub): Use output_bctr.
(ppc_elf_relocate_section): Use output_bctr for long branch stub.
(ppc_elf_finish_dynamic_symbol): Likewise.
(ppc_elf_finish_dynamic_sections): Use output_bctr.
* elf32-ppc.h (struct ppc_elf_params): Add speculate_indirect_jumps.
* elf64-ppc.c (CRSETEQ, BEQCTRM, BEQCTRLM): Define.
(GLINK_PLTRESOLVE_SIZE): Size speculation barrier.
(size_global_entry_stubs): Handle speculation barrier sizing.
(plt_stub_size): Likewise.
(output_bctr): New function.
(build_plt_stub, build_tls_get_addr_stub): Output speculation
barrier.
(ppc_build_one_stub): Likewise for ppc_stub_plt_branch.
(ppc_size_one_stub): Size speculation barrier in ppc_stub_plt_branch.
(build_global_entry_stubs): Output speculation barrier.
(ppc64_elf_build_stubs): Likewise in __glink_PLTresolve stub.
* elf64-ppc.h (struct ppc64_elf_params): Add speculate_indirect_jumps.
gold/
* options.h (speculate_indirect_jumps): New option.
* powerpc.cc (beqctrm, beqctrlm, crseteq): New insn constants.
(output_bctr): New function.
(Stub_table::plt_call_size): Add space for speculation barrier.
(Stub_table::branch_stub_size): Likewise.
(Output_data_glink::pltresolve_size): Likewise.
(Stub_table::do_write): Output speculation barriers.
ld/
* emultempl/ppc32elf.em (params): Init new field.
(OPTION_SPECULATE_INDIRECT_JUMPS): Define.
(OPTION_NO_SPECULATE_INDIRECT_JUMPS): Define.
(PARSE_AND_LIST_LONGOPTS): Handle new options.
(PARSE_AND_LIST_ARGS_CASES): Likewise.
(PARSE_AND_LIST_OPTIONS): Likewise.
* emultempl/ppc64elf.em (params): Init new field.
(OPTION_SPECULATE_INDIRECT_JUMPS): Define.
(OPTION_NO_SPECULATE_INDIRECT_JUMPS): Define.
(PARSE_AND_LIST_LONGOPTS): Handle --speculate-indirect-jumps.
(PARSE_AND_LIST_OPTIONS): Likewise.
(PARSE_AND_LIST_ARGS_CASES): Likewise.
* ld.texinfo (--no-plt-thread-safe): Correct itemx.
(--speculate-indirect-jumps): Document.
* testsuite/ld-powerpc/elfv2exe.d,
* testsuite/ld-powerpc/elfv2so.d,
* testsuite/ld-powerpc/relbrlt.d,
* testsuite/ld-powerpc/powerpc.exp: Disable plt alignment and
speculation barriers on various tests.
Alan Modra [Sat, 13 Jan 2018 08:23:41 +0000 (18:53 +1030)]
PowerPC PLT stub tidy
This is in preparation for the next patch adding Spectre variant 2
mitigation for PowerPC and PowerPC64. Besides tidying code involved
in stub output (to reduce the number of places where bctr is output),
the patch adds some user visible features:
1) PowerPC64 ELFv2 global entry stubs now are aligned under the
control of --plt-align, with a default alignment of 32 bytes.
2) PowerPC64 __glink_PLTresolve is no longer padded out with nops.
3) PowerPC32 PLT stubs are aligned under the control of --plt-align,
with the default alignment being 16 bytes as before.
4) The PowerPC32 branch/nop table emitted before __glink_PLTresolve
is now smaller in many cases. It was sized incorrectly when the
__tls_get_addr_opt stub was used, and unnecessarily included space
for local ifuncs.
bfd/
* elf32-ppc.c (GLINK_ENTRY_SIZE): Add parameters, handle
__tls_get_addr_opt, and alignment sizing.
(TLS_GET_ADDR_GLINK_SIZE): Delete.
(is_nonpic_glink_stub): Don't use GLINK_ENTRY_SIZE.
(ppc_elf_get_synthetic_symtab): Recognize stubs spaced at 4, 6,
or 8 insns.
(ppc_elf_link_hash_table_create): Init new ppc_elf_params field.
(allocate_dynrelocs): Use new GLINK_ENTRY_SIZE.
(ppc_elf_size_dynamic_sections): Likewise. Size branch table
by PLT reloc count.
(write_glink_stub): Handle __tls_get_addr_opt stub.
Pad out to size given by GLINK_ENTRY_SIZE.
(ppc_elf_relocate_section): Adjust write_glink_stub call.
(ppc_elf_finish_dynamic_symbol): Likewise.
(ppc_elf_finish_dynamic_sections): Write PLTresolve without using
insn array since so many need rewriting.
* elf32-ppc.h (struct ppc_elf_params): Add plt_stub_align.
* elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Rename from
GLINK_CALL_STUB_SIZE. Add htab param and evaluate to size without
nops. Adjust all uses.
(ppc64_elf_get_synthetic_symtab): Don't use GLINK_CALL_STUB_SIZE
in glink_vma calculation.
(struct ppc_link_hash_table): Add global_entry section pointer.
(create_linkage_sections): Create separate section for global
entry stubs.
(PPC_LO, PPC_HI, PPC_HA): Move earlier.
(size_global_entry_stubs): Handle sizing for aligned stubs.
(ppc64_elf_size_dynamic_sections): Handle global_entry alloc,
and don't stash end of glink branch table in rawsize.
(ppc_build_one_stub): Rewrite stub size calculations.
(build_global_entry_stubs): Use new section.
(ppc64_elf_build_stubs): Don't pad __glink_PLTresolve with nops.
Build lazy link stubs out to end of section. Build global entry
stubs in new section.
gold/
* options.h (plt_align): Support for PowerPC32 too.
* powerpc.cc (Stub_table::stub_align): Heed --plt-align for 32-bit.
(Stub_table::plt_call_size, branch_stub_size): Tidy.
(Stub_table::plt_call_align): Implement using stub_align.
(Output_data_glink::global_entry_align): New function.
(Output_data_glink::global_entry_off): New function.
(Output_data_glink::global_entry_address): Use global_entry_off.
(Output_data_glink::pltresolve_size): New function, replacing
pltresolve_size_ constant. Update all uses.
(Output_data_glink::add_global_entry): Align offset.
(Output_data_glink::set_final_data_size): Use global_entry_align.
(Stub_table::do_write): Don't pad __glink_PLTrelsolve with nops.
Tidy stub output. Use global_entry_off.
ld/
* emultempl/ppc32elf.em (params): Init new field.
(enum ppc32_opt): New enum to define OPTION_* values. Add
OPTION_PLT_ALIGN and OPTION_NO_PLT_ALIGN.
(PARSE_AND_LIST_LONGOPTS): Handle new options.
(PARSE_AND_LIST_ARGS_CASES): Likewise.
(PARSE_AND_LIST_OPTIONS): Likewise. Break up help output.
* emultempl/ppc64elf.em (ppc_add_stub_section): Init alignment
correctly for negative --plt-stub-align.
* testsuite/ld-powerpc/elfv2exe.d,
* testsuite/ld-powerpc/elfv2so.d,
* testsuite/ld-powerpc/relbrlt.d,
* testsuite/ld-powerpc/relbrlt.s,
* testsuite/ld-powerpc/tlsexe.d,
* testsuite/ld-powerpc/tlsexe.r,
* testsuite/ld-powerpc/tlsexe32.d,
* testsuite/ld-powerpc/tlsexe32.g,
* testsuite/ld-powerpc/tlsexe32.r,
* testsuite/ld-powerpc/tlsexetoc.d,
* testsuite/ld-powerpc/tlsexetoc.r,
* testsuite/ld-powerpc/tlsopt5_32.d,
* testsuite/ld-powerpc/tlsso.d,
* testsuite/ld-powerpc/tlstocso.d: Update for changed stub order.
GDB Administrator [Wed, 17 Jan 2018 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Tue, 16 Jan 2018 13:18:36 +0000 (14:18 +0100)]
binutils release procedure: Add AI to update branch name in crontab
binutils/ChangeLog:
* README-how-to-make-a-release: Add reminder to update the
branch name in gdbadmin's crontab on sourceware.
Nick Clifton [Tue, 16 Jan 2018 12:45:44 +0000 (12:45 +0000)]
Update translations for various binutils components.
ld * po/pt_BR.po: Updated Brazilian Portugese translation.
opcodes * po/pt_BR.po: Updated Brazilian Portugese translation.
* po/de.po: Updated German translation.
gas * po/fr.po: Updated French translation.
binutils* po/fr.po: Updated French translation.
Joel Brobecker [Tue, 16 Jan 2018 11:20:01 +0000 (12:20 +0100)]
Remove trailing spaces in binutils/README-how-to-make-a-release
binutils/ChangeLog:
* README-how-to-make-a-release: Remove trailing spaces.
Yao Qi [Tue, 16 Jan 2018 09:05:39 +0000 (09:05 +0000)]
Mark register unavailable when PTRACE_PEEKUSER fails
As described in PR 18749, GDB/GDBserver may get an error on accessing
memory or register because the thread may disappear. However, some
path doesn't expect the error. This patch fixes this problem by
marking the register unavailable when PTRACE_PEEKUSER fails instead
of throwing error.
gdb/gdbserver:
2018-01-16 Yao Qi <yao.qi@linaro.org>
PR gdb/18749
* linux-low.c (fetch_register): Call supply_register instead of
error.
GDB Administrator [Tue, 16 Jan 2018 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 15 Jan 2018 22:53:44 +0000 (14:53 -0800)]
RISC-V: Add support for addi that compresses to c.nop.
gas/
* testsuite/gas/riscv/c-zero-imm.s: Test addi that compresses to c.nop.
* testsuite/gas/riscv/c-zero-imm.d: Likewise.
opcodes/
* riscv-opc.c (match_c_nop): New.
(riscv_opcodes) <addi>: Handle an addi that compresses to c.nop.
Pedro Alves [Mon, 15 Jan 2018 20:03:20 +0000 (20:03 +0000)]
gdb/common/signals-state-save-restore.c: Fix typos
gdb/ChangeLog:
2018-01-15 Pedro Alves <palves@redhat.com>
* common/signals-state-save-restore.c
(save_original_signals_state): Fix typos.
Tom Tromey [Wed, 3 Jan 2018 18:12:34 +0000 (11:12 -0700)]
Fix scm-ports.exp regression
In https://sourceware.org/ml/gdb-patches/2017-12/msg00215.html, Jan
pointed out that the scalar printing patches caused a regression in
scm-ports.exp on x86.
What happens is that on x86, this:
set sp_reg [get_integer_valueof "\$sp" 0]
... ends up setting sp_reg to a negative value, because
get_integer_valueof uses "print/d":
print /d $sp
$1 = -11496
Then later the test suite does:
gdb_test "guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))" \
"= $sp_reg" \
"seek to \$sp"
... expecting this value to be identical to the saved $sp_reg value.
However it gets:
guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))
=
4294955800
"print" is just a wrapper for guile's format:
gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))"
The seek function returns a scm_t_off, the printing of which is
handled by guile, not by gdb.
Tested on x86-64 Fedora 26 using an ordinary build and also a -m32
build.
2018-01-15 Tom Tromey <tom@tromey.com>
* gdb.guile/scm-ports.exp (test_mem_port_rw): Use get_valueof to
compute sp_reg.
Cary Coutant [Mon, 15 Jan 2018 18:05:54 +0000 (10:05 -0800)]
Fix -fuse-ld option to accept string argument.
PR 22042 complained that garbage text was being printed in the help
for the -fuse-ld option; this was caused by passing an empty string
to the gettext() function, which sometimes returns garbage when passed
an empty string. The quick fix was to replace "" with NULL as the helparg,
but that changed the parsing of the option, as gold uses the helparg to
determine whether an option takes an argument. This patch adds a
non-empty helparg string to fix both problems.
gold/
PR gold/22694
* options.h (-fuse-ld): Add correct helparg.
Thomas Preud'homme [Mon, 15 Jan 2018 14:13:33 +0000 (14:13 +0000)]
[ARM] Add new macro for Thumb-only opcodes
Armv8-M Security Extensions introduced some Thumb-only opcodes
(eg. sg). These are defined using the TUE and TCE macros, setting the
Arm execution state related fields to 0/NULL.
This patch adds 2 new macros to avoid filling this field and clearly
identify Thumb-only instructions.
2018-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (ToC): Define macro.
(ToU): Likewise.
(insns): Make use of above macros for new instructions introduced in
Armv8-M.
Thomas Preud'homme [Mon, 15 Jan 2018 14:11:02 +0000 (14:11 +0000)]
[ARM] Enable conditional Armv8-M instructions
Newly introduced instructions common to ARMv8-M Baseline and Mainline
are currently all marked as unconditional. However, all instructions but
sg (ie. blxns, bxns, tt, ttt, tta, ttat, vlldm and vlstm) do actually
support conditional execution. This patch fixes the definition of these
instructions accordingly.
2018-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (insns): Make blxns, bxns, tt, ttt, tta, ttat, vlldm
and vlstm conditionally executable and reindent parameters.
* testsuite/gas/arm/archv8m-cmse-main.s: Add conditional version of
aforementionned instructions.
Thomas Preud'homme [Mon, 15 Jan 2018 14:09:28 +0000 (14:09 +0000)]
[ARM] No IT usage deprecation for ARMv8-M
Deprecations related to the use of the IT instruction introduced in
Armv8-A do not apply to Armv8-M Baseline and mainline. However the
warning logic do not distinguish between the various profiles and warn
whenever the architecture version is 8.
This patch adds a check to exclude M profile architectures from this
warning. This works as expected when -march is specified on the
command-line or a .arch/.cpu directive exist. However, in autodetection
mode the CPU/architecture targeted is only known once the instructions
have been all processed but this code is run when IT instruction is
processed. It is therefore not possible to distinguish between Armv8-M
and Armv8-A in that mode.
The approach chosen here is not to warn in autodetection mode. The udf.d
testcase that relied on that behavior to test deprecation warning for
Armv8-A is therefore updated to explicitely pass -march=armv8-a.
2018-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (it_fsm_post_encode): Do not warn if targeting M
profile architecture or if in autodetection mode. Clarify that
deprecation is for performance reason and concerns Armv8-A and Armv8-R.
* testsuite/gas/arm/armv8-ar-bad.l: Adapt to new IT deprecation warning
message.
* testsuite/gas/arm/armv8-ar-it-bad.l: Likewise.
* testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: Likewise.
* testsuite/gas/arm/udf.l: Likewise.
* testsuite/gas/arm/udf.d: Assemble for Armv8-A explicitely.
Szabolcs Nagy [Mon, 15 Jan 2018 13:06:45 +0000 (13:06 +0000)]
Fix gdb.texinfo more
Add incorrectly removed @pindex back.
gdb/doc/ChangeLog:
* gdb.texinfo (gdb-add-index man): Add pindex.
Nick Clifton [Mon, 15 Jan 2018 12:09:11 +0000 (12:09 +0000)]
Update Ukranian translations for bfd, binutils, gas, gold, ld and opcodes
Szabolcs Nagy [Mon, 15 Jan 2018 10:44:12 +0000 (10:44 +0000)]
Fix gdb.texinfo for old makeinfo (again)
With old makeinfo (version 4.13) the changes introduced in
commit
ba643918cf869fa0d064d733f69b453b6fe642ea
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Install and generate docs for gdb-add-index
fail to build with
gdb/doc/gdb.texinfo:2498: warning: `.' or `,' must follow @xref, not `@'.
gdb/doc/gdb.texinfo:2517: warning: `.' or `,' must follow @xref, not `@'.
gdb/doc/gdb.texinfo:43443: Node `gdb-add-index man' requires a sectioning command (e.g., @unnumberedsubsec).
gdb/doc/gdb.texinfo:43443: `gdb-add-index man' has no Up field (perhaps incorrect sectioning?).
gdb/doc/gdb.texinfo:43350: Next field of node `gdbinit man' not pointed to (perhaps incorrect sectioning?).
gdb/doc/gdb.texinfo:43443: This node (gdb-add-index man) has the bad Prev.
This patch fixes the warnings too.
gdb/doc/ChangeLog:
* gdb.texinfo (set cwd): Add period.
(gdb-add-index man): Move anchor.
GDB Administrator [Mon, 15 Jan 2018 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 14 Jan 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Sat, 13 Jan 2018 14:29:27 +0000 (14:29 +0000)]
Update notes on how to make a release
Nick Clifton [Sat, 13 Jan 2018 13:56:48 +0000 (13:56 +0000)]
Update pot files
Nick Clifton [Sat, 13 Jan 2018 13:31:12 +0000 (13:31 +0000)]
Bump version number to 2.30.51
bfd/
* version.m4: Bump version to 2.30.51
* configure: Regenerate.
binutils/
* configure: Regenerate.
gas/
* configure: Regenerate.
gprof/
* configure: Regenerate.
ld/
* configure: Regenerate.
opcodes/
* configure: Regenerate.
Nick Clifton [Sat, 13 Jan 2018 13:26:38 +0000 (13:26 +0000)]
Add note about 2.30 branch creation to changelogs
Nick Clifton [Sat, 13 Jan 2018 13:20:55 +0000 (13:20 +0000)]
Add 2.30 markers to NEWS files.
binutils/
* NEWS: Add marker for 2.30.
gas/
* NEWS: Add marker for 2.30.
ld/
* NEWS: Add marker for 2.30.
Cary Coutant [Sat, 13 Jan 2018 02:38:11 +0000 (18:38 -0800)]
Update gold version number to 1.15.
gold/
* NEWS: Add new features in 1.15.
* version.cc (version_string): Bump to 1.15.
GDB Administrator [Sat, 13 Jan 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Thu, 11 Jan 2018 18:58:10 +0000 (18:58 +0000)]
gdb/testsuite: Don't attempt tests if they fail to compile
In the gdb.base/whatis-ptype-typedefs.exp test, if the test program
fails to compile, don't run the tests.
gdb/testsuite/ChangeLog:
* gdb.base/whatis-ptype-typedefs.exp: Don't run tests if we failed
to prepare.
(prepare): Return 0 on error, 1 on success.
Sergio Durigan Junior [Thu, 11 Jan 2018 21:12:05 +0000 (16:12 -0500)]
Install and generate docs for gdb-add-index
The "gdb-add-index" script has been resurrected on:
commit
caf26be91a584ef141ac5d3cb31007731af8b8e3
Author: Samuel Bronson <naesten@gmail.com>
Date: Fri Nov 15 16:09:33 2013 -0500
Resurrect gdb-add-index as a contrib script
However, for some reason (I couldn't find it in the archives), only
the script has been checked-in; the Makefile parts responsible for
installing it in the system were left out. This commit fixes that, by
also resurrecting the Makefile and documentation bits.
This commit is part of our effort to upstream the local Fedora GDB
changes. With this commit, we'll only carry a very small
Fedora-specific modification to the script.
gdb/ChangeLog:
2017-01-12 Tom Tromey <tom@tromey.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (install-only): Install gdb-add-index.
gdb/doc/ChangeLog:
2017-01-12 Tom Tromey <tom@tromey.com>
Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.texinfo (Index Files): Mention gdb-add-index.
(gdb-add-index man): New section.
* Makefile.in (gdb-add-index.1): New rule to generate manpage
from gdb.texinfo.
John Baldwin [Fri, 12 Jan 2018 20:05:50 +0000 (12:05 -0800)]
Use the correct value for the offset of 'kve_protection'.
I had forgotten to convert the decimal output of 'ptype /o' to hex
(but still used a 0x prefix) for the KVE_PROTECTION constant defining
the offset of the 'kve_protection' field in the 'kinfo_vmentry'
structure. This resulted in garbage permissions for entries in 'info
proc mappings' for FreeBSD core dumps.
gdb/ChangeLog:
* fbsd-tdep.c (KVE_PROTECTION): Correct value.
Eric Christopher [Fri, 12 Jan 2018 19:05:58 +0000 (11:05 -0800)]
Apply:
2018-01-12 Sterling Augustine <saugustine@google.com>
* cref.cc (Cref_inputs::Cref_table_compare::operator): Add
conditionals and calls to is_forwarder.
Pedro Alves [Fri, 12 Jan 2018 18:52:39 +0000 (18:52 +0000)]
Add testcase for GDB hang fixed by previous commit
This adds a testcase for the previous commit. The regression was
related to in-line step overs. The reason we didn't see it on native
x86-64/s390 GNU/Linux testing is that native debugging uses displaced
stepping by default (because native debugging defaults to "maint set
target-non-stop on"), unlike remote debugging.
So in order to trigger the bug with native debugging as well, the
testcase disables displaced stepping explicitly.
Also, instead of using watchpoints to trigger the regression, the
testcase uses a breakpoint at address 0, which should be more
portable.
gdb/testsuite/ChangeLog:
2018-01-12 Pedro Alves <palves@redhat.com>
* gdb.base/continue-after-aborted-step-over.c: New.
* gdb.base/continue-after-aborted-step-over.exp: New.
Andreas Arnez [Fri, 12 Jan 2018 18:52:39 +0000 (18:52 +0000)]
Fix GDB hang with remote after error from resume
Since this commit --
Fix PR18360 - internal error when using "interrupt -a"
(https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=
c65d6b55)
-- the testsuite shows long delays on s390 with native-gdbserver when
executing certain tests, such as watchpoints.exp. These hangs have been
discussed before in the context of buildbot problems, see here:
https://sourceware.org/ml/gdb-patches/2017-12/msg00413.html
The problem can easily be triggered by stopping on a breakpoint, then
setting impossible watchpoints, and finally doing "continue". Then, after
having set the step-over state (in keep_going_pass_signal in infrun.c),
GDB tries to insert breakpoints and watchpoints into the inferior. This
fails, and the "continue" command is aborted. But the step-over state is
not cleared in this case, which causes future step-over attempts to be
skipped since GDB thinks that "we already have an in-line step-over
operation ongoing" (see start_step_over in infrun.c). Thus the next
"continue" just goes on to wait for events from the remote, which will
never occur.
The problem can also be reproduced on amd64 with native-gdbserver, using
the following change to watchpoints.exp:
-- >8 --
--- a/gdb/testsuite/gdb.base/watchpoints.exp
+++ b/gdb/testsuite/gdb.base/watchpoints.exp
@@ -61,2 +61,3 @@ with_test_prefix "before inferior start" {
gdb_test "watch ival3" ".*" ""
+ gdb_test "watch *(char \[256\] *) main"
-- >8 --
To fix the hang, this patch clears the step-over info when
insert_breakpoints has failed. Of course, with native-gdbserver the
watchpoints.exp test case still causes many FAILs on s390, because
gdbserver does not support watchpoints for that target. This is a
separate issue.
gdb/ChangeLog:
2018-01-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* infrun.c (keep_going_pass_signal): Clear step-over info when
insert_breakpoints fails.
Nick Clifton [Fri, 12 Jan 2018 17:52:38 +0000 (17:52 +0000)]
Add notes on how to make a branch and a pre-release snapshot.
* README-how-to-make-a-release: Add notes on how to make the
branch and prelease snapshot.
* BRANCHES: Add binutils-2_29-branch.
Jens Widell [Fri, 12 Jan 2018 13:16:17 +0000 (13:16 +0000)]
Optimize the performance of the group_setup function.
When processing a section that is a member of a group, the group
that contains it is looked up using a linear search. The resulting
O(n^2) complexity causes significant performance issues when
dealing with object files with very many groups.
By remembering the index of the last found group and restarting
the next search from that index, the search instead becomes O(n)
in common cases.
* elf.c (setup_group): Optimize search for group by remembering
last found group and restarting search at that index.
* elf-bfd.h (struct elf_obj_tdata): Add group_search_offset field.
Gunther Nikl [Fri, 12 Jan 2018 13:12:17 +0000 (13:12 +0000)]
Fix compile time warning building aout targeted architectures.
Occasionally I build an out-of-tree a.out target (m68k-amigaos). After
a system upgrade which included a newer compiler (clang 4) the build
produces warnings like this:
warning: macro expansion producing 'defined' has undefined behavior
[-Wexpansion-to-defined]
This is caused by the macro gas/config/aout_gnu.h:USE_EXTENDED_RELOC.
Since it is in a header file, the warning triggers for several files.
I am unsure what solution is preferable, thus I am suggesting two
patches:
a) keep the offending macro but define it explicitly to 0 and 1
b) replace the macro usage with its value where it is used.
Either patch removes the warning for clang. I did not check with a
recent GCC.
* gas/config/aout_gnu.h (USE_EXTENDED_RELOC): Explicitly
define to 0 and 1. Remove a dangling reference to "AMD 29000"
in a comment.
Alan Modra [Fri, 12 Jan 2018 10:40:48 +0000 (21:10 +1030)]
pr22374 function pointer initialization
When I added this test I said I'd look at fixing more targets.
That hasn't happened yet, so xfail to tidy results.
* testsuite/ld-elf/elf.exp: xfail "pr22374 function pointer
initialization" for currently failing targets.
Alan Modra [Fri, 12 Jan 2018 00:07:28 +0000 (10:37 +1030)]
Fix override of common symbols for a.out
The default should be bfd_link_common_skip_none, as in the original
patch at https://sourceware.org/ml/binutils/2002-07/msg00717.html
* aoutx.h (aout_link_check_ar_symbols): Remove default and handle
bfd_link_common_skip_none in switch.
Alan Modra [Fri, 12 Jan 2018 06:28:04 +0000 (16:58 +1030)]
Fixes for "Ignore dynamic references on forced local symbols"
PowerPC64 has its own mark_dynamic_ref, which needs the same change as
made by
d664fd41e1 to the generic ELF version. Some other targets
discard more than just .data, so allow for that too in expected ld
messages.
bfd/
PR ld/22649
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore dynamic
references on forced local symbols.
ld/
PR ld/22649
* testsuite/ld-elf/pr22649.msg: Allow other messages.
* testsuite/ld-elf/shared.exp: Check that --gc-sections is
supported before running ld/22649 tests.
Vlad Ivanov [Fri, 12 Jan 2018 09:25:11 +0000 (09:25 +0000)]
_bfd_mips_elf_final_link: Notify user about wrong .reginfo size
One of assertions in _bfd_mips_elf_final_link could be triggered by
a combination of input files and a linker script. This happens when
either the input doesn't contain .reginfo section or when this section
is oversized. This patch replaces the assertion with a more useful
error message.
* elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
.reginfo section has wrong size.
Nick Clifton [Fri, 12 Jan 2018 08:15:55 +0000 (08:15 +0000)]
Add -z undefs option to the ELF linker.
Currently we have no obvious way to revert the action of the "-z defs"
command line option. The "--unresolved-symbols=ignore-in-object-files"
does pretty much what is needed, but it is non-obvious and it also
touches the setting for reporting unresolved symbol references from
shared libraries. So I am proposing adding a "-z undefs" option to be
the inverse of "-z defs". (I thought that "-z nodefs" might be
confusing since it implies banning all definitions, rather than
allowing them).
In addition the description of the "-z defs" option in the linker
documentation is misleading in one place, where it says:
'defs'
Disallows undefined symbols in object files. Undefined
symbols in shared libraries are still allowed.
whereas later on it gets it right:
'-z defs'
Report unresolved symbol references from regular object files.
This is done even if the linker is creating a non-symbolic shared
library. The switch '--[no-]allow-shlib-undefined' controls the
behaviour for reporting unresolved references found in shared
libraries being linked in.
* emultempl/elf32.em (_handle_option): Add support for "-z undefs"
as the opposite of "-z defs".
* ld.texinfo: Document the new option. Update the description of
the -z defs option to make it clear that it does generate an error
if an undefined symbol reference is found in an object file whilst
creating a shared library.
* NEWS: Document this new feature.
H.J. Lu [Fri, 12 Jan 2018 04:46:01 +0000 (20:46 -0800)]
ld: Replace "-z textonly" with "-z separate-code"
Although they aren't passed to linker, we should get it right.
* testsuite/ld-elf/pr22393-2a.rd: Replace "-z textonly" with
"-z separate-code".
* testsuite/ld-elf/pr22393-2b.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
H.J. Lu [Fri, 12 Jan 2018 03:19:22 +0000 (19:19 -0800)]
x86-64: Add tests for -z separate-code -z max-page-size=0x1000
PR ld/22393
* testsuite/ld-x86-64/pr22393-3a.c: New file.
* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3b.c: Likewise.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run tests for -z separate-code
-z max-page-size=0x1000.
H.J. Lu [Fri, 12 Jan 2018 03:17:46 +0000 (19:17 -0800)]
ld: Add tests for -z separate-code and -z noseparate-code
Verify that -z separate-code works and -z noseparate-code doesn't disable
-z relro.
PR ld/22393
* testsuite/ld-elf/pr16322.d: Add -z noseparate-code.
* testsuite/ld-elf/pr22393-1.s: New file.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/pr22393-1c.d: Likewise.
* testsuite/ld-elf/pr22393-1d.d: Likewise.
* testsuite/ld-elf/pr22393-1e.d: Likewise.
* testsuite/ld-elf/pr22393-1f.d: Likewise.
* testsuite/ld-elf/pr22393-2a.c: Likewise.
* testsuite/ld-elf/pr22393-2a.rd: Likewise.
* testsuite/ld-elf/pr22393-2b.c: Likewise.
* testsuite/ld-elf/pr22393-2b.rd: Likewise.
* testsuite/ld-elf/shared.exp: Run tests for -z separate-code.
H.J. Lu [Fri, 12 Jan 2018 03:04:55 +0000 (19:04 -0800)]
ld: Create a new LOAD segment for separate code segment
When generating separate code LOAD segment, create a new LOAD segment
if the previous section contains text and the current section doesn't
or vice versa:
Elf file type is DYN (Shared object file)
Entry point 0x200020
There are 7 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x00000000 0x00000000 0x00200 0x00200 R 0x200000
LOAD 0x200000 0x00200000 0x00200000 0x00036 0x00036 R E 0x200000
LOAD 0x400000 0x00400000 0x00400000 0x00064 0x00064 R 0x200000
LOAD 0x400f80 0x00600f80 0x00600f80 0x000a0 0x000a0 RW 0x200000
DYNAMIC 0x400f80 0x00600f80 0x00600f80 0x00080 0x00080 RW 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10
GNU_RELRO 0x400f80 0x00600f80 0x00600f80 0x00080 0x00080 R 0x1
Section to Segment mapping:
Segment Sections...
00 .hash .gnu.hash .dynsym .dynstr .rela.plt
01 .plt .text
02 .rodata .eh_frame
03 .dynamic .got.plt
04 .dynamic
05
06 .dynamic
to prevent fetching or executing data in code pages as instructions.
Also don't put a writable section in a read-only segment if there is a
RELRO segment.
Since code segment is aligned and padded to the maximum page size on
disk, the minimum file size is bigger than the maximum page size which
is 2MB (0x200000):
-rwxr-xr-x 1 hjl hjl 4201932 Jan 10 10:41 libfoo.so
"-z max-page-size=0x1000" can be used to reduce the maximum page size to
4KB (0x1000):
-rwxr-xr-x 1 hjl hjl 15820 Jan 10 10:44 libfoo.so
PR ld/22393
* elf.c (_bfd_elf_map_sections_to_segments): When generating
separate code and read-only data LOAD segments, create a new
LOAD segment if the previous section contains text and the
current section doesn't or vice versa. Don't put a writable
section in a read-only segment if there is a RELRO segment.
H.J. Lu [Fri, 12 Jan 2018 03:01:39 +0000 (19:01 -0800)]
ld: Add "-z separate-code" option to ELF linker
The new "-z separate-code" option will generate separate code LOAD
segment which must be in wholly disjoint pages from any other data.
include/
PR ld/22393
* bfdlink.h (bfd_link_info): Add separate_code.
ld/
PR ld/22393
* NEWS: Mention "-z separate-code".
* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Get
builtin linker scripts and return linker scripts from disk for
"-z separate-code".
(gld${EMULATION_NAME}_handle_option): Handle "-z separate-code"
and "-z noseparate-code".
* genscripts.sh: Generate linker scripts for "-z separate-code".
(LD_FLAG): Set to *textonly for "-z separate-code".
* ld.texinfo: Document "-z separate-code".
* lexsup.c (elf_shlib_list_options): Add linker help messsages
for "-z separate-code" and "-z noseparate-code".
* scripttempl/elf.sc (SEPARATE_TEXT): New
(TEXT_SEGMENT_ALIGN): Likewise.
Use ${TEXT_SEGMENT_ALIGN} to align and pad text segment to
${MAXPAGESIZE}.
Simon Marchi [Fri, 12 Jan 2018 02:08:23 +0000 (21:08 -0500)]
gdb_compile_shlib: Only consider shlib= options when building executables
Trying to use gdb_compile_shlib with the shlib= option to build a shared
library that depends on another shared library does not work as of
today. See:
https://sourceware.org/ml/gdb-patches/2017-10/msg00733.html
The problem is that building the lib is done in two steps, compilation
(.c -> .o) and linking (.o -> .so) and the shlib= options are passed to
both steps. When compiling the object file (.o), it results in gcc
complaining:
gcc: warning: .../solib-vanish-lib2.so: linker input file unused because linking not done
The first solution I came up with was to filter the options inside
gdb_compile_shlib to remove the shlib= options from the options we pass
when compiling the .o file.
I then thought it would be simpler to ignore the shlib= options in
gdb_compile when not building an executable (the executable category
includes the shared libraries). For other compilation types (object
file, preprocess and generate assembly), it doesn't make sense to add
shared libraries to the source file list.
Regtested on the buildbot.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_compile): Ignore shlib= and shlib_load
options when not creating an executable.
GDB Administrator [Fri, 12 Jan 2018 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 11 Jan 2018 23:36:40 +0000 (15:36 -0800)]
Ignore dynamic references on forced local symbols
We should ignore dynamic references on forced local symbols during
garbage collection since they can never be referenced dynamically.
bfd/
PR ld/22649
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Ignore dynamic
references on forced local symbols.
ld/
PR ld/22649
* testsuite/ld-elf/pr22649-1.s: New file.
* testsuite/ld-elf/pr22649-2a.s: Likewise.
* testsuite/ld-elf/pr22649-2b.s: Likewise.
* testsuite/ld-elf/pr22649.msg: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/22649 tests.
Pedro Alves [Thu, 11 Jan 2018 17:50:31 +0000 (17:50 +0000)]
gdb.base/breakpoint-in-ro-region.exp regression on sss targets (PR gdb/22583)
As Maciej reported at
<https://sourceware.org/ml/gdb-patches/2017-12/msg00212.html>, this
commit:
commit
d930703d68ae160ddfe8ebe5fdcf416fb6090e1e
Date: Thu Nov 16 18:44:43 2017 +0000
Subject: Don't ever Quit out of resume
caused regressions on software single-set targets, specifically:
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: single-step breakpoint is not left behind
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw off: step in ro region (cannot insert hw break)
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw off: single-step breakpoint is not left behind
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: single-step breakpoint is not left behind
and indeed detailed logs indicate a breakpoint is left lingering, e.g.:
(gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: step in ro region (cannot insert sw break)
maint info breakpoints 0
Num Type Disp Enb Address What
0 sw single-step keep y 0x00400774 in main at [...]/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c:24 inf 1 thread 1
stop only in thread 1
(gdb) FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind
vs:
(gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: step in ro region (cannot insert sw break)
maint info breakpoints 0
No breakpoint or watchpoint matching '0'.
(gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw off: single-step breakpoint is not left behind
as at commit
d930703d68ae^.
Before commit
d930703d68ae, we had a cleanup installed in 'resume'
that would delete single-step breakpoints on error:
/* Resuming. */
/* Things to clean up if we QUIT out of resume (). */
static void
resume_cleanups (void *ignore)
{
if (!ptid_equal (inferior_ptid, null_ptid))
delete_single_step_breakpoints (inferior_thread ());
normal_stop ();
}
That whole function was removed by
d930703d68ae mainly to eliminate
the normal_stop call:
~~~~
Note that the exception called from within resume ends up calling
normal_stop via resume_cleanups. That's very borked though, because
normal_stop is going to re-handle whatever was the last reported
event, possibly even re-running a hook stop...
~~~~
But as the regression shows, removing resume_cleanups completely went
a bit too far, as the delete_single_step_breakpoints call is still
necessary.
So fix the regression by reinstating the
delete_single_step_breakpoints call on error. However, since we're
trying to eliminate cleanups, restore it in a different form (using
TRY/CATCH).
Tested on x86-64 GNU/Linux both top of master and on top of a series
that implements software single-step on x86.
gdb/ChangeLog:
2018-01-11 Pedro Alves <palves@redhat.com>
PR gdb/22583
* infrun.c (resume): Rename to ...
(resume_1): ... this.
(resume): Reimplement as wrapper around resume_1.
H.J. Lu [Thu, 11 Jan 2018 17:42:12 +0000 (09:42 -0800)]
ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-sections
We must keep all PREINIT_ARRAY, INIT_ARRAY as well as FINI_ARRAY sections
for ld -r --gc-sections.
bfd/
PR ld/22677
* elflink.c (bfd_elf_gc_sections): Keep all PREINIT_ARRAY,
INIT_ARRAY as well as FINI_ARRAY sections for ld -r --gc-sections.
ld/
PR ld/22677
* scripttempl/elf.sc (PREINIT_ARRAY): New.
Don't add .preinit_array for ld -r.
* testsuite/ld-elf/pr22677.d: New file.
* testsuite/ld-elf/pr22677.s: Likewise.
Andrew Burgess [Fri, 5 Jan 2018 14:59:05 +0000 (14:59 +0000)]
ld: Remove unused expression state
Previous commit removed all uses of the defsym field within the linker
expression union. This commit cleans up the now redundant state.
ld/ChangeLog:
* ldexp.h (union etree_union): Remove defsym field.
* ldexp.c (exp_assop): Remove defsym parameter, and use of defsym
parameter.
(exp_assign): Remove passing of defsym parameter.
(exp_defsym): Likewise.
(exp_provide): Likewise.
Andrew Burgess [Thu, 27 Apr 2017 17:05:08 +0000 (18:05 +0100)]
ld: Fix issue where PROVIDE overrides defined symbol
In a linker script, a sequence like this:
foo = ADDR (.some_section);
bar = foo;
PROVIDE (foo = 0);
will result in 'bar = ADDR (.some_section)' and 'foo = 0', which seems
like incorrect behaviour, foo is clearly defined elsewhere, and so the
PROVIDE should not trigger.
The problem is that an expression like this:
foo = ADDR (.some_section);
can't be evaluated until a late phase of the linker, due to the need
for the section '.some_section' to have been placed, then the PROVIDE
was being marked as being used during an earlier phase. At the end of
the link, both lines:
foo = ADDR (.some_section);
PROVIDE (foo = 0);
are active, and this causes the final value of 'foo' to be 0.
The solution proposed in this commit is that, during earlier phases of
the linker, when we see the expression 'foo = ADDR (.some_section);',
instead of ignoring the expression, we create a "fake" definition of
'foo'. The existence of this "fake" definition prevents the PROVIDE
from being marked used, and during the final phase the real definition
of 'foo' will replace the "fake" definition.
The new test provide-6 covers the exact case described above. The
provide-7 test is similar to the above, but using constant
expressions, this was never broken, but is added here to increase
coverage.
The provide-8 case also didn't fail before this commit, but I did
manage to break this case during development of this patch. This case
was only covered by a mmix test before, so I've added this here to
increase coverage.
ld/ChangeLog:
* ldexp.c (exp_fold_tree_1): Rework condition underwhich provide
nodes are ignored in the tree walk, and move the location at which
we change provide nodes into provided nodes.
(exp_init_os): Add etree_provided.
* testsuite/ld-scripts/provide-6.d: New file.
* testsuite/ld-scripts/provide-6.t: New file.
* testsuite/ld-scripts/provide-7.d: New file.
* testsuite/ld-scripts/provide-7.t: New file.
* testsuite/ld-scripts/provide-8.d: New file.
* testsuite/ld-scripts/provide-8.t: New file.
Andrew Burgess [Thu, 27 Apr 2017 16:53:28 +0000 (17:53 +0100)]
ld: Find and run some tests using a wildcard pattern
Find the ld-script/provide-*.d tests using a wildcard, then run them in
a loop. This will make it easier to add more tests in the future. Some
associated clean up is required.
ld/ChangeLog:
* testsuite/ld-scripts/provide-3.d: Add xfail directive.
* testsuite/ld-scripts/provide-4.d: Use new map file name.
* testsuite/ld-scripts/provide-5.d: Use new map file name.
* testsuite/ld-scripts/provide-4-map.d: Renamed to...
* testsuite/ld-scripts/provide-4.map: ...this.
* testsuite/ld-scripts/provide-5-map.d: Renamed to...
* testsuite/ld-scripts/provide-5.map: ...this.
* testsuite/ld-scripts/provide.exp: Move xfail into provide-3.d
file, and run tests in a loop.
Andrew Burgess [Fri, 5 Jan 2018 22:41:55 +0000 (22:41 +0000)]
ld: In map file use '=' in PROVIDE statements
Currently when recording a PROVIDE statement in a linker map file we
display something like:
PROVIDE (SYMBOL, VALUE)
However, in a linker script we write these statements like this:
PROVIDE (SYMBOL = VALUE);
This commit changes the output in the map file to be closer to linker
script format, the map file now contains:
PROVIDE (SYMBOL = VALUE)
The ';' is still missing from the end, but map files are not intended
to be valid linker script input, so adding the ';' just seems like
clutter.
ld/ChangeLog:
* ldexp.c (exp_print_tree): Use '=' instead of ',' when printing
PROVIDE statements.
* testsuite/ld-scripts/provide-4.map: Update expected output.
* testsuite/ld-scripts/provide-5.map: Likewise.
H.J. Lu [Thu, 11 Jan 2018 13:05:25 +0000 (05:05 -0800)]
Fix the order of SHLIB_RODATA_ADDR in elf.sc
elf.sc has
if test -n "${RODATA_ADDR}"; then
RODATA_ADDR="\
SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS"
else
RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
^^^^^^^^^^ Set RODATA_ADDR
RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})"
^^^^^^^^^^ Set RODATA_ADDR with ${RODATA_ADDR}
fi
if test -n "${SHLIB_RODATA_ADDR}"; then
SHLIB_RODATA_ADDR="\
SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
else
SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
^^^^^^^^^^ Set SHLIB_RODATA_ADDR
SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
^^^^^^^^^^ Override SHLIB_RODATA_ADDR
fi
The order should be:
if test -n "${SHLIB_RODATA_ADDR}"; then
SHLIB_RODATA_ADDR="\
SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
else
SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
fi
PR ld/22696
* scripttempl/elf.sc: Fix the order of SHLIB_RODATA_ADDR.
Szabolcs Nagy [Thu, 11 Jan 2018 12:13:39 +0000 (12:13 +0000)]
Fix gdb.texinfo for old makeinfo
With old makeinfo (version 4.13) the changes introduced in
commit
2d97a5d9d33aea87c3bd02fd1fa417f5d4e1fa05
Author: John Baldwin <jhb@FreeBSD.org>
Document support for 'info proc' on FreeBSD.
fail to build.
gdb/doc/ChangeLog:
* gdb.texinfo (pwd): Fix whitespace.
Pedro Alves [Thu, 11 Jan 2018 00:23:04 +0000 (00:23 +0000)]
Fix backwards compatibility with old GDBservers (PR remote/22597)
At <https://sourceware.org/ml/gdb-patches/2017-12/msg00285.html>,
Maciej reported that commit:
commit
5cd63fda035d4ba949e6478406162c4673b3c9ef
Date: Wed Oct 4 18:21:10 2017 +0100
Subject: Fix "Remote 'g' packet reply is too long" problems with multiple inferiors
made GDB stop working with older stubs. Any attempt to continue
execution after the initial connection fails with:
[...]
Process .../gdb/testsuite/outputs/gdb.base/advance/advance created; pid = 2670
Listening on port 2346
target remote [...]:2346
Remote debugging using [...]:2346
Reading symbols from .../lib64/ld.so.1...done.
[Switching to Thread <main>]
(gdb) continue
Cannot execute this command without a live selected thread.
(gdb)
The problem is:
(gdb) c
Cannot execute this command without a live selected thread.
(gdb) info threads
Id Target Id Frame
1 Thread 14917 0x00007f341cd98ed0 in _start () from /lib64/ld-linux-x86-64.so.2
The current thread <Thread ID 2> has terminated. See `help thread'.
^^^^^^^^^^^
(gdb)
Note, thread _2_. There's really only one thread in the inferior
(it's still at the entry point), but still GDB added a bogus second
thread.
The reason GDB started adding a second thread after
5cd63fda035d is
this hunk:
+ if (event->ptid == null_ptid)
+ {
+ const char *thr = strstr (p1 + 1, ";thread:");
+ if (thr != NULL)
+ event->ptid = read_ptid (thr + strlen (";thread:"),
+ NULL);
+ else
+ event->ptid = magic_null_ptid;
+ }
Note the else branch that falls back to magic_null_ptid. We reach
that when we process the initial stop reply sent back in response to
the the "?" (status) packet early in the connection setup:
Sending packet: $?#3f...Ack
Packet received: T0506:
0000000000000000;07:
40a510f4fd7f0000;10:
d0fe1201577f0000;
And note that that response does not include a ";thread:XXX" part.
This stop reply is processed after listing threads with qfThreadInfo /
qsThreadInfo :
Sending packet: $qfThreadInfo#bb...Ack
Packet received: m3915
Sending packet: $qsThreadInfo#c8...Ack
Packet received: l
meaning, when we process that stop reply, we treat the event as coming
from a thread with ptid == magic_null_ptid, which is not yet in the
thread list, so we add it then:
(top-gdb) p ptid
$1 = {m_pid = 42000, m_lwp = -1, m_tid = 1}
(top-gdb) bt
#0 0x0000000000840a8c in add_thread_silent(ptid_t) (ptid=...) at src/gdb/thread.c:269
#1 0x00000000007ad61d in remote_add_thread(ptid_t, int, int) (ptid=..., running=0, executing=0)
at src/gdb/remote.c:1838
#2 0x00000000007ad8de in remote_notice_new_inferior(ptid_t, int) (currthread=..., executing=0)
at src/gdb/remote.c:1921
#3 0x00000000007b758b in process_stop_reply(stop_reply*, target_waitstatus*) (stop_reply=0x1158860, status=0x7fffffffcc00)
at src/gdb/remote.c:7217
#4 0x00000000007b7a38 in remote_wait_as(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0)
at src/gdb/remote.c:7380
#5 0x00000000007b7cd1 in remote_wait(target_ops*, ptid_t, target_waitstatus*, int) (ops=0x102fac0 <remote_ops>, ptid=..., status=0x7fffffffcc00, options=0) at src/gdb/remote.c:7446
#6 0x000000000081587b in delegate_wait(target_ops*, ptid_t, target_waitstatus*, int) (self=0x102fac0 <remote_ops>, arg1=..., arg2=0x7fffffffcc00, arg3=0) at src/gdb/target-delegates.c:138
#7 0x0000000000827d77 in target_wait(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0)
at src/gdb/target.c:2179
#8 0x0000000000715fda in do_target_wait(ptid_t, target_waitstatus*, int) (ptid=..., status=0x7fffffffcc00, options=0)
at src/gdb/infrun.c:3589
#9 0x0000000000716351 in wait_for_inferior() () at src/gdb/infrun.c:3707
#10 0x0000000000715435 in start_remote(int) (from_tty=1) at src/gdb/infrun.c:3212
things go downhill from this.
We don't see the problem with current master gdbserver, because that
version always sends the ";thread:" part in the initial stop reply:
Sending packet: $?#3f...Packet received: T0506:
0000000000000000;07:
a0d4ffffff7f0000;10:
d05eddf7ff7f0000;thread:p3cea.3cea;core:3;
Years ago I had added a "--disable-packet=" command line option to
gdbserver which comes in handy for testing this, since the existing
"--disable-packet=Tthread" precisely makes gdbserver not send that
";thread:" part in stop replies. The testcase added by this commit
emulates old gdbserver making use of that.
I've compared a testrun at
5cd63fda035d^ (before regression) with
'current master+patch', against old gdbserver at
f8b73d13b7ca^. I
hacked out --once, and "monitor exit" to be able to test. The results
are a bit too unstable to tell accurately, but it looked like there
were no regressions. Maciej confirmed this worked for him as well.
No regressions on master (against master gdbserver).
gdb/ChangeLog:
2018-01-11 Pedro Alves <palves@redhat.com>
PR remote/22597
* remote.c (remote_parse_stop_reply): Default to the last-set
general thread instead of to 'magic_null_ptid'.
gdb/testsuite/ChangeLog:
2018-01-11 Pedro Alves <palves@redhat.com>
PR remote/22597
* gdb.server/stop-reply-no-thread.c: New file.
* gdb.server/stop-reply-no-thread.exp: New file.
Igor Tsimbalist [Wed, 10 Jan 2018 23:56:45 +0000 (02:56 +0300)]
Remove VL variants for 4FMAPS and 4VNNIW insns.
AVX512_4FMAPS and AVX512_4VNNIW insns are marked as having AVX512VL
variants. That is wrong as SDM doesn't define such instructions. The
patch removes these VL variants.
gas/
* testsuite/gas/i386/avx512_4fmaps-warn.l: Change xmm to zmm.
* testsuite/gas/i386/avx512_4fmaps-warn.s: Likewise.
* testsuite/gas/i386/avx512_4fmaps_vl-intel.d: Delete.
* testsuite/gas/i386/avx512_4fmaps_vl-warn.l: Likewise.
* testsuite/gas/i386/avx512_4fmaps_vl-warn.s: Likewise.
* testsuite/gas/i386/avx512_4fmaps_vl.d: Likewise.
* testsuite/gas/i386/avx512_4fmaps_vl.s: Likewise.
* testsuite/gas/i386/avx512_4vnniw_vl-intel.d: Likewise.
* testsuite/gas/i386/avx512_4vnniw_vl.d: Likewise.
* testsuite/gas/i386/avx512_4vnniw_vl.s: Likewise.
* testsuite/gas/i386/i386.exp: Delete _vl tests for 4fmaps an
4vnniw tests.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl-intel.d: Delete.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl-warn.l: Likewise.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl-warn.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_4fmaps_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_4vnniw_vl-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_4vnniw_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_4vnniw_vl.s: Likewise.
opcodes/
* i386-opc.tbl: Remove VL variants for 4FMAPS and 4VNNIW
insns.
* i386-tbl.h: Regenerate.
GDB Administrator [Thu, 11 Jan 2018 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 10 Jan 2018 23:04:58 +0000 (09:34 +1030)]
gas tc-arm.c warning fix
* config/tc-arm.c (aeabi_set_public_attributes): Avoid false
positive "‘profile’ may be used uninitialized".
Pedro Alves [Wed, 10 Jan 2018 20:38:08 +0000 (20:38 +0000)]
language_get_symbol_name_matcher -> get_symbol_name_matcher
Rename language_get_symbol_name_matcher -> get_symbol_name_matcher,
since the function is no longer a straight "language method".
gdb/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
* language.h (language_get_symbol_name_matcher): Rename ...
(get_symbol_name_matcher): ... this.
* language.c (language_get_symbol_name_matcher): Ditto.
* dictionary.c, linespec.c, minsyms.c, psymtab.c, symtab.c: All
callers adjusted.
Pedro Alves [Wed, 10 Jan 2018 20:38:07 +0000 (20:38 +0000)]
Ada: make verbatim matcher override other language matchers (PR gdb/22670)
A previous patch fixed verbatim matching in the lookup at the minimal
symbol level, but we should also be finding that same symbol through
the partial/full symtab search.
For example, this is what happens if we use "print" instead of
"break":
(gdb) p <MixedCaseFunc>
$1 = {<text variable, no debug info>} 0x4024dc <MixedCaseFunc>
Before the C++ wildmatching series, GDB knows that MixedCaseFunc is a
function without parameters, and the expression above means calling
it. If you try it before having started the inferior, you'd get the
following (expected) error:
(gdb) print <MixedCaseFunc>
You can't do that without a process to debug.
The main idea behind making the name matcher be determined by the
symbol's language is so that C++ (etc.) wildmatching in linespecs
works even if the current language is not C++, as e.g., when you step
through C or assembly code.
Ada's verbatim matching syntax however ("<...>") isn't quite the same.
It is more a property of the current language than of a particular
symbol's language. We want to support this syntax when debugging an
Ada program, but it's reason of existence is to find non-Ada symbols.
This suggests going back to enabling it depending on current language
instead of language of the symbol being matched.
I'm not entirely happy with the "current_language" reference (though I
think that it's harmless). I think we could try storing the current
language in the lookup_name_info object, and then convert a bunch of
functions more to pass around lookup_name_info objects instead of
"const char *" names. I.e., build the lookup_name_info higher up.
I'm not sure about that, I'll have to think more about it. Maybe
something different will be better. Meanwhile, this gets us going.
I've extended the testcase to also exercise a no-debug-info function,
for extra coverage of the minsyms-only paths.
gdb/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* dwarf2read.c
(gdb_index_symbol_name_matcher::gdb_index_symbol_name_matcher):
Adjust to use language_get_symbol_name_matcher instead of
language_defn::la_get_symbol_name_matcher.
* language.c (language_get_symbol_name_matcher): If in Ada mode
and the lookup name is a verbatim match, return Ada's matcher.
* language.h (language_get_symbol_name_matcher): Adjust comment.
(ada_lookup_name_info::verbatim_p):: New method.
gdb/testsuite/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* gdb.ada/bp_c_mixed_case.exp: Add intro comment. Test printing C
functions too. Test setting breakpoints and printing C functions
with no debug info too.
* gdb.ada/bp_c_mixed_case/qux.c: New file.
Pedro Alves [Wed, 10 Jan 2018 20:38:07 +0000 (20:38 +0000)]
Fix gdb.ada/complete.exp's "complete break ada" test (PR gdb/22670)
This patch fixes the regression covered by the test added by:
commit
344420da6beac1e0b2f7964e7101f8dcdb509b0d
Date: Thu Jan 4 03:30:37 2018 -0500
Subject: Add "complete break ada" test to gdb.ada/complete.exp
The regression had been introduced by:
commit
b5ec771e60c1a0863e51eb491c85c674097e9e13
Date: Wed Nov 8 14:22:32 2017 +0000
Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
The gist of it is that linespec completion in Ada mode is generating
additional matches that should not appear in the match list
(internally generated symbols, or symbols that should be enclosed
between "<...>"). These extraneous entries have uppercase characters, such as:
break ada__stringsS
break ada__strings__R11s
[etc]
These matches come from minimal symbols. The problem is that Ada
minsyms end up with no language set (language_auto), and thus we end
up using the generic symbol name matcher for those instead of Ada's.
We already had a special case for in compare_symbol_name to handle
this, but it was limited to expressions, while the case at hand is
completing a linespec. Fix this by applying the special case to
linespec completion as well. I.e., remove the EXPRESSION check from
compare_symbol_name. That alone turns out to not be sufficient still
-- GDB would still show a couple entries that shouldn't be there:
~~
break ada__exceptions__exception_data__append_info_exception_name__2Xn
break ada__exceptions__exception_data__exception_name_length__2Xn
~~
The reason is that these minimal symbols end up with their language
set to language_cplus / C++, because those encoded names manage to
demangle successfully as C++ symbols (using an old C++ mangling
scheme):
$ echo ada__exceptions__exception_data__append_info_exception_name__2Xn | c++filt
Xn::ada__exceptions__exception_data__append_info_exception_name(void)
It's unfortunate that Ada's encoding scheme doesn't start with some
unique prefix like "_Z" in the C++ Itanium ABI mangling scheme. For
now, paper over that by treating C++ minsyms as Ada minsyms.
gdb/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (ada_collect_symbol_completion_matches): If the
minsym's language is language_auto or language_cplus, pass down
language_ada instead.
* symtab.c (compare_symbol_name): Don't frob symbol language here.
gdb/testsuite/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* gdb.ada/complete.exp ("complete break ada"): Replace kfail with
a fail.
Pedro Alves [Wed, 10 Jan 2018 20:38:06 +0000 (20:38 +0000)]
Fix gdb.ada/bp_c_mixed_case.exp (PR gdb/22670)
The problem here is that we are using the user-provided lookup name
literally for name comparisons. I.e., "<MixedCase>" with the "<>"s
included.
This commit fixes the minsym lookup case. psymbol/symbol lookup will
be fixed in a follow up.
In the minsym case, we're using using the user-provided lookup name
literally for linkage name comparisons. That obviously can't work
since the "<>" are not really part of the linkage name.
The original idea was that we'd use the symbol's language to select
the right symbol name matching algorithm, but that doesn't work for
Ada because it's not really possible to unambiguously tell from the
linkage name alone whether we're dealing with Ada symbols, so Ada
minsyms end up with no language set, or sometimes C++ set.
So fix this by treating Ada mode specially when determining the
linkage name to match against.
gdb/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* minsyms.c (linkage_name_str): New function.
(iterate_over_minimal_symbols): Use it.
gdb/testsuite/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* gdb.ada/bp_c_mixed_case.exp: Remove setup_kfail calls.
Nick Clifton [Wed, 10 Jan 2018 15:35:34 +0000 (15:35 +0000)]
oops - updates to ChangeLog omitted by accident from previous delta.
Nick Clifton [Wed, 10 Jan 2018 15:29:21 +0000 (15:29 +0000)]
Update top level configure files by synchronizing them with gcc.
. * config-ml.in: Sync with gcc sources.
* config.guess: Likewise.
* config.sub: Likewise.
* configure.ac: Likewise.
* configure: Regenerate.
config * Sync with GCC sources:
2017-11-14 Boris Kolpackov <boris@codesynthesis.com>
* gcc-plugin.m4: Add support for MinGW.
2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
* cet.m4: New file.
2017-11-15 Alexandre Oliva <aoliva@redhat.com>
* bootstrap-debug-lean.mk (do-compare): Use the
contrib/compare-debug script.
2017-10-24 H.J. Lu <hongjiu.lu@intel.com>
* bootstrap-cet.mk: New file.
2017-06-19 Martin Liska <mliska@suse.cz>
* bootstrap-lto-noplugin.mk: Enable -flto in all PGO stages.
* bootstrap-lto.mk: Likewise.
2017-06-03 Eric Botcazou <ebotcazou@adacore.com>
* mt-android: New file.
2017-02-13 Richard Biener <rguenther@suse.de>
* isl.m4: Remove support for ISL 0.14.
2017-01-19 Uros Bizjak <ubizjak@gmail.com>
PR target/78478
* ax_check_define.m4: New file.
2017-01-17 Jakub Jelinek <jakub@redhat.com>
PR other/79046
* acx.m4 (GCC_BASE_VER): New m4 function.
(ACX_TOOL_DIRS): Require GCC_BASE_VER, for
--with-gcc-major-version-only use just major number from BASE-VER.
2017-01-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR go/78978
* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): New macro.
Nick Clifton [Wed, 10 Jan 2018 13:57:48 +0000 (13:57 +0000)]
Update the libiberty sources with the latest patches found in the master sources.
2017-01-02 Richard Biener <rguenther@suse.de>
PR lto/83452
* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
Do not use UNDEF locals for removed symbols but instead just
define them in the first prevailing section and with no name.
Use the same gnu_lto_v1 name for all removed globals we promote to
WEAK UNDEFs so hpux can use a stub to provide this symbol. Clear
sh_info and sh_link in removed sections.
2017-10-30 Richard Biener <rguenther@suse.de>
PR lto/82757
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Strip two leading _s from the __gnu_lto_* symbols.
2017-10-24 Alan Modra <amodra@gmail.com>
PR lto/82687
PR lto/82575
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Only make __gnu_lto symbols hidden.
2017-10-20 Alan Modra <amodra@gmail.com>
PR lto/82575
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Make discarded non-local symbols weak and hidden.
2017-10-18 Jakub Jelinek <jakub@redhat.com>
PR lto/82598
* simple-object.c (handle_lto_debug_sections): Copy over also
.note.GNU-stack section with unchanged name.
* simple-object-elf.c (SHF_EXECINSTR): Define.
(simple_object_elf_copy_lto_debug_section): Drop SHF_EXECINSTR bit
on .note.GNU-stack section.
2017-09-25 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
* cp-demangle.c (d_encoding): Strip return type when name is a
LOCAL_NAME.
(d_local_name): Strip return type of enclosing TYPED_NAME.
* testsuite/demangle-expected: Add and adjust tests.
2017-09-21 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
* cp-demangle.c (d_name): Revert addition of 'toplevel' parm.
(has_return_type): Recurse for DEMANGLE_COMPONENT_LOCAL_NAME.
(d_encoding): Revert d_name change. Use is_fnqual_component_type
to strip modifiers that do not belong.
(d_special_name, d_class_enum_type): Revert d_name call change.
(d_expresion_1): Commonize DEMANGLE_COMPONENT_UNARY building.
(d_local_name): Revert parsing of a function type.
(d_print_comp_inner): An inner LOCAL_NAME might contain a
TEMPLATE.
* testsuite/demangle-expected: Add & adjust tests
Jan Beulich [Wed, 10 Jan 2018 13:53:43 +0000 (14:53 +0100)]
x86: fix Disp8 handling for scalar AVX512_4FMAPS insns
Just like their packed counterparts the memory operand is always 16
bytes wide, and the Disp8 scaling is the same for all of them. (As a
side note: I'm also surprised by there being AVX512VL variants of
these as well as the AVX512_4VNNIW ones - the SDM doesn't define any
such.)
Adjust the test cases also for the packed forms to actually live up to
their promise of testing correct Disp8 encoding.
Jan Beulich [Wed, 10 Jan 2018 13:53:05 +0000 (14:53 +0100)]
x86: fix Disp8 handling for AVX512VL VPCMP*{B,W} variants
In commit
2645e1d079 ("x86: add support for AVX-512 VPCMP*{B,W}
pseudo-ops") I screwed up the Disp8MemShift values of the AVX512VL
variants.
Jim Wilson [Wed, 10 Jan 2018 00:40:06 +0000 (16:40 -0800)]
RISC-V: Disassemble x0 based addresses as 0.
gas/
* testsuite/gas/riscv/auipc-x0.d: New.
* testsuite/gas/riscv/auipc-x0.s: New.
opcodes/
* riscv-dis.c (maybe_print_address): If base_reg is zero,
then the hi_addr value is zero.
GDB Administrator [Wed, 10 Jan 2018 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Tue, 9 Jan 2018 21:35:17 +0000 (13:35 -0800)]
Document support for 'info proc' on FreeBSD.
Since the 'info proc' support on FreeBSD does not use /proc, reword
the documentation for 'info proc' to not assume /proc. This includes
renaming the node to 'Process Information' and suggesting that
additional process information can be queried via different
OS-specific interfaces. This is also cleans up the description of
'info proc' support for core files a bit as /proc is not used for core
file support on any current platform.
gdb/ChangeLog:
* NEWS: Document that 'info proc' now works on FreeBSD.
gdb/doc/ChangeLog:
* gdb.texinfo (pwd): Update cross-reference for Process Information
node and remove explicit /proc reference.
(Native): Rename subsection from SVR4 Process Information to
Process Information.
(Process Information): Reword introduction to be less /proc
centric. Document support for "info proc" on FreeBSD.
John Baldwin [Tue, 9 Jan 2018 21:35:17 +0000 (13:35 -0800)]
Support 'info proc' for native FreeBSD processes.
- Command line arguments are fetched via the kern.proc.args.<pid>
sysctl.
- The 'cwd' and 'exe' values are obtained from the per-process
file descriptor table returned by kinfo_getfile() from libutil.
- 'mappings' is implemented by walking the array of VM map entries
returned by kinfo_getvmmap() from libutil.
- 'status' output is generated by outputting fields from the structure
returned by the kern.proc.pid.<pid> sysctl.
- 'stat' is aliased to 'status'.
gdb/ChangeLog:
* configure.ac: Check for kinfo_getfile in libutil.
* configure: Regenerate.
* config.in: Regenerate.
* fbsd-nat.c: Include "fbsd-tdep.h".
(fbsd_fetch_cmdline): New.
(fbsd_fetch_kinfo_proc): Move earlier and change to return a bool
rather than calling error.
(fbsd_info_proc): New.
(fbsd_thread_name): Report error if fbsd_fetch_kinfo_proc fails.
(fbsd_wait): Report warning if fbsd_fetch_kinfo_proc fails.
(fbsd_nat_add_target): Set "to_info_proc" to "fbsd_info_proc".
John Baldwin [Tue, 9 Jan 2018 21:35:17 +0000 (13:35 -0800)]
Use gdb::unique_xmalloc_ptr<> instead of a deleter that invokes free().
Since xfree() always wraps free(), it is safe to use the xfree deleter
for buffers allocated by library routines such as kinfo_getvmmap() that
must be released via free().
gdb/ChangeLog:
* fbsd-nat.c (struct free_deleter): Remove.
(fbsd_find_memory_regions): Use gdb::unique_xmalloc_ptr<>.
John Baldwin [Tue, 9 Jan 2018 21:35:17 +0000 (13:35 -0800)]
Don't return stale data from fbsd_pid_to_exec_file for kernel processes.
For processes without an associated executable (such as kernel processes),
the kern.proc.pathname.<pid> system control node returns a length of zero
without modifying the user's buffer. Detect this case and return NULL
rather than the previous contents of the static buffer 'buf'.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_pid_to_exec_file) [KERN_PROC_PATHNAME]: Return
NULL for an empty pathname.
John Baldwin [Tue, 9 Jan 2018 21:35:17 +0000 (13:35 -0800)]
Support 'info proc' for FreeBSD process core dumps.
- Command line arguments are obtained from the pr_psargs[] array
saved in the NT_PRPSINFO note.
- The 'cwd' and 'exe' values are obtained from the per-process file
descriptor table stored in the NT_PROCSTAT_FILES core note.
- 'mappings' is implemented by walking the array of VM map entries
stored in the NT_PROCSTAT_VMMAP core note.
- 'status' output is generated by outputting fields from
the first structure stored in the NT_PROCSTAT_PROC core note.
- 'stat' is aliased to 'status'.
gdb/ChangeLog:
* fbsd-tdep.c (KVE_STRUCTSIZE, KVE_START, KVE_END, KVE_OFFSET)
(KVE_FLAGS, KVE_PROTECTION, KVE_PATH, KINFO_VME_PROT_READ)
(KINFO_VME_PROT_WRITE, KINFO_VME_PROT_EXEC, KINFO_VME_FLAG_COW)
(KINFO_VME_FLAG_NEEDS_COPY, KINFO_VME_FLAG_NOCOREDUMP)
(KINFO_VME_FLAG_SUPER, KINFO_VME_FLAG_GROWS_UP)
(KINFO_VME_FLAG_GROWS_DOWN, KF_STRUCTSIZE, KF_TYPE, KF_FD)
(KF_PATH, KINFO_FILE_TYPE_VNODE, KINFO_FILE_FD_TYPE_CWD)
(KINFO_FILE_FD_TYPE_TEXT, SIG_WORDS, struct kinfo_proc_layout)
(kinfo_proc_layout_32, kinfo_proc_layout_i386)
(kinfo_proc_layout_64, fbsd_vm_map_entry_flags)
(fbsd_core_info_proc_mappings, fbsd_core_vnode_path)
(fbsd_core_fetch_timeval, fbsd_print_sigset)
(fbsd_core_info_proc_status, fbsd_core_info_proc): New.
(fbsd_init_abi): Install gdbarch "core_info_proc" method.
* fbsd-tdep.h (fbsd_vm_map_entry_flags): New.
Jim Wilson [Tue, 9 Jan 2018 18:08:47 +0000 (10:08 -0800)]
Add explicit shared check to eh-frame-hdr test.
ld/
* testsuite/ld-elf/eh-frame-hdr.d (#xfail): Delete
(#alltargets): Renamed from #target. Add shared.
* testsuite/lib/ld-lib.exp (run_dump_test): Document shared target.
Document alltargets option. Add support for alltargets option.
(istarget): Add support for shared target.
James Greenhalgh [Tue, 9 Jan 2018 14:15:00 +0000 (14:15 +0000)]
[Arm] Add CSDB instruction
CSDB is a new instruction which Arm has defined. As it shares the
encoding space with NOP instructions, it is available from Armv3 in
Arm mode, and Armv6T2 in Thumb mode.
OK? If so, please commit on my behalf as I don't have commit rights
over here.
Thanks, James
---
opcodes/
2018-01-09 James Greenhalgh <james.greenhalgh@arm.com>
* arm-dis.c (arm_opcodes): Add csdb.
(thumb32_opcodes): Add csdb.
gas/
2018-01-09 James Greenhalgh <james.greenhalgh@arm.com>
* config/tc-arm.c (insns): Add csdb, enable for Armv3 and above
in Arm execution state, and Armv6T2 and above in Thumb execution
state.
* testsuite/gas/arm/csdb.s: New.
* testsuite/gas/arm/csdb.d: New.
* testsuite/gas/arm/thumb2_it_bad.l: Add csdb.
* testsuite/gas/arm/thumb2_it_bad.s: Add csdb.
James Greenhalgh [Tue, 9 Jan 2018 11:28:04 +0000 (11:28 +0000)]
Add support for the AArch64's CSDB instruction.
CSDB is a new instruction which Arm has defined. It has the same encoding as
HINT #0x14 and is available at all architecture levels.
opcodes * aarch64-tbl.h (aarch64_opcode_table): Add "csdb".
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.
gas * testsuite/gas/aarch64/system.d: Update expected results to expect
CSDB.
Xavier Roirand [Mon, 11 Dec 2017 09:03:45 +0000 (10:03 +0100)]
Fix breakpoint add on inlined function using function name.
Using this Ada example:
package B is
procedure Read_Small with Inline_Always;
end B;
package body B is
Total : Natural := 0;
procedure Read_Small is
begin
Total := Total + 1;
end Read_Small;
end B;
and
with B;
procedure M is
begin
B.Read_Small;
end M;
% gnatmake -g -O0 -m m.adb -cargs -gnatn
% gdb m
Inserting a breakpoint on Read_Small inlined function does not work:
(gdb) b read_small
Breakpoint 1 at 0x40250e: file b.adb, line 5.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x000000000040250e in b.doit at b.adb:5
(gdb)
In this exemple we should have two breakpoints set, one in package B and
the other one in the inlined instance inside procedure M), like below:
(gdb) b read_small
Breakpoint 1 at 0x40250e: b.adb:5. (2 locations)
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x000000000040250e in b.doit at b.adb:5
1.2 y 0x0000000000402540 in m at b.adb:5
(gdb)
Looking at the DWARF info for inlined instance of Read_Small:
<1><1526>: Abbrev Number: 2 (DW_TAG_subprogram)
<1527> DW_AT_name : ([...], offset: 0x1e82): b__read_small
<152b> DW_AT_decl_file : 2
<152c> DW_AT_decl_line : 3
<152d> DW_AT_inline : 3 (declared as inline and inlined)
[...]
<2><1547>: Abbrev Number: 4 (DW_TAG_inlined_subroutine)
<1548> DW_AT_abstract_origin: <0x1526>
<154c> DW_AT_low_pc : 0x402552
<1554> DW_AT_high_pc : 0x2b
<155c> DW_AT_call_file : 1
<155d> DW_AT_call_line : 5
<2><155e>: Abbrev Number: 0
During the parsing of DWARF info in order to produce partial DIE linked
list, the DW_TAG_inlined_subroutine were skipped thus not present in the
final partial dies.
Taking DW_TAG_inlined_subroutine in account during the parsing process
fixes the problem.
gdb/ChangeLog:
* dwarf2read.c (scan_partial_symbols, add_partial_symbol)
(add_partial_subprogram, load_partial_dies): Add
DW_TAG_inlined_subroutine handling.
gdb/testsuite/ChangeLog:
* gdb.ada/bp_inlined_func: New testcase.
Kuan-Lin Chen [Tue, 9 Jan 2018 08:04:58 +0000 (16:04 +0800)]
PR22662, nds32: Fix a typographical error.
Jim Wilson [Tue, 9 Jan 2018 01:55:29 +0000 (17:55 -0800)]
RISC-V: Fix accidental embedded -shared regressions.
ld/
* testsuite/ld-riscv-elf/c-lui.d: Don't use -shared. Check for _start
instead of .text.
* testsuite/ld-riscv-elf/c-lui.s: Add _start label.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Before __global_pointer$
tests, add call to check_shared_lib_support.
GDB Administrator [Tue, 9 Jan 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Samuel Thibault [Mon, 8 Jan 2018 15:30:16 +0000 (10:30 -0500)]
hurd: Add enough auxv support for AT_ENTRY for PIE binaries
Add PIE support for hurd, by faking an AT_ENTRY auxv entry. That value
is expected to be read by svr4_exec_displacement, which will propagate
the executable displacement.
gdb/ChangeLog:
* gdb/gnu-nat.c: Include <elf.h> and <link.h>.
(gnu_xfer_auxv): New function.
(gnu_xfer_partial): Call gnu_xfer_auxv when `object' is
TARGET_OBJECT_AUXV.
H.J. Lu [Mon, 8 Jan 2018 12:36:59 +0000 (04:36 -0800)]
x86: Properly encode vmovd with 64-bit memeory
For historical reason, we allow movd/vmovd with 64-bit register and
memeory operands. But for vmovd, we failed to handle 64-bit memeory
operand. This has been gone unnoticed since AT&T syntax always treats
memory operand as 32-bit memory. This patch properly encodes vmovd
with 64-bit memeory operands. It also removes AVX512 vmovd with 64-bit
operands since GCC has
case TYPE_SSEMOV:
switch (get_attr_mode (insn))
{
case MODE_DI:
/* Handle broken assemblers that require movd instead of movq. */
if (!HAVE_AS_IX86_INTERUNIT_MOVQ
&& (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])))
return "%vmovd\t{%1, %0|%0, %1}";
return "%vmovq\t{%1, %0|%0, %1}";
and all AVX512 GNU assemblers set HAVE_AS_IX86_INTERUNIT_MOVQ, GCC won't
generate AVX512 vmovd with 64-bit operand.
gas/
PR gas/22681
* testsuite/gas/i386/i386.exp: Run x86-64-movd and
x86-64-movd-intel.
* testsuite/gas/i386/x86-64-movd-intel.d: New file.
* testsuite/gas/i386/x86-64-movd.d: Likewise.
* testsuite/gas/i386/x86-64-movd.s: Likewise.
opcodes/
PR gas/22681
* i386-opc.tbl: Properly encode vmovd with Qword memeory operand.
Remove AVX512 vmovd with 64-bit operands.
* i386-tbl.h: Regenerated.
Yao Qi [Mon, 8 Jan 2018 10:09:33 +0000 (10:09 +0000)]
Fix GDBserver build failure when $development is false
When we set bfd/development.sh:$development to false, GDBserver failed to
build,
selftest.o: In function `selftests::run_tests(char const*)':
binutils-gdb/gdb/gdbserver/../common/selftest.c:97:undefined reference to `selftests::reset()'
collect2: error: ld returned 1 exit status
selftest.o shouldn't be compiled and linked when $development is false.
With this patch, in release mode, GDBserver doesn't nothing with option
--selftest,
$ ./gdbserver --selftest=foo
Selftests are not available in a non-development build.
$ ./gdbserver --selftest
Selftests are not available in a non-development build.
gdb/gdbserver:
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (OBS): Remove selftest.o.
* configure.ac: Set srv_selftest_objs if $development is true.
(GDBSERVER_DEPFILES): Append $srv_selftest_objs.
* configure: Re-generated.
* server.c (captured_main): Wrap variable selftest_filter with
GDB_SELF_TEST.
gdb/testsuite:
2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
* gdb.server/unittest.exp: Match the output in non-development
mode.
Yao Qi [Mon, 8 Jan 2018 10:09:32 +0000 (10:09 +0000)]
Fix GDB build failure when $development is false
We don't build GDB selftests bits when $development is false. However, if
we turn bfd/development.sh:$development to false, common/selftest.c is
compiled which is not expected. It causes the build failure,
selftest.o: In function `selftests::run_tests(char const*)':
binutils-gdb/gdb/common/selftest.c:97: undefined reference to `selftests::reset()'
collect2: error: ld returned 1 exit status
I fix this issue by putting selftest.o selftest-arch.o into CONFIG_OBS
only when $development is true. After this is fixed, there are other
build failures in maint.c, this patch fixes them as well.
In the release mode, the output of these commands are:
(gdb) maintenance selftest
Selftests are not available in a non-development build.
(gdb) maintenance selftest foo
Selftests are not available in a non-development build.
(gdb) maintenance info selftests
Selftests are not available in a non-development build.
gdb:
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (COMMON_SFILES): Remove selftest-arch.c and
common/selftest.c.
(COMMON_OBS): Remove selftest.o.
* configure.ac: Append selftest-arch.c and common/selftest.c to
CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS.
* configure: Re-generated.
* maint.c (maintenance_selftest): Wrap selftests::run_tests with
GDB_SELF_TEST.
(maintenance_info_selftests): Likewise.
gdb/testsuite:
2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
* gdb.gdb/unittest.exp: Match output in non-development mode.
Joel Brobecker [Mon, 8 Jan 2018 09:39:23 +0000 (04:39 -0500)]
Fix second-to-last gdb/testsuite/ChangeLog entry.
Joel Brobecker [Mon, 8 Jan 2018 09:26:52 +0000 (04:26 -0500)]
Relax expected output in gdb.ada/access_tagged_param.exp test
One of the tests in gdb.ada/access_tagged_param.exp verifies
the value of the parameters being printed by GDB when stopping
at a breakpoint inside procedure Pck.Inspect.
In particular, one of these parameters is actually generated
internally by the compiler, and does only indirectly depend
on the user-level code. A recent change in AdaCore's compiler
caused the code expansion to change a little bit, and as a result,
the value of that parameter has changed from 2 to 3. This can be
evindenced by looking at the code post expansion, using the -gnatDG
command-line switch to generate the .dg files:
$ gnatmake -g -gnatDG foo.adb
$ vi foo.adb.dg
We can see that the call to pck.inspect used to be:
pck__inspect (P8b, objL => 2);
With a recent version of GNAT Pro, it is now:
pck__inspect (P9b, objL => 3);
This change causes a spurious FAIL when running this testcase.
The objL parameter being, at heart, a simple counter of the nesting
level, this commit relaxes the expected output to accept any single-
digit number. We could accept any decimal, but given the example
program, I dout that number will reach double-digit level. If it
does, we'll double-check that this is normal, and relax the expected
output further.
gdb/testsuite/ChangeLog:
* gdb.ada/access_tagged_param.exp: Relax expected output
for value of "ObjL" in "continue" to pck.inspect breakpoint
test.
Tested on x86_64-linux.
Nick Clifton [Mon, 8 Jan 2018 09:29:17 +0000 (09:29 +0000)]
Add a description of the X86_64 assembler's .largcomm pseudo-op.
PR 22553
* doc/c-i386.texi (i386-Directives): Document the .largecomm
directive.
Xavier Roirand [Mon, 8 Jan 2018 04:56:36 +0000 (23:56 -0500)]
(Ada) Fix print of array using non-contiguous enumeration indexes
Consider the following code:
type Index is (Index1, Index2);
Size : constant Integer := 10;
for Index use (Index1 => 1, Index2 => Size);
type Array_Index_Enum is array (Index) of Integer;
my_table : Array_Index_Enum :=(others => 42);
When compiling the code above with a compiler where the GNAT encodings
are turned off (which can be temporarily emulated by using the compiler
switch -fgnat-encodings=minimal), printing this table in gdb leads to:
(gdb) p my_table
$1 = (42, 42, 4203344, 10, -8320, 32767, 4203465, 0, 0, 0)
The displayed content is wrong since the handling part believes
that the length of the array is max index value (10) minus the
first index value (1) i+ 1 = 10 which is wrong since index are not
contiguous in this case.
The right behavior is to detect that the array is using enumeration
index hence parse the enumeration values in order to get the number
of indexes in this array (2 indexes here).
This patch fixes this issue and changes the output as follow:
(gdb) p my_table
$1 = (42, 42)
gdb/ChangeLog:
* ada-valprint.c (val_print_packed_array_elements): Use
proper number of elements when printing an array indexed
by an enumeration type.
gdb/testsuite/ChangeLog (Joel Brobecker <brobecker@adacore.com>):
* gdb.ada/arr_enum_idx_w_gap.exp
* gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb
Tested on x86_64-linux.
GDB Administrator [Mon, 8 Jan 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 7 Jan 2018 16:22:46 +0000 (11:22 -0500)]
Remove dwarf2_cu::dwarf2_per_objfile
This patch removes the dwarf2_per_objfile field of dwarf2_cu. It is
redundant, since we can access dwarf2_per_objfile through
dwarf2_per_objfile, which is guaranteed to be set.
gdb/ChangeLog:
* dwarf2read.c (struct dwarf2_cu) <dwarf2_per_objfile>: Remove.
(dw2_get_file_names_reader): Adjust.
(lookup_dwo_signatured_type): Adjust.
(lookup_dwp_signatured_type): Adjust.
(lookup_signatured_type): Adjust.
(create_type_unit_group): Adjust.
(get_type_unit_group): Adjust.
(process_psymtab_comp_unit_reader): Adjust.
(build_type_psymtabs_reader): Adjust.
(scan_partial_symbols): Adjust.
(add_partial_symbol): Adjust.
(add_partial_subprogram): Adjust.
(peek_die_abbrev): Adjust.
(fixup_go_packaging): Adjust.
(process_imported_unit_die): Adjust.
(dwarf2_compute_name): Adjust.
(dwarf2_physname): Adjust.
(read_import_statement): Adjust.
(handle_DW_AT_stmt_list): Adjust.
(read_file_scope): Adjust.
(read_func_scope): Adjust.
(read_lexical_block_scope): Adjust.
(read_call_site_scope): Adjust.
(read_variable): Adjust.
(dwarf2_rnglists_process): Adjust.
(dwarf2_ranges_process): Adjust.
(dwarf2_ranges_read): Adjust.
(dwarf2_get_pc_bounds): Adjust.
(dwarf2_record_block_ranges): Adjust.
(dwarf2_add_field): Adjust.
(dwarf2_add_member_fn): Adjust.
(read_structure_type): Adjust.
(process_structure_scope): Adjust.
(read_enumeration_type): Adjust.
(read_array_type): Adjust.
(mark_common_block_symbol_computed): Adjust.
(read_common_block): Adjust.
(read_namespace_type): Adjust.
(read_namespace): Adjust.
(read_module_type): Adjust.
(read_tag_pointer_type): Adjust.
(read_tag_ptr_to_member_type): Adjust.
(read_tag_string_type): Adjust.
(read_subroutine_type): Adjust.
(read_typedef): Adjust.
(read_base_type): Adjust.
(attr_to_dynamic_prop): Adjust.
(read_subrange_type): Adjust.
(read_unspecified_type): Adjust.
(dwarf2_read_abbrevs): Adjust.
(load_partial_dies): Adjust.
(read_partial_die): Adjust.
(find_partial_die): Adjust.
(guess_partial_die_structure_name): Adjust.
(fixup_partial_die): Adjust.
(read_attribute_value): Adjust.
(read_addr_index): Adjust.
(read_addr_index_from_leb128): Adjust.
(read_str_index): Adjust.
(dwarf2_string_attr): Adjust.
(get_debug_line_section): Adjust.
(dwarf_decode_line_header): Adjust.
(lnp_state_machine::check_line_address): Adjust.
(dwarf_decode_lines_1): Adjust.
(dwarf_decode_lines): Adjust.
(dwarf2_start_symtab): Adjust.
(var_decode_location): Adjust.
(new_symbol_full): Adjust.
(dwarf2_const_value_data): Adjust.
(dwarf2_const_value_attr): Adjust.
(dwarf2_const_value): Adjust.
(die_type): Adjust.
(die_containing_type): Adjust.
(build_error_marker_type): Adjust.
(lookup_die_type): Adjust.
(guess_full_die_structure_name): Adjust.
(anonymous_struct_prefix): Adjust.
(determine_prefix): Adjust.
(dwarf2_name): Adjust.
(follow_die_ref_or_sig): Adjust.
(follow_die_offset): Adjust.
(follow_die_ref): Adjust.
(follow_die_sig_1): Adjust.
(follow_die_sig): Adjust.
(get_signatured_type): Adjust.
(get_DW_AT_signature_type): Adjust.
(decode_locdesc): Adjust.
(dwarf_decode_macros): Adjust.
(cu_debug_loc_section): Adjust.
(fill_in_loclist_baton): Adjust.
(dwarf2_symbol_mark_computed): Adjust.
(init_one_comp_unit): Don't assign
dwarf2_cu::dwarf2_per_objfile.
(set_die_type): Adjust.
Simon Marchi [Sun, 7 Jan 2018 16:22:46 +0000 (11:22 -0500)]
Remove dwarf2_per_objfile global
This patch removes the global variable dwarf2_per_objfile. This global
variable is set at the various entry points of dwarf2read.c (using
dw2_setup), and is referred to throughout the file. Instead of passing
data between functions in global variables like this one, it would be
better if the functions that depend on it either received it as argument
or got it from the existing arguments they receive. For example, a
function receiving a reference to a dwarf2_per_cu_data can access it
from dwarf2_per_cu_data::dwarf2_per_objfile.
This patch has been tested on the buildbot.
gdb/ChangeLog:
* dwarf2read.c (struct mapped_debug_names): Add constructor.
<dwarf2_per_objfile>: New field.
(dwarf2_per_objfile): Remove global.
(get_dwarf2_per_objfile): New function.
(set_dwarf2_per_objfile): New function.
(dwarf2_build_psymtabs_hard): Change objfile parameter to
dwarf2_per_objfile.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(read_abbrev_offset): Likewise.
(read_indirect_string): Likewise.
(read_indirect_line_string): Likewise.
(read_indirect_string_at_offset): Likewise.
(read_indirect_string_from_dwz): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(create_all_comp_units): Change objfile parameter to
dwarf2_per_objfile.
(create_all_type_units): Likewise.
(process_queue): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(get_dwp_file): Likewise.
(process_cu_includes): Likewise.
(struct free_dwo_file_cleanup_data): New struct.
(dwarf2_has_info): Use get_dwarf2_per_objfile and
set_dwarf2_per_objfile.
(dwarf2_get_dwz_file): Add dwarf2_per_objfile parameter.
(dw2_do_instantiate_symtab): Get dwarf2_per_objfile from
context, adjust calls.
(dw2_instantiate_symtab): Likewise.
(dw2_get_cutu): Add dwarf2_per_objfile parameter.
(dw2_get_cu): Likewise.
(create_cu_from_index_list): Change objfile parameter to
dwarf2_per_objfile.
(create_cus_from_index_list): Get dwarf2_per_objfile from
context, adjust calls.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Change objfile
parameter to dwarf2_per_objfile.
(create_signatured_type_table_from_debug_names): Change objfile
parameter to dwarf2_per_objfile.
(create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dwarf2_read_index): Use get_dwarf2_per_objfile, adjust calls.
(dw2_setup): Remove.
(dw2_get_file_names_reader): Get dwarf2_per_objfile from
context.
(dw2_find_last_source_symtab): Get dwarf2_per_objfile using
get_dwarf2_per_objfile.
(dw2_forget_cached_source_info): Likewise.
(dw2_map_symtabs_matching_filename): Likewise.
(struct dw2_symtab_iterator) <index>: Remove.
<dwarf2_per_objfile>: New field.
(dw2_symtab_iter_init): Replace index parameter with
dwarf2_per_objfile.
(dw2_symtab_iter_next): Use dwarf2_per_objfile from iter.
(dw2_lookup_symbol): Use get_dwarf2_per_objfile and adjust.
(dw2_print_stats): Likewise.
(dw2_dump): Likewise.
(dw2_expand_symtabs_for_function): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_symtabs_with_fullname): Likewise.
(dw2_expand_marked_cus): Replace index and objfile parameters
with dwarf2_per_objfile.
(dw_expand_symtabs_matching_file_matcher): Add
dwarf2_per_objfile parameter and adjust calls.
(dw2_expand_symtabs_matching): Use get_dwarf2_per_objfile and
adjust calls.
(dw2_find_pc_sect_compunit_symtab): Don't call dw2_setup.
(dw2_map_symbol_filenames): Use get_dwarf2_per_objfile and
adjust calls.
(create_cus_from_debug_names_list): Replace objfile parameter
with dwarf2_per_objfile and adjust calls.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_debug_names): Likewise.
(mapped_debug_names::namei_to_name): Adjust call.
(dw2_debug_names_iterator::next): Likewise.
(dw2_debug_names_iterator::find_vec_in_debug_names): Likewise.
(dw2_debug_names_lookup_symbol): Use get_dwarf2_per_objfile.
(dw2_debug_names_dump): Likewise.
(dw2_debug_names_expand_symtabs_for_function): Likewise.
(dw2_debug_names_expand_symtabs_matching): Likewise.
(dwarf2_initialize_objfile): Likewise.
(dwarf2_build_psymtabs): Likewise.
(get_abbrev_section_for_cu): Get dwarf2_per_objfile from
this_cu.
(error_check_comp_unit_head): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(read_abbrev_offset): Likewise.
(create_debug_type_hash_table): Likewise.
(create_debug_types_hash_table): Likewise.
(create_all_type_units): Replace objfile parameter with
dwarf2_per_objfile.
(add_type_unit): Add dwarf2_per_objfile parameter.
(fill_in_sig_entry_from_dwo_entry): Replace objfile parameter
with dwarf2_per_objfile.
(lookup_dwo_signatured_type): Get dwarf2_per_objfile from cu.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(allocate_type_unit_groups_table): Add objfile parameter.
(create_type_unit_group): Use dwarf2_per_objfile from cu.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit): Update call.
(build_type_psymtabs_reader): Use dwarf2_per_objfile from cu.
(build_type_psymtabs_1): Add dwarf2_per_objfile parameter.
(print_tu_stats): Likewise.
(build_type_psymtab_dependencies): Use dwarf2_per_objfile passed
in void* parameter.
(build_type_psymtabs): Change objfile parameter to
dwarf2_per_objfile.
(process_skeletonless_type_unit): Use dwarf2_per_objfile
passed in void* parameter.
(process_skeletonless_type_units): Change objfile parameter to
dwarf2_per_objfile.
(set_partial_user): Likewise.
(dwarf2_build_psymtabs_hard): Likewise.
(read_comp_units_from_section): Likewise.
(create_all_comp_units): Likewise.
(scan_partial_symbols): Update calls.
(add_partial_symbol): Likewise.
(dwarf2_read_symtab): Use get_dwarf2_per_objfile.
(maybe_queue_comp_unit): Use dwarf2_read_symtab from cu.
(process_queue): Add dwarf2_per_objfile parameter.
(get_compunit_symtab): Use dwarf2_per_objfile from cu.
(compute_compunit_symtab_includes): Likewise.
(process_cu_includes): Add dwarf2_per_objfile parameter.
(process_full_comp_unit): Use dwarf2_per_objfile from cu.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Update call.
(handle_DW_AT_stmt_list): Use dwarf2_per_objfile from cu.
(read_file_scope): Likewise.
(allocate_dwo_file_hash_table): Add objfile parameter.
(lookup_dwo_file_slot): Add dwarf2_per_objfile parameter.
(create_cus_hash_table): Likewise.
(create_dwp_hash_table): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwp_v2_section): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(try_open_dwop_file): Likewise.
(open_dwo_file): Likewise. Use dwarf2_per_objfile from cu.
(open_and_init_dwo_file): Use dwarf2_per_objfile from cu, update
cleanup to include a reference to dwarf2_per_objfile.
(open_dwp_file): Add dwarf2_per_objfile parameter.
(open_and_init_dwp_file): Likewise.
(get_dwp_file): Likewise.
(lookup_dwo_cutu): Use dwarf2_per_objfile from cu.
(queue_and_load_all_dwo_tus): Update call.
(free_dwo_file_cleanup): Use dwarf2_per_objfile from cleanup
data.
(dwarf2_rnglists_process): Use dwarf2_per_objfile from cu.
(dwarf2_ranges_process): Likewise.
(dwarf2_get_pc_bounds): Likewise.
(mark_common_block_symbol_computed): Likewise.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(dwarf2_read_abbrevs): Update call.
(read_partial_die): Use dwarf2_per_objfile from cu.
(find_partial_die): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_indirect_string_at_offset_from): Add objfile parameter.
(read_indirect_string_at_offset): Add dwarf2_per_objfile
parameter.
(read_indirect_string_from_dwz): Add objfile parameter.
(read_indirect_string): Add objfile parameter.
(read_addr_index_1): Add dwarf2_per_objfile parameter.
(read_addr_index): Use dwarf2_per_objfile from cu.
(dwarf2_read_addr_index): Use dwarf2_per_objfile from cu, don't
call dw2_setup.
(read_str_index): Use dwarf2_per_objfile from cu.
(get_debug_line_section): Likewise.
(read_formatted_entries): Add dwarf2_per_objfile parameter.
(dwarf_decode_line_header): Use dwarf2_per_objfile from cu.
(new_symbol_full): Use dwarf2_per_objfile from cu.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(determine_prefix): Likewise.
(follow_die_offset): Likewise.
(dwarf2_fetch_die_loc_sect_off): Use get_dwarf2_per_objfile.
(dwarf2_fetch_constant_bytes): Don't call dw2_setup.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig_1): Use dwarf2_per_objfile from cu.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf_decode_macro_bytes): Add dwarf2_per_objfile parameter.
(dwarf_decode_macros): Use dwarf2_per_objfile from cu.
(cu_debug_loc_section): Likewise.
(fill_in_loclist_baton): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(free_cached_comp_units): Use dwarf2_per_objfile passed in void*
parameter.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(free_one_cached_comp_unit): Use dwarf2_per_objfile from cu.
(dwarf2_free_objfile): Use get_dwarf2_per_objfile.
(set_die_type): Use dwarf2_free_objfile from cu.
(get_die_type_at_offset): Likewise.
(dwarf2_per_objfile_free): Don't assign global variable.
(debug_names) <constructor>: Add dwarf2_per_objfile
parameter, update m_debugstrlookup construction.
(debug_names::debug_str_lookup): Add dwarf2_per_objfile
parameter.
<m_dwarf2_per_objfile>: New field.
<lookup>: Use m_dwarf2_per_objfile.
(check_dwarf64_offsets): Add dwarf2_per_objfile parameter.
(psyms_seen_size): Likewise.
(write_gdbindex): Replace objfile parameter with
dwarf2_per_objfile.
(write_debug_names): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Use get_dwarf2_per_objfile, update
calls.
Simon Marchi [Sun, 7 Jan 2018 16:22:45 +0000 (11:22 -0500)]
Replace objfile field in dwarf2_cu and dwarf2_per_cu_data with dwarf2_per_objfile
The next patch aims to remove the dwarf2_per_objfile global. In many
functions, we need to find a way to get a reference to the current
dwarf2_per_objfile through the objects passed in parameters. Often, we have
access to a dwarf2_cu or a dwarf2_per_cu_data. These objects have a reference
to the objfile, through which we can get the dwarf2_per_objfile:
dwarf2_per_objfile = ((struct dwarf2_per_objfile *)
objfile_data (objfile, dwarf2_objfile_data_key));
However, this is a bit cumbersome to do all over the place. It would be
more logical if the dwarf2_cu and dwarf2_per_cu_data had a reference to
their dwarf2_per_objfile, which would then have a reference to the
objfile. It would be more in line with the object hierarchy, where
dwarf2_per_objfile owns the dwarf2_per_cu_data instances. We could
even remove the reference dwarf2_cu has to dwarf2_per_objfile, since we
can access dwarf2_per_objfile through dwarf2_cu::per_cu.
In a graphical way, references would look like this after the current
patch:
objfile <--- dwarf2_per_objfile <--- dwarf2_per_cu_data
| ^
| |
`- dwarf2_cu
This patch has been tested on the buildbot.
gdb/ChangeLog:
* dwarf2read.c (struct dwarf2_cu) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(struct dwarf2_per_cu_data) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(create_cu_from_index_list): Assign dwarf2_per_objfile instead
of objfile.
(create_signatured_type_table_from_index): Likewise.
(create_debug_type_hash_table): Likewise.
(fill_in_sig_entry_from_dwo_entry): Likewise.
(lookup_dwo_unit): Access objfile through dwarf2_per_objfile.
(create_type_unit_group): Assign dwarf2_per_objfile instead of
objfile.
(create_partial_symtab): Access objfile through
dwarf2_per_objfile.
(process_psymtab_comp_unit_reader): Likewise.
(read_comp_units_from_section): Likewise.
(scan_partial_symbols): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(peek_die_abbrev): Likewise.
(fixup_go_packaging): Likewise.
(process_full_comp_unit): Likewise.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(read_import_statement): Likewise.
(create_cus_hash_table): Assign dwarf2_physname instead of
objfile.
(read_func_scope): Access objfile through dwarf2_per_objfile.
(read_lexical_block_scope): Likewise.
(read_call_site_scope): Likewise.
(read_variable): Likewise.
(dwarf2_rnglists_process): Likewise.
(dwarf2_ranges_process): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_structure_type): Likewise.
(process_structure_scope): Likewise.
(read_enumeration_type): Likewise.
(read_array_type): Likewise.
(read_common_block): Likewise.
(read_namespace_type): Likewise.
(read_namespace): Likewise.
(read_module_type): Likewise.
(read_tag_pointer_type): Likewise.
(read_tag_ptr_to_member_type): Likewise.
(read_tag_string_type): Likewise.
(read_subroutine_type): Likewise.
(read_typedef): Likewise.
(read_base_type): Likewise.
(attr_to_dynamic_prop): Likewise.
(read_subrange_type): Likewise.
(read_unspecified_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_addr_index_from_leb128): Likewise.
(dwarf2_read_addr_index): Likewise.
(dwarf2_string_attr): Likewise.
(lnp_state_machine::check_line_address): Likewise.
(dwarf_decode_lines_1): Likewise.
(dwarf_decode_lines): Likewise.
(dwarf2_start_symtab): Likewise.
(var_decode_location): Likewise.
(new_symbol_full): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf2_const_value): Likewise.
(die_type): Likewise.
(die_containing_type): Likewise.
(lookup_die_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(dwarf2_name): Likewise.
(follow_die_ref_or_sig): Likewise.
(follow_die_offset): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig): Likewise.
(decode_locdesc): Likewise.
(dwarf2_per_cu_objfile): Likewise.
(dwarf2_per_cu_text_offset): Likewise.
(init_one_comp_unit): Assign dwarf2_per_objfile instead of
objfile.
(set_die_type): Access objfile through
dwarf2_per_objfile.
Simon Marchi [Sun, 7 Jan 2018 15:50:48 +0000 (10:50 -0500)]
Make parse_debug_format_options return an std::string
This avoid having to manually free the return value.
gdb/gdbserver/ChangeLog:
* server.c (parse_debug_format_options): Return std::string.
(handle_monitor_command, captured_main): Adjust.
Simon Marchi [Sun, 7 Jan 2018 15:48:21 +0000 (10:48 -0500)]
Replace VEC(converted_character_d) with std::vector
This patch changes the usage of VEC(converted_character_d) to use an
std::vector instead. This allows getting rid of a cleanup.
gdb/ChangeLog:
* valprint.c (converted_character_d): Remove typedef.
(DEF_VEC_O (converted_character_d)): Remove.
(count_next_character): Use std::vector.
(print_converted_chars_to_obstack): Likewise.
(generic_printstr): Likewise.