Program terminated with signal 11, Segmentation fault. SEGV_MAPERR - Address not mapped to object

by Community Manager ‎05-18-2012 06:27 AM - edited ‎05-21-2012 09:09 AM

Question

We are currently doing platform migration from sun solaris  to HP-UX   B.11.31.

 

version:
HP-UX hva03ads B.11.31 U ia64 0291095592 unlimited-user license

 

compiler: 

Hewlett-Packard Company           - 41 -          HP C/aC++ Version A.06.25

  

On sun solaris unix it worked fine.  When I am executing on HP it showing coredump error.

 

When i am trying to debug corefiles with gdb  <binary filename>  <corefilename>

 

It shows the following warnings:

  

HP gdb 6.1 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3.
Copyright 1986 - 2009 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 6.1 (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 `ksopogmf'.
Program terminated with signal 11, Segmentation fault.
SEGV_MAPERR - Address not mapped to object

#0  0xc0000000003cb110:0 in free+0xb0 () from /usr/lib/hpux64/libc.so.1

  

(gdb) bt
#0  0xc0000000003cb110:0 in free+0xb0 () from /usr/lib/hpux64/libc.so.1
#1  0x40000000000a3870:0 in mon_free_data () at ./src/moniteur.c:298
#2  0x40000000000a31b0:0 in svc_generique () at ./src/moniteur_tuxedo.c:583
#3  0x40000000000219b0:0 in sopogmf_dlist () at ./src/ksopogmf.pc:617
#4  0xc0000000257dcb30:0 in _tmsvcdsp () at tmsvcdsp.c:547
#5  0xc000000025838e70:0 in _tmrunserver () at tmrunsvr.c:2121
#6  0xc0000000257d9d90:0 in _tmstartserver () at tmstrtsrvr.c:166
#7  0x4000000000011150:0 in main () at BS-6caa.c:82

 

 

(gdb) frame 0
#0  0xc0000000003cb110:0 in free+0xb0 () from /usr/lib/hpux64/libc.so.1
(gdb) set $sp_save = $sp
(gdb) # the frame # of main or __pthread_bound_body
(gdb) frame 13
No frame with frame# or frame_address 13
(gdb) p $sp - $sp_save
$1 = 0
(gdb)

Answer

This issue is raised due to  insuficiant allocation memory for a string.

 

ps_sc_nom_fic = (char *)malloc((strlen(ps_local)+strlen(ps_cs_ipn)+strlen(ps_type)+strlen(ps_num_jd)+strlen(ps_complement)+1)*sizeof(char));

 

After adding sufficient size, now it is working fine.