This patch allows the Perl user to set a logical name
PERL_EXCEPTION_DEBUG that causes Perl to invoke the VMS debugger before
having the default fatal exception handler in Perl cause a fatal exit.
The two files when renamed to being .com and .ini allow a test to be
done with that feature. I am not sure how to integrate these into the
vmsish.t test environment.
This feature was needed to debug a problem where an access violation was
being signaled when a Perl test script was run normally, but not when
the failing Perl was run starting in debug.
-John
[EMAIL PROTECTED]
Personal Opinion Only
$!
$mypid = %x'f$getjpi("","PID")'
$old_message = f$environment("MESSAGE")
$!
$set message/nofacility/noidentity/noseverity/notext
$!
$define/user PERL_EXCEPTION_DEBUG ENABLE
$define/user DBG$DECW$DISPLAY " " ! Disable decwindows
$define/user DBG$INIT VMSPERL_DEBUG.INI
$define/user DBG$INPUT NL:
$!
$mcr []ndbgperl "-e" "kill 1, ''mypid'";
$set message'old_message'
$!
spawn write sys$error "ok 1"
--- /rsync_root/perl/vms/vms.c Mon Jan 30 23:40:08 2006
+++ vms/vms.c Sat Feb 4 15:27:32 2006
@@ -250,6 +250,8 @@
int decc_bug_fgetname = 0;
int decc_dir_barename = 0;
+static int vms_debug_on_exception = 0;
+
/* Is this a UNIX file specification?
* No longer a simple check with EFS file specs
* For now, not a full check, but need to
@@ -1660,8 +1662,8 @@
#define _MY_SIG_MAX 17
-unsigned int
-Perl_sig_to_vmscondition(int sig)
+static unsigned int
+Perl_sig_to_vmscondition_int(int sig)
{
static unsigned int sig_code[_MY_SIG_MAX+1] =
{
@@ -1703,6 +1705,17 @@
return sig_code[sig];
}
+unsigned int
+Perl_sig_to_vmscondition(int sig)
+{
+#ifdef SS$_DEBUG
+ if (vms_debug_on_exception != 0)
+ lib$signal(SS$_DEBUG);
+#endif
+ return Perl_sig_to_vmscondition_int(sig);
+}
+
+
int
Perl_my_kill(int pid, int sig)
{
@@ -1738,7 +1751,7 @@
return -1;
}
- code = Perl_sig_to_vmscondition(sig);
+ code = Perl_sig_to_vmscondition_int(sig);
if (!code) {
SETERRNO(EINVAL, SS$_BADPARAM);
@@ -10865,6 +10878,17 @@
unsigned long case_perm;
unsigned long case_image;
#endif
+
+ /* Allow an exception to bring Perl into the VMS debugger */
+ vms_debug_on_exception = 0;
+ status = sys_trnlnm("PERL_EXCEPTION_DEBUG", val_str, sizeof(val_str));
+ if ($VMS_STATUS_SUCCESS(status)) {
+ if ((val_str[0] == 'E') || (val_str[0] == '1') || (val_str[0] == 'T'))
+ vms_debug_on_exception = 1;
+ else
+ vms_debug_on_exception = 0;
+ }
+
/* hacks to see if known bugs are still present for testing */
--- /rsync_root/perl/vms/perlvms.pod Wed Oct 26 05:27:48 2005
+++ vms/perlvms.pod Sat Feb 4 15:58:01 2006
@@ -367,6 +367,30 @@
except that the element separator is '|' instead of ':'. The
directory specifications may use either VMS or Unix syntax.
+=head1 PERL_EXCEPTION_DEBUG
+
+The PERL_EXCEPTION_DEBUG being defined as "ENABLE" will cause the VMS
+debugger to be invoked if a fatal exception that is not otherwised
+handled is raised. The purpose of this is to allow debugging of
+internal Perl problems that would cause such a problem.
+
+This allows the programmer to look at the execution stack and variables to
+find out the cause of the exception. As the debugger is being invoked as
+the Perl interpreter is about to do a fatal exit, continuing the execution
+in debug mode is usally not practical.
+
+Starting Perl in the VMS debugger may change the program execution
+profile in a way that such problems are not reproduced.
+
+The C<kill> function can be used to test this functionality from within
+a program.
+
+In typical VMS style, only the first letter of the value of this logical
+name is actually checked in a case insensitive mode, and it is considered
+enabled if it is the value "T","1" or "E".
+
+This logical name must be defined before Perl is started.
+
=head1 Command line
=head2 I/O redirection and backgrounding