niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Not Unix » VMS » vmsperl
help needed for VMS debug on exception.
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
John E. Malmberg
*nix forums Guru Wannabe


Joined: 30 May 2005
Posts: 264

PostPosted: Fri Feb 03, 2006 2:59 am    Post subject: help needed for VMS debug on exception. Reply with quote

I am currently building a patch that allows Perl to enter the OpenVMS
debugger when an exception occurs, if the the logical name
PERL_EXCEPTION_DEBUG is present.

What I could use some help in creating a perl script that would cause an
exception to be signaled so that I can verify that it works.

Also, to fully take advantage of this feature, all compiles should
always be /DEBUG/OPTIMIZE on ALPHA and I64 for non-debug builds.

On ALPHA and I64, the link procedure should always be /DSF which will
create a debug symbol file (.DSF) external to the image. This .DSF file
can be used in case the distributed binary needs debugging, but keeps
the binary files small.

I do not know how to change the build procedure to take advantage of
this on the three platforms because of it's complexity.

-John
wb8tyw@qsl.net
Personal Opinion Only
Back to top
Craig A. Berry
*nix forums Guru Wannabe


Joined: 27 May 2005
Posts: 143

PostPosted: Sat Feb 04, 2006 7:28 pm    Post subject: Re: help needed for VMS debug on exception. Reply with quote

At 9:59 PM -0500 2/2/06, John E. Malmberg wrote:
Quote:
I am currently building a patch that allows Perl to enter the OpenVMS debugger when an exception occurs, if the the logical name PERL_EXCEPTION_DEBUG is present.

What I could use some help in creating a perl script that would cause an exception to be signaled so that I can verify that it works.

Not quite the question that you asked, but note that you can pop Perl
into the debugger by calling the dump() function from within Perl:

$ perl -e "dump();"

See the section on dump in perlvms.pod:

http://perldoc.perl.org/perlvms.html#dump

Just about anything that sets errno should generate an exception I
would think. How about opening a file that does not exist:

$ perl -e "open F, '<', 'nonexistentfile'; print $^E;"
%RMS-E-FNF, file not found


Quote:
Also, to fully take advantage of this feature, all compiles should always be /DEBUG/OPTIMIZE on ALPHA and I64 for non-debug builds.

On ALPHA and I64, the link procedure should always be /DSF which will create a debug symbol file (.DSF) external to the image. This .DSF file can be used in case the distributed binary needs debugging, but keeps the binary files small.

I do not know how to change the build procedure to take advantage of this on the three platforms because of it's complexity.

Hmm. I did not know about /DSF. Does the debugger automatically
find the .DSF files if they are in the same directory as the
executables? The main difficulty I see is that these files would
have to be installed, which would involve modifications to
installperl and to MakeMaker and Module::Build.

I would suggest that as a first cut we only implement the
PERL_EXCEPTION_DEBUG option for builds created with -Dusevmsdebug.
The debug symbols would already be in the executable in that case.
Then we can take on adding /DSF capabilities as a separate project.
--
________________________________________
Craig A. Berry
mailto:craigberry@mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
Back to top
John E. Malmberg
*nix forums Guru Wannabe


Joined: 30 May 2005
Posts: 264

PostPosted: Sat Feb 04, 2006 9:39 pm    Post subject: Re: help needed for VMS debug on exception. Reply with quote

Craig A. Berry wrote:
Quote:
At 9:59 PM -0500 2/2/06, John E. Malmberg wrote:

I am currently building a patch that allows Perl to enter the
OpenVMS debugger when an exception occurs, if the the logical name
PERL_EXCEPTION_DEBUG is present.

What I could use some help in creating a perl script that would
cause an exception to be signaled so that I can verify that it works.

Just about anything that sets errno should generate an exception I
would think. How about opening a file that does not exist:

$ perl -e "open F, '<', 'nonexistentfile'; print $^E;"
%RMS-E-FNF, file not found

That does not generate a "FATAL" exception.

By now you should have seen the patch that I wrote. What I am doing is
allowing the default perl fatal exception handler to optionally invoke
the VMS debugger just before the program exits.

This allows you to look at the state of the program where the exception
occurred with out running the program in debug.

Quote:
Also, to fully take advantage of this feature, all compiles should
always be /DEBUG/OPTIMIZE on ALPHA and I64 for non-debug builds.


On ALPHA and I64, the link procedure should always be /DSF which
will create a debug symbol file (.DSF) external to the image. This
.DSF file can be used in case the distributed binary needs debugging,
but keeps the binary files small.

I do not know how to change the build procedure to take advantage
of this on the three platforms because of it's complexity.

Hmm. I did not know about /DSF. Does the debugger automatically
find the .DSF files if they are in the same directory as the
executables?

I have not researched it fully, but I think that it has a number of
places that it will look for it by default, and uses a similar method
that the debugger uses to find the source files.

Quote:
The main difficulty I see is that these files would
have to be installed, which would involve modifications to
installperl and to MakeMaker and Module::Build.

Actually the DSF file would not get installed normally, just like the
source is not copied, but it should be kept with the build output files
in case it was needed. Yes, that is a packaging and documentation issue.

The big advantage of using the DSF file is that on ALPHA, you only need
to build a special debug/nooptimize version under rare circumstances as
there is a mode you can set in the debugger to make it step like in the
original code is written. (I do not remember how to set that mode at
the time I am typing this).

The /DEBUG flag on the linker controls if the debugger is invoked when
the image is started.

With IA64, I am told that it is currently not practical to debug
optimized binaries, and this feature is still being researched. But in
the case of this last chance handler, stepping through code is not a
practical option, so having the compile /debug/optimize and the link
with the DSF file would still work.

I am use to debugging optimized binaries on the VAX, but others may not
be. Unfortunately the VAX linker does not support putting the debug
symbol table in a separate file.

So I think there will always be a need for a /DEBUG/NOOPTIMIZE as a
build option, but at least on Alpha, it is possible to set up an
alternative.

Quote:
I would suggest that as a first cut we only implement the
PERL_EXCEPTION_DEBUG option for builds created with -Dusevmsdebug.
The debug symbols would already be in the executable in that case.
Then we can take on adding /DSF capabilities as a separate project.

With out the debug symbols in the image, the feature still has use as it
can be compared against the linker maps.

The patch I submitted is always built in on the versions of VMS that
implement the SS$_DEBUG symbol in ssdef.h.

-John
wb8tyw@qsl.net
Personal Opinion Only
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Tue Dec 02, 2008 7:07 pm | All times are GMT
navigation Forum index » Not Unix » VMS » vmsperl
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Help Needed. Removing a Folder Problem Kilicaslan Fatih python 4 Thu Jul 20, 2006 9:57 am
No new posts Win32::OLE and CAPICOM to find a certificate in certifica... dan2online Perl 0 Thu Jul 20, 2006 6:47 am
No new posts Win32::OLE and CAPICOM to find a certificate in certifica... dan2online modules 0 Thu Jul 20, 2006 6:44 am
No new posts On the coming demise of debug.mpsafevm and pmap_page_prot... Alan Cox Architecture 0 Wed Jul 19, 2006 7:11 pm
No new posts 2 Perl Software Engineers needed for great contract in NYC jessica.dwyer@scfoster.co Perl 2 Wed Jul 19, 2006 4:41 pm

Debt Help | Hipster Blog | Electricity Suppliers | Loans | Homes for Sale
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1593s ][ Queries: 16 (0.0703s) ][ GZIP on - Debug on ]