- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: SYS$GOTO_UNWIND access violation
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2007 01:08 AM
10-29-2007 01:08 AM
SYS$GOTO_UNWIND access violation
I would like to get your help to the following (Open VMS/C++)
This is regarding SYS$GOTO_UNWIND access violation.
I am calling Pascal functions (ufl_facility_00) which further few other Pascal functions. These Pascal functions in turn calls back a C++ function that has the SYS$GOTO_UNWIND command, depending on certain conditions. I wanted to unwind to the statement after the first Pascal function (ufl_facility_00) was called. This works fine (as expected) in debug but a normal image causes an access violation in the call SYS$GOTO_UNWIND.
Further, more strangely, the unwind call works fine in non-debug image, when a "cout... â Statement is introduced just above the call.
Can you please throw some idea on why a "cout" statement prevents the crash?
Is there any better approach for this?
Code
// Get the invocation handle so that we can subsequently execute a
// SYS$GOTO_UNWIND to get back to this point.
#ifdef _PLATFORM_ALPHA
cout << " before unwindhandle routines...." << endl;
retStatus = lib$get_curr_invo_context (&unwindIcb);
unwindHandle = lib$get_invo_handle (&unwindIcb);
#endif
⠦⠦.
cout << " now just before ufl_facility_00 " << endl;
retStatus = ufl_facility_00(number, eNo);
⠦⠦⠦⠦
Now UFL_FACILITY_00 will call some Pascal routines for display and get values from the fields. And once the field values are input, depending upon the value, this calls UFC_FACILITY_EXIT() - which calls FACILITY_EXIT().It is in this FACILITY_EXIT(), SYS$GOTO_UNWIND() statement is present as
⠦⠦.
curFrame = ourFrameMgr.getFrame(newFid);
#ifdef _PLATFORM_ALPHA
cout << "About to execute sys$goto_unwind" << endl; //If this statement is removed, and image if normal, then the below call will access violates.
// however, debug image seems to work fine without this statement.
rc = sys$goto_unwind(&unwindHandle, 0, 0, 0);
#endif
// There will not be a return to this point unless the sys$goto_unwind call
// fails.
FILE_LOG (logERROR) << "Sess: " << number << " Invalid status " << rc << "from sys$goto_unwind";
exit (EXIT_FAILURE);
}
Thanks and Regards
Sethu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2007 03:05 AM
10-29-2007 03:05 AM
Re: SYS$GOTO_UNWIND access violation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2007 08:59 AM
10-29-2007 08:59 AM
Re: SYS$GOTO_UNWIND access violation
GOTO_UNWIND is a big, very ugly hammer to solve a fairly trivial problem. Fundamentally your code calling GOTO_UNWIND has to make numerous assumptions about where it's called from in order to unwind the right number of frames and not break stuff. My guess about why it behaves differently with or without debug or a cout, is the possible presence of additional call frames and/or condition handlers in the region of stack you're trying to unwind across. There are very few circumstances where GOTO_UNWIND is the best tool for the job, and even fewer (if any) where it's the only solution.
As I understand your problem description, you want to be able to call ufl_facility_00 and be somewhere in a call chain below that routine, when you want to just fold up and unwind, returning the the caller of ufl_facility_00. Yes? If that's the case then the simple and robust solution is to declare a condition handler in ufl_facility_00. You can then LIB$SIGNAL from anywhere below. The condition handler can then do anything you want, inuding unwinding to the caller. As John R has suggested, the off-the-shelf handler LIB$SIG_TO_RET. Here's an example of how you'd use it:
TYPE
Sigarr = ARRAY[0..9] OF INTEGER;
Mecharr = ARRAY[0..(SIZE(CHF2$TYPE)-4) DIV 4] OF INTEGER;
[EXTERNAL,ASYNCHRONOUS] FUNCTION LIB$SIG_TO_RET
(VAR Sigargs : Sigarr;
VAR Mechargs : Mecharr) : INTEGER;
EXTERN;
.
.
.
ESTABLISH (LIB$SIG_TO_RET);
etc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2007 07:20 PM
11-01-2007 07:20 PM
Re: SYS$GOTO_UNWIND access violation
Thanks very much for the response.
I did a code walk through and established LIB$SIG_TO_RET in the function and replaced SYS$GOTO_UNWIND by SYS$ UNWIND. It seems, this is working fine.
Thanks and Regards
Sethu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2007 07:23 PM
11-01-2007 07:23 PM
Re: SYS$GOTO_UNWIND access violation
Thanks to John Reagan and John Gillings for their help.