/* Interface between GDB and target environments, including files and processes
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
+ Copyright (C) 1990-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
#include "bfd.h"
#include "symtab.h"
#include "memattr.h"
-#include "vec.h"
-#include "gdb_signals.h"
+#include "common/vec.h"
+#include "common/gdb_signals.h"
#include "btrace.h"
#include "record.h"
#include "command.h"
#include "disasm.h"
#include "tracepoint.h"
-#include "break-common.h" /* For enum target_hw_bp_type. */
+#include "common/break-common.h" /* For enum target_hw_bp_type. */
enum strata
{
struct target_ops
{
+ /* Return this target's stratum. */
+ virtual strata stratum () const = 0;
+
/* To the target under this one. */
target_ops *beneath () const;
/* Documentation of this routine is provided with the corresponding
target_* macro. */
- virtual void pass_signals (int,
- unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
+ virtual void pass_signals (gdb::array_view<const unsigned char> TARGET_DEBUG_PRINTER (target_debug_print_signals))
TARGET_DEFAULT_IGNORE ();
/* Documentation of this routine is provided with the
corresponding target_* function. */
- virtual void program_signals (int,
- unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
+ virtual void program_signals (gdb::array_view<const unsigned char> TARGET_DEBUG_PRINTER (target_debug_print_signals))
TARGET_DEFAULT_IGNORE ();
virtual bool thread_alive (ptid_t ptid)
TARGET_DEFAULT_RETURN (false);
virtual void update_thread_list ()
TARGET_DEFAULT_IGNORE ();
- virtual const char *pid_to_str (ptid_t)
+ virtual std::string pid_to_str (ptid_t)
TARGET_DEFAULT_FUNC (default_pid_to_str);
virtual const char *extra_thread_info (thread_info *)
TARGET_DEFAULT_RETURN (NULL);
int,
inferior *inf)
TARGET_DEFAULT_RETURN (NULL);
+ /* See target_thread_info_to_thread_handle. */
+ virtual gdb::byte_vector thread_info_to_thread_handle (struct thread_info *)
+ TARGET_DEFAULT_RETURN (gdb::byte_vector ());
virtual void stop (ptid_t)
TARGET_DEFAULT_IGNORE ();
virtual void interrupt ()
TARGET_DEFAULT_IGNORE ();
virtual struct target_section_table *get_section_table ()
TARGET_DEFAULT_RETURN (NULL);
- enum strata to_stratum;
/* Provide default values for all "must have" methods. */
virtual bool has_all_memory () { return false; }
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return the thread-local address at OFFSET in the
thread-local storage for the thread PTID and the shared library
- or executable file given by OBJFILE. If that block of
+ or executable file given by LOAD_MODULE_ADDR. If that block of
thread-local storage hasn't been allocated yet, this function
- may return an error. LOAD_MODULE_ADDR may be zero for statically
+ may throw an error. LOAD_MODULE_ADDR may be zero for statically
linked multithreaded inferiors. */
virtual CORE_ADDR get_thread_local_address (ptid_t ptid,
CORE_ADDR load_module_addr,
/* Returns true if T is pushed on the target stack. */
bool is_pushed (target_ops *t) const
- { return at (t->to_stratum) == t; }
+ { return at (t->stratum ()) == t; }
/* Return the target at STRATUM. */
target_ops *at (strata stratum) const { return m_stack[stratum]; }
/* Set list of signals to be handled in the target.
- PASS_SIGNALS is an array of size NSIG, indexed by target signal number
+ PASS_SIGNALS is an array indexed by target signal number
(enum gdb_signal). For every signal whose entry in this array is
non-zero, the target is allowed -but not required- to skip reporting
arrival of the signal to the GDB core by returning from target_wait,
about to receive a signal, it needs to be reported in any case, even
if mentioned in a previous target_pass_signals call. */
-extern void target_pass_signals (int nsig, unsigned char *pass_signals);
+extern void target_pass_signals
+ (gdb::array_view<const unsigned char> pass_signals);
/* Set list of signals the target may pass to the inferior. This
directly maps to the "handle SIGNAL pass/nopass" setting.
- PROGRAM_SIGNALS is an array of size NSIG, indexed by target signal
+ PROGRAM_SIGNALS is an array indexed by target signal
number (enum gdb_signal). For every signal whose entry in this
array is non-zero, the target is allowed to pass the signal to the
inferior. Signals not present in the array shall be silently
example, when detaching (as threads may have been suspended with
pending signals not reported to GDB). */
-extern void target_program_signals (int nsig, unsigned char *program_signals);
+extern void target_program_signals
+ (gdb::array_view<const unsigned char> program_signals);
/* Check to see if a thread is still alive. */
#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? */
`process xyz', but on some systems it may contain
`process xyz thread abc'. */
-extern const char *target_pid_to_str (ptid_t ptid);
+extern std::string target_pid_to_str (ptid_t ptid);
-extern const char *normal_pid_to_str (ptid_t ptid);
+extern std::string normal_pid_to_str (ptid_t ptid);
/* Return a short string describing extra information about PID,
e.g. "sleeping", "runnable", "running on LWP 3". Null return value
extern struct thread_info *target_thread_handle_to_thread_info
(const gdb_byte *thread_handle, int handle_len, struct inferior *inf);
+/* Given a thread, return the thread handle, a target-specific sequence of
+ bytes which serves as a thread identifier within the program being
+ debugged. */
+extern gdb::byte_vector target_thread_info_to_thread_handle
+ (struct thread_info *);
+
/* Attempts to find the pathname of the executable file
that was run to create a specified process.
extern void push_target (struct target_ops *);
+/* An overload that deletes the target on failure. */
+extern void push_target (target_ops_up &&);
+
extern int unpush_target (struct target_ops *);
extern void target_pre_inferior (int);