redhawk icon indicating copy to clipboard operation
redhawk copied to clipboard

feature: use of 'screen' for sandbox-based debug sessions

Open btgoodwin opened this issue 4 years ago • 0 comments

The sandbox supports launching with debugger and window arguments that if using 'gdb' for the former, defaults to Xterm for the latter, with gnome-terminal being an allowed alternative. For targets with no X session, let alone Gnome or Xterm, screen could be used as an alternative. The way the process might look would be:

from ossie.utils import sb
c = sb.launch(some_spd, debugger='gdb', window='screen')

In another terminal session, search for the highest PID screen session related to gdb (using ps, etc.) and do: screen -d -R INSTANCE_NAME, where INSTANCE_NAME usually is PID.COMPONENT_NAME_N.

Below is a patch that provides this functionality:

Index: src/base/framework/python/ossie/utils/sandbox/local.py
===================================================================
--- src.orig/base/framework/python/ossie/utils/sandbox/local.py
+++ src/base/framework/python/ossie/utils/sandbox/local.py
@@ -213,6 +213,8 @@ class LocalLauncher(SandboxLauncher):
                     window = terminal.XTerm(comp._instanceName)
                 elif window == 'gnome-terminal':
                     window = terminal.GnomeTerm(comp._instanceName)
+                elif window == 'screen':
+                    window = terminal.ScreenTerm(comp._instanceName)
                 else:
                     raise RuntimeError, 'not supported'
             except Exception, e:
Index: src/base/framework/python/ossie/utils/sandbox/terminal.py
===================================================================
--- src.orig/base/framework/python/ossie/utils/sandbox/terminal.py
+++ src/base/framework/python/ossie/utils/sandbox/terminal.py
@@ -57,3 +57,13 @@ class GnomeTerm(Terminal):
 
     def _execArgs(self, command, arguments):
         return ['-x', command] + arguments
+
+class ScreenTerm(Terminal):
+    def __init__(self, title=None):
+        super(ScreenTerm,self).__init__('screen', title)
+
+    def _titleArgs(self, title):
+        return ['-S', title]
+
+    def _execArgs(self, command, arguments):
+        return ['-d', '-m', command] + arguments

btgoodwin avatar Jul 08 '20 19:07 btgoodwin