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.
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.
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.
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.
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.
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.
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.
A recent change (commit 3398af6aa3)
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.
../../../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.
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.
In commit 98882a2651, 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.
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>.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.