Operating System - HP-UX
1752412 Members
5716 Online
108788 Solutions
New Discussion юеВ

Re: Crash seen from c++ runtime exception handling code

 
Dennis Handly
Acclaimed Contributor

Re: Crash seen from c++ runtime exception handling code

The latest libcl patch for 11.31:
http://www.itrc.hp.com/service/patch/patchDetail.do?patchid=PHSS_40804

>ME: You can reopen stderr just before those calls to U_STACK_TRACE and throw so you can get that output.

Here is an example function that you can reuse parts.
#include
#include
extern void U_STACK_TRACE(void);
void redirect_stack_trace(FILE *filest) {
int fd, fd2, err;
fd = fileno(filest);
fflush(filest);
fflush(stderr);
fd2 = dup(STDERR_FILENO);
err = dup2(fd, STDERR_FILENO);
U_STACK_TRACE();
// Restore; not needed here
fflush(stderr);
fd = dup2(fd2, STDERR_FILENO);
close(fd2);
}

You only need to do this the first time. And you wouldn't want to restore it since you want those throw errors on stderr.
Dennis Handly
Acclaimed Contributor

Re: Crash seen from c++ runtime exception handling code

If you are optimizing and using EH you can NOT use +Oentrysched.
Rohitash Panda
New Member

Re: Crash seen from c++ runtime exception handling code

We don't have a terminate handler set , so it uses the default provider in the C++ runtime which aborts the message .

The gdb command 'catch throw' won't work on this platform , and yes I have recompiled debug the relevant files and also changed the attributes on the executable for setting a breakpoint on a shared library :
chatr +dbg enable

__throw__FPvT1 ( __throw(void *,void *) ) is just the runtime throw function and not the one . I want the glue exception handler that sets up the stuff for the catch exception and the unwind.

From the below stack :
TxsOqRenameConflictChecker::throwException TxsOqRenameConflictChecker::checkForConflicts
TxsOqIDRegenerator::regenerateIDs
TxsOqMetadataContext::getModifiedObjects
TxsOqPersistentMetadataContext::commitChild
TxsOqMetadataContext::commit
TxsOqDefinitionManager::commitRootTransaction


Yes this is the one and only throw which aborts . I did a continue and it just crashed after that without hitting it again.

The patches might not be latest , but I don't think thats an option . And yes this is the right stack , I had not listed the function earlier .

Also yes , we are optimizing and using EH , but we still use the flag '+Oentrysched' during compilation . EH works for most of the cases , just that its failing in this particular case .

Thanks for your time and patience .
Dennis Handly
Acclaimed Contributor

Re: Crash seen from c++ runtime exception handling code

>I want the glue exception handler that sets up the stuff for the catch exception and the unwind.

The first thing ThrowException does is try to unwind to find the handler. This is failing.
I don't know what you think a glue exception handler will do?

>we are optimizing and using EH, but we still use the flag '+Oentrysched' during compilation. EH works for most of the cases, just that it's failing in this particular case.

As documented, if you want EH to work correctly in all cases, you must NOT use +Oentrysched.