octave-maintainers
[Top][All Lists]
Advanced

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

Fwd: what else is needed before 3.0?


From: John Swensen
Subject: Fwd: what else is needed before 3.0?
Date: Wed, 26 Dec 2007 21:51:44 -0500

I don't think this patch ever got applied.  I just noticed I was still having problems when trying to call 'dbclear' with no parameters to clear all breakpoints.  I looked back at CVSWeb and it doesn't look like this got applied pre-3.0.  

John Swensen

Begin forwarded message:

From: John Swensen <address@hidden>
Date: November 16, 2007 9:41:53 PM EST
To: "John W. Eaton" <address@hidden>
Cc: octave maintainers mailing list <address@hidden>
Subject: Re: what else is needed before 3.0?

John W. Eaton wrote:
On 13-Nov-2007, John Swensen wrote:

| should be in 3.0.  If you want me to submit the patches for the bugs now | and the patches for the structure input when it is complete, I can do that.

Yes, please don't delay bug fixes.  It is always best to send a
reports for bugs separately anyway.  Combining them, either as fixes
for more than one bug or along with code for new features just makes
them harder to evaluate and less likely to be accepted.  So please
send a separate report for each bug.

Thanks,

jwe

 
Attached is the bugfix patch for the debug.cc file.  This fixes the following errors:
1) A call to dbstop with no parameters caused a crash
2) A call to dbclear on a file with no breakpoints caused a crash

I have an associated question.  I tried to add some tests to the debug.cc file, but had very strange results.  Each call to the dbstatus function always indicated the breakpoint was set at line 212.  Kindof confusing.  I wonder if it has something to do with how all the path stuff is set up for tests?  When I run the exact same commands from a regular session of Octave, it works as expected.  Any suggestions?

John Swensen
Index: debug.cc
===================================================================
RCS file: /cvs/octave/src/debug.cc,v
retrieving revision 1.28
diff -u -r1.28 debug.cc
--- debug.cc 31 Oct 2007 02:12:16 -0000 1.28
+++ debug.cc 17 Nov 2007 02:34:33 -0000
@@ -97,41 +97,49 @@
std::string& symbol_name,
bp_table::intmap& lines)
{
-  octave_idx_type len = 0;
  int nargin = args.length ();
  int idx = 0;
  int list_idx = 0;
  symbol_name = std::string ();
+  lines = bp_table::intmap ();
+
+  if (args.length() == 0)
+    return;

  // If we are already in a debugging function.
  if (octave_call_stack::caller_user_function ())
-    idx = 0;
-  else
+    {
+      idx = 0;
+      symbol_name = get_user_function ()->name ();
+    }
+  else if (args (0).is_map ())
+    {
+      // Problem because parse_dbfunction_params() can only pass out a
+      // single function
+    }
+  else if (args (0).is_string())
    {
      symbol_name = args (0).string_value ();
      if (error_state)
return;
      idx = 1;
    }
+  else
+    error ("Illegal parameter specified");

  for (int i = idx; i < nargin; i++ )
    {
      if (args (i).is_string ())
- len++;
-      else
- len += args (i).numel ();
-    }
-
-  lines = bp_table::intmap ();
-  for (int i = idx; i < nargin; i++ )
-    {
-      if (args (i).is_string ())
{
 int line = atoi (args(i).string_value().c_str ());
 if (error_state)
   break;
 lines[list_idx++] = line;
}
+      else if (args (i).is_map ())
+ {
+  octave_stdout << "Accepting a struct" << std::endl;
+ }
      else
{
 const NDArray arg = args(i).array_value ();
@@ -208,19 +216,23 @@
      if (dbg_fcn)
{
 tree_statement_list *cmds = dbg_fcn->body ();
-  for (int i = 0; i < len; i++)
-    {
-      const_intmap_iterator p = line.find (i);
-
-      if (p != line.end ())
- cmds->delete_breakpoint (p->second);
-    }
-
 octave_value_list results = cmds->list_breakpoints ();
+  if (results.length () > 0)
+    {
+      for (int i = 0; i < len; i++)
+ {
+  const_intmap_iterator p = line.find (i);
+  
+  if (p != line.end ())
+    cmds->delete_breakpoint (p->second);
+ }
+      results = cmds->list_breakpoints ();

-  if (results.length () == 0)
-    bp_map.erase (bp_map.find (fname));
+      breakpoint_map_iterator it = bp_map.find (fname);
+      if (results.length () == 0 && it != bp_map.end ())
+ bp_map.erase (it);

+    }
 retval = results.length ();
}
      else
@@ -249,8 +261,10 @@
 cmds->delete_breakpoint (lineno);
 retval[i] = lineno;
}
-
-      bp_map.erase (bp_map.find (fname));
+      
+      breakpoint_map_iterator it = bp_map.find (fname);
+      if (it != bp_map.end ())
+ bp_map.erase (it);
    }
  else
    error ("remove_all_breakpoint_in_file: "


reply via email to

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