diff options
author | Pedro Alves <palves@redhat.com> | 2016-11-08 15:26:47 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-11-08 15:26:47 +0000 |
commit | 833177a4a5c1a2a6cabe70bfe35ecf241b68d169 (patch) | |
tree | da2e0cfdae4abf5ee493a243cae733166276f781 /gdb/ax-gdb.h | |
parent | 2f408ecb929bd56613e94cf1e84ace4692c78257 (diff) | |
download | fsf-binutils-gdb-833177a4a5c1a2a6cabe70bfe35ecf241b68d169.zip fsf-binutils-gdb-833177a4a5c1a2a6cabe70bfe35ecf241b68d169.tar.gz fsf-binutils-gdb-833177a4a5c1a2a6cabe70bfe35ecf241b68d169.tar.bz2 |
'struct agent_expr *' -> unique_ptr<agent_expr>
This patch makes the gen_* functions return a unique_ptr instead of
raw pointer:
typedef gdb::unique_ptr<agent_expr> agent_expr_up;
and then adjusts the codebase throughout to stop using
make_cleanup_free_agent_expr.
The cond_bytecode and cmd_bytecode fields of struct bp_location are
owning pointers, so they're changed to be unique_ptr's instead of raw
pointers.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ax-gdb.c (is_nontrivial_conversion): Use agent_expr_up.
(gen_trace_for_var, gen_trace_for_expr, gen_eval_for_expr)
(gen_trace_for_return_address, gen_printf): Use and return an
agent_expr_up. Don't use make_cleanup_free_agent_expr.
(agent_eval_command_one, maint_agent_printf_command): Use
agent_expr_up. Don't use make_cleanup_free_agent_expr.
* ax-gdb.h (gen_trace_for_expr, gen_trace_for_var)
(gen_trace_for_return_address, gen_eval_for_expr, gen_printf): Use
agent_expr_up.
* ax-general.c (new_agent_expr): Rename to ...
(agent_expr::agent_expr): ... this, and now a constructor.
(free_agent_expr): Rename to ...
(agent_expr::~agent_exp): ... this, and now a destructor.
(do_free_agent_expr_cleanup, make_cleanup_free_agent_expr):
Delete.
* ax.h (struct agent_expr): Add ctor/dtor.
(agent_expr_up): New typedef.
(new_agent_expr, free_agent_expr, make_cleanup_free_agent_expr):
Delete declarations.
* breakpoint.c (parse_cond_to_aexpr): Use and return an
agent_expr_up. Don't use make_cleanup_free_agent_expr.
(build_target_condition_list): Adjust to use agent_expr_up.
(parse_cmd_to_aexpr): Use and return an agent_expr_up. Don't use
make_cleanup_free_agent_expr.
(build_target_command_list): Adjust to use agent_expr_up.
(force_breakpoint_reinsertion): Adjust to use agent_expr_up.
(bp_location_dtor): Remove unnecessary free_agent_expr and xfree
calls.
* breakpoint.h (struct bp_target_info) <cond_bytecode,
cmd_bytecode>: Now agent_expr_up's.
* remote.c (remote_download_tracepoint): Adjust to use
agent_expr_up and remove use of make_cleanup_free_agent_expr.
* tracepoint.c (validate_actionline, collect_symbol): Adjust to
use agent_expr_up and remove uses of make_cleanup_free_agent_expr.
(collection_list::~collection_list): Call delete instead of
free_agent_expr.
(encode_actions_1): Adjust to use agent_expr_up and remove uses of
make_cleanup_free_agent_expr.
(add_aexpr): Change parameter type to agent_expr_up; Return a raw
agent_expr pointer.
Diffstat (limited to 'gdb/ax-gdb.h')
-rw-r--r-- | gdb/ax-gdb.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h index dacacfc..0d791e9 100644 --- a/gdb/ax-gdb.h +++ b/gdb/ax-gdb.h @@ -101,17 +101,17 @@ struct axs_value record the value of all memory touched by the expression, and leave no values on the stack. The caller can then use the ax_reqs function to discover which registers the expression uses. */ -extern struct agent_expr *gen_trace_for_expr (CORE_ADDR, struct expression *, - int); +extern agent_expr_up gen_trace_for_expr (CORE_ADDR, struct expression *, + int); -extern struct agent_expr *gen_trace_for_var (CORE_ADDR, struct gdbarch *, - struct symbol *, int); +extern agent_expr_up gen_trace_for_var (CORE_ADDR, struct gdbarch *, + struct symbol *, int); -extern struct agent_expr *gen_trace_for_return_address (CORE_ADDR, - struct gdbarch *, - int); +extern agent_expr_up gen_trace_for_return_address (CORE_ADDR, + struct gdbarch *, + int); -extern struct agent_expr *gen_eval_for_expr (CORE_ADDR, struct expression *); +extern agent_expr_up gen_eval_for_expr (CORE_ADDR, struct expression *); extern void gen_expr (struct expression *exp, union exp_element **pc, struct agent_expr *ax, struct axs_value *value); @@ -119,9 +119,9 @@ extern void gen_expr (struct expression *exp, union exp_element **pc, extern void require_rvalue (struct agent_expr *ax, struct axs_value *value); struct format_piece; -extern struct agent_expr *gen_printf (CORE_ADDR, struct gdbarch *, - CORE_ADDR, LONGEST, const char *, int, - struct format_piece *, - int, struct expression **); +extern agent_expr_up gen_printf (CORE_ADDR, struct gdbarch *, + CORE_ADDR, LONGEST, const char *, int, + struct format_piece *, + int, struct expression **); #endif /* AX_GDB_H */ |