aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-05-15 06:15:27 +0000
committerAndrew Cagney <cagney@redhat.com>2000-05-15 06:15:27 +0000
commitf23d52e0a54905bc88c1a5ea25168227356d6f37 (patch)
tree9b55315786830882293a4225641d0bbd44fecefc
parent4d6140d95eace437441b17dd43a7b0a456d3803a (diff)
downloadgdb-f23d52e0a54905bc88c1a5ea25168227356d6f37.zip
gdb-f23d52e0a54905bc88c1a5ea25168227356d6f37.tar.gz
gdb-f23d52e0a54905bc88c1a5ea25168227356d6f37.tar.bz2
Cleanup free_agent_expr cleanups.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/ax-gdb.c6
-rw-r--r--gdb/ax-general.c12
-rw-r--r--gdb/ax.h1
-rw-r--r--gdb/tracepoint.c5
5 files changed, 28 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 04b6f79..5e655b1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+Mon May 15 16:05:46 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * ax.h (make_cleanup_free_agent_expr): Add declaration.
+ * ax-general.c (do_free_agent_expr_cleanup):
+ (make_cleanup_free_agent_expr): New functions.
+
+ * tracepoint.c (validate_actionline, encode_actions), ax-gdb.c
+ (expr_to_agent, gen_trace_for_expr, agent_command): Replace calls
+ to make_cleanup.
+
Mon May 15 14:06:23 2000 Andrew Cagney <cagney@b1.cygnus.com>
* breakpoint.h (make_cleanup_delete_breakpoint,
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 291ac75..08ce732 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1798,7 +1798,7 @@ expr_to_agent (expr, value)
struct agent_expr *ax = new_agent_expr (0);
union exp_element *pc;
- old_chain = make_cleanup ((make_cleanup_func) free_agent_expr, ax);
+ old_chain = make_cleanup_free_agent_expr (ax);
pc = expr->elts;
trace_kludge = 0;
@@ -1854,7 +1854,7 @@ gen_trace_for_expr (scope, expr)
union exp_element *pc;
struct axs_value value;
- old_chain = make_cleanup ((make_cleanup_func) free_agent_expr, ax);
+ old_chain = make_cleanup_free_agent_expr (ax);
pc = expr->elts;
trace_kludge = 1;
@@ -1925,7 +1925,7 @@ agent_command (exp, from_tty)
expr = parse_expression (exp);
old_chain = make_cleanup (free_current_contents, &expr);
agent = gen_trace_for_expr (fi->pc, expr);
- make_cleanup ((make_cleanup_func) free_agent_expr, agent);
+ make_cleanup_free_agent_expr (agent);
ax_print (gdb_stdout, agent);
/* It would be nice to call ax_reqs here to gather some general info
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 34ec3b3..4612e8e 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -62,6 +62,18 @@ free_agent_expr (x)
free (x);
}
+static void
+do_free_agent_expr_cleanup (void *x)
+{
+ free_agent_expr (x);
+}
+
+struct cleanup *
+make_cleanup_free_agent_expr (struct agent_expr *x)
+{
+ return make_cleanup (do_free_agent_expr_cleanup, x);
+}
+
/* Make sure that X has room for at least N more bytes. This doesn't
affect the length, just the allocated size. */
diff --git a/gdb/ax.h b/gdb/ax.h
index bf1fd2c..f6860b3 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -143,6 +143,7 @@ extern struct agent_expr *new_agent_expr PARAMS ((CORE_ADDR));
/* Free a agent expression. */
extern void free_agent_expr PARAMS ((struct agent_expr *));
+extern struct cleanup *make_cleanup_free_agent_expr (struct agent_expr *);
/* Append a simple operator OP to EXPR. */
extern void ax_simple PARAMS ((struct agent_expr * EXPR, enum agent_op OP));
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 58db9b3..eefd556 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -999,7 +999,7 @@ validate_actionline (line, t)
/* we have something to collect, make sure that the expr to
bytecode translator can handle it and that it's not too long */
aexpr = gen_trace_for_expr (t->address, exp);
- (void) make_cleanup ((make_cleanup_func) free_agent_expr, aexpr);
+ make_cleanup_free_agent_expr (aexpr);
if (aexpr->len > MAX_AGENT_EXPR_LEN)
error ("expression too complicated, try simplifying");
@@ -1617,8 +1617,7 @@ encode_actions (t, tdp_actions, stepping_actions)
default: /* full-fledged expression */
aexpr = gen_trace_for_expr (t->address, exp);
- old_chain1 = make_cleanup ((make_cleanup_func)
- free_agent_expr, aexpr);
+ old_chain1 = make_cleanup_free_agent_expr (aexpr);
ax_reqs (aexpr, &areqs);
if (areqs.flaw != agent_flaw_none)