static char *write_ptid (char *buf, const char *endbuf, ptid_t ptid);
static ptid_t read_ptid (char *buf, char **obuf);
-static void remote_set_permissions (void);
+static void remote_set_permissions (struct target_ops *self);
struct remote_state;
-static int remote_get_trace_status (struct trace_status *ts);
+static int remote_get_trace_status (struct target_ops *self,
+ struct trace_status *ts);
-static int remote_upload_tracepoints (struct uploaded_tp **utpp);
+static int remote_upload_tracepoints (struct target_ops *self,
+ struct uploaded_tp **utpp);
-static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
+static int remote_upload_trace_state_variables (struct target_ops *self,
+ struct uploaded_tsv **utsvp);
static void remote_query_supported (void);
\f
static int
-remote_static_tracepoint_marker_at (CORE_ADDR addr,
+remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr,
struct static_tracepoint_marker *marker)
{
struct remote_state *rs = get_remote_state ();
}
static VEC(static_tracepoint_marker_p) *
-remote_static_tracepoint_markers_by_strid (const char *strid)
+remote_static_tracepoint_markers_by_strid (struct target_ops *self,
+ const char *strid)
{
struct remote_state *rs = get_remote_state ();
VEC(static_tracepoint_marker_p) *markers = NULL;
/* If the stub wants to get a QAllow, compose one and send it. */
if (remote_protocol_packets[PACKET_QAllow].support != PACKET_DISABLE)
- remote_set_permissions ();
+ remote_set_permissions (target);
/* Next, we possibly activate noack mode.
/* Upload TSVs regardless of whether the target is running or not. The
remote stub, such as GDBserver, may have some predefined or builtin
TSVs, even if the target is not running. */
- if (remote_get_trace_status (current_trace_status ()) != -1)
+ if (remote_get_trace_status (target, current_trace_status ()) != -1)
{
struct uploaded_tsv *uploaded_tsvs = NULL;
- remote_upload_trace_state_variables (&uploaded_tsvs);
+ remote_upload_trace_state_variables (target, &uploaded_tsvs);
merge_uploaded_trace_state_variables (&uploaded_tsvs);
}
/* Possibly the target has been engaged in a trace run started
previously; find out where things are at. */
- if (remote_get_trace_status (current_trace_status ()) != -1)
+ if (remote_get_trace_status (target, current_trace_status ()) != -1)
{
struct uploaded_tp *uploaded_tps = NULL;
if (current_trace_status ()->running)
printf_filtered (_("Trace is already running on the target.\n"));
- remote_upload_tracepoints (&uploaded_tps);
+ remote_upload_tracepoints (target, &uploaded_tps);
merge_uploaded_tracepoints (&uploaded_tps);
}
permissions. */
void
-remote_set_permissions (void)
+remote_set_permissions (struct target_ops *self)
{
struct remote_state *rs = get_remote_state ();
Returns 1 if ptid is found and thread_local_base is non zero. */
static int
-remote_get_tib_address (ptid_t ptid, CORE_ADDR *addr)
+remote_get_tib_address (struct target_ops *self, ptid_t ptid, CORE_ADDR *addr)
{
if (remote_protocol_packets[PACKET_qGetTIBAddr].support != PACKET_DISABLE)
{
/* Do not try this during initial connection, when we do not know
whether there is a running but stopped thread. */
if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid))
- return NULL;
+ return target->beneath->to_read_description (target->beneath);
if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
{
an architecture, but it's too tricky to do safely. */
}
- return NULL;
+ return target->beneath->to_read_description (target->beneath);
}
/* Remote file transfer support. This is host-initiated I/O, not
*REMOTE_ERRNO). */
static int
-remote_hostio_open (const char *filename, int flags, int mode,
+remote_hostio_open (struct target_ops *self,
+ const char *filename, int flags, int mode,
int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
set *REMOTE_ERRNO). */
static int
-remote_hostio_pwrite (int fd, const gdb_byte *write_buf, int len,
+remote_hostio_pwrite (struct target_ops *self,
+ int fd, const gdb_byte *write_buf, int len,
ULONGEST offset, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
set *REMOTE_ERRNO). */
static int
-remote_hostio_pread (int fd, gdb_byte *read_buf, int len,
+remote_hostio_pread (struct target_ops *self,
+ int fd, gdb_byte *read_buf, int len,
ULONGEST offset, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
(and set *REMOTE_ERRNO). */
static int
-remote_hostio_close (int fd, int *remote_errno)
+remote_hostio_close (struct target_ops *self, int fd, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
occurs (and set *REMOTE_ERRNO). */
static int
-remote_hostio_unlink (const char *filename, int *remote_errno)
+remote_hostio_unlink (struct target_ops *self,
+ const char *filename, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
occurs (and set *REMOTE_ERRNO). */
static char *
-remote_hostio_readlink (const char *filename, int *remote_errno)
+remote_hostio_readlink (struct target_ops *self,
+ const char *filename, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
int fd = *(int *) opaque;
int remote_errno;
- remote_hostio_close (fd, &remote_errno);
+ remote_hostio_close (find_target_at (process_stratum), fd, &remote_errno);
}
gdb_assert (remote_filename_p (filename));
- fd = remote_hostio_open (filename + 7, FILEIO_O_RDONLY, 0, &remote_errno);
+ fd = remote_hostio_open (find_target_at (process_stratum),
+ filename + 7, FILEIO_O_RDONLY, 0, &remote_errno);
if (fd == -1)
{
errno = remote_fileio_errno_to_host (remote_errno);
/* Ignore errors on close; these may happen if the remote
connection was already torn down. */
- remote_hostio_close (fd, &remote_errno);
+ remote_hostio_close (find_target_at (process_stratum), fd, &remote_errno);
/* Zero means success. */
return 0;
pos = 0;
while (nbytes > pos)
{
- bytes = remote_hostio_pread (fd, (gdb_byte *) buf + pos, nbytes - pos,
+ bytes = remote_hostio_pread (find_target_at (process_stratum),
+ fd, (gdb_byte *) buf + pos, nbytes - pos,
offset + pos, &remote_errno);
if (bytes == 0)
/* Success, but no bytes, means end-of-file. */
perror_with_name (local_file);
back_to = make_cleanup_fclose (file);
- fd = remote_hostio_open (remote_file, (FILEIO_O_WRONLY | FILEIO_O_CREAT
+ fd = remote_hostio_open (find_target_at (process_stratum),
+ remote_file, (FILEIO_O_WRONLY | FILEIO_O_CREAT
| FILEIO_O_TRUNC),
0700, &remote_errno);
if (fd == -1)
bytes += bytes_in_buffer;
bytes_in_buffer = 0;
- retcode = remote_hostio_pwrite (fd, buffer, bytes,
+ retcode = remote_hostio_pwrite (find_target_at (process_stratum),
+ fd, buffer, bytes,
offset, &remote_errno);
if (retcode < 0)
}
discard_cleanups (close_cleanup);
- if (remote_hostio_close (fd, &remote_errno))
+ if (remote_hostio_close (find_target_at (process_stratum), fd, &remote_errno))
remote_hostio_error (remote_errno);
if (from_tty)
if (!rs->remote_desc)
error (_("command can only be used with remote target"));
- fd = remote_hostio_open (remote_file, FILEIO_O_RDONLY, 0, &remote_errno);
+ fd = remote_hostio_open (find_target_at (process_stratum),
+ remote_file, FILEIO_O_RDONLY, 0, &remote_errno);
if (fd == -1)
remote_hostio_error (remote_errno);
offset = 0;
while (1)
{
- bytes = remote_hostio_pread (fd, buffer, io_size, offset, &remote_errno);
+ bytes = remote_hostio_pread (find_target_at (process_stratum),
+ fd, buffer, io_size, offset, &remote_errno);
if (bytes == 0)
/* Success, but no bytes, means end-of-file. */
break;
}
discard_cleanups (close_cleanup);
- if (remote_hostio_close (fd, &remote_errno))
+ if (remote_hostio_close (find_target_at (process_stratum), fd, &remote_errno))
remote_hostio_error (remote_errno);
if (from_tty)
if (!rs->remote_desc)
error (_("command can only be used with remote target"));
- retcode = remote_hostio_unlink (remote_file, &remote_errno);
+ retcode = remote_hostio_unlink (find_target_at (process_stratum),
+ remote_file, &remote_errno);
if (retcode == -1)
remote_hostio_error (remote_errno);
}
static void
-remote_trace_init (void)
+remote_trace_init (struct target_ops *self)
{
putpkt ("QTinit");
remote_get_noisy_reply (&target_buf, &target_buf_size);
}
static void
-remote_download_tracepoint (struct bp_location *loc)
+remote_download_tracepoint (struct target_ops *self, struct bp_location *loc)
{
#define BUF_SIZE 2048
}
static int
-remote_can_download_tracepoint (void)
+remote_can_download_tracepoint (struct target_ops *self)
{
struct remote_state *rs = get_remote_state ();
struct trace_status *ts;
return 0;
ts = current_trace_status ();
- status = remote_get_trace_status (ts);
+ status = remote_get_trace_status (self, ts);
if (status == -1 || !ts->running_known || !ts->running)
return 0;
static void
-remote_download_trace_state_variable (struct trace_state_variable *tsv)
+remote_download_trace_state_variable (struct target_ops *self,
+ struct trace_state_variable *tsv)
{
struct remote_state *rs = get_remote_state ();
char *p;
}
static void
-remote_enable_tracepoint (struct bp_location *location)
+remote_enable_tracepoint (struct target_ops *self,
+ struct bp_location *location)
{
struct remote_state *rs = get_remote_state ();
char addr_buf[40];
}
static void
-remote_disable_tracepoint (struct bp_location *location)
+remote_disable_tracepoint (struct target_ops *self,
+ struct bp_location *location)
{
struct remote_state *rs = get_remote_state ();
char addr_buf[40];
}
static void
-remote_trace_set_readonly_regions (void)
+remote_trace_set_readonly_regions (struct target_ops *self)
{
asection *s;
bfd *abfd = NULL;
}
static void
-remote_trace_start (void)
+remote_trace_start (struct target_ops *self)
{
putpkt ("QTStart");
remote_get_noisy_reply (&target_buf, &target_buf_size);
}
static int
-remote_get_trace_status (struct trace_status *ts)
+remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
{
/* Initialize it just to avoid a GCC false warning. */
char *p = NULL;
}
static void
-remote_get_tracepoint_status (struct breakpoint *bp,
+remote_get_tracepoint_status (struct target_ops *self, struct breakpoint *bp,
struct uploaded_tp *utp)
{
struct remote_state *rs = get_remote_state ();
}
static void
-remote_trace_stop (void)
+remote_trace_stop (struct target_ops *self)
{
putpkt ("QTStop");
remote_get_noisy_reply (&target_buf, &target_buf_size);
}
static int
-remote_trace_find (enum trace_find_type type, int num,
+remote_trace_find (struct target_ops *self,
+ enum trace_find_type type, int num,
CORE_ADDR addr1, CORE_ADDR addr2,
int *tpp)
{
}
static int
-remote_get_trace_state_variable_value (int tsvnum, LONGEST *val)
+remote_get_trace_state_variable_value (struct target_ops *self,
+ int tsvnum, LONGEST *val)
{
struct remote_state *rs = get_remote_state ();
char *reply;
}
static int
-remote_save_trace_data (const char *filename)
+remote_save_trace_data (struct target_ops *self, const char *filename)
{
struct remote_state *rs = get_remote_state ();
char *p, *reply;
not be unhappy if we don't get as much as we ask for. */
static LONGEST
-remote_get_raw_trace_data (gdb_byte *buf, ULONGEST offset, LONGEST len)
+remote_get_raw_trace_data (struct target_ops *self,
+ gdb_byte *buf, ULONGEST offset, LONGEST len)
{
struct remote_state *rs = get_remote_state ();
char *reply;
}
static void
-remote_set_disconnected_tracing (int val)
+remote_set_disconnected_tracing (struct target_ops *self, int val)
{
struct remote_state *rs = get_remote_state ();
}
static void
-remote_set_circular_trace_buffer (int val)
+remote_set_circular_trace_buffer (struct target_ops *self, int val)
{
struct remote_state *rs = get_remote_state ();
char *reply;
}
static struct traceframe_info *
-remote_traceframe_info (void)
+remote_traceframe_info (struct target_ops *self)
{
char *text;
length is unknown. */
static int
-remote_get_min_fast_tracepoint_insn_len (void)
+remote_get_min_fast_tracepoint_insn_len (struct target_ops *self)
{
struct remote_state *rs = get_remote_state ();
char *reply;
}
static void
-remote_set_trace_buffer_size (LONGEST val)
+remote_set_trace_buffer_size (struct target_ops *self, LONGEST val)
{
if (remote_protocol_packets[PACKET_QTBuffer_size].support
!= PACKET_DISABLE)
}
static int
-remote_set_trace_notes (const char *user, const char *notes,
+remote_set_trace_notes (struct target_ops *self,
+ const char *user, const char *notes,
const char *stop_notes)
{
struct remote_state *rs = get_remote_state ();
}
static int
-remote_use_agent (int use)
+remote_use_agent (struct target_ops *self, int use)
{
if (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE)
{
}
static int
-remote_can_use_agent (void)
+remote_can_use_agent (struct target_ops *self)
{
return (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE);
}
/* Enable branch tracing. */
static struct btrace_target_info *
-remote_enable_btrace (ptid_t ptid)
+remote_enable_btrace (struct target_ops *self, ptid_t ptid)
{
struct btrace_target_info *tinfo = NULL;
struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_bts];
/* Disable branch tracing. */
static void
-remote_disable_btrace (struct btrace_target_info *tinfo)
+remote_disable_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_off];
struct remote_state *rs = get_remote_state ();
/* Teardown branch tracing. */
static void
-remote_teardown_btrace (struct btrace_target_info *tinfo)
+remote_teardown_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
/* We must not talk to the target during teardown. */
xfree (tinfo);
/* Read the branch trace. */
static enum btrace_error
-remote_read_btrace (VEC (btrace_block_s) **btrace,
+remote_read_btrace (struct target_ops *self,
+ VEC (btrace_block_s) **btrace,
struct btrace_target_info *tinfo,
enum btrace_read_type type)
{
}
static int
-remote_augmented_libraries_svr4_read (void)
+remote_augmented_libraries_svr4_read (struct target_ops *self)
{
struct remote_state *rs = get_remote_state ();
collection. */
static int
-remote_upload_tracepoints (struct uploaded_tp **utpp)
+remote_upload_tracepoints (struct target_ops *self, struct uploaded_tp **utpp)
{
struct remote_state *rs = get_remote_state ();
char *p;
}
static int
-remote_upload_trace_state_variables (struct uploaded_tsv **utsvp)
+remote_upload_trace_state_variables (struct target_ops *self,
+ struct uploaded_tsv **utsvp)
{
struct remote_state *rs = get_remote_state ();
char *p;