Pedro Alves [Thu, 7 Jun 2018 16:27:46 +0000 (17:27 +0100)]
target_stack -> current_top_target() throughout
The recent C++ification of target_ops replaced references to the old
"current_target" squashed target throughout with references to a
"target_stack" pointer. I had picked the "target_stack" name very
early in the multi-target work, and managed to stick with it, even
though it's a bit of a misnomer, since it isn't really a "target
stack" object, but a pointer into the current top target in the stack.
As I'm splitting more pieces off of the multi-target branch, I've come
to think that it's better to rename it now. A following patch will
introduce a new class to represent a target stack, and "target_stack"
would be _its_ ideal name. (In the branch, the class is called
a_target_stack to work around the clash.)
Thus this commit renames target_stack to current_top_target and
replaces all references throughout. Also, while at it,
current_top_target is made a function instead of a pointer, to make it
possible to change its internal implementation without leaking
implementation details out. In a couple patches, the implementation
of the function will change to refer to a target stack object, and
then further down the multi-target work, it'll change again to find
the right target stack for the current inferior.
gdb/ChangeLog:
2018-06-07 Pedro Alves <palves@redhat.com>
* target.h (target_stack): Delete.
(current_top_target): Declare function.
* target.c (target_stack): Delete.
(g_current_top_target): New.
(current_top_target): New function.
* auxv.c: Use current_top_target instead of target_stack
throughout.
* avr-tdep.c: Likewise.
* breakpoint.c: Likewise.
* corefile.c: Likewise.
* elfread.c: Likewise.
* eval.c: Likewise.
* exceptions.c: Likewise.
* frame.c: Likewise.
* gdbarch-selftests.c: Likewise.
* gnu-v3-abi.c: Likewise.
* ia64-tdep.c: Likewise.
* ia64-vms-tdep.c: Likewise.
* infcall.c: Likewise.
* infcmd.c: Likewise.
* infrun.c: Likewise.
* linespec.c: Likewise.
* linux-tdep.c: Likewise.
* minsyms.c: Likewise.
* ppc-linux-nat.c: Likewise.
* ppc-linux-tdep.c: Likewise.
* procfs.c: Likewise.
* regcache.c: Likewise.
* remote.c: Likewise.
* rs6000-tdep.c: Likewise.
* s390-linux-nat.c: Likewise.
* s390-tdep.c: Likewise.
* solib-aix.c: Likewise.
* solib-darwin.c: Likewise.
* solib-dsbt.c: Likewise.
* solib-spu.c: Likewise.
* solib-svr4.c: Likewise.
* solib-target.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* symfile.c: Likewise.
* symtab.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.c: Likewise.
* target.h: Likewise.
* tracefile-tfile.c: Likewise.
* tracepoint.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
* value.c: Likewise.
* windows-tdep.c: Likewise.
* mi/mi-main.c: Likewise.
Tom Tromey [Sat, 5 May 2018 16:24:54 +0000 (10:24 -0600)]
Change build_address_symbolic to return std::string
This changes two out parameters of build_address_symbolic to be
std::string, and updates the callers. This allows removing some
cleanups.
This patch also moves the declaration of build_address_symbolic out of
defs.h. I think that many things in defs.h should be elsewhere
instead. In this case, I moved the declaration to valprint.h, becuase
there is no "printcmd.h" -- but perhaps it would be better to
introduce that instead.
Tested by the buildbot.
gdb/ChangeLog
2018-06-07 Tom Tromey <tom@tromey.com>
* valprint.h (build_address_symbolic): Declare.
* printcmd.c (print_address_symbolic): Update.
(build_address_symbolic): Change "name" and "filename" to
std::string.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Update.
* defs.h (build_address_symbolic): Remove declaration.
Tamar Christina [Thu, 7 Jun 2018 10:53:13 +0000 (11:53 +0100)]
Fix AArch64 unintialized variable which can cause diagnostic failures.
This patch fixes an uninitialized memory issue that can under certain
circumstances turn an error into a warning because non_fatal was not initialised
in all cases.
Verified using valgrind.
gas/config/tc-aarch64.c
PR binutils/21446
* tc-aarch64.c (record_operand_error, record_operand_error_with_data):
Initialize non_fatal.
Alan Hayward [Thu, 19 Oct 2017 15:35:35 +0000 (16:35 +0100)]
Aarch64 SVE pseudo register support
Add the functionality for reading/writing pseudo registers.
On SVE the V registers are pseudo registers. This is supported
by adding AARCH64_SVE_V0_REGNUM.
* aarch64-tdep.c (AARCH64_SVE_V0_REGNUM): Add define.
(aarch64_vnv_type): Add function.
(aarch64_pseudo_register_name): Add V regs for SVE.
(aarch64_pseudo_register_type): Likewise.
(aarch64_pseudo_register_reggroup_p): Likewise.
(aarch64_pseudo_read_value_2): Use V0 offset for SVE
(aarch64_pseudo_read_value): Add V regs for SVE.
(aarch64_pseudo_write_2): Use V0 offset for SVE
(aarch64_pseudo_write): Add V regs for SVE.
* aarch64-tdep.h (struct gdbarch_tdep): Add vnv_type.
GDB Administrator [Thu, 7 Jun 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 2 Jun 2018 09:16:03 +0000 (18:46 +0930)]
EXECUTABLE_SYMBOLS -> OTHER_SYMBOLS
EXECUTABLE_SYMBOLS is supposed to be true to its name, only defining
symbols for the executable.
* emulparams/elf64bmip.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define this instead.
* emulparams/elf32bmipn32.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define similarly to elf64bmip.sh.
* emulparams/elf64hppa.sh (EXECUTABLE_SYMBOLS): Don't define.
(OTHER_SYMBOLS): Define instead.
Alan Modra [Sat, 2 Jun 2018 08:35:24 +0000 (18:05 +0930)]
TIC6X __c6xabi_DSBT_BASE
Adding an undefined __c6xabi_DSBT_BASE via an EXTERN in the linker
script isn't ideal, as the symbol is not always needed. This patch
adds the undefined symbol on encountering relocations where it is
implicitly referenced.
bfd/
* elf32-tic6x.c (elf32_tic6x_check_relocs): Reference
__c6xabi_DSBT_BASE explicitly for R_C6000_SBR_* relocs.
ld/
* emulparams/elf32_tic6x_le.sh (EXECUTABLE_SYMBOLS): Don't define.
Sergio Durigan Junior [Tue, 5 Jun 2018 21:55:39 +0000 (17:55 -0400)]
Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)
Commit
122394f1476b1c925a281b15399119500c8231c1 ("Function for reading
the Aarch64 SVE vector length") has added macros to manipulate SVE
vector sizes based on Linux kernel sources, but did not guard them
with #ifndef's, which breaks the build when the system headers already
have these macros:
CXX aarch64-linux-nat.o
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:79: error: "sve_vq_from_vl" redefined [-Werror]
#define sve_vq_from_vl(vl) ((vl) / 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:154: note: this is the location of the previous definition
#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:80: error: "sve_vl_from_vq" redefined [-Werror]
#define sve_vl_from_vq(vq) ((vq) * 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:155: note: this is the location of the previous definition
#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
In order to fix this breakage, this commit guards the declaration of
the macros using #ifndef's.
gdb/ChangeLog:
2018-06-06 Sergio Durigan Junior <sergiodj@redhat.com>
* arch/aarch64.h (sve_vg_from_vl): Guard with #ifndef.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
Sameera Deshpande [Wed, 6 Jun 2018 14:19:59 +0000 (15:19 +0100)]
Update the AArch64 assembler to note that the Qualcomm Saphira cpu supports ARMv8.4
gas * config/tc-aarch64.c (aarch64_cpus): Add support of ARMv8.4 in
saphira.
Alan Modra [Wed, 6 Jun 2018 10:08:28 +0000 (19:38 +0930)]
armelf_fbsd and armelf_fuchsia dependencies
* Makefile.am (earmelf_fbsd.c): Correct dependencies.
(earmelfb_fbsd.c, earmelfb_fuchsia.c): Likewise.
* Makefile.in: Regenerate.
Alan Modra [Wed, 6 Jun 2018 06:00:35 +0000 (15:30 +0930)]
Fix xtensa "clobbered by longjmp" warnings
.../opcodes/xtensa-dis.c: In function ‘print_insn_xtensa’:
.../opcodes/xtensa-dis.c:257:17: error: variable ‘fmt’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
xtensa_format fmt;
^~~
.../opcodes/xtensa-dis.c:262:26: error: variable ‘valid_insn’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
int first, first_slot, valid_insn = 0;
^~~~~~~~~~
* xtensa-dis.c (print_insn_xtensa): Init fmt and valid_insn after
setjmp. Move init for some other vars later too.
GDB Administrator [Wed, 6 Jun 2018 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 11 May 2018 18:21:03 +0000 (12:21 -0600)]
Remove some text from --version output
I happened to notice recently that "gdb --version" says:
GNU gdb (GDB) 8.0.50.
20170911-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
This is a bit on the wordy side, but also references interactive
commands, which I think doesn't really make sense for --version.
This patch removes some text from --version, while leaving it in the
"show version" output. It also adds a newline between the URLs and
the "For help, ..." text, because I thought that was easier to read.
Finally, it indents one of the URLs, since that was simpler to read,
but not the other URL, because the current format is specified by the
GNU coding standards section on "--version".
Now the --version output looks like:
GNU gdb (GDB) 8.1.50.
20180511-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Tested by the buildbot.
gdb/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
* cli/cli-cmds.c (show_version): Update.
* top.c (print_gdb_version): Add "interactive" parameter.
Update.
* main.c (captured_main_1): Update.
* top.h (print_gdb_version): Add "interactive" parameter and a
comment.
gdb/testsuite/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
* gdb.base/default.exp: Update expected "show version" output.
David Malcolm [Tue, 5 Jun 2018 17:22:25 +0000 (18:22 +0100)]
Fix typo in common/enum-flags.h example
The DEF_ENUM_FLAGS_TYPE macro should be used with a trailing
semicolon, but the example in the comment lacks one.
gdb/ChangeLog:
2018-06-05 David Malcolm <dmalcolm@redhat.com>
* common/enum-flags.h: Add trailing semicolon to example in
comment.
Tom Tromey [Wed, 25 Apr 2018 14:52:00 +0000 (08:52 -0600)]
Add "continue" response to pager
This adds a "continue" response to the pager. If the user types "c"
in response to the pager prompt, pagination will be disabled for the
duration of one command -- but re-enabled afterward. This is handy if
you type a command that produces a lot of output, and you don't want
to baby-sit it by typing "return" each time the prompt comes up.
Tested by the buildbot.
gdb/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
PR cli/12326:
* NEWS: Add entry about pager.
* utils.c (pagination_disabled_for_command): New global.
(prompt_for_continue): Allow "c" response to prompt.
(reinitialize_more_filter): Clear
pagination_disabled_for_command.
(fputs_maybe_filtered): Check pagination_disabled_for_command.
gdb/doc/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
PR cli/12326:
* gdb.texinfo (Screen Size): Document "c" response to pagination
prompt.
gdb/testsuite/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
PR cli/12326:
* gdb.cp/static-print-quit.exp: Update.
* lib/gdb.exp (pagination_prompt): Update.
* gdb.base/page.exp: Use pagination_prompt. Add new tests.
* gdb.python/python.exp: Update.
Alan Modra [Tue, 5 Jun 2018 13:01:23 +0000 (22:31 +0930)]
Tidy bfdio to consistenly use containing archive
Archive element IO is performed on the file of the containing archive,
which leads to the BFD "where" field of archives and their elements
being out of sync with the real file position. (We're talking
traditional archives here, not thin archives.) The old bfd_seek code
recognized this by not attempting to optimize away seeks for
archives. However, there was other code that could return bogus
results. For example, cache.c limits the number of open files by
closing a file and remembering its state once the limit is reached.
If bfd_tell is called on an archive element when the containing
archive is closed, it will return an invalid file pointer.
It's possible to have a valid "where" field for archives by always
using and updating the containing archive BFD. That's what this patch
does. Note that cache.c used to find the containing archive BFD
anyway for the iostream, so we're not really doing extra work, just
transferring it up to the correct abstraction level.
The patch also gets rid of some hacks. bfd_tell was called when
bfd_seek failed, in an attempt to correct "where". That's got to be
papering over another problem, so that code has been removed.
bfd_read also had an "optimiziation" to return early when the number
of bytes was zero, and bfd_seek optimized calls that didn't move the
file pointer. This was covering for a coff_slurp_line_table bug where
IO was attempted on a pe-dll BFD without an iovec.
* bfd.c (struct bfd): Update comment on "where" usage.
* bfdio.c (bfd_bwrite, bfd_stat): Use and update "iovec",
"iostream", and "where" from containing archive file. Return
error on NULL iovec.
(bfd_bread): Similarly, and return error attempted out of
bounds archive element access.
(bfd_tell, bfd_flush): Use and update "iovec", "iostream", and
"where" from containing archive file.
(bfd_seek): Likewise. Return error on NULL iovec. Don't
attempt to optimize away seeks. Don't paper over errors by
calling bfd_tell.
(bfd_get_mtime): Call bfd_stat rather than iovec->bstat.
(bfd_get_size): Likewise.
(bfd_mmap): Operate on and use iovec of containing archive
file. Return error on NULL iovec.
* cache.c (bfd_cache_lookup_worker): Abort if working on
archive element bfd.
(cache_bread_1): Delete bfd parameter, add FILE* parameter.
Don't ignore zero byte reads.
(cache_bread): Look up FILE* in cache here. Error on NULL
lookup.
(cache_bwrite): Rename "where" to "from".
(cache_bmmap): Don't handle archive elements.
* coffcode.h (coff_slurp_line_table): Exit early on zero
lineno count.
* bfd-in2.h: Regenerate.
Alan Modra [Tue, 5 Jun 2018 11:34:00 +0000 (21:04 +0930)]
PR23254, ld.bfd mishandles file pointers while scanning archive
Best practice is to not mix lseek/read with fseek/fread on the same
underlying file descriptor, as not all stdio implementations will cope.
Since the plugin uses lseek/read while bfd uses fseek/fread this patch
reopens the file for exclusive use by the plugin rather than trying to
restore the file descriptor. That allows the plugin to read the file
after plugin_call_claim_file too.
bfd/
PR 23254
* plugin.c (bfd_plugin_open_input): Allow for possibility of
nested archives. Open file again for plugin.
(try_claim): Don't save and restore file position. Close file
if not claimed.
* sysdep.h (O_BINARY): Define.
ld/
PR 23254
* plugin.c (plugin_call_claim_file): Revert 2016-07-19 patch.
(plugin_object_p): Don't dup file descriptor.
Alan Modra [Tue, 5 Jun 2018 11:31:56 +0000 (21:01 +0930)]
Another s12z regen
* Makefile.in: Regenerate.
Flavio Ceolin [Tue, 5 Jun 2018 11:39:47 +0000 (12:39 +0100)]
Add a test of the linker's "-z noexecstack" command line option.
ld * testsuite/ld-elf/elf.exp Run new test.
* testsuite/ld-elf/stack-noexec.rd New file: Expected readelf output.
Nick Clifton [Tue, 5 Jun 2018 11:26:44 +0000 (12:26 +0100)]
Updated Malay and Esperanto translations for the gprof/ subdirectory.
2018-06-05 Nick Clifton <nickc@redhat.com>
* po/eo.po: Updated Esperanto translation.
* po/ms.po: Updated Malay translation.
GDB Administrator [Tue, 5 Jun 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 25 May 2018 19:32:20 +0000 (13:32 -0600)]
Remove last Ada cleanups
This removes the last cleanups from the Ada code by changing
ada_lookup_symbol_list's out parameter to be a std::vector, and then
fixing up the fallout.
This is a relatively shallow change. Deeper changes are possible, for
example (1) changing various other functions to accept a vector rather
than a pointer, or (2) changing ada_lookup_symbol_list to return the
vector and omitting the length entirely.
Tested by the buildbot, but I'll wait for Joel to test these as well.
gdb/ChangeLog
2018-06-04 Tom Tromey <tom@tromey.com>
* ada-lang.h (ada_lookup_symbol_list): Update.
* ada-lang.c (resolve_subexp): Update.
(symbols_are_identical_enums): Change type of syms. Remove nsyms
parameter.
(remove_extra_symbols, remove_irrelevant_renamings): Likewise.
(ada_lookup_symbol_list_worker, ada_lookup_symbol_list): Change
results parameter to std::vector.
(ada_iterate_over_symbols, ada_lookup_symbol, get_var_value):
Update.
* ada-exp.y (block_lookup): Update.
(select_possible_type_sym): Change type of syms. Remove nsyms
parameter.
(write_var_or_type, write_name_assoc): Update.
Joel Brobecker [Mon, 4 Jun 2018 20:03:32 +0000 (15:03 -0500)]
(windows) GDB/MI crash when using "-list-thread-groups --available"
On Windows, using the "-list-thread-groups --available" GDB/MI command
before an inferior is being debugged:
% gdb -q -i=mi
=thread-group-added,id="i1"
=cmd-param-changed,param="auto-load safe-path",value="/"
(gdb)
-list-thread-groups --available
Segmentation fault
Ooops!
The SEGV happens because the -list-thread-groups --available command
triggers a windows_nat_target::xfer_partial call for a TARGET_OBJECT_OSDATA
object. Until a program is being debugged, the target_ops layer that
gets the call is the Windows "native" layer. Except for a couple of
specific objects (TARGET_OBJECT_MEMORY and TARGET_OBJECT_LIBRARIES),
this layer's xfer_partial method delegates the xfer of other objects
to the target beneath:
default:
return beneath->xfer_partial (object, annex,
readbuf, writebuf, offset, len,
xfered_len);
Unfortunately, there is no "beneath layer" in this case, so
beneath is NULL and dereferencing it leads to the SEGV.
This patch fixes the issue by checking beneath before trying
to delegate the request.
gdb/ChangeLog:
* windows-nat.c (windows_nat_target::xfer_partial): Return
TARGET_XFER_E_IO if we need to delegate to the target beneath
but BENEATH is NULL.
gdb/testsuite/ChangeLog:
* gdb.mi/list-thread-groups-no-inferior.exp: New testcase.
Max Filippov [Thu, 24 May 2018 18:22:14 +0000 (11:22 -0700)]
xtensa: use property tables for correct disassembly
xtensa disassembler does not use information from the .xt.prop sections
to switch between code/data disassembly in text sections. This may
result in incorrect disassembly when data is interpreted as code and
disassembler loses synchronization with instruction stream. Use .xt.prop
section information to correctly interpret code and data and synchronize
with instruction stream.
2018-06-04 Max Filippov <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (xtensa_read_table_entries): Make global.
(compute_fill_extra_space): Drop declaration. Rename function to
xtensa_compute_fill_extra_space.
(compute_ebb_actions, remove_dead_literal): Update references to
compute_fill_extra_space.
include/
* elf/xtensa.h (xtensa_read_table_entries)
(xtensa_compute_fill_extra_space): New declarations.
opcodes/
* xtensa-dis.c (bfd.h, elf/xtensa.h): New includes.
(dis_private): Add new fields for property section tracking.
(xtensa_coalesce_insn_tables, xtensa_find_table_entry)
(xtensa_instruction_fits): New functions.
(fetch_data): Bump minimal fetch size to 4.
(print_insn_xtensa): Make struct dis_private static.
Load and prepare property table on section change.
Don't disassemble literals. Don't disassemble instructions that
cross property table boundaries.
Max Filippov [Wed, 23 May 2018 04:48:09 +0000 (21:48 -0700)]
xtensa: add separate property sections option
It is currently not possible to correctly match .xt.prop information
for sections with identical VMA. Allow creation of separate property
sections in the BFD. Add assembler option --separate-prop-tables to
allow creation of separate property sections.
2018-06-04 Volodymyr Arbatov <arbatov@cadence.com>
bfd/
* elf32-xtensa.c (elf32xtensa_separate_props): New global
variable.
(xtensa_add_names): New function.
(xtensa_property_section_name): Add new parameter
separate_sections, use it to choose property section name.
(xtensa_get_separate_property_section): New function.
(xtensa_get_property_section): Invoke
xtensa_get_separate_property_section to get individual property
section if it exists, common property section otherwise.
(xtensa_make_property_section): Pass elf32xtensa_separate_props
to xtensa_property_section_name.
gas/
* config/tc-xtensa.c (elf32xtensa_separate_props): New
declaration.
(option_separate_props, option_no_separate_props): New
enumeration constants.
(md_longopts): Add separate-prop-tables option.
(md_parse_option): Add cases for option_separate_props and
option_no_separate_props.
(md_show_usage): Add help for [no-]separate-prop-tables options.
H.J. Lu [Mon, 4 Jun 2018 17:01:34 +0000 (10:01 -0700)]
Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1
GCC 8.1 warns about destination size with -Wstringop-truncation:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence it.
bfd/
PR binutils/23146
* bfd-in.h: Include "diagnostics.h".
* bfd-in2.h: Regenerated.
* elf32-arm.c (elf32_arm_nabi_write_core_note): Use
DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and
DIAGNOSTIC_POP to silence GCC 8.1 warnings with
-Wstringop-truncation.
* elf32-ppc.c (ppc_elf_write_core_note): Likewse.
* elf32-s390.c (elf_s390_write_core_note): Likewse.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewse.
* elf64-s390.c (elf_s390_write_core_note): Likewse.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse.
include/
* diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): Always
define for GCC.
Alan Hayward [Mon, 4 Jun 2018 16:21:04 +0000 (17:21 +0100)]
Use ELF_SECTION_IN_SEGMENT to map segments
The macro ELF_SECTION_IN_SEGMENT should be used when calculating if
a section maps to a segment.
gdb/
* elfread.c (elf_symfile_segments): Use ELF_SECTION_IN_SEGMENT.
Simon Marchi [Mon, 4 Jun 2018 14:40:27 +0000 (10:40 -0400)]
Add configure.nat as a dependency of config.status
After pulling Alan's change that added aarch64-sve-linux-ptrace.o to
configure.nat, I got an undefined reference to aarch64_sve_get_vq when
doing a "make clean && make". It turns out that re-running configure
(./config.status --recheck) was needed to re-generate the Makefile with
aarch64-sve-linux-ptrace.o included in the object list. Putting
configure.nat in the dependencies of config.status would make sure that
when we modify configure.nat, the configure script is re-ran. I think
it also makes sense because configure.tgt and configure.host are also
there.
gdb/ChangeLog:
* Makefile.in (config.status): Add configure.nat as a
dependency.
Stan Cox [Mon, 4 Jun 2018 14:20:49 +0000 (10:20 -0400)]
Add client_state struct.
Collect per client specific global data items into struct client_state,
which is similar in purpose to remote.c::remote_state.
gdbserver/ChangeLog
* server.h (struct client_state): New.
* server.c (cont_thread, general_thread, multi_process)
(report_fork_events, report_vfork_events, report_exec_events)
(report_thread_events, swbreak_feature, hwbreak_feature)
(vCont_supported, disable_randomization, pass_signals)
(program_signals, program_signals_p, last_status, last_ptid, own_buf):
Moved to client_state.
* remote-utils.c (remote_debug, noack_mode)
(transport_is_reliable): Moved to client_state.
* tracepoint.c (current_traceframe): Moved to client_state.
Update all callers.
* server.c, remote-utils.c, tracepoint.c, fork-child.c,
linux-low.c, remote-utils.h, target.c: Use client_state.
H.J. Lu [Mon, 4 Jun 2018 13:33:07 +0000 (06:33 -0700)]
Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION for GCC 8.1 to silence
-Wstringop-truncation warning:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
* diagnostics.h (DIAGNOSTIC_STRINGIFY_1): New.
(DIAGNOSTIC_STRINGIFY): Likewise.
(DIAGNOSTIC_IGNORE): Replace STRINGIFY with DIAGNOSTIC_STRINGIFY.
(DIAGNOSTIC_IGNORE_SELF_MOVE): Define empty if not defined.
(DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Likewise.
(DIAGNOSTIC_IGNORE_UNUSED_FUNCTION): Likewise.
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): Likewise.
(DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): New.
Tom Tromey [Fri, 1 Jun 2018 17:50:01 +0000 (11:50 -0600)]
Change functions in cp-name-parser.y into methods
Pedro pointed out in an earlier patch that it would be possible to
make some helper functions in cp-name-parser.y into methods on
cpname_state, cleaning up the code a bit. This patch implements this
idea.
Doing this required moving the %union earlier in the .y file, so the
patch is somewhat bigger than you might expect.
Tested by building with both bison and byacc, and then running the
gdb.cp tests.
gdb/ChangeLog
2018-06-04 Tom Tromey <tom@tromey.com>
* cp-name-parser.y (cpname_state): Add method declarations.
(HANDLE_QUAL): Update.
(cpname_state::d_grab, cpname_state::fill_comp)
(cpname_state::make_operator, cpname_state::make_dtor)
(cpname_state::make_builtin_type, cpname_state::make_name)
(cpname_state::d_qualify, cpname_state::d_int_type)
(cpname_state::d_unary, cpname_state::d_binary): Now methods.
(%union): Move earlier.
Alan Hayward [Thu, 26 Apr 2018 13:58:40 +0000 (14:58 +0100)]
Add aarch64 pseudo help functions
Reduce code copy/paste by adding two helper functions for
aarch64_pseudo_read_value and aarch64_pseudo_write
Does not change any functionality.
gdb/
* aarch64-tdep.c (aarch64_pseudo_read_value_1): New helper func.
(aarch64_pseudo_write_1): Likewise.
(aarch64_pseudo_read_value): Use helper.
(aarch64_pseudo_write): Likewise.
Pedro Alves [Mon, 4 Jun 2018 11:26:39 +0000 (12:26 +0100)]
Fix macOS null pointer dereference
<https://sourceware.org/bugzilla/show_bug.cgi?id=22960#c4> reports
that macOS gdb crashes with a null pointer dereference in
push_target(struct target_ops *). This commit fixes that.
The problem is that commit
f6ac5f3d63e0 ("Convert struct target_ops to
C++") left the darwin_ops global uninitialized.
We don't need that global anymore, we can use the (new)
get_native_target function instead for the same effect.
gdb/ChangeLog:
2018-06-04 Pedro Alves <palves@redhat.com>
* darwin-nat.c (darwin_ops): Delete.
(darwin_attach_pid): Use get_native_target.
Alan Hayward [Mon, 4 Jun 2018 11:13:43 +0000 (12:13 +0100)]
Use uint64_t for aarch64 tdep VQ
Alan Hayward [Mon, 4 Jun 2018 10:39:41 +0000 (11:39 +0100)]
Enable SVE for GDB
Enable SVE support for GDB by reading the VQ when creating a
target description.
Also ensurse that SVE is taken into account when creating
the tdep structure, and store the current VQ value directly in tdep.
gdb/
* aarch64-linux-nat.c (aarch64_linux_read_description): Support SVE.
* aarch64-tdep.c (aarch64_get_tdesc_vq): New function.
(aarch64_gdbarch_init): Check for SVE.
* aarch64-tdep.h (gdbarch_tdep::has_sve): New function.
Alan Hayward [Fri, 1 Jun 2018 15:37:45 +0000 (16:37 +0100)]
Use uint64_t for SVE VQ
Previously VQ was of type long. Using uint64_t ensures it always matches the
same type as the VG register.
Note that in the Linux kernel, VQ is 16bits. We cast it up to 64bits
immediately after reading to ensure we always use the same type throughout
the code.
gdb/
* aarch64-tdep.c (aarch64_read_description): Use uint64_t for VQ.
* aarch64-tdep.h (aarch64_read_description): Likewise.
* arch/aarch64.c (aarch64_create_target_description): Likewise.
* arch/aarch64.h (aarch64_create_target_description): Likewise.
* features/aarch64-sve.c (create_feature_aarch64_sve): Likewise.
* nat/aarch64-sve-linux-ptrace.c(aarch64_sve_get_vq): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_vq): Likewise.
GDB Administrator [Mon, 4 Jun 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sun, 3 Jun 2018 22:42:29 +0000 (15:42 -0700)]
RISC-V: Handle out-of-range calls to undefined weak.
bfd/
PR ld/23244
* elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Check
for and handle an undefined weak with no PLT.
ld/
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run new weak ref tests.
* testsuite/ld-riscv-elf/weakref.ld: New.
* testsuite/ld-riscv-elf/weakref32.d: New.
* testsuite/ld-riscv-elf/weakref32.s: New.
* testsuite/ld-riscv-elf/weakref64.d: New.
* testsuite/ld-riscv-elf/weakref64.s: New.
Jim Wilson [Sun, 3 Jun 2018 21:44:44 +0000 (14:44 -0700)]
RISC-V: Fix symbol address problem with versioned symbols.
bfd/
PR ld/22756
* elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
to code that ignores duplicate symbols.
GDB Administrator [Sun, 3 Jun 2018 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 2 Jun 2018 13:17:06 +0000 (09:17 -0400)]
Split value_fetch_lazy
While reading value_fetch_lazy, I thought it would be good to split it
in small functions (especially the part that handles lval_register).
gdb/ChangeLog:
* value.c (value_fetch_lazy_bitfield): New.
(value_fetch_lazy_memory): New.
(value_fetch_lazy_register): New.
(value_fetch_lazy): Factor out to smaller functions.
GDB Administrator [Sat, 2 Jun 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 30 May 2018 14:19:01 +0000 (08:19 -0600)]
Make two cp-name-parser.y constants "const"
This changes "backslashable" and "represented" in cp-name-parser.y to
be const. This lets the compiler make them read-only (though in my
build it seems that GCC inlines them, which seems even better).
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y (backslashable, represented): Now const.
Tom Tromey [Tue, 29 May 2018 18:54:59 +0000 (12:54 -0600)]
Include parser-defs.h in cp-name-parser.y
This changes cp-name-parser.y to include parser-defs.h, removing the
copy-pasted declaration of parser_fprintf. This can be done now that
cp-name-parser.y does not define any global variables.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Include parser-defs.h.
(parser_fprintf): Remove declaration.
Tom Tromey [Thu, 24 May 2018 03:46:59 +0000 (21:46 -0600)]
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
Tom Tromey [Tue, 29 May 2018 18:20:09 +0000 (12:20 -0600)]
Use yy-remap.h in cp-name-parser.y
This changes cp-name-parser.y to use yy-remap.h, rather than its old
manual approach.
This required declaring parser_fprintf in cp-name-parser.y.
parser-defs.h can't be included here because parser-defs.h declares a
global "lexptr", which conflicts with the local one in
cp-name-parser.y. This is only temporary, and will be cleaned up
later in the series.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y (parser_fprintf): Declare.
(GDB_YY_REMAP_PREFIX): Define.
Include yy-remap.h. Don't redefine yy* identifiers.
Tom Tromey [Thu, 24 May 2018 03:05:52 +0000 (21:05 -0600)]
Remove a static buffer from cp-name-parser.y
This removes a static buffer from cp-name-parser.y by replacing the
fixed-sized buffer with a std::string out parameter.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* python/py-type.c (typy_legacy_template_argument): Update.
* cp-support.h (cp_demangled_name_to_comp): Update.
* cp-name-parser.y (cp_demangled_name_to_comp): Change errmsg
parameter to be a "std::string *".
(main): Update.
H.J. Lu [Fri, 1 Jun 2018 16:38:22 +0000 (09:38 -0700)]
Move gdb/common/diagnostics.h to include/diagnostics.h
Move gdb/common/diagnostics.h to include/diagnostics.h so that it can
be used in binutils.
gdb/
* ada-lex.l: Include "diagnostics.h" instead of
"common/diagnostics.h".
* unittests/environ-selftests.c: Likewise.
* common/diagnostics.h: Moved to ../include.
include/
* diagnostics.h: Moved from ../gdb/common/diagnostics.h.
Joel Brobecker [Fri, 1 Jun 2018 16:36:05 +0000 (09:36 -0700)]
inadvertent language switch during breakpoint_re_set_one
Trying to insert a breakpoint using *FUNC'address with an Ada program
and then running the program until reaching that breakpoint currently
yields the following behavior:
(gdb) break *a'address
Breakpoint 1 at 0x40240c: file a.adb, line 1.
(gdb) run
[1] + 27222 suspended (tty output) /[...]/gdb -q simple_main
Unsuspending GDB then shows it was suspended trying to report
the following error:
Starting program: /home/takamaka.a/brobecke/ex/simple/a
Error in re-setting breakpoint 1: Unmatched single quote.
Error in re-setting breakpoint 1: Unmatched single quote.
Error in re-setting breakpoint 1: Unmatched single quote.
[Inferior 1 (process 32470) exited normally]
The "a'address" is Ada speak for function A's address ("A" by
itself means the result of calling A with no arguments). The
transcript above shows that we're having problems trying to
parse the breakpoint location while re-setting it. As a result,
we also fail to stop at the breakpoint.
Normally, breakpoint locations are evaluated with the current_language
being set to the language of the breakpoint. But, unfortunately for us,
what happened in this case is that parse_exp_in_context_1 calls
get_selected_block which eventually leads to a call to select_frame
because the current_frame hadn't been set yet. select_frame then
finds that our language_mode is auto, and therefore changes the
current_language to match the language of the frame we just selected.
In our case, the language chosen was 'c', which of course is not
able to parse an Ada expression, hence the error.
This patch prevents this by forcing the language_mode to manual
before we call breakpoint_re_set_one.
gdb/ChangeLog:
* breakpoint.c (breakpoint_re_set): Temporarily force language_mode
to language_mode_manual while calling breakpoint_re_set_one.
gdb/testsuite/ChangeLog:
* gdb.ada/bp_fun_addr: New testcase.
Tested on x86_64-linux.
H.J. Lu [Fri, 1 Jun 2018 16:34:04 +0000 (09:34 -0700)]
Bump version number to 2.30.52
Bump version number to 2.30.52 since _bfd_link_hide_symbol has been added
to bfd_target.
bfd/
* version.m4: Bump version to 2.30.52
* configure: Regenerated.
binutils/
* configure: Regenerated.
gas/
* configure: Regenerated.
gprof/
* configure: Regenerated.
ld/
* configure: Regenerated.
opcodes/
* configure: Regenerated.
Tom Tromey [Tue, 17 Apr 2018 19:51:25 +0000 (13:51 -0600)]
Remove type_name_no_tag and rename type_name_no_tag_or_error
type_name_no_tag is just a plain wrapper for TYPE_NAME now, so this
patch removes it. And, because tag names no longer exist, this
renames type_name_no_tag_or_error to type_name_or_error.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* valops.c (value_cast_structs, destructor_name_p): Update.
* symtab.c (gdb_mangle_name): Update.
* stabsread.c (define_symbol, read_cpp_abbrev, read_baseclasses):
Update.
* p-valprint.c (pascal_object_is_vtbl_ptr_type)
(pascal_object_print_value_fields, pascal_object_print_value):
Update.
* p-typeprint.c (pascal_type_print_derivation_info): Update.
* linespec.c (find_methods): Update.
* gdbtypes.h (type_name_no_tag): Remove.
(type_name_or_error): Rename from type_name_no_tag_or_error.
* gdbtypes.c (type_name_no_tag): Remove.
(type_name_or_error): Rename from type_name_no_tag_or_error.
(lookup_struct_elt_type, check_typedef): Update.
* expprint.c (print_subexp_standard): Update.
* dwarf2read.c (dwarf2_add_field, load_partial_dies): Update.
* d-namespace.c (d_lookup_nested_symbol): Update.
* cp-valprint.c (cp_is_vtbl_ptr_type, cp_print_value_fields)
(cp_print_class_member): Update.
* cp-namespace.c (cp_lookup_nested_symbol): Update.
* completer.c (add_struct_fields): Update.
* c-typeprint.c (cp_type_print_derivation_info)
(c_type_print_varspec_prefix, c_type_print_base_struct_union):
Update.
* ada-lang.c (parse_old_style_renaming, xget_renaming_scope)
(ada_prefer_type, ada_is_exception_sym): Update.
Tom Tromey [Tue, 17 Apr 2018 19:51:24 +0000 (13:51 -0600)]
Remove TYPE_TAG_NAME
TYPE_TAG_NAME has been an occasional source of confusion and bugs. It
seems to me that it is only useful for C and C++ -- but even there,
not so much, because at least with DWARF there doesn't seem to be any
way to wind up with a type where the name and the tag name are both
non-NULL and different.
So, this patch removes TYPE_TAG_NAME entirely. This should save a
little memory, but more importantly, it simplifies this part of gdb.
A few minor test suite adjustments were needed. In some situations
the new code does not yield identical output to the old code.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* valops.c (enum_constant_from_type, value_namespace_elt)
(value_maybe_namespace_elt): Update.
* valarith.c (find_size_for_pointer_math): Update.
* target-descriptions.c (make_gdb_type): Update.
* symmisc.c (print_symbol): Update.
* stabsread.c (define_symbol, read_type)
(complain_about_struct_wipeout, add_undefined_type)
(cleanup_undefined_types_1): Update.
* rust-lang.c (rust_tuple_type_p, rust_slice_type_p)
(rust_range_type_p, val_print_struct, rust_print_struct_def)
(rust_internal_print_type, rust_composite_type)
(rust_evaluate_funcall, rust_evaluate_subexp)
(rust_inclusive_range_type_p): Update.
* python/py-type.c (typy_get_tag): Update.
* p-typeprint.c (pascal_type_print_base): Update.
* mdebugread.c (parse_symbol, parse_type): Update.
* m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum):
Update.
* guile/scm-type.c (gdbscm_type_tag): Update.
* go-lang.c (sixg_string_p): Update.
* gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type):
Update.
* gdbtypes.h (struct main_type) <tag_name>: Remove.
(TYPE_TAG_NAME): Remove.
* gdbtypes.c (type_name_no_tag): Simplify.
(check_typedef, check_types_equal, recursive_dump_type)
(copy_type_recursive, arch_composite_type): Update.
* f-typeprint.c (f_type_print_base): Update. Print "Type" prefix
in summary mode when needed.
* eval.c (evaluate_funcall): Update.
* dwarf2read.c (fixup_go_packaging, read_structure_type)
(process_structure_scope, read_enumeration_type)
(read_namespace_type, read_module_type, determine_prefix): Update.
* cp-support.c (inspect_type): Update.
* coffread.c (process_coff_symbol, decode_base_type): Update.
* c-varobj.c (c_is_path_expr_parent): Update.
* c-typeprint.c (c_type_print_base_struct_union): Update.
(c_type_print_base_1): Update. Print struct/class/union/enum in
summary when using C language.
* ax-gdb.c (gen_struct_ref, gen_namespace_elt)
(gen_maybe_namespace_elt): Update.
* ada-lang.c (ada_type_name): Simplify.
(empty_record, ada_template_to_fixed_record_type_1)
(template_to_static_fixed_type)
(to_record_with_fixed_variant_part, ada_check_typedef): Update.
gdb/testsuite/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* gdb.xml/tdesc-regs.exp (load_description): Update expected
results.
* gdb.dwarf2/method-ptr.exp: Set language to C++.
* gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++.
* gdb.cp/typeid.exp (do_typeid_tests): Update type_re.
* gdb.base/maint.exp (maint_pass_if): Update.
Tom Tromey [Tue, 17 Apr 2018 19:51:23 +0000 (13:51 -0600)]
Thread language through c_type_print_args
Currently dwarf2read.c will pass the CU's language to
c_type_print_args -- but this doesn't affect all aspects of type
printing, because some code in c-typeprint.c refers to
current_language.
This patch threads the language through more of the type printing
code, adding an overload to c_type_print. Some uses of
current_language remain, but now they are only in top-level functions.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_compute_name): Pass CU's language to
c_print_type.
* c-typeprint.c (c_print_type_1): Add "language" parameter.
(c_print_type): Update.
(c_print_type): New overload.
(c_type_print_varspec_prefix, c_type_print_args)
(c_type_print_varspec_suffix, c_print_type_no_offsets)
(c_type_print_base_struct_union, c_type_print_base_1)
(cp_type_print_method_args): Add "language" parameter.
(c_type_print_base): Update.
* c-lang.h (c_print_type): Add new overload.
Tom Tromey [Tue, 17 Apr 2018 19:51:22 +0000 (13:51 -0600)]
Make c_type_print_varspec_suffix static
I noticed that c_type_print_varspec_suffix is only called from
c-typeprint.c, so this patch makes it "static".
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* typeprint.h (c_type_print_varspec_suffix): Don't declare.
* c-typeprint.c (c_type_print_varspec_suffix): Now static.
Alan Hayward [Fri, 1 Jun 2018 15:02:37 +0000 (16:02 +0100)]
Add SVE register defines
In order to prevent gaps in the register numbering, the Z registers
reuse the V register numbers (which become pseudos on SVE).
2018-06-01 Alan Hayward <alan.hayward@arm.com>
* aarch64-tdep.c (aarch64_sve_register_names): New const
var.
* arch/aarch64.h (enum aarch64_regnum): Add SVE entries.
(AARCH64_SVE_Z_REGS_NUM): New define.
(AARCH64_SVE_P_REGS_NUM): Likewise.
(AARCH64_SVE_NUM_REGS): Likewise.
Alexandre Oliva [Fri, 1 Jun 2018 09:00:25 +0000 (06:00 -0300)]
Drop view when consuming line info
Fix locviews on ia64. If we do not drop the view after copying line
info to slots in the bundle, we may attempt to compute the view more
than once and get very confused.
for gas/ChangeLog
* dwarf2dbg.c (dwarf2_consume_line_info): Drop view.
Jan Beulich [Fri, 1 Jun 2018 06:41:16 +0000 (08:41 +0200)]
x86: fold MOV to/from segment register templates
First of all there's no point in having separate Cpu386 templates - the
respective SReg3 registers can't be specified for pre-386 anyway; see
parse_real_register().
And then we can also make use of D here for the memory forms of the
insn. This cannot be done for the non-64bit GPR forms because of the
IgnoreSize that cannot be dropped from the to-SREG variant.
Jan Beulich [Fri, 1 Jun 2018 06:40:38 +0000 (08:40 +0200)]
x86: don't emit REX.W for SLDT and STR
Just like for other selector register reads, they're unnecessary and
should hence be avoided.
Jan Beulich [Fri, 1 Jun 2018 06:39:54 +0000 (08:39 +0200)]
x86: relax redundant REX prefix check
All REX bits can be specified via individual prefixes. Redundancy should
only be reported on a per-bit basis.
Note that I originally had further checks added to the test case,
checking the effect also on PDEP. I had to strip those, because my patch
to correctly handle those
(https://sourceware.org/ml/binutils/2017-02/msg00280.html) was rejected.
I continue to think that there should not be any new prefix introduced
to handle the VEX case - whether the encoding of an insn requires VEX et
al should not be of immediate interest to the programmer.
Jan Beulich [Fri, 1 Jun 2018 06:39:08 +0000 (08:39 +0200)]
x86: simplify control register check
... as is already done elsewhere: There's no need for the use of
operand_type_equal() here - the bit identifying control registers isn't
used for any other purposes.
Jan Beulich [Fri, 1 Jun 2018 06:38:36 +0000 (08:38 +0200)]
x86: tighten condition for emitting LOCK on control register accesses
The control register is never expressed by REX.B; this bit only affects
the involved GPR. Also only one of the operands can have its "control"
flag set, so only check the correct operand.
Jan Beulich [Fri, 1 Jun 2018 06:37:24 +0000 (08:37 +0200)]
x86/Intel: accept "oword ptr" for INVPCID
The insn is no different in this reagrd from INVEPT and INVVPID.
Alan Modra [Fri, 1 Jun 2018 01:30:46 +0000 (11:00 +0930)]
Make _bfd_error_handler available outside libbfd
Needed when building libopcodes.so.
bfd/
* bfd.c (_bfd_error_handler): Arrange for this function to be
declared in bfd-in2.h.
* libbfd-in.h (_bfd_error_handler): Don't declare.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
opcodes/
* sysdep.h (_bfd_error_handler): Don't declare.
* msp430-decode.opc: Include bfd.h. Don't include ansidecl.h here.
* rl78-decode.opc: Likewise.
* msp430-decode.c: Regenerate.
* rl78-decode.c: Regenerate.
GDB Administrator [Fri, 1 Jun 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 26 Apr 2018 22:51:40 +0000 (16:51 -0600)]
Fix "set" handling of Python parameters
It's long bothered me that setting a Python parameter from the CLI
will print the "set" help text by default. I think usually "set"
commands should be silent. And, while you can modify this behavior a
bit by providing a "get_set_string" method, if this method returns an
empty string, a blank line will be printed.
This patch removes the "help" behavior and changes the get_set_string
behavior to avoid printing a blank line. The code has a comment about
preserving API behavior, but I don't think this is truly important;
and in any case the workaround -- implementing get_set_string -- is
trivial.
Regression tested on x86-64 Fedora 26.
2018-04-26 Tom Tromey <tom@tromey.com>
* NEWS: Mention new "set" behavior.
* python/py-param.c (get_set_value): Don't print an empty string.
Don't call get_doc_string.
gdb/doc/ChangeLog
2018-04-26 Tom Tromey <tom@tromey.com>
* python.texi (Parameters In Python): Update get_set_string
documentation.
Tom Tromey [Sun, 22 Apr 2018 21:13:09 +0000 (15:13 -0600)]
Add basic Python API for convenience variables
This adds a basic Python API for accessing convenience variables.
With this, convenience variables can be read and set from Python.
Although gdb supports convenience variables whose value changes at
each call, this is not exposed to Python; it could be, but I think
it's just as good to write a convenience function in this situation.
This is PR python/23080.
Tested on x86-64 Fedora 26.
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* NEWS: Update for new functions.
* python/py-value.c (gdbpy_set_convenience_variable)
(gdbpy_convenience_variable): New functions.
* python/python-internal.h (gdbpy_convenience_variable)
(gdbpy_set_convenience_variable): Declare.
* python/python.c (python_GdbMethods): Add convenience_variable,
set_convenience_variable.
doc/ChangeLog
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* python.texi (Basic Python): Document gdb.convenience_variable,
gdb.set_convenience_variable.
testsuite/ChangeLog
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* gdb.python/python.exp: Add convenience variable tests.
Uros Bizjak [Thu, 31 May 2018 15:18:02 +0000 (11:18 -0400)]
Fix Alpha native GDB build
[Commit log by Simon Marchi]
I get this error:
CXX linux-nat.o
/home/simark/src/binutils-gdb/gdb/linux-nat.c: In function 'void save_stop_reason(lwp_info*)':
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2718:9: error: duplicated 'if' condition [-Werror=duplicated-cond]
else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
^~
In file included from /home/simark/src/binutils-gdb/gdb/linux-nat.c:31:0:
/home/simark/src/binutils-gdb/gdb/nat/linux-ptrace.h:173:41: note: previously used here
# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
~~~~~^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2709:13: note: in expansion of macro 'GDB_ARCH_IS_TRAP_BRKPT'
else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
^~~~~~~~~~~~~~~~~~~~~~
For Alpha, we currently define GDB_ARCH_IS_TRAP_BRKPT and
GDB_ARCH_IS_TRAP_HWBKPT both to ((X) == TRAP_BRKPT), which causes the
two if branches to be duplicated.
Alpha doesn't have hardware breakpoints, so the Linux kernel for Alpha
never sets si_code to TRAP_HWBKPT. We can just remove the special
definitions of these macros for __alpha__ and rely on the default ones.
Since the kernel will never report TRAP_HWBKPT, we will just never enter
the "hardware breakpoint" branch on Alpha (which is fine since it
doesn't have them).
gdb/ChangeLog:
* nat/linux-ptrace.h [__alpha__]
(GDB_ARCH_IS_TRAP_BRKPT, GDB_ARCH_IS_TRAP_HWBKPT): Remove
definitions.
Maciej W. Rozycki [Thu, 31 May 2018 14:15:35 +0000 (15:15 +0100)]
arch-utils: Make the last endianness actually chosen sticky
Use the last endianness explicitly selected, either by choosing a binary
file or with the `set endian' command, for future automatic selection.
As observed with the `gdb.base/step-over-no-symbols.exp' test case when
discarding the binary file even while connected to a live target the
endianness automatically selected is reset to the GDB target's default,
even if it does not match the endianness of the target being talked to.
For example with a little-endian MIPS target and the default endianness
being big we get this:
(gdb) file .../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols
Reading symbols from .../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols...done.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break main
Breakpoint 1 at 0x400840: file .../gdb/testsuite/gdb.base/start.c, line 34.
[...]
(gdb) continue
Continuing.
Breakpoint 1, main () at .../gdb/testsuite/gdb.base/start.c:34
34 foo();
(gdb) delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
No executable file now.
Discard symbol table from `.../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols'? (y or n) y
No symbol file now.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: purging symbols
p /x $pc
$1 = 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get before PC
break *$pc
Breakpoint 2 at 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: break *$pc
set displaced-stepping off
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: set displaced-stepping off
stepi
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x40084000
Command aborted.
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
$2 = 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host ...
monitor exit
(gdb) Killing process(es): ...
testcase .../gdb/testsuite/gdb.base/step-over-no-symbols.exp completed in 2 seconds
which shows that with the removal of the executable debugged the
endianness of $pc still at `main' gets swapped and the value in that
register is now incorrectly interpreted as 0x40084000 rather than
0x400840 as shown earlier on with the `break' command. Consequently the
debug session no longer works as expected, until the endianness is
overridden with an explicit `set endian little' command.
This will happen while working with any target hardware whose endianness
does not match the default GDB target's endianness guessed and recorded
for a later use in `initialize_current_architecture'.
Given that within a single run of GDB it is more likely that consecutive
target connections will use the same endianness than that the endianness
will be swapped between connections, it makes sense to preserve the last
endianness explicitly selected as the automatic default. It will make a
session like above, where an executable is removed, work correctly and
will retain the endianness for a further reconnection to the target.
And the new automatic default will still be overridden by subsequently
choosing a binary to debug, or with an explicit `set endian' command.
With the change in place the test case above completes successfully:
(gdb) continue
Continuing.
Breakpoint 1, main () at .../gdb/testsuite/gdb.base/start.c:34
34 foo();
(gdb) delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
No executable file now.
Discard symbol table from `.../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols'? (y or n) y
No symbol file now.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: purging symbols
p /x $pc
warning: GDB can't find the start of the function at 0x400840.
GDB is unable to find the start of the function at 0x400840
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0x400840 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
$1 = 0x400840
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get before PC
break *$pc
Breakpoint 2 at 0x400840
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: break *$pc
set displaced-stepping off
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: set displaced-stepping off
stepi
warning: GDB can't find the start of the function at 0x4007f8.
0x004007f8 in ?? ()
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
$2 = 0x4007f8
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
PASS: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host ...
monitor exit
(gdb) Killing process(es): ...
testcase .../gdb/testsuite/gdb.base/step-over-no-symbols.exp completed in 2 seconds
gdb/
* arch-utils.c (gdbarch_info_fill): Set `default_byte_order' to
the endianness selected.
* NEWS: Document `set endian auto' mode operation update.
gdb/doc/
* gdb.texinfo (Choosing Target Byte Order): Document endianness
selection details with the `set endian auto' mode.
gdb/testsuite
* gdb.base/endian.exp: New test.
* gdb.base/endian.c: New test source.
Alan Hayward [Thu, 31 May 2018 13:36:48 +0000 (14:36 +0100)]
Function for reading the Aarch64 SVE vector length
Returns 0 for systems without SVE support.
Note the defines taken from Linux kernel headers
in aarch64-sve-linux-ptrace.h.
gdb/
* Makefile.in: Add new header.
* gdb/arch/aarch64.h (sve_vg_from_vl): New macro.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
* configure.nat: Add new c file.
* nat/aarch64-sve-linux-ptrace.c: New file.
* nat/aarch64-sve-linux-ptrace.h: New file.
gdbserver/
* configure.srv: Add new c/h file.
Alan Hayward [Thu, 31 May 2018 12:33:04 +0000 (13:33 +0100)]
Add Aarch64 SVE target description
No code uses the new descriptions yet.
gdb/
* aarch64-linux-nat.c (aarch64_linux_read_description):
Add parmeter zero.
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
Likewise.
* aarch64-tdep.c (tdesc_aarch64_list): Add.
(aarch64_read_description): Use VQ to index tdesc_aarch64_list.
(aarch64_gdbarch_init): Add parmeter zero.
* aarch64-tdep.h (aarch64_read_description): Add VQ parmeter.
* arch/aarch64.c (aarch64_create_target_description): Check VQ.
* arch/aarch64.h (aarch64_create_target_description): Add VQ.
parmeter.
* doc/gdb.texinfo: Describe SVE feature
* features/aarch64-sve.c: New file.
gdbserver/
* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add
null VQ.
edlinger [Mon, 28 May 2018 18:21:23 +0000 (18:21 +0000)]
include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
include:
* splay-tree.h (splay_tree_compare_strings,
splay_tree_delete_pointers): Declare new utility functions.
libiberty:
2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
* splay-tree.c (splay_tree_compare_strings,
splay_tree_delete_pointers): New utility functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260850
138bc75d-0d04-0410-961f-
82ee72b054a4
marxin [Thu, 10 May 2018 10:15:42 +0000 (10:15 +0000)]
Improve boostrap-ubsan config (PR bootstrap/64914).
2018-05-10 Martin Liska <mliska@suse.cz>
PR bootstrap/64914
* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260112
138bc75d-0d04-0410-961f-
82ee72b054a4
law [Mon, 30 Apr 2018 18:00:49 +0000 (18:00 +0000)]
* argv.c (expandargv): Fix memory leak for expanded arguments.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775
138bc75d-0d04-0410-961f-
82ee72b054a4
Omair Javaid [Sat, 26 May 2018 00:58:51 +0000 (05:58 +0500)]
Unset gdbarch significant_addr_bit by default
This patch fixes a bug introduced by fix to AArch64 pointer tagging.
In our fix for tagged pointer support our agreed approach was to sign
extend user-space address after clearing tag bits. This is not same
for all architectures and this patch allows sign extension for
addresses on targets which specifically set significant_addr_bit.
More information about patch that caused the issues and discussion
around tagged pointer support can be found in links below:
https://sourceware.org/ml/gdb-patches/2018-05/msg00000.html
https://sourceware.org/ml/gdb-patches/2017-12/msg00159.html
gdb/ChangeLog:
2018-05-31 Omair Javaid <omair.javaid@linaro.org>
PR gdb/23210
* gdbarch.sh (significant_addr_bit): Default to zero when
not set by target architecture.
* gdbarch.c: Re-generated.
* utils.c (address_significant): Update.
Alan Modra [Tue, 29 May 2018 01:23:18 +0000 (10:53 +0930)]
Run a few more binutils tests non-native
Setting CC_FOR_TARGET from the environment CC was just plain wrong,
and no doubt the reason these tests were only run natively.
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Don't
set CC_FOR_TARGET. Run test non-native.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.
(test_follow_debuglink): Run test non-native.
GDB Administrator [Thu, 31 May 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Wed, 30 May 2018 23:43:02 +0000 (16:43 -0700)]
(ARI) remove trailing newline in call to error in stack.c::func_command
gdb/ChangeLog:
* stack.c (func_command): Remove trailing newline in call to error.
Simon Marchi [Wed, 30 May 2018 18:54:46 +0000 (14:54 -0400)]
Remove regcache_raw_collect
Remove regcache_raw_collect, update callers to use
regcache::raw_collect.
gdb/ChangeLog:
* regcache.h (regcache_raw_collect): Remove, update callers to
use regcache::raw_collect.
* regcache.c (regcache_raw_collect): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:45 +0000 (14:54 -0400)]
Remove regcache_raw_supply
Remove regcache_raw_supply, update callers to use
detached_regcache::raw_supply.
gdb/ChangeLog:
* regcache.h (regcache_raw_supply): Remove, update callers to
use detached_regcache::raw_supply.
* regcache.c (regcache_raw_supply): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:44 +0000 (14:54 -0400)]
Remove regcache_cooked_write_part
Remove regcache_cooked_write_part, update callers to use
regcache::cooked_write_part.
gdb/ChangeLog:
* regcache.h (regcache_cooked_write_part): Remove, update
callers to use regcache::cooked_write_part.
* regcache.c (regcache_cooked_write_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:43 +0000 (14:54 -0400)]
Remove regcache_cooked_read_part
Remove regcache_cooked_read_part, update callers to use
readable_regcache::cooked_read_part.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_part): Remove, update callers
to use readable_regcache::cooked_read_part.
* regcache.c (regcache_cooked_read_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)]
Remove regcache_cooked_read_value
Remove regcache_cooked_read_value, update callers to use
readable_regcache::cooked_read_value.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_value): Remove, update
callers to use readable_regcache::cooked_read_value.
* regcache.c (regcache_cooked_read_value): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)]
Remove regcache_cooked_write
Remove regcache_cooked_write, update callers to use
regcache::cooked_write.
gdb/ChangeLog:
* regcache.h (regcache_cooked_write): Remove, update callers to
use regcache::cooked_write.
* regcache.c (regcache_cooked_write): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:41 +0000 (14:54 -0400)]
Remove regcache_invalidate
Remove regcache_invalidate, update callers to use
detached_regcache::invalidate instead.
gdb/ChangeLog:
* regcache.h (regcache_invalidate): Remove, update callers to
use detached_regcache::invalidate instead.
* regcache.c (regcache_invalidate): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:40 +0000 (14:54 -0400)]
Remove regcache_raw_write_part
Remove regcache_raw_write_part, update callers to use
regcache::raw_write_part instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_write_part): Remove, update callers
to use regcache::raw_write_part instead.
* regcache.c (regcache_raw_write_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:39 +0000 (14:54 -0400)]
Remove regcache_raw_read_part
Remove regcache_raw_read_part, update callers to use
readable_regcache::raw_read_part instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_read_part): Remove, update callers to
use readable_regcache::raw_read_part instead.
* regcache.c (regcache_raw_read_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:38 +0000 (14:54 -0400)]
Remove regcache_cooked_read
Remove regcache_cooked_read, update callers to use
readable_regcache::cooked_read instead.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read): Remove, update callers to
use readable_regcache::cooked_read instead.
* regcache.c (regcache_cooked_read): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:37 +0000 (14:54 -0400)]
Remove regcache_raw_write
Remove regcache_raw_write, update all callers to use regcache::raw_write
instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_write): Remove, update callers to use
regcache::raw_write instead.
* regcache.c (regcache_raw_write): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)]
Remove regcache_raw_read
Remove regcache_raw_read, update all callers to use
readable_regcache::raw_read instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_read): Remove, update callers to use
readable_regcache::raw_read instead.
* regcache.c (regcache_raw_read): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)]
Remove regcache_raw_update
Remove regcache_raw_update, update callers to use
readable_regcache::raw_update instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_update): Remove, update callers to
use readable_regcache::raw_update instead.
* regcache.c (regcache_raw_update): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:35 +0000 (14:54 -0400)]
Remove regcache_register_status
Remove regcache_register_status, change callers to use
reg_buffer::get_register_status directly.
gdb/ChangeLog:
* regcache.h (regcache_register_status): Remove, update callers
to use reg_buffer::get_register_status directly instead.
* regcache.c (regcache_register_status): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:34 +0000 (14:54 -0400)]
Remove regcache_get_ptid
Remove regcache_get_ptid, change all callers to call the regcache method
directly.
gdb/ChangeLog:
* regcache.h (regcache_get_ptid): Remove, update all callers to
call regcache::ptid instead.
* regcache.c (regcache_get_ptid): Remove.
Ant Bikeneev [Wed, 30 May 2018 16:06:26 +0000 (17:06 +0100)]
Add option to ar's 't' command to display the offset of elements within the archive.
PR 23107
* ar.c (display_offsets): New variable.
(usage): Add description of 'O' operator.
(decode_option): Handle 'O' operator.
(print_descr): Pass display_offsets to print_arelt_descr.
* arsup.c: Update call to printy_arelt_descr.
* objdump.c: Likewise.
* bucomm.c (print_arelt_descr): If offsets parameter is true then
display offset of archive element within the archive.
* bucomm.h: Update prototype for print_arelt_descr.
* doc/binutils.texi: Update description of ar command.
* NEWS: Mention the new feature.
* testsuite/binutils-all/ar.exp: Add text of new feature.
Simon Marchi [Wed, 30 May 2018 16:04:35 +0000 (12:04 -0400)]
Add or1k target to --enable-targets=all
The or1k-tdep.o object is missing from the ALL_TARGET_OBS, which means
it's not currently included in an --enable-targets=all build.
gdb/ChangeLog:
* Makefile.in (ALL_TARGET_OBS): Add or1k-tdep.o.
Amaan Cheval [Fri, 18 May 2018 20:20:40 +0000 (01:50 +0530)]
2018-05-30 Amaan Cheval <amaan.cheval@gmail.com>
* config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
This is needed to generate UEFI application image files from ELFs.
Pedro Alves [Wed, 30 May 2018 13:18:47 +0000 (14:18 +0100)]
Mark END_CATCH as ATTRIBUTE_NORETURN (-Wmaybe-uninitialized warnings)
This commit fixes a set of -Wmaybe-uninitialized warnings in GDB and
GDBserver, seen with GCC 7.3.1 on F27 at -O2. Specifically, all of
these:
src/gdb/breakpoint.c:5040:4: warning: ‘e’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/cli/cli-cmds.c:277:71: warning: ‘tracker’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/cli/cli-cmds.c:302:22: warning: ‘word’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/gdbserver/server.c:1895:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
For example, looking at one of the gdbserver ones in more detail:
../../../src/gdb/gdbserver/server.c: In function ‘int handle_qxfer_btrace_conf(const char*, gdb_byte*, const gdb_byte*, ULONGEST, LONGEST)’:
../../../src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (result != 0)
^~
In this case (like the others), the 'result' variable is assigned in
both TRY and CATCH blocks:
TRY
{
result = target_read_btrace_conf (thread->btrace, &cache);
if (result != 0)
memcpy (own_buf, cache.buffer, cache.used_size);
}
CATCH (exception, RETURN_MASK_ERROR)
{
sprintf (own_buf, "E.%s", exception.message);
result = -1;
}
END_CATCH
if (result != 0)
return -3;
so it would seem like the warning is bogus.
However, END_CATCH is really a catch block in disguise, and that path
indeed does not initialize the variable:
#define END_CATCH \
catch (...) \
{ \
exception_rethrow (); \
} \
}
exception_rethrow does not return normally (it rethrows the current
exception after running cleanups), but the compiler can not see that.
If it could return normally, then indeed 'result' could be used
uninitialized if the TRY block threw some non-gdb exception, which
would be caught by END_CATCH.
The fix it to let the compiler know that the exception_rethrow does
not return normally, using ATTRIBUTE_NORETURN.
gdb/ChangeLog:
2018-05-30 Pedro Alves <palves@redhat.com>
* common/common-exceptions.h (exception_rethrow): Use
ATTRIBUTE_NORETURN.
Amit Pawar [Wed, 30 May 2018 06:57:35 +0000 (12:27 +0530)]
Add znver2 support.
gas/
* config/tc-i386.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* doc/c-i386.texi : Document znver2.
* gas/testsuite/gas/i386/arch-13.s: Updated for znver2.
* gas/testsuite/gas/i386/arch-13.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver1.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver2.d: New file.
* gas/testsuite/gas/i386/x86-64-arch-3.s: Updated for znver2.
* gas/testsuite/gas/i386/x86-64-arch-3.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver1.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver2.d: New file.
* gas/testsuite/gas/i386/i386.exp: Updated for new test.
opcode/
* i386-gen.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* i386-init.h : Regenerated.
Simon Marchi [Wed, 30 May 2018 00:13:04 +0000 (20:13 -0400)]
Remove "struct" keyword in range-based for loops
I get this kind of errors with GCC 6.3.0:
/home/simark/src/binutils-gdb/gdb/breakpoint.c: In function 'void print_solib_event(int)':
/home/simark/src/binutils-gdb/gdb/breakpoint.c:4618:12: error: types may not be defined in a for-range-declaration [-Werror]
for (struct so_list *iter : current_program_space->added_solibs)
^~~~~~
Removing the struct keyword makes it happy.
gdb/ChangeLog:
* breakpoint.c (print_solib_event, check_status_catch_solib):
Remove struct keyword in range-based for loops.
* dbxread.c (find_corresponding_bincl_psymtab): Likewise.
* dwarf2read.c (compute_delayed_physnames, rust_union_quirks);
Likewise.
* linespec.c (find_superclass_methods, search_minsyms_for_name):
Likewise.
* symfile.c (addr_info_make_relative): Likewise.
* thread.c (value_in_thread_stack_temporaries): Likewise.
GDB Administrator [Wed, 30 May 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Weimin Pan [Tue, 29 May 2018 22:01:34 +0000 (22:01 +0000)]
Removing lookup_minimal_symbol_and_objfile
Function lookup_minimal_symbol_and_objfile iterates on all objfiles and
calls lookup_minimal_symbol for each of them, effectively searching in all
objfiles. lookup_bound_minimal_symbol calls lookup_minimal_symbol with NULL,
which also effectively searches all objfiles. AFAIK, they do exactly the same
thing, so we can get rid of one (and lookup_minimal_symbol_and_objfile happens
to be the most inefficient because it ends up n^2 on the number of objfiles).
Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.