? configure.lineno Index: pydb/gdb.py.in =================================================================== RCS file: /cvsroot/bashdb/pydb/pydb/gdb.py.in,v retrieving revision 1.41 diff -u -r1.41 gdb.py.in --- pydb/gdb.py.in 22 Jul 2006 22:39:18 -0000 1.41 +++ pydb/gdb.py.in 24 Jul 2006 14:36:15 -0000 @@ -258,7 +258,7 @@ self.showcmds.add('args', self.show_args) self.showcmds.add('basename', self.show_basename) self.showcmds.add('cmdtrace', self.show_cmdtrace, 2) - self.showcmds.add('commands', self.show_commands, 2) + self.showcmds.add('commands', self.show_commands, 2, False) self.showcmds.add('history', self.show_history) self.showcmds.add('interactive', self.show_interactive) self.showcmds.add('linetrace', self.show_linetrace, 3) @@ -1096,87 +1096,14 @@ get info about just that subcommand.""" if not arg: - self.help_info([]) + for subcommand in self.infocmds.list(): + self.msg_nocr("%s: " % subcommand) + self.do_info(subcommand) return - arglist = arg.split() - arg = arglist[0] - frame=self.curframe - if "args".startswith(arg): - if not self.curframe: - self.msg("No stack.") - return - self.info_args(None) - elif "break".startswith(arg): - # FIXME: Should split out the "info" part in args - self.do_L(None) - elif 'display'.startswith(arg): - if not self.display.displayAll(): - self.msg('There are no auto-display expressions now.') - elif "globals".startswith(arg): - if not frame: - self.msg("No frame selected.") - return - self.msg("\n".join(["%s = %s" - % (l, pprint.pformat(self.getval(l))) - for l in frame.f_globals])) - elif "line".startswith(arg) and len(arg) > 1: - #info line identifier - if not frame: - self.msg("No line number information available.") - return - if len(arglist) == 2: - # lineinfo returns (item, file, lineno) or (None,) - answer = self.lineinfo(arglist[1]) - if answer[0]: - item, file, lineno = answer - if not os.path.isfile(file): - file = search_file(file, self.search_path, - self.main_dirname) - self.msg('Line %s of "%s" <%s>' % - (lineno, file, item)) - return - #info line - file=self.canonic_filename(frame) - if not os.path.isfile(file): - file = search_file(file, self.search_path, self.main_dirname) - - self.msg('Line %d of \"%s\" at instruction %d' % - (inspect.getlineno(frame), - self.filename(self.canonic_filename(frame)), - self.curframe.f_lasti)) - elif "locals".startswith(arg) and len(arg) > 1: - if not frame: - self.msg("No frame selected.") - return - self.msg("\n".join(["%s = %s" - % (l, pprint.pformat(self.getval(l))) - for l in frame.f_locals])) - elif 'program'.startswith(arg): - if not frame: - self.msg("The program being debugged is not being run.") - return - if self.is_running(): - self.msg('Program stopped.') - if self.currentbp: - self.msg('It stopped at breakpoint %d.' % self.currentbp) - elif self.stop_reason == 'call': - self.msg('It stopped at a call.') - elif self.stop_reason == 'exception': - self.msg('It stopped as a result of an exception.') - elif self.stop_reason == 'return': - self.msg('It stopped at a return.') - else: - self.msg("It stopped after stepping, next'ing or initial start.") - return - elif "source".startswith(arg): - if not frame: - self.msg("No current source file.") - return - self.msg('Current Python file is %s' % - self.filename(self.canonic_filename(frame))) else: - self.undefined_cmd("info", arg) + args = arg.split() + self.infocmds.do(self, args[0], args) def info_break(self, arg): """info break Index: pydb/pydbcmd.py =================================================================== RCS file: /cvsroot/bashdb/pydb/pydb/pydbcmd.py,v retrieving revision 1.23 diff -u -r1.23 pydbcmd.py --- pydb/pydbcmd.py 22 Jul 2006 22:39:18 -0000 1.23 +++ pydb/pydbcmd.py 24 Jul 2006 14:36:15 -0000 @@ -6,7 +6,7 @@ of more oriented towards any gdb-like debugger. Also routines that need to be changed from cmd are here. """ -import cmd, linecache, os, sys, types +import cmd, linecache, os, pprint, sys, types from fns import * # Interaction prompt line will separate file and call info from code @@ -274,7 +274,7 @@ self.commands_doprompt[self.commands_bnum] = False self.cmdqueue = [] return 1 - return + return def info_args(self, arg): """Argument variables of current stack frame""" @@ -318,9 +318,9 @@ if not self.curframe: self.msg("No line number information available.") return - if len(arglist) == 2: + if len(arg) == 2: # lineinfo returns (item, file, lineno) or (None,) - answer = self.lineinfo(arglist[1]) + answer = self.lineinfo(arg[1]) if answer[0]: item, file, lineno = answer if not os.path.isfile(file): @@ -329,6 +329,14 @@ self.msg('Line %s of "%s" <%s>' % (lineno, file, item)) return + file=self.canonic_filename(self.curframe) + if not os.path.isfile(file): + file = search_file(file, self.search_path, self.main_dirname) + + self.msg('Line %d of \"%s\" at instruction %d' % + (inspect.getlineno(self.curframe), + self.filename(self.canonic_filename(self.curframe)), + self.curframe.f_lasti)) def info_locals(self, arg): """Local variables of current stack frame""" @@ -362,7 +370,7 @@ self.msg("No current source file.") return self.msg('Current Python file is %s' % - self.filename(self.canonic_filename(frame))) + self.filename(self.canonic_filename(self.curframe))) def msg(self, msg, out=None): """Common routine for reporting messages. Index: pydb/subcmd.py =================================================================== RCS file: /cvsroot/bashdb/pydb/pydb/subcmd.py,v retrieving revision 1.1 diff -u -r1.1 subcmd.py --- pydb/subcmd.py 22 Jul 2006 22:39:18 -0000 1.1 +++ pydb/subcmd.py 24 Jul 2006 14:36:15 -0000 @@ -24,7 +24,11 @@ entry=self.lookup(subcmd_name) if entry: - obj.msg(entry['doc']) + d = entry['doc'] + # Only print one line of the docstring, stopping at the full-stop. + if '.' in d: + d = d[:d.find('.')] + obj.msg(d) return obj.undefined_cmd("help", subcmd_name) @@ -75,6 +79,10 @@ def list(self): l=self.subcmds.keys() + for i in l: + # Remove subcmd if we don't want it displayed in the list + if not self.subcmds[i]['in_list']: + l.pop(l.index(i)) l.sort() return l Index: test/cmdparse.right =================================================================== RCS file: /cvsroot/bashdb/pydb/test/cmdparse.right,v retrieving revision 1.19 diff -u -r1.19 cmdparse.right --- test/cmdparse.right 22 Jul 2006 22:39:18 -0000 1.19 +++ test/cmdparse.right 24 Jul 2006 14:36:15 -0000 @@ -295,10 +295,9 @@ show args -- Show argument list to give debugged program on start show basename -- Show if we are to show short of long filenames show cmdtrace -- Show if we are to show debugger commands before running -show commands -- Show the history of commands you typed show history -- Generic command for showing command history parameters show interactive -- Show whether we are interactive -show linetrace -- Show the line tracing status. Can also add 'delay' +show linetrace -- Show the line tracing status show listsize -- Show number of source lines the debugger will list by default show logging -- Show logging options show prompt -- Show debugger's prompt