octave-maintainers
[Top][All Lists]
Advanced

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

Re: [Changeset] make symbol_table:; find_function also find class specif


From: Przemek Klosowski
Subject: Re: [Changeset] make symbol_table:; find_function also find class specific functions
Date: Wed, 8 Oct 2008 16:45:01 -0400 (EDT)

   Given code like

     1  if (c1)
     2    stmt1;
     3    if (c2) stmt1; stmt2; endif
     4  endif

   and breakpoints set on line 2 and line 3, what should we do?  In the
   case of line 2, it seems the breakpoint should be attached to the
   statement STMT1.  But in the case of 3, should the breakpoint be
   attached to the IF statement or the expressions (they are also on line
   3).  If we set the breakpoint on the IF statement, then presumably the
   debugger will stop before the condition C2 is executed.  Should there
   be a way to step through the evaluation of the IF statement so that we
   can stop just prior to each statement if C2 is true?

Pretty much all debuggers I ever used step by lines, so breakpoint in
line 3 would stop before the if() statement, and then step would run
both c1 and stmt1 and stmt2. One often wishes to be able to see the
intermediate results in cases like the above, or for compound
statements like a;b; or a=b=c, or even a=b+c+d+e. Of course one could
rewrite the code so that each desired subexpression is on a separate
line, but the whole point of symbolic debuggers is that you can trace
an existing program---if editing is required, we might as well use
printf debugging.

Of course most debuggers allow on-the-fly expression evaluation, so
that we can eval and print the individual subexpressions, which solves
the problem unless the subexpressions have side effects or take a long
time to compute.

It might be nice, therefore, to be able to step by a subexpression,
which in the above case would execute c1 and print its value.
Subsequent step commands would execute and print the returned values
of further individual subexpressions, presumably in the order of
traversal of the parse tree. I'm not sure what's a right granularity
for that: stop at subexpressions in a+b+c or a=b=c, or only at the
statement boundaries (a; b;)? Also, if such command existed, should it
allow setting a breakpoint on the individual subexpressions? 
It seems complicated, also from the point of view of UI: hard to
specify things like that on the command line---although might be
simple and natural with the GUI (click where you want to break).





reply via email to

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