Author Topic: How can SCons files be treated as Python sources while debugging?  (Read 1208 times)

sliqedit

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
How do I get Slickedit to allow breakpoints to be set in *.scons files from within a Python project?

I've set up a Python project to debug an issue within our SCons build environment and would like to step through SCons source files.
When attempting to set a breakpoint in a file with a *.scons extension Slickedit states:
    Breakpoints are not allowed in files that are not source files.

Setup: Windows 10, SlickEdit 2012 (v17.0.2.0 32-bit)

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: How can SCons files be treated as Python sources while debugging?
« Reply #1 on: June 30, 2020, 01:44:58 PM »
If you go to Tools -> Options -> Languages -> Scripting Languages -> Python -> General, add "scons" to the extensions if it is not already there.  And for that level of SlickEdit, you'll need to create a Python Project containing that scons file if you don't have one already. 

sliqedit

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
Re: How can SCons files be treated as Python sources while debugging?
« Reply #2 on: July 01, 2020, 08:08:57 AM »
Thanks for your reply Patrick, however, even with these suggestions the error still appears.

I tried to find out where this error is thrown and came across debug.e:

Code: [Select]
   
   // check that tagging is supported in this file (should be a source file)
   if (!_isdebugging_supported()) {
      debug_message("Breakpoints are not allowed in files that are not source files.");
      return(DEBUG_BREAKPOINT_NOT_ALLOWED_RC);
   }

and _isdebugging_supported() has the following switch statement:
Code: [Select]
   switch (dbg_get_callback_name(session_id)) {
   case 'gdb':
      // GDB works with other languages, and we only support C and C++
      // but we can let them try to set breakpoints in those languages anyway
      return(_LanguageInheritsFrom('c', lang) ||
             _LanguageInheritsFrom('d', lang) ||
             _LanguageInheritsFrom('f', lang) ||
             _LanguageInheritsFrom('s', lang) ||
             _LanguageInheritsFrom('ch', lang) ||
             _LanguageInheritsFrom('asm', lang) ||
             _LanguageInheritsFrom('mod', lang) ||
             _LanguageInheritsFrom('ada', lang) ||
             _LanguageInheritsFrom('pas'));
   case 'windbg':
      return(_LanguageInheritsFrom('c', lang));
   case 'jdwp':
      // this should work also for java embedded in HTML
      return(lang=='java');
   case 'xdebug':
      return ( lang == 'phpscript' );
   case 'pydbgp':
      return ( lang == 'py' );
   case 'perl5db':
      return ( lang == 'pl' );
   case 'rdbgp':
      return ( lang == 'ruby' );
   default:
      // not a system we know about, revert to if taggable
      return _istagging_supported(lang);
   }
I set a breakpoint in the macro debugger for the 'pydbgp' case in debug.e, and then tried to set a breakpoint in the scons file.
At this point the macro debugger shows the value of lang in _isdebugging_supported() as
Code: [Select]
lang = 'fundamental'
Is there a way to tell Slickedit to report the associated language for *.scons files to be "py" instead of "fundamental"?

Just a disclaimer I don't know anything about Slick-C macro editing, but am willing to learn.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: How can SCons files be treated as Python sources while debugging?
« Reply #3 on: July 01, 2020, 10:12:18 AM »
Going to the General page of the Python language settings, and adding the "scons" extension should have made files with the scons extension be recognized as Python. 

You can set the file mode manually by opening the file in the editor, and then going to Document -> Select Mode and then pick Python.

sliqedit

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
Re: How can SCons files be treated as Python sources while debugging?
« Reply #4 on: July 02, 2020, 06:43:51 AM »
Manual setting file mode worked. Thanks Patrick.