summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2002-08-27 01:09:09 +0000
committerMichael Snyder <msnyder@specifix.com>2002-08-27 01:09:09 +0000
commit339c6a3633db11751d936ed024de0990a8e05227 (patch)
tree8aefc921be27b45fb4fcc09e66dde9e597385d47 /gdb/cli
parentac87a01228d8a51cbda6eed3cb02e1b1ec925a7d (diff)
downloadgdb-339c6a3633db11751d936ed024de0990a8e05227.tar.gz
2002-08-26 Joel Brobecker <brobecker@gnat.com>
* cli/cli-script.c (copy_command_lines): New function. * defs.h (copy_command_lines): Export. * testsuite/gdb.base/commands.exp: New tests for commands attached to a temporary breakpoint, and for commands that delete the breakpoint they are attached to. 2002-08-26 Michael Snyder <msnyder@redhat.com> * breakpoint.c (bpstat_stop_status): Instead of copying the pointer to the breakpoint commands struct, make a new copy of the struct and point to that. (bpstat_clear): Free the commands struct. (bpstat_clear_actions): Free the commands struct. (bpstat_do_actions): Free the command actions. Also execute the local cleanups, instead of deleting them. (delete_breakpoint): Leave the commands field of the bpstat chain alone -- it will be freed later.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-script.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 9aac6e6aaae..2b23301c6b3 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1012,6 +1012,36 @@ make_cleanup_free_command_lines (struct command_line **arg)
{
return make_cleanup (do_free_command_lines_cleanup, arg);
}
+
+struct command_line *
+copy_command_lines (struct command_line *cmds)
+{
+ struct command_line *result = NULL;
+
+ if (cmds)
+ {
+ result = (struct command_line *) xmalloc (sizeof (struct command_line));
+
+ result->next = copy_command_lines (cmds->next);
+ result->line = xstrdup (cmds->line);
+ result->control_type = cmds->control_type;
+ result->body_count = cmds->body_count;
+ if (cmds->body_count > 0)
+ {
+ int i;
+
+ result->body_list = (struct command_line **)
+ xmalloc (sizeof (struct command_line *) * cmds->body_count);
+
+ for (i = 0; i < cmds->body_count; i++)
+ result->body_list[i] = copy_command_lines (cmds->body_list[i]);
+ }
+ else
+ result->body_list = NULL;
+ }
+
+ return result;
+}
static void
validate_comname (char *comname)