Permalink
Browse files

Merge https://github.com/rocky/Perl-Devel-Trepan

  • Loading branch information...
2 parents d877a95 + d5cda13 commit 9597cfe818dd2b202439a1cb7b1b43caa8bfcad9 @shlomif committed Oct 29, 2011
Showing with 145 additions and 105 deletions.
  1. +5 −2 Build.PL
  2. +27 −0 Changes
  3. +8 −0 MANIFEST
  4. +2 −0 MANIFEST.SKIP
  5. +1 −1 lib/Devel/Trepan.pm
  6. +4 −4 lib/Devel/Trepan/CmdProcessor.pm
  7. +1 −1 lib/Devel/Trepan/CmdProcessor/Command.pm
  8. +4 −4 lib/Devel/Trepan/CmdProcessor/Command/Edit.pm
  9. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Eval.pm
  10. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Finish.pm
  11. +5 −5 lib/Devel/Trepan/CmdProcessor/Command/Help.pm
  12. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Files.pm
  13. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Kill.pm
  14. +2 −2 lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Auto_Subcmd/List.pm
  15. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/EvalDisplay.pm
  16. +3 −3 lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Highlight.pm
  17. +4 −4 lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Timer.pm
  18. +2 −2 lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Trace_Subcmd/Print.pm
  19. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Show_Subcmd/Highlight.pm
  20. +2 −2 lib/Devel/Trepan/CmdProcessor/Command/Subcmd/Core.pm
  21. +1 −1 lib/Devel/Trepan/CmdProcessor/Command/Subcmd/SubMgr.pm
  22. +4 −4 lib/Devel/Trepan/CmdProcessor/Command/Subcmd/SubsubMgr.pm
  23. +3 −3 lib/Devel/Trepan/CmdProcessor/Command/Subcmd/Subsubcmd.pm
  24. +3 −3 lib/Devel/Trepan/CmdProcessor/Frame.pm
  25. +1 −1 lib/Devel/Trepan/CmdProcessor/Hook.pm
  26. +11 −11 lib/Devel/Trepan/CmdProcessor/Msg.pm
  27. +1 −1 lib/Devel/Trepan/CmdProcessor/Running.pm
  28. +1 −1 lib/Devel/Trepan/Core.pm
  29. +7 −7 lib/Devel/Trepan/DB/Colors.pm
  30. +15 −15 lib/Devel/Trepan/DB/LineCache.pm
  31. +3 −3 lib/Devel/Trepan/IO/StringArray.pm
  32. +16 −16 lib/Devel/Trepan/Interface/User.pm
  33. +3 −3 lib/Devel/Trepan/Psh.pm
View
@@ -29,7 +29,11 @@ my $builder = Module::Build->new(
dist_version_from => 'lib/Devel/Trepan.pm',
license => 'gpl',
needs_compiler => 0,
- release_status => 'testing',
+ release_status => 'stable',
+ configure_requires => { 'Module::Build' => 0.38 },
+ build_requires => {
+ 'String::Diff' => 0,
+ },
requires => {
'perl' => '5.010',
'Array::Columnize' => '0.3.5',
@@ -39,7 +43,6 @@ my $builder = Module::Build->new(
'Psh' => '1.8.0',
'Syntax::Highlight::Perl::Improved' => 0,
'Test::More' => 0,
- 'String::Diff' => 0,
'version' => 0,
},
sign => 1,
View
27 Changes
@@ -0,0 +1,27 @@
+Revision history for Devel-Trepan
+0.1.0 - Oct 27, 2011
+
+Initial release.
+
+Some cool things not in other Perl debuggers
+- Syntax higlighting via Syntax::Highlight::Perl::Improved
+- Readline debugger command completion
+- Extensive help inside the debugger
+- Gdb-like command set
+- Standalone binary install: trepanpl
+ (Enbugger support provided as a patch to Enbugger)
+- trace mode for POSIX-shell "set -x"-like tracing: trepanpl -x ...
+- auto evaluation in hash and array and scalar context:
+ @ array-expression # for array
+ % hash-expression # for hash
+ [$] expression # for scalar
+- Evaluation results saved in global array @DB::D
+- Ability to go into a Psh shell
+- Debugger Command aliases for simple things and
+- Debugger Command macros via a perl anonymous sub for
+ more complicated things.
+- Extensible command set
+- many unit and integration tests
+
+Still, much remains to be done (out-of-process control, installing
+signal handlers, adding watch expressions), so please help out!
View
@@ -1,6 +1,7 @@
Artistic
bin/trepanpl
Build.PL
+Changes
example/eval.pl
example/fns.pl
example/gcd-dbg.pl
@@ -68,6 +69,7 @@ lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Return.pm
lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Timer.pm
lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Trace.pm
lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Trace_Subcmd/Print.pm
+lib/Devel/Trepan/CmdProcessor/Command/Shell.pm
lib/Devel/Trepan/CmdProcessor/Command/Show.pm
lib/Devel/Trepan/CmdProcessor/Command/Show_Subcmd/Abbrev.pm
lib/Devel/Trepan/CmdProcessor/Command/Show_Subcmd/Aliases.pm
@@ -131,6 +133,7 @@ lib/Devel/Trepan/IO/Output.pm
lib/Devel/Trepan/IO/StringArray.pm
lib/Devel/Trepan/Options.pm
lib/Devel/Trepan/Position.pm
+lib/Devel/Trepan/Psh.pm
lib/Devel/Trepan/Util.pm
MANIFEST This list of files
MANIFEST.SKIP
@@ -170,6 +173,8 @@ t/data/display.cmd
t/data/display.right
t/data/eval.cmd
t/data/eval.right
+t/data/eval2.cmd
+t/data/eval2.right
t/data/list1.cmd
t/data/list1.right
t/data/list2.cmd
@@ -188,3 +193,6 @@ t/data/trace2.cmd
t/data/trace2.right
t/Helper.pm
testit
+Makefile.PL
+META.yml
+META.json
View
@@ -1,6 +1,8 @@
#!start included /usr/share/perl/5.10/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
+\bhow-to-make-a-release.txt$
+\bDevel-Trepan-.*\.gz$
\bRCS\b
\bCVS\b
\bSCCS\b
View
@@ -6,7 +6,7 @@ package Devel::Trepan;
use strict;
use warnings;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
-use version; $VERSION = '0.1.0'; # 0.1.0 to match initial Rubinius version
+use version; $VERSION = '0.1.1dev';
use Exporter;
use lib '..';
@@ -76,8 +76,8 @@ sub new($;$$$) {
$self->running_initialize;
$self->hook_initialize;
$self->{unconditional_prehooks}->insert_if_new(10,
- $self->{trace_hook}->[0],
- $self->{trace_hook}->[1]
+ $self->{trace_hook}[0],
+ $self->{trace_hook}[1]
) if $self->{settings}{traceprint};
if ($intf->has_completion) {
@@ -339,7 +339,7 @@ sub run_command($$)
last unless $self->{macros}{$macro_cmd_name};
pop @args;
my $macro_expanded =
- $self->{macros}{$macro_cmd_name}->[0]->(@args);
+ $self->{macros}{$macro_cmd_name}[0]->(@args);
# $self->msg($macro_expanded) if $self->{settings}{debugmacro};
if (ref $macro_expanded eq 'ARRAY' # &&
# current_command.all? {|val| val.is_a?(String)}
@@ -429,7 +429,7 @@ unless (caller) {
print $sep;
$proc->run_command("help help;; kill 100");
# Note kill 100 is in queue - not run yet.
- if (scalar(@ARGV) > 0 && $proc->{interfaces}->[-1]->is_interactive) {
+ if (scalar(@ARGV) > 0 && $proc->{interfaces}[-1]->is_interactive) {
$proc->process_command_and_quit; # Handle's queued command
$proc->process_command_and_quit;
print $sep;
@@ -152,7 +152,7 @@ sub section($$;$) {
sub settings($) {
my ($self) = @_;
- $self->{proc}->{settings};
+ $self->{proc}{settings};
}
sub short_help($) {
@@ -43,12 +43,12 @@ sub run($$)
my ($filename, $line_number);
given (scalar @$args) {
when (1) {
- $filename = $self->{proc}->{frame}->{file};
- $line_number = $self->{proc}->{frame}->{line};
+ $filename = $self->{proc}{frame}{file};
+ $line_number = $self->{proc}{frame}{line};
} when(2) {
$line_number = $self->{proc}->get_int_noerr($args->[1]);
if (defined $line_number) {
- $filename = $self->{proc}->{frame}->{file};
+ $filename = $self->{proc}{frame}{file};
} else {
$filename = $args->[1];
$line_number = 1;
@@ -62,7 +62,7 @@ sub run($$)
my $editor = $ENV{'EDITOR'} || '/bin/ex';
if ( -r $filename ) {
use File::Basename;
- $filename = basename($filename) if $self->{proc}->{settings}{basename};
+ $filename = basename($filename) if $self->{proc}{settings}{basename};
my @edit_cmd = ($editor, "+$line_number", $filename);
$self->{proc}->msg(sprintf "Running: %s...", join(' ', @edit_cmd));
system(@edit_cmd);
@@ -69,7 +69,7 @@ sub complete($$)
{
my ($self, $prefix) = @_;
if (!$prefix) {
- if (0 == index($self->{proc}->{leading_str}, 'eval?')) {
+ if (0 == index($self->{proc}{leading_str}, 'eval?')) {
Devel::Trepan::Util::extract_expression(
$self->{proc}->current_source_text());
} else {
@@ -58,7 +58,7 @@ sub run($$) {
$level_count = $count;
}
- $self->{proc}->{leave_cmd_loop} = 1;
+ $self->{proc}{leave_cmd_loop} = 1;
$self->{dbgr}->finish($level_count);
}
@@ -141,11 +141,11 @@ sub run($$)
splice(@$args,0,2);
$self->show_category($cmd_name, $args);
} elsif ($proc->{commands}{$cmd_name}
- || $proc->{aliases}->{$cmd_name}) {
+ || $proc->{aliases}{$cmd_name}) {
if ($proc->{commands}{$cmd_name}) {
$real_name = $cmd_name;
} else {
- $real_name = $proc->{aliases}->{$cmd_name};
+ $real_name = $proc->{aliases}{$cmd_name};
}
my $cmd_obj = $proc->{commands}{$real_name};
my $help_text =
@@ -158,12 +158,12 @@ sub run($$)
$self->msg("Aliases: $aliases_str");
}
}
- # } elsif ($self->{proc}->{macros}->{$cmd_name}) {
+ # } elsif ($self->{proc}{macros}{$cmd_name}) {
# $self->msg("${cmd_name} is a macro which expands to:");
# $self->msg(" ${@proc.macros[cmd_name]}", {:unlimited => true});
} else {
my @matches = sort grep(/^${cmd_name}/,
- keys %{$self->{proc}->{commands}} );
+ keys %{$self->{proc}{commands}} );
if (!scalar @matches) {
$self->errmsg("No commands found matching /^${cmd_name}/. Try \"help\".")
} else {
@@ -180,7 +180,7 @@ sub show_aliases($)
{
my $self = shift;
$self->section('All alias names:');
- my @aliases = sort(keys(%{$self->{proc}->{aliases}}));
+ my @aliases = sort(keys(%{$self->{proc}{aliases}}));
$self->msg($self->columnize_commands(\@aliases));
}
@@ -88,7 +88,7 @@ sub run($$)
}
my $filename = shift @args;
if ($filename eq '.') {
- my $frame_file = $proc->{frame}->{file};
+ my $frame_file = $proc->{frame}{file};
$filename = DB::LineCache::map_file($frame_file) ||
abs_path($frame_file);
}
@@ -84,7 +84,7 @@ sub run($$) {
}
if (kill(0, $$)) {
# Force finalization on interface.
- $self->{proc}->{interfaces} = [] if
+ $self->{proc}{interfaces} = [] if
'KILL' eq $sig || 9 eq $sig || -9 eq $sig;
if (kill($sig, $$)) {
$self->msg("kill ${sig} successfully sent to process $$");
@@ -28,8 +28,8 @@ sub run($$)
$self->SUPER::run($args);
my $proc = $self->{proc};
if ( $proc->{settings}{autolist} ) {
- $proc->{cmdloop_prehooks}->insert_if_new(10, $proc->{autolist_hook}->[0],
- $proc->{autolist_hook}->[1]);
+ $proc->{cmdloop_prehooks}->insert_if_new(10, $proc->{autolist_hook}[0],
+ $proc->{autolist_hook}[1]);
} else {
$proc->{cmdloop_prehooks}->delete_by_name('autolist');
}
@@ -32,7 +32,7 @@ sub run($$)
$proc->errmsg("Expecting either 'tidy' or 'dumper', got ${evaltype}");
return;
}
- $proc->{commands}->{show}->run(['show', 'evaldisplay']);
+ $proc->{commands}{show}->run(['show', 'evaldisplay']);
}
unless (caller) {
@@ -26,11 +26,11 @@ sub run($$)
my ($self, $args) = @_;
if (scalar @$args == 3 && 'reset' eq $args->[2]) {
DB::LineCache::clear_file_format_cache;
- $self->{proc}->{settings}{highlight} = 'term';
+ $self->{proc}{settings}{highlight} = 'term';
} else {
$self->SUPER::run($args);
- $self->{proc}->{settings}{highlight} = 'term' if
- $self->{proc}->{settings}{highlight};
+ $self->{proc}{settings}{highlight} = 'term' if
+ $self->{proc}{settings}{highlight};
}
}
@@ -43,10 +43,10 @@ sub run($$)
$self->SUPER::run($args);
my $proc = $self->{proc};
if ( $proc->{settings}{timer} ) {
- $proc->{cmdloop_posthooks}->insert_if_new(-1, $proc->{timer_hook}->[0],
- $proc->{timer_hook}->[1]);
- $proc->{cmdloop_prehooks}->insert_if_new(-1, $proc->{timer_hook}->[0],
- $proc->{timer_hook}->[1]);
+ $proc->{cmdloop_posthooks}->insert_if_new(-1, $proc->{timer_hook}[0],
+ $proc->{timer_hook}[1]);
+ $proc->{cmdloop_prehooks}->insert_if_new(-1, $proc->{timer_hook}[0],
+ $proc->{timer_hook}[1]);
} else {
$proc->{cmdloop_posthooks}->delete_by_name('timer');
$proc->{cmdloop_posthooks}->delete_by_name('timer');
@@ -32,8 +32,8 @@ sub run($$)
my $proc = $self->{proc};
if ( $proc->{settings}{traceprint} ) {
$proc->{unconditional_prehooks}->insert_if_new(10,
- $proc->{trace_hook}->[0],
- $proc->{trace_hook}->[1]
+ $proc->{trace_hook}[0],
+ $proc->{trace_hook}[1]
);
} else {
$proc->{unconditional_prehooks}->delete_by_name('trace');
@@ -18,7 +18,7 @@ sub run($$)
{
my ($self, $args) = @_;
my $proc = $self->{proc};
- my $val = 'term' eq $proc->{settings}->{highlight};
+ my $val = 'term' eq $proc->{settings}{highlight};
my $onoff = $self->show_onoff($val);
my $msg = sprintf "%s is %s.", $self->{name}, $onoff;
$proc->msg($msg);
@@ -111,7 +111,7 @@ sub run_set_int($$$;$$)
msg_on_error => $msg_on_error
});
if (defined ($val)) {
- $self->{settings}->{subcmd_setting_key} = $val;
+ $self->{settings}{subcmd_setting_key} = $val;
$self->run_show_int();
}
}
@@ -284,7 +284,7 @@ if (__FILE__ eq $0) {
my $subcmd =
Devel::Trepan::CmdProcessor::Command::Subcmd->new($cmds{'quit'});
print join(', ', keys %{$subcmd->{settings}}), "\n";
- print $subcmd->show_onoff($subcmd->{settings}->{autoeval}), "\n";
+ print $subcmd->show_onoff($subcmd->{settings}{autoeval}), "\n";
$subcmd->run_set_int($proc, 'Just a test');
}
@@ -135,7 +135,7 @@ sub lookup($$;$)
my ($self, $subcmd_prefix, $use_regexp) = @_;
$use_regexp = 0 if scalar @_ < 3;
my $compare;
- if (!$self->{proc}->{settings}->{abbrev}) {
+ if (!$self->{proc}{settings}{abbrev}) {
$compare = sub($) { my $name = shift; $name eq $subcmd_prefix};
} elsif ($use_regexp) {
$compare = sub($) { my $name = shift; $name =~ /^${subcmd_prefix}/};
@@ -87,7 +87,7 @@ sub load_debugger_subsubcommands($$)
$self->{cmd_basenames} = ();
my $cmd_dir = dirname(__FILE__);
my $parent_name = ucfirst $self->{name};
- my $cmd_name = $self->{prefix}->[0];
+ my $cmd_name = $self->{prefix}[0];
my @path = ($cmd_dir, '..', "${cmd_name}_Subcmd",
$parent_name . '_Subcmd');
my $subcmd_dir = File::Spec->catfile(@path);
@@ -126,7 +126,7 @@ sub setup_subsubcommand($$$$)
"${cmd_prefix}->new(\$self, '$cmd_name'); 1";
if (eval $new_cmd) {
# Add to hash of commands, and list of subcmds
- $self->{subcmds}->{$cmd_name} = $cmd_obj;
+ $self->{subcmds}{$cmd_name} = $cmd_obj;
$self->add($cmd_obj, $cmd_name);
} else {
my $proc = $parent->{proc};
@@ -142,7 +142,7 @@ sub lookup($$;$)
my ($self, $subcmd_prefix, $use_regexp) = @_;
$use_regexp = 0 if scalar @_ < 3;
my $compare;
- if (!$self->{proc}->{settings}->{abbrev}) {
+ if (!$self->{proc}{settings}{abbrev}) {
$compare = sub($) { my $name = shift; $name eq $subcmd_prefix};
} elsif ($use_regexp) {
$compare = sub($) { my $name = shift; $name =~ /^${subcmd_prefix}/};
@@ -243,7 +243,7 @@ sub help($$)
} else {
@help_text = ("Subcommands of \"$name\" matching /^#{$subcmd_name}/:");
my @sort_matches = sort @matches;
- push @help_text, $self->{parent}->{cmd}->columnize_commands(\@sort_matches);
+ push @help_text, $self->{parent}{cmd}->columnize_commands(\@sort_matches);
return @help_text;
}
}
Oops, something went wrong.

0 comments on commit 9597cfe

Please sign in to comment.