Operating System - HP-UX
1748019 Members
4763 Online
108757 Solutions
New Discussion юеВ

Re: 64-bit program segmentation fault on HP-UX PA RISC

 
SachinT
New Member

64-bit program segmentation fault on HP-UX PA RISC

Hello.

I am using 3 HP-UX PA RISC machines for testing. My binary is failing on one PA RISC machine where as others it working. Note that, even though binary is executed with version check i.e. it just print version and exit and don't perform any other operation , still binary is giving segmentation fault. what could be probable reason for Segmentation fault. It is important to me to find out root cause of the failure on one box. As program is working on 2 HP-UX, it seems that it is environment issue?

I tried to copy same peace of code (i.e. declare variables, print version and exit) in test program and build with same compilation options but it is working. Here is gdb output for the program.

Here is gdb results:

$ gdb prg_us
Detected 64-bit executable.
Invoking /opt/langtools/bin/gdb64.
HP gdb 5.4.0 for PA-RISC 2.0 (wide), HP-UX 11.00
and target hppa2.0w-hp-hpux11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.4.0 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) b 5573
Breakpoint 1 at 0x4000000000259e04: file pmgreader.c, line 5573 from /tmp/test/prg_us.
(gdb) r -v
Starting program: /tmp/test/prg_us -v

Breakpoint 1, main (argc=2, argv=0x800003ffbfff05f8) at pmgreader.c:5573
5573 if (argc >=2 && strcmp (argv[1], "-v") == 0)
Current language: auto; currently c++
(gdb) n
5575 printf ("%s", VER);
(gdb) n
5576 exit(0);
(gdb) n

Program received signal SIGSEGV, Segmentation fault
si_code: 0 - SEGV_UNKNOWN - Unknown Error.
0x800003ffbfb9e130 in real_free+0x480 () from /lib/pa20_64/libc.2
(gdb)

What should be probable cause? why it is working on one and not on another?
6 REPLIES 6
RickT_1
Valued Contributor

Re: 64-bit program segmentation fault on HP-UX PA RISC

Hello Sachin,

Have you checked to make sure that the server with the error is running a 64bit OS?

Rick
Viktor Balogh
Honored Contributor

Re: 64-bit program segmentation fault on HP-UX PA RISC

what is the output of

# getconf KERNEL_BITS
# getconf HW_CPU_SUPP_BITS

?

****
Unix operates with beer.
Dennis Handly
Acclaimed Contributor

Re: 64-bit program segmentation fault on HP-UX PA RISC

0x800003ffbfb9e130 in real_free+0x480 /lib/pa20_64/libc.2
>What should be probable cause?

A stack trace would be helpful here.
This indicates heap corruption. Is this a C++ application?

>RickT: Have you checked to make sure that the server with the error is running a 64bit OS?
>Viktor: what is the output of getconf KERNEL_BITS

Why would you waste time doing this? Almost all recent 11.11 systems should support 64 bit. And you get a different error.
SachinT
New Member

Re: 64-bit program segmentation fault on HP-UX PA RISC

@RickT : It is 64 bit OS

@Viktor : getconf return 64 for both commands.

@Dennis: It is a C++ application. I though of memory corruption, but looking at code, but it just printing version when called with -v option, it print version and exit.
secondly, no memory allocated in between and no array has been defined.
Dennis Handly
Acclaimed Contributor

Re: 64-bit program segmentation fault on HP-UX PA RISC

>It is a C++ application.
>no memory allocated in between and no array has been defined.

These can be contradictory. I.e a C++ static initializer can allocate and corrupt memory before main is called.

Try changing your main to just return.
Or change your printf so it doesn't allocate a buffer:
fprintf(stderr, "%s", VER);
Dennis Handly
Acclaimed Contributor

Re: 64-bit program segmentation fault on HP-UX PA RISC

Does VER have a newline on the end?