2018-11-30 22:53:39 +08:00
|
|
|
/* Abstract base class inherited by all process_stratum targets
|
|
|
|
|
|
|
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef PROCESS_STRATUM_TARGET_H
|
|
|
|
#define PROCESS_STRATUM_TARGET_H
|
|
|
|
|
|
|
|
#include "target.h"
|
|
|
|
|
|
|
|
/* Abstract base class inherited by all process_stratum targets. */
|
|
|
|
|
|
|
|
class process_stratum_target : public target_ops
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
process_stratum_target ()
|
|
|
|
{
|
|
|
|
to_stratum = process_stratum;
|
|
|
|
}
|
|
|
|
|
|
|
|
~process_stratum_target () override = 0;
|
|
|
|
|
|
|
|
/* We must default these because they must be implemented by any
|
|
|
|
target that can run. */
|
|
|
|
bool can_async_p () override { return false; }
|
|
|
|
bool supports_non_stop () override { return false; }
|
|
|
|
bool supports_disable_randomization () override { return false; }
|
|
|
|
|
|
|
|
/* This default implementation returns the inferior's address
|
|
|
|
space. */
|
|
|
|
struct address_space *thread_address_space (ptid_t ptid) override;
|
|
|
|
|
|
|
|
/* This default implementation always returns target_gdbarch (). */
|
|
|
|
struct gdbarch *thread_architecture (ptid_t ptid) override;
|
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.
2018-11-30 22:53:40 +08:00
|
|
|
|
|
|
|
/* 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;
|
2018-11-30 22:53:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !defined (PROCESS_STRATUM_TARGET_H) */
|