binutils-gdb.git
10 years agoAdd target_ops argument to to_remove_vfork_catchpoint
Tom Tromey [Wed, 18 Dec 2013 04:32:29 +0000 (21:32 -0700)]
Add target_ops argument to to_remove_vfork_catchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_remove_vfork_catchpoint>: Add
argument.
(target_remove_vfork_catchpoint): Add argument.
* target.c (debug_to_remove_vfork_catchpoint): Add argument.
(update_current_target): Update.
* linux-nat.c (linux_child_remove_vfork_catchpoint): Add 'self'
argument.

10 years agoAdd target_ops argument to to_insert_vfork_catchpoint
Tom Tromey [Wed, 18 Dec 2013 04:32:17 +0000 (21:32 -0700)]
Add target_ops argument to to_insert_vfork_catchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_insert_vfork_catchpoint>: Add
argument.
(target_insert_vfork_catchpoint): Add argument.
* target.c (debug_to_insert_vfork_catchpoint): Add argument.
(update_current_target): Update.
* linux-nat.c (linux_child_insert_vfork_catchpoint): Add 'self'
argument.

10 years agoAdd target_ops argument to to_remove_fork_catchpoint
Tom Tromey [Wed, 18 Dec 2013 04:32:05 +0000 (21:32 -0700)]
Add target_ops argument to to_remove_fork_catchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_remove_fork_catchpoint>: Add
argument.
(target_remove_fork_catchpoint): Add argument.
* target.c (debug_to_remove_fork_catchpoint): Add argument.
(update_current_target): Update.
* linux-nat.c (linux_child_remove_fork_catchpoint): Add 'self'
argument.

10 years agoAdd target_ops argument to to_insert_fork_catchpoint
Tom Tromey [Wed, 18 Dec 2013 04:31:52 +0000 (21:31 -0700)]
Add target_ops argument to to_insert_fork_catchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_insert_fork_catchpoint>: Add
argument.
(target_insert_fork_catchpoint): Add argument.
* target.c (debug_to_insert_fork_catchpoint): Add argument.
(update_current_target): Update.
* linux-nat.c (linux_child_insert_fork_catchpoint): Add 'self'
argument.

10 years agoAdd target_ops argument to to_post_startup_inferior
Tom Tromey [Wed, 18 Dec 2013 04:31:40 +0000 (21:31 -0700)]
Add target_ops argument to to_post_startup_inferior

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_post_startup_inferior>: Add
argument.
(target_post_startup_inferior): Add argument.
* target.c (debug_to_post_startup_inferior): Add argument.
(update_current_target): Update.
* spu-linux-nat.c (spu_child_post_startup_inferior): Add 'self'
argument.
* linux-nat.c (linux_child_post_startup_inferior): Add 'self'
argument.
* inf-ptrace.c (inf_ptrace_post_startup_inferior): Add 'self'
argument.
* inf-child.c (inf_child_post_startup_inferior): Add 'self'
argument.
* i386-linux-nat.c (i386_linux_child_post_startup_inferior): Add
'self' argument.
(super_post_startup_inferior): Likewise.
* amd64-linux-nat.c (amd64_linux_child_post_startup_inferior): Add
'self' argument.
(super_post_startup_inferior): Likewise.
* aarch64-linux-nat.c (aarch64_linux_child_post_startup_inferior):
Add 'self' argument.
(super_post_startup_inferior): Likewise.

10 years agoAdd target_ops argument to to_load
Tom Tromey [Wed, 18 Dec 2013 04:31:27 +0000 (21:31 -0700)]
Add target_ops argument to to_load

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_load>: Add argument.
* target.c (target_load): Add argument.
(debug_to_load): Add argument.
(update_current_target): Update.
* remote.c (remote_load): Add 'self' argument.
* remote-sim.c (gdbsim_load): Add 'self' argument.
* remote-mips.c (mips_load): Add 'self' argument.
* remote-m32r-sdi.c (m32r_load): Add 'self' argument.
* monitor.c (monitor_load): Add 'self' argument.
* m32r-rom.c (m32r_load_gen): Add 'self' argument.

10 years agoAdd target_ops argument to to_terminal_info
Tom Tromey [Wed, 18 Dec 2013 04:31:14 +0000 (21:31 -0700)]
Add target_ops argument to to_terminal_info

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_terminal_info>: Add argument.
(target_terminal_info): Add argument.
* target.c (debug_to_terminal_info): Add argument.
(default_terminal_info): Likewise.
* inflow.c (child_terminal_info): Add 'self' argument.
* inferior.h (child_terminal_info): Add 'self' argument.
* go32-nat.c (go32_terminal_info): Add 'self' argument.

10 years agoAdd target_ops argument to to_terminal_save_ours
Tom Tromey [Wed, 18 Dec 2013 04:31:01 +0000 (21:31 -0700)]
Add target_ops argument to to_terminal_save_ours

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_terminal_save_ours>: Add
argument.
(target_terminal_save_ours): Add argument.
* target.c (debug_to_terminal_save_ours): Add argument.
(update_current_target): Update.
* inflow.c (terminal_save_ours): Add 'self' argument.
* inferior.h (terminal_save_ours): Add 'self' argument.

10 years agoAdd target_ops argument to to_terminal_ours
Tom Tromey [Wed, 18 Dec 2013 04:30:49 +0000 (21:30 -0700)]
Add target_ops argument to to_terminal_ours

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_terminal_ours>: Add argument.
(target_terminal_ours): Add argument.
* target.c (debug_to_terminal_ours): Add argument.
(update_current_target): Update.
* remote.c (remote_terminal_ours): Add 'self' argument.
(remote_close): Update.
* linux-nat.c (linux_nat_terminal_ours): Add 'self' argument.
* inflow.c (terminal_ours): Add 'self' argument.
* inferior.h (terminal_ours): Add 'self' argument.
* go32-nat.c (go32_terminal_ours): Add 'self' argument.

10 years agoAdd target_ops argument to to_terminal_ours_for_output
Tom Tromey [Wed, 18 Dec 2013 04:30:36 +0000 (21:30 -0700)]
Add target_ops argument to to_terminal_ours_for_output

2014-02-19  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_terminal_ours_for_output>: Add
argument.
(target_terminal_ours_for_output): Add argument.
* target.c (debug_to_terminal_ours_for_output): Add argument.
(update_current_target): Update.
* inflow.c (terminal_ours_for_output): Add 'self' argument.
* inferior.h (terminal_ours_for_output): Add 'self' argument.
* go32-nat.c (go32_terminal_ours): Add 'self' argument.

10 years agoAdd target_ops argument to to_terminal_inferior
Tom Tromey [Wed, 18 Dec 2013 04:30:23 +0000 (21:30 -0700)]
Add target_ops argument to to_terminal_inferior

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_terminal_inferior>: Add
argument.
* target.c (target_terminal_inferior): Add argument.
(update_current_target): Update.
* remote.c (remote_terminal_inferior): Add 'self' argument.
* linux-nat.c (linux_nat_terminal_inferior): Add 'self' argument.
* inflow.c (terminal_inferior): Add 'self' argument.
* inferior.h (terminal_inferior): Add 'self' argument.
* go32-nat.c (go32_terminal_inferior): Add 'self' argument.
(go32_terminal_inferior): Add 'self' argument.

10 years agoAdd target_ops argument to to_terminal_init
Tom Tromey [Wed, 18 Dec 2013 04:30:10 +0000 (21:30 -0700)]
Add target_ops argument to to_terminal_init

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_terminal_init>: Add argument.
(target_terminal_init): Add argument.
* target.c (debug_to_terminal_init): Add argument.
(update_current_target): Update.
* inflow.c (terminal_init_inferior): Add 'self' argument.
* inferior.h (terminal_init_inferior): Add 'self' argument.
* go32-nat.c (go32_terminal_init): Add 'self' argument.
* gnu-nat.c (gnu_terminal_init_inferior): Add 'self' argument.

10 years agoAdd target_ops argument to to_can_accel_watchpoint_condition
Tom Tromey [Wed, 18 Dec 2013 04:29:57 +0000 (21:29 -0700)]
Add target_ops argument to to_can_accel_watchpoint_condition

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops)
<to_can_accel_watchpoint_condition>: Add argument.
(target_can_accel_watchpoint_condition): Add argument.
* target.c (debug_to_can_accel_watchpoint_condition): Add
argument.
(update_current_target): Update.
* ppc-linux-nat.c (ppc_linux_can_accel_watchpoint_condition): Add
'self' argument.

10 years agoAdd target_ops argument to to_region_ok_for_hw_watchpoint
Tom Tromey [Wed, 18 Dec 2013 04:29:45 +0000 (21:29 -0700)]
Add target_ops argument to to_region_ok_for_hw_watchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_region_ok_for_hw_watchpoint>:
Add argument.
(target_region_ok_for_hw_watchpoint): Add argument.
* target.c (debug_to_region_ok_for_hw_watchpoint): Add argument.
(default_region_ok_for_hw_watchpoint): Add argument.
* spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Add argument.
* s390-linux-nat.c (s390_region_ok_for_hw_watchpoint): Add 'self'
argument.
* remote.c (remote_region_ok_for_hw_watchpoint): Add 'self'
argument.
* procfs.c (procfs_region_ok_for_hw_watchpoint): Add 'self'
argument.
* ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Add
'self' argument.
* mips-linux-nat.c (mips_linux_region_ok_for_hw_watchpoint): Add
'self' argument.
* inf-ttrace.c (inf_ttrace_region_ok_for_hw_watchpoint): Add
'self' argument.
* i386-nat.c (i386_region_ok_for_watchpoint): Add 'self' argument.
* arm-linux-nat.c (arm_linux_region_ok_for_hw_watchpoint): Add
'self' argument.
* aarch64-linux-nat.c (aarch64_linux_region_ok_for_hw_watchpoint):
Add 'self' argument.

10 years agoAdd target_ops argument to to_insert_watchpoint
Tom Tromey [Wed, 18 Dec 2013 04:29:31 +0000 (21:29 -0700)]
Add target_ops argument to to_insert_watchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_insert_watchpoint>: Add
argument.
(target_insert_watchpoint): Add argument.
* target.c (debug_to_insert_watchpoint): Add argument.
(update_current_target): Update.
* s390-linux-nat.c (s390_insert_watchpoint): Add 'self' argument.
* remote.c (remote_insert_watchpoint): Add 'self' argument.
* remote-mips.c (mips_insert_watchpoint): Add 'self' argument.
* remote-m32r-sdi.c (m32r_insert_watchpoint): Add 'self' argument.
* procfs.c (procfs_insert_watchpoint): Add 'self' argument.
* ppc-linux-nat.c (ppc_linux_insert_watchpoint): Add 'self'
argument.
* nto-procfs.c (procfs_insert_hw_watchpoint): Add 'self' argument.
(procfs_insert_hw_watchpoint): Add 'self' argument.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Add 'self'
argument.
* inf-ttrace.c (inf_ttrace_insert_watchpoint): Add 'self'
argument.
* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Add 'self'
argument.
* i386-nat.c (i386_insert_watchpoint): Add 'self' argument.
* arm-linux-nat.c (arm_linux_insert_watchpoint): Add 'self'
argument.
* aarch64-linux-nat.c (aarch64_linux_insert_watchpoint): Add
'self' argument.

10 years agoAdd target_ops argument to to_remove_watchpoint
Tom Tromey [Wed, 18 Dec 2013 04:29:17 +0000 (21:29 -0700)]
Add target_ops argument to to_remove_watchpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_remove_watchpoint>: Add
argument.
(target_remove_watchpoint): Add argument.
* target.c (debug_to_remove_watchpoint): Add argument.
(update_current_target): Update.
* s390-linux-nat.c (s390_remove_watchpoint): Add 'self' argument.
* remote.c (remote_remove_watchpoint): Add 'self' argument.
* remote-mips.c (mips_remove_watchpoint): Add 'self' argument.
* remote-m32r-sdi.c (m32r_remove_watchpoint): Add 'self' argument.
* procfs.c (procfs_remove_watchpoint): Add 'self' argument.
* ppc-linux-nat.c (ppc_linux_remove_watchpoint): Add 'self'
argument.
* nto-procfs.c (procfs_remove_hw_watchpoint): Add 'self' argument.
* mips-linux-nat.c (mips_linux_remove_watchpoint): Add 'self'
argument.
* inf-ttrace.c (inf_ttrace_remove_watchpoint): Add 'self'
argument.
* ia64-linux-nat.c (ia64_linux_remove_watchpoint): Add 'self'
argument.
* i386-nat.c (i386_remove_watchpoint): Add 'self' argument.
* arm-linux-nat.c (arm_linux_remove_watchpoint): Add 'self'
argument.
* aarch64-linux-nat.c (aarch64_linux_remove_watchpoint): Add
'self' argument.

10 years agoAdd target_ops argument to to_remove_hw_breakpoint
Tom Tromey [Wed, 18 Dec 2013 04:29:03 +0000 (21:29 -0700)]
Add target_ops argument to to_remove_hw_breakpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_remove_hw_breakpoint>: Add
argument.
(target_remove_hw_breakpoint): Add argument.
* target.c (debug_to_remove_hw_breakpoint): Add argument.
(update_current_target): Update.
* remote.c (remote_remove_hw_breakpoint): Add 'self' argument.
* ppc-linux-nat.c (ppc_linux_remove_hw_breakpoint): Add 'self'
argument.
* i386-nat.c (i386_remove_hw_breakpoint): Add 'self' argument.
* arm-linux-nat.c (arm_linux_remove_hw_breakpoint): Add 'self'
argument.
* aarch64-linux-nat.c (aarch64_linux_remove_hw_breakpoint): Add
'self' argument.

10 years agoAdd target_ops argument to to_insert_hw_breakpoint
Tom Tromey [Wed, 18 Dec 2013 04:28:50 +0000 (21:28 -0700)]
Add target_ops argument to to_insert_hw_breakpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_insert_hw_breakpoint>: Add
argument.
(target_insert_hw_breakpoint): Add argument.
* target.c (debug_to_insert_hw_breakpoint): Add argument.
(update_current_target): Update.
* remote.c (remote_insert_hw_breakpoint): Add 'self' argument.
* ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint): Add 'self'
argument.
* nto-procfs.c (procfs_insert_hw_breakpoint): Add 'self' argument.
* i386-nat.c (i386_insert_hw_breakpoint): Add 'self' argument.
* arm-linux-nat.c (arm_linux_insert_hw_breakpoint): Add 'self'
argument.
* aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Add
'self' argument.

10 years agoAdd target_ops argument to to_can_use_hw_breakpoint
Tom Tromey [Wed, 18 Dec 2013 04:28:37 +0000 (21:28 -0700)]
Add target_ops argument to to_can_use_hw_breakpoint

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_can_use_hw_breakpoint>: Add
argument.
(target_can_use_hardware_watchpoint): Add argument.
* target.c (debug_to_can_use_hw_breakpoint): Add argument.
(update_current_target): Update.
* spu-linux-nat.c (spu_can_use_hw_breakpoint): Add 'self'
argument.
* s390-linux-nat.c (s390_can_use_hw_breakpoint): Add 'self'
argument.
* remote.c (remote_check_watch_resources): Add 'self' argument.
* remote-mips.c (mips_can_use_watchpoint): Add 'self' argument.
* remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Add 'self'
argument.
* procfs.c (procfs_can_use_hw_breakpoint): Add 'self' argument.
* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Add 'self'
argument.
* nto-procfs.c (procfs_can_use_hw_breakpoint): Add 'self'
argument.
* mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Add 'self'
argument.
* inf-ttrace.c (inf_ttrace_can_use_hw_breakpoint): Add 'self'
argument.
* ia64-linux-nat.c (ia64_linux_can_use_hw_breakpoint): Add 'self'
argument.
* ia64-hpux-nat.c (ia64_hpux_can_use_hw_breakpoint): Add 'self'
argument.
* i386-nat.c (i386_can_use_hw_breakpoint): Add 'self' argument.
* arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Add 'self'
argument.
* aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Add
'self' argument.

10 years agoAdd target_ops argument to to_post_attach
Tom Tromey [Wed, 18 Dec 2013 04:28:08 +0000 (21:28 -0700)]
Add target_ops argument to to_post_attach

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_post_attach>: Add argument.
(target_post_attach): Add argument.
* target.c (debug_to_post_attach): Add argument.
(update_current_target): Update.
* spu-linux-nat.c (spu_child_post_attach): Add 'self' argument.
* nto-procfs.c (procfs_post_attach): Add 'self' argument.
* linux-nat.c (linux_child_post_attach): Add 'self' argument.
* inf-ptrace.c (inf_ptrace_post_attach): Add 'self' argument.
* inf-child.c (inf_child_post_attach): Add 'self' argument.

10 years agoAdd target_ops argument to to_close
Tom Tromey [Wed, 18 Dec 2013 04:27:56 +0000 (21:27 -0700)]
Add target_ops argument to to_close

2014-02-19  Tom Tromey  <tromey@redhat.com>

* windows-nat.c (windows_close): Add 'self' argument.
* tracepoint.c (tfile_close): Add 'self' argument.
* target.h (struct target_ops) <to_close>: Add argument.
* target.c (target_close): Add argument.
(update_current_target): Update.
* remote.c (remote_close): Add 'self' argument.
* remote-sim.c (gdbsim_close): Add 'self' argument.
* remote-mips.c (mips_close): Add 'self' argument.
* remote-m32r-sdi.c (m32r_close): Add 'self' argument.
* record-full.c (record_full_close): Add 'self' argument.
* record-btrace.c (record_btrace_close): Add 'self' argument.
* monitor.h (monitor_close): Add 'self' argument.
* monitor.c (monitor_close): Add 'self' argument.
* mips-linux-nat.c (mips_linux_close): Add 'self' argument.
* linux-nat.c (linux_nat_close): Add argument.
* go32-nat.c (go32_close): Add 'self' argument.
* exec.c (exec_close_1): Add 'self' argument.
* ctf.c (ctf_close): Add 'self' argument.
* corelow.c (core_close): Add 'self' argument.
(core_close_cleanup): Update.
* bsd-uthread.c (bsd_uthread_close): Add 'self' argument.
* bsd-kvm.c (bsd_kvm_close): Add 'self' argument.

10 years agointroduce remote_load
Tom Tromey [Wed, 18 Dec 2013 04:21:17 +0000 (21:21 -0700)]
introduce remote_load

I used a refactoring script to add target_ops arguments to all the
target methods.  In order to make this script work a little better,
this patch adds a new "remote_load" function; this eliminates the need
to later change the signature of generic_load.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* remote.c (remote_load): New function.
(init_remote_ops): Use it.

10 years agoconvert to_supports_btrace
Tom Tromey [Fri, 13 Dec 2013 20:26:04 +0000 (13:26 -0700)]
convert to_supports_btrace

This adds a "self" argument to to_supports_btrace.  Due to how one
implementation of this method is shared with gdbserver this required a
small change to gdbserver as well.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* common/linux-btrace.c (linux_supports_btrace): Add "ops"
argument.
* common/linux-btrace.h (linux_supports_btrace): Update.
* remote.c (remote_supports_btrace): Add "self" argument.
* target-delegates.c: Rebuild.
* target.c (target_supports_btrace): Remove.
* target.h (struct target_ops) <to_supports_btrace>: Add
target_ops argument.
(target_supports_btrace): New define.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <supports_btrace>: Add target_ops
argument.
(target_supports_btrace): Update.

10 years agoadd target method delegation
Tom Tromey [Fri, 12 Jul 2013 19:00:34 +0000 (13:00 -0600)]
add target method delegation

This patch replaces some code in the record targets with target method
delegation.

record-full.c stores pointers to many target methods when the record
target is pushed.  Then it later delegates some calls via these.  This
is wrong because it violates the target stack contract.  In particular
it is ok to unpush a target at any stratum, but record-full does not
keep track of this, so it could potentially call into an unpushed
target.

This patch fixes the problem by using the newly-introduced generic
approach to target delegation for the methods in question.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* record-full.c (record_full_beneath_to_resume_ops)
(record_full_beneath_to_resume, record_full_beneath_to_wait_ops)
(record_full_beneath_to_wait)
(record_full_beneath_to_store_registers_ops)
(record_full_beneath_to_store_registers)
(record_full_beneath_to_xfer_partial_ops)
(record_full_beneath_to_xfer_partial)
(record_full_beneath_to_insert_breakpoint_ops)
(record_full_beneath_to_insert_breakpoint)
(record_full_beneath_to_remove_breakpoint_ops)
(record_full_beneath_to_remove_breakpoint)
(record_full_beneath_to_stopped_by_watchpoint)
(record_full_beneath_to_stopped_data_address)
(record_full_beneath_to_async, tmp_to_resume_ops, tmp_to_resume)
(tmp_to_wait_ops, tmp_to_wait, tmp_to_store_registers_ops)
(tmp_to_store_registers, tmp_to_xfer_partial_ops)
(tmp_to_xfer_partial, tmp_to_instmp_to_insert_breakpoint_ops)
(tmp_to_insert_breakpoint, tmp_to_remove_breakpoint_ops)
(tmp_to_remove_breakpoint, tmp_to_stopped_by_watchpoint)
(tmp_to_stopped_data_address, tmp_to_async): Remove.
(record_full_open_1, record_full_open): Update.  Use RECORD_IS_USED.
(record_full_resume, record_full_wait_1)
(record_full_stopped_by_watchpoint, record_full_stopped_data_address)
(record_full_store_registers, record_full_xfer_partial)
(record_full_insert_breakpoint, record_full_remove_breakpoint)
(record_full_async, record_full_core_xfer_partial): Use target
delegation.
* target-delegates.c: Rebuild.
* target.c (current_xfer_partial): Remove.
(update_current_target): Do not INHERIT or de_fault
to_insert_breakpoint, to_remove_breakpoint,
to_stopped_data_address, to_stopped_by_watchpoint, to_can_async_p,
to_is_async_p, to_async.  Do not set to_xfer_partial field.
(default_xfer_partial): Simplify.
(current_xfer_partial): Remove.
(target_wait, target_resume): Simplify.
(find_default_can_async_p, find_default_is_async_p): Update.
(init_dummy_target): Don't set to_can_async_p, to_is_async_p,
to_xfer_partial, to_stopped_by_watchpoint,
to_stopped_data_address.
(target_store_registers): Simplify.
(forward_target_remove_breakpoint)
(forward_target_insert_breakpoint): Remove.
(target_remove_breakpoint, target_insert_breakpoint)
(debug_to_insert_breakpoint, debug_to_remove_breakpoint): Update.
* target.h (struct target_ops) <to_resume, to_wait,
to_store_registers, to_insert_breakpoint, to_remove_breakpoint,
to_stopped_by_watchpoint, to_stopped_data_address, to_can_async_p,
to_is_async_p, to_async, to_xfer_partial>: Add TARGET_DEFAULT
markup.
(forward_target_remove_breakpoint)
(forward_target_insert_breakpoint): Remove.
* record-btrace.c (record_btrace_remove_breakpoint): Delegate
directly.
(record_btrace_insert_breakpoint): Delegate directly.

10 years agoadd make-target-delegates
Tom Tromey [Thu, 19 Dec 2013 16:38:11 +0000 (09:38 -0700)]
add make-target-delegates

This patch adds a new script, call make-target-delegates, which
auto-generates some target delegation code based on annotations in
target.h.  This adds the new delegation macros, the new generated
file, and adds the necessary calls to the new generated functions to
target.c.  It doesn't, however, add any actual annotations to the
target methods, leaving these for separate patches.

2014-02-19  Tom Tromey  <tromey@redhat.com>

PR build/7701:
* target-delegates.c: New file.
* target.c: Include target-delegates.c.
(init_dummy_target): Call install_dummy_methods.
(complete_target_initialization): Call install_delegators.
* target.h (TARGET_DEFAULT_IGNORE, TARGET_DEFAULT_NORETURN)
(TARGET_DEFAULT_RETURN, TARGET_DEFAULT_FUNC): New defines.
* make-target-delegates: New file.

10 years agointroduce and use find_target_at
Tom Tromey [Mon, 28 Oct 2013 18:16:24 +0000 (12:16 -0600)]
introduce and use find_target_at

This patch adds find_target_at to determine whether a target appears
at a given stratum.  This new function lets us clean up
find_record_target a bit, and is generally useful.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* record.c (find_record_target): Use find_target_at.
* target.c (find_target_at): New function.
* target.h (find_target_at): Declare.

10 years agoadd "this" pointers to more target APIs
Tom Tromey [Tue, 30 Jul 2013 16:36:07 +0000 (10:36 -0600)]
add "this" pointers to more target APIs

A subsequent pass introduces delegation helper functions to the target
API.  This delegation is much cleaner if the target_ops pointer is
directly available at delegation time.

This patch adds the "this" pointer to various to_* methods for this
purpose.

This updates a number of ports which I am unable to test.  Please give
them a look-over.  Any possible problem here is trivial, though, as
all that is required is adding an argument to a function.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint):
Add 'ops' argument.
* arm-linux-nat.c (arm_linux_stopped_by_watchpoint): Add
'ops' argument.
* i386-nat.c (i386_stopped_by_watchpoint): Add 'ops' argument.
* ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Add
'ops' argument.
* inf-ttrace.c (inf_ttrace_stopped_by_watchpoint): Add 'ops'
argument.
* linux-nat.c (save_sigtrap): Update.
(linux_nat_stopped_by_watchpoint, linux_nat_is_async_p)
(linux_nat_can_async_p, linux_nat_async): Add 'ops' argument.
(linux_nat_close): Update.
* mips-linux-nat.c (mips_linux_stopped_by_watchpoint): Add 'ops'
argument.
* ppc-linux-nat.c (ppc_linux_stopped_by_watchpoint): Add 'ops'
argument.
* procfs.c (procfs_stopped_by_watchpoint): Add 'ops' argument.
* record-full.c (record_full_beneath_to_stopped_by_watchpoint)
(record_full_beneath_to_async, tmp_to_stopped_by_watchpoint)
(tmp_to_async): Add 'ops' argument.
(record_full_stopped_by_watchpoint, record_full_async)
(record_full_can_async_p, record_full_is_async_p): Add 'ops'
argument.
* remote-m32r-sdi.c (m32r_insert_breakpoint, m32r_remove_breakpoint)
(m32r_stopped_by_watchpoint): Add 'ops' argument.
* remote-mips.c (mips_stopped_by_watchpoint): Add 'ops' argument.
* remote.c (remote_stopped_by_watchpoint_p, remote_can_async_p)
(remote_is_async_p, remote_async): Add 'ops' argument.
(remote_stopped_data_address): Update.
* s390-nat.c (s390_stopped_by_watchpoint): Add 'ops' argument.
* target.c (update_current_target)
(find_default_can_async_p, find_default_is_async_p): Update.
(init_dummy_target): Update.
(debug_to_stopped_by_watchpoint): Add 'ops' argument.
* target.h (struct target_ops) <to_stopped_by_watchpoint,
to_can_async_p, to_is_async_p, to_async>: Add 'ops' argument.
(target_can_async_p, target_is_async_p, target_async)
(target_stopped_by_watchpoint): Update.

10 years agoControl powerpc64-ld provision of register save/restore
Alan Modra [Wed, 19 Feb 2014 03:53:12 +0000 (14:23 +1030)]
Control powerpc64-ld provision of register save/restore

This patch allows the user to override powerpc64-ld's default for
providing linker generated register save and restore functions as used
by gcc -Os code.  Normally these are not provided by ld -r, so Linux
kernel modules have needed to include their own copies.

bfd/
* elf64-ppc.h (struct ppc64_elf_params): Add save_restore_funcs.
* elf64-ppc.c (ppc64_elf_func_desc_adjust): Use it to control
provision of out-of-line register save/restore routines.
ld/
* emultempl/ppc64elf.em (params): Init new field.
(ppc_create_output_section_statements): Set params.save_restore_funcs
default.
(PARSE_AND_LIST_*): Add support for --save-restore-funcs and
--no-save-restore-funcs.

10 years agoFix PR16220
Yao Qi [Tue, 18 Feb 2014 06:57:03 +0000 (14:57 +0800)]
Fix PR16220

This patch removes startup_gdbarch because it is not used anymore.
After this patch,

 [PATCH] Multi-process + multi-arch: GDB
 https://sourceware.org/ml/gdb-patches/2012-11/msg00228.html

global variable target_gdbarch is removed and gdbarch becomes
per-inferior.  Then, we don't have to keep global variable
startup_gdbarch.

Rebuild GDB with all targets.  Is it OK?

gdb:

2014-02-18  Yao Qi  <yao@codesourcery.com>

PR gdb/16220
* gdbarch.sh: Remove startup_gdbarch.
* gdbarch.c: Regenerated.
* gdbarch.h: Likewise.

10 years agoThe PT_DYNAMIC segment was being hard coded to have read, write, and
Jack Carter [Wed, 19 Feb 2014 00:23:48 +0000 (16:23 -0800)]
The PT_DYNAMIC segment was being hard coded to have read, write, and
execute permission regardless of the underlying PT_LOAD segment permissions.
Deleting this code allows the default linker behavior which is to set the
dynamic segment to the same permissions as the sections that make it up.

This change alters one existing test case to check the segment flags for
PT_DYNAMIC.

bfd/ChangeLog
        * elfxx-mips.c(_bfd_mips_elf_modify_segment_map): Deleted hard coding of
        PT_DYNAMIC segment flags.

ld/testsuite/ChangeLog
* ld-mips-elf/pic-and-nonpic-3a.sd: Check DYNAMIC segment flags.

10 years agoNew TESTS variable to run a subset of tests in parallel.
Doug Evans [Wed, 19 Feb 2014 00:11:02 +0000 (16:11 -0800)]
New TESTS variable to run a subset of tests in parallel.

* Makefile.in (TESTS): New variable.
(expanded_tests, expanded_tests_or_none): New variables
(check-single): Pass $(expanded_tests_or_none) to runtest.
(check-parallel): Only run tests in $(TESTS) if non-empty.
(check/no-matching-tests-found): New rule.
* README: Document TESTS makefile variable.

10 years ago* Makefile.in (check-parallel): rm -rf outputs temp.
Doug Evans [Wed, 19 Feb 2014 00:01:34 +0000 (16:01 -0800)]
* Makefile.in (check-parallel): rm -rf outputs temp.

10 years agodaily update
Alan Modra [Tue, 18 Feb 2014 23:00:43 +0000 (09:30 +1030)]
daily update

10 years ago Revise signal mapping function in GDB interface for RX sim.
Kevin Buettner [Tue, 18 Feb 2014 01:15:56 +0000 (18:15 -0700)]
Revise signal mapping function in GDB interface for RX sim.

sim/rx/gdb-if.c had a function named `rx_signal_to_host'.  This
function mapped signal numbers used by the BSP to host signal
numbers which, at one time a while back, were used by GDB
as target signal numbers.  This change updates the signal
numbers returned to be those names prefixed with "GDB_SIGNAL_"
as defined in include/gdb/signals.h.

It also changes the name of the function somewhat to better
match what the function currently does.  I noticed that this
function is not static - and there's no reason for it not
to be - so I made it static too.

* gdb-if.c (rx_signal_to_host):  Rename to
`rx_signal_to_gdb_signal'.  Make static.  Update all callers
to use new name.  Use signal names from include/gdb/signals.h.

10 years agosim: delete duplicate SIGINT handling
Mike Frysinger [Mon, 17 Feb 2014 23:24:10 +0000 (18:24 -0500)]
sim: delete duplicate SIGINT handling

Many of the simulators change the SIGINT handler.
E.g., moxie/interp.c:

  sigsave = signal (SIGINT, interrupt);

However, this is unnecessary.
remote-sim.h already provides an API for asynchronously stopping
a sim; and both gdb and the drivers (run.c and nrun.c at least,
I didn't check the others) install a SIGINT handler which
calls this method.

URL: https://sourceware.org/bugzilla/show_bug.cgi?id=16450
Reported-by: Tom Tromey <tromey@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agodaily update
Alan Modra [Mon, 17 Feb 2014 23:00:41 +0000 (09:30 +1030)]
daily update

10 years agosim: ppc: drop $(LIBS) from psim dependency
Aaro Koskinen [Mon, 17 Feb 2014 22:12:59 +0000 (17:12 -0500)]
sim: ppc: drop $(LIBS) from psim dependency

When cross-compiling GDB for PPC, there's a prerequisite "-lz" for psim
that results in a build failure. With such prerequisite, GNU Make will
try to search the library from build machine's /usr/lib which is wrong.
On 64-bit Linux build machines the compilation will fail because of this.

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

10 years agoAdd g10 support to rl78-tdep.c.
Kevin Buettner [Mon, 17 Feb 2014 19:03:23 +0000 (12:03 -0700)]
Add g10 support to rl78-tdep.c.

The g10 is an rl78 variant which has fewer registers.  Aside from the
obvious addition of a new register_name() function which omits
registers which the g10 lacks, this change also updates the
return_value() function with the conventions specified by the ABI for
finding and setting return values.

* rl78-tdep.c (rl78_g10_register_name): New function.
(rl78_return_value): Add g10 support.
(rl78_gdbarch_init): Register rl78_g10_register_name for the
g10.

10 years agoSplit python docs into separate file.
Doug Evans [Mon, 17 Feb 2014 18:35:03 +0000 (10:35 -0800)]
Split python docs into separate file.

* Makefile.in (GDB_DOC_FILES): Add python.texi.
* gdb.texinfo (Python): Moved to ...
* python.texi: ... here.  New file.

10 years agoRemove doc/ in recent entries.
Doug Evans [Mon, 17 Feb 2014 18:25:48 +0000 (10:25 -0800)]
Remove doc/ in recent entries.

10 years agoMove entry from ChangeLog to doc/ChangeLog.
Doug Evans [Mon, 17 Feb 2014 18:23:48 +0000 (10:23 -0800)]
Move entry from ChangeLog to doc/ChangeLog.

* doc/guile.texi (Writing a Guile Pretty-Printer) <example>:
[...]

10 years agoguile: Fix typos in the manual.
Ludovic Courtès [Sun, 16 Feb 2014 21:41:49 +0000 (22:41 +0100)]
guile: Fix typos in the manual.

gdb/
2014-02-17  Ludovic Courtès  <ludo@gnu.org>

* doc/guile.texi (Writing a Guile Pretty-Printer) <example>:
Remove 'string-begins-with' procedure.  Add 'pretty-printer'
parameter to 'str-lookup-function' procedure.  Look for
the "std::string<" prefix.
(Frames In Guile): Add 'frame' parameter to 'frame-read-var'.
Adjust description.

10 years agoPR binutils/16595
Jan Kratochvil [Mon, 17 Feb 2014 07:32:22 +0000 (08:32 +0100)]
PR binutils/16595

abfd->section_count unexpectedly changes between 218 and 248 in:

150 bfd_simple_get_relocated_section_contents (bfd *abfd,
[...]
218   saved_offsets = malloc (sizeof (struct saved_output_info)
219                           * abfd->section_count);
[...]
230   _bfd_generic_link_add_symbols (abfd, &link_info);
[...]
248   bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets);

_bfd_generic_link_add_symbols increases section_count

and simple_restore_output_info later reads unallocated part of saved_offsets.

READ of size 8 at 0x601c0000c5c0 thread T0
    #0 0x1124770 in simple_restore_output_info (.../gdb/gdb+0x1124770)
    #1 0x10ecd51 in bfd_map_over_sections (.../gdb/gdb+0x10ecd51)
    #2 0x1125150 in bfd_simple_get_relocated_section_contents (.../gdb/gdb+0x1125150)

bfd/
2014-02-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR binutils/16595
* simple.c (struct saved_offsets): New.
(simple_save_output_info): Use it for ptr.
(simple_restore_output_info): Use it for ptr.  Check section_count.
(bfd_simple_get_relocated_section_contents): Use it for saved_offsets.

10 years agoConsolidate ppc64 ld/bfd communication
Alan Modra [Mon, 17 Feb 2014 06:38:00 +0000 (17:08 +1030)]
Consolidate ppc64 ld/bfd communication

Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.

bfd/
* elf64-ppc.h (struct ppc64_elf_params): Define.
(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Update prototype.
* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
fields now in params.  Adjust code throughout file.
(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
Save params pointer in htab.
(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
* emultemps/ppc64elf.em (params): New static struct replacing
various other static vars.  Adjust code throughout file.

10 years agoppc476 workaround for ld -r fixes
Alan Modra [Mon, 17 Feb 2014 06:21:25 +0000 (16:51 +1030)]
ppc476 workaround for ld -r fixes

This fixes the glaring error that the ppc476 workaround wasn't
actually enabled for ld -r, and adjusts relocations to match moved
code.

bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Move relocs on insns
patched for ppc476 workaround.  Reapply branch taken/not taken
relocs.
ld/
* emultempl/ppc32elf.em (ppc_after_open_output): Really enable
ppc476 workaround for ld -r.

10 years agoFix date in previous entry.
Doug Evans [Mon, 17 Feb 2014 04:57:43 +0000 (23:57 -0500)]
Fix date in previous entry.

10 years agoResort scm-gsmob.c entry in Makefile.in
Doug Evans [Mon, 17 Feb 2014 04:41:29 +0000 (23:41 -0500)]
Resort scm-gsmob.c entry in Makefile.in

* Makefile.in (SUBDIR_GUILE_OBS): Resort alphabetically.
(SUBDIR_GUILE_SRCS): Ditto.
(scm-gsmob.o): Ditto.

10 years agoFix missing-prototypes warnings in gnu-nat.c
Yao Qi [Mon, 17 Feb 2014 03:20:35 +0000 (11:20 +0800)]
Fix missing-prototypes warnings in gnu-nat.c

A recent change (commit 3398af6aa352b0611bc9d66aed72080a876e42d4)
in gnu-nat.c causes the some missing-prototypes warnings,

../../../git/gdb/gnu-nat.c:1864:1: error: no previous prototype for 'S_proc_pid2task_reply' [-Werror=missing-prototypes]
../../../git/gdb/gnu-nat.c:1866:1: error: no previous prototype for 'S_proc_task2pid_reply' [-Werror=missing-prototypes]
../../../git/gdb/gnu-nat.c:1868:1: error: no previous prototype for 'S_proc_task2proc_reply' [-Werror=missing-prototypes]

A new macro ILL_RPC was added recently, which defines some external
functions.  However, they are not declared and GCC complains about this.

This patch is to add the declarations of these external function in
macro ILL_RPC.

gdb:

2014-02-17  Yao Qi  <yao@codesourcery.com>

* gnu-nat.c (ILL_RPC): Declare defined function.

10 years agoFix -Werror=pointer-sign warnings
Yao Qi [Fri, 7 Feb 2014 06:35:09 +0000 (14:35 +0800)]
Fix -Werror=pointer-sign warnings

../../../git/gdb/gnu-nat.c: In function 'gnu_read_inferior':
../../../git/gdb/gnu-nat.c:2282:3: error: pointer targets in passing argument 5 of 'vm_read' differ in signedness [-Werror=pointer-sign]
In file included from /home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/usr/include/mach.h:38:0,
                 from ./nm.h:23,
                 from ../../../git/gdb/defs.h:500,
                 from ../../../git/gdb/gnu-nat.c:23:
/home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/usr/include/mach/mach_interface.h:843:15: note: expected 'mach_msg_type_number_t *' but argument is of type 'int *'
../../../git/gdb/gnu-nat.c: In function 'gnu_write_inferior':
../../../git/gdb/gnu-nat.c:2339:4: error: pointer targets in passing argument 5 of 'vm_read' differ in signedness [-Werror=pointer-sign]
In file included from /home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/usr/include/mach.h:38:0,
                 from ./nm.h:23,
                 from ../../../git/gdb/defs.h:500,
                 from ../../../git/gdb/gnu-nat.c:23:
/home/yao/Software/hurd-toolchain/bin/../i686-pc-gnu/libc/usr/include/mach/mach_interface.h:843:15: note: expected 'mach_msg_type_number_t *' but argument is of type 'int *'

This patch fixes these warnings.

gdb:

2014-02-17  Yao Qi  <yao@codesourcery.com>

* gnu-nat.c (gnu_read_inferior): Change 'copy_count' type to
mach_msg_type_number_t.
(gnu_write_inferior): Likewise.

10 years agoFix -Wformat warnings in gnu-nat.c
Yao Qi [Sun, 5 Jan 2014 11:37:27 +0000 (19:37 +0800)]
Fix -Wformat warnings in gnu-nat.c

I've seen some -Wformat warnings when build native gdb for hurd.

../../../git/gdb/gnu-nat.c:2384:8: error: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'vm_address_t' [-Werror=format]
../../../git/gdb/gnu-nat.c:2394:8: error: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'vm_address_t' [-Werror=format]
../../../git/gdb/gnu-nat.c: In function 'steal_exc_port':
../../../git/gdb/gnu-nat.c:2898:5: error: format '%d' expects argument of type 'int', but argument 2 has type 'mach_port_t' [-Werror=format]

in usr/include/mach/port.h, we have:

typedef vm_offset_t mach_port_t;

and in usr/include/mach/machine/vm_types.h, we have:

typedef       unsigned long   vm_offset_t;

so this patch changes '%d' to '%lu' in format string for mach_port_t
variables.

Similarly, in usr/include/mach/std_types.h, we have,

typedef      vm_offset_t     vm_address_t;

this patch also changes '%x' to '%lx' in gnu_write_inferior.

gdb:

2014-02-17  Yao Qi  <yao@codesourcery.com>

* gnu-nat.c (proc_get_exception_port): Use 'lu' insetad of 'd'
in format string.
(proc_steal_exc_port, make_proc, inf_set_pid): Likewise.
(inf_validate_procs, inf_signal): Likewise.
(S_exception_raise_request): Likewise.
(do_mach_notify_dead_name): Likewise.
(steal_exc_port): Likewise.
(gnu_read_inferior): Change 'copy_count''s type to
mach_msg_type_number_t.
(gnu_write_inferior): Likewise.  Use 'lx' instead of 'x' in
format string.

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

10 years agoFix "ERROR: no fileid for" in the testsuite.
Jan Kratochvil [Sun, 16 Feb 2014 20:49:40 +0000 (21:49 +0100)]
Fix "ERROR: no fileid for" in the testsuite.

If GDB has crashed then gdb_spawn_id still exists (although it does not work).
So my patch does not change anything.  And also currently it will leave the
stale gdbserver running anyway.

In general if gdb_spawn_id does not exist then send_gdb + gdb_expect just do
not make sense anyway.  So this patch just prevents the error in such case.

The killing of stale gdbserver could be improved multiple ways (also as
suggested by Pedro in the original thread) but that is IMO outside of the
scope of this patch.  Apparently if there is no good response from GDB then
gdb_finish() should try to call gdb_start just to kill that gdbserver, IIUC.

gdb/testsuite/
2014-02-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix "ERROR: no fileid for" in the testsuite.
* lib/gdb.exp (gdb_finish): Check gdb_spawn_id.

Message-ID: <20140206205814.GA18495@host2.jankratochvil.net>

10 years agoMissing ChangeLog entry from commit 60ef20e28534cf093d5bd799b3830c68381bb27f.
Thomas Schwinge [Sun, 16 Feb 2014 08:01:29 +0000 (09:01 +0100)]
Missing ChangeLog entry from commit 60ef20e28534cf093d5bd799b3830c68381bb27f.

10 years agold: Remove Hurd-specific XFAILs related to weak symbols.
Thomas Schwinge [Thu, 9 Jan 2014 15:56:22 +0000 (16:56 +0100)]
ld: Remove Hurd-specific XFAILs related to weak symbols.

This has been fixed properly, in glibc.

ld/testsuite/
* ld-elfweak/elfweak.exp (setup_xfail_gnu_hurd): Remove function
and all usage of it.

10 years agoHurd: Adjust to startup-with-shell changes.
Thomas Schwinge [Wed, 8 Jan 2014 20:42:07 +0000 (21:42 +0100)]
Hurd: Adjust to startup-with-shell changes.

In commit 98882a26513e25b2161b41dfd4bed97b59b2c01a, STARTUP_WITH_SHELL was made
a runtime toggle, startup-with-shell.  The Hurd code was missed to be adjusted;
it had a value hard-coded instead of using START_INFERIOR_TRAPS_EXPECTED.  Fix
that, and also simplify gnu-nat's pending_execs handling from counting to just
a flag.

gdb/
* gnu-nat.c (struct inf): Change pending_execs member to a 1-bit
flag.  Adjust all users; in particular...
(gnu_wait): ..., don't decrement its value in here...
(gnu_create_inferior): ..., and instead set the flag in here,
around the startup_inferior call, and call that one with
START_INFERIOR_TRAPS_EXPECTED.

10 years agoHurd: New RPC reply stub functions.
Thomas Schwinge [Mon, 6 Jan 2014 15:28:00 +0000 (16:28 +0100)]
Hurd: New RPC reply stub functions.

gdb/
* gnu-nat.c (ill_rpc): Remove function; replaced with this...
(ILL_RPC): ... new macro.
(do_mach_notify_no_senders, do_mach_notify_port_deleted)
(do_mach_notify_msg_accepted, do_mach_notify_port_destroyed)
(do_mach_notify_send_once, S_proc_setmsgport_reply)
(S_proc_getmsgport_reply, S_msg_sig_post_reply): Generate stub
functions with ILL_RPC macro.
(S_proc_pid2task_reply, S_proc_task2pid_reply)
(S_proc_task2proc_reply, S_proc_proc2task_reply)
(S_proc_pid2proc_reply, S_proc_getprocinfo_reply)
(S_proc_getprocargs_reply, S_proc_getprocenv_reply)
(S_proc_getloginid_reply, S_proc_getloginpids_reply)
(S_proc_getlogin_reply, S_proc_getsid_reply)
(S_proc_getsessionpgids_reply, S_proc_getsessionpids_reply)
(S_proc_getsidport_reply, S_proc_getpgrp_reply)
(S_proc_getpgrppids_reply, S_proc_get_tty_reply)
(S_proc_getnports_reply, S_proc_is_important_reply)
(S_proc_get_code_reply): New stub functions, generated with
ILL_RPC macro.

Based on a patch by David Michael <fedora.dm0@gmail.com>.

10 years agoHurd: Make MIG output parsing more robust.
Thomas Schwinge [Mon, 6 Jan 2014 15:01:08 +0000 (16:01 +0100)]
Hurd: Make MIG output parsing more robust.

gdb/
* reply_mig_hack.awk: In phase 5, keep going if we have not yet
collected the type check structures.

Based on a patch by David Michael <fedora.dm0@gmail.com>.

10 years agoHurd: Adapt to changed MIG output.
Thomas Schwinge [Mon, 6 Jan 2014 14:56:33 +0000 (15:56 +0100)]
Hurd: Adapt to changed MIG output.

gdb/
* reply_mig_hack.awk: Don't expect to see the auto keyword.

Based on a patch by David Michael <fedora.dm0@gmail.com>.

10 years agodaily update
Alan Modra [Sat, 15 Feb 2014 23:00:57 +0000 (09:30 +1030)]
daily update

10 years agodaily update
Alan Modra [Fri, 14 Feb 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years ago* target.c (target_write_partial): Fix result type.
Doug Evans [Fri, 14 Feb 2014 22:57:37 +0000 (14:57 -0800)]
* target.c (target_write_partial): Fix result type.

10 years agoFix offsets to access fpregset_t in sparc64-linux targets.
Jose E. Marchesi [Fri, 14 Feb 2014 10:29:11 +0000 (02:29 -0800)]
Fix offsets to access fpregset_t in sparc64-linux targets.

The %fsr register is not being properly accessed from gdb in
sparc64.  This is because sparc64_supply_fpregset and
sparc64_collect_fpregset are using the offsets from the
sparc32_bsd_fpregset constant instead of sparc64_bsd_fpregset.
This patch fixes this by registering the proper offsets for
sparc64-linux targets.

2014-02-14  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Register
the proper offsets to access fpregset_t.

10 years agoCompile rsp-low.c for IPA
Yao Qi [Thu, 13 Feb 2014 08:42:09 +0000 (16:42 +0800)]
Compile rsp-low.c for IPA

gdb/gdbserver:

2014-02-14  Yao Qi  <yao@codesourcery.com>

* Makefile.in (IPA_OBJS): Append rsp-low-ipa.o.
(rsp-low-ipa.o): New target.

10 years agodaily update
Alan Modra [Thu, 13 Feb 2014 23:00:47 +0000 (09:30 +1030)]
daily update

10 years agocleanup: remove declared variables without any references
Sanimir Agovic [Thu, 13 Feb 2014 12:41:24 +0000 (12:41 +0000)]
cleanup: remove declared variables without any references

2014-02-13  Sanimir Agovic  <sanimir.agovic@intel.com>

* cris-tdep.c (cris_supply_gregset): Remove zerobuf.
(_initialize_cris_tdep): Remove cris_set_cmdlist, cris_show_cmdlist.
* h8300-tdep.c (setmachinelist): Remove global.
* hppa-tdep.c (hppa_sigtramp): Remove global.
* mipsnbsd-tdep.c (sigtramp_retcode_mipsel, sigtramp_retcode_mipseb
RETCODE_NWORDS, RETCODE_SIZE): Wrap code with #if 0.
* ravenscar-thread.c (update_target_observer): Remove global.
* rs6000-tdep.c (rs6000_gdbarch_init): Remove segment_regs.

10 years agodaily update
Alan Modra [Wed, 12 Feb 2014 23:00:47 +0000 (09:30 +1030)]
daily update

10 years agoTest for binary,dwp symlinks into different directories.
Doug Evans [Wed, 12 Feb 2014 19:38:48 +0000 (11:38 -0800)]
Test for binary,dwp symlinks into different directories.

* gdb.dwarf2/Makefile.in (EXECUTABLES): Add dwp-symlink.
(MISCELLANEOUS): New variable.
(clean): rm -rf $(MISCELLANEOUS).
* gdb.dwarf2/dwp-symlink.exp: Test the case where the executable and
dwp live in the same directory as symlinks, with each symlink pointed
to a differently named file in a different directory.

10 years agoupdate rsp-low comments
Tom Tromey [Mon, 20 Jan 2014 17:38:07 +0000 (10:38 -0700)]
update rsp-low comments

This updates all the comments in rsp-low.[ch], now that the
unification has been completed.

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

* common/rsp-low.c: Update comments.
* common/rsp-low.h: Update comments.

10 years agoreplace convert_ascii_to_int with hex2bin
Tom Tromey [Sun, 19 Jan 2014 02:42:15 +0000 (19:42 -0700)]
replace convert_ascii_to_int with hex2bin

convert_ascii_to_int is identical to hex2bin.
This removes the former.

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

* common/rsp-low.c (convert_ascii_to_int): Remove.
* common/rsp-low.h (convert_ascii_to_int): Don't declare.

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

* ax.c (gdb_parse_agent_expr): Use hex2bin, not
convert_ascii_to_int.
* regcache.c (registers_to_string): Likewise.
* remote-utils.c (decode_M_packet): Likewise.
* server.c (process_serial_event): Likewise.

10 years agoreplace unhexify with hex2bin
Tom Tromey [Sun, 19 Jan 2014 02:41:08 +0000 (19:41 -0700)]
replace unhexify with hex2bin

unhexify and hex2bin are identical, so this removes unhexify.  The
particular choice of which to keep was made on the basis of
parallelism with the earlier patch that removed hexify.

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

* common/rsp-low.h (unhexify): Don't declare.
* common/rsp-low.c (unhexify): Remove.

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

* server.c (handle_query, handle_v_run): Use hex2bin, not
unhexify.
* tracepoint.c (cmd_qtdpsrc, cmd_qtdv, cmd_qtnotes): Likewise.

10 years agoreplace convert_int_to_ascii with bin2hex
Tom Tromey [Sun, 19 Jan 2014 02:34:15 +0000 (19:34 -0700)]
replace convert_int_to_ascii with bin2hex

convert_int_to_ascii is identical to bin2hex.  This removes the
former.  In this case I made the choice of which to keep on the basis
that I consider the name bin2hex to be superior to
convert_int_to_ascii.

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

* common/rsp-low.h (convert_int_to_ascii): Don't declare.
* common/rsp-low.c (convert_int_to_ascii): Remove.

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

* ax.c (gdb_unparse_agent_expr): Use bin2hex, not
convert_int_to_ascii.
* regcache.c (registers_to_string, collect_register_as_string):
Likewise.
* remote-utils.c (look_up_one_symbol, relocate_instruction):
Likewise.
* server.c (process_serial_event): Likewise.
* tracepoint.c (cmd_qtstatus, response_source, response_tsv)
(cmd_qtbuffer, cstr_to_hexstr): Likewise.

10 years agoreplace hexify with bin2hex
Tom Tromey [Sun, 19 Jan 2014 02:30:20 +0000 (19:30 -0700)]
replace hexify with bin2hex

This removes hexify in favor of bin2hex.
The choice of which to keep was arbitrary.

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

* common/rsp-low.h (hexify): Don't declare.
* common/rsp-low.c (hexify): Remove.

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

* remote-utils.c (look_up_one_symbol, monitor_output): Use
bin2hex, not hexify.
* tracepoint.c (cmd_qtstatus): Likewise.

10 years agodon't let hexify call strlen
Tom Tromey [Sun, 19 Jan 2014 02:25:57 +0000 (19:25 -0700)]
don't let hexify call strlen

hexify had the same issue as bin2hex; and the fix is the same.

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

* common/rsp-low.c (hexify): Never take strlen of argument.

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

* remote-utils.c (monitor_output): Pass explicit length to
hexify.

10 years agodon't let bin2hex call strlen
Tom Tromey [Sat, 18 Jan 2014 21:42:54 +0000 (14:42 -0700)]
don't let bin2hex call strlen

Currently bin2hex may call strlen if the length argument is zero.
This prevents some function unification; and also it seems cleaner to
me not to have a special meaning for a zero length.

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

* common/rsp-low.c (bin2hex): Never take strlen of argument.
* remote.c (extended_remote_run, remote_rcmd)
(remote_download_trace_state_variable, remote_save_trace_data)
(remote_set_trace_notes): Update.
* tracepoint.c (encode_source_string, tfile_write_status)
(tfile_write_uploaded_tsv): Update.

10 years agomove some rsp bits into rsp-low.h
Tom Tromey [Sat, 18 Jan 2014 21:32:47 +0000 (14:32 -0700)]
move some rsp bits into rsp-low.h

This moves various low-level remote serial protocol bits into
common/rsp-low.[ch].

This is as close to a pure move as possible.  There are some
redundancies remaining but those will be dealt with in a subsequent
patch.

Note that the two variants of remote_escape_output disagreed on the
treatment of "*".  On the theory that quoting cannot hurt but the
absence possibly can, I chose the gdbserver variant to be the
canonical one.

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

* tracepoint.c: Include rsp-low.h.
* remote.h (hex2bin, bin2hex, unpack_varlen_hex): Don't declare.
* remote.c: Include rsp-low.h.
(hexchars, ishex, unpack_varlen_hex, pack_nibble, pack_hex_byte)
(fromhex, hex2bin, tohex, bin2hex, remote_escape_output)
(remote_unescape_input): Move to common/rsp-low.c.
* common/rsp-low.h: New file.
* common/rsp-low.c: New file.
* Makefile.in (SFILES): Add common/rsp-low.c.
(HFILES_NO_SRCDIR): Add common/rsp-low.h.
(COMMON_OBS): Add rsp-low.o.
(rsp-low.o): New target.

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

* tracepoint.c: Include rsp-low.h.
* server.c: Include rsp-low.h.
* remote-utils.h (convert_ascii_to_int, convert_int_to_ascii)
(unhexify, hexify, remote_escape_output, unpack_varlen_hex): Don't
declare.
* remote-utils.c: Include rsp-low.h.
(fromhex, hexchars, ishex, unhexify, tohex, hexify)
(remote_escape_output, remote_unescape_input, unpack_varlen_hex)
(convert_int_to_ascii, convert_ascii_to_int): Move to
common/rsp-low.c.
* regcache.c: Include rsp-low.h.
* ax.c: Include rsp-low.h.
* Makefile.in (SFILES): Add common/rsp-low.c.
(OBS): Add rsp-low.o.
(rsp-low.o): New target.

10 years agoshare "cell" code
Tom Tromey [Fri, 17 Jan 2014 04:41:58 +0000 (21:41 -0700)]
share "cell" code

The "cell"-based printing code, like phex, was duplicated in both gdb
and gdbserver.  This patch merges the two implementations into a new
file in common/.

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

* utils.h: Include print-utils.h.
(host_address_to_string, plongest, pulongest, phex, phex_nz)
(int_string, core_addr_to_string, core_addr_to_string_nz)
(hex_string, hex_string_custom): Don't declare.
* utils.c (NUMCELLS, CELLSIZE, get_cell, decimal2str, pulongest)
(plongest, thirty_two, phex, phex_nz, octal2str, hex_string)
(hex_string_custom, int_string, core_addr_to_string)
(core_addr_to_string_nz, host_address_to_string): Move to
common/print-utils.c.
* common/print-utils.h: New file.
* common/print-utils.c: New file
* Makefile.in (SFILES): Add common/print-utils.c.
(HFILES_NO_SRCDIR): Add common/print-utils.h.
(COMMON_OBS): Add print-utils.o.
(print-utils.o): New target.

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

* utils.h (pulongest, plongest, phex_nz): Don't declare.
Include print-utils.h.
* utils.c (NUMCELLS, CELLSIZE, get_cell, decimal2str, pulongest)
(plongest, thirty_two, phex_nz): Remove.
* Makefile.in (SFILES): Add common/print-utils.c.
(OBS): Add print-utils.o.
(print-utils-ipa.o): New target.
(print-utils.o): New target.
(IPA_OBJS): Add print-utils-ipa.o.

10 years agofix error in nios2-tdep.c
Tom Tromey [Wed, 12 Feb 2014 16:20:02 +0000 (09:20 -0700)]
fix error in nios2-tdep.c

Since this change:

2014-02-12  Sanimir Agovic  <sanimir.agovic@intel.com>

* nios2-tdep.c (nios2_stub_frame_base): Remove global.

nios2-tdep hasn't built:

../../binutils-gdb/gdb/nios2-tdep.c:1337:1: error: ‘nios2_stub_frame_base_address’ defined but not used [-Werror=unused-function]

This patch removes the offending function.

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

* nios2-tdep.c (nios2_stub_frame_base_address): Remove.

10 years agoAdd clflushopt, xsaves, xsavec, xrstors
Ilya Tocar [Mon, 25 Nov 2013 12:35:42 +0000 (16:35 +0400)]
Add clflushopt, xsaves, xsavec, xrstors

gas/

2014-02-12  Ilya Tocar  <ilya.tocar@intel.com>

* config/tc-i386.c (cpu_arch): Add .clflushopt, .xsavec, .xsaves.
* doc/c-i386.texi: Document .xsavec/xsavec/.xsaves/xsaves/
clflushopt/.clfushopt.

gas/testsuite/

2014-02-12  Ilya Tocar  <ilya.tocar@intel.com>

* gas/i386/clflushopt-intel.d: New.
* gas/i386/clflushopt.d: Ditto.
* gas/i386/clflushopt.s: Ditto.
* gas/i386/i386.exp: Run new tests.
* gas/i386/x86-64-clflushopt-intel.d: New.
* gas/i386/x86-64-clflushopt.d: Ditto.
* gas/i386/x86-64-clflushopt.s: Ditto.
* gas/i386/x86-64-xsavec-intel.d: Ditto.
* gas/i386/x86-64-xsavec.d: Ditto.
* gas/i386/x86-64-xsavec.s: Ditto.
* gas/i386/x86-64-xsaves-intel.d: Ditto.
* gas/i386/x86-64-xsaves.d: Ditto.
* gas/i386/x86-64-xsaves.s: Ditto.
* gas/i386/xsavec-intel.d: Ditto.
* gas/i386/xsavec.d: Ditto.
* gas/i386/xsavec.s: Ditto.
* gas/i386/xsaves-intel.d: Ditto.
* gas/i386/xsaves.d: Ditto.
* gas/i386/xsaves.s: Ditto.

opcodes/

2014-02-12  Ilya Tocar  <ilya.tocar@intel.com>

* i386-dis.c (MOD enum): Add MOD_0FC7_REG_3, MOD_0FC7_REG_4,
MOD_0FC7_REG_5.
(PREFIX enum): Add PREFIX_0FAE_REG_7.
(reg_table): Add MOD_0FC7_REG_3, MOD_0FC7_REG_4 MOD_0FC7_REG_5.
(prefix_table): Add clflusopt.
(mod_table): Add xrstors, xsavec, xsaves.
* i386-gen.c (cpu_flag_init): Add CPU_CLFLUSHOPT_FLAGS,
CPU_XSAVES_FLAGS, CPU_XSAVEC_FLAGS.
(cpu_flags): Add CpuClflushOpt, CpuXSAVES, CpuXSAVEC.
* i386-init.h: Regenerate.
* i386-opc.tbl: Add clflushopt, xrstors, xrstors64, xsaves,
xsaves64, xsavec, xsavec64.
* i386-tbl.h: Regenerate.

10 years agoCall obsd_init_abi for OpenBSD/sparc64.
Mark Kettenis [Wed, 12 Feb 2014 13:59:48 +0000 (14:59 +0100)]
Call obsd_init_abi for OpenBSD/sparc64.

gdb/CHangeLog:

        * sparc64obsd-tdep.c (sparc64obsd_init_abi): Call obsd_init_abi.

10 years agoFIX EOF detection in PT_IO-based to_xfer_partial implementation.
Mark Kettenis [Wed, 12 Feb 2014 13:51:19 +0000 (14:51 +0100)]
FIX EOF detection in PT_IO-based to_xfer_partial implementation.

At least on OpenBSD PT_IO/PIOD_READ_AUXV can return sucessfully without
transferring any bytes.  Arguably a kernel bug, but interpreting this as EOF
seems sensible.

gdb/ChangeLog:

        * inf-ptrace.c (inf_ptrace_xfer_partial): Return TARGET_XFER_EOF
        if a PT_IO ptrace request returns sucessfully but indicates that 0
        bytes were transferred.

10 years agoExplicitly mark vtables as code space
Pedro Alves [Wed, 12 Feb 2014 13:30:21 +0000 (13:30 +0000)]
Explicitly mark vtables as code space

Ports for Hardvard architectures will typically have in their
pointer_to_address hook a check for TYPE_CODE_SPACE in their
"pointer_to_address" gdbarch method.  E.g., rl78's:

  /* Is it a code address?  */
  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
      || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
      || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))
      || TYPE_LENGTH (type) == 4)
    return rl78_make_instruction_address (addr);
  else
    return rl78_make_data_address (addr);

The avr port is similar.

The vtable type is a struct type gdb itself bakes.  Being neither a
function, nor a method, and absent explicit flagging as residing in
code space, ends up being considered data.

This patch marks the type as code when it is created, on the theory
that this is needed for all Hardvard architectures.  I believe this
should make no difference on archs with flat address space.  Testing
on x86-64 GNU/Linux shows no changes.

gdb/
2014-02-12  Pedro Alves  <palves@redhat.com>
    Kevin Buettner <kevinb@redhat.com>

* gnu-v3-abi.c (build_gdb_vtable_type): Return a type marked with
TYPE_INSTANCE_FLAG_CODE_SPACE.

Kevin Buettner, at
<https://sourceware.org/ml/gdb-patches/2014-02/msg00338.html>, writes,
re. rl78:

This patch, for rl78 using the default multilib, fixes 5 failures in
gdb.cp/casts.exp, 2 failures in gdb.cp/class2.exp, 115 failures in
gdb.mi/mi-var-rtti.exp, and 2 failures in gdb.python/py-value.exp.

It introduces 9 failures (regressions) in gdb.mi/mi-var-rtti.exp.

One of the regressions is:

 FAIL: gdb.mi/mi-var-rtti.exp: list children of s.public in type_update_when_use_rtti

The relevant lines from the log file from a pre-patch test run are as
follows:

 -var-list-children  S.public
 ^done,numchild="1",children=[child={name="S.public.ptr",exp="ptr",numchild="1",type="Base *",thread-id="1"}],has_more="0"
 (gdb)
 PASS: gdb.mi/mi-var-rtti.exp: list children of s.public in type_update_when_use_rtti
 Expecting: \^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"
 Expecting: ^(-var-list-children  S\.public\.ptr  [
 ]+)?(\^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"[
 ]+[(]gdb[)]
 [ ]*)

The same set of lines for the failing (post-patch) run are instead:

 -var-list-children  S.public
 &"warning: can't find linker symbol for virtual table for `Base' value\n"
 &"warning:   found `typeinfo for __cxxabiv1::__vmi_class_type_info' instead\n"
 &"warning: can't find linker symbol for virtual table for `Base' value\n"
 &"warning:   found `typeinfo for __cxxabiv1::__vmi_class_type_info' instead\n"
 &"warning: can't find linker symbol for virtual table for `Base' value\n"
 &"warning:   found `typeinfo for __cxxabiv1::__vmi_class_type_info' instead\n"
 ^done,numchild="1",children=[child={name="S.public.ptr",exp="ptr",numchild="1",type="Base *",thread-id="1"}],has_more="0"
 (gdb)
 FAIL: gdb.mi/mi-var-rtti.exp: list children of s.public in type_update_when_use_rtti
 Expecting: \^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"
 Expecting: ^(-var-list-children  S\.public\.ptr  [
 ]+)?(\^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"[
 ]+[(]gdb[)]
 [ ]*)

Note that the difference between these are the warnings regarding
linker symbols.  Aside from the warnings, the result is the same.
I.e.  gdb produces the correct answer despite the warnings.  The
reason for the other 8 failures is the same: the test harness is not
expecting these warnings.

I spent some time (a while ago) looking at the reason for these
warnings.  As I recall, we are now getting further along in the type
resolution process than we were without my patch.  I.e.  for the
example above, the code in question never got to the point where it
was looking for the specified linker symbol.  So it seems to me that,
at worst, my patch exposes some other problem, but is not directly the
cause of the problem.

10 years agoH8/300: Fix pseudo registers reads/writes.
Pedro Alves [Wed, 12 Feb 2014 12:27:50 +0000 (12:27 +0000)]
H8/300: Fix pseudo registers reads/writes.

'info registers ccr' corrupts memory.

Debugging gdb under Valgrind, we see:

 (gdb) info registers ccr
 ==23225== Invalid write of size 1
 ==23225==    at 0x4A0A308: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:881)
 ==23225==    by 0x52D334: regcache_raw_read (regcache.c:625)
 ==23225==    by 0x45E4D8: h8300_pseudo_register_read (h8300-tdep.c:1171)
 ==23225==    by 0x5B694B: gdbarch_pseudo_register_read (gdbarch.c:1926)
 ==23225==    by 0x52DADB: regcache_cooked_read (regcache.c:740)
 ==23225==    by 0x52DC10: regcache_cooked_read_value (regcache.c:765)
 ==23225==    by 0x68CA41: sentinel_frame_prev_register (sentinel-frame.c:52)
 ==23225==    by 0x6B80CB: frame_unwind_register_value (frame.c:1105)
 ==23225==    by 0x6B7C97: frame_register_unwind (frame.c:1010)
 ==23225==    by 0x6B7F73: frame_unwind_register (frame.c:1064)
 ==23225==    by 0x6B8359: frame_unwind_register_signed (frame.c:1162)
 ==23225==    by 0x6B8396: get_frame_register_signed (frame.c:1169)
 ==23225==  Address 0x4f7b031 is 0 bytes after a block of size 1 alloc'd
 ==23225==    at 0x4A06B0F: calloc (vg_replace_malloc.c:593)
 ==23225==    by 0x6EB754: xcalloc (common-utils.c:91)
 ==23225==    by 0x6EB793: xzalloc (common-utils.c:101)
 ==23225==    by 0x53A782: allocate_value_contents (value.c:854)
 ==23225==    by 0x53A7B4: allocate_value (value.c:864)
 ==23225==    by 0x52DBC8: regcache_cooked_read_value (regcache.c:757)
 ==23225==    by 0x68CA41: sentinel_frame_prev_register (sentinel-frame.c:52)
 ==23225==    by 0x6B80CB: frame_unwind_register_value (frame.c:1105)
 ==23225==    by 0x6B7C97: frame_register_unwind (frame.c:1010)
 ==23225==    by 0x6B7F73: frame_unwind_register (frame.c:1064)
 ==23225==    by 0x6B8359: frame_unwind_register_signed (frame.c:1162)
 ==23225==    by 0x6B8396: get_frame_register_signed (frame.c:1169)
 ==23225==
 ccr            0x00        0    I-0 UI-0 H-0 U-0 N-0 Z-0 V-0 C-0 u> u>= != >= >
 (gdb)

This bit:

 ==23225== Invalid write of size 1
 ==23225==    at 0x4A0A308: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:881)
 ==23225==    by 0x52D334: regcache_raw_read (regcache.c:625)
 ==23225==    by 0x45E4D8: h8300_pseudo_register_read (h8300-tdep.c:1171)

shows the problem.  The CCR pseudo register has type length of 1,
while the corresponding CCR raw register has a length of 2 or 4
(depending on mode).  In
sim/h8300/compile.c:sim_{fetch|store}_register we see that the sim
also treats those raw registers (CCR/EXR) as 2 or 4 bytes length.

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

* h8300-tdep.c (pseudo_from_raw_register)
(raw_from_pseudo_register): New functions.
(h8300_pseudo_register_read, h8300_pseudo_register_write): Use
them.

10 years agoH8/300: Fix gdb<->sim register mapping.
Pedro Alves [Wed, 12 Feb 2014 12:27:49 +0000 (12:27 +0000)]
H8/300: Fix gdb<->sim register mapping.

Currently, printing the H8/300 ccr register when debugging with the
sim is broken:

 (gdb) target sim
 ...
 (gdb) load
 ...
 (gdb) start
 ...
 Breakpoint 1, foo (i=0x0 <foo>) at main.c:4
 4       {
 (gdb) info registers ccr
 Register 13 is not available

'13' is the ccr pseudo-register.  This pseudo-register provides an
8-bit view into the raw ccr register (regno=8).

The problem is that the H8/300 port does not define a
register_sim_regno gdbarch hook, and thus when fetching the raw
register off of the sim, we end up in legacy_register_sim_regno trying
to figure out the sim register number for the raw CCR register:

 int
 legacy_register_sim_regno (struct gdbarch *gdbarch, int regnum)
 {
   /* Only makes sense to supply raw registers.  */
   gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch));
   /* NOTE: cagney/2002-05-13: The old code did it this way and it is
      suspected that some GDB/SIM combinations may rely on this
      behavour.  The default should be one2one_register_sim_regno
      (below).  */
   if (gdbarch_register_name (gdbarch, regnum) != NULL
       && gdbarch_register_name (gdbarch, regnum)[0] != '\0')
     return regnum;
   else
     return LEGACY_SIM_REGNO_IGNORE;
 }

Because the raw ccr register does not have a name (so that it is
hidden from the user), that returns LEGACY_SIM_REGNO_IGNORE.  That
means that we never actually read the value of the raw ccr register.

Before the <unavailable> support, this must have meant that ccr was
_always_ read as 0...  At least, I'm not seeing how this ever worked.

The fix for that is adding a gdbarch_register_sim_regno hook that maps
all raw registers.  Looking at sim/h8300/sim-main.h, I believe the
sim's register numbers are compatible with gdb's, so no actual
convertion is necessary.

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

* h8300-tdep.c (h8300_register_sim_regno): New function.
(h8300_gdbarch_init): Install h8300_register_sim_regno as
gdbarch_register_sim_regno hook.

10 years agonios2-tdep: remove unreferenced global nios2_stub_frame_base
Sanimir Agovic [Mon, 10 Feb 2014 17:54:15 +0000 (17:54 +0000)]
nios2-tdep: remove unreferenced global nios2_stub_frame_base

2014-02-12  Sanimir Agovic  <sanimir.agovic@intel.com>

* nios2-tdep.c (nios2_stub_frame_base): Remove global.

10 years agotic6x-tdep: set default frame base
Sanimir Agovic [Mon, 10 Feb 2014 18:00:01 +0000 (18:00 +0000)]
tic6x-tdep: set default frame base

2014-02-12  Sanimir Agovic  <sanimir.agovic@intel.com>

* tic6x-tdep.c (tic6x_gdbarch_init): Call frame_base_set_default.

10 years agoFix bad interaction between --relax and tls optimisation
Alan Modra [Wed, 12 Feb 2014 10:34:32 +0000 (21:04 +1030)]
Fix bad interaction between --relax and tls optimisation

Adding long-branch stubs for __tls_get_addr calls that are optimised
away is silly.  It also causes assertion failures on newer object files
that use R_PPC_TLSGD and R_PPC_TLSLD marker relocs, and half-optimised
(ie. broken) code for older object files.

PR 16546
* elf32-ppc.c (ppc_elf_relax_section): Don't build long-branch
stubs for calls to __tls_get_addr that we know will later be
optimised away.

10 years agoEnable ppc476 workaround for ld -r.
Alan Modra [Wed, 12 Feb 2014 06:14:36 +0000 (16:44 +1030)]
Enable ppc476 workaround for ld -r.

The Linux kernel builds modules using ld -r.  These might need the
ppc476 workaround, so enable it for ld -r if sections have sufficient
alignment to tell location within a page.

bfd/
* elf32-ppc.c (ppc_elf_relax_section): Enable ppc476 workaround
for ld -r, when code sections are sufficiently aligned.
* elf32-ppc.h (struct ppc_elf_params): Delete pagesize.  Add
pagesize_p2.
ld/
* emultempl/ppc32elf.em (pagesize): New static var.
(ppc_after_open_output): Set params.pagesize_p2 from pagesize.
(PARSE_AND_LIST_ARGS_CASES): Adjust to use pagesize.

10 years agoPR15530, mark symbol in executables if it matches dynamic_list
Alan Modra [Wed, 12 Feb 2014 10:38:01 +0000 (21:08 +1030)]
PR15530, mark symbol in executables if it matches dynamic_list

For powerpc64 as HJ did earlier for other ELF targets, and a tidy.

PR gold/15530
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
--export-dynamic and --dynamic-list marking of symbols.
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Reorder
cheap tests first.

10 years agoAdd signal number conversions for OpenBSD.
Mark Kettenis [Wed, 12 Feb 2014 11:08:28 +0000 (12:08 +0100)]
Add signal number conversions for OpenBSD.

gdb/ChangeLog:

        * obsd-tdep.h (obsd_init_abi): New prototype.
        * obsd-tdep.c: Define enum with OpenBSD signal numbers.
        (obsd_gdb_signal_from_target, obsd_gdb_signal_to_target)
        (obsd_init_abi): New functions.
        * i386obsd-tdep.c: Include "obsd-tdep.h".
        (i386obsd_init_abi): Call obsd_init_abi.
        * amd64obsd-tdep.c: Include "obsd-tdep.h".
        (amd64obsd_init_abi): Call obsd_init_abi.
        * configure.tgt (i[34567]86-*-openbsd*, x86_64-*-openbsd*): Add
        obsd-tdep.c to gdb_target_obs.

10 years agoRemove stray parantheses for deffn.
Doug Evans [Wed, 12 Feb 2014 07:19:22 +0000 (23:19 -0800)]
Remove stray parantheses for deffn.

10 years ago* gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead
Doug Evans [Tue, 11 Feb 2014 23:47:50 +0000 (15:47 -0800)]
* gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead
of Tcl file commands.

10 years agodaily update
Alan Modra [Tue, 11 Feb 2014 23:00:55 +0000 (09:30 +1030)]
daily update

10 years agoFix readelf so it doesn't complain about corrupt attribute.
Cary Coutant [Tue, 11 Feb 2014 19:33:49 +0000 (11:33 -0800)]
Fix readelf so it doesn't complain about corrupt attribute.

When a DW_FORM_flag_present attribute comes at the very end of a
debug section, readelf complains about a corrupt attribute
because it's checking to make sure there's at least one byte of
data remaining. This patch suppresses the check when the form
is DW_FORM_flag_present.

2014-02-11  Cary Coutant  <ccoutant@google.com>

* binutils/dwarf.c (read_and_display_attr_value): Don't warn
for zero-length attribute value.

10 years agoUpdate ChangeLog from earlier patch.
Cary Coutant [Tue, 11 Feb 2014 19:25:11 +0000 (11:25 -0800)]
Update ChangeLog from earlier patch.

10 years ago2014-02-11 Andrew Pinski <apinski@cavium.com>
Andrew Pinski [Fri, 7 Feb 2014 20:22:27 +0000 (12:22 -0800)]
2014-02-11  Andrew Pinski  <apinski@cavium.com>

* emulparams/aarch64linux32.sh (LIBPATH_SUFFIX): Change to ilp32.
(ELF_INTERPRETER_NAME): Define.
* emulparams/aarch64linux32b.sh (ELF_INTERPRETER_NAME): Define.

10 years agoFix passing double float complex arguments in sparc64.
Jose E. Marchesi [Tue, 11 Feb 2014 12:27:20 +0000 (04:27 -0800)]
Fix passing double float complex arguments in sparc64.

Double float complex objects are not 16-byte aligned in either
gcc or solaris studio.  This patch makes gdb to not align double
float complex arguments in the dummy frame when calling a
function.

2014-02-11  Jose E. Marchesi  <jose.marchesi@oracle.com>

        * sparc64-tdep.c (sparc64_store_arguments): Do not align complex
        double float arguments to 16-byte in the argument slots.

10 years agoDon't crash if pkg-config is not found and guile wasn't explicitly requested.
Doug Evans [Tue, 11 Feb 2014 07:04:38 +0000 (23:04 -0800)]
Don't crash if pkg-config is not found and guile wasn't explicitly requested.

* configure.ac: Don't crash if pkg-config is not found and guile
wasn't explicitly requested.  Use AC_MSG_ERROR instead of AC_ERROR
in guile checks.
* configure: Regenerate.

10 years agoUpdate comments to to_xfer_partial implementations.
Yao Qi [Thu, 30 Jan 2014 00:23:14 +0000 (08:23 +0800)]
Update comments to to_xfer_partial implementations.

Some comments to to_xfer_partial implementations are out of date.
This patch updates them using the "Implement the to_xfer_partial
target_ops method" pattern.

gdb:

2014-02-11  Yao Qi  <yao@codesourcery.com>

* aix-thread.c (aix_thread_xfer_partial): Update comments.
* auxv.c (procfs_xfer_auxv, memory_xfer_auxv): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partial): Likewise.
* gnu-nat.c (gnu_xfer_memory): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial):  Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.

10 years agoReturn target_xfer_status in to_xfer_partial
Yao Qi [Mon, 27 Jan 2014 12:35:33 +0000 (20:35 +0800)]
Return target_xfer_status in to_xfer_partial

This patch does the conversion of to_xfer_partial from

    LONGEST (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len);

to

    enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);

It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN.  Generally, the return status has three stats,

 - TARGET_XFER_OK,
 - TARGET_XFER_EOF,
 - TARGET_XFER_E_XXXX,

See the comments to them in 'enum target_xfer_status'.  Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK".  We finally name it TARGET_XFER_EOF.

With this change, GDB core can handle unavailable data in a convenient
way.

The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html

Consider an object/value like this:

  0          100      150        200           512
  DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III

where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid).  Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE.  That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out.  But, in this scenario, we're interested in
the data at [150,512).  The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next.  We'd need something like:

get me [0,512) >>>
     <<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK

get me [100,512)  >>> (**1)
     <<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.

get me [150,512) >>>
     <<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.

get me [200,512) >>>
     <<< no more data, return TARGET_XFER_EOF.

This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target.  (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).

Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.

No target implementations to to_xfer_partial adapts this new
interface.  The interface still behaves as before.

gdb:

2014-02-11  Yao Qi  <yao@codesourcery.com>

* target.h (enum target_xfer_error): Rename to ...
(enum target_xfer_status): ... it.  New.  All users updated.
(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
New.
(TARGET_XFER_STATUS_ERROR_P): New macro.
(target_xfer_error_to_string): Remove declaration.
(target_xfer_status_to_string): Declare.
(target_xfer_partial_ftype): Adjust it.
(struct target_ops) <to_xfer_partial>: Return
target_xfer_status.  Add argument xfered_len.  Update
comments.
* target.c (target_xfer_error_to_string): Rename to ...
(target_xfer_status_to_string): ... it.  New.  All callers
updated.
(target_read_live_memory): Likewise.  Call target_xfer_partial
instead of target_read.
(memory_xfer_live_readonly_partial): Return
target_xfer_status.  Add argument xfered_len.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1): Likewise.
(memory_xfer_partial): Likewise.
(target_xfer_partial): Likewise.  Check *XFERED_LEN is set
properly.  Update debug message.
(default_xfer_partial, current_xfer_partial): Likewise.
(target_write_partial): Likewise.
(target_read_partial): Likewise.  All callers updated.
(read_whatever_is_readable): Likewise.
(target_write_with_progress): Likewise.
(target_read_alloc_1): Likewise.

* aix-thread.c (aix_thread_xfer_partial): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
* corefile.c (read_memory): Adjust.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_dyld_info): Likewise.  All callers
updated.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise.  All
callers updated.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise.  Assert 'res' is not
negative.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise.  Change
type of 'partial_len' to ULONGEST.
* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
* linux-nat.c (linux_xfer_siginfo ): Likewise.
(linux_nat_xfer_partial): Likewise.
(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_write_bytes_aux): Likewise.  All callers
updated.
(remote_write_bytes, remote_read_bytes): Likewise.  All
callers updated.
(remote_flash_erase): Likewise.  All callers updated.
(remote_write_qxfer): Likewise.  All callers updated.
(remote_read_qxfer): Likewise.  All callers updated.
(remote_xfer_partial): Likewise.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
(sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.  All callers
updated.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.
(windows_xfer_shared_libraries): Likewise.
(windows_xfer_partial): Likewise.
* valprint.c: Replace 'target_xfer_error' with
'target_xfer_status' in comments.

10 years agoFix thinko in mi/mi-main.c::mi_cmd_data_write_memory_bytes comment.
Joel Brobecker [Tue, 11 Feb 2014 03:59:14 +0000 (07:59 +0400)]
Fix thinko in mi/mi-main.c::mi_cmd_data_write_memory_bytes comment.

gdb/ChangeLog:
2014-02-11  Simon Marchi  <simon.marchi@ericsson.com>  (tiny patch)

Checked in by Joel Brobecker <brobecker@adacore.com>.
* mi/mi-main.c (mi_cmd_data_write_memory_bytes): Fix comment.