X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftarget.h;h=a8e551ce697f44cbd6511795e46564337ceaffb1;hb=f5a7c406b1975cde626efed526960f2cf1bdaceb;hp=b0469bba1482793c29e9211c811aada3cd98836b;hpb=f3d11a9a96465432c01678445fc2fe84f2ef94f7;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/target.h b/gdb/target.h index b0469bba14..a8e551ce69 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1,6 +1,6 @@ /* Interface between GDB and target environments, including files and processes - Copyright (C) 1990-2018 Free Software Foundation, Inc. + Copyright (C) 1990-2020 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by John Gilmore. @@ -42,7 +42,7 @@ struct inferior; #include "infrun.h" /* For enum exec_direction_kind. */ #include "breakpoint.h" /* For enum bptype. */ -#include "common/scoped_restore.h" +#include "gdbsupport/scoped_restore.h" /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or @@ -74,15 +74,14 @@ struct inferior; #include "bfd.h" #include "symtab.h" #include "memattr.h" -#include "vec.h" -#include "gdb_signals.h" +#include "gdbsupport/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 "gdbsupport/break-common.h" /* For enum target_hw_bp_type. */ enum strata { @@ -137,8 +136,6 @@ enum target_object { /* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */ TARGET_OBJECT_AVR, - /* SPU target specific transfer. See "spu-tdep.c". */ - TARGET_OBJECT_SPU, /* Transfer up-to LEN bytes of memory starting at OFFSET. */ TARGET_OBJECT_MEMORY, /* Memory, avoiding GDB's data cache and trusting the executable. @@ -431,6 +428,9 @@ struct target_info struct target_ops { + /* Return this target's stratum. */ + virtual strata stratum () const = 0; + /* To the target under this one. */ target_ops *beneath () const; @@ -619,7 +619,7 @@ struct target_ops TARGET_DEFAULT_RETURN (1); virtual int remove_exec_catchpoint (int) TARGET_DEFAULT_RETURN (1); - virtual void follow_exec (struct inferior *, char *) + virtual void follow_exec (struct inferior *, const char *) TARGET_DEFAULT_IGNORE (); virtual int set_syscall_catchpoint (int, bool, int, gdb::array_view) @@ -634,21 +634,19 @@ struct target_ops /* 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 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 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); @@ -658,6 +656,9 @@ struct target_ops 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 () @@ -672,7 +673,6 @@ struct target_ops 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; } @@ -718,9 +718,9 @@ struct target_ops 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, @@ -878,11 +878,10 @@ struct target_ops /* Determine current architecture of thread PTID. The target is supposed to determine the architecture of the code where - the target is currently stopped at (on Cell, if a target is in spu_run, - to_thread_architecture would return SPU, otherwise PPC32 or PPC64). - This is architecture used to perform decr_pc_after_break adjustment, - and also determines the frame architecture of the innermost frame. - ptrace operations need to operate according to target_gdbarch (). */ + the target is currently stopped at. The architecture information is + used to perform decr_pc_after_break adjustment, and also to determine + the frame architecture of the innermost frame. ptrace operations need to + operate according to target_gdbarch (). */ virtual struct gdbarch *thread_architecture (ptid_t) TARGET_DEFAULT_RETURN (NULL); @@ -1286,7 +1285,7 @@ public: /* 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]; } @@ -1535,7 +1534,7 @@ enum flash_preserve_mode that supports writing to flash memory, and it should be used for all cases where access to flash memory is desirable. - REQUESTS is the vector (see vec.h) of memory_write_request. + REQUESTS is the vector of memory_write_request. PRESERVE_FLASH_P indicates what to do with blocks which must be erased, but not completely rewritten. PROGRESS_CB is a function that will be periodically called to provide @@ -1634,7 +1633,7 @@ int target_follow_fork (int follow_child, int detach_fork); /* Handle the target-specific bookkeeping required when the inferior makes an exec call. INF is the exec'd inferior. */ -void target_follow_exec (struct inferior *inf, char *execd_pathname); +void target_follow_exec (struct inferior *inf, const char *execd_pathname); /* On some targets, we can catch an inferior exec event when it occurs. These functions insert/remove an already-created @@ -1680,7 +1679,7 @@ extern int target_can_run (); /* 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, @@ -1690,12 +1689,13 @@ extern int target_can_run (); 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 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 @@ -1706,7 +1706,8 @@ extern void target_pass_signals (int nsig, unsigned char *pass_signals); 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 program_signals); /* Check to see if a thread is still alive. */ @@ -1797,7 +1798,7 @@ extern int target_has_execution_current (void); (current_top_target ()->get_thread_control_capabilities () & tc_schedlock) /* Controls whether async mode is permitted. */ -extern int target_async_permitted; +extern bool target_async_permitted; /* Can the target support asynchronous execution? */ #define target_can_async_p() (current_top_target ()->can_async_p ()) @@ -1827,9 +1828,9 @@ extern int target_is_non_stop_p (void); `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 @@ -1849,6 +1850,12 @@ extern const char *target_thread_name (struct thread_info *); 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. @@ -2331,6 +2338,9 @@ extern void add_deprecated_target_alias (const target_info &info, 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); @@ -2468,12 +2478,12 @@ extern int remote_timeout; extern scoped_restore_tmpl make_scoped_restore_show_memory_breakpoints (int show); -extern int may_write_registers; -extern int may_write_memory; -extern int may_insert_breakpoints; -extern int may_insert_tracepoints; -extern int may_insert_fast_tracepoints; -extern int may_stop; +extern bool may_write_registers; +extern bool may_write_memory; +extern bool may_insert_breakpoints; +extern bool may_insert_tracepoints; +extern bool may_insert_fast_tracepoints; +extern bool may_stop; extern void update_target_permissions (void);