Example #1
0
    def test_basic(self):
        """Basic sanity testing."""
        test_basic = import_relative('test-basic')
        self.assertTrue(inspect.ismodule(test_basic),
                        'import_relative should return a module type')

        filename = os.path.join(get_srcdir(), 'test-basic.py')
        self.assertEqual(os.path.sep, filename[0],
                         'get_srcdir should return an absolute path name')

        check_fn = test_basic.__file__
        if (check_fn.endswith(".pyc") or check_fn.endswith(".pyo")):
            check_fn = check_fn[:-1]
            pass

        self.assertEqual(filename, check_fn,
                         'import_relative should set __file__ correctly')

        self.assertEqual('test-basic', test_basic.__name__,
                         'import_relative should set __name__ correctly')

        self.assertTrue(test_basic.true(),
                        'should be able to use fns inside returned module')

        self.assertTrue('test-basic' in sys.modules)

        ir = import_relative('import_relative', os.pardir)
        os2_path = ir.import_relative('os2.path')
        self.assertTrue('test.os2.path', os2_path.me)

        ir = import_relative('import_relative', '..')
        os2_path = ir.import_relative('os2.path')
        self.assertTrue('test.os2.path', os2_path.me)
        tb = import_relative('test-basic', '..test')
        self.assertTrue(tb.true)
        return
Example #2
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

from import_relative import *
# Our local modules

# FIXME: Until import_relative is fixed up...
import_relative('processor', '....')

Mbase_subcmd = import_relative('base_subcmd', '..')


class ShowAutoEval(Mbase_subcmd.DebuggerShowBoolSubcommand):
    "Show Python evaluation of unrecognized debugger commands"
    min_abbrev = len('autoe')
    pass


if __name__ == '__main__':
    Mhelper = import_relative('__demo_helper__', '.', 'trepan')
    Mhelper.demo_run(ShowAutoEval)
    pass
Example #3
0
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Interface when communicating with the user in the same process as
    the debugged program."""
import atexit, os

# Our local modules
from import_relative import *
import_relative('interfaces', '..')
Minterface = import_relative('interface', '..', 'trepan')
Minput = import_relative('input', '..io', 'trepan')
Moutput = import_relative('output', '..io', 'trepan')
Mmisc = import_relative('misc', '...trepan')

histfile = os.path.expanduser('~/.trepan3k_hist')

DEFAULT_USER_SETTINGS = {
    'histfile': histfile,  # Where do we save the history?
}

try:
    from readline import read_history_file, set_completer, set_history_length
    from readline import write_history_file, parse_and_bind
except ImportError:
Example #4
0
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

from import_relative import *
# Our local modules

# FIXME: Until import_relative is fixed up...
import_relative('processor', '....')

Mbase_subcmd  = import_relative('base_subcmd', '..')

class ShowAutoEval(Mbase_subcmd.DebuggerShowBoolSubcommand):
    "Show Python evaluation of unrecognized debugger commands"
    min_abbrev = len('autoe')
    pass

if __name__ == '__main__':
    Mhelper = import_relative('__demo_helper__', '.', 'trepan')
    Mhelper.demo_run(ShowAutoEval)
    pass
Example #5
0
# -*- coding: utf-8 -*-
#   Copyright (C) 2009, 2010, 2012 Rocky Bernstein
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *

# Our local modules

Mbase_subcmd = import_relative("base_subcmd", "..", "trepan")


class ShowMaxString(Mbase_subcmd.DebuggerShowIntSubcommand):
    "Show maximum string length to use in string-oriented output"
    min_abbrev = 2
    pass
Example #6
0
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.
# 'Helper' function for Processor. Put here so we
# can use this in a couple of processors.

from import_relative import *
from tracer import EVENT2SHORT
Mprocessor = import_relative('vprocessor', '..', 'trepan')

class PrintProcessor(Mprocessor.Processor):
    """ A processor that just prints out events as we see them. This
    is suitable for example for line/call tracing. We assume that the
    caller is going to filter out which events it wants printed or
    whether it wants any printed at all.
    """
    def __init__(self, debugger, opts=None):
        Mprocessor.Processor.__init__(self, debugger)
        return

    def event_processor(self, frame, event, arg):
        'A simple event processor that prints out events.'
        out = self.debugger.intf[-1].output
        lineno = frame.f_lineno
Example #7
0
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Module for client (i.e. user to communication-device) interaction.
The debugged program is at the other end of the communcation."""
import atexit

# Our local modules
from import_relative import *
Muser       = import_relative('user', top_name='trepan')
Mtcpclient  = import_relative('tcpclient', '..inout', 'trepan')
Mfifoclient = import_relative('fifoclient', '..inout', 'trepan')
Mcomcodes   = import_relative('comcodes', '.', 'trepan')
Mmisc       = import_relative('misc', '..', 'trepan')

class ClientInterface(Muser.UserInterface):
    """Interface for a user which is attached to a debugged process
    via some sort of communication medium (e.g. socket, tty, FIFOs).
    This could be on the same computer in a different process or on
    a remote computer."""

    DEFAULT_INIT_CONNECTION_OPTS = {'IO': 'FIFO'}
    def __init__(self, inp=None, out=None, inout=None, user_opts=None,
                 connection_opts=None):
        get_connection_option = lambda key: \
Example #8
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Module for Server (i.e. program to communication-device) interaction"""
import atexit, os

# Our local modules
from import_relative import *
Minterface = import_relative('interface', '..', 'trepan')
Mtcpserver = import_relative('tcpserver', '..io', 'trepan')
Mfifoserver = import_relative('fifoserver', '..io', 'trepan')
Mmisc = import_relative('misc', '..', 'trepan')
Mcomcodes = import_relative('comcodes', '.', 'trepan')


class ServerInterface(Minterface.TrepanInterface):
    """Interface for debugging a program but having user control
    reside outside of the debugged process, possibly on another
    computer."""

    DEFAULT_INIT_CONNECTION_OPTS = {'IO': 'TCP'}

    def __init__(self, inout=None, out=None, connection_opts=None):
        get_option = lambda key: \
Example #9
0
from import_relative import *
# Our local modules

Mbase_subcmd  = import_relative('base_subcmd', os.path.pardir)

class ShowDbgTrepan(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """Show debugging the debugger"""
    min_abbrev = 4 # Min 'show pydb"
    pass
Example #10
0
# -*- coding: utf-8 -*-
#   Copyright (C) 2009 Rocky Bernstein
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *

# Our local modules
Mbase_subcmd  = import_relative('base_subcmd', '..', 'trepan')

class ShowAnnotate(Mbase_subcmd.DebuggerShowIntSubcommand):
    "Show GNU Emacs 'annotation' level"
    min_abbrev = len('an') # Need at least "show an"
    pass
Example #11
0
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *
# Our local modules

Mcmdfns = import_relative('cmdfns', '...')

Mbase_subcmd = import_relative('base_subcmd', '..')


class ShowHighlight(Mbase_subcmd.DebuggerSubcommand):
    '''**show highlight**

Show whether we use terminal highlighting.'''
    def run(self, args):
        val = self.settings['highlight']
        if 'plain' == val:
            mess = 'output set to not use terminal escape sequences'
        elif 'light' == val:
            mess = 'output set for terminal with escape sequences for a light background'
        elif 'dark' == val:
Example #12
0
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *
# Our local modules

Mbase_subcmd = import_relative('base_subcmd', os.path.pardir, 'trepan')
Mcmdfns      = import_relative('cmdfns', '...', 'trepan')


class ShowEvents(Mbase_subcmd.DebuggerSubcommand):
    '''Show trace events we may stop on.'''
    min_abbrev = 2
    run_cmd    = False

    run = Mcmdfns.run_show_val
    pass

if __name__ == '__main__':
    mock = import_relative('mock', '..')
    Mshow = import_relative('show', '..')
    Mdebugger = import_relative('debugger', '....')
Example #13
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Call-frame-oriented helper function for Processor. Put here so we
# can use this in a couple of processors.

from import_relative import *
Mcmdfns = import_relative('cmdfns',   '.')
Mcomplete = import_relative('complete', '..lib')

def frame_low_high(proc_obj, direction):
    stack_size = len(proc_obj.stack) # - hide_level
    if direction is None:
        return [-stack_size, stack_size-1]
    else:
        frame_index = proc_obj.curindex
        low, high = [ frame_index * -direction,
                      (stack_size - frame_index - 1) * direction ]
        if direction < 0: low, high = [high, low]
        return (low, high)
    return

def frame_complete(proc_obj, prefix, direction):
Example #14
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Call-frame-oriented helper function for Processor. Put here so we
# can use this in a couple of processors.

from import_relative import *
Mcmdfns = import_relative('cmdfns', '.')
Mcomplete = import_relative('complete', '..lib')


def frame_low_high(proc_obj, direction):
    stack_size = len(proc_obj.stack)  # - hide_level
    if direction is None:
        return [-stack_size, stack_size - 1]
    else:
        frame_index = proc_obj.curindex
        low, high = [
            frame_index * -direction,
            (stack_size - frame_index - 1) * direction
        ]
        if direction < 0: low, high = [high, low]
        return (low, high)
Example #15
0
# -*- coding: utf-8 -*-
#   Copyright (C) 2009 Rocky Bernstein
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *
# Our local modules

Mbase_subcmd  = import_relative('base_subcmd', '..')

class ShowCmdtrace(Mbase_subcmd.DebuggerShowBoolSubcommand):
    "Show debugger commands before running them"
    min_abbrev = 4    # Need at least "show cmdt"
    pass


Example #16
0
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *
# Our local modules

Mbase_subcmd  = import_relative('base_subcmd', '..', 'trepan')
Mcmdfns       = import_relative('cmdfns', '...', 'trepan')
class ShowWidth(Mbase_subcmd.DebuggerSubcommand):
    "Show the number of characters the debugger thinks are in a line"

    min_abbrev = 2 # Need at least "show wi"

    def run(self, args):
        Mcmdfns.run_show_int(self, self.__doc__[5:].capitalize())
        return
    pass
Example #17
0
# -*- coding: utf-8 -*-
#   Copyright (C) 2009 Rocky Bernstein
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

from import_relative import *
# Our local modules

Mbase_subcmd  = import_relative('base_subcmd', os.path.pardir)

class ShowConfirm(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """Show confirmation of potentially dangerous operations"""
    min_abbrev = 3    # Need at least "show con"
    pass

if __name__ == '__main__':
    Mhelper = import_relative('__demo_helper__', '.', 'trepan')
    Mhelper.demo_run(ShowConfirm)
    pass
Example #18
0
# -*- coding: utf-8 -*-
#   Copyright (C) 2009, 2010, 2012 Rocky Bernstein
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *
# Our local modules

Mbase_subcmd = import_relative('base_subcmd', '..', 'trepan')


class ShowMaxString(Mbase_subcmd.DebuggerShowIntSubcommand):
    "Show maximum string length to use in string-oriented output"
    min_abbrev = 2
    pass
Example #19
0
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *
# Our local modules

Mbase_subcmd = import_relative('base_subcmd', os.path.pardir, 'trepan')
Mcmdfns = import_relative('cmdfns', '...', 'trepan')


class ShowEvents(Mbase_subcmd.DebuggerSubcommand):
    '''Show trace events we may stop on.'''
    min_abbrev = 2
    run_cmd = False

    run = Mcmdfns.run_show_val
    pass


if __name__ == '__main__':
    mock = import_relative('mock', '..')
    Mshow = import_relative('show', '..')
Example #20
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Module for reading debugger scripts"""
import atexit

# Our local modules
from import_relative import *
import_relative('inout', '...trepan')
Minterface = import_relative('interface', '..')
Mscriptin = import_relative('scriptin', '..inout')
Moutput = import_relative('output', '..inout')
Mmisc = import_relative('misc', '..')


class ScriptInterface(Minterface.DebuggerInterface):
    """Interface when reading debugger scripts"""

    DEFAULT_INIT_OPTS = {
        'abort_on_error': True,
        'confirm_val': False,
        'verbose': False
    }
Example #21
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Module for reading debugger scripts"""
import atexit

# Our local modules
from import_relative import *
Minterface = import_relative('interface', '..',   'trepan')
Mscriptin  = import_relative('scriptin',  '..io', 'trepan')
Moutput    = import_relative('output',    '..io', 'trepan')
Mmisc      = import_relative('misc',      '..',   'trepan')

class ScriptInterface(Minterface.TrepanInterface):
    """Interface when reading debugger scripts"""

    DEFAULT_INIT_OPTS = {
        'abort_on_error' : True,
        'confirm_val'    : False,
        'verbose'        : False
        }

    def __init__(self, script_name, out=None, opts=None):
        get_option = lambda key: Mmisc.option_set(opts, key, 
Example #22
0
# -*- coding: utf-8 -*-
#   Copyright (C) 2009 Rocky Bernstein
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#    02110-1301 USA.

from import_relative import *

# Our local modules

Mbase_subcmd = import_relative("base_subcmd", "..")


class ShowCmdtrace(Mbase_subcmd.DebuggerShowBoolSubcommand):
    "Show debugger commands before running them"
    min_abbrev = 4  # Need at least "show cmdt"
    pass
Example #23
0
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Interface when communicating with the user in the same process as
    the debugged program."""
import atexit, pprint

# Our local modules
from import_relative import *
import_relative('interfaces',             '..',   'trepan')
Minterface = import_relative('interface', '..',   'trepan')
Minput     = import_relative('input',     '..inout', 'trepan')
Moutput    = import_relative('output',    '..inout', 'trepan')

class BWInterface(Minterface.DebuggerInterface):
    """Interface when communicating with the user in the same
    process as the debugged program."""

    def __init__(self, inp=None, out=None, opts=None):
        atexit.register(self.finalize)
        self.input       = inp or Minput.DebuggerUserInput()
        self.output      = out or Moutput.DebuggerUserOutput()
        self.pp          = pprint.PrettyPrinter()
        return
Example #24
0
from import_relative import *
# Our local modules

Mbase_subcmd = import_relative('base_subcmd', os.path.pardir)


class ShowDbgTrepan(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """Show debugging the debugger"""
    min_abbrev = 4  # Min 'show pydb"
    pass
Example #25
0
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Module for Server (i.e. program to communication-device) interaction"""
import atexit, os

# Our local modules
from import_relative import *
Minterface  = import_relative('interface',  '..',   'trepan')
Mtcpserver  = import_relative('tcpserver', '..io', 'trepan')
Mfifoserver = import_relative('fifoserver', '..io', 'trepan')
Mmisc       = import_relative('misc', '..', 'trepan')
Mcomcodes   = import_relative('comcodes', '.', 'trepan')

class ServerInterface(Minterface.TrepanInterface):
    """Interface for debugging a program but having user control
    reside outside of the debugged process, possibly on another
    computer."""

    DEFAULT_INIT_CONNECTION_OPTS = {'IO': 'TCP'}
    def __init__(self, inout=None, out=None, connection_opts=None):
        get_option = lambda key: \
            Mmisc.option_set(connection_opts, key,
                             self.DEFAULT_INIT_CONNECTION_OPTS)
Example #26
0
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Module for client (i.e. user to communication-device) interaction.
The debugged program is at the other end of the communcation."""
import atexit

# Our local modules
from import_relative import *
Muser       = import_relative('user', top_name='trepan')
Mtcpclient  = import_relative('tcpclient', '..io', 'trepan')
Mfifoclient = import_relative('fifoclient', '..io', 'trepan')
Mcomcodes   = import_relative('comcodes', '.', 'trepan')
Mmisc       = import_relative('misc', '..', 'trepan')

class ClientInterface(Muser.UserInterface):
    """Interface for a user which is attached to a debugged process
    via some sort of communication medium (e.g. socket, tty, FIFOs).
    This could be on the same computer in a different process or on
    a remote computer."""

    DEFAULT_INIT_CONNECTION_OPTS = {'IO': 'FIFO'}
    def __init__(self, inp=None, out=None, inout=None, user_opts=None,
                 connection_opts=None):
        get_connection_option = lambda key: \
Example #27
0
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Interface when communicating with the user in the same process as
    the debugged program."""
import atexit, os

# Our local modules
from import_relative import *
import_relative('interfaces',  '..')
Minterface = import_relative('interface',  '..', 'trepan')
Minput     = import_relative('input', '..io', 'trepan')
Moutput    = import_relative('output', '..io', 'trepan')
Mmisc      = import_relative('misc', '...trepan')

histfile = os.path.expanduser('~/.trepan3k_hist')

DEFAULT_USER_SETTINGS = {
    'histfile'     : histfile, # Where do we save the history?
}

try:
    from readline import read_history_file, set_completer, set_history_length
    from readline import write_history_file, parse_and_bind
except ImportError: