Commit Graph

81225 Commits

Author SHA1 Message Date
Doug Evans ded4fc8f9c ada-typeprint.c (print_range): Initialize lo,hi for gcc -Wall.
* ada-typeprint.c (print_range): Initialize lo,hi for gcc -Wall.
2014-08-18 10:04:18 -07:00
Nick Clifton 3ce3a066e1 This fixes the processing of BFD_RELOC_RL78_DIFF fixups when the size is less
than 4.  This affects DWARF debug info generation in particular.

	* config/tc-rl78.c (md_apply_fix): Correct handling of small sized
	RELOC_RL78_DIFF fixups.
2014-08-18 17:34:03 +01:00
Joel Brobecker 3c8c5dcc98 DW_AT_data_location and DW_OP_push_object_address testcase.
This testcase allows us to test the proper processing of both
DW_AT_data_location and DW_OP_push_object_address using a hand-crafted
testcase duplicating how we expect the Ada compiler to represent
unbounded arrays.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/data-loc.c, gdb.dwarf2/data-loc.exp: New files.
2014-08-18 18:14:14 +02:00
Joel Brobecker 950c97d860 [Ada] "ptype" of array where bound value uses DW_OP_push_object_address
Consider an Ada array type where the DWARF debugging info for
at least one of the bounds involves an expression containing
a DW_OP_push_object_address operation. Trying to "ptype" that
type currently yields:

    (gdb) ptype foo.array_type
    type = array (Location address is not set.

This patch improves ada-typeprint by adding handling of the situation
where an array range type has dynamic bounds.  In that case, it prints
the array bounds using Ada's typical syntax for unbounded ranges "<>":

    (gdb) ptype array_type
    type = array (<>) of integer

gdb/ChangeLog:

        * ada-typeprint.c (type_is_full_subrange_of_target_type):
        Return 0 if TYPE is dynamic.
        (print_range): Add handling of dynamic ranges.
2014-08-18 18:13:29 +02:00
Joel Brobecker 3cdcd0ce16 Add support for DW_AT_data_location.
gdb/ChangeLog:

        * gdbtypes.h (struct main_type): Add field "data_location".
        (TYPE_DATA_LOCATION, TYPE_DATA_LOCATION_BATON)
        (TYPE_DATA_LOCATION_ADDR, TYPE_DATA_LOCATION_KIND): New macros.
        * gdbtypes.c (is_dynamic_type): Return 1 if the type has
        a dynamic data location.
        (resolve_dynamic_type): Add DW_AT_data_location handling.
        (copy_recursive, copy_type): Copy the data_location information
        when present.
        * dwarf2read.c (set_die_type): Add DW_AT_data_location handling.
        * value.c (value_from_contents_and_address): Add
        DW_AT_data_location handling.
2014-08-18 18:12:53 +02:00
Joel Brobecker 08412b0722 Add support for DW_OP_push_object_address.
gdb/ChangeLog:

        * dwarf2expr.h (struct dwarf_expr_context_funcs): Uncomment
        field "get_object_address".
        * dwarf2expr.c (execute_stack_op): Add handling for
        DW_OP_push_object_address.
        * dwarf2loc.h (dwarf2_evaluate_property): Add "address" field.
        * dwarf2loc.c (struct dwarf_expr_baton): Add field "obj_address".
        (dwarf_expr_push_dwarf_reg_entry_value): Set baton_local.obj_address.
        (dwarf_expr_get_obj_addr): New function.
        (dwarf_expr_ctx_funcs): Add get_object_address field.
        (dwarf2_evaluate_loc_desc_full): Set baton.obj_address.
        (dwarf2_locexpr_baton_eval): Add parameter "addr".  Use it.
        (dwarf2_evaluate_property): Add parameter "address".  Use it.
        (needs_get_obj_addr): New function.
        (needs_frame_ctx_funcs): Add get_object_address field.
        (dwarf2_compile_expr_to_ax): Add DW_OP_push_object_address handling.
        * gdbtypes.c (resolve_dynamic_range): Add "addr" field.  Use it.
        (resolve_dynamic_array): Likewise.
2014-08-18 18:11:28 +02:00
Joel Brobecker 84754697d2 ada_evaluate_subexp<OP_VAR_VALUE>: Avoid static fixing when possible.
Now that the OP_VAR_VALUE section of this function has been reorganized
a bit, we can fall-back on standard evaluation when static fixing is
not required. This patch does that, but being exclusive about when
static fixing has to be used, rather than doing it all the time when
noside is EVAL_AVOID_SIDE_EFFECTS.

This will pave the way for later when we want to evaluate entities
that have no GNAT encodings related to them but dynamic properties
instead. In that case, we expect the standard evaluation to resolve
those dynamic properties for us, even in no-side-effect mode.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>:
        When noside is EVAL_AVOID_SIDE_EFFECTS, only return a statically
        fixed value for records and unions for which some GNAT encodings
        are present.
2014-08-18 17:10:39 +02:00
Joel Brobecker da5c522f5b avoid "if ... else if ... else" logic in ada-lang.c::ada_evaluate_subexp
The OP_VAR_VALUE branch in ada_evaluate_subexp is written with
multiple "if ... else if ... else if ... else ..." block. But
in practice, these blocks  all either goto out of that block of
code, or return.

This patch rewrites this code slightly by replacing the "else if"-s
by simple "if"s. This should better reflect the ideal processing
where we try to do a standard eval whenever possible, and only
do something else when the standard eval does not work. On a pratical
level, this patch makes it easier to fall through to the default
processing when none of the special situations are detected, thus
making it easier to add more handlers of those special situations;
or to remove them as they no longer become necessary!

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Slight code
        rewrite to avoid "else if" and "else" constructs.  Should be
        a no-op in practice.
2014-08-18 17:09:33 +02:00
Joel Brobecker 0d72a7c318 Fix indentation level in ada-lang.c::ada_evaluate_subexp.
I just happen to notice that a lexical block was missing one
indentation level.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Fix identation
        of lexical block.
2014-08-18 17:08:55 +02:00
Alan Modra cb8e01c6bb LTO plugin with older gcc
* ld-plugin/lto.exp: Use gcc -print-file-name to find lto plugin.
2014-08-18 21:01:26 +09:30
Alan Modra 1009ef284f PowerPC fix for ifunc broken by d1eca1e4
This probably could be fixed by making changes in relocate_section for
ifunc, but it's simpler to disable the optimisation for ifunc.

	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't attempt to
	use dynrelocs for ifunc.
	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Similarly.
2014-08-18 21:00:46 +09:30
Alan Modra 1240be6b7d PR 17287, DT_NEEDED of unneeded libraries affects --as-needed
PR 17287
bfd/
	* elflink.c (on_needed_list): Only consider libraries that have
	been loaded.
ld/
	* ld.texinfo (--as-needed): Clarify that references from libraries
	must be from needed libraries.
ld/testsuite/
	* ld-plugin/needed3.c: New file.
	* ld-elf/shared.exp: Add needed3 test.
2014-08-18 18:45:01 +09:30
Alan Modra 759388538d Return error status from bfd_elf_discard_info.
bfd/
	* elflink.c (bfd_elf_discard_info): Return int error status.
	* stabs.c (_bfd_discard_section_stabs): Comment typo fix.
	* bfd-in.h (bfd_elf_discard_info): Updata prototype.
	* bfd-in2.h: Regenerate.
ld/
	* emultempl/aarch64elf.em (gld${EMULATION_NAME}_after_allocation):
	Handle error status from bfd_elf_discard_info.
	* emultempl/armelf.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/metagelf.em: Likewise.
	* emultempl/nios2elf.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
	* emultempl/vms.em: Likewise.
2014-08-18 09:33:35 +09:30
Alan Modra 1e53931944 Cast result of TC_PARSE_CONS_EXPRESSION
* read.c (parse_mri_cons): Warning fix.
2014-08-18 09:32:44 +09:30
Alan Modra 87ea0aeaa3 daily update 2014-08-18 09:30:46 +09:30
Alan Modra d2db64e914 daily update 2014-08-17 09:30:44 +09:30
Siva Chandra e66d444669 Add new argument NOSIDE to find_overload_match.
This is a fix for PR c++/17132.
If this new argument is set to EVAL_AVOID_SIDE_EFFECTS, then the object's
memory will not be read while picking the best overload match.

gdb/

	* eval.c: Update all calls to find_overload_match.
	* valarith.c: Likewise.
	(value_user_defined_cpp_op, value_user_defined_op): New
	argument NOSIDE.  Update all callers.
	* valops.c (find_overload_match): New argument NOSIDE.
	* value.h (find_overload_match): Update signature.

gdb/testsuite

	* gdb.cp/pr17132.cc: New file.
	* gdb.cp/pr17132.exp: New file.
2014-08-15 18:28:59 -07:00
Siva Chandra 940df40812 Fix xmethod Python so that it works with Python3.
gdb/

	* python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
	'items'	methods instead of 'iteritems' method on dictionaries.

gdb/testsuite/

	* gdb.python/py-xmethods.py (A_getarrayind)
	(E_method_char_worker.__call__, E_method_int_worker.__call__):
	Use 'print' with function call syntax.
	(E_method_matcher.match): Fix tab vs space indentation mixup.
2014-08-15 18:04:47 -07:00
Alan Modra a0d09f12db daily update 2014-08-16 09:31:03 +09:30
Doug Evans 699ca60ad9 (dwarf_decode_lines_1): Move definition of adj_opcode closer to use.
* dwarf2read.c (dwarf_decode_lines_1): Move definition of adj_opcode
	closer to use.
2014-08-15 16:22:51 -07:00
Doug Evans 37780ee59e dwarf2read.c (dwarf_decode_lines_1): Add comment.
* dwarf2read.c (dwarf_decode_lines_1): Add comment.
2014-08-15 16:05:47 -07:00
Roland McGrath faa743bb1b Regenerate sim configury. 2014-08-15 15:51:50 -07:00
Doug Evans 0ad93d4feb (dwarf_decode_lines_1): Delete local "column", unused.
* dwarf2read.c (dwarf_decode_lines_1): Delete local "column", unused.
2014-08-15 15:38:56 -07:00
Doug Evans 20d8c3722e (dwarf_decode_lines_1): Delete local basic_block, unused.
* dwarf2read.c (dwarf_decode_lines_1): Delete local basic_block,
	unused.
2014-08-15 15:24:35 -07:00
Eli Zaretskii cb039ba453 Avoid compiler warnings about incomplete parameter types.
gdb/ChangeLog:

	* dcache.h: Include target.h, to avoid compile time warnings.
2014-08-15 17:04:27 +03:00
Joel Brobecker eb7a547ad4 Add "frame.h" #include in gdbarch.h.
This include is needed because gdbarch_dummy_id needs the full
definition of struct frame_id.

gdb/ChangeLog:

        * gdbarch.sh: #include "frame.h" in gdbarch.h.  Delete "struct
        frame_info" partial declaration.
        * gdbarch.h: Regenerate.

Tested on x86_64-linux by rebuilding GDB.
2014-08-15 05:29:33 -07:00
Yao Qi ebcc6c3a7b Skip tfile.exp if unable to generate trace file
I added proc generate_tracefile in this patch
https://sourceware.org/ml/gdb-patches/2014-03/msg00591.html but
tfile.exp isn't skipped as changelog entry said:

	* gdb.trace/tfile.exp: Skip the test if generate_tracefile
	return 0.

it is a mistake I made at the last minute.  Patch below fixed it.

gdb/testsuite:

2014-08-15  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/tfile.exp: Return -1 if generate_tracefile returns
	false.
2014-08-15 08:43:44 +08:00
Alan Modra 7dba4c934c daily update 2014-08-15 09:31:09 +09:30
Yao Qi 775e0f0481 Set print symbol off in some tests
GDB in default prints the symbol associated on an address, and tests
assume that there is no symbol on address zero.  However, on bare
metal target, address may be mapped to zero and there may be a
symbol.  Then, some tests fail as below:

print const_cast<void *> (0)^M
$8 = (void *) 0x0 <_ftext>^M
(gdb) FAIL: gdb.cp/casts.exp: const_cast of 0

p acp->c1^M
$9 = (A *) 0x0 <_ftext>^M
(gdb) FAIL: gdb.cp/class2.exp: p acp->c1

This patch is to set print symbol off in these tests, like what
I did previously https://sourceware.org/ml/gdb-patches/2014-07/msg00257.html

gdb/testsuite:

2014-08-15  Yao Qi  <yao@codesourcery.com>

	* gdb.cp/casts.exp: Set print symbol off.
	* gdb.cp/class2.exp: Likewise.
	* gdb.cp/overload.exp: Likewise.
	* gdb.cp/templates.exp: Likewise.
2014-08-15 07:55:16 +08:00
Yao Qi 783cecc8b3 Remove pst from dwarf_decode_lines_1
Hi,
Parameter 'pst' of function dwarf_decode_lines_1 isn't used except
to compute decode_for_pst_p, which has been got in the caller
dwarf_decode_lines.  I wonder it would be good if we just pass
'decode_for_pst_p'.

gdb:

2014-08-15  Yao Qi  <yao@codesourcery.com>

	* dwarf2read.c (dwarf_decode_lines_1): Remove parameter 'pst'.
	Add parameter 'decode_for_pst_p'.  Callers update.
2014-08-15 07:38:19 +08:00
Mike Frysinger 60ac5798c8 opcodes: blackfin: convert ad-hoc ints to bfd_boolean
These various int fields are being used as booleans, so change to the
existing bfd_boolean style.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-14 09:14:39 -04:00
Mike Frysinger b3f3b4b030 opcodes: blackfin: simplify decode_CC2stat_0 logic
These multiple if statements can be condensed down into a single if
statement and an array of strings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-14 09:10:12 -04:00
Mike Frysinger a4e600b22e opcodes: blackfin: avoid duplicate memory reads
Rather than reading the same memory twice, pass the value back up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-14 09:07:37 -04:00
Alan Modra 513ea82edf Fix for objdump segfault on broken PE executable
* peXXigen.c (pe_print_reloc): Protect against access past end
	of .reloc section.
2014-08-14 16:57:08 +09:30
Alan Modra 18cd5bce47 Linker part of PR16563 fix
Presents .eh_frame input sections to the optimisation machinery in
elf-eh-frame.c in the order they are given by the linker script.

	PR 16563
bfd/
	* elflink.c (bfd_elf_discard_info): Process .eh_frame and .stab
	in the order they are mapped to output sections.
ld/
	* ldlang.c (map_head_is_link_order): Rename from
	stripped_excluded_sections.
	(lang_clear_os_map): New function, extracted from..
	(strip_excluded_output_sections): ..here.
	* ldlang.h (lang_clear_os_map): Declare.
	* ldwrite.c (ldwrite): Call lang_clear_os_map.
	* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation):
	Likewise.
2014-08-14 13:49:31 +09:30
Alan Modra b879806f2f configury changes to make ld plugin support controlled by --enable-plugins
This also makes --enable-plugins default to on for hosts that can
support plugins, so we have consistent lto toolchain support.  The
ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
will be necessary if plugin support is extended to more hosts via
libtool's dlopen support.  I started down that path then decided it
was more work than I was interested in doing.  (ACX_LARGEFILE invokes
AC_PLUGINS.)

config/
	* plugins.m4: Test for dlfcn.h or windows.h here to set default
	for --enable-plugins.  Report error if someone tries to enable
	plugins on a host we don't support.
bfd/
	* configure.ac: Delete redundant plugin related checks.
	* configure: Regenerate.
binutils/
	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
	* config.in: Regenerate.
	* configure: Regenerate.
gas/
	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
	* config.in: Regenerate.
	* configure: Regenerate.
gprof/
	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
	* configure: Regenerate.
	* gconfig.in: Regenerate.
ld/
	* configure.ac: Move AC_PROG_CC and other macros earlier.  Delete
	plugin checks now done in config/plugins.m4.
	* config.in: Regenerate.
	* configure: Regenerate.
2014-08-14 13:46:09 +09:30
Alan Modra 23ebe1a0bd Simplify is_ir_dummy_bfd test
is_ir_dummy_bfd started life before BFD_PLUGIN was invented.

	* plugin.c (is_ir_dummy_bfd): Test BFD_PLUGIN flag rather than
	flags.claimed.
2014-08-14 13:39:40 +09:30
Sriraman Tallam 8123365312 Add option -no-pie. 2014-08-13 18:40:19 -07:00
Alan Modra 78090f7c83 daily update 2014-08-14 09:31:08 +09:30
Stefan Kristiansson ffccb7afb5 bfd: or1k: avoid emitting R_OR1K_INSN_REL_26 in shared libs
This fixes a bug where R_OR1K_INSN_REL_26 relocations would be emitted
into shared libraries even when the referenced symbol was hidden
or the symbol was contained in the same .so which had been
linked with -Bsymbolic.

bfd/
	* elf32-or1k.c (or1k_elf_relocate_section, or1k_elf_check_relocs,
	allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL
	and SYMBOLIC_BIND.
2014-08-13 23:32:51 +03:00
Mike Frysinger 703ec4e8d0 opcodes: blackfin: push down global state
The variables used to track insn state should be pushed down into the
private_data structure to avoid pollution across calls.

This also happens to fix the output when hitting comments/invalid insns
which needs to tweak a gas test.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-13 07:06:15 -04:00
Mike Frysinger ed2c487956 opcodes: blackfin: do not force align the PC
If the user gives us an unaligned PC, then dump an error as such.
Otherwise if you try to disassemble at an odd address, the output
will look weird (it'll read one byte earlier).

This can be seen in one of the gas tests where data is in the middle
of .text, so move the data to .data like it should be in the first place.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-13 06:58:34 -04:00
Mike Frysinger ba32981791 opcodes: blackfin: handle memory read errors
The current code ignores memory read errors which isn't a great idea.
So add a helper function which takes care of error checking and update
the code to use that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-13 06:49:47 -04:00
Yaakov Selkowitz 63e1777c6c This is necessary for adding __cxa_atexit support for Cygwin in GCC without
exporting __dso_handle from every DLL.

	* pe-dll.c (autofilter_entry_type autofilter_symbollist_i386): Add
	__dso_handle.
2014-08-13 11:43:28 +01:00
Yao Qi 65c749e7c0 Fix build/17104
This patch is to fix the build error when GDB is configured as:

  CFLAGS=-Wall ./configure --with-babeltrace; make

This patch adds one line of code in configure test to use local
variable 'pos'.

Note that we append -Werror to CFLAGS to catch the warning related to
assignment to scope.  See more in this thread
https://sourceware.org/ml/gdb-patches/2014-08/msg00045.html

2014-08-13  Yao Qi  <yao@codesourcery.com>

	PR build/17104
	* configure.ac: Use local variable 'pos'.
	* configure: Regenerated.
2014-08-13 17:42:57 +08:00
Alan Modra e20e2464f8 daily update 2014-08-13 09:31:13 +09:30
H.J. Lu 6374269c11 Remove type directive
* gas/i386/omit-lock.s: Remove type directive.
2014-08-12 15:53:48 -07:00
Alan Modra 0fef4b9893 Fix non-ELF build breakage
* ldlang.c (open_input_bfds): Don't use bfd_elf_get_dyn_lib_class.
2014-08-13 07:36:30 +09:30
Alan Modra 2d03dd2f8d Tighten test for ld plugin support
To not match spu --plugin option.

	* lib/ld-lib.exp (check_plugin_api_available): Match "-plugin PLUGIN".
2014-08-12 20:51:11 +09:30
Alan Modra e77620a58f Fix build breakage when ld plugins disabled
* ldlang.h (struct lang_input_statement_flags): Don't make "reload"
	field conditional on ENABLE_PLUGINS.
	* ldlang.c (open_input_bfds): Expand plugin_should_reload.
	* plugin.h (plugin_should_reload): Delete.
	* plugin.c (plugin_should_reload): Delete.
2014-08-12 20:49:58 +09:30