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

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

[Octave-bug-tracker] [bug #45404] Breakpoints cannot be set in classdef


From: Richard
Subject: [Octave-bug-tracker] [bug #45404] Breakpoints cannot be set in classdef methods or +package function files
Date: Tue, 15 May 2018 05:35:35 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36

Follow-up Comment #4, bug #45404 (project octave):

If you replace file_editor_tab::bp_info::bp_info with the following if fixes
the bug


  file_editor_tab::bp_info::bp_info (const QString& fname, int l,
                                     const QString& cond)
    : line (l), file (fname.toStdString ()), condition (cond.toStdString ())
  {
    QFileInfo file_info (fname);

    QString q_dir = file_info.absolutePath ();
    QString q_function_name = file_info.fileName ();

    // We have to cut off the suffix, because octave appends it.
    q_function_name.chop (file_info.suffix ().length () + 1);

    dir = q_dir.toStdString ();
    function_name = q_function_name.toStdString ();

    // Check if we are in a class directory or a package namespace
    size_t pos = dir.rfind (sys::file_ops::dir_sep_chars ());

    if (pos != std::string::npos && pos < dir.length () - 1)
      {
        if (dir[pos+1] == '@')
          {
            // If the last component of DIR is @foo strip it and prepend it
            // to the name of the function.

            function_name = sys::file_ops::concat (dir.substr (pos+1),
function_name);

            dir = dir.substr (0, pos);
          }
        else if (dir[pos+1] == '+')
          {
              // If the last component of DIR is +foo the file is in a
package
              // namespace, we need to build the whole package tree (packages
              // can be nested)
              function_name = dir.substr (pos+2) + "." + function_name;

              dir = dir.substr (0, pos);

              // search backwards for the next directory level
              pos = dir.rfind (sys::file_ops::dir_sep_chars (), pos-1);

              size_t last_pos = pos;

              while (pos != std::string::npos)
                {
                  if (dir[pos+1] == '+')
                    {
                      // add this package to the full function name
                      function_name = dir.substr (pos+2, last_pos-1) + "." +
function_name;

                      dir = dir.substr (0, pos);

                      pos = dir.rfind (sys::file_ops::dir_sep_chars (),
pos-1);
                    }
                  else
                    {
                      // finish the search
                      pos = std::string::npos;
                    }
                }
          }
      }
  }


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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