- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- App crashes(SIGSEGV, Segmentation fault) on HP-UX ...
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
03-27-2012 12:19 AM
03-27-2012 12:19 AM
App crashes(SIGSEGV, Segmentation fault) on HP-UX on introducing a new structure member
Hi All,
I am executing my own application which is built on HPUX Itanium platfrom with g++ compiler 3.4.4. The system deatiails are as follows:
#uname -a
HP-UX xy1600 B.11.23 U ia64 3100475210 unlimited-user license
This application contains a structure declaration in its C++ code. The structure declaration is as follows;
#define S_ID_LENGTH 32
#define L_MAX_LENGTH 2
#define C_TYPE_LENGTH 127
typedef struct {
char* pData;
const char* rDir;
const char* loc;
char sessionID[S_ID_LENGTH+1];
const char* URL;
char* args;
char* method;
const char* clientIP;
char localeType[L_MAX_LENGTH+1];
char contentType[C_TYPE_LENGTH+1];
char cacheControl[C_TYPE_LENGTH+1];
} RequestRec;
This successfully runs fine, but when i introduce a new structure member inside this structure declaration, the application crashes.
New structure after introducing the new variable:
typedef struct {
char* pData;
const char* rDir;
const char* loc;
char sessionID[S_ID_LENGTH+1];
const char* URL;
char* args;
char* method;
const char* clientIP;
char localeType[L_MAX_LENGTH+1];
char contentType[C_TYPE_LENGTH+1];
char cacheControl[C_TYPE_LENGTH+1];
char userName[MAX_CONTENT_TYPE_LENGTH+1]; /* Newly introduced member */
} RequestRec;
The back trace of the core dump is as follows:
Program received signal SIGSEGV, Segmentation fault
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
[Switching to thread 27 (system thread 3085163)]
warning: No unwind information found.
Skipping this library /lib/hpux64/libcl.so.1.
search ()
at ../../../../../core/libs/libc/shared_em_64/../core/gen/getcwd.c:589
589 ../../../../../core/libs/libc/shared_em_64/../core/gen/getcwd.c: No such file or directory.
in ../../../../../core/libs/libc/shared_em_64/../core/gen/getcwd.c
(gdb) bt
#0 search ()
at ../../../../../core/libs/libc/shared_em_64/../core/gen/getcwd.c:589
#1 0x9fffffffec05e7f0:0 in getcwd ()
at ../../../../../core/libs/libc/shared_em_64/../core/gen/getcwd.c:868
#2 0x40000000009d42d0:0 in fnplm::lmgrd::File::getCurrentDirectory()+0x40 ()
Eventhough i am not accessing the new variable anywhere in the code, just declaraing a new member inside the structure causes the application to crash. The same application works fine if i change the optimization level to Os and dynamically allocate the memory to new structure member(char * userName) instead of declaring inside the structure(as char userName[C_TYPE_LENGTH+1]) .
Can anybody tell me the reason for getting this crash, just by introducing a new variable inside the structure? How this works fine just by changing the Optimization level and dynamically allocating the memory to newly introduced member?
How can i introduce a new variable(character array) without changing the Optimization level?
NOTE: This behaviour is observed only on HP-UX Platfrom.
Thanks & Regards,
Vinay
- Tags:
- SIGSEGV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2012 01:19 AM
03-27-2012 01:19 AM
Re: App crashes(SIGSEGV, Segmentation fault) on HP-UX on introducing a new structure member
>when I introduce a new structure member inside this structure declaration, the application crashes.
If you change the size of a struct, you need to recompile/relink all objects that use that struct.
>Even though I am not accessing the new variable anywhere in the code,
That doesn't matter. You can't access the struct.
>How can I introduce a new variable(character array)
Have you tried cleaning and rebuilding everything?
>#1 0x9fffffffec05e7f0:0 in getcwd
What is being passed to getcwd(3)? Are the parms reasonable Anything related to that struct?
>warning: No unwind information found. Skipping this library /lib/hpux64/libcl.so.1.
Any reason you are linking against this empty shlib?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2012 02:12 AM
03-27-2012 02:12 AM
Re: App crashes(SIGSEGV, Segmentation fault) on HP-UX on introducing a new structure member
Yes. I cleaned and rebuilt everything.
I am not passing any parameter related to struct to getcwd(3).
How does changing the Optimization level to Os and dynamically allocating memory to the variable helps in solving the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2012 07:30 AM
03-27-2012 07:30 AM
Re: App crashes(SIGSEGV, Segmentation fault) on HP-UX on introducing a new structure member
>I am not passing any parameter related to struct to getcwd(3).
Are you passing a valid address and length?
>How does changing the optimization level and dynamically allocating memory to the variable help in solving the issue?
That probably doesn't solve the problem, it just hides it. Perhaps there is an uninitialized variable and the different code generated has a different value. Or the heap layout is now different.