binutils-gdb.git
10 years agodaily update
Alan Modra [Wed, 12 Mar 2014 23:01:14 +0000 (09:31 +1030)]
daily update

10 years agoFactor out foreground/background execution command preparation.
Pedro Alves [Wed, 12 Mar 2014 20:32:53 +0000 (20:32 +0000)]
Factor out foreground/background execution command preparation.

All execution commands currently have this pattern:

  /* If we must run in the background, but the target can't do it,
     error out.  */
  if (async_exec && !target_can_async_p ())
    error (_("Asynchronous execution not supported on this target."));

  /* If we are not asked to run in the bg, then prepare to run in the
     foreground, synchronously.  */
  if (!async_exec && target_can_async_p ())
    {
      /* Simulate synchronous execution.  */
      async_disable_stdin ();
    }

This patch factors that into a shared function.

attach_command installs a cleanup to re-enable stdin, but that's not
necessary, as per the comment in prepare_execution_command.  In any
case, if someday it turns out necessary, we have a single place to
install it now.

Tested on x86_64 Fedora 17, sync and async modes.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

* infcmd.c (prepare_execution_command): New function, factored out
from several execution commands.
(run_command_1, continue_command, step_1, jump_command)
(signal_command, until_command, advance_command, finish_command)
(attach_command): Use prepare_execution_command.

10 years agoSupport for HWbreak/watchpoint across fork/vfork on arm-native
Omair Javaid [Wed, 12 Mar 2014 20:23:55 +0000 (01:23 +0500)]
Support for HWbreak/watchpoint across fork/vfork on arm-native

This patch updates arm native support for hwbreak-/watchpoints to enable
support for hwbreak-/watchpoints across fork/vfork. This involves changes to
hwbreak-/watchpoint insertion mechanism to the modern way, by marking debug
registers as needing update, but only really updating them on resume, which is
necessary for supporting watchpoints in non-stop mode. This also updates a
previously maintained per thread hwbreak-/watchpoint cache to a per process
cache which allows target specific code to come in sync with gdb-linux calls to
threads create/destroy and process fork/exit hooks.

10 years agoMake 'make check TESTS="..."' work from GDB's build dir.
Pedro Alves [Wed, 12 Mar 2014 19:40:52 +0000 (19:40 +0000)]
Make 'make check TESTS="..."' work from GDB's build dir.

I noticed 'make check TESTS="..."' works when ran from gdb/testsuite/,
but TESTS is ignored when "make check" is ran from gdb/.

The issue is that TESTS isn't being passed to the testsuite subdir
make invocation.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

* Makefile.in (TARGET_FLAGS_TO_PASS): Add TESTS.

10 years agofix regressions with target-async
Tom Tromey [Fri, 28 Feb 2014 16:47:34 +0000 (09:47 -0700)]
fix regressions with target-async

A patch in the target cleanup series caused a regression when using
record with target-async.  Version 4 of the patch is here:

    https://sourceware.org/ml/gdb-patches/2014-03/msg00159.html

The immediate problem is that record supplies to_can_async_p and
to_is_async_p methods, but does not supply a to_async method.  So,
when target-async is set, record claims to support async -- but if the
underlying target does not support async, then the to_async method
call will end up in that method's default implementation, namely
tcomplain.

This worked previously because the record target used to provide a
to_async method; one that (erroneously, only at push time) checked the
other members of the target stack, and then simply dropped to_async
calls in the "does not implement async" case.

My first thought was to simply drop tcomplain as the default for
to_async.  This works, but Pedro pointed out that the only reason
record has to supply to_can_async_p and to_is_async_p is that these
default to using the find_default_run_target machinery -- and these
defaults are only needed by "run" and "attach".

So, a nicer solution presents itself: change run and attach to
explicitly call into the default run target when needed; and change
to_is_async_p and to_can_async_p to default to "return 0".  This makes
the target stack simpler to use and lets us remove the method
implementations from record.  This is also in harmony with other plans
for the target stack; namely trying to reduce the impact of
find_default_run_target.  This approach makes it clear that
find_default_is_async_p is not needed -- it is asking whether a target
that may not even be pushed is actually async, which seems like a
nonsensical question.

While an improvement, this approach proved to introduce the same bug
when using the core target.  Looking a bit deeper, the issue is that
code in "attach" and "run" may need to use either the current target
stack or the default run target -- but different calls into the target
API in those functions could wind up querying different targets.

This new patch makes the target to use more explicit in "run" and
"attach".  Then these commands explicitly make the needed calls
against that target.  This ensures that a single target is used for
all relevant operations.  This lets us remove a couple find_default_*
functions from various targets, including the dummy target.  I think
this is a decent understandability improvement.

One issue I see with this patch is that the new calls in "run" and
"attach" are not very much like the rest of the target API.  I think
fundamentally this is due to bad factoring in the target API, which
may need to be fixed for multi-target.  Tackling that seemed ambitious
for a regression fix.

While working on this I noticed that there don't seem to be any test
cases that involve both target-async and record, so this patch changes
break-precsave.exp to add some.  It also changes corefile.exp to add
some target-async tests; these pass with current trunk and with this
patch applied, but fail with the v1 patch.

This patch differs from v4 in that it moves initialization of
to_can_async_p and to_supports_non_stop into inf-child, adds some
assertions to complete_target_initialization, and adds some comments
to target.h.

Built and regtested on x86-64 Fedora 20.

2014-03-12  Tom Tromey  <tromey@redhat.com>

* inf-child.c (return_zero): New function.
(inf_child_target): Set to_can_async_p, to_supports_non_stop.
* aix-thread.c (aix_thread_inferior_created): New function.
(aix_thread_attach): Remove.
(init_aix_thread_ops): Don't set to_attach.
(_initialize_aix_thread): Register inferior_created observer.
* corelow.c (init_core_ops): Don't set to_attach or
to_create_inferior.
* exec.c (init_exec_ops): Don't set to_attach or
to_create_inferior.
* infcmd.c (run_command_1): Use find_run_target.  Make direct
target calls.
(attach_command): Use find_attach_target.  Make direct target
calls.
* record-btrace.c (init_record_btrace_ops): Don't set
to_create_inferior.
* record-full.c (record_full_can_async_p, record_full_is_async_p):
Remove.
(init_record_full_ops, init_record_full_core_ops): Update.  Don't
set to_create_inferior.
* target.c (complete_target_initialization): Add assertion.
(target_create_inferior): Remove.
(find_default_attach, find_default_create_inferior): Remove.
(find_attach_target, find_run_target): New functions.
(find_default_is_async_p, find_default_can_async_p)
(target_supports_non_stop, target_attach): Remove.
(init_dummy_target): Don't set to_create_inferior or
to_supports_non_stop.
* target.h (struct target_ops) <to_attach>: Add comment.  Remove
TARGET_DEFAULT_FUNC.
<to_create_inferior>: Add comment.
<to_can_async_p, to_is_async_p, to_supports_non_stop>: Use
TARGET_DEFAULT_RETURN.
<to_can_async_p, to_supports_non_stop, to_can_run>: Add comments.
(find_attach_target, find_run_target): Declare.
(target_create_inferior): Remove.
(target_has_execution_1): Update comment.
(target_supports_non_stop): Remove.
* target-delegates.c: Rebuild.

2014-03-12  Tom Tromey  <tromey@redhat.com>

* gdb.base/corefile.exp (corefile_test_run, corefile_test_attach):
New procs.  Add target-async tests.
* gdb.reverse/break-precsave.exp (precsave_tests): New proc.
Add target-async tests.

10 years agoThe value of a bignum expression is held in a single global array. This means
Nick Clifton [Wed, 12 Mar 2014 15:44:09 +0000 (15:44 +0000)]
The value of a bignum expression is held in a single global array.  This means
that if multiple bignum values are encountered only the most recent is valid.
If such expressions are cached, eg to be emitted into a literal pool later on
in the assembly, then only one expression - the last - will be correct.  This
patch fixes the problem for the AArch64 target by caching each bignum value
locally.

PR gas/16688
* config/tc-aarch64.c (literal_expression): New structure.
(literal_pool): Replace exp array with literal_expression array.
(add_to_lit_pool): When adding a bignum cache the big value.
(s_ltorg): When emitting a bignum initialise the global bignum
array from the cached value.

* gas/aarch64/litpool.s: New test case.
* gas/aarch64/litpool.d: Expected disassembly.

10 years agoFix dw2-ifort-parameter.exp on PPC64
Andreas Arnez [Fri, 7 Mar 2014 12:23:47 +0000 (12:23 +0000)]
Fix dw2-ifort-parameter.exp on PPC64

On PPC64, 'func' and 'main' are function descriptors and don't point
to the actual code.  Thus the usage of these symbols in the DWARF
assembler source was broken.  The patch introduces new labels
func_start and func_end for this purpose.

10 years agoMigrate dw2-ifort-parameter.exp to Dwarf::assemble
Andreas Arnez [Fri, 7 Mar 2014 11:52:54 +0000 (11:52 +0000)]
Migrate dw2-ifort-parameter.exp to Dwarf::assemble

A "side effect" of the migration to Dwarf::assemble is that the DWARF
address size is now automatically adjusted to the target architecture.
The original assembler source hard-coded the DWARF address size to 4,
even on 64-bit architectures.  This address size mismatch caused a
test case failure on s390x due to a wrong result from DW_OP_deref.

10 years agoExploit 'prepare_for_testing' etc. for 'Dwarf::assemble'-generated files
Andreas Arnez [Fri, 7 Mar 2014 11:45:49 +0000 (11:45 +0000)]
Exploit 'prepare_for_testing' etc. for 'Dwarf::assemble'-generated files

Now that prepare_for_testing etc. can cope with absolute path names,
this can be exploited for test cases with generated source files.
This is just to simplify the code and shouldn't cause any functional
change.

10 years agogdb.exp: Support absolute path name args in 'prepare_for_testing' etc.
Andreas Arnez [Fri, 7 Mar 2014 10:23:42 +0000 (10:23 +0000)]
gdb.exp: Support absolute path name args in 'prepare_for_testing' etc.

Test cases that produce source files in the build directory have not
been able to use prepare_for_testing and friends.  This was because
build_executable_from_specs unconditionally prepended the source
directory path name to its arguments.

10 years agoPrevent the linker from generaing a seg-fault when the user attempts to link
Nick Clifton [Wed, 12 Mar 2014 13:12:37 +0000 (13:12 +0000)]
Prevent the linker from generaing a seg-fault when the user attempts to link
an ARM ELF binary into an AARCH64 ELF executable.

PR ld/16671
* elf32-arm.c (elf32_arm_add_symbol_hook): Check for ARM format
before testing for vxworks.

10 years agoUpdate the documentation for the AR command so that it shows the --plugin
Nick Clifton [Wed, 12 Mar 2014 12:00:27 +0000 (12:00 +0000)]
Update the documentation for the AR command so that it shows the --plugin
option coming *after* the command option not before it.

PR binutils/16652
* doc/binutils.texi (ar cmdline): Move --plugin command line
option to after the command option.

10 years agoinf-child.h: Update comment.
Pedro Alves [Wed, 12 Mar 2014 11:55:02 +0000 (11:55 +0000)]
inf-child.h: Update comment.

Like inf-child.c, this file is no longer used exclusively by Unix
targets anymore.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

        * inf-child.h: Update comment to not mention Unix.

10 years agoinf-child.c: Update comments.
Pedro Alves [Wed, 12 Mar 2014 11:33:59 +0000 (11:33 +0000)]
inf-child.c: Update comments.

This file is no longer used exclusively by Unix targets anymore.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

* inf-child.c: Update top comment to not mention Unix.  Add
generic comment describing how this target is meant to be used.
(inf_child_post_attach, inf_child_post_startup_inferior)
(inf_child_follow_fork, inf_child_pid_to_exec_file): Don't mention
Unix in comment.

10 years agoMake the nto-procfs.c target inherit inf-child.c.
Pedro Alves [Wed, 12 Mar 2014 11:21:36 +0000 (11:21 +0000)]
Make the nto-procfs.c target inherit inf-child.c.

So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Not tested.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

* nto-procfs.c: Include inf-child.h.
(procfs_ops): Delete global.
(procfs_can_run): Delete method.
(procfs_detach, procfs_mourn_inferior): Unpush the passed in
target pointer instead of referencing procfs_ops.
(procfs_prepare_to_store): Delete.
(init_procfs_ops): Delete function.
(procfs_target): New function, based on init_procfs_ops, but
inherit inf_child_target.
(_initialize_procfs): Use procfs_target.

10 years agoMake the windows-nat.c target inherit inf-child.c.
Pedro Alves [Wed, 12 Mar 2014 11:21:36 +0000 (11:21 +0000)]
Make the windows-nat.c target inherit inf-child.c.

So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Tested by cross building on Fedora 17, and then confirming that

./gdb.exe ./gdb.exe -ex "set pagination off" -ex "start"

under Wine still works.

Also, Joel tested this with Adacore's internal testsuite.

gdb/
2014-03-12  Pedro Alves  <palves@redhat.com>

* windows-nat.c: Include inf-child.h.
(windows_ops): Delete global.
(windows_open, windows_prepare_to_store, windows_can_run): Delete
methods.
(init_windows_ops): Delete function.
(windows_target): New function, based on init_windows_ops, but
inherit inf_child_target.
(_initialize_windows_nat): Use windows_target.  Install x86
specific target methods here.

10 years agoMention PR gdb/16696 in corresponding ChangeLog entry.
Pedro Alves [Wed, 12 Mar 2014 11:07:37 +0000 (11:07 +0000)]
Mention PR gdb/16696 in corresponding ChangeLog entry.

10 years agoAdd myself as the maintainer for the MSP430 sim.
Nick Clifton [Wed, 12 Mar 2014 11:02:57 +0000 (11:02 +0000)]
Add myself as the maintainer for the MSP430 sim.

10 years agoFix compile time warnings about unused variables 'yyinput' and 'input'.
Dmitry Gorbachev [Wed, 12 Mar 2014 10:56:17 +0000 (10:56 +0000)]
Fix compile time warnings about unused variables 'yyinput' and 'input'.

PR binutils/16567
* deflex.l: Add noinput and nounput options.

10 years agoautoreconf
Alan Modra [Wed, 12 Mar 2014 04:32:00 +0000 (15:02 +1030)]
autoreconf

Regenerate Makefile.in in bfd, binutils, gas, gold, gprof, ld, opcodes.
Regenerate gas/config.in.

10 years agoobjcopy/strip ELF program header p_vaddr confusion
Alan Modra [Wed, 12 Mar 2014 00:03:26 +0000 (10:33 +1030)]
objcopy/strip ELF program header p_vaddr confusion

copy_elf_program_header has logic to reject non-alloc sections when
calculating p_vaddr offset for padding, but blithely assumed the
first section in a segment was allocated.

PR 16690
* elf.c (copy_elf_program_header): Ignore first section lma if
non-alloc.

10 years agodaily update
Alan Modra [Tue, 11 Mar 2014 23:01:13 +0000 (09:31 +1030)]
daily update

10 years agointptr_t type definition needed
Alan Modra [Tue, 11 Mar 2014 05:12:46 +0000 (15:42 +1030)]
intptr_t type definition needed

coffcode.h uses an intptr_t cast inside an #ifdef RS6000COFF_C, so
ensure that intptr_t is defined.  We don't see this when
cross-compiling from linux due to intptr_t being provided by
unistd.h.

PR 16686
* coff-rs6000.c: Include stdint.h.
* coff64-rs6000.c: Likewise.

10 years ago * guile/guile.c (call_initialize_gdb_module): New function.
Doug Evans [Tue, 11 Mar 2014 04:02:19 +0000 (00:02 -0400)]
* guile/guile.c (call_initialize_gdb_module): New function.
(initialize_guile): Replace call to scm_init_guile with call to
scm_with_guile.

10 years agosim: msp430: start a test framework
Mike Frysinger [Sat, 8 Mar 2014 05:21:13 +0000 (00:21 -0500)]
sim: msp430: start a test framework

The current sim lacks any sort of tests.  Start a basic framework and
add a simple one to test the add insn.

10 years agosim: msp430: set initial PC to ELF entry if available
Mike Frysinger [Sat, 8 Mar 2014 05:20:11 +0000 (00:20 -0500)]
sim: msp430: set initial PC to ELF entry if available

If we want to run a simple ELF, the reset vector isn't set up, so starting
at address 0 doesn't make sense.  Use the ELF's entry point instead.

10 years agosim: msp430: fix build time warnings
Mike Frysinger [Fri, 7 Mar 2014 04:29:37 +0000 (23:29 -0500)]
sim: msp430: fix build time warnings

This fix is simple:

msp430-sim.c: In function 'maybe_perform_syscall':
msp430-sim.c:898:10: warning: format '%d' expects argument of type 'int',
                     but argument 5 has type 'long int' [-Wformat]

This one we change to use casts like everyone else does in the code base:

msp430-sim.c: In function 'msp430_step_once':
msp430-sim.c:985:7: warning: passing argument 3 of 'init_disassemble_info'
                    from incompatible pointer type [enabled by default]
include/dis-asm.h:368:13: note: expected 'fprintf_ftype' but argument is
of type 'int (*)(struct FILE * __restrict__,  const char * __restrict__)'

10 years agosim: constify arg to sim_do_command
Mike Frysinger [Thu, 20 Feb 2014 05:28:17 +0000 (00:28 -0500)]
sim: constify arg to sim_do_command

It is rare for people to want to modify the cmd arg.  In general, they
really shouldn't be, but a few still do.  For those who misbehave, dupe
the string locally so they can bang on it.

10 years agodaily update
Alan Modra [Mon, 10 Mar 2014 23:00:40 +0000 (09:30 +1030)]
daily update

10 years agoAdd function to set non-visibility part of st_other.
Cary Coutant [Mon, 10 Mar 2014 20:38:20 +0000 (13:38 -0700)]
Add function to set non-visibility part of st_other.

2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* symtab.h (Symbol::set_nonvis): New function.

10 years agoAdd explicit instantiations for Sized_symbol::init_output_data.
Cary Coutant [Mon, 10 Mar 2014 20:36:40 +0000 (13:36 -0700)]
Add explicit instantiations for Sized_symbol::init_output_data.

2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* symtab.cc (Sized_symbol<32>::init_output_data):
Instantiate the template.
(Sized_symbol<64>::init_output_data): Likewise.

10 years agoAllow target to adjust dynamic symbol value.
Cary Coutant [Mon, 10 Mar 2014 20:35:53 +0000 (13:35 -0700)]
Allow target to adjust dynamic symbol value.

2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* symtab.cc (Symbol_table::sized_write_globals): Allow a target to
adjust dynamic symbol value.
* target.h (Target::adjust_dyn_symbol): New function.
(Target::do_adjust_dyn_symbol): New function.

10 years agoAllow target to add custom dynamic table entries.
Cary Coutant [Mon, 10 Mar 2014 20:34:53 +0000 (13:34 -0700)]
Allow target to add custom dynamic table entries.

2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* output.cc (Output_data_dynamic::Dynamic_entry::write):
Get the value of DYNAMIC_CUSTOM dynamic entry.
* output.h (Output_data_dynamic::add_custom): New function.
(Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
dynamic entry.
(enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
* target.h (Target::dynamic_tag_custom_value): New function.
(Target::do_dynamic_tag_custom_value): New function.

10 years agoAllow target to set dynsym indexes.
Cary Coutant [Mon, 10 Mar 2014 20:33:20 +0000 (13:33 -0700)]
Allow target to set dynsym indexes.

2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
dynsym indexes.
* target.h (Target::has_custom_set_dynsym_indexes): New function.
(Target::do_has_custom_set_dynsym_indexes): New function.
(Target::set_dynsym_indexes): New function.
(Target::do_set_dynsym_indexes): New function.

10 years agoRemove bfd/ticoff.h (unused)
Tristan Gingold [Mon, 10 Mar 2014 14:10:27 +0000 (15:10 +0100)]
Remove bfd/ticoff.h (unused)

2013-12-03  Tristan Gingold  <gingold@adacore.com>

* ticoff.h: Remove.

10 years agoMissing space before '(' in ada-lang.c::ada_evaluate_subexp
Joel Brobecker [Mon, 10 Mar 2014 13:45:26 +0000 (14:45 +0100)]
Missing space before '(' in ada-lang.c::ada_evaluate_subexp

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp): Add missing space before '('
        in call to TYPE_CODE macro.

10 years agoMinor style change in the previous commits' ChangeLog entry.
Joel Brobecker [Mon, 10 Mar 2014 13:44:30 +0000 (14:44 +0100)]
Minor style change in the previous commits' ChangeLog entry.

10 years ago[Ada] Full view of tagged type with ptype
Jerome Guitton [Wed, 12 Feb 2014 11:08:23 +0000 (12:08 +0100)]
[Ada] Full view of tagged type with ptype

When evaluating an expression, if it is of a tagged type, GDB reads
the tag in memory and deduces the full view. At parsing time, however,
this operation is done only in the case of OP_VAR_VALUE. ptype does
not go through a full evaluation of expressions so it may return some
odd results:

 (gdb) print c.menu_name
 $1 = 0x0
 (gdb) ptype $
 type = system.strings.string_access
 (gdb) ptype c.menu_name
 type = <void>

This change removes this peculiarity by extending the tag resolution
to UNOP_IND and STRUCTOP_STRUCT. As in the case of OP_VAR_VALUE, this
implies switching from EVAL_AVOID_SIDE_EFFECTS to EVAL_NORMAL when a
tagged type is dereferenced.

gdb/
* ada-lang.c (ada_evaluate_subexp): Resolve tagged types to
full view in the case of UNOP_IND and STRUCTOP_STRUCT.

gdb/testsuite/

* gdb.ada/tagged_access: New testcase.

10 years agoRemove "hardware" from comments of "target_insert_breakpoint"
Hui Zhu [Mon, 10 Mar 2014 07:42:26 +0000 (15:42 +0800)]
Remove "hardware" from comments of "target_insert_breakpoint"

This function is for simple breakpoint.  So I post a patch to remove "hardware".

Thanks,
Hui

2014-03-10  Hui Zhu  <hui@codesourcery.com>

* target.h (target_insert_breakpoint): Remove "hardware" from its
comments.

10 years agodaily update
Alan Modra [Sun, 9 Mar 2014 23:00:41 +0000 (09:30 +1030)]
daily update

10 years agodaily update
Alan Modra [Sat, 8 Mar 2014 23:01:12 +0000 (09:31 +1030)]
daily update

10 years agoBetter overflow checking for powerpc32 relocations
Alan Modra [Sat, 8 Mar 2014 02:35:06 +0000 (13:05 +1030)]
Better overflow checking for powerpc32 relocations

Similar to the powerpc64 patch, this improves overflow checking in
elf32-ppc.c.  Many reloc "howto" entries needed fixes, some just
cosmetic.

The patch also fixes the R_PPC_VLE_SDA21 reloc application code, which
was horribly broken.  In fact, it may still be broken since Power ISA
2.07 says e_li behaves as
   RT <- EXTS(li20 1:4 || li20 5:8 || li20 0 || li20 9:19)
where li20 is a field taken from bits 17..20, 11..15, 21..31 of the
instruction.  Freescale VLEPEM says differently, and I assume
correctly, that
   RT <- EXTS(li20 0:3 || li20 4:8 || li20 9:19)
The VLE_SDA21 relocation description matches this too.

Now the VLE_SDA21 relocation specifies in the case where e_addi16 is
converted to e_li for symbols in .PPC.EMB.sdata0 or .PPC.EMB.sbss0
(no base register), that the field is restricted to 16 bits, with the
sign bit being propagated to the top 4 bits.  I don't see the sense in
restricting the value like this, so have allowed the full 20 bit
signed value.  This of course is compatible with the reloc description
in that values in the 16 bit signed range will result in exactly the
same insn field as when the reloc description is followed to the
letter.

* elf32-ppc.c (ppc_elf_howto_raw): Correct overflow check for
many relocations.  Correct bitsize and rightshift too for a number
of VLE relocs.  Describe R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO.
Correct dst_mask on R_PPC_VLE_SDA21_LO.
(ppc_elf_vle_split16): Tidy, delete unnecessary prototype.
(ppc_elf_relocate_section): Modify overflow test for 16-bit
fields in instructions to signed/unsigned according to whether
the field takes a signed or unsigned value.  Tidy vle split16 code.
Correct R_PPC_VLE_SDA21 and R_PPC_VLE_SDA21_LO handling.

10 years agoBetter overflow checking for powerpc64 relocations
Alan Modra [Thu, 6 Mar 2014 23:44:30 +0000 (10:14 +1030)]
Better overflow checking for powerpc64 relocations

R_PPC64_ADDR16 is used in three contexts:
- .short data relocation
- 16-bit signed insn fields, eg. addi
- 16-bit unsigned insn fields, eg. ori
In the first case we want to allow both signed and unsigned 16-bit
values, the latter two ought to error if the field exceeds the range
of values allowed for 16-bit signed and unsigned integers
respectively.  These conflicting requirements meant that ld had to
choose the least restrictive overflow checks, and thus it is possible
to construct testcases where an addi field overflows but is not
reported by ld.  Many relocations dealing with 16-bit insn fields have
this problem.  What's more, some relocations that are only ever used
for signed fields of instructions woodenly copied the lax overflow
checking of R_PPC64_ADDR16.

bfd/
* elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed
for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN,
R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS,
R_PPC64_REL16 entries.  Use complain_overflow_dont for R_PPC64_TOC.
(ppc64_elf_relocate_section): Modify overflow test for 16-bit
fields in instructions to signed/unsigned according to whether
the field takes a signed or unsigned value.
gold/
* powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
(Powerpc_relocate_functions::has_overflow_unsigned): New function.
(Powerpc_relocate_functions::has_overflow_bitfield,
overflowed): Use the above.
(Target_powerpc::Relocate::relocate): Correct overflow checking
for a number of relocations.  Modify overflow test for 16-bit
fields in instructions to signed/unsigned according to whether
the field takes a signed or unsigned value.

10 years ago* dwarf2read.c (read_str_index): Rename local dwo_name to objf_name.
Doug Evans [Sat, 8 Mar 2014 01:33:12 +0000 (17:33 -0800)]
* dwarf2read.c (read_str_index): Rename local dwo_name to objf_name.

10 years agoread_cutu_die_from_dwo: Misc minor cleanups.
Doug Evans [Sat, 8 Mar 2014 00:38:26 +0000 (16:38 -0800)]
read_cutu_die_from_dwo: Misc minor cleanups.

* dwarf2read.c (read_cutu_die_from_dwo): Fix function comment.
Remove unused local comp_dir_attr.  Assert exactly one of
stub_comp_unit_die, stub_comp_dir is non-NULL.

10 years agotarget.h: Expands complete_target_initialization and add_target comments.
Joel Brobecker [Fri, 7 Mar 2014 17:00:27 +0000 (09:00 -0800)]
target.h: Expands complete_target_initialization and add_target comments.

Expand a bit the comments to answer some questions I had when looking
at why a target of mine would not have some default methods set.

gdb/ChangeLog:

        * target.h (complete_target_initialization, add_target):
        Add comment.

10 years agodaily update
Alan Modra [Fri, 7 Mar 2014 23:00:39 +0000 (09:30 +1030)]
daily update

10 years agoMake the go32-nat.c target inherit inf-child.c.
Pedro Alves [Fri, 7 Mar 2014 15:36:50 +0000 (15:36 +0000)]
Make the go32-nat.c target inherit inf-child.c.

So that all native targets inherit a single "superclass".

Target methods that are set to or do the same as inf-child.c's are
removed.

Tested by cross building on Fedora 17.

gdb/
2014-03-07  Pedro Alves  <palves@redhat.com>

* go32-nat.c: Include inf-child.h.
(go32_ops): Delete global.
(go32_close, go32_detach, go32_prepare_to_store, go32_can_run):
Delete methods.
(go32_create_inferior): Push the passed in target pointer instead
of referencing go32_ops.
(init_go32_ops): Delete function.  Moved parts to _initialize_go32_nat.
(go32_target): New function, based on init_go32_ops, but inherit
inf_child_target.
(_initialize_go32_nat): Use go32_target.  Move parts of
init_go32_ops here.

10 years agoAIX 32-bit core loading, high section addresses.
Pedro Alves [Fri, 7 Mar 2014 12:11:40 +0000 (12:11 +0000)]
AIX 32-bit core loading, high section addresses.

I noticed GDB was failing to enable threading support for 32-bit AIX
cores.  I traced it to failure to read variables from libpthreads.a.
The issue is that data for that library is loaded at a high address,
and bfd is sign extending the section addresses:

 (gdb) info files
 Symbols from "/home/palves/crash".
 Local core dump file:
 `/home/palves/core', file type aixcoff-rs6000.
 0x2ff22000 - 0x2ff23000 is .stack
 0x20000000 - 0x200316e0 is .data
 0x20000e90 - 0x200016c0 is .data
 0xfffffffff0254000 - 0xfffffffff0297920 is .data
 0xfffffffff07b46a8 - 0xfffffffff07b47c8 is .data
 0xfffffffff0298000 - 0xfffffffff029bfcc is .data
 0xfffffffff06dafe0 - 0xfffffffff07b3838 is .data
 Local exec file:
 `/home/palves/crash', file type aixcoff-rs6000.
 Entry point: 0x20001394
 0x10000150 - 0x10000e90 is .text
 0x20000e90 - 0x2000149c is .data
 0x2000149c - 0x200016c0 is .bss
 0xd053b124 - 0xd053e15f is .text in /usr/lib/libpthreads.a(shr_comm.o)
 0xf0254000 - 0xf0297920 is .data in /usr/lib/libpthreads.a(shr_comm.o)
 0xf0254450 - 0xf0297920 is .bss in /usr/lib/libpthreads.a(shr_comm.o)
 0xd053a280 - 0xd053aabe is .text in /usr/lib/libcrypt.a(shr.o)
 0xf07b46a8 - 0xf07b47c8 is .data in /usr/lib/libcrypt.a(shr.o)
 0xf07b47c8 - 0xf07b47c8 is .bss in /usr/lib/libcrypt.a(shr.o)
 0xd04fb180 - 0xd053917e is .text in /usr/lib/libpthreads.a(shr_xpg5.o)
 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
 0xf029bf64 - 0xf029bfcc is .bss in /usr/lib/libpthreads.a(shr_xpg5.o)
 0xd0100900 - 0xd04fa39c is .text in /usr/lib/libc.a(shr.o)
 0xf06dafe0 - 0xf07b3838 is .data in /usr/lib/libc.a(shr.o)
 0xf0751e94 - 0xf07b3838 is .bss in /usr/lib/libc.a(shr.o)

Notice:
...
0xfffffffff0298000 - 0xfffffffff029bfcc is .data
...

Those are the bfd section start/end addresses.  It't not visible here:

         ...
 0xf0298000 - 0xf029bfcc is .data in /usr/lib/libpthreads.a(shr_xpg5.o)
         ...

... just because GDB trims that number to 32-bit when printing.

GDB then fails to find the memory for libpthreads.a variables in the
core, and falls back to reading it directly from the executable (which
yields the values as originally initialized in the code).

E.g.:

 (gdb) p &__n_pthreads
 $2 = (<data variable, no debug info> *) 0xf074fda8 <__n_pthreads>
 (gdb) p __n_pthreads
 $1 = -1

That should have returned 2 instead of -1.

bfd/
2014-03-07  Pedro Alves  <palves@redhat.com>

* rs6000-core.c (rs6000coff_core_p): Cast pointers to bfd_vma
through ptr_to_uint instead of through long.

10 years agobtrace, test: fix gdb.btrace/data test
Markus Metzger [Wed, 5 Mar 2014 10:17:35 +0000 (11:17 +0100)]
btrace, test: fix gdb.btrace/data test

The format of the output changed.  Fix the test.

testsuite/
* gdb.btrace/data.exp: Update expected output.

10 years agodaily update
Alan Modra [Thu, 6 Mar 2014 23:00:46 +0000 (09:30 +1030)]
daily update

10 years agoApply ld-arm/gc-hidden-1 to all ELF targets, not just *eabi* targets
Roland McGrath [Thu, 6 Mar 2014 17:46:15 +0000 (09:46 -0800)]
Apply ld-arm/gc-hidden-1 to all ELF targets, not just *eabi* targets

ld/testsuite/
* ld-arm/gc-hidden-1.d: Remove target, add not-target to match
other ELF-only tests in this directory.  Loosen regexps so they
don't care what the exact addresses are.

10 years agoDisable --long-plt test for arm-nacl targets.
Roland McGrath [Thu, 6 Mar 2014 17:44:25 +0000 (09:44 -0800)]
Disable --long-plt test for arm-nacl targets.

ld/testsuite/
* ld-arm/arm-elf.exp (armelftests_common): Move long-plt case ...
(armelftests_nonacl): ... here.

10 years agoFix sol-thread.c build failure.
Joel Brobecker [Thu, 6 Mar 2014 15:57:29 +0000 (10:57 -0500)]
Fix sol-thread.c build failure.

Some updates where needed after the minimal symbol handling got changed
a little. This patch makes those changes.

gdb/ChangeLog:

        * sol-thread.c: #include "symtab.h", "minsym.h" and "objfiles.h".
        (ps_pglobal_lookup): Use BMSYMBOL_VALUE_ADDRESS instead of
        SYMBOL_VALUE_ADDRESS.
        (info_cb): MSYMBOL_PRINT_NAME instead of SYMBOL_PRINT_NAME.

10 years ago * gas/tc-avr.c: Add new devices
Denis Chertykov [Thu, 6 Mar 2014 14:59:05 +0000 (18:59 +0400)]
* gas/tc-avr.c: Add new devices
avr25: ata5272, attiny828
avr35: ata5505, attiny1634
avr4: atmega8a, ata6285, ata6286, atmega48pa
avr5: at90pwm161, ata5790, ata5795, atmega164pa, atmega165pa,
atmega168pa, atmega32a, atmega64rfr2, atmega644rfr2, atmega64a,
atmega16hva2
avr51: atmega128a, atmega1284
avrxmega2: atxmega16a4u, atxmega16c4, atxmega32a4u, atxmega32c4,
atxmega32e5, atxmega16e5, atxmega8e5
avrxmega4: atxmega64a3u, atxmega64a4u, atxmega64b1, atxmega64b3,
atxmega64c3, atxmega64d4
avrxmega6: atxmega128a3u, atxmega128b3, atxmega128c3,
atxmega128d4, atxmega192a3u, atxmega192c3, atxmega256a3u,
atxmega256c3, atxmega384c3, atxmega384d3
avrxmega7: atxmega128a4u
* doc/c-avr.texi: Ditto.

10 years agoPatch for PR binutils/16664 which triggers a seg-fault when attempting to
Nick Clifton [Thu, 6 Mar 2014 10:57:13 +0000 (10:57 +0000)]
Patch for PR binutils/16664 which triggers a seg-fault when attempting to
display the contents of a corrupt attribute section.

* readelf.c (process_attributes): Add checks for corrupt
attribute section names.

* elf-attrs.c (_bfd_elf_parse_attributes): Add checks for corrupt
attribute section names.

10 years agoRemove argument optional_p from get_tracepoint_by_number
Yao Qi [Sat, 22 Feb 2014 05:53:37 +0000 (13:53 +0800)]
Remove argument optional_p from get_tracepoint_by_number

This patch is to remove parameter optional_p as it is always true,
in order to simplify get_tracepoint_by_number.

'optional_p' was added by this change,

1999-11-18  Tom Tromey  <tromey@cygnus.com>

* tracepoint.h (get_tracepoint_by_number): Updated
declaration.
* tracepoint.c (trace_pass_command): Better error message.
Fixed logic when `all' not specified.
(get_tracepoint_by_number): Added `optional_p' argument.  Fixed
all callers.

but after this patch,

 FYI: remove `static's from cli-utils.c
 https://sourceware.org/ml/gdb-patches/2011-03/msg00636.html

'optional_p' passed to get_tracepoint_by_number become always true.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* breakpoint.c (get_tracepoint_by_number): Remove argument
optional_p.  All callers updated.  Adjust comments.  Update
output message.
* breakpoint.h (get_tracepoint_by_number): Update declaration.

10 years agoHandle parse number error in goto_bookmark_command
Yao Qi [Sat, 22 Feb 2014 06:42:12 +0000 (14:42 +0800)]
Handle parse number error in goto_bookmark_command

In GDB mainline, the error message for goto-bookmark
isn't perfect.

 (gdb) goto-bookmark 1.1
 goto-bookmark: no bookmark found for ''.

This patch tweaks the error message by checking the return value of
get_number.  With patch applied, it becomes:

 (gdb) goto-bookmark 1.1
 goto-bookmark: invalid bookmark number '1.1'.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* reverse.c (goto_bookmark_command): Add local 'p'.  Emit error
early if get_number returns zero.  Use 'p' instead of 'args'.

10 years agoAdd a newline in output messages
Yao Qi [Thu, 20 Feb 2014 09:35:31 +0000 (17:35 +0800)]
Add a newline in output messages

Hi,
GDB prints two warnings in one single line, as below:

 (gdb) p 1.2
 $1 = 1.2
 (gdb) enable $1.2
 History value must have integer type.Bad breakpoint number '$1'

This patch adds '\n' at the end of message.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* cli/cli-utils.c (get_number_trailer): Add '\n' at the end of
message.

10 years agoFix PR16508
Yao Qi [Sat, 15 Feb 2014 00:48:53 +0000 (08:48 +0800)]
Fix PR16508

This patch fixes PR16508, which is about MI "-trace-find frame-number 0"
behaves differently from CLI "tfind 0".  In CLI, we check both
status->running and status->filename, but in MI, we only check
status->running, which looks wrong to me.  This patch moves the code
of checking to a new function check_trace_running, and use it in
both CLI and MI.

This patch also adds a test case pr16508.exp, which fails without this
fix, and passes with the fix applied.

  FAIL: gdb.trace/pr16508.exp: interpreter-exec mi "-trace-find frame-number 0"

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

PR breakpoints/16508
* tracepoint.c (check_trace_running): New function.
(trace_find_command): Move code to check_trace_running and
call check_trace_running.
(trace_find_pc_command): Likewise.
(trace_find_tracepoint_command): Likewise.
(trace_find_line_command): Likewise.
(trace_find_range_command): Likewise.
* tracepoint.h (check_trace_running): Likewise.
* mi/mi-main.c (mi_cmd_trace_find): Call check_trace_running.

gdb/testsuite:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* gdb.trace/pr16508.exp: New file.

10 years agoChange the default implementation of to_traceframe_info to tcomplain
Yao Qi [Tue, 4 Mar 2014 09:39:10 +0000 (17:39 +0800)]
Change the default implementation of to_traceframe_info to tcomplain

This patch is to change the default implementation of to_traceframe_info
from 'return NULL' to tcomplain, which is intended.  If new target
supports tracepoint, this method should be implemented, otherwise,
an error is thrown.

gdb:

2014-03-06  Yao Qi  <yao@codesourcery.com>

* target.h (struct target_ops) <to_traceframe_info>: Use
TARGET_DEFAULT_NORETURN (tcomplain ()).
* target-delegates.c: Regenerated.

10 years agodaily update
Alan Modra [Wed, 5 Mar 2014 23:01:23 +0000 (09:31 +1030)]
daily update

10 years agoPR gdb/16575: stale breakpoint instructions in the code cache
Pedro Alves [Wed, 5 Mar 2014 14:18:28 +0000 (14:18 +0000)]
PR gdb/16575: stale breakpoint instructions in the code cache

In non-stop mode, or rather, breakpoints always-inserted mode, the
code cache can easily end up with stale breakpoint instructions:

All it takes is filling a cache line when breakpoints already exist in
that memory region, and then delete the breakpoint.

Vis. (from the new test):

 (gdb) set breakpoint always-inserted on
 (gdb) b 23
 Breakpoint 2 at 0x400540: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 23.
 (gdb) b 24
 Breakpoint 3 at 0x400547: file ../../../src/gdb/testsuite/gdb.base/breakpoint-shadow.c, line 24.
 disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

So far so good.  Now flush the code cache:

 (gdb) set code-cache off
 (gdb) set code-cache on

Requesting a disassembly works as expected, breakpoint shadowing is
applied:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

However, now delete the breakpoints:

 (gdb) delete
 Delete all breakpoints? (y or n) y

And disassembly shows the old breakpoint instructions:

 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     int3
    0x0000000000400541 <+5>:     rex.RB cld
    0x0000000000400543 <+7>:     add    %eax,(%rax)
    0x0000000000400545 <+9>:     add    %al,(%rax)
    0x0000000000400547 <+11>:    int3
    0x0000000000400548 <+12>:    rex.RB cld
    0x000000000040054a <+14>:    add    (%rax),%al
    0x000000000040054c <+16>:    add    %al,(%rax)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

Those breakpoint instructions are no longer installed in target memory
they're stale in the code cache.  Easily confirmed by just disabling
the code cache:

 (gdb) set code-cache off
 (gdb) disass main
 Dump of assembler code for function main:
    0x000000000040053c <+0>:     push   %rbp
    0x000000000040053d <+1>:     mov    %rsp,%rbp
 => 0x0000000000400540 <+4>:     movl   $0x1,-0x4(%rbp)
    0x0000000000400547 <+11>:    movl   $0x2,-0x4(%rbp)
    0x000000000040054e <+18>:    mov    $0x0,%eax
    0x0000000000400553 <+23>:    pop    %rbp
    0x0000000000400554 <+24>:    retq
 End of assembler dump.

I stumbled upon this when writing a patch to infrun.c, that made
handle_inferior_event & co fill in the cache before breakpoints were
removed from the target.  Recall that wait_for_inferior flushes the
dcache for every event.  So in that case, always-inserted mode was not
necessary to trigger this.  It's just a convenient way to expose the
issue.

The dcache works at the raw memory level.  We need to update it
whenever memory is written, no matter what kind of target memory
object was originally passed down by the caller.  The issue is that
the dcache update code isn't reached when a caller explicitly writes
raw memory.  Breakpoint insertion/removal is one such case --
mem-break.c uses target_write_read_memory/target_write_raw_memory.

The fix is to move the dcache update code from memory_xfer_partial_1
to raw_memory_xfer_partial so that it's always reachable.

When we do that, we can actually simplify a series of things.
memory_xfer_partial_1 no longer needs to handle writes for any kind of
memory object, and therefore dcache_xfer_memory no longer needs to
handle writes either.  So the latter (dcache_xfer_memory) and its
callees can be simplified to only care about reads.  While we're
touching dcache_xfer_memory's prototype, might as well rename it to
reflect that fact that it only handles reads, and make it follow the
new target_xfer_status/xfered_len style.  This made me notice that
dcache_xfer_memory loses the real error status if a memory read fails:
we could have failed to read due to TARGET_XFER_E_UNAVAILABLE, for
instance, but we always return TARGET_XFER_E_IO, hence the FIXME note.
I felt that fixing that fell out of the scope of this patch.

Currently dcache_xfer_memory handles the case of a write failing.  The
whole cache line is invalidated when that happens.  However,
dcache_update, the sole mechanism for handling writes that will remain
after the patch, does not presently handle that scenario.  That's a
bug.  The patch makes it handle that, by passing down the
target_xfer_status status from the caller, so that it can better
decide what to do itself.  While I was changing the function's
prototype, I constified the myaddr parameter, getting rid of the need
for the cast as seen in its existing caller.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2014-03-05  Pedro Alves  <palves@redhat.com>

PR gdb/16575
* dcache.c (dcache_poke_byte): Constify ptr parameter.  Return
void.  Update comment.
(dcache_xfer_memory): Delete.
(dcache_read_memory_partial): New, based on the read bits of
dcache_xfer_memory.
(dcache_update): Add status parameter.  Use ULONGEST for len, and
adjust.  Discard cache lines if the reason for the update was
error.
* dcache.h (dcache_xfer_memory): Delete declaration.
(dcache_read_memory_partial): New declaration.
(dcache_update): Update prototype.
* target.c (raw_memory_xfer_partial): Update the dcache here.
(memory_xfer_partial_1): Don't handle dcache writes here.

gdb/testsuite/
2014-03-05  Pedro Alves  <palves@redhat.com>

PR gdb/16575
* gdb.base/breakpoint-shadow.exp (compare_disassembly): New
procedure.
(top level): Adjust to use it.  Add tests that exercise breakpoint
interaction with the code-cache.

10 years agoUpdate copyright years
Alan Modra [Wed, 5 Mar 2014 11:46:15 +0000 (22:16 +1030)]
Update copyright years

10 years agoSupport R_PPC64_ADDR64_LOCAL
Alan Modra [Wed, 5 Mar 2014 09:27:39 +0000 (19:57 +1030)]
Support R_PPC64_ADDR64_LOCAL

This adds support for "func@localentry", an expression that returns the
ELFv2 local entry point address of function "func".  I've excluded
dynamic relocation support because that obviously would require glibc
changes.

include/elf/
* ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
bfd/
* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
(ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
(ppc64_elf_check_relocs): Likewise.
(ppc64_elf_relocate_section): Likewise.
* Add BFD_RELOC_PPC64_ADDR64_LOCAL.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Support @localentry.
(md_apply_fix): Support R_PPC64_ADDR64_LOCAL.
ld/testsuite/
* ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files.
* ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files.
* ld-powerpc/powerpc.exp: Run new test.
elfcpp/
* powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
gold/
* powerpc.cc (Target_powerpc::Scan::local, global): Support
R_PPC64_ADDR64_LOCAL.
(Target_powerpc::Relocate::relocate): Likewise.

10 years agoSupport more relocs on 16-bit insn fields
Alan Modra [Wed, 5 Mar 2014 09:01:45 +0000 (19:31 +1030)]
Support more relocs on 16-bit insn fields

This patch allows gas to assemble a testcase like
li 3,ext_sym
which oddly was not accepted while the following is OK:
li 3,ext_sym@l

* config/tc-ppc.c (md_assemble): Move code adjusting reloc types
later.  Merge absolute and relative branch reloc selection.
Generate 16-bit relocs for most 16-bit insn fields given a
non-constant expression.

10 years agoRemove magic treatment of toc symbols for powerpc ELF
Alan Modra [Wed, 5 Mar 2014 08:57:57 +0000 (19:27 +1030)]
Remove magic treatment of toc symbols for powerpc ELF

The XCOFF assembler does some wierd things with instructions like
`lwz 9,sym(30'.  See the comment in md_apply_fix.  From an ELF
perspective, it's weird even to magically select a TOC16 reloc
when a symbol is in the TOC/GOT.  ELF assemblers generally use
modifiers like @toc to select relocs, so remove this "feature"
for ELF.  I believe this was to support gcc -m32 -mcall-aixdesc
but that combination of gcc options has been broken for a long
time.

* config/tc-ppc.c (ppc_is_toc_sym): Remove OBJ_ELF support.
(md_assemble): Don't call ppc_is_toc_sym for ELF.

10 years agosim: constify prog_name
Mike Frysinger [Thu, 20 Feb 2014 05:13:48 +0000 (00:13 -0500)]
sim: constify prog_name

There's no need for the prog_name handed down to the core to be mutable,
so add const markings to it and all the related funcs.

10 years agodaily update
Alan Modra [Tue, 4 Mar 2014 23:01:07 +0000 (09:31 +1030)]
daily update

10 years agoFix changelog formatting in last commit -- sorry
Richard Sandiford [Tue, 4 Mar 2014 21:30:39 +0000 (21:30 +0000)]
Fix changelog formatting in last commit -- sorry

10 years agobfd/
Richard Sandiford [Tue, 4 Mar 2014 21:18:02 +0000 (21:18 +0000)]
bfd/
2014-02-04  Heiher <r@hev.cc>

* elfxx-mips.c (mips_set_isa_flags): Use E_MIPS_ARCH_64R2 for
Loongson-3A.
(mips_mach_extensions): Make bfd_mach_mips_loongson_3a an
extension of bfd_mach_mipsisa64r2.

opcodes/
2014-02-04  Heiher <r@hev.cc>

* mips-dis.c (mips_arch_choices): Usee ISA_MIPS64R2 for Loongson-3A.

gas/
2014-02-04  Heiher <r@hev.cc>

* config/tc-mips.c (mips_cpu_info_table): Use ISA_MIPS64R2 for
Loongson-3A.

10 years agoopcodes/
Richard Sandiford [Tue, 4 Mar 2014 21:16:38 +0000 (21:16 +0000)]
opcodes/
* mips-opc.c (mips_builtin_opcodes): Move the udi* instructions
so that they come after the Loongson extensions.

10 years agoRemove default-manifest from ALL_EMUL_EXTRA_BINARIES so that it is not mistakenly
Nick Clifton [Tue, 4 Mar 2014 17:22:46 +0000 (17:22 +0000)]
Remove default-manifest from ALL_EMUL_EXTRA_BINARIES so that it is not mistakenly
built when constructing a toolchain configued from all targets.

* Makefile.am (ALL_EMUL_EXTRA_BINARIES): Remove default-manifest.
* Makefile.in: Regenerate.

10 years agoInstall patch for PR ld/16017. This adds support for generating PLT entries
Nick Clifton [Tue, 4 Mar 2014 15:25:53 +0000 (15:25 +0000)]
Install patch for PR ld/16017.  This adds support for generating PLT entries
using Thumb2 instructions for those cores which do not support the ARM ISA.

* elf32-arm.c (elf32_thumb2_plt0_entry): New array.
(elf32_thumb2_plt_entry): New array.
(elf32_arm_create_dynamic_sections): Set PLT entry sizes when
using thumb2 based PLT.
(elf32_arm_populate_plt_entry): Handle generating Thumb2 based PLT
entries.
(elf32_arm_final_link_relocate): Do not bias jumps to Thumb based
PLT entries.
(elf32_arm_finish_dynamic_sections): Handle creation of Thumb2
based PLT 0-entry.
(elf32_arm_output_plt_map_1): Handle creation of local symbols for
Thumb2 based PLT 0-entry.
(elf32_arm_output_arch_local_syms): Handle creation of local
symbols for Thumb2 based PLT entries.

10 years agosim: convert old style prototypes
Mike Frysinger [Thu, 20 Feb 2014 03:29:37 +0000 (22:29 -0500)]
sim: convert old style prototypes

Most of these prototypes have been killed off, but we have a few left
in the sim tree.  Clean them up so we can enable the -W flag for it.

10 years agodaily update
Alan Modra [Mon, 3 Mar 2014 23:00:37 +0000 (09:30 +1030)]
daily update

10 years agomove probes to be per-bfd
Tom Tromey [Tue, 3 Dec 2013 17:21:20 +0000 (10:21 -0700)]
move probes to be per-bfd

This patch moves the probe data from the objfile to the per-BFD
object.  This lets the probes be shared between different inferiors
(and different objfiles when dlmopen is in use, should gdb ever handle
that).

2014-03-03  Tom Tromey  <tromey@redhat.com>

* elfread.c (probe_key): Change to bfd_data.
(elf_get_probes, probe_key_free, _initialize_elfread): Probes are
now per-BFD, not per-objfile.
* stap-probe.c (stap_probe_destroy): Update comment.
(handle_stap_probe): Allocate on the per-BFD obstack.

10 years agochange probes to be program-space-independent
Tom Tromey [Mon, 2 Dec 2013 20:58:59 +0000 (13:58 -0700)]
change probes to be program-space-independent

This changes the probes to be independent of the program space.

After this, when a probe's address is needed, it is determined by
applying offsets at the point of use.

This introduces a bound_probe object, similar to bound minimal
symbols.  Objects of this type are used when it's necessary to pass a
probe and its corresponding objfile.

This removes the backlink from probe to objfile, which was primarily
used to fetch the architecture to use.

This adds a get_probe_address function which calls a probe method to
compute the probe's relocated address.  Similarly, it adds an objfile
parameter to the semaphore methods so they can do the relocation
properly as well.

2014-03-03  Tom Tromey  <tromey@redhat.com>

* break-catch-throw.c (fetch_probe_arguments): Use bound probes.
* breakpoint.c (create_longjmp_master_breakpoint): Use
get_probe_address.
(add_location_to_breakpoint, bkpt_probe_insert_location)
(bkpt_probe_remove_location): Update.
* breakpoint.h (struct bp_location) <probe>: Now a bound_probe.
* elfread.c (elf_symfile_relocate_probe): Remove.
(elf_probe_fns): Update.
(insert_exception_resume_breakpoint): Change type of "probe"
parameter to bound_probe.
(check_exception_resume): Update.
* objfiles.c (objfile_relocate1): Don't relocate probes.
* probe.c (bound_probe_s): New typedef.
(parse_probes): Use get_probe_address.  Set sal's objfile.
(find_probe_by_pc): Return a bound_probe.
(collect_probes): Return a VEC(bound_probe_s).
(compare_probes): Update.
(gen_ui_out_table_header_info): Change type of "probes"
parameter.  Update.
(info_probes_for_ops): Update.
(get_probe_address): New function.
(probe_safe_evaluate_at_pc): Update.
* probe.h (struct probe_ops) <get_probe_address>: New field.
<set_semaphore, clear_semaphore>: Add objfile parameter.
(struct probe) <objfile>: Remove field.
<arch>: New field.
<address>: Update comment.
(struct bound_probe): New.
(find_probe_by_pc): Return a bound_probe.
(get_probe_address): Declare.
* solib-svr4.c (struct probe_and_action) <address>: New field.
(hash_probe_and_action, equal_probe_and_action): Update.
(register_solib_event_probe): Add address parameter.
(solib_event_probe_at): Update.
(svr4_create_probe_breakpoints): Add objfile parameter.  Use
get_probe_address.
* stap-probe.c (struct stap_probe) <sem_addr>: Update comment.
(stap_get_probe_address): New function.
(stap_can_evaluate_probe_arguments, compute_probe_arg)
(compile_probe_arg): Update.
(stap_set_semaphore, stap_clear_semaphore): Compute semaphore's
address.
(handle_stap_probe): Don't relocate the probe.
(stap_relocate): Remove.
(stap_gen_info_probes_table_values): Update.
(stap_probe_ops): Remove stap_relocate.
* symfile-debug.c (debug_sym_relocate_probe): Remove.
(debug_sym_probe_fns): Update.
* symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove.
* symtab.c (init_sal): Use memset.
* symtab.h (struct symtab_and_line) <objfile>: New field.
* tracepoint.c (start_tracing, stop_tracing): Update.

10 years agocomment fixes
Tom Tromey [Mon, 2 Dec 2013 18:12:15 +0000 (11:12 -0700)]
comment fixes

This fixes up a few mildly erroneous comments in probe.h.

2014-03-03  Tom Tromey  <tromey@redhat.com>

* probe.h (parse_probes, find_probe_by_pc)
(find_probes_in_objfile): Fix comments.

10 years agoThis patch enhances the MSP430 port of GAS so that, if requested, it will
Nick Clifton [Mon, 3 Mar 2014 17:27:55 +0000 (17:27 +0000)]
This patch enhances the MSP430 port of GAS so that, if requested, it will
generate warning messages about an instruction that changes the interrupt
state not being followed by a NOP instruction.

* config/msp430/msp430.c: Replace known mcu array with known
msp430 ISA mcu name array.
Accept any name for -mmcu option.
Add -mz option to warn about missing NOP following an interrupt
status change.
(check_for_nop): New.
(msp430_operands): Emit a warning, if requested, when an interrupt
changing instruction is not followed by a NOP.
* doc/c-msp430.c: Document -mz option.

* gas/msp430/bad.d: Add -mz option.
* gas/msp430/bad.s: Add more cases where warnings should be
generated.
* gas/msp430/bad.l: Add expected warning messages.

10 years agoMore copyright fixes
Alan Modra [Mon, 3 Mar 2014 03:11:34 +0000 (13:41 +1030)]
More copyright fixes

* config/obj-fdpicelf.c: Correct copyright date.
* config/obj-fdpicelf.h: Likewise.

10 years agoFix various copyright issues
Alan Modra [Sat, 1 Mar 2014 11:25:26 +0000 (21:55 +1030)]
Fix various copyright issues

binutils/
* README: Add "Copyright Notices" paragraph.
gas/
* config/bfin-lex-wrapper.c: Correct copyright date.
* config/tc-frv.c: Correct copyright punctuation.
* config/tc-ip2k.c: Likewise.
* config/tc-iq2000.c: Likewise.
* config/tc-mep.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic4x.h: Likewise.
ld/testsuite/
* ld-scripts/phdrs2.exp: Correct copyright punctuation.
* ld-v850/v850.exp: Correct copyright typo.
opcodes/
* i386-gen.c (process_copyright): Emit copyright notice on one line.
gold/
* dwp.cc (print_version): Update copyright year to current.

10 years agodaily update
Alan Modra [Sun, 2 Mar 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years ago* infrun.c (handle_signal_stop): Replace test for
Doug Evans [Sun, 2 Mar 2014 21:51:35 +0000 (16:51 -0500)]
* infrun.c (handle_signal_stop): Replace test for
TARGET_WAITKIND_STOPPED with an assert.

10 years agoguile/scm-objfile.c (ofscm_mark_objfile_smob): Fix typo in comment.
Doug Evans [Sun, 2 Mar 2014 18:30:46 +0000 (10:30 -0800)]
guile/scm-objfile.c (ofscm_mark_objfile_smob): Fix typo in comment.

10 years agoguile/lib/gdb/printing.scm (append-pretty-printer!): Fix thinko.
Doug Evans [Sun, 2 Mar 2014 17:17:46 +0000 (09:17 -0800)]
guile/lib/gdb/printing.scm (append-pretty-printer!): Fix thinko.

10 years agodaily update
Alan Modra [Sat, 1 Mar 2014 23:00:37 +0000 (09:30 +1030)]
daily update

10 years agoSilence ARI warning.
Mark Kettenis [Sat, 1 Mar 2014 16:13:47 +0000 (17:13 +0100)]
Silence ARI warning.

gdb/ChangeLog:

        * obsd-nat.c: Include "gdb_wait.h" instead of <sys/wait.h>.

10 years agoEnable rhreads support on OpenBSD/i386.
Mark Kettenis [Sat, 1 Mar 2014 14:29:34 +0000 (15:29 +0100)]
Enable rhreads support on OpenBSD/i386.

gdb/ChangeLog:

        * i386obsd-nat.c: Include "obsd-nat.h".
        (_initialize_i386obsd_nat): Call obsd_add_target instead of
        add_target.
        * config/i386/obsd.mh (NATDEPFILES): Add obsd-nat.o.

10 years agoEliminate pointer signedness warning.
Mark Kettenis [Sat, 1 Mar 2014 12:06:49 +0000 (13:06 +0100)]
Eliminate pointer signedness warning.

gdb/ChangeLog:

        * i386obsd-nat.c (i386obsd_supply_pcb): Cast 'sf' to 'gdb_byte *'.

10 years agold-arm/long-plt-format.d, ld-arm/arm-elf.exp: Adjust for arm-eabi.
Yuri Gribov [Sat, 1 Mar 2014 11:19:53 +0000 (12:19 +0100)]
ld-arm/long-plt-format.d, ld-arm/arm-elf.exp: Adjust for arm-eabi.

10 years agoFix ChangeLog.
Mark Kettenis [Sat, 1 Mar 2014 11:03:30 +0000 (12:03 +0100)]
Fix ChangeLog.

10 years agoEnable rthreads support on OpenBSD/mips64.
Mark Kettenis [Sat, 1 Mar 2014 11:00:19 +0000 (12:00 +0100)]
Enable rthreads support on OpenBSD/mips64.

gdb/ChangeLog:

        * mips64obsd-nat.c: Include "obsd-nath".
        (_initialize_mips64obsd_nat): Call obsd_add_target instead of
        add_target
        * config/mips/obsd64.mh (NATDEPFILES): Add obsd-nat.o.

10 years agoEnable rthreads support on OpenBSD/amd64.
Mark Kettenis [Sat, 1 Mar 2014 10:49:58 +0000 (11:49 +0100)]
Enable rthreads support on OpenBSD/amd64.

gdb/ChangeLog:

        * amd64obsd-nat.c (_initialize_amd64obsd_nat): Call
        obsd_add_target instead of add_target.
        * config/i386/obsd64.mh (NATDEPFILES): Add obsd-nat.o.

10 years ago * config/tc-avr.c: Remove atxmega16x1.
Denis Chertykov [Sat, 1 Mar 2014 09:12:49 +0000 (13:12 +0400)]
* config/tc-avr.c: Remove atxmega16x1.

10 years agoRemove the unnecesary argument METHOD to valops.c:find_oload_champ.
Siva Chandra [Thu, 27 Feb 2014 13:51:46 +0000 (05:51 -0800)]
Remove the unnecesary argument METHOD to valops.c:find_oload_champ.

* valops.c (find_oload_champ): Remove unneccesary argument METHOD.
(find_overload_match): Update call to find_oload_champ.
(find_oload_champ_namespace_loop): Likewise

10 years agodaily update
Alan Modra [Fri, 28 Feb 2014 23:01:08 +0000 (09:31 +1030)]
daily update

10 years agoAdd sparc64obsd-nat.c to ALLDEPFILES.
Mark Kettenis [Fri, 28 Feb 2014 22:20:57 +0000 (23:20 +0100)]
Add sparc64obsd-nat.c to ALLDEPFILES.

gdb/ChangeLog:

        * Makefile.in (ALLDEPFILES): Add sparc64obsd-nat.c.

10 years agoEnable rthreads supports on OpenBSD/sparc64.
Mark Kettenis [Fri, 28 Feb 2014 22:06:14 +0000 (23:06 +0100)]
Enable rthreads supports on OpenBSD/sparc64.

gdb/ChangeLog:

        * configure.host (sparc64-*-openbsd*): Set gdb_host to obsd64.
        * config/sparc/obsd64.mh: New file.
        * sparc64obsd-nat.c: New file.

10 years agoStupid git never fucking does what I want!
Mark Kettenis [Fri, 28 Feb 2014 21:58:57 +0000 (22:58 +0100)]
Stupid git never fucking does what I want!