Skip to content

Commit

Permalink
First stab at bindings to simuliate perldb. Alias help expanded. main…
Browse files Browse the repository at this point in the history
….rb add interfaces accessor.
  • Loading branch information
rocky committed Jun 18, 2011
1 parent e230da4 commit 3afc366
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
17 changes: 17 additions & 0 deletions data/perldb.bindings
@@ -0,0 +1,17 @@
# Aliases to simulate some of the Perl debugger command set
alias = alias
alias R restart
alias b break
alias c continue
alias f list
alias n next
alias p pr
alias q quit
alias s step
alias v list
macro - Proc.new{|*args| "list -"}
macro E Proc.new{|*args| "info thread"}
macro L Proc.new{|*args| "info break"}
macro T Proc.new{|*args| "info stack"}
macro l Proc.new{|*args| "list>"}
macro r Proc.new{|*args| %w(finish step)}
15 changes: 13 additions & 2 deletions processor/command/alias.rb
Expand Up @@ -8,7 +8,18 @@ class Trepan::Command::AliasCommand < Trepan::Command
HELP = <<-HELP
#{NAME} ALIAS COMMAND
Add an alias for a COMMAND
Add alias ALIAS for a debugger command COMMAND.
Add an alias when you want to use a command abbreviation for a command
that would otherwise be ambigous. For example, by default we make 's'
be an alias of 'step' to force it to be used. Without the alias, "s"
might be "step", "show", or "set" among others
Example:
alias cat list # "cat rubyfile.rb" is the same as "list rubyfile.rb"
alias s step # "s" is now an alias for "step".
# The above examples done by default.
See also 'unalias' and 'show #{NAME}'.
HELP
Expand All @@ -24,7 +35,7 @@ def run(args)
if args.size == 1
@proc.commands['show'].run(%w(show alias))
elsif args.size == 2
@proc.commands['show'].run(['show', 'alias', args[1]])
@proc.commands['show'].run(%W(show alias #{args[1]}))
else
junk, al, command = args
old_command = @proc.aliases[al]
Expand Down
6 changes: 3 additions & 3 deletions processor/command/list.rb
Expand Up @@ -6,8 +6,8 @@

class Trepan::Command::ListCommand < Trepan::Command
unless defined?(HELP)
NAME = File.basename(__FILE__, '.rb')
HELP = <<-HELP
NAME = File.basename(__FILE__, '.rb')
HELP = <<-HELP
#{NAME}[>] [MODULE] [FIRST [NUM]]
#{NAME}[>] LOCATION [NUM]
Expand Down Expand Up @@ -81,7 +81,7 @@ class Trepan::Command::ListCommand < Trepan::Command
disabled.
HELP

ALIASES = %W(l #{NAME}> l>)
ALIASES = %W(l #{NAME}> l> cat)
CATEGORY = 'files'
MAX_ARGS = 3
SHORT_HELP = 'List source code'
Expand Down
1 change: 1 addition & 0 deletions processor/main.rb
Expand Up @@ -34,6 +34,7 @@ class CmdProcessor < VirtualCmdProcessor
attr_accessor :event # Stop event. Same as @core.event
attr_reader :intf # Current interface
# Trepan::Core instance)
attr_reader :interfaces # Array of all interfaces
attr_accessor :leave_cmd_loop # Commands set this to signal to leave
# the command loop (which often continues to
# run the debugged program).
Expand Down

0 comments on commit 3afc366

Please sign in to comment.