Alan Hayward [Mon, 25 Mar 2019 16:48:03 +0000 (16:48 +0000)]
Add linux_get_hwcap
Tidy up calls to read HWCAP (and HWCAP2) by adding common functions,
removing the PPC and AArch64 specific versions.
The only function difference is in aarch64_linux_core_read_description - if
the hwcap read fails it now return a valid description instead of nullptr.
gdb/ChangeLog:
2019-03-25 Alan Hayward <alan.hayward@arm.com>
* aarch64-linux-nat.c (aarch64_linux_nat_target::read_description):
Call linux_get_hwcap.
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
Likewise.
(aarch64_linux_get_hwcap): Remove function.
* aarch64-linux-tdep.h (aarch64_linux_get_hwcap): Remove
declaration.
* arm-linux-nat.c (arm_linux_nat_target::read_description):Call
linux_get_hwcap.
* arm-linux-tdep.c (arm_linux_core_read_description): Likewise.
* linux-tdep.c (linux_get_hwcap): Add function.
(linux_get_hwcap2): Likewise.
* linux-tdep.h (linux_get_hwcap): Add declaration.
(linux_get_hwcap2): Likewise.
* ppc-linux-nat.c (ppc_linux_get_hwcap): Remove function.
(ppc_linux_get_hwcap2): Likewise.
(ppc_linux_nat_target::region_ok_for_hw_watchpoint): Call
linux_get_hwcap.
(ppc_linux_nat_target::insert_watchpoint): Likewise.
(ppc_linux_nat_target::watchpoint_addr_within_range): Likewise.
(ppc_linux_nat_target::read_description): Likewise.
* ppc-linux-tdep.c (ppc_linux_core_read_description): Likewise.
* s390-linux-nat.c: Likewise.
* s390-linux-tdep.c (s390_core_read_description): Likewise.
Tamar Christina [Mon, 25 Mar 2019 12:16:17 +0000 (12:16 +0000)]
Arm: Fix Arm disassembler mapping symbol search.
Similar to the AArch64 patches the Arm disassembler has the same issues with
out of order sections but also a few short comings.
For one thing there are multiple code blocks to determine mapping symbols, and
they all work slightly different, and neither fully correct. The first thing
this patch does is centralise the mapping symbols search into one function
mapping_symbol_for_insn. This function is then updated to perform a search in
a similar way as AArch64.
Their used to be a value has_mapping_symbols which was used to determine the
default disassembly for objects that have no mapping symbols. The problem with
the approach was that it was determining this value in the same loop that needed
it, which is why this field could take on the states -1, 0, 1 where -1 means
"don't know". However this means that until you actually find a mapping symbol
or reach the end of the disassembly glob, you don't know if you did the right
action or not, and if you didn't you can't correct it anymore.
This is why the two jump-reloc-veneers-* testcases end up disassembling some
insn as data when they shouldn't.
Out of order here refers to an object file where sections are not listed in a
monotonic increasing VMA order.
The ELF ABI for Arm [1] specifies the following for mapping symbols:
1) A text section must always have a corresponding mapping symbol at it's
start.
2) Data sections do not require any mapping symbols.
3) The range of a mapping symbol extends from the address it starts on up to
the next mapping symbol (exclusive) or section end (inclusive).
However there is no defined order between a symbol and it's corresponding
mapping symbol in the symbol table. This means that while in general we look
up for a corresponding mapping symbol, we have to make at least one check of
the symbol below the address being disassembled.
When disassembling different PCs within the same section, the search for mapping
symbol can be cached somewhat. We know that the mapping symbol corresponding to
the current PC is either the previous one used, or one at the same address as
the current PC.
However this optimization and mapping symbol search must stop as soon as we
reach the end or start of the section. Furthermore if we're only disassembling
a part of a section, the search is a allowed to search further than the current
chunk, but is not allowed to search past it (The mapping symbol if there, must
be at the same address, so in practice we usually stop at PC+4).
lastly, since only data sections don't require a mapping symbol the default
mapping type should be DATA and not INSN as previously defined, however if the
binary has had all its symbols stripped than this isn't very useful. To fix
this we determine the default based on the section flags. This will allow the
disassembler to be more useful on stripped binaries. If there is no section
than we assume you to be disassembling INSN.
[1] https://developer.arm.com/docs/ihi0044/latest/elf-for-the-arm-architecture-abi-2018q4-documentation#aaelf32-table4-7
binutils/ChangeLog:
* testsuite/binutils-all/arm/in-order-all.d: New test.
* testsuite/binutils-all/arm/in-order.d: New test.
* testsuite/binutils-all/arm/objdump.exp: Support .d tests.
* testsuite/binutils-all/arm/out-of-order-all.d: New test.
* testsuite/binutils-all/arm/out-of-order.T: New test.
* testsuite/binutils-all/arm/out-of-order.d: New test.
* testsuite/binutils-all/arm/out-of-order.s: New test.
ld/ChangeLog:
* testsuite/ld-arm/jump-reloc-veneers-cond-long.d: Update disassembly.
* testsuite/ld-arm/jump-reloc-veneers-long.d: Update disassembly.
opcodes/ChangeLog:
* arm-dis.c (struct arm_private_data): Remove has_mapping_symbols.
(mapping_symbol_for_insn): Implement new algorithm.
(print_insn): Remove duplicate code.
Tamar Christina [Mon, 25 Mar 2019 12:14:37 +0000 (12:14 +0000)]
AArch64: Have -D override mapping symbol as documented.
The documentation for -D says that on Arm platforms -D should disassemble
data as instructions.
"If the target is an ARM architecture this switch also has the effect of
forcing the disassembler to decode pieces of data found in code sections
as if they were instructions. "
This makes it do as it says on the tincan so it's more consistent with
aarch32. The usecase here is for baremetal developers who have created
their instructions using .word directives instead if .insn.
Though for Linux users I do find this behavior somewhat non-optimal.
Perhaps there should be a new flag that just disassembles the values
following the actual mapping symbol?
binutils/ChangeLog:
* testsuite/binutils-all/aarch64/in-order-all.d: New test.
* testsuite/binutils-all/aarch64/out-of-order-all.d: New test.
* testsuite/binutils-all/aarch64/out-of-order.d:
opcodes/ChangeLog:
* aarch64-dis.c (print_insn_aarch64):
Implement override.
Tamar Christina [Mon, 25 Mar 2019 12:12:03 +0000 (12:12 +0000)]
AArch64: Fix AArch64 disassembler mapping symbol search
My previous patch for AArch64 was not enough to catch all the cases where
disassembling an out-of-order section could go wrong. It had missed the case
DATA sections could be incorrectly disassembled as TEXT.
Out of order here refers to an object file where sections are not listed in a
monotonic increasing VMA order.
The ELF ABI for AArch64 [1] specifies the following for mapping symbols:
1) A text section must always have a corresponding mapping symbol at it's
start.
2) Data sections do not require any mapping symbols.
3) The range of a mapping symbol extends from the address it starts on up to
the next mapping symbol (exclusive) or section end (inclusive).
However there is no defined order between a symbol and it's corresponding
mapping symbol in the symbol table. This means that while in general we look
up for a corresponding mapping symbol, we have to make at least one check of
the symbol below the address being disassembled.
When disassembling different PCs within the same section, the search for mapping
symbol can be cached somewhat. We know that the mapping symbol corresponding to
the current PC is either the previous one used, or one at the same address as
the current PC.
However this optimization and mapping symbol search must stop as soon as we
reach the end or start of the section. Furthermore if we're only disassembling
a part of a section, the search is a allowed to search further than the current
chunk, but is not allowed to search past it (The mapping symbol if there, must
be at the same address, so in practice we usually stop at PC+4).
lastly, since only data sections don't require a mapping symbol the default
mapping type should be DATA and not INSN as previously defined, however if the
binary has had all its symbols stripped than this isn't very useful. To fix this
we determine the default based on the section flags. This will allow the
disassembler to be more useful on stripped binaries. If there is no section than
we assume you to be disassembling INSN.
[1] https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4#aaelf64-section4-5-4
binutils/ChangeLog:
* testsuite/binutils-all/aarch64/in-order.d: New test.
* testsuite/binutils-all/aarch64/out-of-order.d: Disassemble data as
well.
opcodes/ChangeLog:
* aarch64-dis.c (print_insn_aarch64): Update the mapping symbol search
order.
Tamar Christina [Mon, 25 Mar 2019 12:08:53 +0000 (12:08 +0000)]
AArch64: Fix disassembler bug with out-of-order sections
The AArch64 disassembler has an optimization that it uses to reduce the amount
it has to search for mapping symbols during disassembly. This optimization
assumes that sections are listed in the section header in monotonic increasing
VMAs. However this is not a requirement for the ELF specification.
Because of this when such "out of order" sections occur the disassembler would
pick the wrong mapping symbol to disassemble the section with.
This fixes it by explicitly passing along the stop offset for the current
disassembly glob and when this changes compared to the previous one we've seen
the optimization won't be performed. In effect this restarts the search from
a well defined starting point. Usually the symbol's address.
The existing stop_vma can't be used for this as it is allowed to be unset and
setting this unconditionally would change the semantics of this field.
binutils/ChangeLog:
* objdump.c (disassemble_bytes): Pass stop_offset.
* testsuite/binutils-all/aarch64/out-of-order.T: New test.
* testsuite/binutils-all/aarch64/out-of-order.d: New test.
* testsuite/binutils-all/aarch64/out-of-order.s: New test.
include/ChangeLog:
* dis-asm.h (struct disassemble_info): Add stop_offset.
opcodes/ChangeLog:
* aarch64-dis.c (last_stop_offset): New.
(print_insn_aarch64): Use stop_offset.
Pedro Alves [Mon, 25 Mar 2019 13:26:23 +0000 (13:26 +0000)]
Fix testsuite hangs when gdb_test_multiple body errors out
This commit fixes a regression in the testsuite itself, triggered by
errors being raised from within gdb_test_multiple, originally reported
by Pedro Franco de Carvalho's at
<https://sourceware.org/ml/gdb-patches/2019-03/msg00160.html>. Parts
of the commit message are based on his report.
This started happening due to a commit that was introduced recently,
and it can cause the testsuite to hang.
The commit that triggers this is:
fe1a5cad302b5535030cdf62895e79512713d738
[gdb/testsuite] Log wait status on process no longer exists error
That commit introduces a new "eof" block in gdb_test_multiple. That
is not incorrect itself, but dejagnu's remote_expect is picking that
block as the "default" action when an error is raised from within the
commands inside a call to gdb_test_multiple:
# remote_expect works basically the same as standard expect, but it
# also takes care of getting the file descriptor from the specified
# host and also calling the timeout/eof/default section if there is an
# error on the expect call.
#
proc remote_expect { board timeout args } {
I find that "feature" surprising, and I don't really know why it
exists, but this means that the eof section that remote_expect picks
as the error block can be executed even when there was no actual eof
and the GDB process is still running, so the wait introduced in the
commit that tries to get the exit status of GDB hangs forever, while
GDB itself waits for input.
This only happens when there are internal testsuite errors (not
testcase failures). This can be reproduced easily with a testcase
such as:
gdb_start
gdb_test_multiple "show version" "show version" {
-re ".*" {
error "forced error"
}
}
I think that working around this in GDB is useful so that the
testsuite doesn't hang in these cases.
Adding an empty "default" block at the end of the expect body in
gdb_test_multiple doesn't work, because dejagnu gives preference to
"eof" blocks:
if { $x eq "eof" } {
set save_next 1
} elseif { $x eq "default" || $x eq "timeout" } {
if { $error_sect eq "" } {
set save_next 1
}
}
And we do have "eof" blocks. So we need to make sure that the last
"eof" block is safe to use as the default error block. It's also
pedantically incorrect to print
"ERROR: Process no longer exists"
which is what we'd get if the last eof block we have was selected
(more below on this).
So this commit solves this by appending an "eof" with an empty
spawn_id list, so that it won't ever match.
Now, why is the first "eof" block selected today as the error block,
instead of the last one?
The reason is that remote_expect, while parsing the body to select the
default block to execute after an error, is affected by the comments
in the body (since they are also parsed).
If this comment in gdb_test_multiple
# patterns below apply to any spawn id specified.
is changed to
# The patterns below apply to any spawn id specified.
then the second eof block is selected and there is no hang.
Any comment at that same place with an even number of tokens also
works.
This is IMO a coincidence caused by how comments work in TCL.
Comments should only appear in places where a command can appear. And
here, remote_expect is parsing a list of options, not commands, so
it's not unreasonable to not parse comments, similarly to how this:
set a_list {
an_element
# another_element
}
results in a list with three elements, not one element.
The fact that comments with an even number of tokens work is just a
coincidence of how remote_expect's little state machine is
implemented.
I thought we could solve this by stripping out comment lines in
gdb_expect, but I didn't find an easy way to do that. Particularly, a
couple naive approaches I tried run into complications. For example,
we have gdb_test calls with regular expressions that include sequences
like "\r\n#", and by the time we get to gdb_expect, the \r\n have
already been expanded to a real newline, so just splitting the whole
body at newline boundaries, looking for lines that start with #
results in incorrectly stripping out half of the gdb_text regexp. I
think it's better (at least in this commit), to move the comments out
of the list, because it's much simpler and risk free.
gdb/testsuite/ChangeLog:
2019-03-25 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_test_multiple): Split appends to $code and
move comments outside list. Append '-i "" eof' section.
Tom Tromey [Fri, 22 Mar 2019 22:53:12 +0000 (16:53 -0600)]
Remove null_block_symbol
This removes null_block_symbol. It seemed simpler to me to change
initializations and returns to use value initialization rather than
null_block_symbol. This also fixes up a few spots where
initialization was done piecemeal.
gdb/ChangeLog
2019-03-24 Tom Tromey <tom@tromey.com>
* ada-lang.c (standard_lookup): Simplify initialization.
(ada_lookup_symbol_nonlocal): Simplify return.
* solib-spu.c (spu_lookup_lib_symbol): Simplify return.
* solib-darwin.c (darwin_lookup_lib_symbol): Simplify return.
* solib-svr4.c (elf_lookup_lib_symbol): Simplify return.
* rust-lang.c (rust_lookup_symbol_nonlocal): Simplify
initialization.
* solib.c (solib_global_lookup): Simplify.
* symtab.c (null_block_symbol): Remove.
(symbol_cache_lookup): Simplify returns.
(lookup_language_this): Simplify returns.
(lookup_symbol_aux): Simplify return.
(lookup_local_symbol): Simplify returns.
(lookup_global_symbol_from_objfile): Simplify return.
(lookup_symbol_in_objfile_symtabs)
(lookup_symbol_in_objfile_from_linkage_name): Simplify return.
(lookup_symbol_via_quick_fns, lookup_symbol_in_static_block)
(lookup_static_symbol, lookup_global_symbol): Simplify return.
* cp-namespace.c (cp_lookup_bare_symbol)
(cp_search_static_and_baseclasses, cp_lookup_symbol_via_imports)
(cp_lookup_symbol_via_all_imports, cp_lookup_nested_symbol_1)
(cp_lookup_nested_symbol): Don't use null_block_symbol.
(cp_lookup_symbol_via_imports): Simplify initialization.
(find_symbol_in_baseclass): Likewise.
* symtab.h (null_block_symbol): Remove.
* d-namespace.c (d_lookup_symbol): Don't use null_block_symbol.
(d_lookup_nested_symbol, d_lookup_symbol_imports)
(d_lookup_symbol_module): Likewise.
(find_symbol_in_baseclass): Simplify initialization.
Tom Tromey [Fri, 22 Mar 2019 22:06:36 +0000 (16:06 -0600)]
Don't include symtab.h from expression.h
expression.h includes symtab.h, but apparently only for the
declaration of struct block. This patch changes it to foward-declare
the structure, and remove the include.
gdb/ChangeLog
2019-03-24 Tom Tromey <tom@tromey.com>
* expression.h: Don't include symtab.h.
(struct block): Forward declare.
Tom Tromey [Fri, 22 Mar 2019 21:54:10 +0000 (15:54 -0600)]
More block constification
I noticed that there are still many places referring to non-const
blocks. This constifies all the remaining ones that I found that
could be constified.
In a few spots, this search found unused variables or fields. I
removed these. I've also removed some unnecessary casts to
"struct block *".
gdb/ChangeLog
2019-03-24 Tom Tromey <tom@tromey.com>
* c-exp.y (typebase): Remove casts.
* gdbtypes.c (lookup_unsigned_typename, )
(lookup_signed_typename): Remove cast.
* eval.c (parse_to_comma_and_eval): Remove cast.
* parse.c (write_dollar_variable): Remove cast.
* block.h (struct block) <superblock>: Now const.
* symfile-debug.c (debug_qf_map_matching_symbols): Update.
* psymtab.c (psym_map_matching_symbols): Make "block" const.
(map_block): Make "block" const.
* symfile.h (struct quick_symbol_functions)
<map_matching_symbols>: Constify block argument to "callback".
* symtab.c (basic_lookup_transparent_type_quick): Make "block"
const.
(find_pc_sect_compunit_symtab): Make "b" const.
(find_symbol_at_address): Likewise.
(search_symbols): Likewise.
* dwarf2read.c (dw2_lookup_symbol): Make "block" const.
(dw2_debug_names_lookup_symbol): Likewise.
(dw2_map_matching_symbols): Update.
* p-valprint.c (pascal_val_print): Remove "block".
* ada-lang.c (ada_add_global_exceptions): Make "b" const.
(aux_add_nonlocal_symbols): Make "block" const.
(resolve_subexp): Remove cast.
* linespec.c (iterate_over_all_matching_symtabs): Make "block"
const.
(iterate_over_file_blocks): Likewise.
* f-exp.y (%union) <bval>: Remove.
* coffread.c (patch_opaque_types): Make "b" const.
* spu-tdep.c (spu_catch_start): Make "block" const.
* c-valprint.c (print_unpacked_pointer): Remove "block".
* symmisc.c (dump_symtab_1): Make "b" const.
(block_depth): Make "block" const.
* d-exp.y (%union) <bval>: Remove.
* cp-support.h (cp_lookup_rtti_type): Update.
* cp-support.c (cp_lookup_rtti_type): Make "block" const.
* psymtab.c (psym_lookup_symbol): Make "block" const.
(maintenance_check_psymtabs): Make "b" const.
* python/py-framefilter.c (extract_sym): Make "sym_block" const.
(enumerate_locals, enumerate_args): Update.
* python/py-symtab.c (stpy_global_block): Make "block" const.
(stpy_static_block): Likewise.
* inline-frame.c (block_starting_point_at): Make "new_block"
const.
* block.c (find_block_in_blockvector): Make return type const.
(blockvector_for_pc_sect): Make "b" const.
(find_block_in_blockvector): Make "b" const.
GDB Administrator [Mon, 25 Mar 2019 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sun, 24 Mar 2019 10:44:00 +0000 (11:44 +0100)]
(re-)fix the regcache leaks when detaching from an executable.
Commit
799efbe8e01ab8292c01f46ac59a6fb2349d4535 was supposed to fix
the below leak. However, for this fix to work, it is critical to
save the ptid before detach.
This commit (pushed as OBVIOUS, as the change was already reviewed/approved)
saves the ptid before the detach, as in the original reviewed patch
(see https://sourceware.org/ml/gdb-patches/2019-02/msg00263.html).
Re-tested on debian/amd64, natively and under valgrind.
==7426== 1,123 (72 direct, 1,051 indirect) bytes in 1 blocks are definitely lost in loss record 2,872 of 3,020
==7426== at 0x4C2C4CC: operator new(unsigned long) (vg_replace_malloc.c:344)
==7426== by 0x5BD1E1: get_thread_arch_aspace_regcache(ptid_t, gdbarch*, address_space*) (regcache.c:330)
==7426== by 0x5BD39A: get_thread_regcache (regcache.c:366)
==7426== by 0x5BD39A: get_current_regcache() (regcache.c:372)
==7426== by 0x4B1EB4: get_current_frame() (frame.c:1588)
...
GDB Administrator [Sun, 24 Mar 2019 00:01:13 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 23 Mar 2019 16:11:51 +0000 (10:11 -0600)]
Have parser reset the innermost block tracker
I ran across a comment in symfile.c today:
/* Clear globals which might have pointed into a removed objfile.
FIXME: It's not clear which of these are supposed to persist
between expressions and which ought to be reset each time. */
It seems to me that this can be clarified: the parser entry points
ought to reset the innermost block tracker (and the expression context
block), and these should not be considered valid for code to use at
arbitrary times -- only immediately after an expression has been
parsed.
This patch implements this idea. This could be further improved by
removing the parser globals and changing the parser functions to
return this information, but I have not done this.
Tested by the buildbot.
gdb/ChangeLog
2019-03-23 Tom Tromey <tom@tromey.com>
* varobj.c (varobj_create): Update.
* symfile.c (clear_symtab_users): Don't reset innermost_block.
* printcmd.c (display_command, do_one_display): Don't reset
innermost_block.
* parser-defs.h (enum innermost_block_tracker_type): Move to
expression.h.
(innermost_block): Update comment.
* parse.c (parse_exp_1): Add tracker_types parameter.
(parse_exp_in_context): Rename from parse_exp_in_context_1. Add
tracker_types parameter. Reset innermost_block.
(parse_exp_in_context): Remove.
(parse_expression_for_completion): Update.
* objfiles.c (~objfile): Don't reset expression_context_block or
innermost_block.
* expression.h (enum innermost_block_tracker_type): Move from
parser-defs.h.
(parse_exp_1): Add tracker_types parameter.
* breakpoint.c (set_breakpoint_condition, watch_command_1): Don't
reset innermost_block.
Tom Tromey [Sat, 23 Mar 2019 16:50:27 +0000 (10:50 -0600)]
Include bcache.h from objfiles.h
objfiles.h needs "struct bcache" to be complete, so it should include
bcache.h. This patch implements this.
Tested by rebuilding.
gdb/ChangeLog
2019-03-23 Tom Tromey <tom@tromey.com>
* objfiles.h: Include bcache.h.
Tom Tromey [Sat, 23 Mar 2019 15:43:49 +0000 (09:43 -0600)]
Use scoped_restore_current_language in two places
I found a couple of spots that manually saved and restored the current
language. This patch changes them to use
scoped_restore_current_language.
Tested by the buildbot.
gdb/ChangeLog
2019-03-23 Tom Tromey <tom@tromey.com>
* linespec.c (get_current_search_block): Use
scoped_restore_current_language.
* symmisc.c (dump_symtab): Use scoped_restore_current_language.
GDB Administrator [Sat, 23 Mar 2019 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Hayward [Fri, 22 Mar 2019 10:43:17 +0000 (10:43 +0000)]
AArch64: Read pauth section from core files
gdb/ChangeLog:
* aarch64-linux-tdep.c
(aarch64_linux_iterate_over_regset_sections): Check for pauth
section.
* aarch64-linux-tdep.h (AARCH64_LINUX_SIZEOF_PAUTH): New define.
Alan Hayward [Fri, 22 Mar 2019 10:41:15 +0000 (10:41 +0000)]
AArch64: Prologue scan unwinder support for signed return addresses
Pauth address signing is enabled at binary compile time. When enabled the
return addresses for functions may be mangled. This patch adds functionality
to restore the original address for use in the prologue scan unwinder.
In the prologue analyzer, check for PACIASP/PACIBSP (enable address mangling)
and AUTIASP/AUTIBSP (disable address mangling).
When unwinding the PC from the prologue, unmask the register if required.
Add a test case to the prologue tests.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_analyze_prologue): Check for pauth
instructions.
(aarch64_analyze_prologue_test): Add PACIASP test.
(aarch64_prologue_prev_register): Unmask PC value.
Alan Hayward [Fri, 22 Mar 2019 10:39:11 +0000 (10:39 +0000)]
AArch64: DWARF unwinder support for signed return addresses
Pauth address signing is enabled at binary compile time. When enabled the
return addresses for functions may be mangled. This patch adds functionality
to restore the original address for use in the DWARF unwinder.
DW_CFA_AARCH64_negate_ra_state in a binary indicates the toggling of address
signing between enabled and disabled. Ensure the state is stored in the DWARF
register ra_state.
Ensure the pauth DWARF registers are initialised.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_frame_unmask_address): New function.
(aarch64_dwarf2_prev_register): Unmask PC value.
(aarch64_dwarf2_frame_init_reg): Init pauth registers.
(aarch64_execute_dwarf_cfa_vendor_op): Check for
DW_CFA_AARCH64_negate_ra_state.
(aarch64_gdbarch_init): Add aarch64_execute_dwarf_cfa_vendor_op.
Alan Hayward [Fri, 22 Mar 2019 10:37:46 +0000 (10:37 +0000)]
AArch64: Add pauth DWARF registers
Map the pauth registers to DWARF.
Add a new pseudo register ra_state and also map this to DWARF. This register
is hidden from the user - prevent it from being read or written to. It will
be used for the unmangling of addresses.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Check for pauth
registers.
(aarch64_pseudo_register_name): Likewise.
(aarch64_pseudo_register_type): Likewise.
(aarch64_pseudo_register_reggroup_p): Likewise.
(aarch64_gdbarch_init): Add pauth registers.
* aarch64-tdep.h (AARCH64_DWARF_PAUTH_RA_STATE): New define.
(AARCH64_DWARF_PAUTH_DMASK): Likewise.
(AARCH64_DWARF_PAUTH_CMASK): Likewise.
(struct gdbarch_tdep): Add regnum for ra_state.
Alan Hayward [Fri, 22 Mar 2019 10:34:09 +0000 (10:34 +0000)]
AArch64: gdbserver: read pauth registers
Add the pauth registers to the regset lists.
Add a new regset type OPTIONAL_REGS which allows for the regset read to fail.
Once the read fails, it will not be checked again. This allows targets with
optional features to keep a single static regset_info structure.
gdb/ChangeLog:
* arch/aarch64.h (AARCH64_PAUTH_REGS_SIZE): New define.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_store_pauthregset): New function.
* linux-low.c (regsets_store_inferior_registers): Allow optional reads
to fail.
* linux-low.h (enum regset_type): Add OPTIONAL_REGS.
Alan Hayward [Fri, 22 Mar 2019 10:31:02 +0000 (10:31 +0000)]
AArch64: Read pauth registers
Initialise the pauth registers when creating a target description, and store
the regnum of the first pauth register.
Use ptrace to read the registers in the pauth feature.
Do not allow the registers to be written.
gdb/ChangeLog:
* aarch64-linux-nat.c (fetch_pauth_masks_from_thread): New
function.
(aarch64_linux_nat_target::fetch_registers): Read pauth registers.
* aarch64-tdep.c (aarch64_cannot_store_register): New function.
(aarch64_gdbarch_init): Add puth registers.
* aarch64-tdep.h (struct gdbarch_tdep): Add pauth features.
* arch/aarch64.h (AARCH64_PAUTH_DMASK_REGNUM): New define.
(AARCH64_PAUTH_CMASK_REGNUM): Likewise.
Alan Hayward [Fri, 22 Mar 2019 10:00:28 +0000 (10:00 +0000)]
AArch64: Use HWCAP to detect pauth feature
Add aarch64_get_hwcap functions for reading the HWCAP.
From this extract the PACA value and use this to enable pauth.
gdb/ChangeLog:
* aarch64-linux-nat.c
(aarch64_linux_nat_target::read_description): Read PACA hwcap.
* aarch64-linux-tdep.c
(aarch64_linux_core_read_description): Likewise.
(aarch64_linux_get_hwcap): New function.
* aarch64-linux-tdep.h (AARCH64_HWCAP_PACA): New define.
(aarch64_linux_get_hwcap): New declaration.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (AARCH64_HWCAP_PACA): New define.
(aarch64_get_hwcap): New function.
(aarch64_arch_setup): Read APIA hwcap.
Alan Hayward [Fri, 22 Mar 2019 09:58:42 +0000 (09:58 +0000)]
AArch64: Add pointer authentication feature
Pointer Authentication is a new feature in AArch64 v8.3-a. When enabled in
the compiler, function return addresses will be mangled by the kernel.
Add register description xml and wire up to aarch64_linux_read_description.
This description includes the two pauth user registers.
Nothing yet uses the feature - that is added in later patches.
gdb/ChangeLog:
* aarch64-linux-nat.c
(aarch64_linux_nat_target::read_description): Add pauth param.
* aarch64-linux-tdep.c
(aarch64_linux_core_read_description): Likewise.
* aarch64-tdep.c (struct target_desc): Add in pauth.
(aarch64_read_description): Add pauth param.
(aarch64_gdbarch_init): Likewise.
* aarch64-tdep.h (aarch64_read_description): Likewise.
* arch/aarch64.c (aarch64_create_target_description): Likewise.
* arch/aarch64.h (aarch64_create_target_description): Likewise.
* features/Makefile: Add new files.
* features/aarch64-pauth.c: New file.
* features/aarch64-pauth.xml: New file.
gdb/doc/ChangeLog:
* gdb.texinfo: Describe pauth feature.
gdb/gdbserver/ChangeLog:
* linux-aarch64-ipa.c (get_ipa_tdesc): Add pauth param.
(initialize_low_tracepoint): Likewise.
* linux-aarch64-low.c (aarch64_arch_setup): Likewise.
* linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Likewise.
* linux-aarch64-tdesc.c (struct target_desc): Likewise.
(aarch64_linux_read_description): Likewise.
* linux-aarch64-tdesc.h (aarch64_linux_read_description): Likewise.
Alan Hayward [Wed, 13 Feb 2019 12:28:38 +0000 (12:28 +0000)]
Testsuite: Ensure pie is disabled on some tests
Recent versions of Ubuntu and Debian default GCC to enable pie.
In dump.exp, pie will causes addresses to be out of range for IHEX.
In break-interp.exp, pie is explicitly set for some tests and assumed
to be disabled for the remainder.
Ensure pie is disabled for these tests when required.
In addition, add a pie option to gdb_compile to match the nopie option
and simplify use.
gdb/testsuite/ChangeLog:
* README: Add pie options.
* gdb.base/break-interp.exp: Ensure pie is disabled.
* gdb.base/dump.exp: Likewise.
* lib/gdb.exp (gdb_compile): Add pie option.
GDB Administrator [Fri, 22 Mar 2019 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 21 Mar 2019 22:08:48 +0000 (15:08 -0700)]
RISC-V: Fix linker crash in section symbol check.
sym is only set for local symbols. h is only set for global symbols. Gas
won't let me create a global section symbol, but bfd appears to have some
support for that, and I can't rule out that other assemblers might do this.
So we need to support both, and verify sym and h are non-NULL before using.
bfd/
PR 24365
* elfnn-riscv.c (riscv_elf_relocate_section): For STT_SECTION check,
verify sym non-NULL before using. Add identical check using h.
Sudakshina Das [Thu, 21 Mar 2019 16:20:21 +0000 (16:20 +0000)]
[BFD, AArch64, x86] Improve warning for --force-bti
The AArch64 linker option to turn on BTI (--force-bti) warns in case there are
input objects which have a missing GNU NOTE section for BTI. This patch is trying
to improve the warnings that come out.
In order to do so, I propose adding a new argument to elf_merge_gnu_properties
and the backend function merge_gnu_properties. This new argument makes sure
that we now pass both the objects along with the properties to which they
belong to. The x86 backend function has also been updated to match this
change.
*** bfd/ChangeLog ***
2019-03-21 Sudakshina Das <sudi.das@arm.com>
* elf-bfd.h (struct elf_backend_data): Add argument to
merge_gnu_properties.
* elf-properties.c (elf_merge_gnu_properties): Add argument to
itself and while calling bed->merge_gnu_properties.
(elf_merge_gnu_property_list): Update the calls for
elf_merge_gnu_properties.
* elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update handling
of --force-bti warning and add argument.
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Add
warning.
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Add argument.
* elfxx-x86.h (_bfd_x86_elf_merge_gnu_properties): Likewise in
declaration.
*** ld/ChangeLog ***
2019-03-21 Sudakshina Das <sudi.das@arm.com>
* testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
* testsuite/ld-aarch64/bti-plt-1.s: Add .ifdef for PAC note section.
* testsuite/ld-aarch64/bti-plt-6.d: Update warning.
* testsuite/ld-aarch64/bti-plt-7.d: Likewise.
* testsuite/ld-aarch64/bti-warn.d: New test.
Alan Modra [Thu, 21 Mar 2019 05:31:08 +0000 (16:01 +1030)]
Adjust pr14156 test for m68hc1*
The test section alignment is unnecessarily high, overflowing the
m68hc11 page used by .init code.
* testsuite/ld-elf/fini2.s: Reduce alignment.
* testsuite/ld-elf/fini3.s: Likewise.
* testsuite/ld-elf/finin.s: Likewise.
* testsuite/ld-elf/init2.s: Likewise.
* testsuite/ld-elf/init3.s: Likewise.
* testsuite/ld-elf/initn.s: Likewise.
* testsuite/ld-elf/pr14156a.d: Don't xfail m68hc1*-* or xgate-*.
* testsuite/ld-elf/pr14156b.d: Don't xfail xgate-*.
Alan Modra [Thu, 21 Mar 2019 04:28:35 +0000 (14:58 +1030)]
Add SORT_NONE to .init and .fini in scripts
The special case for .init and .fini in update_wild_statements is
ineffective for .init or .fini wildcards inside other output sections.
The special case needs to be on the wildcard, not the output section.
This patch is belt and braces, both fixing update_wild_statements and
the scripts.
* scripttempl/alpha.sc, * scripttempl/armbpabi.sc,
* scripttempl/crisaout.sc, * scripttempl/elf32cr16.sc,
* scripttempl/elf32crx.sc, * scripttempl/elf32xc16x.sc,
* scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc,
* scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc,
* scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc,
* scripttempl/elfd30v.sc, * scripttempl/elfm68hc11.sc,
* scripttempl/elfm68hc12.sc, * scripttempl/elfm9s12z.sc,
* scripttempl/elfmicroblaze.sc, * scripttempl/elfxgate.sc,
* scripttempl/elfxtensa.sc, * scripttempl/epiphany_4x4.sc,
* scripttempl/ft32.sc, * scripttempl/i386beos.sc,
* scripttempl/iq2000.sc, * scripttempl/mcorepe.sc,
* scripttempl/mep.sc, * scripttempl/mips.sc, * scripttempl/moxie.sc,
* scripttempl/pe.sc, * scripttempl/pep.sc, * scripttempl/ppcpe.sc,
* scripttempl/tic4xcoff.sc, * scripttempl/tic80coff.sc,
* scripttempl/v850.sc, * scripttempl/v850_rh850.sc,
* scripttempl/visium.sc, * scripttempl/xstormy16.sc: Add KEEP and
SORT_NONE to .init and .fini wildcards.
* scripttempl/elf32xc16x.sc,
* scripttempl/elf32xc16xl.sc,
* scripttempl/elf32xc16xs.sc: Add .fini wildcard.
* scripttempl/elf_chaos.sc: Add .init output section.
* scripttempl/elfd30v.sc: Remove duplicate .init.
* scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc,
* scripttempl/elfm9s12z.sc, * scripttempl/elfxgate.sc: Remove
duplicate .init, and add .fini wildcard.
* scripttempl/ppcpe.sc (INIT, FINI): Delete.
* ldlang.c (update_wild_statements): Special case .init and
.fini in the wildcard, not the output section.
GDB Administrator [Thu, 21 Mar 2019 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 20 Mar 2019 22:09:18 +0000 (08:39 +1030)]
lm32-linux ld testsuite fails
A number of the fails are due to ld supporting the creation of shared
libraries but not allowing linking against them without using an
option like -Bdynamic.
FAIL: Symbol export class test (final shared object)
FAIL: PROVIDE_HIDDEN test 4
FAIL: PROVIDE_HIDDEN test 6
FAIL: PROVIDE_HIDDEN test 10
FAIL: PROVIDE_HIDDEN test 12
FAIL: Build pr22471b.so
FAIL: Build pr22649-2b.so
FAIL: Build pr22649-2d.so
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: PR ld/21233 dynamic symbols with section GC (--undefined)
FAIL: PR ld/21233 dynamic symbols with section GC (--require-defined)
FAIL: PR ld/21233 dynamic symbols with section GC (EXTERN)
FAIL: Build pr22150
FAIL: PR ld/14170
FAIL: Link using broken linker script
FAIL: pr17068 link --as-needed lib in group
FAIL: ld-gc/pr20022
* emulparams/elf32lm32fd.sh (DYNAMIC_LINK): Undef.
Alan Modra [Wed, 20 Mar 2019 08:05:16 +0000 (18:35 +1030)]
Remove strip_underscore from struct emulation
This field is unused. I would have liked to also remove
leading_underscore and fake_label_name but in an i386-elf/coff/aout
multi-obj setup those fields are used to select a different
fake_label_name for aout.
* emul.h (struct emulation): Delete strip_underscore.
* emul-target.h (emul_strip_underscore): Don't define.
(emul_struct_name): Update initialization.
Alan Modra [Tue, 19 Mar 2019 22:50:55 +0000 (09:20 +1030)]
Teach a few targets to resolve BFD_RELOC_8
and tidy "forward" test. I've removed some checks in d30v
md_apply_fix that have no business being there. Any symbol problems
will be caught later in tc_gen_reloc, and overflow checking is done in
gas/write.c.
* config/tc-d10v.c (md_apply_fix): Apply BFD_RELOC_8.
* config/tc-pdp11.c (md_apply_fix): Likewise.
* config/tc-d30v.c (md_apply_fix): Don't emit errors for BFD_RELOC_8,
BFD_RELOC_16, and BFD_RELOC_64.
* testsuite/gas/all/gas.exp: Move target exclusions for forward
test, but not cr16, to..
* testsuite/gas/all/forward.d: ..here, with explanation. Remove
d10v, d30v, and pdp11 xfails.
Alan Modra [Tue, 19 Mar 2019 05:11:58 +0000 (15:41 +1030)]
Fix some dlx fails
Generic linker ELF targets using CREATE_OBJECT_SYMBOLS in their
scripts run into a problem. The file symbols are created by
_bfd_generic_link_output_symbols in each object file, in the section
corresponding to the CREATE_OBJECT_SYMBOLS section, typically .text.
If it so happens that the output .text section is stripped due to
being empty, then elf.c:assign_section_numbers won't assign an ELF
section number and swap_out_syms will report "unable to find
equivalent output section" for the object symbols. Fix this by
always keeping an output section with CREATE_OBJECT_SYMBOLS.
* ldlang.c (lang_size_sections_1): Set SEC_KEEP on
create_object_symbols_section.
* testsuite/ld-elf/pr22319.d: Don't xfail dlx.
Sudakshina Das [Wed, 20 Mar 2019 18:00:07 +0000 (18:00 +0000)]
[BFD, AArch64] Define elf_backend_fixup_gnu_properties in AArch64
This patch add support for elf_backend_fixup_gnu_properties for GNU
property support for AArch64. The new AArch64 specific definition
_bfd_aarch64_elf_link_fixup_gnu_properties goes through the property
list to find AArch64 type properties and removes the properties that
are marked as "property_remove".
*** bfd/ChangeLog ***
2019-03-20 Sudakshina Das <sudi.das@arm.com>
* elfxx-aarch64.c (_bfd_aarch64_elf_link_fixup_gnu_properties): Define.
* elfxx-aarch64.h (_bfd_aarch64_elf_link_fixup_gnu_properties): Declare.
(elf_backend_fixup_gnu_properties): Define for AArch64.
Tom Tromey [Wed, 20 Mar 2019 14:12:38 +0000 (08:12 -0600)]
Use @defvar to document gdb.pretty_printers
While referencing the manual, I noticed that gdb.pretty_printers
wasn't documented using @defvar. This made it more difficult to find
in the info pages. This patch adds the @defvar and also an
introductory paragraph in that node.
gdb/doc/ChangeLog
2019-03-20 Tom Tromey <tromey@adacore.com>
* python.texi (Selecting Pretty-Printers): Use @defvar for
gdb.pretty_printers.
Tom Tromey [Wed, 20 Mar 2019 13:57:09 +0000 (07:57 -0600)]
Merge handle_inferior_event and handle_inferior_event_1
I noticed that handle_inferior_event is just a small wrapper that
frees the value chain. This patch replaces it with a
scoped_value_mark, reducing the number of lines of code here.
Regression tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-03-20 Tom Tromey <tromey@adacore.com>
* infrun.c (handle_inferior_event): Rename from
handle_inferior_event_1. Create a scoped_value_mark.
(handle_inferior_event): Remove.
GDB Administrator [Wed, 20 Mar 2019 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 12 Mar 2019 18:56:01 +0000 (12:56 -0600)]
Don't show "display"s twice in MI
If you run "gdb -i=mi2" and set a "display", then when "next"ing the
displays will be shown twice:
~"1: x = 23\n"
~"7\t printf(\"%d\\n\", x);\n"
~"1: x = 23\n"
*stopped,reason="end-stepping-range",frame={addr="0x0000000000400565",func="main",args=[],file="q.c",fullname="/tmp/q.c",line="7"},thread-id="1",stopped-threads="all",core="1"
The immediate cause of this is this code in mi_on_normal_stop_1:
print_stop_event (mi_uiout);
console_interp = interp_lookup (current_ui, INTERP_CONSOLE);
if (should_print_stop_to_console (console_interp, tp))
print_stop_event (mi->cli_uiout);
... which obviously prints the stop twice.
However, I think the first call to print_stop_event is intended just
to emit the MI *stopped notification, which explains why the source
line does not show up two times.
This patch fixes the bug by changing print_stop_event to only call
do_displays for non-MI-like ui-outs.
Tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-03-19 Tom Tromey <tromey@adacore.com>
* mi/mi-interp.c (mi_on_normal_stop_1): Only show displays once.
* infrun.h (print_stop_event): Add "displays" parameter.
* infrun.c (print_stop_event): Add "displays" parameter.
gdb/testsuite/ChangeLog
2019-03-19 Tom Tromey <tromey@adacore.com>
* gdb.mi/mi2-cli-display.c: New file.
* gdb.mi/mi2-cli-display.exp: New file.
Pedro Alves [Tue, 19 Mar 2019 18:08:27 +0000 (18:08 +0000)]
Add comments describing tui_ui_out and its fields, cleanup a bit
This commit add comments describing tui_ui_out and its fields, and
cleans up the code a little bit.
Also switch to using in-class initialization so that the initial
values can be seen alongside the comments.
I see no reason for initializing m_line as -1 instead of 0, since all
the checks in the .c file are of the form "> 0". AFAICS there's no
practical difference between -1 and 0. So it seems simpler to
initialize it as 0.
There's a bit of redundancy in tui_ui_out::do_field_string, which is
fixed by this commit.
gdb/ChangeLog:
2019-03-19 Pedro Alves <palves@redhat.com>
* tui/tui-out.c (tui_ui_out::do_field_string): Simplify.
(tui_ui_out::do_text): Add comments. Reset M_LINE to 0 instead of
to -1. Fix TABs vs spaces.
(tui_ui_out::tui_ui_out): Don't initialize fields here.
* tui/tui-out.h (tui_ui_out) Add intro comments.
<m_line, m_start_of_line>: In-class initialize, and add describing
comment.
Nick Clifton [Tue, 19 Mar 2019 13:39:30 +0000 (13:39 +0000)]
Prevent an illegal memory access by objdump when parsing a corrupt file on a 32-bit host.
PR 24360
* objdump.c (load_specific_debug_section): Check that the amount
of memory to be allocated matches the size of the section.
H.J. Lu [Tue, 19 Mar 2019 13:12:47 +0000 (21:12 +0800)]
x86: Correct EVEX vector load/store optimization
Update EVEX vector load/store optimization:
1. There is no need to check AVX since AVX2 is required for AVX512F.
2. We need to check both operands for ZMM register since AT&T syntax
may not set zmmword on the first operand.
3. Update Opcode_SIMD_IntD check and set.
4. Since the VEX prefix has 2 or 3 bytes, the EVEX prefix has 4 bytes,
EVEX Disp8 has 1 byte and VEX Disp32 has 4 bytes, we choose EVEX Disp8
over VEX Disp32.
* config/tc-i386.c (optimize_encoding): Don't check AVX for
EVEX vector load/store optimization. Check both operands for
ZMM register. Update EVEX vector load/store opcode check.
Choose EVEX Disp8 over VEX Disp32.
* testsuite/gas/i386/optimize-1.d: Updated.
* testsuite/gas/i386/optimize-1a.d: Likewise.
* testsuite/gas/i386/optimize-2.d: Likewise.
* testsuite/gas/i386/optimize-4.d: Likewise.
* testsuite/gas/i386/optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2a.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2b.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.d: Likewise.
* testsuite/gas/i386/optimize-1.s: Add ZMM register load
test.
* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
H.J. Lu [Tue, 19 Mar 2019 13:10:21 +0000 (21:10 +0800)]
x86: Correct EVEX to 128-bit EVEX optimization
Since not all AVX512F processors support AVX512VL, we can optimize
512-bit EVEX to 128-bit EVEX encoding for upper 16 vector registers
only when AVX512VL is enabled explicitly at command-line or via
".arch .avx512vl" directive.
PR gas/24352
* config/tc-i386.c (optimize_encoding): Check only
cpu_arch_flags.bitfield.cpuavx512vl.
* testsuite/gas/i386/i386.exp: Run x86-64-optimize-2b.
* testsuite/gas/i386/x86-64-optimize-2.d: Revert the last
change.
* testsuite/gas/i386/x86-64-optimize-2b.d: New file.
* testsuite/gas/i386/x86-64-optimize-2b.s: Likewise.
H.J. Lu [Tue, 19 Mar 2019 13:08:15 +0000 (21:08 +0800)]
ix86: Disable AVX512F when disabling AVX2
Since AVX2 is required for AVX512F, we should disable AVX512F when AVX2
is disabled.
gas/
PR gas/24359
* testsuite/gas/i386/i386.exp: Change optimize-6a, optimize-7,
x86-64-optimize-7a and x86-64-optimize-8 tests to run_list_test.
Remove optimize-6c and x86-64-optimize-7c tests.
* testsuite/gas/i386/noavx-3.l: Updated.
* testsuite/gas/i386/noavx-4.d: Likewise.
* testsuite/gas/i386/noavx-5.d: Likewise.
* testsuite/gas/i386/noavx-3.s: Add AVX512F tests.
* testsuite/gas/i386/noavx-4.s: Remove AVX512F tests.
* testsuite/gas/i386/nosse-5.s: Likewise.
* testsuite/gas/i386/optimize-6a.d: Removed.
* testsuite/gas/i386/optimize-6c.d: Likewise.
* testsuite/gas/i386/optimize-7.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7a.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7c.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-8.d: Likewise.
* testsuite/gas/i386/optimize-6a.l: New file.
* testsuite/gas/i386/optimize-6a.s: Likewise.
* testsuite/gas/i386/optimize-7.l: Likewise.
* testsuite/gas/i386/x86-64-optimize-7a.l: Likewise.
* testsuite/gas/i386/x86-64-optimize-7a.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-8.l: Likewise.
opcodes/
PR gas/24359
* i386-gen.c (cpu_flag_init): Add CPU_ANY_AVX512F_FLAGS to
CPU_ANY_AVX2_FLAGS.
* i386-init.h: Regenerated.
Alan Hayward [Mon, 18 Mar 2019 16:13:12 +0000 (16:13 +0000)]
Fix Arm build error
The following commit broke the build for Arm:
d3a70e03cf51c8fb6bc183eaff7559edffec2045
Change iterate_over_lwps to take a gdb::function_view
Correct the changes made to arm_linux_insert_hw_breakpoint1 and make
similar changes to arm_linux_remove_hw_breakpoint1.
2019-03-18 Alan Hayward <alan.hayward@arm.com>
* arm-linux-nat.c (arm_linux_insert_hw_breakpoint1): Fix
variable names.
(arm_linux_remove_hw_breakpoint1): Use a gdb::function_view.
GDB Administrator [Tue, 19 Mar 2019 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Mon, 18 Mar 2019 18:32:42 +0000 (18:32 +0000)]
Fix first time you type UP or DOWN in TUI's command window
The first time you type UP or DOWN arrow in the command window, GDB
should scroll the source window, but instead it displays the line
number and the file name in the command window(?).
What happens there is that the first time we call
tui_ui_out::do_field_int, it doesn't initialize m_line, because
m_start_of_line is -1, as set by the constructor; and then the
following call to tui_ui_out::do_field_string falls back to
cli_ui_out::do_field_string because m_line is zero.
The problem is caused by a typo in the C++ification of tui_ui_out,
commit
112e8700a6f, where m_line and m_start_of_line's initial values
were swapped from what they used to be:
-struct ui_out *
-tui_out_new (struct ui_file *stream)
+tui_ui_out::tui_ui_out (ui_file *stream)
+: cli_ui_out (stream, 0),
+ m_line (0),
+ m_start_of_line (-1)
{
-
- /* Initialize our fields. */
- data->line = -1;
- data->start_of_line = 0;
This commit fixes it.
gdb/ChangeLog:
2019-03-18 Pedro Alves <palves@redhat.com>
Eli Zaretskii <eliz@gnu.org>
* tui/tui-out.c (tui_ui_out::tui_ui_out): Fix initialization of
m_line and m_start_of_line.
Eli Zaretskii [Mon, 18 Mar 2019 18:04:40 +0000 (20:04 +0200)]
Fix gdb/TUI behavior in response to [Enter] keypress
gdb/ChangeLog:
2019-03-18 Eli Zaretskii <eliz@gnu.org>
* tui/tui-io.c (gdb_wgetch): Don't echo CR.
(tui_getc): When gdb_wgetch returns a CR, behave the same as when
it returns a newline. This fixes a regression in TUI mode, whereby
the next line is output on the same screen line as the user input.
Tom Tromey [Mon, 18 Mar 2019 15:32:09 +0000 (09:32 -0600)]
Fix regression caused by minimal symbol changes
The earlier patch to change minimal symbol allocations to use xmalloc
erroneously left a call to obstack_blank in
minimal_symbol_reader::install. Because obstack_blank does not finish
the object allocation on an obstack, this in turn could cause invalid
memory reads in some situations.
This patch fixes the problem by removing the call. Tested on x86-64
Fedora 29; also verified with valgrind.
gdb/ChangeLog
2019-03-18 Tom Tromey <tromey@adacore.com>
* minsyms.c (minimal_symbol_reader::install): Remove call to
obstack_blank.
Pedro Alves [Mon, 18 Mar 2019 14:26:00 +0000 (14:26 +0000)]
Improve/fix the TUI's current source line highlight
With styling enabled, I think the way we display the TUI's
highlighted/current line is very ugly and distracting. The problem in
my view is that we reverse foreground/background in colored text as
well, leading to rainbow of background colors.
This patch changes that to something that I find much more sensible --
only reverse the default foreground/background colors, leave styled
text colors alone. If the foreground color is not the default
(because the text was styled), leave the foreground color as is. If
e.g., the terminal is fg=BLACK, and bg=WHITE, and the style wants to
print text in RED, reverse the background color (print in BLACK), but
still print the text in RED.
Note: The new ui_file_style::set_fg method isn't called set_foreground
instead, because set_foreground is a macro in /usr/lib/term.h (ncurses).
gdb/ChangeLog:
2019-03-18 Pedro Alves <palves@redhat.com>
* tui/tui-io.c (reverse_mode_p, reverse_save_bg, reverse_save_fg):
New globals.
(apply_style): New, factored out from ...
(apply_ansi_escape): ... this. Handle reverse video mode.
(tui_set_reverse_mode): New function.
* tui/tui-io.h (tui_set_reverse_mode): New declaration.
* tui/tui-winsource.c (tui_show_source_line): Use
tui_set_reverse_mode instead of setting A_STANDOUT.
* ui-style.h (struct ui_file_style) <set_reverse, set_fg, set_bg>:
New setter methods.
Hannes Domani [Mon, 18 Mar 2019 14:25:59 +0000 (14:25 +0000)]
Fix scrolling right in the TUI
This commit fixes two issues in scrolling right in the TUI:
#1 - Scrolling right with the arrow keys, the first keypress doesn't
do anything. The problem is that copy_source_line() checks if
(column < first_col), and because of the ++column directly before, it
basically starts with 1 instead of 0.
#2 - Scrolling right handles TABS and escaped characters as single
characters, which just looks weird. The problem is that there's a
spot that misses handling TABS.
gdb/ChangeLog:
2019-03-18 Hannes Domani <ssbssa@yahoo.de>
* tui/tui-source.c (copy_source_line): Fix handling of 'column'.
Handle tabs.
Tom Tromey [Wed, 13 Mar 2019 14:40:25 +0000 (08:40 -0600)]
Fix Ada "ptype" bug with array types
Using ptype on an array type in Ada can sometimes show an incorrect
high bound. This happens because ada_evaluate_subexp will create an
array with an incorrect upper bound in the EVAL_AVOID_SIDE_EFFECTS
case.
This patch fixes the problem by arranging to always create such an
array with valid bounds.
Tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-03-18 Tom Tromey <tromey@adacore.com>
* ada-lang.c (empty_array): Add "high" parameter.
(ada_evaluate_subexp): Update.
gdb/testsuite/ChangeLog
2019-03-18 Joel Brobecker <brobecker@adacore.com>
Tom Tromey <tromey@adacore.com>
* gdb.ada/ptype_array/pck.adb: New file.
* gdb.ada/ptype_array/pck.ads: New file.
* gdb.ada/ptype_array/foo.adb: New file.
* gdb.ada/ptype_array.exp: New file.
Alan Modra [Mon, 18 Mar 2019 12:04:36 +0000 (22:34 +1030)]
Use temp_ilp and restore_ilp in more places
* as.c (macro_expr): Use temp_ilp and restore_ilp.
* macro.c (buffer_and_nest): Likewise.
* read.c (temp_ilp): Remove FIXME.
Alan Modra [Mon, 18 Mar 2019 11:46:24 +0000 (22:16 +1030)]
Fix MRI mode testsuite failures
These fails were introduced by git commit
2469b3c584 with the
inroduction of "input_from_string":
m68k-linux FAIL: MRI structured for
m68k-linux FAIL: MRI structured if
m68k-linux FAIL: MRI structured repeat
m68k-linux FAIL: MRI structured while
Since the m68k parser called expression() without setting
input_from_string, get_symbol_name rejected FAKE_LABEL_CHAR in names.
* config/m68k-parse.y (yylex): Use temp_ilp and restore_ilp.
Alan Modra [Mon, 18 Mar 2019 11:08:36 +0000 (21:38 +1030)]
PR24355, segmentation fault in function called from ppc_finish_symbols
This one looks to be a bug going back to 2009, git commit
e054468f6c
"STT_GNU_IFUNC support for PowerPC". That bug was carried over with
git commit
49c09209d0 "Rearrange PLT reloc output on powerpc".
If the refcount for an ifunc local sym plt entry was zero,
ppc_elf_size_dynamic_sections would correctly set plt.offset to -1 but
leave glink_offset uninitialized. That leads to occasional segfaults
(which can be made solid with MALLOC_PERTURB_=1 when using glibc).
So, guard the write_glink_stub call with plt.offset != -1. Also,
remove the totally ineffective attempt at writing multiple-use glink
stubs only once.
PR 24355
* elf32-ppc.c (ppc_finish_symbols): Don't call write_glink_stub
for local iplt syms with ent->plt.offset == -1. Remove ineffective
attempt at writing glink stubs only once.
Alan Modra [Mon, 18 Mar 2019 00:41:39 +0000 (11:11 +1030)]
csky ld testsuite fixes
* testsuite/ld-elf/merge.d: Remove csky from xfails, add moxie.
* testsuite/ld-elf/pr21884.d: Remove csky from xfails.
* testsuite/ld-elf/shared.exp: Add csky to list not xfailing pr22374.
* testsuite/ld-unique/pr21529.d: Remove csky from xfails
Sergei Trofimovich [Sun, 17 Mar 2019 22:27:31 +0000 (22:27 +0000)]
gdb: unconditionally define _initialize_string_view_selftests
The build failure was noticed by Helmut Jarausch in
https://bugs.gentoo.org/680232:
$ ./configure CXXFLAGS='-std=c++17 -Os'
...
CXXLD gdb
ld: init.o: in function `initialize_all_files()':
init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'
It happens because '_initialize_string_view_selftests()' is
conditionally defined based on C++ default.
The change defines '_initialize_string_view_selftests()'
unconditionally and leaves implementation a no-op on c++17
compilers.
gdb/ChangeLog:
2019-03-17 Sergei Trofimovich <siarheit@google.com>
* unittests/string_view-selftests.c: Define
_initialize_string_view_selftests unconditionally.
H.J. Lu [Mon, 18 Mar 2019 01:19:45 +0000 (09:19 +0800)]
x86: Pass -O0 to assembler for some tests
* testsuite/gas/i386/att-regs.d: Pass -O0 to assembler.
* testsuite/gas/i386/avx512bw-intel.d: Likewise.
* testsuite/gas/i386/avx512bw.d: Likewise.
* testsuite/gas/i386/avx512f-intel.d: Likewise.
* testsuite/gas/i386/avx512f.d: Likewise.
* testsuite/gas/i386/disp32.d: Likewise.
* testsuite/gas/i386/intel-regs.d: Likewise.
* testsuite/gas/i386/pseudos.d: Likewise.
* testsuite/gas/i386/x86-64-disp32.d: Likewise.
* testsuite/gas/i386/x86-64-pseudos.d: Likewise.
H.J. Lu [Mon, 18 Mar 2019 00:56:10 +0000 (08:56 +0800)]
x86: Optimize EVEX vector load/store instructions
When there is no write mask, we can encode lower 16 128-bit/256-bit
EVEX vector register load and store instructions as VEX vector register
load and store instructions with -O1.
gas/
PR gas/24348
* config/tc-i386.c (optimize_encoding): Encode 128-bit and
256-bit EVEX vector register load/store instructions as VEX
vector register load/store instructions for -O1.
* doc/c-i386.texi: Update -O1 documentation.
* testsuite/gas/i386/i386.exp: Run PR gas/24348 tests.
* testsuite/gas/i386/optimize-1.s: Add tests for EVEX vector
load/store instructions.
* testsuite/gas/i386/optimize-2.s: Likewise.
* testsuite/gas/i386/optimize-3.s: Likewise.
* testsuite/gas/i386/optimize-5.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-4.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.s: Likewise.
* testsuite/gas/i386/optimize-1.d: Updated.
* testsuite/gas/i386/optimize-2.d: Likewise.
* testsuite/gas/i386/optimize-3.d: Likewise.
* testsuite/gas/i386/optimize-4.d: Likewise.
* testsuite/gas/i386/optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-4.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.d: Likewise.
* testsuite/gas/i386/optimize-7.d: New file.
* testsuite/gas/i386/optimize-7.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-8.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-8.s: Likewise.
opcodes/
PR gas/24348
* i386-opc.tbl: Add Optimize to vmovdqa32, vmovdqa64, vmovdqu8,
vmovdqu16, vmovdqu32 and vmovdqu64.
* i386-tbl.h: Regenerated.
GDB Administrator [Mon, 18 Mar 2019 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 17 Mar 2019 19:50:45 +0000 (03:50 +0800)]
x86: Encode 256-bit/512-bit VEX/EVEX insns with 128-bit VEX
Since all AVX512 processors support AVX, we can encode 256-bit/512-bit
VEX/EVEX vector register clearing instructions with 128-bit VEX vector
register clearing instructions at -O1.
* config/tc-i386.c (optimize_encoding): Encode 256-bit/512-bit
VEX/EVEX vector register clearing instructions with 128-bit VEX
vector register clearing instructions at -O1.
* doc/c-i386.texi: Update -O1 and -O2 documentation.
* testsuite/gas/i386/i386.exp: Run optimize-1a and
x86-64-optimize-2a.
* testsuite/gas/i386/optimize-1a.d: New file.
* testsuite/gas/i386/x86-64-optimize-2a.d: Likewise.
Владимир Мартьянов [Sun, 17 Mar 2019 09:51:01 +0000 (12:51 +0300)]
Remove unused variable from windows_make_so
There is unused variable text_vma in function windows_make_so. This
leads to build error on Windows using Cygwin.
gdb/ChangeLog:
2019-03-17 Vladimir Martyanov <vilgeforce@gmail.com>
PR gdb/24350
* windows-nat.c (windows_make_so): Remove unused text_vma variable.
Владимир Мартьянов [Sun, 17 Mar 2019 09:48:24 +0000 (12:48 +0300)]
Fix wrong format specification in display_selector()
There are a wrong format strings in function display_selector() in
file windows-nat.c. This leads to build error using Cygwin on Windows.
LDT_ENTRY.HighWord is a DWORD, which is unsigned long int, so the
format specification should be for long int, not simply int.
gdb/ChangeLog:
2019-03-17 Vladimir Martyanov <vilgeforce@gmail.com>
PR gdb/24351
* windows-nat.c (display_selector): Format specifications fixed
Eli Zaretskii [Sun, 17 Mar 2019 16:00:34 +0000 (18:00 +0200)]
Fix redisplay of the current line in GDB TUI mode
Without this change, when the current line is longer than the source
window width, redisplaying that line overwrites the window frame and
also portions of the next line.
gdb/ChangeLog:
2019-03-17 Eli Zaretskii <eliz@gnu.org>
* tui/tui-winsource.c (tui_set_is_exec_point_at): Call
tui_refill_source_window instead of tui_refresh_win, to update the
current execution line. This fixes redisplay of the current line
when stepping through very long lines with "next" or "step".
GDB Administrator [Sun, 17 Mar 2019 00:01:10 +0000 (00:01 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 16 Mar 2019 23:39:18 +0000 (07:39 +0800)]
x86: Set optimize to INT_MAX for -Os
Set optimize to INT_MAX, instead of -1, for -Os so that -Os will include
-O2 optimization.
PR gas/24353
* config/tc-i386.c (md_parse_option): Set optimize to INT_MAX
for -Os.
* testsuite/gas/i386/optimize-2.s: Add a test.
* testsuite/gas/i386/x86-64-optimize-3.s: Likewise.
* testsuite/gas/i386/optimize-2.d: Updated.
* testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
H.J. Lu [Sat, 16 Mar 2019 23:25:08 +0000 (07:25 +0800)]
x86: Correctly optimize EVEX to 128-bit VEX/EVEX
We can optimize 512-bit EVEX to 128-bit EVEX encoding for upper 16
vector registers only when AVX512VL is enabled. We can't optimize
EVEX to 128-bit VEX encoding when AVX isn't enabled.
PR gas/24352
* config/tc-i386.c (optimize_encoding): Encode 512-bit EVEX
with 128-bit VEX encoding only when AVX is enabled and with
128-bit EVEX encoding only when AVX512VL is enabled.
* testsuite/gas/i386/i386.exp: Run PR gas/24352 tests.
* testsuite/gas/i386/optimize-6.s: New file.
* testsuite/gas/i386/optimize-6a.d: Likewise.
* testsuite/gas/i386/optimize-6b.d: Likewise.
* testsuite/gas/i386/optimize-6c.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-7a.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7b.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7c.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.d: Updated.
Eli Zaretskii [Sat, 16 Mar 2019 17:53:46 +0000 (19:53 +0200)]
Fix vertical scrolling of TUI source window
gdb/ChangeLog:
2019-03-16 Eli Zaretskii <eliz@gnu.org>
* source-cache.c (source_cache::get_source_lines): Call
find_source_lines to initialize s->nlines. This fixes vertical
scrolling of TUI source window when the DOWN arrow is pressed.
Philippe Waroquiers [Sat, 16 Mar 2019 15:56:44 +0000 (16:56 +0100)]
OBVIOUS: fix several occurrences of 'This options has' to 'This option has'
Eli Zaretskii [Sat, 16 Mar 2019 12:13:43 +0000 (14:13 +0200)]
Revert "Use wclrtoeol in tui_show_source_line"
gdb/ChangeLog:
2019-03-16 Eli Zaretskii <eliz@gnu.org>
* tui/tui-winsource.c (tui_show_source_line): Revert "Use
wclrtoeol in tui_show_source_line". This reverts changes made in
commit
4a3045920bbe4e50a0f4920b0fdc4e88ef23015c.
Alan Modra [Fri, 15 Mar 2019 23:04:47 +0000 (09:34 +1030)]
PR24337, segfault in _bfd_elf_rela_local_sym, again
Reverts commit
1ff31e135f, fixing the problem more generally. There
are likely other place that will segfault on a NULL section.
PR 24337
* elf.c (_bfd_elf_rela_local_sym): Revert last change.
(_bfd_elf_rel_local_sym): Likewise.
* elflink.c (elf_link_input_bfd): Use bfd_und_section for
section of symbols with unrecognized shndx.
GDB Administrator [Sat, 16 Mar 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 2 Mar 2019 20:07:47 +0000 (13:07 -0700)]
Change minimal_symbol inheritance
This changes struct minimal_symbol to inherit from general_symbol_info
and updates various macros to cope.
Because MSYMBOL_SET_LANGUAGE and MSYMBOL_SET_NAMES were only used from
a single spot, this patch removes them in favor of simply inlining
their definitions. I consider this to be somewhat cleaner, not least
because the "phony polymorphism" provided by such macros is not useful
in practice.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* symtab.h (struct minimal_symbol): Derive from
general_symbol_info.
(MSYMBOL_VALUE, MSYMBOL_VALUE_RAW_ADDRESS)
(MSYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_BYTES)
(MSYMBOL_BLOCK_VALUE, MSYMBOL_VALUE_CHAIN, MSYMBOL_LANGUAGE)
(MSYMBOL_SECTION, MSYMBOL_OBJ_SECTION, MSYMBOL_NATURAL_NAME)
(MSYMBOL_LINKAGE_NAME, MSYMBOL_DEMANGLED_NAME)
(MSYMBOL_SEARCH_NAME): Update.
(MSYMBOL_SET_LANGUAGE, MSYMBOL_SET_NAMES): Remove.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Don't use memset.
* minsyms.c (minimal_symbol_reader::record_full): Update.
Tom Tromey [Sat, 2 Mar 2019 19:31:04 +0000 (12:31 -0700)]
Use memcpy in minimal_symbol_reader::install
minimal_symbol_reader::install copies minsyms from the msym_bunch
objects into the allocated memory. It seemed better to me to do this
via memcpy, as that is frequently optimized in libc.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* minsyms.c (minimal_symbol_reader::install): Use memcpy.
Tom Tromey [Sat, 2 Mar 2019 19:29:48 +0000 (12:29 -0700)]
Allocate minimal symbols with malloc
Currently, minimal symbols are allocated on the per-BFD obstack.
However, it is also possible for multiple symbol readers to create
minimal symbols for a given objfile. In this case, the minimal
symbols will be reallocated on the obstack, leading to some waste of
storage.
This is a memory leak, but I think it won't be caught by tools like
valgrind, because valgrind doesn't know about obstacks.
This patch fixes the problem by using malloc to allocate the storage
for minimal symbols.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* objfiles.h (struct objfile_per_bfd_storage) <msymbols>: Now a
unique_xmalloc_ptr.
(objfile::msymbols_range::begin, objfile::msymbols_range::end):
Update.
* minsyms.c (lookup_minimal_symbol_by_pc_section)
(build_minimal_symbol_hash_tables)
(minimal_symbol_reader::install): Update.
Tom Tromey [Sat, 2 Mar 2019 19:18:05 +0000 (12:18 -0700)]
Use htab_up for demangled hash
This changes objfile_per_bfd_storage::demangled_names_hash to be an
htab_up. This lets us remove some manual management code from the
objfile_per_bfd_storage destructor.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* symtab.c (create_demangled_names_hash): Update.
(symbol_set_names): Update.
* objfiles.h (struct objfile_per_bfd_storage)
<demangled_names_hash>: Now an htab_up.
* objfiles.c (objfile_per_bfd_storage): Simplify.
Tom Tromey [Sat, 2 Mar 2019 19:11:26 +0000 (12:11 -0700)]
Simplify per-BFD storage management
There's no reason that the objfile_per_bfd_storage must be allocated
via bfd_alloc. This patch changes objfile_per_bfd_storage to be
managed more simply, via ordinary new and delete; and moves some code
into its (new) destructor.
While doing this I also noticed an extra initialization of
language_of_main, and removed it.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* objfiles.h (struct objfile_per_bfd_storage): Declare
destructor.
* objfiles.c (objfile_per_bfd_storage::~objfile_per_bfd_storage):
New.
(get_objfile_bfd_data): Use new. Don't initialize
language_of_main.
(free_objfile_per_bfd_storage): Remove.
(objfile_bfd_data_free, objfile::~objfile): Use delete.
Tom Tromey [Sat, 2 Mar 2019 19:05:57 +0000 (12:05 -0700)]
Remove minsym termination
I was curious what used the terminating "null" minimal symbol; and
after looking I could not find anything. This patch removes
terminate_minimal_symbol_table and the extra minimal symbol that is
allocated for it.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Update.
* objfiles.c (objfile::objfile): Update.
* minsyms.h (terminate_minimal_symbol_table): Don't declare.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Update
comment.
(minimal_symbol_reader::install): Update.
(terminate_minimal_symbol_table): Remove.
* jit.c (jit_object_close_impl): Update.
Tom Tromey [Sat, 2 Mar 2019 02:56:45 +0000 (19:56 -0700)]
Remove some unneeded initializations in minimal_symbol_reader
minimal_symbol_reader::record_full does not need to initialize any
minsym fields to 0, because that was already done implicitly via the
use of XCNEW when allocating the msym_bunch.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* minsyms.c (minimal_symbol_reader::record_full): Remove some
initializations.
Tom Tromey [Sat, 2 Mar 2019 02:55:46 +0000 (19:55 -0700)]
Use bitset for demangled_hash_languages
I noticed that objfile_per_bfd_storage::demangled_hash_languages is a
std::vector, which seemed quite large for something that,
fundamentally, can be represented as a bitset. This patch
reimplements it as a std::bitset.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* objfiles.h (struct objfile_per_bfd_storage)
<demangled_hash_languages>: Now a bitset.
* minsyms.c (add_minsym_to_demangled_hash_table): Update.
(lookup_minimal_symbol): Update.
Tom Tromey [Sat, 2 Mar 2019 00:37:30 +0000 (17:37 -0700)]
Slightly simplify minsym creation
Only one caller of minimal_symbol_reader::record_with_info was using
the return value, so this patch simplifies this code by having it
return void and changing that caller to use record_full instead.
gdb/ChangeLog
2019-03-15 Tom Tromey <tom@tromey.com>
* minsyms.h (class minimal_symbol_reader) <record_with_info>:
Don't return the symbol.
* coffread.c (record_minimal_symbol): Use record_full.
H.J. Lu [Fri, 15 Mar 2019 14:19:01 +0000 (22:19 +0800)]
COFF: Check for symbols defined in discarded section
For LTO, a symbol may defined in discarded section. We should mark it
as undefined so that LTO plugin will make IR definition available.
PR ld/24267
* coffgen.c (_bfd_coff_section_already_linked): Skip discarded
section.
* cofflink.c (coff_link_add_symbols): Check for symbols defined
in discarded section.
Nick Clifton [Fri, 15 Mar 2019 12:08:56 +0000 (12:08 +0000)]
Update the documentation describing where the linker will attempt to locate plugins.
PR 24262
* ld.texi (-plugin): Correct the path used to locate linker
plugins.
Li Hao [Fri, 15 Mar 2019 11:58:05 +0000 (11:58 +0000)]
Fix a potential illegal memory access whilt parsing an x86 insn.
PR 24308
* config/tc-i386.c (parse_insn): Check mnemp before using it to
determine if a suffix can be trimmed.
Alan Modra [Fri, 15 Mar 2019 06:19:59 +0000 (16:49 +1030)]
PR24339, segfault on NULL symbol section
PR 24339
* elflink.c (elf_link_add_object_symbols): Bail out on a local
symbol after globals if elf_bad_symtab is not set.
Alan Modra [Fri, 15 Mar 2019 06:19:42 +0000 (16:49 +1030)]
PR24337, segfault in _bfd_elf_rela_local_sym
PR 24337
* elf.c (_bfd_elf_rela_local_sym): Don't segfault on NULL sec.
(_bfd_elf_rel_local_sym): Likewise.
Alan Modra [Fri, 15 Mar 2019 05:19:27 +0000 (15:49 +1030)]
PR24336, buffer overflow in swap_reloca_in
PR 24336
* elflink.c (elf_link_read_relocs_from_section): Handle fuzzed
object files with sh_size not a multiple of sh_entsize.
H.J. Lu [Fri, 15 Mar 2019 07:46:12 +0000 (15:46 +0800)]
x86-64: Check for corrupt input with bad relocation
PR ld/24338
* elf64-x86-64.c (elf_x86_64_relocate_section): Check for corrupt
input with bad relocation.
H.J. Lu [Fri, 15 Mar 2019 06:43:36 +0000 (14:43 +0800)]
Re-indent elf_x86_64_relocate_section
* elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
GDB Administrator [Fri, 15 Mar 2019 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 14 Mar 2019 19:04:10 +0000 (15:04 -0400)]
Fix gdb.texinfo build
Commit
b4be1b064860 ("Fix MI output for multi-location breakpoints")
broke the build of gdb.texinfo. The problem is simply the use of "@end
@table", which should be "@end table".
The error was:
/home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: warning: @table should not appear in @end
/home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: table requires an argument: the formatter for @item
/home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: no matching `@end table'
/home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: bad argument to @end: @table
/home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27867: warning: @table has text but no @item
/home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27879: @node seen before @end table
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Development and Front Ends): Fix closing
of table, "@end @table" -> "@end table".
Nick Clifton [Thu, 14 Mar 2019 17:21:41 +0000 (17:21 +0000)]
Fix a buffer overrun error when attempting to parse corrupt DWARF information.
PR 24334
* dwarf2.c (struct dwarf2_debug): Add sec_vma_count field.
(save_section_vma): Initialise field to the number of entries in
the sec_vma table.
(section_vma_same): Check that the number of entries in the
sec_vma table matches the number of sections in the bfd.
Nick Clifton [Thu, 14 Mar 2019 16:03:07 +0000 (16:03 +0000)]
Fix an illegal memory access when parsing a corrupt ELF file.
PR 24333
* elflink.c (_bfd_elf_add_default_symbol): Add a check for a NULL
section owner pointer when adding the default symbol.
Eli Zaretskii [Thu, 14 Mar 2019 15:31:38 +0000 (17:31 +0200)]
Fix colors in TUI mode in MS-Windows build with ncurses
The MS-Windows port of ncurses fails to switch to a color pair if
one or both of the colors are the implicit default colors. This
change records the default colors when TUI is initialized, and
then specifies them explicitly when a color pair uses the default
colors. This allows color styling in TUI mode on MS-Windows.
gdb/ChangeLog:
2019-03-14 Eli Zaretskii <eliz@gnu.org>
* tui/tui-io.c [__MINGW32__]: Include windows.h. Declare
ncurses_norm_attr.
(tui_initialize_io) [__MINGW32__]: Record the default terminal
colors in ncurses_norm_attr.
(apply_ansi_escape) [__MINGW32__]: If a color in a color pair is
"none", replace it with the default color recorded in
ncurses_norm_attr.
Nick Clifton [Thu, 14 Mar 2019 14:45:32 +0000 (14:45 +0000)]
Fix illegal memory access parsing a corrupt ELF file.
PR 24332
* elflink.c (elf_link_add_object_symbols): Add new local variable
extversym_end. Initialise it to point to the end of the version
symbol table, if present. Check it when initialising and updating
the ever pointer.
Tom Tromey [Fri, 8 Mar 2019 20:59:27 +0000 (13:59 -0700)]
Avoid a crash in source_cache::extract_lines
If the first requested line is larger than the number of lines in the
source buffer, source_cache::extract_lines could crash, because it
would try to pass string::npos" to string::substr.
This patch avoids the crash by checking for this case.
This version of the patch changes get_source_lines to return
std::string.
gdb/ChangeLog
2019-03-14 Tom Tromey <tromey@adacore.com>
* source-cache.h (class source_cache) <get_source_lines>: Return
std::string.
* source-cache.c (source_cache::extract_lines): Handle case where
first_pos==npos. Return std::string.
(source_cache::get_source_lines): Update.
Tom Tromey [Fri, 8 Mar 2019 20:54:07 +0000 (13:54 -0700)]
Add the "set style source" command
This adds "set style source" (and "show style source") commands. This
gives the user control over whether source code is highlighted.
gdb/ChangeLog
2019-03-14 Tom Tromey <tromey@adacore.com>
* NEWS: Add item for "style sources" commands.
* source-cache.c (source_cache::get_source_lines): Check
source_styling.
* cli/cli-style.c (source_styling): New global.
(_initialize_cli_style): Add "style sources" commands.
(show_style_sources): New function.
* cli/cli-style.h (source_styling): Declare.
gdb/doc/ChangeLog
2019-03-14 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Output Styling): Document "set style source" and
"show style source".
gdb/testsuite/ChangeLog
2019-03-14 Tom Tromey <tromey@adacore.com>
* gdb.base/style.exp: Add "set style sources" test.
Tom Tromey [Fri, 8 Mar 2019 20:41:55 +0000 (13:41 -0700)]
Make TUI react to "set style enabled"
When the user toggles "set style enabled", the TUI should react by
redrawing the source window, if necessary. This patch implements this
behavior.
No test because the TUI is generally not tested.
This version of the patch incorporates Pedro's patch to provide a
clean way to force the TUI to update the source window's contents.
gdb/ChangeLog
2019-03-14 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@adacore.com>
* tui/tui-winsource.h (tui_refill_source_window): Declare.
* tui/tui-winsource.c (tui_refill_source_window): New function,
from...
(tui_horizontal_source_scroll): ... here. Move some logic.
* cli/cli-style.c (set_style_enabled): Notify new observable.
* tui/tui-hooks.c (tui_redisplay_source): New function.
(tui_attach_detach_observers): Attach or detach
tui_redisplay_source.
* observable.h (source_styling_changed): New observable.
* observable.c: Define source_styling_changed observable.
GDB Administrator [Thu, 14 Mar 2019 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in