Operating System - HP-UX
1830350 Members
1823 Online
110001 Solutions
New Discussion

core dump on exceptional handling - TRY/CATCH

 
sathis kumar
Frequent Advisor

core dump on exceptional handling - TRY/CATCH


Hello,

We are currently working on migrating our application from HP-UX 11i to HP-UX 11V2. We were using DCE version 1.8 on 11i version and DCE 1.9 on our 11V2 server.

We recompiled our code and rebuilt our application. When we try to run our application, we get core dump error. While debugging using gdb, we found that it throws error when the code reaches 'TRY' exceptional handling. The same code works fine in 11i version.

Could you help us in resolving this issue? Kindly let us know whether any change has to be done in order to use the exceptional handling on 11V2/ DCE 1.9 version.

Thanks in advance for your help.

Regards,
Sathis Kumar.B
3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: core dump on exceptional handling - TRY/CATCH

I assume this is the same as:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1120577

What does the macro TRY, etc. expand to?
Perhaps you can single step though the macro to see where it fails?
sathis kumar
Frequent Advisor

Re: core dump on exceptional handling - TRY/CATCH

Below is a sample program we have tried it in HP-UX11i version and HP-UX11V2 version. It works fine in 11i but not in 11V2.

#define _PTHREADS_DRAFT4
#include
#include
/* prototyping of functions */
/* to allow type checks by */
/* the compiler */
#include "pthread_exc.h"
#include


void main()
{
int n;
char string[50];
/* strcpy(a,b) copies string b into a */
/* defined via the stdio.h header */
strcpy(string, "Hello World");

/* call own function */
n = n_char(string);
printf("Length of string = %d\n", n);
}

/* definition of local function n_char */
int n_char(char string[])
{
/* local variable in this function */
int n;
/* strlen(a) returns the length of */
/* string a */
/* defined via the string.h header */
TRY
printf("HAI \n");
CATCH_ALL
printf("CATCH_ALL \n");
ENDTRY
n = strlen(string);
if (n > 50)
printf("String is longer than 50 characters\n");

/* return the value of integer n */
return n;
}

In 11V2, the compilation goes through fine but not the execution. During execution, it throws 'core dump' error. While debugging, we observed that core occurs when TRY is called.

We would like to know, how to use the identifiers TRY/CATCH.. etc.. in 11V2 version? Please let me know if you need any other detail. FYI, the DCE version on 11V2 is 1.9.
Dennis Handly
Acclaimed Contributor

Re: core dump on exceptional handling - TRY/CATCH

I have no problems compiling and running your test case with these changes:
#define _PTHREADS_DRAFT4

libcma is NOT supported on 11.23, remove it.

You don't have a prototype for:
int n_char(char string[])

>void main()

The return type for main must be int.

>printf("HAI \n");
>printf("CATCH_ALL \n");

(You shouldn't have a space before the newline.)

I compiled your test case with:
$ cc -Ae itrc_dce.c -ldcecpkt