Operating System - HP-UX
1753511 Members
5294 Online
108795 Solutions
New Discussion юеВ

Got Memory fault(coredump) on HPUX-PA 11.11

 
SOLVED
Go to solution
Srikrishna Erra
Advisor

Got Memory fault(coredump) on HPUX-PA 11.11

Hi all,
I got Memory fault(coredump) on HPUX-PA 11.11 during compilation.

Here is the log
pkgdata: /vob/hpux-pa/usr/bin/cc -g -O +DAportable +DS1.1 -D_REENTRANT -Ae +Olit=all -c -I/vob/icu/src/source/common -I../common +Z -o ./out/tmp/confusables_cfu.o ./out/tmp/confusables_cfu.c
cpp: warning 2021: Possibly incorrect message catalog.
/bin/sh: 2680 Memory fault(coredump)
gmake: *** [packagedata] Error 139


Stack trace shows
$ gdb ../bin/pkgdata -c core
HP gdb 5.2 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00
and target hppa1.1-hp-hpux11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.2 (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.
..
Core was generated by `pkgdata'.
Program terminated with signal 11, Segmentation fault.
Unknown si_code. Report to HP.
#0 0xc01f4098 in __fwrite_unlocked+0x220 () from /usr/lib/libc.2
(gdb) bt
#0 0xc01f4098 in __fwrite_unlocked+0x220 () from /usr/lib/libc.2
#1 0xc01f7d94 in __ldfcvt_r+0x3b1c () from /usr/lib/libc.2
#2 0x6b697470 in ()
#3 0xc01f7d94 in __ldfcvt_r+0x3b1c () from /usr/lib/libc.2
Cannot access memory at address 0x746d605b
(gdb) q


I had searched web and found similar issues but unfortunately didn't help.

Did anyone came accross/aware of this issues OR similar one?

BTW,
$ uname -a
HP-UX eshpx080 B.11.11 U 9000/800 1542770548 unlimited-user license
$ /vob/hpux-pa/opt/ansic/bin/cc -V
/usr/ccs/bin/ld: 92453-07 linker linker ld B.11.67 081202


Any help in this regards is appreciated.


Thanks

regards,
Srikrishna Erra.
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: Got Memory fault(coredump) on HPUX-PA 11.11

>I got Memory fault during compilation.
>../bin/pkgdata

No, you got it during building. The compiler isn't aborting, which program is this?

>$ /vob/hpux-pa/opt/ansic/bin/cc -V

The above option doesn't work on PA, unless you provide a .c file.
Use "what /vob/hpux-pa/opt/ansic/bin/cc"

Also, you might as well change +DS1.1 to +DS2.0.
Srikrishna Erra
Advisor

Re: Got Memory fault(coredump) on HPUX-PA 11.11

HI,

>>No, you got it during building. The compiler isn't aborting, which program is this?
pkgdata is an executable (generated from a cpp program). It prepares command to run based on the arguments passed to it. It has below code

printf("pkgdata: %s\n", cmd);
int result = system(cmd);
if (result != 0) {
printf("-- return status = %d\n", result);


>>Also, you might as well change +DS1.1 to +DS2.0.
I have changed it but no use.

pkgdata: /vob/hpux-pa/usr/bin/cc -g -O +DAportable +DS2.0 -D_REENTRANT -Ae +Olit=all -c -I/vob/icu/src/source/common -I../common +Z -o ./out/tmp/confusables_cfu.o ./out/tmp/confusables_cfu.c
[New process 9958]
Detaching after fork from process 9958
cpp: warning 2021: Possibly incorrect message catalog.

Program received signal SIGSEGV, Segmentation fault
si_code: 0 - SEGV_UNKNOWN - Unknown Error.
0x7aff2098 in __fwrite_unlocked+0x220 () from /usr/lib/libc.2
(gdb) where
#0 0x7aff2098 in __fwrite_unlocked+0x220 () from /usr/lib/libc.2
#1 0x7aff5d94 in __ldfcvt_r+0x3b1c () from /usr/lib/libc.2
#2 0x2e2f6f74 in ()
#3 0x7aff5d94 in __ldfcvt_r+0x3b1c () from /usr/lib/libc.2
Error accessing memory address 0x55534f9e: Bad address.
(gdb)


Thanks in advance.

Dennis Handly
Acclaimed Contributor
Solution

Re: Got Memory fault(coredump) on HPUX-PA 11.11

>pkgdata is an executable (generated from a cpp program). It prepares command to run based on the arguments passed to it. It has below code
printf("pkgdata: %s\n", cmd);
int result = system(cmd);
if (result != 0) {
printf("-- return status = %d\n", result);

There has to be more than this?
It seems to be executing the printf and system(3). You need to debug pkgdata and see if you can find a place where it is printing a long double: %Lf (call to _ldfcvt_r?)

What version of gdb do you have? Your stack trace seems to have problems and perhaps the latest will work better.
http://www.hp.com/go/wdb

>I have changed it but no use.

Of course. That was just to make it faster after you get it working. :-)
Srikrishna Erra
Advisor

Re: Got Memory fault(coredump) on HPUX-PA 11.11

Hi,

Sorry for late response.

I had resolved this issue. Issue was with the code. There was sprintf which resulted in coredump.

sprintf(cmd, "%s", command);

cmd is delcared as
#define SMALL_BUFFER_MAX_SIZE 512
char cmd[SMALL_BUFFER_MAX_SIZE];

but Length of command is 9094 bytes.
(gdb) p strlen(command)
$45 = 9094

This is creating the issue here and i got fixed the same.

Thanks for all your suggestions.


regadrs,
Srikrishna Erra.
Dennis Handly
Acclaimed Contributor

Re: Got Memory fault(coredump) on HPUX-PA 11.11

>There was sprintf which resulted in coredump.

Thanks for the details.

>sprintf(cmd, "%s", command);

If you could use snprintf you could range check the function. If your format is that simple, better to use strcpy or strncpy.