• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisão3cde5c42d1c1ddcf8bbde5c47233c644370c959c (tree)
Hora2016-11-09 00:26:47
AutorPedro Alves <palves@redh...>
CommiterPedro Alves

Mensagem de Log

Eliminate agent_expr_p; VEC -> std::vector in struct bp_target_info

After the previous patch, we end up with these two types with quite
similar, and potentially confusing names:

typedef gdb::unique_ptr<agent_expr> agent_expr_up;
/* Pointer to an agent_expr structure. */
typedef struct agent_expr *agent_expr_p;

The latter is only necessary to put agent_expr pointers in VECs. So
just eliminate it and use std::vector instead.

gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>

* ax.h (agent_expr_p): Delete.
(DEF_VEC_P (agent_expr_p)): Delete.
* breakpoint.c (build_target_condition_list)
(build_target_command_list): Adjust to use of std::vector.
(bp_location_dtor): Remove now unnecessary VEC_free calls.
* breakpoint.h: Include <vector>.
(struct bp_target_info) <conditions, tcommands>: Now
std::vector's.
* remote.c (remote_add_target_side_condition): bp_tgt->conditions
is now a std::vector; adjust.
(remote_add_target_side_commands, remote_insert_breakpoint):
bp_tgt->tcommands is now a std::vector; adjust.

Mudança Sumário

Diff

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
11 2016-11-08 Pedro Alves <palves@redhat.com>
22
3+ * ax.h (agent_expr_p): Delete.
4+ (DEF_VEC_P (agent_expr_p)): Delete.
5+ * breakpoint.c (build_target_condition_list)
6+ (build_target_command_list): Adjust to use of std::vector.
7+ (bp_location_dtor): Remove now unnecessary VEC_free calls.
8+ * breakpoint.h: Include <vector>.
9+ (struct bp_target_info) <conditions, tcommands>: Now
10+ std::vector's.
11+ * remote.c (remote_add_target_side_condition): bp_tgt->conditions
12+ is now a std::vector; adjust.
13+ (remote_add_target_side_commands, remote_insert_breakpoint):
14+ bp_tgt->tcommands is now a std::vector; adjust.
15+
16+2016-11-08 Pedro Alves <palves@redhat.com>
17+
318 * ax-gdb.c (is_nontrivial_conversion): Use agent_expr_up.
419 (gen_trace_for_var, gen_trace_for_expr, gen_eval_for_expr)
520 (gen_trace_for_return_address, gen_printf): Use and return an
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -170,12 +170,6 @@ struct agent_expr
170170 /* An agent_expr owning pointer. */
171171 typedef gdb::unique_ptr<agent_expr> agent_expr_up;
172172
173-/* Pointer to an agent_expr structure. */
174-typedef struct agent_expr *agent_expr_p;
175-
176-/* Vector of pointers to agent expressions. */
177-DEF_VEC_P (agent_expr_p);
178-
179173 /* The actual values of the various bytecode operations. */
180174
181175 enum agent_op
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2298,7 +2298,7 @@ build_target_condition_list (struct bp_location *bl)
22982298 struct bp_location *loc;
22992299
23002300 /* Release conditions left over from a previous insert. */
2301- VEC_free (agent_expr_p, bl->target_info.conditions);
2301+ bl->target_info.conditions.clear ();
23022302
23032303 /* This is only meaningful if the target is
23042304 evaluating conditions and if the user has
@@ -2371,10 +2371,11 @@ build_target_condition_list (struct bp_location *bl)
23712371 && loc->pspace->num == bl->pspace->num
23722372 && loc->owner->enable_state == bp_enabled
23732373 && loc->enabled)
2374- /* Add the condition to the vector. This will be used later to send the
2375- conditions to the target. */
2376- VEC_safe_push (agent_expr_p, bl->target_info.conditions,
2377- loc->cond_bytecode.get ());
2374+ {
2375+ /* Add the condition to the vector. This will be used later
2376+ to send the conditions to the target. */
2377+ bl->target_info.conditions.push_back (loc->cond_bytecode.get ());
2378+ }
23782379 }
23792380
23802381 return;
@@ -2481,8 +2482,8 @@ build_target_command_list (struct bp_location *bl)
24812482 int modified = bl->needs_update;
24822483 struct bp_location *loc;
24832484
2484- /* Release commands left over from a previous insert. */
2485- VEC_free (agent_expr_p, bl->target_info.tcommands);
2485+ /* Clear commands left over from a previous insert. */
2486+ bl->target_info.tcommands.clear ();
24862487
24872488 if (!target_can_run_breakpoint_commands ())
24882489 return;
@@ -2565,10 +2566,11 @@ build_target_command_list (struct bp_location *bl)
25652566 && loc->pspace->num == bl->pspace->num
25662567 && loc->owner->enable_state == bp_enabled
25672568 && loc->enabled)
2568- /* Add the command to the vector. This will be used later
2569- to send the commands to the target. */
2570- VEC_safe_push (agent_expr_p, bl->target_info.tcommands,
2571- loc->cmd_bytecode.get ());
2569+ {
2570+ /* Add the command to the vector. This will be used later
2571+ to send the commands to the target. */
2572+ bl->target_info.tcommands.push_back (loc->cmd_bytecode.get ());
2573+ }
25722574 }
25732575
25742576 bl->target_info.persist = 0;
@@ -12888,9 +12890,6 @@ static void
1288812890 bp_location_dtor (struct bp_location *self)
1288912891 {
1289012892 xfree (self->function_name);
12891-
12892- VEC_free (agent_expr_p, self->target_info.conditions);
12893- VEC_free (agent_expr_p, self->target_info.tcommands);
1289412893 }
1289512894
1289612895 static const struct bp_location_ops bp_location_ops =
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -26,6 +26,7 @@
2626 #include "command.h"
2727 #include "break-common.h"
2828 #include "probe.h"
29+#include <vector>
2930
3031 struct value;
3132 struct block;
@@ -264,13 +265,13 @@ struct bp_target_info
264265 packets. */
265266 int kind;
266267
267- /* Vector of conditions the target should evaluate if it supports target-side
268- breakpoint conditions. */
269- VEC(agent_expr_p) *conditions;
268+ /* Conditions the target should evaluate if it supports target-side
269+ breakpoint conditions. These are non-owning pointers. */
270+ std::vector<agent_expr *> conditions;
270271
271- /* Vector of commands the target should evaluate if it supports
272- target-side breakpoint commands. */
273- VEC(agent_expr_p) *tcommands;
272+ /* Commands the target should evaluate if it supports target-side
273+ breakpoint commands. These are non-owning pointers. */
274+ std::vector<agent_expr *> tcommands;
274275
275276 /* Flag that is true if the breakpoint should be left in place even
276277 when GDB is not connected. */
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -9623,10 +9623,7 @@ remote_add_target_side_condition (struct gdbarch *gdbarch,
96239623 struct bp_target_info *bp_tgt, char *buf,
96249624 char *buf_end)
96259625 {
9626- struct agent_expr *aexpr = NULL;
9627- int i, ix;
9628-
9629- if (VEC_empty (agent_expr_p, bp_tgt->conditions))
9626+ if (bp_tgt->conditions.empty ())
96309627 return 0;
96319628
96329629 buf += strlen (buf);
@@ -9634,13 +9631,13 @@ remote_add_target_side_condition (struct gdbarch *gdbarch,
96349631 buf++;
96359632
96369633 /* Send conditions to the target and free the vector. */
9637- for (ix = 0;
9638- VEC_iterate (agent_expr_p, bp_tgt->conditions, ix, aexpr);
9639- ix++)
9634+ for (int ix = 0; ix < bp_tgt->conditions.size (); ix++)
96409635 {
9636+ struct agent_expr *aexpr = bp_tgt->conditions[ix];
9637+
96419638 xsnprintf (buf, buf_end - buf, "X%x,", aexpr->len);
96429639 buf += strlen (buf);
9643- for (i = 0; i < aexpr->len; ++i)
9640+ for (int i = 0; i < aexpr->len; ++i)
96449641 buf = pack_hex_byte (buf, aexpr->buf[i]);
96459642 *buf = '\0';
96469643 }
@@ -9651,10 +9648,7 @@ static void
96519648 remote_add_target_side_commands (struct gdbarch *gdbarch,
96529649 struct bp_target_info *bp_tgt, char *buf)
96539650 {
9654- struct agent_expr *aexpr = NULL;
9655- int i, ix;
9656-
9657- if (VEC_empty (agent_expr_p, bp_tgt->tcommands))
9651+ if (bp_tgt->tcommands.empty ())
96589652 return;
96599653
96609654 buf += strlen (buf);
@@ -9664,13 +9658,13 @@ remote_add_target_side_commands (struct gdbarch *gdbarch,
96649658
96659659 /* Concatenate all the agent expressions that are commands into the
96669660 cmds parameter. */
9667- for (ix = 0;
9668- VEC_iterate (agent_expr_p, bp_tgt->tcommands, ix, aexpr);
9669- ix++)
9661+ for (int ix = 0; ix < bp_tgt->tcommands.size (); ix++)
96709662 {
9663+ struct agent_expr *aexpr = bp_tgt->tcommands[ix];
9664+
96719665 sprintf (buf, "X%x,", aexpr->len);
96729666 buf += strlen (buf);
9673- for (i = 0; i < aexpr->len; ++i)
9667+ for (int i = 0; i < aexpr->len; ++i)
96749668 buf = pack_hex_byte (buf, aexpr->buf[i]);
96759669 *buf = '\0';
96769670 }
@@ -9735,7 +9729,7 @@ remote_insert_breakpoint (struct target_ops *ops,
97359729
97369730 /* If this breakpoint has target-side commands but this stub doesn't
97379731 support Z0 packets, throw error. */
9738- if (!VEC_empty (agent_expr_p, bp_tgt->tcommands))
9732+ if (!bp_tgt->tcommands.empty ())
97399733 throw_error (NOT_SUPPORTED_ERROR, _("\
97409734 Target doesn't support breakpoints that have target side commands."));
97419735