gdb.trace: Deduplicate write_inferior_data_ptr.
This function is now basically identical to write_inferior_data_pointer, remove it and change all references. gdb/gdbserver/ChangeLog: * tracepoint.c (x_tracepoint_action_download): Change write_inferior_data_ptr to write_inferior_data_pointer. (cmd_qtstart): Likewise. (write_inferior_data_ptr): Remove. (download_agent_expr): Change write_inferior_data_ptr to write_inferior_data_pointer. (download_tracepoint_1): Likewise. (download_tracepoint): Likewise. (download_trace_state_variables): Likewise.
This commit is contained in:
parent
d21b5f15d9
commit
020ecd38e7
|
@ -1,3 +1,15 @@
|
||||||
|
2016-02-12 Marcin Kościelnicki <koriakin@0x04.net>
|
||||||
|
|
||||||
|
* tracepoint.c (x_tracepoint_action_download): Change
|
||||||
|
write_inferior_data_ptr to write_inferior_data_pointer.
|
||||||
|
(cmd_qtstart): Likewise.
|
||||||
|
(write_inferior_data_ptr): Remove.
|
||||||
|
(download_agent_expr): Change write_inferior_data_ptr to
|
||||||
|
write_inferior_data_pointer.
|
||||||
|
(download_tracepoint_1): Likewise.
|
||||||
|
(download_tracepoint): Likewise.
|
||||||
|
(download_trace_state_variables): Likewise.
|
||||||
|
|
||||||
2016-02-11 Wei-cheng Wang <cole945@gmail.com>
|
2016-02-11 Wei-cheng Wang <cole945@gmail.com>
|
||||||
Marcin Kościelnicki <koriakin@0x04.net>
|
Marcin Kościelnicki <koriakin@0x04.net>
|
||||||
|
|
||||||
|
|
|
@ -452,7 +452,6 @@ write_inferior_uinteger (CORE_ADDR symaddr, unsigned int val)
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR target_malloc (ULONGEST size);
|
static CORE_ADDR target_malloc (ULONGEST size);
|
||||||
static int write_inferior_data_ptr (CORE_ADDR where, CORE_ADDR ptr);
|
|
||||||
|
|
||||||
#define COPY_FIELD_TO_BUF(BUF, OBJ, FIELD) \
|
#define COPY_FIELD_TO_BUF(BUF, OBJ, FIELD) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -553,9 +552,9 @@ x_tracepoint_action_download (const struct tracepoint_action *action)
|
||||||
write_inferior_memory (ipa_action, (unsigned char *) action,
|
write_inferior_memory (ipa_action, (unsigned char *) action,
|
||||||
sizeof (struct eval_expr_action));
|
sizeof (struct eval_expr_action));
|
||||||
expr = download_agent_expr (((struct eval_expr_action *) action)->expr);
|
expr = download_agent_expr (((struct eval_expr_action *) action)->expr);
|
||||||
write_inferior_data_ptr (ipa_action
|
write_inferior_data_pointer (ipa_action
|
||||||
+ offsetof (struct eval_expr_action, expr),
|
+ offsetof (struct eval_expr_action, expr),
|
||||||
expr);
|
expr);
|
||||||
|
|
||||||
return ipa_action;
|
return ipa_action;
|
||||||
}
|
}
|
||||||
|
@ -3214,7 +3213,7 @@ cmd_qtstart (char *packet)
|
||||||
|
|
||||||
/* Start out empty. */
|
/* Start out empty. */
|
||||||
if (agent_loaded_p ())
|
if (agent_loaded_p ())
|
||||||
write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, 0);
|
write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, 0);
|
||||||
|
|
||||||
/* Download and install tracepoints. */
|
/* Download and install tracepoints. */
|
||||||
for (tpoint = tracepoints; tpoint; tpoint = tpoint->next)
|
for (tpoint = tracepoints; tpoint; tpoint = tpoint->next)
|
||||||
|
@ -3310,11 +3309,11 @@ cmd_qtstart (char *packet)
|
||||||
if (tpoint == tracepoints)
|
if (tpoint == tracepoints)
|
||||||
/* First object in list, set the head pointer in the
|
/* First object in list, set the head pointer in the
|
||||||
inferior. */
|
inferior. */
|
||||||
write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, tpptr);
|
write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, tpptr);
|
||||||
else
|
else
|
||||||
write_inferior_data_ptr (prev_tpptr + offsetof (struct tracepoint,
|
write_inferior_data_pointer (prev_tpptr
|
||||||
next),
|
+ offsetof (struct tracepoint, next),
|
||||||
tpptr);
|
tpptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Any failure in the inner loop is sufficient cause to give
|
/* Any failure in the inner loop is sufficient cause to give
|
||||||
|
@ -5912,17 +5911,6 @@ compile_tracepoint_condition (struct tracepoint *tpoint,
|
||||||
*jump_entry += 16;
|
*jump_entry += 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We'll need to adjust these when we consider bi-arch setups. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
write_inferior_data_ptr (CORE_ADDR where, CORE_ADDR ptr)
|
|
||||||
{
|
|
||||||
uintptr_t pptr = ptr;
|
|
||||||
|
|
||||||
return write_inferior_memory (where,
|
|
||||||
(unsigned char *) &pptr, sizeof pptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The base pointer of the IPA's heap. This is the only memory the
|
/* The base pointer of the IPA's heap. This is the only memory the
|
||||||
IPA is allowed to use. The IPA should _not_ call the inferior's
|
IPA is allowed to use. The IPA should _not_ call the inferior's
|
||||||
`malloc' during operation. That'd be slow, and, most importantly,
|
`malloc' during operation. That'd be slow, and, most importantly,
|
||||||
|
@ -5968,8 +5956,8 @@ download_agent_expr (struct agent_expr *expr)
|
||||||
write_inferior_memory (expr_addr, (unsigned char *) expr, sizeof (*expr));
|
write_inferior_memory (expr_addr, (unsigned char *) expr, sizeof (*expr));
|
||||||
|
|
||||||
expr_bytes = target_malloc (expr->length);
|
expr_bytes = target_malloc (expr->length);
|
||||||
write_inferior_data_ptr (expr_addr + offsetof (struct agent_expr, bytes),
|
write_inferior_data_pointer (expr_addr + offsetof (struct agent_expr, bytes),
|
||||||
expr_bytes);
|
expr_bytes);
|
||||||
write_inferior_memory (expr_bytes, expr->bytes, expr->length);
|
write_inferior_memory (expr_bytes, expr->bytes, expr->length);
|
||||||
|
|
||||||
return expr_addr;
|
return expr_addr;
|
||||||
|
@ -6027,9 +6015,9 @@ download_tracepoint_1 (struct tracepoint *tpoint)
|
||||||
sizeof (target_tracepoint));
|
sizeof (target_tracepoint));
|
||||||
|
|
||||||
if (tpoint->cond)
|
if (tpoint->cond)
|
||||||
write_inferior_data_ptr (tpptr + offsetof (struct tracepoint,
|
write_inferior_data_pointer (tpptr
|
||||||
cond),
|
+ offsetof (struct tracepoint, cond),
|
||||||
download_agent_expr (tpoint->cond));
|
download_agent_expr (tpoint->cond));
|
||||||
|
|
||||||
if (tpoint->numactions)
|
if (tpoint->numactions)
|
||||||
{
|
{
|
||||||
|
@ -6039,9 +6027,9 @@ download_tracepoint_1 (struct tracepoint *tpoint)
|
||||||
/* The pointers array. */
|
/* The pointers array. */
|
||||||
actions_array
|
actions_array
|
||||||
= target_malloc (sizeof (*tpoint->actions) * tpoint->numactions);
|
= target_malloc (sizeof (*tpoint->actions) * tpoint->numactions);
|
||||||
write_inferior_data_ptr (tpptr + offsetof (struct tracepoint,
|
write_inferior_data_pointer (tpptr + offsetof (struct tracepoint,
|
||||||
actions),
|
actions),
|
||||||
actions_array);
|
actions_array);
|
||||||
|
|
||||||
/* Now for each pointer, download the action. */
|
/* Now for each pointer, download the action. */
|
||||||
for (i = 0; i < tpoint->numactions; i++)
|
for (i = 0; i < tpoint->numactions; i++)
|
||||||
|
@ -6050,9 +6038,9 @@ download_tracepoint_1 (struct tracepoint *tpoint)
|
||||||
CORE_ADDR ipa_action = tracepoint_action_download (action);
|
CORE_ADDR ipa_action = tracepoint_action_download (action);
|
||||||
|
|
||||||
if (ipa_action != 0)
|
if (ipa_action != 0)
|
||||||
write_inferior_data_ptr
|
write_inferior_data_pointer (actions_array
|
||||||
(actions_array + i * sizeof (*tpoint->actions),
|
+ i * sizeof (*tpoint->actions),
|
||||||
ipa_action);
|
ipa_action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6176,19 +6164,19 @@ download_tracepoint (struct tracepoint *tpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tpoint->next = tp_prev->next */
|
/* tpoint->next = tp_prev->next */
|
||||||
write_inferior_data_ptr (tpoint->obj_addr_on_target
|
write_inferior_data_pointer (tpoint->obj_addr_on_target
|
||||||
+ offsetof (struct tracepoint, next),
|
+ offsetof (struct tracepoint, next),
|
||||||
tp_prev_target_next_addr);
|
tp_prev_target_next_addr);
|
||||||
/* tp_prev->next = tpoint */
|
/* tp_prev->next = tpoint */
|
||||||
write_inferior_data_ptr (tp_prev->obj_addr_on_target
|
write_inferior_data_pointer (tp_prev->obj_addr_on_target
|
||||||
+ offsetof (struct tracepoint, next),
|
+ offsetof (struct tracepoint, next),
|
||||||
tpoint->obj_addr_on_target);
|
tpoint->obj_addr_on_target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* First object in list, set the head pointer in the
|
/* First object in list, set the head pointer in the
|
||||||
inferior. */
|
inferior. */
|
||||||
write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints,
|
write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints,
|
||||||
tpoint->obj_addr_on_target);
|
tpoint->obj_addr_on_target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6199,7 +6187,7 @@ download_trace_state_variables (void)
|
||||||
struct trace_state_variable *tsv;
|
struct trace_state_variable *tsv;
|
||||||
|
|
||||||
/* Start out empty. */
|
/* Start out empty. */
|
||||||
write_inferior_data_ptr (ipa_sym_addrs.addr_trace_state_variables, 0);
|
write_inferior_data_pointer (ipa_sym_addrs.addr_trace_state_variables, 0);
|
||||||
|
|
||||||
for (tsv = trace_state_variables; tsv != NULL; tsv = tsv->next)
|
for (tsv = trace_state_variables; tsv != NULL; tsv = tsv->next)
|
||||||
{
|
{
|
||||||
|
@ -6220,15 +6208,15 @@ download_trace_state_variables (void)
|
||||||
/* First object in list, set the head pointer in the
|
/* First object in list, set the head pointer in the
|
||||||
inferior. */
|
inferior. */
|
||||||
|
|
||||||
write_inferior_data_ptr (ipa_sym_addrs.addr_trace_state_variables,
|
write_inferior_data_pointer (ipa_sym_addrs.addr_trace_state_variables,
|
||||||
ptr);
|
ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
write_inferior_data_ptr (prev_ptr
|
write_inferior_data_pointer (prev_ptr
|
||||||
+ offsetof (struct trace_state_variable,
|
+ offsetof (struct trace_state_variable,
|
||||||
next),
|
next),
|
||||||
ptr);
|
ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the whole object. We'll fix up its pointers in a bit.
|
/* Write the whole object. We'll fix up its pointers in a bit.
|
||||||
|
@ -6244,10 +6232,10 @@ download_trace_state_variables (void)
|
||||||
CORE_ADDR name_addr = target_malloc (size);
|
CORE_ADDR name_addr = target_malloc (size);
|
||||||
write_inferior_memory (name_addr,
|
write_inferior_memory (name_addr,
|
||||||
(unsigned char *) tsv->name, size);
|
(unsigned char *) tsv->name, size);
|
||||||
write_inferior_data_ptr (ptr
|
write_inferior_data_pointer (ptr
|
||||||
+ offsetof (struct trace_state_variable,
|
+ offsetof (struct trace_state_variable,
|
||||||
name),
|
name),
|
||||||
name_addr);
|
name_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_assert (tsv->getter == NULL);
|
gdb_assert (tsv->getter == NULL);
|
||||||
|
@ -6256,9 +6244,9 @@ download_trace_state_variables (void)
|
||||||
if (prev_ptr != 0)
|
if (prev_ptr != 0)
|
||||||
{
|
{
|
||||||
/* Fixup the next pointer in the last item in the list. */
|
/* Fixup the next pointer in the last item in the list. */
|
||||||
write_inferior_data_ptr (prev_ptr
|
write_inferior_data_pointer (prev_ptr
|
||||||
+ offsetof (struct trace_state_variable,
|
+ offsetof (struct trace_state_variable,
|
||||||
next), 0);
|
next), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue