octave_call_stack changes

View: New views
3 Messages — Rating Filter:   Alert me  

octave_call_stack changes

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Earlier today, I checked in some changes to the way the call stack is
handled so that for a function like

  function fx (n)
    if (n == 0)
      'a'
      x = 1
      fx (n+1)
      'e'
      x
    else
      'b'
      x = 2
      'c'
      evalin ('caller', 'x');
      'd'
      x
    end
  end

the call

  octave:1> fx (0)
  ans = a
  x =  1
  ans = b
  x =  2
  ans = c
  x =  1
  ans = d
  x =  2
  ans = e
  x =  1

will work as shown above.  I don't think evalin ('caller', ...)
ever worked properly for recursive calls until now.

Also, given a set of functions like

  function f ()
    x = 'f';
    g ();
  endfunction
  function g ()
    x = 'g';
    h ();
  endfunction
  function h ()
    x = 'h';
  endfunction

things like this should now be possible:

  octave:1> dbstop h
  ans =  2
  octave:2> f
  h: line 2, column 5
  x = 'h'
  keyboard: stopped in /scratch/jwe/build/octave/h.m at line 2
  debug> dbstack
  Stopped in:

  --> h at line 2 column 1
      g at line 3 column 3
      f at line 3 column 3
  debug> dbup
  g:  line 3, column 3
  debug> dbstack
  Stopped in:

      h at line 2 column 1
  --> g at line 3 column 3
      f at line 3 column 3
  debug> dbdown
  h:  line 2, column 1
  debug> dbstack
  Stopped in:

  --> h at line 2 column 1
      g at line 3 column 3
      f at line 3 column 3

I don't think this kind of thing ever really worked properly before
now.

Although I'm sure there is still room for improvement, these changes
appear to be working for me.  There could also be some problems
that I haven't seen yet.  Unfortunately, if there are problems, I
won't be able to do anything about then until after July 7, but I
thought it would be best to go ahead and check in these changes so
they could get some additional testing.

jwe

Re: octave_call_stack changes

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


John W. Eaton wrote:
Although I'm sure there is still room for improvement, these changes
appear to be working for me.  There could also be some problems
that I haven't seen yet.  Unfortunately, if there are problems, I
won't be able to do anything about then until after July 7, but I
thought it would be best to go ahead and check in these changes so
they could get some additional testing.

I think you forgot an "hg push" as the changes don't appear in the repository

D.

Re: octave_call_stack changes

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 29-Jun-2008, dbateman wrote:

| I think you forgot an "hg push" as the changes don't appear in the
| repository

Oops.  The changes are checked in to the public archive now.

jwe