Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

C++ Exception Handling support on HP-UX PA RISC

 
Highlighted
New Member

C++ Exception Handling support on HP-UX PA RISC

We are having HP-UX OS Installed...

OS INFO:- HP-UX PA RISC B.11.11

We are trying a 64bit compilation of a C++ project on it using gcc 3.4.2 found in
pa64 directory (Specific for 64bit compilation)
and a 64bit ld linker.

We found that C++ Exception Handling is not properly handled and has issues with stack unwinding. At runtime the code crashes (may/may not) when an exception is thrown....

Is there a patch available.... is there any
solution to overcome this problem without
removing exceptions from our code
7 REPLIES 7
Highlighted
Honored Contributor

Re: C++ Exception Handling support on HP-UX PA RISC

Hi Prajwal,

a better place to ask those questions is HP's Dev Resource Center:
http://devresource.hp.com/drc/index.jsp

There you can get current releases of gcc/g++ and answers...

FWIW,
Wodisch
Highlighted
Valued Contributor

Re: C++ Exception Handling support on HP-UX PA RISC

Do you have a small test case that can show the problem? That would help. Also, 3.4.3 is available from http://www.hp.com/go/gcc if you wanted to try that. 4.0 has been released by FSF and should be available in a couple of weeks. If you had a test case I could try it on 4.0 and see if it is fixed there.
Highlighted
New Member

Re: C++ Exception Handling support on HP-UX PA RISC

In Some HPlink I read these kind of problems
come in large dynamically linked excutables.

I tried to simulate the problem in a small
test program, but I didn't face any such
problems.

Any how the scenario is something similar to
this:

void x()
{
...
..
char arr[8096];//huge stack allocation
/* probs come also for huge dynamic alloc*/
..
..

try
{
...
}
catch(CMyExcep e)
{
fprintf(stderr, "%s", arr) ;
}
...
}

Here, whenever a exception is caught, it
was resulting in SIGSEGV.....

Solution / roundabout we found for this:-

void x()
{
....
try
{
...
}
catch(CMyExcep e)
{
char arr[8096] ;
fprintf(stderr, "%s", arr) ;
}
..
}
...... >>>> this worked
Highlighted
Honored Contributor

Re: C++ Exception Handling support on HP-UX PA RISC

It may be obvious, or stupid of me, but are you quite sure that your array arr is properly string terminated before you try to output it?

I would be tempted to do something like:

arr[8191]='\0' ;

just before the fprintf to be sure that fprintf doesn't work its way through the entire quadrant until it SEGVs.

Or does it SEGV somewhere else?




Highlighted
Honored Contributor

Re: C++ Exception Handling support on HP-UX PA RISC

Sorry - should have said arr[8095] (one less than the size of the array. I couldn't see your previous post when I replied and guessed at 8kb.


Highlighted
Honored Contributor

Re: C++ Exception Handling support on HP-UX PA RISC

In your posted example code, you've changed the scope of arr between the code sample that core dumped and the code sample you say is OK. Are you sure of the scope of arr in your core-dumping code?
Highlighted
New Member

Re: C++ Exception Handling support on HP-UX PA RISC


1) The array is 100% null terminated ('\0')
The very use of that array, either in
fprintf/memcpy or any other access to
the element of that array causes SIGSEGV.

2) I'm sure about the array access scope.
The scenario that is posted by me in
the form a simple example is correct.