Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Don Howard <dhoward@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Fernando Nasser <fnasser@cygnus.com>,
	Michael Snyder <msnyder@cygnus.com>,
	<gdb-patches@sources.redhat.com>
Subject: Re: [RFA] deleting breakpoints inside of 'commands' [Repost]
Date: Thu, 20 Sep 2001 15:24:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.33.0109201305160.9139-100000@theotherone> (raw)
In-Reply-To: <3BA8B70D.7040506@cygnus.com>

Here is a patch that I hope will satisfy all sides.  The patch below
changes free_command_lines() to check if we are currently
'executing_breakpoint_commands'.  If so, the command list is appended to
a list of 'orphaned_command_lines'.  When the execution of the command
list completes, the orphaned_command_lines are then deleted.

Should I make the global variables static and add accessor/mutator
functions?  What is the policy on globals?

Comments?



2001-09-20  Don Howard  <dhoward@redhat.com>

	* cli/cli-script.c (free_command_lines): Avoid deleting
	command_line lists while executing that list.
	* breakpoint.c: (executing_breakpoint_commands): Make this
	global visible to other compilation units.
	(orphaned_breakpoint_commands) New global.
	(bpstat_do_actions): Free orphaned command_line structures once
	done executing them.


Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.53
diff -p -u -w -r1.53 breakpoint.c
--- breakpoint.c	2001/09/18 05:00:48	1.53
+++ breakpoint.c	2001/09/20 22:18:17
@@ -221,8 +221,11 @@ extern int addressprint;	/* Print machin
 static int internal_breakpoint_number = -1;

 /* Are we executing breakpoint commands?  */
-static int executing_breakpoint_commands;
+int executing_breakpoint_commands;

+/* List of breakpoint commands to be cleaned up after we are done executing them. */
+struct command_line * orphaned_breakpoint_commands;
+
 /* Walk the following statement or block through all breakpoints.
    ALL_BREAKPOINTS_SAFE does so even if the statment deletes the current
    breakpoint.  */
@@ -1845,6 +1848,7 @@ top:
     }

   executing_breakpoint_commands = 0;
+  free_command_lines (&orphaned_breakpoint_commands);
   discard_cleanups (old_chain);
 }

Index: gdb/cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.7
diff -p -u -w -r1.7 cli-script.c
--- cli-script.c	2001/06/17 15:16:12	1.7
+++ cli-script.c	2001/09/20 22:18:17
@@ -1014,7 +1014,25 @@ free_command_lines (struct command_line
   register struct command_line *next;
   struct command_line **blist;
   int i;
+  extern int executing_breakpoint_commands;
+  extern struct command_line * orphaned_breakpoint_commands;

+  /* Avoid deleting command_line lists while executing that list. */
+  if (executing_breakpoint_commands)
+    {
+      struct command_line **b = NULL;
+
+      /* Find the end of the orphaned_breakpoint_commands list */
+      for (b = &orphaned_breakpoint_commands; *b; b = &((*b)->next))
+	/* Nothing */
+	;
+
+      /* Append the passed-in list */
+      *b = *lptr;
+      *lptr = NULL;
+      return;
+    }
+
   while (l)
     {
       if (l->body_count > 0)


-- 
-Don
dhoward@redhat.com
gdb engineering



  parent reply	other threads:[~2001-09-20 15:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-17  9:34 Don Howard
2001-09-17 15:39 ` Michael Snyder
2001-09-18  6:56   ` Fernando Nasser
2001-09-18  7:56     ` Andrew Cagney
2001-09-18  8:09       ` Fernando Nasser
2001-09-18 10:34       ` Michael Snyder
2001-09-18 17:47         ` Andrew Cagney
2001-09-18 18:03           ` Michael Snyder
2001-09-19  7:20             ` Fernando Nasser
2001-09-19  8:17               ` Andrew Cagney
2001-09-19  9:22                 ` Fernando Nasser
2001-09-19 11:44                   ` PRMS not TODO: " Andrew Cagney
2001-09-19  9:33                 ` Don Howard
2001-09-19 12:08                   ` Kevin Buettner
2001-09-19 12:18                     ` Michael Snyder
2001-09-19 13:09                       ` Kevin Buettner
     [not found]                     ` <3BA905AD.5F8F1A68@redhat.com>
2001-09-19 14:22                       ` Kevin Buettner
2001-09-19 14:44                         ` Fernando Nasser
2001-09-20 15:24                 ` Don Howard [this message]
2001-09-20 18:05                   ` Andrew Cagney
     [not found] <Pine.LNX.4.33.0109211638230.1755-100000@theotherone>
2001-09-24 17:10 ` Kevin Buettner
2001-09-24 17:33   ` Kevin Buettner
2001-09-24 18:52   ` Andrew Cagney
2001-09-26 13:07     ` Fernando Nasser
2001-09-26 14:20       ` Kevin Buettner
2001-09-26 14:57         ` Fernando Nasser
2001-09-26 15:09           ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0109201305160.9139-100000@theotherone \
    --to=dhoward@redhat.com \
    --cc=ac131313@cygnus.com \
    --cc=fnasser@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox