octave-maintainers
[Top][All Lists]
Advanced

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

Re: Arbitrary call stack access for external debuggers changeset.


From: Ryan Rusaw
Subject: Re: Arbitrary call stack access for external debuggers changeset.
Date: Wed, 5 Mar 2008 21:16:37 -0600

John,

1. The modifications to the octave_call_stack class enables one to
easily access all the octave_functions in the stack at any depth..

octave_function *f = octave_call_stack::element(depth);
if (f && f->is_user_function())
{
    symbol_table::scope_id id;
    switch(context)
    {
    case DBGP_GLOBAL_SCOPE:
        id = symbol_table::global_scope();
        break;
    case DBGP_LOCAL_SCOPE:
    default:
        id = f->user_function_value()->scope();
        break;
    }
    symbol_table::symbol_record rec =
symbol_table::find_symbol(propertyName, id);
}

2. The tree_statement_stack class allows the linking of
tree_statements to the octave_call_stack, regardless of stack depth.
Previously one only had access to the current statement and its direct
caller.

int i = 0, no_statement = 0;
octave_function *f = octave_call_stack::element(i);
while (f)
{
   tree_statement *sp = NULL;
   if (f->is_user_function() || f->is_user_script())
   {
      sp = tree_statement_stack::element(i - no_statement);
      /* sp and f are now in sync */
   } else {
      ++no_statement;
   }
   f = octave_call_stack::element(++i);
}



On Wed, Mar 5, 2008 at 7:56 AM, John Swensen <address@hidden> wrote:
>
>
>  On Mar 3, 2008, at 9:48 PM, Ryan Rusaw wrote:
>
>  > I sent in this patch in prior to the 3.0.0 release, but it never made
>  > it in prior to the switch to mercurial.
>  >
>  > 2008-03-03  Ryan Rusaw  <address@hidden>
>  >
>  >       * top_lev.h: Replace internal std::list with stl::deque in
>  >       octave_call_stack to allow access to elements by position
>  >       index via element_at () call.
>  >       * top_lev.cc: Implement new element_at () call for updated
>  >       octave_call_stack class
>  >       * pt-stmt.h: Declare new tree_statement_stack class modelled
>  >       after octave_call_stack class
>  >       * pt-stmt.cc: Remove curr_statement and curr_caller_statement,
>  >       and implement tree_statement_stack class to allow call stack
>  >       statements to to be accessed by depth index.
>  >       * error.cc: Replace references to curr_statement to
>  >       tree_statement_stack::current ()
>  >       * input.cc: Replace references to curr_statement to
>  >       tree_statement_stack::current ()
>  >       * ov-usr-func.cc: Remove references to curr_statement and
>  >       curr_caller_statement
>  > <changeset.txt>
>
>  I have been working a bit lately on making the debugger act more like
>  Matlab in terms of the command line functionality and was wondering if
>  you would give a quick synopsis of what this patch does.  I looked
>  through all the changes, but don't know enough about how the parser,
>  tree represenation of a file,  and debugger interact to fully
>  understand it.
>
>  John Swensen
>


reply via email to

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