changeset 8359:5798aa0f902a

[mq]: debug.patch
author jpswensen@john-swensens-macbook-pro-15.local
date Fri, 21 Nov 2008 22:53:50 -0500
parents 55b97f709203
children 32d9c0299e99
files ChangeLog src/debug.cc
diffstat 2 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2008-11-21  John Swensen <jpswensen@comcast.net> 
+        * debug.cc: Bugfix for symtab/debugger interactions.
+
 2008-11-18  John W. Eaton  <jwe@octave.org>
 
 	* mkoctfile.cc.in, octave-bug.cc.in: Style fixes.
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -304,19 +304,32 @@
 {
   fname_line_map retval;
 
+  // Clear the breakpoints in the function if it has been updated.
+  // FIXME:  This is a bad way of doing this, but I can't think of another.  The
+  // problem is due to the fact that out_of_date_check(...) calls 
+  // remove_breakpoints_in_file(...), which in turn modifies bp_map while we are
+  // in the middle of iterating through it.
+  std::list<octave_user_code*> usercode_list;
+  for (breakpoint_map_iterator it = bp_map.begin (); it != bp_map.end (); it++)
+    {
+      octave_user_code *f = it->second;
+      usercode_list.push_back(f);
+    }
+
+  for (std::list<octave_user_code*>::iterator it = usercode_list.begin (); it != usercode_list.end (); it++)
+    {
+      out_of_date_check(*it);
+    }
+
+
   // Iterate through each of the files in the map and get the 
   // name and list of breakpoints.
-
   for (breakpoint_map_iterator it = bp_map.begin (); it != bp_map.end (); it++)
     {
       if (fname_list.length () == 0
 	  || do_find_bkpt_list (fname_list, it->first) != "")
 	{
 	  octave_user_code *f = it->second;
-
-	  // Clears the breakpoints if the function has been updated
-	  out_of_date_check (f);
-
 	  tree_statement_list *cmds = f->body ();
 
 	  if (cmds)