octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Breakpoint bug [was Re: Breakpoint woes]


From: John W. Eaton
Subject: Breakpoint bug [was Re: Breakpoint woes]
Date: Mon, 13 Apr 2009 22:33:55 -0500

On 13-Apr-2009, John Swensen wrote:

| So, I think the problem I was describing above is actually a bug.  The  
| problem occurs because the bp_table class stores pointers to  
| octave_user_code objects that can become invalid without these items  
| being removed from the STL map in the bp_table class.  I have come up  
| with a solution, but want input from others to know if they think it  
| is an acceptable solution.  The included patch has my proposed solution.
| 
| My next question is whether there is a way to force the symbol table  
| to update. I have the problem that after calling octave_env::chdir the  
| symbol table doesn't update until the next time I press enter and go  
| to the next readline prompt.

Do you mean the symbol table or the load path?

| diff -r 4bb94a71913b src/debug.cc
| --- a/src/debug.cc    Sun Apr 12 20:40:53 2009 -0400
| +++ b/src/debug.cc    Mon Apr 13 16:57:09 2009 -0400
| @@ -376,10 +376,16 @@
|           bp_map.erase (it);
|       }
|      }
| -  else if (! silent)
| -    error ("remove_all_breakpoint_in_file: "
| -        "unable to find the function requested\n");
| -
| +  else
| +    {
| +      if (! silent)
| +     error ("remove_all_breakpoint_in_file: "
| +            "unable to find the function requested\n");
| +      
| +      breakpoint_map_iterator it = bp_map.find (fname);
| +      if (it != bp_map.end ())
| +     bp_map.erase (it);
| +    }
|    tree_evaluator::debug_mode = bp_table::have_breakpoints ();
|  
|    return retval;
| diff -r 4bb94a71913b src/symtab.h
| --- a/src/symtab.h    Sun Apr 12 20:40:53 2009 -0400
| +++ b/src/symtab.h    Mon Apr 13 16:57:09 2009 -0400
| @@ -1353,11 +1353,15 @@
|    static void clear_functions (void)
|    {
|      for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); 
p++)
| -      p->second.clear ();
| +      {
| +     bp_table::remove_all_breakpoints_in_file (p->first, true);
| +     p->second.clear ();
| +      }
|    }
|  
|    static void clear_function (const std::string& name)
|    {
| +    bp_table::remove_all_breakpoints_in_file (name, true);
|      clear_user_function (name);
|    }

I haven't looked at this in detail, but I think it might be better to
call the remove_all_breakpoints_in_file function from the
function/script object destructor.

Should breakpoint information be stored directly in the list of tree
objects that make up the body of a function/script instead of storing
it in a separate table?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]