aboutsummaryrefslogtreecommitdiff
path: root/gdb/process-stratum-target.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2018-11-30 14:53:40 +0000
committerPedro Alves <palves@redhat.com>2018-11-30 16:28:11 +0000
commitf3d11a9a96465432c01678445fc2fe84f2ef94f7 (patch)
tree44b4e3a90e2036c740b8119ff1f5da097e2ba2e9 /gdb/process-stratum-target.c
parent3b3dac9b3fd916d73726c7e5508f057574f74d19 (diff)
downloadfsf-binutils-gdb-f3d11a9a96465432c01678445fc2fe84f2ef94f7.zip
fsf-binutils-gdb-f3d11a9a96465432c01678445fc2fe84f2ef94f7.tar.gz
fsf-binutils-gdb-f3d11a9a96465432c01678445fc2fe84f2ef94f7.tar.bz2
Convert default_child_has_foo functions to process_stratum_target methods
This patch converts the default_child_has_foo functions to process_stratum_target methods. This simplifies "regular" non-inf_child process_stratum targets, since they no longer have to override the target_ops::has_foo methods to call the default_child_foo functions. A couple targets need to override the new defaults (corelow and tracefiles), but it still seems like a good tradeoff, since those are expected to be little different (target doesn't run). gdb/ChangeLog: 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.
Diffstat (limited to 'gdb/process-stratum-target.c')
-rw-r--r--gdb/process-stratum-target.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c
index 9ce8d3d..ca9d13a 100644
--- a/gdb/process-stratum-target.c
+++ b/gdb/process-stratum-target.c
@@ -47,3 +47,39 @@ process_stratum_target::thread_architecture (ptid_t ptid)
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;
+}