Commit Graph

94424 Commits

Author SHA1 Message Date
Tom Tromey c7110220be 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.
2018-06-07 06:38:18 -06:00
Tamar Christina 2a9b2c1abe 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.
2018-06-07 11:54:11 +01:00
Alan Hayward 63bad7b636 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.
2018-06-07 10:31:41 +01:00
GDB Administrator 066b621238 Automatic date update in version.in 2018-06-07 00:00:50 +00:00
Alan Modra fc6041a776 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.
2018-06-07 09:10:15 +09:30
Alan Modra 527278f336 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.
2018-06-07 09:07:32 +09:30
Sergio Durigan Junior e5a77256e8 Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)
Commit 122394f147 ("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.
2018-06-06 17:35:01 -04:00
Sameera Deshpande eb5c42e511 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.
2018-06-06 15:19:59 +01:00
Alan Modra 08f22593f0 armelf_fbsd and armelf_fuchsia dependencies
* Makefile.am (earmelf_fbsd.c): Correct dependencies.
	(earmelfb_fbsd.c, earmelfb_fuchsia.c): Likewise.
	* Makefile.in: Regenerate.
2018-06-06 21:31:41 +09:30
Alan Modra ce72cd46ec 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.
2018-06-06 21:30:36 +09:30
GDB Administrator 773ff7907c Automatic date update in version.in 2018-06-06 00:00:53 +00:00
Tom Tromey c61b06a19a 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.
2018-06-05 11:47:50 -06:00
David Malcolm 115f7325b5 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.
2018-06-05 18:22:25 +01:00
Tom Tromey eb6af80922 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.
2018-06-05 11:02:52 -06:00
Alan Modra 5c4ce239a3 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.
2018-06-05 22:39:12 +09:30
Alan Modra 27b0767593 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.
2018-06-05 22:39:11 +09:30
Alan Modra 8347745522 Another s12z regen
* Makefile.in: Regenerate.
2018-06-05 22:39:11 +09:30
Flavio Ceolin 112ba8675e 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.
2018-06-05 12:39:47 +01:00
Nick Clifton 84e219e23c 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.
2018-06-05 12:26:44 +01:00
GDB Administrator e6d079c2fb Automatic date update in version.in 2018-06-05 00:00:36 +00:00
Tom Tromey 54d343a240 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.
2018-06-04 15:33:28 -06:00
Joel Brobecker 178d6a6386 (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.
2018-06-04 16:07:33 -04:00
Max Filippov 4b8e28c793 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.
2018-06-04 10:38:55 -07:00
Max Filippov 8255c61b8a 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.
2018-06-04 10:36:39 -07:00
H.J. Lu 95da985446 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.
2018-06-04 10:01:46 -07:00
Alan Hayward 62b74cb8b0 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.
2018-06-04 17:23:07 +01:00
Simon Marchi baf00c2d75 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.
2018-06-04 10:40:27 -04:00
Stan Cox c12a508964 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.
2018-06-04 10:20:49 -04:00
H.J. Lu 23081219bf 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.
2018-06-04 06:35:07 -07:00
Tom Tromey 214b073ced 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.
2018-06-04 07:15:11 -06:00
Alan Hayward 3c5cd5c3b4 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.
2018-06-04 14:09:57 +01:00
Pedro Alves 59f413d541 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 f6ac5f3d63 ("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.
2018-06-04 12:26:39 +01:00
Alan Hayward 1332a14001 Use uint64_t for aarch64 tdep VQ 2018-06-04 12:14:53 +01:00
Alan Hayward ba2d2bb24e 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.
2018-06-04 12:07:26 +01:00
Alan Hayward 39bfb9373c 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.
2018-06-04 10:50:59 +01:00
GDB Administrator ff183b0d82 Automatic date update in version.in 2018-06-04 00:00:48 +00:00
Jim Wilson cf7a5066b9 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.
2018-06-03 15:42:29 -07:00
Jim Wilson 137b5cbd20 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.
2018-06-03 14:44:44 -07:00
GDB Administrator b15fe636af Automatic date update in version.in 2018-06-03 00:00:49 +00:00
Simon Marchi 41c60b4b26 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.
2018-06-02 09:17:06 -04:00
GDB Administrator a131318670 Automatic date update in version.in 2018-06-02 00:00:35 +00:00
Tom Tromey 7b640f7268 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.
2018-06-01 10:46:49 -06:00
Tom Tromey 98e69eb381 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.
2018-06-01 10:46:49 -06:00
Tom Tromey 49265499d8 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.
2018-06-01 10:46:48 -06:00
Tom Tromey 55b6c98496 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.
2018-06-01 10:46:48 -06:00
Tom Tromey 3513a6bb20 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.
2018-06-01 10:46:47 -06:00
H.J. Lu e9cb46ab59 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.
2018-06-01 09:40:30 -07:00
Joel Brobecker 8e81706197 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.
2018-06-01 09:36:59 -07:00
H.J. Lu 55e99962b2 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.
2018-06-01 09:34:16 -07:00
Tom Tromey a737d952e0 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.
2018-06-01 10:19:55 -06:00