From 833177a4a5c1a2a6cabe70bfe35ecf241b68d169 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 8 Nov 2016 15:26:47 +0000 Subject: 'struct agent_expr *' -> unique_ptr This patch makes the gen_* functions return a unique_ptr instead of raw pointer: typedef gdb::unique_ptr 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 * 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) : 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. --- gdb/breakpoint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/breakpoint.h') diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 60ffbf7..8c2dfaf 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -344,7 +344,7 @@ struct bp_location /* Conditional expression in agent expression bytecode form. This is used for stub-side breakpoint condition evaluation. */ - struct agent_expr *cond_bytecode; + agent_expr_up cond_bytecode; /* Signals that the condition has changed since the last time we updated the global location list. This means the condition @@ -361,7 +361,7 @@ struct bp_location enum condition_status condition_changed; - struct agent_expr *cmd_bytecode; + agent_expr_up cmd_bytecode; /* Signals that breakpoint conditions and/or commands need to be re-synched with the target. This has no use other than -- cgit v1.1