Commit Graph

88417 Commits

Author SHA1 Message Date
Pedro Alves 93689493b3 gdb/s390: Fix build breakage due to std::min/std::max usage without header
[...]
  .../gdb/s390-linux-nat.c: In function 'void s390_prepare_to_resume(lwp_info*)':
  .../gdb/s390-linux-nat.c:703:20: error: 'min' is not a member of 'std'
      watch_lo_addr = std::min (watch_lo_addr, area->lo_addr);
  [...]

gdb/ChangeLog:
2016-09-18  Pedro Alves  <palves@redhat.com>

	* s390-linux-nat.c: Include <algorithm>.
2016-09-19 00:30:30 +01:00
Pedro Alves 768adc05c4 gdb: Fix std::{min, max}-related build breakage on 32-bit hosts
Building on a 32-bit host fails currently with errors like:

  .../src/gdb/exec.c: In function ‘target_xfer_status section_table_read_available_memory(gdb_byte*, ULONGEST, ULONGEST, ULONGEST*)’:
  .../src/gdb/exec.c:801:54: error: no matching function for call to ‘min(ULONGEST, long unsigned int)’
      end = std::min (offset + len, r->start + r->length);
							^
  In file included from /usr/include/c++/5.3.1/algorithm:61:0,
		   from .../src/gdb/exec.c:46:
  /usr/include/c++/5.3.1/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
       min(const _Tp& __a, const _Tp& __b)
       ^
  /usr/include/c++/5.3.1/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
  .../src/gdb/exec.c:801:54: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long unsigned int’ and ‘long unsigned int’)
      end = std::min (offset + len, r->start + r->length);
							^
  In file included from /usr/include/c++/5.3.1/algorithm:61:0,
		   from .../src/gdb/exec.c:46:
  /usr/include/c++/5.3.1/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
       min(const _Tp& __a, const _Tp& __b, _Compare __comp)
       ^

The problem is that the std::min/std::max function templates use the
same type for both parameters.  When the argument types are different,
the compiler can't automatically deduce which template specialization
to pick from the arguments' types.

Fix that by specifying the specialization we want explicitly.

gdb/ChangeLog:
2016-09-18  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (hardware_watchpoint_inserted_in_range): Explicitly
	specify the std:min/std::max specialization.
	* exec.c (section_table_read_available_memory): Likewise.
	* remote.c (remote_read_qxfer): Likewise.
	* target.c (simple_verify_memory): Likewise.
2016-09-18 23:56:01 +01:00
GDB Administrator 498f644143 Automatic date update in version.in 2016-09-18 00:00:23 +00:00
Eli Zaretskii 7f3c5ec870 Improve MinGW support in Readline
These changes were already accepted upstream in Readline,
but GDB did not yet import a newer Readline version.

readline/Changelog.gdb:

	* util.c: Include rlshell.h.
	(_rl_tropen) [_WIN32 && !__CYGWIN__]: Open the trace file in the
	user's temporary directory.
	* tcap.h [HAVE_NCURSES_TERMCAP_H]: Include ncurses/termcap.h.
	* input.c (w32_isatty) [_WIN32 && !__CYGWIN__]: New function, to
	replace isatty that is not reliable enough on MS-Windows.
	(isatty) [_WIN32 && !__CYGWIN__]: Redirect to w32_isatty.
	(rl_getc): Call _getch, not getch, which could be an ncurses
	function when linked with ncurses, in which case getch will return
	EOF for any keystroke, because there's no curses window.
	* tilde.c (tilde_expand_word) [_WIN32]:
	* histfile.c (history_filename) [_WIN32]: Windows-specific
	environment variable to replace HOME if that is undefined.
	* funmap.c (default_funmap): Compile rl_paste_from_clipboard on
	all Windows platforms, not just Cygwin.
	* readline.h (rl_paste_from_clipboard): Include declaration for
	all Windows platforms.
	* display.c (insert_some_chars, delete_chars): Don't use the
	MinGW-specific code if linked with ncurses.
	* configure.in:
	* config.h.in: Support ncurses/termcap.h.  The configure script
	was updated accordingly.
	* complete.c [_WIN32 && !__CYGWIN__]: Initialize
	_rl_completion_case_fold to 1.
	(printable_part, rl_filename_completion_function)
	[_WIN32 && !__CYGWIN__]: Handle the drive letter.
2016-09-17 11:50:37 +03:00
GDB Administrator a3fa21cadc Automatic date update in version.in 2016-09-17 00:00:23 +00:00
Simon Marchi cd94f6d535 Introduce cleanup to restore current_uiout
Make a globally available cleanup from a pre-existing one in infrun.c.
This is used in a following patch.

gdb/ChangeLog:

	* infrun.c (restore_current_uiout_cleanup): Move to ui-out.c.
	(print_stop_event): Use make_cleanup_restore_current_uiout.
	* python/python.c (execute_gdb_command): Likewise.
	* ui-out.c (restore_current_uiout_cleanup): Move from infrun.c.
	(make_cleanup_restore_current_uiout): New function definition.
	* ui-out.h (make_cleanup_restore_current_uiout): New function
	declaration.
	* utils.c (do_restore_ui_out): Remove.
	(make_cleanup_restore_ui_out): Remove.
	* utils.h (make_cleanup_restore_ui_out): Remove.
2016-09-16 15:44:29 -04:00
Pedro Alves 325fac504a gdb: Use std::min and std::max throughout
Otherwise including <string> or some other C++ header is broken.
E.g.:

  In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0,
		   from /opt/gcc/include/c++/7.0.0/string:40,
		   from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68:
  /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
       min(const _Tp& __a, const _Tp& __b, _Compare __comp)
							  ^
  /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
       max(const _Tp& __a, const _Tp& __b, _Compare __comp)
							  ^
  In file included from .../src/gdb/infrun.c:21:0:

To the best of my grepping abilities, I believe I adjusted all min/max
calls.

gdb/ChangeLog:
2016-09-16  Pedro Alves  <palves@redhat.com>

	* defs.h (min, max): Delete.
	* aarch64-tdep.c: Include <algorithm> and use std::min and
	std::max throughout.
	* aarch64-tdep.c: Likewise.
	* alpha-tdep.c: Likewise.
	* amd64-tdep.c: Likewise.
	* amd64-windows-tdep.c: Likewise.
	* arm-tdep.c: Likewise.
	* avr-tdep.c: Likewise.
	* breakpoint.c: Likewise.
	* btrace.c: Likewise.
	* ctf.c: Likewise.
	* disasm.c: Likewise.
	* doublest.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* environ.c: Likewise.
	* exec.c: Likewise.
	* f-exp.y: Likewise.
	* findcmd.c: Likewise.
	* ft32-tdep.c: Likewise.
	* gcore.c: Likewise.
	* hppa-tdep.c: Likewise.
	* i386-darwin-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* linux-thread-db.c: Likewise.
	* lm32-tdep.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* memrange.c: Likewise.
	* minidebug.c: Likewise.
	* mips-tdep.c: Likewise.
	* moxie-tdep.c: Likewise.
	* nds32-tdep.c: Likewise.
	* nios2-tdep.c: Likewise.
	* nto-procfs.c: Likewise.
	* parse.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* probe.c: Likewise.
	* record-btrace.c: Likewise.
	* remote.c: Likewise.
	* rs6000-tdep.c: Likewise.
	* rx-tdep.c: Likewise.
	* s390-linux-nat.c: Likewise.
	* s390-linux-tdep.c: Likewise.
	* ser-tcp.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* source.c: Likewise.
	* sparc-tdep.c: Likewise.
	* symfile.c: Likewise.
	* target-memory.c: Likewise.
	* target.c: Likewise.
	* tic6x-tdep.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* tracefile-tfile.c: Likewise.
	* tracepoint.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* xtensa-tdep.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* compile/compile-object-load.c: Likewise.
2016-09-16 19:55:17 +01:00
Andreas Arnez 8193adea2f S390: Hardware breakpoint support
Add hardware breakpoint support for S390 targets.

gdb/ChangeLog:

	* s390-linux-nat.c (PER_BIT, PER_EVENT_BRANCH, PER_EVENT_IFETCH)
	(PER_EVENT_STORE, PER_EVENT_NULLIFICATION)
	(PER_CONTROL_BRANCH_ADDRESS, PER_CONTROL_SUSPENSION)
	(PER_CONTROL_ALTERATION): New macros.
	(struct s390_debug_reg_state) <break_areas>: New member.
	(s390_forget_process): Free break_areas as well.
	(s390_linux_new_fork): Copy break_areas as well.
	(s390_prepare_to_resume): Install hardware breakpoints.
	(s390_can_use_hw_breakpoint): Indicate support for hardware
	breakpoints.
	(s390_insert_hw_breakpoint, s390_remove_hw_breakpoint): New
	linux_nat target methods.
	(_initialize_s390_nat): Register them.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp: No longer skip hardware breakpoint tests on s390.
2016-09-16 19:25:55 +02:00
Andreas Arnez 0e00e962c5 linux-nat: Add function lwp_is_stepping
Add the function lwp_is_stepping which indicates whether the given LWP
is currently single-stepping.  This is a common interface, usable from
native GDB as well as from gdbserver.

gdb/gdbserver/ChangeLog:

	* linux-low.c (lwp_is_stepping): New function.

gdb/ChangeLog:

	* nat/linux-nat.h (lwp_is_stepping): New declaration.
	* linux-nat.c (lwp_is_stepping): New function.
2016-09-16 19:25:55 +02:00
Andreas Arnez 169fe0df15 S390: Enable "maint set show-debug-regs"
Implement a new function for dumping the S390 "debug
registers" (actually, the PER info) and invoke it at appropriate places.
Respect the variable show_debug_regs and make it settable by the user.

gdb/ChangeLog:

	* s390-linux-nat.c (gdbcmd.h): New include.
	(s390_show_debug_regs): New function.
	(s390_stopped_by_watchpoint): Call it, if show_debug_regs is set.
	(s390_prepare_to_resume): Likewise.
	(_initialize_s390_nat): Register the command "maint set
	show-debug-regs".
2016-09-16 19:25:55 +02:00
Andreas Arnez 373c3dad74 S390: Multi-inferior watchpoint support
Support different sets of watchpoints in multiple inferiors.

gdb/ChangeLog:

	* s390-linux-nat.c (watch_areas): Remove variable.  Replace by a
	member of...
	(struct s390_debug_reg_state): ...this.  New struct.
	(struct s390_process_info): New struct.
	(s390_process_list): New variable.
	(s390_find_process_pid, s390_add_process, s390_process_info_get)
	(s390_get_debug_reg_state): New functions.
	(s390_stopped_by_watchpoint): Now access the watch_areas VEC via
	s390_get_debug_reg_state.
	(s390_prepare_to_resume): Likewise.
	(s390_insert_watchpoint): Likewise.
	(s390_remove_watchpoint): Likewise.
	(s390_forget_process, s390_linux_new_fork): New linux_nat target
	methods.
	(_initialize_s390_nat): Register them.
2016-09-16 19:25:54 +02:00
Andreas Arnez 17c84ccaf0 S390: Migrate watch areas from list to VEC type
For S390, the list of active watchpoints is maintained in a list based
at "watch_base".  This refactors the list to a vector "watch_areas".

gdb/ChangeLog:

	* s390-linux-nat.c (s390_watch_area): New typedef.  Define a VEC.
	(watch_base): Remove variable.
	(watch_areas): New variable.
	(s390_stopped_by_watchpoint): Transform operations on the
	watch_base list to equivalent operations on the watch_areas VEC.
	(s390_prepare_to_resume): Likewise.
	(s390_insert_watchpoint): Likewise.
	(s390_remove_watchpoint): Likewise.
2016-09-16 19:25:54 +02:00
Andreas Arnez 9c2996c982 S390: Avoid direct access to lwp_info structure
When using the lwp_info structure, avoid accessing its members directly,
and use the advertised function interfaces instead.  This is according
to the instructions in linux-nat.h and prepares for making some of the
code common between gdb and gdbserver.

gdb/ChangeLog:

	* s390-linux-nat.c (s390_prepare_to_resume): Use advertised lwp
	functions instead of accessing lwp_info structure members.
	(s390_mark_per_info_changed): New function.
	(s390_new_thread): Use it.
	(s390_refresh_per_info_cb): New function.
	(s390_refresh_per_info): Remove parameter.  Refresh all lwps of
	the current process.
	(s390_insert_watchpoint): Adjust call to s390_refresh_per_info.
	(s390_remove_watchpoint): Likewise.
2016-09-16 19:25:54 +02:00
Jan Kratochvil d41a5c096e testsuite: Fix false FAIL in gdb.cp/casts.exp
gcc-6.2.1-1.fc26.x86_64

gdb compile failed, /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:40:10: error: expected primary-expression before 'int'
 decltype(int x)
          ^~~
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:40:10: error: expected ')' before 'int'
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:40:1: error: expected unqualified-id before 'decltype'
 decltype(int x)
 ^~~~~~~~
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc: In function 'int main(int, char**)':
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:59:14: error: expected primary-expression before 'decltype'
   double y = decltype(2);
              ^~~~~~~~

'decltype' is a registered keyword since C++11 which is now a default for GCC.

On Thu, 15 Sep 2016 14:06:56 +0200, Pedro Alves wrote:

Seems to be exercising the FLAG_SHADOW bits:

...
    {"__typeof__", TYPEOF, OP_TYPEOF, 0 },
    {"__typeof", TYPEOF, OP_TYPEOF, 0 },
    {"typeof", TYPEOF, OP_TYPEOF, FLAG_SHADOW },
    {"__decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX },
    {"decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX | FLAG_SHADOW },
...

/* This is used to associate some attributes with a token.  */

enum token_flag
{
...
  /* If this bit is set, the token is conditional: if there is a
     symbol of the same name, then the token is a symbol; otherwise,
     the token is a keyword.  */

  FLAG_SHADOW = 2
};

So perhaps a better fix is to move that particular test to a
separate testcase that force-compiles with -std=c++03.

gdb/testsuite/ChangeLog
2016-09-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.cp/casts.cc (decltype): Move it ...
	(main): ... with its call to ...
	* gdb.cp/casts03.cc: ... a new file.
	* gdb.cp/casts.exp: Add new file casts03.cc, move decltype test to it.
2016-09-16 19:23:22 +02:00
Claudiu Zissulescu f807f43d7e [ARC] Disassemble correctly extension instructions.
For each MAJOR-MINOR opcode tuple, we can have either a 3-operand, or
2-operand, or a single operand instruction format, depending on the
values present in i-field, and a-field.

The disassembler is reading the section containing the extension
instruction format and stores them in a table.  Each table element
represents a linked list with encodings for a particular MAJOR-MINOR
tuple.

The current implementation checks only against the first element of
the list, hence, the issue.

This patch is walking the linked list until empty or finds an opcode
match.  It also adds a test outlining the found problem.

opcodes/
2016-09-15  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-dis.c (find_format): Walk the linked list pointed by einsn.

gas/
2016-09-15  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/textinsnxop.d: New file.
	* testsuite/gas/arc/textinsnxop.s: Likewise.
2016-09-16 14:49:33 +02:00
GDB Administrator 0a0df90827 Automatic date update in version.in 2016-09-16 00:00:18 +00:00
Jan Kratochvil d2dfe70034 testsuite: Fix C++11 compilation failure for gdb.cp/m-static.exp
gcc-6.2.1-1.fc26.x86_64

g++ -std=c++03:
no warnings

g++:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:0:
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:34: error: ‘constexpr’ needed for in-class initialization of static
data member ‘const float gnu_obj_4::somewhere’ of non-integral type [-fpermissive]
   static const float somewhere = 3.14159;
                                  ^~~~~~~

clang++:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: warning: in-class initializer for static data member of type 'const
float' is a GNU extension [-Wgnu-static-float-init]
  static const float somewhere = 3.14159;
                     ^           ~~~~~~~
1 warning generated.

clang++ -std=c++11:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: error: in-class initializer for static data member of type 'const
float' requires 'constexpr' specifier [-Wstatic-float-init]
  static const float somewhere = 3.14159;
                     ^           ~~~~~~~
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:3: note: add 'constexpr'
  static const float somewhere = 3.14159;
  ^
  constexpr
1 error generated.

OK for check-in?

After the fix out of the 4 combinations above only this one remains non-empty:

clang++:
In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:
/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: warning: in-class initializer for static data member of type 'const
float' is a GNU extension [-Wgnu-static-float-init]
  static const float somewhere = 3.14159;
                     ^           ~~~~~~~
1 warning generated.

On Thu, 15 Sep 2016 15:10:50 +0200, Pedro Alves wrote:

Hmm, OK, now that I read the test, I think you were right in trying to
keep it safe, actually.  The .exp file has:

if { $non_dwarf } { setup_xfail *-*-* }
gdb_test "print test4.everywhere" "\\$\[0-9\].* = 317" "static const int initialized in class definition"
if { $non_dwarf } { setup_xfail *-*-* }
gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const float initialized in class definition"
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Added by this:

 https://sourceware.org/bugzilla/show_bug.cgi?id=11702
 https://sourceware.org/ml/gdb-patches/2010-06/msg00677.html
 https://sourceware.org/ml/gdb-patches/2010-06/txt00011.txt

So the new patch would make that highlighted tested above not
test what its test message says it is testing.

So I now think your original patch is better.  Please push
that one instead.

gdb/testsuite/ChangeLog
2016-09-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.cp/m-static.h (gnu_obj_4::somewhere): Use constexpr for C++11.
2016-09-15 23:45:11 +02:00
Peter Bergner e2a92b1649 Update ISA 3.0 / POWER9 gdb tests to match GAS test cases.
* gdb.arch/powerpc-power.s: Update Power9 instruction tests
	and sync up the test with tests in gas/testsuite/gas/ppc.
	* gdb.arch/powerpc-power.exp: Likewise.
2016-09-15 16:10:05 -05:00
Jan Kratochvil 49b4de6424 testsuite: Disable ccache
There were always various problems with compatibility with ccache:
	https://bugzilla.redhat.com/show_bug.cgi?id=488863
	https://bugzilla.redhat.com/show_bug.cgi?id=759592
	https://sourceware.org/ml/gdb-patches/2009-02/msg00397.html

IMO in a summary ccache finds more a benefit of faster compilation despite the
debug info is no longer exactly the same (as without ccache).

Although for example in this case ccache helped to find a real GDB bug:
	https://sourceware.org/ml/gdb-patches/2015-01/msg00497.html

For the GDB testcases ccache has (IMO) no real performance advantage and it
just brings heisenbugs - false FAILs - from time to time:

Breakpoint 1, main () at gdb/testsuite/gdb.base/vdso-warning.c:21^M
	21        return 0;^M
	(gdb) PASS: gdb.base/vdso-warning.exp: run: startup
	->
	Breakpoint 1, main () at gdb/testsuite/gdb.base/hbreak-unmapped.c:21^M
	21        return 0;^M
	(gdb) FAIL: gdb.base/vdso-warning.exp: run: startup

So I find most safe and easy to just disable ccache for all testsuites.

gdb/testsuite/ChangeLog
2016-09-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* lib/future.exp: Set CCACHE_DISABLE, clear CCACHE_NODISABLE.
2016-09-15 14:06:11 +02:00
Jose E. Marchesi d7cd93a718 gas: run the sparc test dcti-couples-v9 only in ELF targets.
gas/ChangeLog:

2016-09-15  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* testsuite/gas/sparc/sparc.exp (gas_64_check): Run
	dcti-couples-v9 only in ELF targets to avoid spurious failures in
	sparc-aout and sparc-coff targets.
2016-09-15 12:20:54 +02:00
Ed Maste fb324ee93a Fix typo in readelf error message.
* readelf.c (process_mips_specific): Fix typo in error message.
2016-09-15 10:42:08 +01:00
Peter Bergner fd486b633e Modify POWER9 support to match final ISA 3.0 documentation.
opcodes/
	* ppc-opc.c (powerpc_opcodes) <slbiag>: New mnemonic.
	<addex., brd, brh, brw, lwzmx, nandxor, rldixor, setbool,
	xor3>: Delete mnemonics.
	<cp_abort>: Rename mnemonic from ...
	<cpabort>: ...to this.
	<setb>: Change to a X form instruction.
	<sync>: Change to 1 operand form.
	<copy>: Delete mnemonic.
	<copy_first>: Rename mnemonic from ...
	<copy>: ...to this.
	<paste, paste.>: Delete mnemonics.
	<paste_last>: Rename mnemonic from ...
	<paste.>: ...to this.

gas/
	* testsuite/gas/ppc/power9.d <slbiag, cpabort> New tests.
	<addex., brd, brh, brw, lwzmx, nandxor, rldixor, setbool,
	xor3, cp_abort, copy_first, paste, paste_last, sync>: Remove tests.
	<copy, paste.>: Update tests.
	* testsuite/gas/ppc/power9.s: Likewise.
2016-09-14 22:10:51 -05:00
GDB Administrator b82c1d9741 Automatic date update in version.in 2016-09-15 00:00:19 +00:00
Thomas Preud'homme 4f90d84b2f Fix ld --gc-section segfault with ARMv8-M entry function in absolute section
bfd/
2016-09-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* elf32-arm.c (elf32_arm_gc_mark_extra_sections): Only mark section
	not already marked.

ld/
2016-09-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* testsuite/ld-arm/cmse-veneers.s: Add a test for ARMv8-M Security
	Extensions entry functions in absolute section.
	* testsuite/ld-arm/cmse-veneers.rd: Adapt expected output accordingly.
2016-09-14 16:03:43 +01:00
Nick Clifton e6d042fe27 Fix seg-fault in objdump when run on a fuzzed PE binary.
PR binutils/20605
	* peicode.h (pe_bfd_read_buildid): Check that the Data Directory
	contains a valid size for the Debug directory.
2016-09-14 15:32:01 +01:00
Jose E. Marchesi fc7514d6f2 gas: improve architecture mismatch diagnostics in sparc
Merely dumping the mnemonic name in "architecture mismatch" errors may
not provide enough information to determine what went wrong, as the same
mnemonic can be used for different variants of an instruction pertaining
to different architecture levels.

This little patch makes the assembler to include the instruction
arguments in the error message.

gas/ChangeLog:

2016-09-14  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (sparc_ip): Print the instruction arguments
	in "architecture mismatch" error messages.
2016-09-14 07:15:24 -07:00
Jose E. Marchesi 46a2d504dd gas: detect DCTI couples in sparc
Before SPARC V9 the effect of having a delayed branch instruction in the
delay slot of a conditional delayed branch was undefined.

In SPARC V9 DCTI couples are well defined.

However, starting with the UltraSPARC Architecture 2005, DCTI
couples (of all kind) are deprecated and should not be used, as they may
be slow or behave differently to what the programmer expects.

This patch adds a new command line option --dcti-couples-detect to `as',
disabled by default, that makes the assembler to warn the user if an
unpredictable DCTI couple is found.  Tests and documentation are
included.

gas/ChangeLog:

2016-09-14  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (md_assemble): Detect and warning on
	unpredictable DCTI couples in certain arches.
	(dcti_couples_detect): New global.
	(md_longopts): Add command line option -dcti-couples-detect.
	(md_show_usage): Document -dcti-couples-detect.
	(md_parse_option): Handle OPTION_DCTI_COUPLES_DETECT.
	* testsuite/gas/sparc/sparc.exp (gas_64_check): Run
	dcti-couples-v8, dcti-couples-v9 and dcti-couples-v9c tests.
	* testsuite/gas/sparc/dcti-couples.s: New file.
	* testsuite/gas/sparc/dcti-couples-v9c.d: Likewise.
	* testsuite/gas/sparc/dcti-couples-v8.d: Likewise.
	* testsuite/gas/sparc/dcti-couples-v9.d: Likewise.
	* testsuite/gas/sparc/dcti-couples-v9c.l: Likewise.
	* testsuite/gas/sparc/dcti-couples-v8.l: Likewise.
	* doc/as.texinfo (Overview): Document --dcti-couples-detect.
	* doc/c-sparc.texi (Sparc-Opts): Likewise.
2016-09-14 07:10:49 -07:00
Bhushan Attarde 5d9bbb73c1 Prevent segfault in GDB when searching for architecture matches.
* format.c (struct bfd_preserve): New "build_id" field.
	(bfd_preserve_save): Save "build_id".
	(bfd_preserve_restore): Restore "build_id".
2016-09-14 13:49:16 +01:00
Claudiu Zissulescu 32348c581b [ARC] Fix parsing dtpoff relocation expression.
The assembler accepts dtpoff complex relocation expression like
identifier@dtpoff + const. However, it doesn't accept an expression such
as identifier@dtpoff@base + const. This patch solves this issue, and adds
a number of tests.

ld/
2016-09-14  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/ld-arc/tls-dtpoff.dd: New file.
	* testsuite/ld-arc/tls-dtpoff.rd: Likewise.
	* testsuite/ld-arc/tls-dtpoff.s: Likewise.
	* testsuite/ld-arc/tls-relocs.ld: Likewise.
	* testsuite/ld-arc/arc.exp: Add new tdpoff test.

gas/
2016-09-14  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/tls-relocs2.d: New file.
	* testsuite/gas/arc/tls-relocs2.s: Likewise.
	* config/tc-arc.c (tokenize_arguments): Accept offsets when base
	is used.
2016-09-14 14:04:34 +02:00
Anton Kolesov dce084426d Stop the ARC disassembler from seg-faulting if initialised without a BFD present.
* arc-dis.c (arc_get_disassembler): Accept a null bfd gracefully.
2016-09-14 12:20:13 +01:00
Nick Clifton 29063f8bfb Add support for disabling automatic generation of .eh_frame_hdr sections in ELF based linkers.
PR ld/20537
	* emultempl/elf32.em: More OPTION_xxx values into an enum.  Add
	OPTION_NO_EH_FRAME_HDR.
	(_add_options): Add support for --no-eh-frame-hdr.
	* ld.texinfo: Document new option.
	* lexsup.c (elf_shlib_list_options): List new option.
	* NEWS: Mention the new option.
2016-09-14 10:42:10 +01:00
GDB Administrator d68ff01f17 Automatic date update in version.in 2016-09-14 00:00:22 +00:00
Carl E. Love 1d8cb77dff Fix for gdb.server/non-existing-program.exp test case
The last commit was supposed to have the reference to ptrace () removed.
The patch didn't get updated correctly before the commit.  This commit
fixes the comment as requested

gdbserver/ChangeLog

	2016-09-06  Carl Love  <cel@us.ibm.com>

	* server.c (start_inferior):  Fixed comment, requested comment change
	didn't get updated correctly.  Removed reference to ptrace () call as
 	it is only true on Linux systems.
2016-09-13 09:58:18 -07:00
Carl E. Love 7313bced5b Fix for gdb.server/non-existing-program.exp test case
The test checks to make sure GDB exits cleanly if there is
no valid target binary.  Currently, ppc and S390 fail on this
test.  The function target_post_create_inferior () calls
linux_post_create_inferior () which calls the architecture
specific functions s390_arch_setup () and ppc_arch_setup ()
which make ptrace calls	to access the architecture specific
registers.  These ptrace calls fail because the	process	does
not exist causing GDB to exit on error.

This patch checks to see if the initial ptrace (PTRACE_TRACEME, ...)
call returned a status of TARGET_WAITKIND_EXITED indicating the
target has already exited.  If the target has exited, then the
target_post_create_inferior () is not called since there is no
inferior to be setup.  The test	to see if the initial ptrace
call succeeded is done after the ptrace (PTRACE_TRACEME, ...)
call and the wait for the inferior process to stop, assuming
it exists, has occurred.

The patch has been tested on X86 64-bit, ppc64 and s390.  If
fixes the test failures	on ppc64 and s390.  The	test does not
fail on	X86 64-bit.  The patch does not	introduce any additional
regression failures on any of these three platforms.

gdbserver/ChangeLog

2016-09-06  Carl Love  <cel@us.ibm.com>

	* server.c (start_inferior):  Do not call
	function target_post_create_inferior () if the
	inferior process has already exited.
2016-09-13 09:46:18 -07:00
GDB Administrator f83683d5e8 Automatic date update in version.in 2016-09-13 00:00:21 +00:00
Andreas Krebbel 952c3f51ac S/390: Add alternate processor names.
This patch adds alternate CPU names which adhere to the number of the
architecture document.  So instead of having z196, zEC12, and z13 you
can use arch9, arch10, and arch11.  The old cpu names stay valid and
should primarily be used.

The alternate names are supposed to improve compatibility with the IBM
XL compiler toolchain which uses the arch numbering.

opcodes/ChangeLog:

2016-09-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* s390-mkopc.c (main): Support alternate arch strings.

gas/ChangeLog:

2016-09-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c (s390_parse_cpu): Support alternate arch
	strings.
	* doc/as.texinfo: Document new arch strings.
	* doc/c-s390.texi: Likewise.
2016-09-12 16:32:02 +02:00
Andreas Krebbel 58af639728 S/390: Fix facility bit default.
gas/ChangeLog:

2016-09-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/tc-s390.c: Set all facitily bits by default
2016-09-12 16:32:02 +02:00
Patrick Steuer 8b71537b6b S/390: Fix kmctr instruction type.
opcodes/ChangeLog:

2016-09-12  Patrick Steuer  <steuer@linux.vnet.ibm.com>

	* s390-opc.txt: Fix kmctr instruction type.

gas/ChangeLog:

2016-09-12  Patrick Steuer  <steuer@linux.vnet.ibm.com>

	* testsuite/gas/s390/zarch-z196.d: Adjust testcase.
2016-09-12 16:32:02 +02:00
Sergio Durigan Junior 2c29df25b7 Fix false FAIL on gdb.base/stap-probe.exp, due to ICF optimization
GCC 6's ICF optimization pass is making the declaration of 'm1' and
'm2', on gdb.base/stap-probe.c, to be unified.  However, this leads to
only one instance of the probe 'two' being created, which causes a
failure on the testsuite (which expects a multi-location breakpoint to
be inserted on the probe).

This patch fixes this failure by declaring a dummy variable on 'm1',
and using it as an argument to m1's version of probe 'two'.  Since we
do not care about the contents of the functions nor about the
arguments of each probe 'two', this is OK.

gdb/testsuite/ChangeLog:
2016-09-11  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to
	make m1's definition to be different from m2's.  Use 'dummy' as an
	argument for probe 'two'.
2016-09-12 00:19:22 -04:00
GDB Administrator 12ec45de8f Automatic date update in version.in 2016-09-12 00:00:22 +00:00
GDB Administrator 6097c91e1c Automatic date update in version.in 2016-09-11 00:00:22 +00:00
Jon Beniston cc3c284619 Use target_sim_options for sim target.
2016-09-10  Jon Beniston  <jon@beniston.com>

	* lib/mi-support.exp (mi_gdb_target_load): Use target_sim_options
	for sim target.
2016-09-10 21:38:47 +01:00
GDB Administrator 855dde8e78 Automatic date update in version.in 2016-09-10 00:00:21 +00:00
Andreas Arnez e1b2624a08 Pass HWCAP to ifunc resolver
On various GNU Elf architectures, including AArch64, ARM, s390/s390x,
ppc32/64, and sparc32/64, the dynamic loader passes HWCAP as a parameter
to each ifunc resolver.  Currently there is an open glibc Bugzilla that
requests this to be generalized to all architectures:

  https://sourceware.org/bugzilla/show_bug.cgi?id=19766

And various ifunc resolvers already rely on receiving HWCAP.  Currently
GDB always calls an ifunc resolver without any arguments; thus the
resolver may receive garbage, and based on that, the resolver may decide
to return a function that is not suited for the given platform.

This patch always passes HWCAP to ifunc resolvers, even on systems where
the dynamic loader currently behaves otherwise.  The rationale is
that (1) the dynamic loader may get adjusted on those systems as well in
the future; (2) passing an unused argument should not cause a problem
with existing resolvers; and (3) the logic is much simpler without such
a distinction.

gdb/ChangeLog:

	* elfread.c (auxv.h): New include.
	(elf_gnu_ifunc_resolve_addr): Pass HWCAP to ifunc resolver.

gdb/testsuite/ChangeLog:

	* gdb.base/gnu-ifunc-lib.c (resolver_hwcap): New external
	variable declaration.
	(gnu_ifunc): Add parameter hwcap.  Store it in resolver_hwcap.
	* gdb.base/gnu-ifunc.c (resolver_hwcap): New global variable.
	* gdb.base/gnu-ifunc.exp: Add test to verify that the resolver
	received HWCAP as its argument.
2016-09-09 19:59:53 +02:00
GDB Administrator 3569342c14 Automatic date update in version.in 2016-09-09 00:00:22 +00:00
Tom Tromey f5c4fcd971 Remove some unneeded casts from remote.c
I happened to notice a few unneeded casts in remote.c.  In some cases
these are no-ops, and in others these cast away const, but in a context
where this is not needed.

I'm checking this in under the obvious rule.
Tested by rebuilding on x86-64 Fedora 24.

2016-09-08  Tom Tromey  <tom@tromey.com>

	* remote.c (remote_notif_stop_ack, remote_wait_as)
	(show_remote_cmd): Remove unneeded casts.
2016-09-08 09:50:28 -06:00
H.J. Lu 8d471ec1e7 Allow PROCESSOR_IAMCU for Intel MCU
* config/tc-i386.c (i386_target_format): Allow PROCESSOR_IAMCU
	for Intel MCU.
2016-09-08 07:54:16 -07:00
GDB Administrator a46c43f40a Automatic date update in version.in 2016-09-08 00:00:20 +00:00
H.J. Lu 5b64d091e9 X86: Allow additional ISAs for IAMCU in assembler
Originally only Pentium integer instructions are allowed for IAMCU.
This patch removes such a restriction.  For example, 387 and SSE2
instructions can be enabled by passing "-march=iamcu+sse2+387" to
assembler.

gas/

	* config/tc-i386.c (valid_iamcu_cpu_flags): Removed.
	(set_cpu_arch): Updated.
	(md_parse_option): Likewise.
	* testsuite/gas/i386/i386.exp: Run iamcu-4 and iamcu-5.  Remove
	iamcu-inval-2 and iamcu-inval-3.
	* testsuite/gas/i386/iamcu-4.d: New file.
	* testsuite/gas/i386/iamcu-4.s: Likewise.
	* testsuite/gas/i386/iamcu-5.d: Likewise.
	* testsuite/gas/i386/iamcu-5.s: Likewise.
	* testsuite/gas/i386/iamcu-inval-2.l: Removed.
	* testsuite/gas/i386/iamcu-inval-2.s: Likewise.
	* testsuite/gas/i386/iamcu-inval-3.l: Likewise.
	* testsuite/gas/i386/iamcu-inval-3.s: Likewise.

opcodes/

	* i386-gen.c (cpu_flag_init): Remove CPU_IAMCU_COMPAT_FLAGS.
	* i386-init.h: Regenerated.
2016-09-07 09:22:19 -07:00
Richard Earnshaw 27e5a27096 [arm] Automatically enable CRC instructions on supported ARMv8-A CPUs.
2016-09-07  Richard Earnshaw  <rearnsha@arm.com>

	* opcode/arm.h (ARM_ARCH_V8A_CRC): New architecture.

2016-09-07  Richard Earnshaw  <rearnsha@arm.com>

	* config/tc-arm.c ((arm_cpus): Use ARM_ARCH_V8A_CRC for all
	ARMv8-A CPUs except xgene1.
2016-09-07 17:14:54 +01:00