#include "server.h"
#include "tracepoint.h"
#include "gdbthread.h"
-#include "common/rsp-low.h"
+#include "gdbsupport/rsp-low.h"
#include <ctype.h>
#include <fcntl.h>
#include "tdesc.h"
#define IPA_SYM_STRUCT_NAME ipa_sym_addresses
-#include "common/agent.h"
+#include "gdbsupport/agent.h"
#define DEFAULT_TRACE_BUFFER_SIZE 5242880 /* 5*1024*1024 */
write_inferior_data_pointer (CORE_ADDR symaddr, CORE_ADDR val)
{
void *pval = (void *) (uintptr_t) val;
- return write_inferior_memory (symaddr,
+ return target_write_memory (symaddr,
(unsigned char *) &pval, sizeof (pval));
}
static int
write_inferior_integer (CORE_ADDR symaddr, int val)
{
- return write_inferior_memory (symaddr, (unsigned char *) &val, sizeof (val));
+ return target_write_memory (symaddr, (unsigned char *) &val, sizeof (val));
}
static int
write_inferior_int8 (CORE_ADDR symaddr, int8_t val)
{
- return write_inferior_memory (symaddr, (unsigned char *) &val, sizeof (val));
+ return target_write_memory (symaddr, (unsigned char *) &val, sizeof (val));
}
static int
write_inferior_uinteger (CORE_ADDR symaddr, unsigned int val)
{
- return write_inferior_memory (symaddr, (unsigned char *) &val, sizeof (val));
+ return target_write_memory (symaddr, (unsigned char *) &val, sizeof (val));
}
static CORE_ADDR target_malloc (ULONGEST size);
{
CORE_ADDR ipa_action = target_malloc (sizeof (struct collect_memory_action));
- write_inferior_memory (ipa_action, (unsigned char *) action,
+ target_write_memory (ipa_action, (unsigned char *) action,
sizeof (struct collect_memory_action));
return ipa_action;
{
CORE_ADDR ipa_action = target_malloc (sizeof (struct collect_registers_action));
- write_inferior_memory (ipa_action, (unsigned char *) action,
+ target_write_memory (ipa_action, (unsigned char *) action,
sizeof (struct collect_registers_action));
return ipa_action;
CORE_ADDR ipa_action = target_malloc (sizeof (struct eval_expr_action));
CORE_ADDR expr;
- write_inferior_memory (ipa_action, (unsigned char *) action,
+ target_write_memory (ipa_action, (unsigned char *) action,
sizeof (struct eval_expr_action));
expr = download_agent_expr (((struct eval_expr_action *) action)->expr);
write_inferior_data_pointer (ipa_action
CORE_ADDR ipa_action
= target_malloc (sizeof (struct collect_static_trace_data_action));
- write_inferior_memory (ipa_action, (unsigned char *) action,
+ target_write_memory (ipa_action, (unsigned char *) action,
sizeof (struct collect_static_trace_data_action));
return ipa_action;
/* Control structure holding the read/write/etc. pointers into the
trace buffer. We need more than one of these to implement a
- transaction-like mechanism to garantees that both GDBserver and the
+ transaction-like mechanism to guarantees that both GDBserver and the
in-process agent can try to change the trace buffer
simultaneously. */
ipa_trace_buffer_ctrl.wrap = ipa_trace_buffer_hi;
/* A traceframe with zeroed fields marks the end of trace data. */
- write_inferior_memory (ipa_sym_addrs.addr_trace_buffer_ctrl,
+ target_write_memory (ipa_sym_addrs.addr_trace_buffer_ctrl,
(unsigned char *) &ipa_trace_buffer_ctrl,
sizeof (ipa_trace_buffer_ctrl));
write_inferior_uinteger (ipa_sym_addrs.addr_trace_buffer_ctrl_curr, 0);
/* A traceframe with zeroed fields marks the end of trace data. */
- write_inferior_memory (ipa_trace_buffer_lo,
+ target_write_memory (ipa_trace_buffer_lo,
(unsigned char *) &ipa_traceframe,
sizeof (ipa_traceframe));
return NULL;
}
-/* Look for the block of type TYPE_WANTED in the trameframe starting
+/* Look for the block of type TYPE_WANTED in the traceframe starting
at DATABASE of DATASIZE bytes long. TFNUM is the traceframe
number. */
CORE_ADDR expr_bytes;
expr_addr = target_malloc (sizeof (*expr));
- write_inferior_memory (expr_addr, (unsigned char *) expr, sizeof (*expr));
+ target_write_memory (expr_addr, (unsigned char *) expr, sizeof (*expr));
expr_bytes = target_malloc (expr->length);
write_inferior_data_pointer (expr_addr + offsetof (struct agent_expr, bytes),
expr_bytes);
- write_inferior_memory (expr_bytes, expr->bytes, expr->length);
+ target_write_memory (expr_bytes, expr->bytes, expr->length);
return expr_addr;
}
tracepoints before clearing our own copy. */
target_tracepoint.hit_count = 0;
- write_inferior_memory (tpptr, (unsigned char *) &target_tracepoint,
+ target_write_memory (tpptr, (unsigned char *) &target_tracepoint,
sizeof (target_tracepoint));
if (tpoint->cond)
Assume no next, fixup when needed. */
target_tsv.next = NULL;
- write_inferior_memory (ptr, (unsigned char *) &target_tsv,
+ target_write_memory (ptr, (unsigned char *) &target_tsv,
sizeof (target_tsv));
if (tsv->name != NULL)
{
size_t size = strlen (tsv->name) + 1;
CORE_ADDR name_addr = target_malloc (size);
- write_inferior_memory (name_addr,
+ target_write_memory (name_addr,
(unsigned char *) tsv->name, size);
write_inferior_data_pointer (ptr
+ offsetof (struct trace_state_variable,
into GDBserver's trace buffer. This always uploads either all or
no trace frames. This is the counter part of
`trace_alloc_trace_buffer'. See its description of the atomic
- synching mechanism. */
+ syncing mechanism. */
static void
upload_fast_traceframes (void)
(int) (ipa_trace_buffer_hi - ipa_trace_buffer_lo));
}
- if (write_inferior_memory (ipa_trace_buffer_ctrl_addr,
+ if (target_write_memory (ipa_trace_buffer_ctrl_addr,
(unsigned char *) &ipa_trace_buffer_ctrl,
sizeof (struct ipa_trace_buffer_control)))
return;
result = fd = socket (PF_UNIX, SOCK_STREAM, 0);
if (result == -1)
{
- warning ("socket creation failed: %s", strerror (errno));
+ warning ("socket creation failed: %s", safe_strerror (errno));
return -1;
}
result = unlink (name);
if (result == -1)
{
- warning ("unlink failed: %s", strerror (errno));
+ warning ("unlink failed: %s", safe_strerror (errno));
close (fd);
return -1;
}
result = bind (fd, (struct sockaddr *) &addr, sizeof (addr));
if (result == -1)
{
- warning ("bind failed: %s", strerror (errno));
+ warning ("bind failed: %s", safe_strerror (errno));
close (fd);
return -1;
}
result = listen (fd, 1);
if (result == -1)
{
- warning ("listen: %s", strerror (errno));
+ warning ("listen: %s", safe_strerror (errno));
close (fd);
return -1;
}
if (listen_fd == -1)
{
- warning ("could not create sync socket\n");
+ warning ("could not create sync socket");
break;
}
if (fd < 0)
{
- warning ("Accept returned %d, error: %s\n",
- fd, strerror (errno));
+ warning ("Accept returned %d, error: %s",
+ fd, safe_strerror (errno));
break;
}
if (ret == -1)
{
warning ("reading socket (fd=%d) failed with %s",
- fd, strerror (errno));
+ fd, safe_strerror (errno));
close (fd);
break;
}