* [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr. @ 2016-01-28 15:42 Marcin Kościelnicki 2016-02-06 1:05 ` Marcin Kościelnicki 0 siblings, 1 reply; 6+ messages in thread From: Marcin Kościelnicki @ 2016-01-28 15:42 UTC (permalink / raw) To: gdb-patches; +Cc: Marcin Kościelnicki 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. --- OK to push? gdb/gdbserver/ChangeLog | 12 ++++++++++++ gdb/gdbserver/tracepoint.c | 44 ++++++++++++++++---------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 1f9c139..50eda62 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,15 @@ +2016-01-28 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-01-28 Simon Marchi <simon.marchi@ericsson.com> * server.c (skip_to_semicolon): Remove. diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 0671999..6b9a33c 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -452,7 +452,6 @@ write_inferior_uinteger (CORE_ADDR symaddr, unsigned int val) } 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) \ do { \ @@ -589,7 +588,7 @@ x_tracepoint_action_download (const struct tracepoint_action *action) write_inferior_memory (ipa_action, (unsigned char *) &action->type, size_in_ipa); expr = download_agent_expr (((struct eval_expr_action *)action)->expr); - write_inferior_data_ptr (ipa_action + offsetof (struct eval_expr_action, expr) + write_inferior_data_pointer (ipa_action + offsetof (struct eval_expr_action, expr) - offsetof (struct tracepoint_action, type), expr); @@ -3233,7 +3232,7 @@ cmd_qtstart (char *packet) /* Start out empty. */ 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. */ for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) @@ -3329,9 +3328,9 @@ cmd_qtstart (char *packet) if (tpoint == tracepoints) /* First object in list, set the head pointer in the inferior. */ - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, tpptr); + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, tpptr); else - write_inferior_data_ptr (prev_tpptr + offsetof (struct tracepoint, + write_inferior_data_pointer (prev_tpptr + offsetof (struct tracepoint, next), tpptr); } @@ -5931,17 +5930,6 @@ compile_tracepoint_condition (struct tracepoint *tpoint, *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 IPA is allowed to use. The IPA should _not_ call the inferior's `malloc' during operation. That'd be slow, and, most importantly, @@ -5987,7 +5975,7 @@ download_agent_expr (struct agent_expr *expr) write_inferior_memory (expr_addr, (unsigned char *) expr, sizeof (*expr)); 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); write_inferior_memory (expr_bytes, expr->bytes, expr->length); @@ -6046,7 +6034,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) sizeof (target_tracepoint)); if (tpoint->cond) - write_inferior_data_ptr (tpptr + offsetof (struct tracepoint, + write_inferior_data_pointer (tpptr + offsetof (struct tracepoint, cond), download_agent_expr (tpoint->cond)); @@ -6058,7 +6046,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) /* The pointers array. */ actions_array = 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_array); @@ -6069,7 +6057,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) CORE_ADDR ipa_action = action->ops->download (action); if (ipa_action != 0) - write_inferior_data_ptr + write_inferior_data_pointer (actions_array + i * sizeof (*tpoint->actions), ipa_action); } @@ -6195,18 +6183,18 @@ download_tracepoint (struct tracepoint *tpoint) } /* 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), tp_prev_target_next_addr); /* 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), tpoint->obj_addr_on_target); } else /* First object in list, set the head pointer in the inferior. */ - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, tpoint->obj_addr_on_target); } @@ -6218,7 +6206,7 @@ download_trace_state_variables (void) struct trace_state_variable *tsv; /* 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) { @@ -6239,12 +6227,12 @@ download_trace_state_variables (void) /* First object in list, set the head pointer in the inferior. */ - write_inferior_data_ptr (ipa_sym_addrs.addr_trace_state_variables, + write_inferior_data_pointer (ipa_sym_addrs.addr_trace_state_variables, ptr); } else { - write_inferior_data_ptr (prev_ptr + write_inferior_data_pointer (prev_ptr + offsetof (struct trace_state_variable, next), ptr); @@ -6263,7 +6251,7 @@ download_trace_state_variables (void) CORE_ADDR name_addr = target_malloc (size); write_inferior_memory (name_addr, (unsigned char *) tsv->name, size); - write_inferior_data_ptr (ptr + write_inferior_data_pointer (ptr + offsetof (struct trace_state_variable, name), name_addr); @@ -6275,7 +6263,7 @@ download_trace_state_variables (void) if (prev_ptr != 0) { /* 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, next), 0); } -- 2.7.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr. 2016-01-28 15:42 [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr Marcin Kościelnicki @ 2016-02-06 1:05 ` Marcin Kościelnicki 2016-02-12 10:56 ` Marcin Kościelnicki 0 siblings, 1 reply; 6+ messages in thread From: Marcin Kościelnicki @ 2016-02-06 1:05 UTC (permalink / raw) To: gdb-patches Ping On 28/01/16 16:42, Marcin KoÅcielnicki wrote: > 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. > --- > OK to push? > > gdb/gdbserver/ChangeLog | 12 ++++++++++++ > gdb/gdbserver/tracepoint.c | 44 ++++++++++++++++---------------------------- > 2 files changed, 28 insertions(+), 28 deletions(-) > > diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog > index 1f9c139..50eda62 100644 > --- a/gdb/gdbserver/ChangeLog > +++ b/gdb/gdbserver/ChangeLog > @@ -1,3 +1,15 @@ > +2016-01-28 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-01-28 Simon Marchi <simon.marchi@ericsson.com> > > * server.c (skip_to_semicolon): Remove. > diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c > index 0671999..6b9a33c 100644 > --- a/gdb/gdbserver/tracepoint.c > +++ b/gdb/gdbserver/tracepoint.c > @@ -452,7 +452,6 @@ write_inferior_uinteger (CORE_ADDR symaddr, unsigned int val) > } > > 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) \ > do { \ > @@ -589,7 +588,7 @@ x_tracepoint_action_download (const struct tracepoint_action *action) > write_inferior_memory (ipa_action, (unsigned char *) &action->type, > size_in_ipa); > expr = download_agent_expr (((struct eval_expr_action *)action)->expr); > - write_inferior_data_ptr (ipa_action + offsetof (struct eval_expr_action, expr) > + write_inferior_data_pointer (ipa_action + offsetof (struct eval_expr_action, expr) > - offsetof (struct tracepoint_action, type), > expr); > > @@ -3233,7 +3232,7 @@ cmd_qtstart (char *packet) > > /* Start out empty. */ > 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. */ > for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) > @@ -3329,9 +3328,9 @@ cmd_qtstart (char *packet) > if (tpoint == tracepoints) > /* First object in list, set the head pointer in the > inferior. */ > - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, tpptr); > + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, tpptr); > else > - write_inferior_data_ptr (prev_tpptr + offsetof (struct tracepoint, > + write_inferior_data_pointer (prev_tpptr + offsetof (struct tracepoint, > next), > tpptr); > } > @@ -5931,17 +5930,6 @@ compile_tracepoint_condition (struct tracepoint *tpoint, > *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 > IPA is allowed to use. The IPA should _not_ call the inferior's > `malloc' during operation. That'd be slow, and, most importantly, > @@ -5987,7 +5975,7 @@ download_agent_expr (struct agent_expr *expr) > write_inferior_memory (expr_addr, (unsigned char *) expr, sizeof (*expr)); > > 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); > write_inferior_memory (expr_bytes, expr->bytes, expr->length); > > @@ -6046,7 +6034,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) > sizeof (target_tracepoint)); > > if (tpoint->cond) > - write_inferior_data_ptr (tpptr + offsetof (struct tracepoint, > + write_inferior_data_pointer (tpptr + offsetof (struct tracepoint, > cond), > download_agent_expr (tpoint->cond)); > > @@ -6058,7 +6046,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) > /* The pointers array. */ > actions_array > = 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_array); > > @@ -6069,7 +6057,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) > CORE_ADDR ipa_action = action->ops->download (action); > > if (ipa_action != 0) > - write_inferior_data_ptr > + write_inferior_data_pointer > (actions_array + i * sizeof (*tpoint->actions), > ipa_action); > } > @@ -6195,18 +6183,18 @@ download_tracepoint (struct tracepoint *tpoint) > } > > /* 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), > tp_prev_target_next_addr); > /* 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), > tpoint->obj_addr_on_target); > } > else > /* First object in list, set the head pointer in the > inferior. */ > - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, > + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, > tpoint->obj_addr_on_target); > > } > @@ -6218,7 +6206,7 @@ download_trace_state_variables (void) > struct trace_state_variable *tsv; > > /* 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) > { > @@ -6239,12 +6227,12 @@ download_trace_state_variables (void) > /* First object in list, set the head pointer in the > inferior. */ > > - write_inferior_data_ptr (ipa_sym_addrs.addr_trace_state_variables, > + write_inferior_data_pointer (ipa_sym_addrs.addr_trace_state_variables, > ptr); > } > else > { > - write_inferior_data_ptr (prev_ptr > + write_inferior_data_pointer (prev_ptr > + offsetof (struct trace_state_variable, > next), > ptr); > @@ -6263,7 +6251,7 @@ download_trace_state_variables (void) > CORE_ADDR name_addr = target_malloc (size); > write_inferior_memory (name_addr, > (unsigned char *) tsv->name, size); > - write_inferior_data_ptr (ptr > + write_inferior_data_pointer (ptr > + offsetof (struct trace_state_variable, > name), > name_addr); > @@ -6275,7 +6263,7 @@ download_trace_state_variables (void) > if (prev_ptr != 0) > { > /* 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, > next), 0); > } > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr. 2016-02-06 1:05 ` Marcin Kościelnicki @ 2016-02-12 10:56 ` Marcin Kościelnicki 2016-02-12 11:37 ` Marcin Kościelnicki 0 siblings, 1 reply; 6+ messages in thread From: Marcin Kościelnicki @ 2016-02-12 10:56 UTC (permalink / raw) To: gdb-patches Ping On 06/02/16 02:05, Marcin KoÅcielnicki wrote: > Ping > > On 28/01/16 16:42, Marcin KoÅcielnicki wrote: >> 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. >> --- >> OK to push? >> >> gdb/gdbserver/ChangeLog | 12 ++++++++++++ >> gdb/gdbserver/tracepoint.c | 44 >> ++++++++++++++++---------------------------- >> 2 files changed, 28 insertions(+), 28 deletions(-) >> >> diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog >> index 1f9c139..50eda62 100644 >> --- a/gdb/gdbserver/ChangeLog >> +++ b/gdb/gdbserver/ChangeLog >> @@ -1,3 +1,15 @@ >> +2016-01-28 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-01-28 Simon Marchi <simon.marchi@ericsson.com> >> >> * server.c (skip_to_semicolon): Remove. >> diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c >> index 0671999..6b9a33c 100644 >> --- a/gdb/gdbserver/tracepoint.c >> +++ b/gdb/gdbserver/tracepoint.c >> @@ -452,7 +452,6 @@ write_inferior_uinteger (CORE_ADDR symaddr, >> unsigned int val) >> } >> >> 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) \ >> do { \ >> @@ -589,7 +588,7 @@ x_tracepoint_action_download (const struct >> tracepoint_action *action) >> write_inferior_memory (ipa_action, (unsigned char *) &action->type, >> size_in_ipa); >> expr = download_agent_expr (((struct eval_expr_action >> *)action)->expr); >> - write_inferior_data_ptr (ipa_action + offsetof (struct >> eval_expr_action, expr) >> + write_inferior_data_pointer (ipa_action + offsetof (struct >> eval_expr_action, expr) >> - offsetof (struct tracepoint_action, type), >> expr); >> >> @@ -3233,7 +3232,7 @@ cmd_qtstart (char *packet) >> >> /* Start out empty. */ >> 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. */ >> for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) >> @@ -3329,9 +3328,9 @@ cmd_qtstart (char *packet) >> if (tpoint == tracepoints) >> /* First object in list, set the head pointer in the >> inferior. */ >> - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, tpptr); >> + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, >> tpptr); >> else >> - write_inferior_data_ptr (prev_tpptr + offsetof (struct >> tracepoint, >> + write_inferior_data_pointer (prev_tpptr + offsetof (struct >> tracepoint, >> next), >> tpptr); >> } >> @@ -5931,17 +5930,6 @@ compile_tracepoint_condition (struct tracepoint >> *tpoint, >> *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 >> IPA is allowed to use. The IPA should _not_ call the inferior's >> `malloc' during operation. That'd be slow, and, most importantly, >> @@ -5987,7 +5975,7 @@ download_agent_expr (struct agent_expr *expr) >> write_inferior_memory (expr_addr, (unsigned char *) expr, sizeof >> (*expr)); >> >> 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); >> write_inferior_memory (expr_bytes, expr->bytes, expr->length); >> >> @@ -6046,7 +6034,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) >> sizeof (target_tracepoint)); >> >> if (tpoint->cond) >> - write_inferior_data_ptr (tpptr + offsetof (struct tracepoint, >> + write_inferior_data_pointer (tpptr + offsetof (struct tracepoint, >> cond), >> download_agent_expr (tpoint->cond)); >> >> @@ -6058,7 +6046,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) >> /* The pointers array. */ >> actions_array >> = 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_array); >> >> @@ -6069,7 +6057,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) >> CORE_ADDR ipa_action = action->ops->download (action); >> >> if (ipa_action != 0) >> - write_inferior_data_ptr >> + write_inferior_data_pointer >> (actions_array + i * sizeof (*tpoint->actions), >> ipa_action); >> } >> @@ -6195,18 +6183,18 @@ download_tracepoint (struct tracepoint *tpoint) >> } >> >> /* 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), >> tp_prev_target_next_addr); >> /* 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), >> tpoint->obj_addr_on_target); >> } >> else >> /* First object in list, set the head pointer in the >> inferior. */ >> - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, >> + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, >> tpoint->obj_addr_on_target); >> >> } >> @@ -6218,7 +6206,7 @@ download_trace_state_variables (void) >> struct trace_state_variable *tsv; >> >> /* 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) >> { >> @@ -6239,12 +6227,12 @@ download_trace_state_variables (void) >> /* First object in list, set the head pointer in the >> inferior. */ >> >> - write_inferior_data_ptr (ipa_sym_addrs.addr_trace_state_variables, >> + write_inferior_data_pointer >> (ipa_sym_addrs.addr_trace_state_variables, >> ptr); >> } >> else >> { >> - write_inferior_data_ptr (prev_ptr >> + write_inferior_data_pointer (prev_ptr >> + offsetof (struct trace_state_variable, >> next), >> ptr); >> @@ -6263,7 +6251,7 @@ download_trace_state_variables (void) >> CORE_ADDR name_addr = target_malloc (size); >> write_inferior_memory (name_addr, >> (unsigned char *) tsv->name, size); >> - write_inferior_data_ptr (ptr >> + write_inferior_data_pointer (ptr >> + offsetof (struct trace_state_variable, >> name), >> name_addr); >> @@ -6275,7 +6263,7 @@ download_trace_state_variables (void) >> if (prev_ptr != 0) >> { >> /* 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, >> next), 0); >> } >> > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr. 2016-02-12 10:56 ` Marcin Kościelnicki @ 2016-02-12 11:37 ` Marcin Kościelnicki 2016-02-12 11:47 ` Pedro Alves 0 siblings, 1 reply; 6+ messages in thread From: Marcin Kościelnicki @ 2016-02-12 11:37 UTC (permalink / raw) To: gdb-patches; +Cc: Marcin Kościelnicki 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. --- Whoops, fixed a conflict with changes on master. Also fixed lots of indents. gdb/gdbserver/ChangeLog | 12 ++++++ gdb/gdbserver/tracepoint.c | 94 ++++++++++++++++++++-------------------------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 0e8c5ae..ca82f91 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -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> Marcin KoÅcielnicki <koriakin@0x04.net> diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 67995ac..e7c18fd 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -452,7 +452,6 @@ write_inferior_uinteger (CORE_ADDR symaddr, unsigned int val) } 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) \ do { \ @@ -553,9 +552,9 @@ x_tracepoint_action_download (const struct tracepoint_action *action) write_inferior_memory (ipa_action, (unsigned char *) action, sizeof (struct eval_expr_action)); expr = download_agent_expr (((struct eval_expr_action *) action)->expr); - write_inferior_data_ptr (ipa_action - + offsetof (struct eval_expr_action, expr), - expr); + write_inferior_data_pointer (ipa_action + + offsetof (struct eval_expr_action, expr), + expr); return ipa_action; } @@ -3214,7 +3213,7 @@ cmd_qtstart (char *packet) /* Start out empty. */ 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. */ for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) @@ -3310,11 +3309,11 @@ cmd_qtstart (char *packet) if (tpoint == tracepoints) /* First object in list, set the head pointer in the inferior. */ - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, tpptr); + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, tpptr); else - write_inferior_data_ptr (prev_tpptr + offsetof (struct tracepoint, - next), - tpptr); + write_inferior_data_pointer (prev_tpptr + + offsetof (struct tracepoint, next), + tpptr); } /* Any failure in the inner loop is sufficient cause to give @@ -5912,17 +5911,6 @@ compile_tracepoint_condition (struct tracepoint *tpoint, *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 IPA is allowed to use. The IPA should _not_ call the inferior's `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)); expr_bytes = target_malloc (expr->length); - write_inferior_data_ptr (expr_addr + offsetof (struct agent_expr, bytes), - expr_bytes); + write_inferior_data_pointer (expr_addr + offsetof (struct agent_expr, bytes), + expr_bytes); write_inferior_memory (expr_bytes, expr->bytes, expr->length); return expr_addr; @@ -6027,9 +6015,9 @@ download_tracepoint_1 (struct tracepoint *tpoint) sizeof (target_tracepoint)); if (tpoint->cond) - write_inferior_data_ptr (tpptr + offsetof (struct tracepoint, - cond), - download_agent_expr (tpoint->cond)); + write_inferior_data_pointer (tpptr + + offsetof (struct tracepoint, cond), + download_agent_expr (tpoint->cond)); if (tpoint->numactions) { @@ -6039,9 +6027,9 @@ download_tracepoint_1 (struct tracepoint *tpoint) /* The pointers array. */ actions_array = target_malloc (sizeof (*tpoint->actions) * tpoint->numactions); - write_inferior_data_ptr (tpptr + offsetof (struct tracepoint, - actions), - actions_array); + write_inferior_data_pointer (tpptr + offsetof (struct tracepoint, + actions), + actions_array); /* Now for each pointer, download the action. */ 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); if (ipa_action != 0) - write_inferior_data_ptr - (actions_array + i * sizeof (*tpoint->actions), - ipa_action); + write_inferior_data_pointer (actions_array + + i * sizeof (*tpoint->actions), + ipa_action); } } } @@ -6176,19 +6164,19 @@ download_tracepoint (struct tracepoint *tpoint) } /* tpoint->next = tp_prev->next */ - write_inferior_data_ptr (tpoint->obj_addr_on_target - + offsetof (struct tracepoint, next), - tp_prev_target_next_addr); + write_inferior_data_pointer (tpoint->obj_addr_on_target + + offsetof (struct tracepoint, next), + tp_prev_target_next_addr); /* tp_prev->next = tpoint */ - write_inferior_data_ptr (tp_prev->obj_addr_on_target - + offsetof (struct tracepoint, next), - tpoint->obj_addr_on_target); + write_inferior_data_pointer (tp_prev->obj_addr_on_target + + offsetof (struct tracepoint, next), + tpoint->obj_addr_on_target); } else /* First object in list, set the head pointer in the inferior. */ - write_inferior_data_ptr (ipa_sym_addrs.addr_tracepoints, - tpoint->obj_addr_on_target); + write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, + tpoint->obj_addr_on_target); } @@ -6199,7 +6187,7 @@ download_trace_state_variables (void) struct trace_state_variable *tsv; /* 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) { @@ -6220,15 +6208,15 @@ download_trace_state_variables (void) /* First object in list, set the head pointer in the inferior. */ - write_inferior_data_ptr (ipa_sym_addrs.addr_trace_state_variables, - ptr); + write_inferior_data_pointer (ipa_sym_addrs.addr_trace_state_variables, + ptr); } else { - write_inferior_data_ptr (prev_ptr - + offsetof (struct trace_state_variable, - next), - ptr); + write_inferior_data_pointer (prev_ptr + + offsetof (struct trace_state_variable, + next), + ptr); } /* 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); write_inferior_memory (name_addr, (unsigned char *) tsv->name, size); - write_inferior_data_ptr (ptr - + offsetof (struct trace_state_variable, - name), - name_addr); + write_inferior_data_pointer (ptr + + offsetof (struct trace_state_variable, + name), + name_addr); } gdb_assert (tsv->getter == NULL); @@ -6256,9 +6244,9 @@ download_trace_state_variables (void) if (prev_ptr != 0) { /* Fixup the next pointer in the last item in the list. */ - write_inferior_data_ptr (prev_ptr - + offsetof (struct trace_state_variable, - next), 0); + write_inferior_data_pointer (prev_ptr + + offsetof (struct trace_state_variable, + next), 0); } } -- 2.7.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr. 2016-02-12 11:37 ` Marcin Kościelnicki @ 2016-02-12 11:47 ` Pedro Alves 2016-02-12 11:48 ` Marcin Kościelnicki 0 siblings, 1 reply; 6+ messages in thread From: Pedro Alves @ 2016-02-12 11:47 UTC (permalink / raw) To: Marcin Kościelnicki, gdb-patches On 02/12/2016 11:37 AM, Marcin KoÅcielnicki wrote: > 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. > --- > Whoops, fixed a conflict with changes on master. Also fixed lots of indents. OK. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr. 2016-02-12 11:47 ` Pedro Alves @ 2016-02-12 11:48 ` Marcin Kościelnicki 0 siblings, 0 replies; 6+ messages in thread From: Marcin Kościelnicki @ 2016-02-12 11:48 UTC (permalink / raw) To: Pedro Alves, gdb-patches On 12/02/16 12:46, Pedro Alves wrote: > On 02/12/2016 11:37 AM, Marcin KoÅcielnicki wrote: >> 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. >> --- >> Whoops, fixed a conflict with changes on master. Also fixed lots of indents. > > OK. > > Thanks, > Pedro Alves > Thanks, pushed. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-12 11:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-01-28 15:42 [PATCH] gdb.trace: Deduplicate write_inferior_data_ptr Marcin Kościelnicki 2016-02-06 1:05 ` Marcin Kościelnicki 2016-02-12 10:56 ` Marcin Kościelnicki 2016-02-12 11:37 ` Marcin Kościelnicki 2016-02-12 11:47 ` Pedro Alves 2016-02-12 11:48 ` Marcin Kościelnicki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox