diff options
author | Pedro Alves <palves@redhat.com> | 2009-06-07 16:46:48 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-06-07 16:46:48 +0000 |
commit | c35b149212fc1bf4cf991e42354b0303682bcead (patch) | |
tree | 6c670700d71b0f899cde2ccd0c3a85c2311b4b8f /gdb/remote.c | |
parent | 68c9c31474850c42b8241a753d5a0b22232650cf (diff) | |
download | gdb-c35b149212fc1bf4cf991e42354b0303682bcead.zip gdb-c35b149212fc1bf4cf991e42354b0303682bcead.tar.gz gdb-c35b149212fc1bf4cf991e42354b0303682bcead.tar.bz2 |
* target.h (struct target_ops): Make to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
methods instead of variables.
(target_has_all_memory_1, target_has_memory_1, target_has_stack_1)
(target_has_registers_1, target_has_execution_1): Declare
functions.
(target_has_all_memory): Rewrite to call target_has_all_memory_1.
(target_has_memory): Rewrite to call target_has_memory_1.
(target_has_stack): Rewrite to call target_has_all_stack_1.
(target_has_registers): Rewrite to call target_has_registers_1.
(target_has_execution): Rewrite to call target_has_execution_1.
(default_child_has_all_memory, default_child_has_memory)
(default_child_has_stack, default_child_has_registers)
(default_child_has_execution): Declare.
(target_mark_running, target_mark_exited): Delete declarations.
* target.c (default_child_has_all_memory,
default_child_has_memory, default_child_has_stack,
default_child_has_registers, default_child_has_execution): New.
(target_has_all_memory_1, target_has_memory_1, target_has_stack_1,
target_has_registers_1, target_has_execution_1): New.
(add_target): Default the to_has_all_memory, to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
callbacks to return 0.
(update_current_target): Do not inherit to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers or to_has_execution.
(target_mark_running, target_mark_exited): Delete.
(memory_xfer_partial): Adjust.
(target_read_memory, target_write_memory, target_search_memory):
Dispatch to the the top-most target, not the flattened
current_target.
(target_info): Adjust.
(init_dummy_target): Install return_zero as callback for
to_has_all_memory, to_has_memory, to_has_stack, to_has_registers,
to_has_execution.
(set_maintenance_target_async_permitted): Use have_live_inferiors
instead of target_has_execution.
* target-memory.c (target_write_memory_blocks): Dispatch memory
writes to the the top-most target, not the flattened
current_target.
* breakpoint.c (insert_breakpoints): Don't check for
target_has_execution here.
(update_global_location_list): Check if there are live inferiors
to debug instead of target_has_execution.
* infcmd.c (kill_command, detach_command): Check if there are
inferiors instead of target_has_execution.
* inferior.h (have_live_inferiors): Declare.
* inferior.c (have_live_inferiors): New.
* infrun.c (normal_stop): Don't check for target_has_execution to
finish the thread states.
* thread.c (is_thread_state, is_stopped, is_exited, is_running)
(any_running, is_executing): Remove checks for
target_has_execution.
* top.c (kill_or_detach): Don't try to kill core inferiors.
(quit_target): Don't check for target_has_execution.
* corelow.c (core_has_memory, core_has_stack, core_has_registers):
New.
(init_core_ops): Install core_has_memory, core_has_stack and
core_has_registers.
* exec.c (exec_has_memory): New.
(init_exec_ops): Install exec_has_memory.
* remote.c (remote_add_inferior): Don't call target_mark_running.
(remote_start_remote): Don't call target_mark_exited or call
target_mark_running.
(remote_open_1): Use have_inferiors instead of
target_has_execution. Don't use target_mark_exited.
(init_remote_ops): Install deafult_child_has_all_memory,
default_child_has_memory, default_child_has_stack,
default_child_has_registers, default_child_has_execution.
* bsd-kvm.c (bsd_kvm_return_one): New.
(bsd_kvm_add_target): Register bsd_kvm_return_one as
to_has_memory, to_has_stack and to_has_registers callbacks.
* remote-m32r-sdi.c (m32r_return_one): New.
(init_m32r_ops): Register it.
* inf-child.c (inf_child_target): Adjust to register
default_child_has_all_memory, default_child_has_memory,
default_child_has_stack, default_child_has_registers,
default_child_has_execution callbacks.
* gnu-nat.c (init_gnu_ops): Likewise.
* go32-nat.c (init_go32_ops): Likewise.
* hpux-thread.c (init_hpux_thread_ops): Likewise.
* monitor.c (init_base_monitor_ops): Likewise.
* nto-procfs.c (init_procfs_ops): Likewise.
* remote-mips.c (_initialize_remote_mips): Likewise.
* windows-nat.c (init_windows_ops): Likewise.
* remote-sim.c (gdbsim_create_inferior): Don't use
target_mark_running or target_mark_exited.
(gdbsim_mourn_inferior): Don't call target_mark_exited.
(init_gdbsim_ops): Adjust to register
default_child_has_all_memory, default_child_has_memory,
default_child_has_stack, default_child_has_registers,
default_child_has_execution callbacks.
* linux-nat.c (linux_nat_xfer_partial): If reading memory, and
there's no inferior selected, defer to a lower stratum.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 65 |
1 files changed, 17 insertions, 48 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 70a0248..3fb7a70 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1179,15 +1179,6 @@ remote_add_inferior (int pid, int attached) inf->attach_flag = attached; - /* This may be the first inferior we hear about. */ - if (!target_has_execution) - { - if (rs->extended) - target_mark_running (&extended_remote_ops); - else - target_mark_running (&remote_ops); - } - return inf; } @@ -2688,15 +2679,12 @@ remote_start_remote (struct ui_out *uiout, void *opaque) { if (rs->buf[0] == 'W' || rs->buf[0] == 'X') { - if (args->extended_p) - { - /* We're connected, but not running. Drop out before we - call start_remote. */ - target_mark_exited (args->target); - return; - } - else + if (!args->extended_p) error (_("The target is not running (try extended-remote?)")); + + /* We're connected, but not running. Drop out before we + call start_remote. */ + return; } else { @@ -2786,19 +2774,13 @@ remote_start_remote (struct ui_out *uiout, void *opaque) if (thread_count () == 0) { - if (args->extended_p) - { - /* We're connected, but not running. Drop out before we - call start_remote. */ - target_mark_exited (args->target); - return; - } - else + if (!args->extended_p) error (_("The target is not running (try extended-remote?)")); - } - if (args->extended_p) - target_mark_running (args->target); + /* We're connected, but not running. Drop out before we + call start_remote. */ + return; + } /* Let the stub know that we want it to return the thread. */ @@ -3209,7 +3191,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, int extended But if we're connected to a target system with no running process, then we will still be connected when it returns. Ask this question first, before target_preopen has a chance to kill anything. */ - if (remote_desc != NULL && !target_has_execution) + if (remote_desc != NULL && !have_inferiors ()) { if (!from_tty || query (_("Already connected to a remote target. Disconnect? "))) @@ -3227,7 +3209,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, int extended process, we may still be connected. If we are starting "target remote" now, the extended-remote target will not have been removed by unpush_target. */ - if (remote_desc != NULL && !target_has_execution) + if (remote_desc != NULL && !have_inferiors ()) pop_target (); /* Make sure we send the passed signals list the next time we resume. */ @@ -3270,10 +3252,6 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, int extended } push_target (target); /* Switch to using remote target now. */ - /* Assume that the target is not running, until we learn otherwise. */ - if (extended_p) - target_mark_exited (target); - /* Register extra event sources in the event loop. */ remote_async_inferior_event_token = create_async_event_handler (remote_async_inferior_event_handler, @@ -6680,16 +6658,7 @@ extended_remote_mourn_1 (struct target_ops *target) so that the user can say "kill" again. */ inferior_ptid = magic_null_ptid; } - else - { - /* Mark this (still pushed) target as not executable until we - restart it. */ - target_mark_exited (target); - } } - else - /* Always remove execution if this was the last process. */ - target_mark_exited (target); } } @@ -8803,11 +8772,11 @@ Specify the serial device it is connected to\n\ remote_ops.to_log_command = serial_log_command; remote_ops.to_get_thread_local_address = remote_get_thread_local_address; remote_ops.to_stratum = process_stratum; - remote_ops.to_has_all_memory = 1; - remote_ops.to_has_memory = 1; - remote_ops.to_has_stack = 1; - remote_ops.to_has_registers = 1; - remote_ops.to_has_execution = 1; + remote_ops.to_has_all_memory = default_child_has_all_memory; + remote_ops.to_has_memory = default_child_has_memory; + remote_ops.to_has_stack = default_child_has_stack; + remote_ops.to_has_registers = default_child_has_registers; + remote_ops.to_has_execution = default_child_has_execution; remote_ops.to_has_thread_control = tc_schedlock; /* can lock scheduler */ remote_ops.to_can_execute_reverse = remote_can_execute_reverse; remote_ops.to_magic = OPS_MAGIC; |