示例#1
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, see <http://www.gnu.org/licenses/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowAutoPython(Mbase_subcmd.DebuggerShowBoolSubcommand):
    '''**show autopython**

Show whether we go into a python shell when automatically when the
debugger is entered.

Change with **set autopython**
'''
    short_help = "Show automatic Python shell entry"
    min_abbrev = len('autopy')
    pass


if __name__ == '__main__':
    from trepan.processor.command.show_subcmd \
      import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowAutoPython)
    pass
示例#2
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, see <http://www.gnu.org/licenses/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowBasename(Mbase_subcmd.DebuggerShowBoolSubcommand):
    '''**show basename**

Show whether filenames are reported with just the basename or the
fully qualified filename.

Change with **set basename**
'''
    short_help = "Show the basename portion only of filenames"
    min_abbrev = len('ba')
    pass


if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowBasename)
    pass
示例#3
0
        aliases.sort()
        if len(args) == 0:
            self._alias_header()
            for alias in aliases:
                self._alias_line(alias)
                pass
            return
        if "*" in args:
            self.section("Current aliases:")
            self.msg(columnize.columnize(aliases, lineprefix="    "))
        else:
            self._alias_header()
            for alias in args:
                if alias in aliases:
                    self._alias_line(alias)
                else:
                    self.errmsg("%s is not an alias" % alias)
                    pass
                pass
            return
        return


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper

    sub = Mhelper.demo_run(ShowAliases)
    sub.run(["*"])
    sub.run(["s+", "n+"])
    pass
示例#4
0
#   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.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


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

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowAutoEval)
    pass
示例#5
0
#  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/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowArgs(Mbase_subcmd.DebuggerSubcommand):
    """Show argument list to give debugged program when it is started"""
    min_abbrev = len('arg')
    run_in_help = False
    short_help = 'Show arguments when program is started'

    def run(self, args):
        self.msg("Argument list to give program being debugged " +
                 "when it is started is:")
        self.msg('\t%s.' % ' '.join(self.debugger.program_sys_argv[1:]))
        return False

    pass


if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowArgs)
    pass
示例#6
0
    infopc_cmd = None

    def run(self, args):
        run_set_bool(self, args)
        if self.settings["autopc"]:
            if self.infopc_cmd is None:
                info_cmd = self.proc.commands["info"]
                self.info_pc_cmd = info_cmd.cmds.lookup("pc").run
                pass
            self.proc.add_preloop_hook(self.run_infopc, 0)

        else:
            self.proc.remove_preloop_hook(self.run_infopc)
            pass
        run_show_bool(self, "Run `info pc` on debugger entry")
        return

    def run_infopc(self, args):
        if self.proc.frame:
            self.info_pc_cmd(["info", "pc"])
        return

    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd.__demo_helper__ import demo_run

    demo_run(SetAutoPC)
    pass
示例#7
0
#  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/>.

# Our local modules
from trepan.processor.command.base_subcmd import DebuggerShowBoolSubcommand


class ShowAutoStack(DebuggerShowBoolSubcommand):
    """**show autostack**

Show debugger `info stack` command automatically on entry.

See also:
---------

`set autostack`"""

    min_abbrev = len("autos")
    short_help = "Show `info stack` on debugger entry"
    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd.__demo_helper__ import demo_run

    demo_run(ShowAutoStack)
    pass
示例#8
0
#  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/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowBasename(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """**show basename**

Show whether filenames are reported with just the basename or the
fully qualified filename.

Change with **set basename**
"""

    short_help = "Show the basename portion only of filenames"
    min_abbrev = len("ba")
    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper

    Mhelper.demo_run(ShowBasename)
    pass
#   (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/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowAutoPython(Mbase_subcmd.DebuggerShowBoolSubcommand):
    '''**show autopython**

Show whether we go into a python shell when automatically when the
debugger is entered.

Change with **set autopython**
'''
    short_help = "Show automatic Python shell entry"
    min_abbrev = len('autopy')
    pass

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    mgr = Mhelper.demo_run(ShowAutoPython)
    pass
示例#10
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, see <http://www.gnu.org/licenses/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowAutoEval(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """**show autoeval**

Show Python evaluation of unrecognized debugger commands.

See also:
---------

`set autoeval`
"""
    min_abbrev = len('autoe')
    pass

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowAutoEval)
    pass
示例#11
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, see <http://www.gnu.org/licenses/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowArgs(Mbase_subcmd.DebuggerSubcommand):
    """Show argument list to give debugged program when it is started"""
    min_abbrev = len('arg')
    run_in_help = False
    short_help = 'Show arguments when program is started'

    def run(self, args):
        self.msg("Argument list to give program being debugged " +
                 "when it is started is:")
        self.msg('\t%s.' % ' '.join(self.debugger.program_sys_argv[1:]))
        return False
    pass

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowArgs)
    pass
示例#12
0
    def run(self, args):
        aliases = list(self.proc.aliases.keys())
        aliases.sort()
        if len(args) == 0:
            self._alias_header()
            for alias in aliases:
                self._alias_line(alias)
                pass
            return
        if '*' in args:
            self.section("Current aliases:")
            self.msg(columnize.columnize(aliases, lineprefix='    '))
        else:
            self._alias_header()
            for alias in args:
                if alias in aliases:
                    self._alias_line(alias)
                else:
                    self.errmsg("%s is not an alias" % alias)
                    pass
                pass
            return
        return

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    sub = Mhelper.demo_run(ShowAliases)
    sub.run(['*'])
    sub.run(['s+', "n+"])
    pass
示例#13
0
    info_stack_cmd = None

    def run(self, args):
        run_set_bool(self, args)
        if self.settings["autostack"]:
            if self.info_stack_cmd is None:
                info_cmd = self.proc.commands["info"]
                self.info_stack_cmd = info_cmd.cmds.lookup("stack").run
                pass
            self.proc.add_preloop_hook(self.run_infostack, 0)

        else:
            self.proc.remove_preloop_hook(self.run_infostack)
            pass
        run_show_bool(self, "Run `info stack` on debugger entry")
        return

    def run_infostack(self, args):
        if self.proc.frame:
            self.info_stack_cmd(["info", "stack"])
        return

    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd.__demo_helper__ import demo_run

    demo_run(SetAutoStack)
    pass
示例#14
0
#  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/>.

# Our local modules
from trepan.processor.command.base_subcmd import DebuggerShowBoolSubcommand


class ShowAutoPC(DebuggerShowBoolSubcommand):
    """**show autopc**

    Show debugger `info pc` command automatically on entry.

    See also:
    ---------

    `set autopc`"""

    min_abbrev = len("autos")
    short_help = "Show `info pc` on debugger entry"
    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd.__demo_helper__ import demo_run

    demo_run(ShowAutoPC)
    pass
示例#15
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/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowFlush(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """**show flush**

Show confirmation of potentially dangerous operations

See also:
---------

`set flush`"""
    min_abbrev = 3    # Need at least "show flu"
    pass

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    Mhelper.demo_run(ShowConfirm)
    pass
示例#16
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, see <http://www.gnu.org/licenses/>.

# Our local modules
from trepan.processor.command import base_subcmd as Mbase_subcmd


class ShowAutoList(Mbase_subcmd.DebuggerShowBoolSubcommand):
    """**show autolist**

Show debugger `list` command automatically on entry.

See also:
---------

`set autolist`"""
    min_abbrev = len('autol')
    short_help = 'Show `list` on debugger entry'
    pass

if __name__ == '__main__':
    from trepan.processor.command.show_subcmd import __demo_helper__ as Mhelper
    mgr = Mhelper.demo_run(ShowAutoList)
    pass
示例#17
0
        if self.settings["autolist"]:
            if self.list_cmd is None:
                self.list_cmd = self.proc.commands["list"].run
                pass
            self.proc.add_preloop_hook(self.run_list, 0)

        else:
            self.proc.remove_preloop_hook(self.run_list)
            pass
        run_show_bool(self, "Show `list` on debugger entry")
        return

    def run_list(self, args):
        # Check if there is a "file" to show. Right now we just
        # handle the case of a string.
        # FIXME: generalize this so for other kinds of missing "files"
        # are not shown.
        filename = frame2file(self.core, self.proc.curframe)
        if "<string>" != filename:
            self.list_cmd(["list"])
        return

    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd.__demo_helper__ import demo_run

    demo_run(SetAutoList)
    pass
示例#18
0
#  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/>.

# Our local modules
from trepan.processor.command.base_subcmd import DebuggerShowBoolSubcommand


class ShowAutoList(DebuggerShowBoolSubcommand):
    """**show autolist**

    Show debugger `list` command automatically on entry.

    See also:
    ---------

    `set autolist`"""

    min_abbrev = len("autol")
    short_help = "Show `list` on debugger entry"
    pass


if __name__ == "__main__":
    from trepan.processor.command.show_subcmd.__demo_helper__ import demo_run

    demo_run(ShowAutoList)
    pass