octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54231] GUI attempts to open file for function


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54231] GUI attempts to open file for function declared at top-level
Date: Mon, 9 Jul 2018 19:39:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #19, bug #54231 (project octave):

If I find time, I may look at this later.  However, I can see what the issue
is.  The ggg() is merely a base-class octave_function object, and for the
virtual function fcn_file_name is returned an empty string "":


@linux ~/octave/octave/octave $ grep fcn_file_name */*/*.h
-slibinterp/corefcn/call-stack.h:      std::string fcn_file_name (void)
const;
libinterp/octave-value/ov-dld-fcn.h:  std::string fcn_file_name (void) const;
libinterp/octave-value/ov-fcn.h:  virtual std::string fcn_file_name (void)
const { return ""; }
libinterp/octave-value/ov-mex-fcn.h:  std::string fcn_file_name (void) const;
libinterp/octave-value/ov-usr-fcn.h:  void stash_fcn_file_name (const
std::string& nm) { file_name = nm; }
libinterp/octave-value/ov-usr-fcn.h:  std::string fcn_file_name (void) const {
return file_name; }
libinterp/parse-tree/lex.h:        m_fcn_file_name (),
libinterp/parse-tree/lex.h:    std::string m_fcn_file_name;


In the dbwhere routine, an empty function doesn't display the file info:


DEFMETHOD (dbwhere, interp, , ,
[snip]
{
  octave::tree_evaluator& tw = interp.get_evaluator ();

  octave_user_code *dbg_fcn = tw.get_user_code ();

  if (! dbg_fcn)
    {
      octave_stdout << "stopped at top level" << std::endl;
      return ovl ();
    }

  octave_stdout << "stopped in " << dbg_fcn->name () << " at ";

  octave::call_stack& cs = interp.get_call_stack ();

  int l = cs.debug_user_code_line ();

  if (l > 0)
    {
      octave_stdout << "line " << l;

std::cerr << "\nGetting the FILENAME!\n";
      std::string file_name = dbg_fcn->fcn_file_name ();

      if (! file_name.empty ())
        {
          octave_stdout << " [" << file_name << ']' << std::endl;

          std::string line = dbg_fcn->get_code_line (l);

          if (! line.empty ())
            octave_stdout << l << ": " << line << std::endl;
        }
      else
        octave_stdout << std::endl;
    }
[snip]


It seems to me that the ggg() routine should be elevated to an ov-usr-fcn,
ov-mex-fcn or ov-dld-fcn, but I can't find where in the parse code that
determination is made.  (I searched for things like "new octave_function",
etc.)

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54231>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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