Commit Graph

85257 Commits

Author SHA1 Message Date
David Edelsohn 33f914a197 Recognize a few more AIX XCOFF DWARF sections.
gdb/ChangeLog:

        * xcoffread.c (dwarf2_xcoff_names): Add .dwmac and .dwpbtyp.
2015-10-13 18:45:38 -04:00
Pedro Alves e6a959d68b More char constification
Trivial constifications flagged by G++.  E.g.:

 src/gdb/c-varobj.c: In function ‘void c_describe_child(const varobj*, int, char**, value**, type**, char**)’:
 src/gdb/c-varobj.c:373:33: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
    char *join = was_ptr ? "->" : ".";
				  ^

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_enum_name): Constify local.
	* ada-typeprint.c (print_range_bound): Constify locals.
	* c-varobj.c (c_describe_child): Likewise.
	* cli/cli-setshow.c (do_set_command): Likewise.
	* gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
	* dwarf2read.c (find_file_and_directory): Likewise.
	(anonymous_struct_prefix, dwarf2_name): Likewise.
	* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
	* go-lang.c (unpack_mangled_go_symbol): Likewise.
	* jv-typeprint.c (java_type_print_base): Likewise.
	* ser-tcp.c (net_open): Likewise.
	* symfile.c (deduce_language_from_filename): Likewise.
	* symtab.c (gdb_mangle_name): Likewise.
	* tui/tui-io.c (tui_redisplay_readline): Likewise.
2015-10-13 19:40:50 +01:00
Pedro Alves 170742de5d Fix execution_direction's type
This fixes a few build errors like these in C++ mode:

  src/gdb/reverse.c: In function ‘void exec_reverse_once(char*, char*, int)’:
  src/gdb/reverse.c:49:34: error: invalid conversion from ‘int’ to ‘exec_direction_kind’ [-fpermissive]
     enum exec_direction_kind dir = execution_direction;
				    ^
  make: *** [reverse.o] Error 1

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

	* infrun.c (restore_execution_direction): New function.
	(fetch_inferior_event): Use it instead of
	make_cleanup_restore_integer.
	(execution_direction): Change type to enum
	exec_direction_kind.
	* infrun.h (execution_direction): Likewise.
2015-10-13 19:40:50 +01:00
Pedro Alves bfb1c7963b ada-lang.c:ada_value_primitive_packed_val: const correctness
gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_value_primitive_packed_val): Constify
	locals.  Use value_contents_writeable.  Remove casts.
2015-10-13 19:40:50 +01:00
Pedro Alves aa5c10ce9b ada-lang.c: malloc/alloca casts for C++
gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_value_primitive_packed_val): Add casts to malloc
	and alloca calls.
2015-10-13 19:40:50 +01:00
Simon Marchi 4666fec3b4 lm32: Replace call to write_memory with write_memory_unsigned_integer
Fixes this error:

/home/emaisin/src/binutils-gdb/gdb/lm32-tdep.c: In function ‘CORE_ADDR lm32_push_dummy_call(gdbarch*, value*, regcache*, CORE_ADDR, int, value**, CORE_ADDR, int, CORE_ADDR)’:
/home/emaisin/src/binutils-gdb/gdb/lm32-tdep.c:292:59: error: invalid conversion from ‘void*’ to ‘const gdb_byte* {aka const unsigned char*}’ [-fpermissive]
    write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type));
                                                           ^
In file included from /home/emaisin/src/binutils-gdb/gdb/lm32-tdep.c:29:0:
/home/emaisin/src/binutils-gdb/gdb/gdbcore.h:107:13: error:   initializing argument 2 of ‘void write_memory(CORE_ADDR, const gdb_byte*, ssize_t)’ [-fpermissive]
 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
             ^

gdb/ChangeLog:

	* lm32-tdep.c (lm32_push_dummy_call): Replace call to
	write_memory with write_memory_unsigned_integer.
2015-10-13 13:37:13 -04:00
Simon Marchi 3953f15ce4 Constify arguments of gdb_bfd_lookup_symbol and related functions
Fixes this error:

/home/pedro/gdb/mygit/src/gdb/solib-frv.c: In function ‘int enable_break2()’:
/home/pedro/gdb/mygit/src/gdb/solib-frv.c:622:72: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
       addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");
                                                                        ^
In file included from /home/pedro/gdb/mygit/src/gdb/solib-frv.c:23:0:
/home/pedro/gdb/mygit/src/gdb/solib.h:82:18: error:   initializing argument 3 of ‘CORE_ADDR gdb_bfd_lookup_symbol(bfd*, int (*)(asymbol*, void*), void*)’ [-fpermissive]
 extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
                  ^

The call in question is:

      addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");

gdb/ChangeLog:

	* solib-dsbt.c (cmp_name): Constify arguments.
	* solib-frv.c (cmp_name): Likewise.
	* solib-svr4.c (svr4_create_solib_event_breakpoints): Likewise.
	* solib.c (gdb_bfd_lookup_symbol_from_symtab): Likewise.
	(bfd_lookup_symbol_from_dyn_symtab): Likewise.
	(gdb_bfd_lookup_symbol): Likewise.
	* solib.h (gdb_bfd_lookup_symbol): Likewise.
	(gdb_bfd_lookup_symbol_from_symtab): Likewise.
2015-10-13 12:42:35 -04:00
H.J. Lu 01f573ad8a Add EM_IAMCU support to gold
elfcpp/

	PR gold/19118
	* elfcpp.h (EM): Add EM_IAMCU.

gold/

	PR gold/19118
	* i386.cc (Target_iamcu): New class.
	(Target_selector_iamcu): Likewise.
	(Target_iamcu::iamcu_info): New variable.
	(target_selector_iamcu): Likewise.
2015-10-13 09:02:41 -07:00
Nick Clifton 8f33e7daaf Updated Chinese translation for the linker.
* po/zh_TW.po: Updated Chinese translation.
2015-10-13 14:32:44 +01:00
Alan Modra 341b8ee719 Tidy code setting PT_GNU_RELRO p_flags
No functional changes here.

	* elf.c (_bfd_elf_map_sections_to_segments): Don't set
	PT_GNU_RELRO p_flags.
	(assign_file_positions_for_non_load_sections): Set PT_GNU_RELRO
	flags to PF_R here.
2015-10-13 16:23:13 +10:30
James Bowman 8173c2a3c4 sim: ft32: test coverage for link parameters and PM write port
Adds test coverage for recent features.
2015-10-12 20:23:26 -04:00
GDB Administrator cb781f0412 Automatic date update in version.in 2015-10-13 00:00:07 +00:00
Andrew Burgess a0d34a3956 gdb: Simplify parse_frame_specification.
Remove an unneeded parameter from parse_frame_specification, replace
with a fixed string within parse_frame_specification.  The message was
the same in every place that parse_frame_specification was used anyway.

gdb/ChangeLog:

	* stack.c (parse_frame_specification): Remove message parameter,
	replace with fixed string in function body, update function
	comment.
	(frame_info): Remove message to parse_frame_specification.
	(select_frame_command): Likewise.
2015-10-12 23:30:39 +02:00
Andrew Burgess edbbff4a22 gdb: Avoid unneeded calls to parse_frame_specification.
Within the stack command there are a couple of places where fixed
strings are passed into functions that are really intended for
processing user input.  These fixed strings are then processed and the
result returned.

Given that the input strings in these cases are fixed, and are always
"0", then the result will always be the same, the current frame.  By
switching to using get_current_frame instead the code can be simplified,
and the intention of the code is clearer.

gdb/ChangeLog:

	* stack.c (parse_frame_specification): Delete.
	(parse_frame_specification_1): Rename to
	parse_frame_specification.
	(frame_info): Use parse_frame_specification.
	(select_frame_command): Likewise.
	(return_command): Use select_frame and print_stack_frame rather
	than frame_command and select_frame_command.
	(func_command): Use get_current_frame rather than
	parse_frame_specification.
2015-10-12 23:30:10 +02:00
Andrew Burgess 9d622bda56 gdb: Fix bug with dbx style func command.
The func command, available when starting gdb in dbx mode, is supposed
to take a function name and locate the frame for that function in the
stack.  This has been broken for a while due to an invalid check of the
arguments within the worker function.  Fixed in this commit.

gdb/ChangeLog:

	* stack.c (func_command): Return early when there is no ARG
	string.

gdb/testsuite/ChangeLog:

	* gdb.base/dbx.exp (test_func): Remove xfails, update expected
	results.
2015-10-12 23:29:43 +02:00
Andrew Burgess fc58fa65d4 gdb/doc: Restructure frame command documentation.
The 'frame' command is documented in two places.  The 'select-frame'
command is only mentioned in one of these places.

Of the two places, having the description of 'frame' and 'select-frame'
in the section 'Selecting a Frame' seems like the most obvious choice,
which is where things like 'up' and 'down' are also documented.

This commit moves the documentation of 'frame' and 'select-frame' into
the 'Selecting a Frame' section, and removes the duplicate documentation
of the 'frame' command.

At the same time I have reordered the sections in the 'Examining the
Stack' chapter, moving the discussion of frame filters to the end of the
chapter; it feels odd that we talk about frame filters before such basic
things like navigating the stack, or examining stack frames in general.

gdb/doc/ChangeLog:

	* gdb.texinfo (Frames): Remove 'frame' and 'select-frame'
	description.
	(Frame Filter Management): Move to later in the 'Examining the
	Stack' chapter.
	(Selection): Add entry for 'select-frame'.
2015-10-12 23:28:58 +02:00
Andrew Burgess 8d3fea161a gdb: Make use of safe-ctype.h header.
In stack.c switch to using safe-ctype.h instead of ctype.h, update code
as required.

gdb/ChangeLog:

	* stack.c: Include safe-ctype.h not ctype.h.
	(parse_frame_specification): Use ISSPACE not isspace.
	(backtrace_command): Use TOLOWER not tolower.
2015-10-12 23:28:24 +02:00
Simon Marchi f54b226fb0 mep: Add cast for int to enum conversion
Taken directly from Pedro's branch.

gdb/ChangeLog:

	* mep-tdep.c (current_me_module): Add cast.
	(mep_gdbarch_init): Likewise.
2015-10-12 12:43:23 -04:00
Simon Marchi 6da660c76d m32c: Split m32c_move_reg_t in read/write variants
This allows to avoid casting away the const qualification in
m32c_pseudo_register_write (which is the entry points for all other
register read/write functions).

Also, use gdb_byte* instead of void* to avoid casts when calling gdb
common memory functions.  It also allows to remove those "For adderss
arithmetic" local variables.

gdb/ChangeLog:

	* m32c-tdep.c (m32c_move_reg_t): Replace with...
	(m32c_write_reg_t): ...this and...
	(m32c_read_reg_t): ...this.
	(struct m32c_reg): Update types of read and write.
	(m32c_raw_read): Change declaration type to m32c_read_reg_t and
	adjust definition.
	(m32c_banked_read): Likewise.
	(m32c_sb_read): Likewise.
	(m32c_part_read): Likewise.
	(m32c_cat_read): Likewise.
	(m32c_r3r2r1r0_read): Likewise.
	(m32c_raw_write): Change declaration type to m32c_write_reg_t
	and adjust definition.
	(m32c_banked_write): Likewise.
	(m32c_sb_write): Likewise.
	(m32c_part_write): Likewise.
	(m32c_cat_write): Likewise.
	(m32c_r3r2r1r0_write): Likewise.
2015-10-12 12:39:40 -04:00
Simon Marchi 1f713e48f0 aarch64: Add cast for integer to enum cast
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c: In function ‘int aarch64_linux_syscall_record(regcache*, long unsigned int)’:
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:904:57: error: invalid conversion from ‘long unsigned int’ to ‘aarch64_syscall’ [-fpermissive]
   syscall_gdb = aarch64_canonicalize_syscall (svc_number);
                                                         ^
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:645:1: note:   initializing argument 1 of ‘gdb_syscall aarch64_canonicalize_syscall(aarch64_syscall)’
 aarch64_canonicalize_syscall (enum aarch64_syscall syscall_number)
 ^

gdb/ChangeLog:

	* aarch64-linux-tdep.c (aarch64_linux_syscall_record): Add cast.
2015-10-12 12:24:38 -04:00
Simon Marchi cb65d272fd aarch64: Use gdb_sys_no_syscall enum instead of -1
Fixes:

/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c: In function "gdb_syscall aarch64_canonicalize_syscall(aarch64_syscall)":
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:874:13: error: invalid conversion from "int" to "gdb_syscall" [-fpermissive]
     return -1;
             ^

gdb/ChangeLog:

	* aarch64-linux-tdep.c (aarch64_canonicalize_syscall): Return
	gdb_sys_no_syscall instead of -1.
2015-10-12 12:24:37 -04:00
H.J. Lu 4373f8af3d Skip the unversioned definition after the default version
We may see an unversioned definition after the default version.  We
should skip the unversioned definition in this case.

bfd/

	PR ld/19073
	* elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned
	definition after the default version.

ld/testsuite/

	PR ld/19073
	* ld-elf/pr19073.map: New file.
	* ld-elf/pr19073.rd: Likewise.
	* ld-elf/pr19073.s: Likewise.
	* ld-elf/shared.exp (build_tests): Add tests for PR ld/19073.
2015-10-12 04:57:16 -07:00
Nick Clifton ede77e6963 Update list of known MSP430 MCU names.
* config/tc-msp430.c (msp430_mcu_names): Rename to
	msp430_mcu_data.  Add fields for the ISA and hardware multiply
	support.  Update with information from the latest devices.csv
	file.
	(md_parse_option): Make use of the new array.
2015-10-12 11:51:05 +01:00
Yao Qi eda14cf259 Mention the change in NEWS
gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* NEWS: Mention the change.
2015-10-12 11:28:39 +01:00
Yao Qi 1c2e1515c4 Rename emit_load_store to aarch64_emit_load_store
Likewise, this patch renames emit_load_store to
aarch64_emit_load_store.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* arch/aarch64-insn.c (emit_load_store): Rename to ...
	(aarch64_emit_load_store): ... it.  All callers updated.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c: Update all callers as emit_load_store
	is renamed to aarch64_emit_load_store.
2015-10-12 11:28:39 +01:00
Yao Qi e1c587c312 Rename emit_insn to aarch64_emit_insn
As emit_insn becomes extern, the prefix "aarch64_" is needed.  This
patch renames emit_insn to aarch64_emit_insn.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* arch/aarch64-insn.c (emit_insn): Rename to ...
	(aarch64_emit_insn): ... it.  All callers updated.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c: Update all callers of function renaming
	from emit_insn to aarch64_emit_insn.
2015-10-12 11:28:39 +01:00
Yao Qi 0fd8ac1c45 New test case gdb.arch/disp-step-insn-reloc.exp
This patch adds a new test case which uses gdb.arch/insn-reloc.c too
to test displaced stepping.  Nowadays, tests are for x86, x86_64 and
aarch64.

gdb/testsuite:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* gdb.arch/disp-step-insn-reloc.exp: New test case.
2015-10-12 11:28:38 +01:00
Yao Qi 34240514b5 Support displaced stepping in support_displaced_stepping for aarch64*-*-linux*
gdb/testsuite:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* lib/gdb.exp (support_displaced_stepping): Return 1 if target
	is aarch64*-*-linux*.
2015-10-12 11:28:38 +01:00
Yao Qi b6542f81d0 Support displaced stepping in aarch64-linux
This patch is to support displaced stepping in aarch64-linux.  A
visitor is implemented for displaced stepping, and used to record
information to fixup pc after displaced stepping if needed.  Some
emit_* functions are converted to macros, and moved to
arch/aarch64-insn.{c,h} so that they can be shared.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* aarch64-linux-tdep.c: Include arch-utils.h.
	(aarch64_linux_init_abi): Call set_gdbarch_max_insn_length,
	set_gdbarch_displaced_step_copy_insn,
	set_gdbarch_displaced_step_fixup,
	set_gdbarch_displaced_step_free_closure,
	set_gdbarch_displaced_step_location,
	and set_gdbarch_displaced_step_hw_singlestep.
	* aarch64-tdep.c (struct displaced_step_closure): New.
	(struct aarch64_displaced_step_data): New.
	(aarch64_displaced_step_b): New function.
	(aarch64_displaced_step_b_cond): Likewise.
	(aarch64_register): Likewise.
	(aarch64_displaced_step_cb): Likewise.
	(aarch64_displaced_step_tb): Likewise.
	(aarch64_displaced_step_adr): Likewise.
	(aarch64_displaced_step_ldr_literal): Likewise.
	(aarch64_displaced_step_others): Likewise.
	(aarch64_displaced_step_copy_insn): Likewise.
	(aarch64_displaced_step_fixup): Likewise.
	(aarch64_displaced_step_hw_singlestep): Likewise.
	* aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): New macro.
	(aarch64_displaced_step_copy_insn): Declare.
	(aarch64_displaced_step_fixup): Declare.
	(aarch64_displaced_step_hw_singlestep): Declare.
	* arch/aarch64-insn.c (emit_insn): Moved from
	gdbserver/linux-aarch64-low.c.
	(emit_load_store): Likewise.
	* arch/aarch64-insn.h (enum aarch64_opcodes): Moved from
	gdbserver/linux-aarch64-low.c.
	(struct aarch64_register): Likewise.
	(struct aarch64_memory_operand): Likewise.
	(ENCODE): Likewise.
	(can_encode_int32): New macro.
	(emit_b, emit_bcond, emit_cb, emit_ldr, emit_ldrsw): Likewise.
	(emit_tb, emit_nop): Likewise.
	(emit_insn): Declare.
	(emit_load_store): Declare.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c (enum aarch64_opcodes): Move to
	arch/aarch64-insn.h.
	(struct aarch64_memory_operand): Likewise.
	(ENCODE): Likewise.
	(emit_insn): Move to arch/aarch64-insn.c.
	(emit_b, emit_bcond, emit_cb, emit_tb): Remove.
	(emit_load_store): Move to arch/aarch64-insn.c.
	(emit_ldr, emit_ldrb, emit_ldrsw, emit_nop): Remove.
	(can_encode_int32): Remove.
2015-10-12 11:28:38 +01:00
Yao Qi 246994ce35 Move aarch64_relocate_instruction to arch/aarch64-insn.c
This patch moves aarch64_relocate_instruction and visitor class to
arch/aarch64-insn.c, so that both GDB and GDBserver can use it.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* arch/aarch64-insn.c (aarch64_decode_ldr_literal): Moved from
	gdbserver/linux-aarch64-low.c.
	(aarch64_relocate_instruction): Likewise.
	* arch/aarch64-insn.h (aarch64_decode_ldr_literal): Declare.
	(struct aarch64_insn_data): Moved from
	gdbserver/linux-aarch64-low.c.
	(struct aarch64_insn_visitor): Likewise.
	(aarch64_relocate_instruction): Declare.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c (extract_signed_bitfield): Remove.
	(aarch64_decode_ldr_literal): Move to gdb/arch/aarch64-insn.c.
	(aarch64_relocate_instruction): Likewise.
	(struct aarch64_insn_data): Move to gdb/arch/aarch64-insn.h.
	(struct aarch64_insn_visitor): Likewise.
2015-10-12 11:28:38 +01:00
Yao Qi 0badd99faf Use visitor in aarch64_relocate_instruction
Nowadays, the instruction decodings and handling are mixed together
inside aarch64_relocate_instruction.  The patch decouples instruction
decoding and instruction handling by using visitor pattern.  That is,
aarch64_relocate_instruction decode instructions and visit each
instruction by different visitor methods.  Each visitor defines the
concrete things to different instructions.  Fast tracepoint instruction
relocation and displaced stepping can define their own visitors,
sub-class of struct aarch64_insn_data.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c (struct aarch64_insn_data): New.
	(struct aarch64_insn_visitor): New.
	(struct aarch64_insn_relocation_data): New.
	(aarch64_ftrace_insn_reloc_b): New function.
	(aarch64_ftrace_insn_reloc_b_cond): Likewise.
	(aarch64_ftrace_insn_reloc_cb): Likewise.
	(aarch64_ftrace_insn_reloc_tb): Likewise.
	(aarch64_ftrace_insn_reloc_adr): Likewise.
	(aarch64_ftrace_insn_reloc_ldr_literal): Likewise.
	(aarch64_ftrace_insn_reloc_others): Likewise.
	(visitor): New.
	(aarch64_relocate_instruction): Use visitor.
2015-10-12 11:28:38 +01:00
Yao Qi dfaffe9d93 Move append_insns out of aarch64_relocate_instruction
aarch64_relocate_instruction should only decode instructions, and other
operations should be done out side of it.  This patch moves append_insns
out of aarch64_relocate_instruction, to its caller.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c (aarch64_relocate_instruction): Return
	int.  Add argument buf.
	(aarch64_install_fast_tracepoint_jump_pad): Pass buf to
	aarch64_relocate_instruction.
2015-10-12 11:28:38 +01:00
Yao Qi 70b439f0a8 Move target_read_uint32 out of aarch64_relocate_instruction
This patch is to move target_read_uint32 out of
aarch64_relocate_instruction and pass INSN to
aarch64_relocate_instruction, so that it is cleaner, only decode
instructions.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-low.c (aarch64_relocate_instruction): Add
	argument insn.  Remove local variable insn.  Don't call
	target_read_uint32.
	(aarch64_install_fast_tracepoint_jump_pad): Call
	target_read_uint32.
2015-10-12 11:28:38 +01:00
Yao Qi 8240f4421f More tests in gdb.arch/insn-reloc.c
This patch adds more tests in gdb.arch/insn-reloc.c to cover
instruction BL and cover B.CON when CON is false.  These new added
tests can be used for displaced stepping too.

gdb/testsuite:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

	* gdb.arch/insn-reloc.c (can_relocate_bcond): Rename to ...
	(can_relocate_bcond_true): ... it.
	(can_relocate_bcond_false): New function.
	(foo): Likewise.
	(can_relocate_bl): Likewise.
	(testcases) [__aarch64__]: Add can_relocate_bcond_false and
	can_relocate_bl.
2015-10-12 11:28:38 +01:00
Pierre-Marie de Rodat 2520f728b7 Forward VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT
Assume foo_array is a pointer to a C structure. GDB must evaluate the
following expression properly, but it does not currently:

    (gdb) print 1 && &foo_array[1].a
    Attempt to take address of value not located in memory.

The problem is that in EVAL_AVOID_SIDE_EFFECTS mode,
eval.c:evaluate_subexp_standard always returns a not_lval value as the
result for a STRUCTOP_STRUCT operation. As a consequence, the rest of
the code believes that one cannot take the address of the returned
value.

This patch fixes STRUCTOP_STRUCT handling so that the VALUE_LVAL
attribute for the returned value is properly initialized.  After this
change, the above session becomes:

    (gdb) print 1 && &foo_array[1].a
    $1 = 1

gdb/ChangeLog:

	* eval.c (evaluate_subexp_standard) <STRUCTOP_STRUCT>: If
	EVAL_AVOID_SIDE_EFFECTS mode, forward the VALUE_LVAL attribute
	to the returned value.

gdb/testsuite/ChangeLog:

	* gdb.base/nested-addr.c: New file.
	* gdb.base/nested-addr.exp: New testcase.

Tested on x86_64-linux, no regression.
2015-10-12 12:22:10 +02:00
Andrew Burgess 431ff0756a avr: Fix bugs in org/align tracking.
This commit fixes a few issues in the mechanism for passing information
about ".org" and ".align" directives from the assembler to the linker,
used by the avr target.

In the original commit fdd410ac7a, there
were some mistakes when writing out information about ".align"
directives:
  - An align with fill does not write out its information correctly, the
    fill data overwrites the alignment data.
  - Each alignment directive is recorded at the location where the
    previous alignment directive should be recorded, the first alignment
    directive is discarded.

In commit 137c83d69f, the data produced by
objdump is not correct:
   - It's miss-aligned due to a missing whitespace.
   - The fill data for align with fill records is not displayed
     correctly.

All of the above issues are addressed in this commit, and the test is
improved to cover these cases.

binutils/ChangeLog:

	* od-elf32_avr.c (elf32_avr_dump_avr_prop): Fix printing of align
	specific data, fix formatting for align and org data.

gas/ChangeLog:

	* config/tc-avr.c (avr_output_property_record): Fix overwrite bug
	for align and fill records.
	(avr_handle_align): Record fill information for align frags.
	(create_record_for_frag): Add next frag assertion, use correct
	address for align records.

gas/testsuite/ChangeLog:

	* gas/avr/avr-prop-1.s: Use fill in some cases.
	* gas/avr/avr-prop-1.d: Update expected results.
2015-10-12 09:43:11 +01:00
Andreas Krebbel ef05be83b7 PR19083 S/390: Fix garbage collection of some GOT relocs.
bfd/ChangeLog:

2015-10-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	PR ld/19083
	* elf32-s390.c (elf_s390_gc_sweep_hook): Do not reduce got
	refcount for relocs not really requiring a got slot.
	* elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
2015-10-12 10:22:49 +02:00
GDB Administrator da76f7d33f Automatic date update in version.in 2015-10-12 00:00:08 +00:00
John David Anglin da6e19a926 Ignore references with relocs to discarded sections in .data.rel.ro.local on hppa-linux. 2015-10-11 19:08:54 -04:00
Mike Frysinger 7d8a636c9a sim: moxie: fix leakage in error path [BZ #18273]
Reported-by: dcb <dcb314@hotmail.com>
2015-10-11 03:56:22 -04:00
Mike Frysinger 3f946aa825 sim: bfin: handle negative left saturated shifts as ashifts [BZ #18407]
When handling left saturated ashifts with negative immediates, they
should be treated as right ashifts.  This matches hardware behavior.

Reported-by: Igor Rayak <igorr@gitatechnologies.com>
2015-10-11 03:42:09 -04:00
GDB Administrator 5fde150fed Automatic date update in version.in 2015-10-11 00:00:08 +00:00
Alan Modra d980077618 Bug 19113 - read.c stringer assertion
Fails due to signed char promotion.

	PR gas/19113
	* read.c (next_char_of_string): Mask char after escape.  Use
	CHAR_MASK rather than 0xff.
2015-10-10 10:51:20 +10:30
GDB Administrator bd4e004229 Automatic date update in version.in 2015-10-10 00:00:08 +00:00
Joel Brobecker 5b639deae1 [Ada] ada_unpack_from_contents: Error if target buffer not large enough
This adds a guard that the size of the "unpacked" buffer is large enough
to contain at least BIT_SIZE bits.  If not, report an error.  This is to
guard this routine from doing buffer overflows when called incorrectly.

gdb/ChangeLog:

        * ada-lang.c (ada_unpack_from_contents): Add guard that unpacked
        is large enough for BIT_SIZE.  Update function comment.
2015-10-09 14:33:57 -07:00
Joel Brobecker 0cafa88cc0 [Ada] Buffer overflow in ada_unpack_from_contents
This patch fixes a buffer overflow in ada_unpack_from_contents
caused by one of the previous commits. This happens when trying
to print the value of an array of variant records.

The overflow happens while trying to print one element of the array.
Because the size of each element in the array is variable, the array
has a DWARF byte_stride attribute, which makes us treat the array
as if it was packed. And during the extraction of each array element,
we try to unpack an object using the array's byte stride as the size,
into an element whose size is actually less than the stride.

This patch fixes the issue by overriding the byte-stride with
the actual element's length.

gdb/ChangeLog:

        * ada-lang.c (ada_value_primitive_packed_val): Move
        src_len variable to local block where used.  Override
        BIT_SIZE if bigger than size of resolved type.
2015-10-09 14:33:28 -07:00
Joel Brobecker 220475ed8b make is_scalar_type non-static and use it in ada-lang.c
Just a small cleanup, to avoid code duplication...

gdb/ChangeLog:

        * gdbtypes.h (is_scalar_type): Add extern declaration.
        * gdbtypes.c (is_scalar_type): Make non-static.
        * ada-lang.c (ada_value_primitive_packed_val): Use is_scalar_type
        to compute IS_SCALAR instead of doing it ourselves.
2015-10-09 14:32:23 -07:00
Joel Brobecker d0a9e81089 [Ada] Better handling of dynamic types in ada_value_primitive_packed_val
There is some partial handling for dynamic types in
ada_value_primitive_packed_val, but this support was added
in a fairly ad hoc way, and actually only covered the situation
where OBJ is not NULL and its contents had not been fetched yet.
In addition, even in the cases that it does cover, it doesn't make
much sense. In particular, it was adjusting BIT_SIZE and SRC_LEN,
which are properties of the data to be extracted _from_, based
on TYPE's length once resolved, which is a property of the data
we want to extract _to_.

This patch hopefully adjust this function to handle dynamic types
correctly, and in all cases. It does so by unpacking the data into
a temporary buffer in order to use that buffer to resolve the type.
And _then_ creates the resulting value from that resolved type.

gdb/ChangeLog:

        * ada-lang.c (ada_value_primitive_packed_val): Rework handling
        of case where TYPE is dynamic.
2015-10-09 14:30:38 -07:00
Joel Brobecker f93fca700f [Ada] split data unpacking code out of ada_value_primitive_packed_val.
This patch is just preparation work which splits the function
ada_value_primitive_packed_val into two function: one which unpacks
the data, and the other which now uses it to implement
ada_value_primitive_packed_val.

This simplifies a bit ada_value_primitive_packed_val, but will also
allow us to use the new function to unpack data without actually creating
a struct value as a result.

gdb/ChangeLog:

        * ada-lang.c (ada_unpack_from_contents): New function,
        extracted from ada_value_primitive_packed_val.
        (ada_value_primitive_packed_val): Replace extracted out code
        by call to ada_unpack_from_contents.
2015-10-09 14:30:06 -07:00
Joel Brobecker a1c95e6b6e Reorder variable declarations in ada_value_primitive_packed_val
This patch just changes the order in which local variables are declared
so as to group the logically-related variables together.  No code
change otherwise.

gdb/ChangeLog:

        * ada-lang.c (ada_value_primitive_packed_val): Reorder local
        variable declarations.
2015-10-09 14:28:50 -07:00