2018-11-30 Pedro Alves <palves@redhat.com>
+ * corelow.c (core_target) <has_all_memory, has_execution>: New
+ overrides.
+ * inf-child.c (inf_child_target::has_all_memory)
+ (inf_child_target::has_memory, inf_child_target::has_stack)
+ (inf_child_target::has_registers)
+ (inf_child_target::has_execution): Delete.
+ * inf-child.h (inf_child_target) <has_all_memory, has_memory,
+ has_stack, has_registers, has_execution>: Delete.
+ * process-stratum-target.c
+ (process_stratum_target::has_all_memory)
+ (process_stratum_target::has_memory)
+ (process_stratum_target::has_stack)
+ (process_stratum_target::has_registers)
+ (process_stratum_target::has_execution): New.
+ * process-stratum-target.h (process_stratum_target)
+ <has_all_memory, has_memory, has_stack, has_registers,
+ has_execution>: New method overrides.
+ * ravenscar-thread.c (ravenscar_thread_target) <has_all_memory,
+ has_memory, has_stack, has_registers, has_execution>: Delete.
+ * remote-sim.c (gdbsim_target) <has_stack, has_registers,
+ has_execution>: Delete.
+ * remote.c (remote_target) <has_all_memory, has_memory, has_stack,
+ has_registers, has_execution>: Delete.
+ * target.c (default_child_has_all_memory)
+ (default_child_has_memory, default_child_has_stack)
+ (default_child_has_registers, default_child_has_execution):
+ Delete.
+ * target.h (default_child_has_all_memory)
+ (default_child_has_memory, default_child_has_stack)
+ (default_child_has_registers, default_child_has_execution):
+ Delete.
+ * tracefile.h (tracefile_target) <has_execution>: New override.
+
+2018-11-30 Pedro Alves <palves@redhat.com>
+
* Makefile.in (COMMON_SFILES): Add process-stratum-target.c.
* bsd-kvm.c: Include "process-stratum-target.h".
(bsd_kvm_target): Now inherits from process_stratum_target.
const char *thread_name (struct thread_info *) override;
+ bool has_all_memory () override { return false; }
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
+ bool has_execution (ptid_t) override { return false; }
+
bool info_proc (const char *, enum info_proc_what) override;
/* A few helpers. */
return NULL;
}
-bool
-inf_child_target::has_all_memory ()
-{
- return default_child_has_all_memory ();
-}
-
-bool
-inf_child_target::has_memory ()
-{
- return default_child_has_memory ();
-}
-
-bool
-inf_child_target::has_stack ()
-{
- return default_child_has_stack ();
-}
-
-bool
-inf_child_target::has_registers ()
-{
- return default_child_has_registers ();
-}
-
-bool
-inf_child_target::has_execution (ptid_t ptid)
-{
- return default_child_has_execution (ptid);
-}
-
/* Implementation of to_fileio_open. */
int
char *pid_to_exec_file (int pid) override;
- bool has_all_memory () override;
- bool has_memory () override;
- bool has_stack () override;
- bool has_registers () override;
- bool has_execution (ptid_t) override;
-
int fileio_open (struct inferior *inf, const char *filename,
int flags, int mode, int warn_if_slow,
int *target_errno) override;
gdb_assert (inf != NULL);
return inf->gdbarch;
}
+
+bool
+process_stratum_target::has_all_memory ()
+{
+ /* If no inferior selected, then we can't read memory here. */
+ return inferior_ptid != null_ptid;
+}
+
+bool
+process_stratum_target::has_memory ()
+{
+ /* If no inferior selected, then we can't read memory here. */
+ return inferior_ptid != null_ptid;
+}
+
+bool
+process_stratum_target::has_stack ()
+{
+ /* If no inferior selected, there's no stack. */
+ return inferior_ptid != null_ptid;
+}
+
+bool
+process_stratum_target::has_registers ()
+{
+ /* Can't read registers from no inferior. */
+ return inferior_ptid != null_ptid;
+}
+
+bool
+process_stratum_target::has_execution (ptid_t the_ptid)
+{
+ /* If there's no thread selected, then we can't make it run through
+ hoops. */
+ return the_ptid != null_ptid;
+}
/* This default implementation always returns target_gdbarch (). */
struct gdbarch *thread_architecture (ptid_t ptid) override;
+
+ /* Default implementations for process_stratum targets. Return true
+ if there's a selected inferior, false otherwise. */
+ bool has_all_memory () override;
+ bool has_memory () override;
+ bool has_stack () override;
+ bool has_registers () override;
+ bool has_execution (ptid_t the_ptid) override;
};
#endif /* !defined (PROCESS_STRATUM_TARGET_H) */
ptid_t get_ada_task_ptid (long lwp, long thread) override;
void mourn_inferior () override;
-
- bool has_all_memory () override { return default_child_has_all_memory (); }
- bool has_memory () override { return default_child_has_memory (); }
- bool has_stack () override { return default_child_has_stack (); }
- bool has_registers () override { return default_child_has_registers (); }
- bool has_execution (ptid_t ptid) override
- { return default_child_has_execution (ptid); }
};
/* This module's target-specific operations. */
bool has_all_memory () override;
bool has_memory () override;
-
- bool has_stack () override
- { return default_child_has_stack (); }
-
- bool has_registers () override
- { return default_child_has_registers (); }
-
- bool has_execution (ptid_t ptid) override
- { return default_child_has_execution (ptid); }
};
static struct gdbsim_target gdbsim_ops;
CORE_ADDR load_module_addr,
CORE_ADDR offset) override;
- bool has_all_memory () override { return default_child_has_all_memory (); }
- bool has_memory () override { return default_child_has_memory (); }
- bool has_stack () override { return default_child_has_stack (); }
- bool has_registers () override { return default_child_has_registers (); }
- bool has_execution (ptid_t ptid) override { return default_child_has_execution (ptid); }
-
bool can_execute_reverse () override;
std::vector<mem_region> memory_map () override;
gdb_stdout);
}
-/* Default target_has_* methods for process_stratum targets. */
-
-int
-default_child_has_all_memory ()
-{
- /* If no inferior selected, then we can't read memory here. */
- if (inferior_ptid == null_ptid)
- return 0;
-
- return 1;
-}
-
-int
-default_child_has_memory ()
-{
- /* If no inferior selected, then we can't read memory here. */
- if (inferior_ptid == null_ptid)
- return 0;
-
- return 1;
-}
-
-int
-default_child_has_stack ()
-{
- /* If no inferior selected, there's no stack. */
- if (inferior_ptid == null_ptid)
- return 0;
-
- return 1;
-}
-
-int
-default_child_has_registers ()
-{
- /* Can't read registers from no inferior. */
- if (inferior_ptid == null_ptid)
- return 0;
-
- return 1;
-}
-
-int
-default_child_has_execution (ptid_t the_ptid)
-{
- /* If there's no thread selected, then we can't make it run through
- hoops. */
- if (the_ptid == null_ptid)
- return 0;
-
- return 1;
-}
-
-
int
target_has_all_memory_1 (void)
{
#define target_has_execution target_has_execution_current ()
-/* Default implementations for process_stratum targets. Return true
- if there's a selected inferior, false otherwise. */
-
-extern int default_child_has_all_memory ();
-extern int default_child_has_memory ();
-extern int default_child_has_stack ();
-extern int default_child_has_registers ();
-extern int default_child_has_execution (ptid_t the_ptid);
-
/* Can the target support the debugger control of thread execution?
Can it lock the thread scheduler? */
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
+ bool has_execution (ptid_t) override { return false; }
bool thread_alive (ptid_t ptid) override;
};