summaryrefslogtreecommitdiff
path: root/gdb/ax-gdb.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-10 15:47:21 -0600
committerTom Tromey <tom@tromey.com>2017-04-12 11:16:19 -0600
commit16e802b9c085ce354b1ab9e2fd25d00bf7626fa8 (patch)
tree7745d7708fd31fe748a6807242a3a6e58201f892 /gdb/ax-gdb.c
parentd28cd78ad820e3a40ac5064b6a30f3a12ce70bf0 (diff)
Add a constructor and destructor to linespec_result
linespec_result is only ever allocated on the stack, so it's relatively easy to convert to having a constructor and a destructor. This patch makes this change. This removes some cleanups. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * linespec.h (struct linespec_result): Add constructor and destructor. (init_linespec_result, destroy_linespec_result) (make_cleanup_destroy_linespec_result): Don't declare. * linespec.c (init_linespec_result): Remove. (linespec_result::~linespec_result): Rename from destroy_linespec_result. Update. (cleanup_linespec_result, make_cleanup_destroy_linespec_result): Remove. * breakpoint.c (create_breakpoint, break_range_command) (decode_location_default): Update. * ax-gdb.c (agent_command_1): Update.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 720602239e..fae2e2d483 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2603,15 +2603,13 @@ agent_command_1 (char *exp, int eval)
struct linespec_result canonical;
int ix;
struct linespec_sals *iter;
- struct cleanup *old_chain;
exp = skip_spaces (exp);
- init_linespec_result (&canonical);
+
event_location_up location = new_linespec_location (&exp);
decode_line_full (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
(struct symtab *) NULL, 0, &canonical,
NULL, NULL);
- old_chain = make_cleanup_destroy_linespec_result (&canonical);
exp = skip_spaces (exp);
if (exp[0] == ',')
{
@@ -2625,7 +2623,6 @@ agent_command_1 (char *exp, int eval)
for (i = 0; i < iter->sals.nelts; i++)
agent_eval_command_one (exp, eval, iter->sals.sals[i].pc);
}
- do_cleanups (old_chain);
}
else
agent_eval_command_one (exp, eval, get_frame_pc (get_current_frame ()));