1 *** ../../../lib/perldb.pl Mon Nov 11 10:40:22 1991
2 --- perldb.pl Mon May 18 17:00:56 1992
7 ! # modified Perl debugger, to be run from Emacs in perldb-mode
8 ! # Ray Lischner (uunet!mntgfx!lisch) as of 5 Nov 1990
9 ! # Johan Vromans -- upgrade to 4.0 pl 10
11 ! $header = '$RCSfile: perldb.diff,v $$Revision: 4.0.1.1 $$Date: 92/06/08 11:50:28 $';
13 # This file is automatically included if you do perl -d.
14 # It's probably not useful to include this yourself.
18 ! $header = '$RCSfile: perldb.diff,v $$Revision: 4.0.1.1 $$Date: 92/06/08 11:50:28 $';
20 # This file is automatically included if you do perl -d.
21 # It's probably not useful to include this yourself.
24 # have a breakpoint. It also inserts a do 'perldb.pl' before the first line.
26 # $Log: perldb.diff,v $
27 # Revision 4.0.1.1 92/06/08 11:50:28 lwall
30 - # Revision 4.0.1.2 91/11/05 17:55:58 lwall
31 - # patch11: perldb.pl modified to run within emacs in perldb-mode
33 # Revision 4.0.1.1 91/06/07 11:17:44 lwall
34 # patch4: added $^P variable to control calling of perldb routines
35 # patch4: debugger sometimes listed wrong number of lines for a statement
42 ! open(IN, "</dev/tty") || open(IN, "<&STDIN"); # so we don't dingle stdin
43 ! open(OUT,">/dev/tty") || open(OUT, ">&STDOUT"); # so we don't dongle stdout
51 ! open(IN, "</dev/console") || open(IN, "<&STDIN"); # so we don't dingle stdin
52 ! open(OUT,">/dev/console") || open(OUT, ">&STDOUT"); # so we don't dongle stdout
58 $| = 1; # for real STDOUT
61 - # Is Perl being run from Emacs?
62 - $emacs = $main'ARGV[$[] eq '-emacs';
63 - shift(@main'ARGV) if $emacs;
65 $header =~ s/.Header: ([^,]+),v(\s+\S+\s+\S+).*$/$1$2/;
66 ! print OUT "\nLoading DB routines from $header\n";
67 ! print OUT ("Emacs support ",
68 ! $emacs ? "enabled" : "available",
70 ! print OUT "\nEnter h for help.\n\n";
75 $| = 1; # for real STDOUT
78 $header =~ s/.Header: ([^,]+),v(\s+\S+\s+\S+).*$/$1$2/;
79 ! print OUT "\nLoading DB routines from $header\n\nEnter h for help.\n\n";
87 if ($single || $trace || $signal) {
89 ! print OUT "\032\032$filename:$line:0\n";
91 ! print OUT "$package'" unless $sub =~ /'/;
92 ! print OUT "$sub($filename:$line):\t",$dbline[$line];
93 ! for ($i = $line + 1; $i <= $max && $dbline[$i] == 0; ++$i) {
94 ! last if $dbline[$i] =~ /^\s*(}|#|\n)/;
95 ! print OUT "$sub($filename:$i):\t",$dbline[$i];
99 $evalarg = $action, &eval if $action;
103 if ($single || $trace || $signal) {
104 ! print OUT "$package'" unless $sub =~ /'/;
105 ! print OUT "$sub($filename:$line):\t",$dbline[$line];
106 ! for ($i = $line + 1; $i <= $max && $dbline[$i] == 0; ++$i) {
107 ! last if $dbline[$i] =~ /^\s*(;|}|#|\n)/;
108 ! print OUT "$sub($filename:$i):\t",$dbline[$i];
111 $evalarg = $action, &eval if $action;
115 $i = $line if $i eq '.';
118 ! print OUT "\032\032$filename:$i:0\n";
121 ! for (; $i <= $end; $i++) {
122 ! print OUT "$i:\t", $dbline[$i];
126 $start = $i; # remember in case they want more
127 $start = $max if $start > $max;
130 $i = $line if $i eq '.';
132 ! for (; $i <= $end; $i++) {
133 ! print OUT "$i:\t", $dbline[$i];
136 $start = $i; # remember in case they want more
137 $start = $max if $start > $max;
140 $start = 1 if ($start > $max);
141 last if ($start == $end);
142 if ($dbline[$start] =~ m'."\n$pat\n".'i) {
144 ! print OUT "\032\032$filename:$start:0\n";
146 ! print OUT "$start:\t", $dbline[$start], "\n";
152 $start = 1 if ($start > $max);
153 last if ($start == $end);
154 if ($dbline[$start] =~ m'."\n$pat\n".'i) {
155 ! print OUT "$start:\t", $dbline[$start], "\n";
161 $start = $max if ($start <= 0);
162 last if ($start == $end);
163 if ($dbline[$start] =~ m'."\n$pat\n".'i) {
165 ! print OUT "\032\032$filename:$start:0\n";
167 ! print OUT "$start:\t", $dbline[$start], "\n";
173 $start = $max if ($start <= 0);
174 last if ($start == $end);
175 if ($dbline[$start] =~ m'."\n$pat\n".'i) {
176 ! print OUT "$start:\t", $dbline[$start], "\n";