- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Getting core dump while dealing with TRY/CATCH exc...
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
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
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
05-02-2007 07:18 PM
05-02-2007 07:18 PM
Getting core dump while dealing with TRY/CATCH exceptions in HP-UX 11V2
Problem Description:
Getting core dump while dealing with TRY/CATCH exceptions in HP-UX 11V2.
Below is the sample test program to verify the TRY/CATCH exceptional handling calls.
#include
#include
/* prototyping of functions */
/* to allow type checks by */
/* the compiler */
#include
#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;
}
Compilation option given : cc -ldcekt test.c..
Though the compilation went fine, execution is failed with 'core dump' error.
:cc -ldcekt test.c
:a.out
Memory fault(coredump)
While debugging with gdb, found that it fails while calling 'TRY'. Below is the gdb output :
Program received signal SIGSEGV, Segmentation fault
si_code: 2 - SEGV_ACCERR - Invalid Permissions for object.
0x4000e40:0 in n_char () at test.c:35
35 TRY
Could you please let me know if compilation option needs to be changed to avoid getting 'core dump'?
Thanks in advance for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2007 05:07 PM - edited 10-02-2011 09:27 PM
05-03-2007 05:07 PM - edited 10-02-2011 09:27 PM
Re: Getting core dump while dealing with TRY/CATCH exceptions in HP-UX 11.23
Not that this is your direct problem:
char string[50];
This will only take a string of 49 bytes, plus the null character.
if (n > 50)
corruption has already occurred if the string is 50 bytes.
Program received signal SIGSEGV, Segmentation fault Invalid Permissions for object.
0x4000e40:0 in n_char () at test.c:35
35 TRY
You might want to preprocess this file so you can see what the TRY macro does. Compile with -E and save stdout.
>Could you please let me know if compilation option needs to be changed to avoid getting 'core dump'?
I don't know of any.