Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

SEGV_MAPERR in goto statement

SOLVED
Go to Solution

SEGV_MAPERR in goto statement

we are currently migrating our 32 bit application to HPUX ( HPUX v 11.31, ia64. )  using the following compiler version

$ aCC --version
aCC: HP C/aC++ B3910B A.06.27 [May 22 2012]

 

during program execution we are getting a SEGV_MAPERR from a goto statement ( generated by opencobol )


(gdb)

Breakpoint 4, HCASEMNT_ (entry=0, b_11402=0x60000000f1badbf8 "",
b_11462=0x2b49ff0 "HCASEMNT ", b_13505=0x13a1a50 "en")
at ../../../../obj/server/investigations/srv/cob/tmp/HCASEMNT.c:8091
8091 goto l_17516;
(gdb) info corruption
Analyzing heap ...

No blocks were found.

(gdb) show heap-check
Thread debugging commands is "string on".
Current heap check settings are :
Check leaks : on
Check bounds : on
Check free() : on
Check string : on
Scrambling : off
Frame count : 4
Min-leak-size : 0
Min-heap-size : 0
Block-size : 0
Header-size : 16
Footer-size : 1
Seed-value : 5
Random-range : 100
Null-check : -1
Null-check-size : -1
Heap-size : 0
Heap Interval : 0
Repeat Count : 100
High-mem Count : 0
Watch Address : 0x00000000
retain-freed-blocks : off
(gdb) p/x $save_sp=$sp
$1 = 0x60000000ffff2ca0
(gdb) frame 18
#18 0xd1d60:0 in main (argc=3, argv=0x60000000fffff1f0)
at ../../../../../../upload/source/MdStd/Server/coserver3/cosrvpsx.cpp:1707
1707 return theServer.Run();
Current language: auto; currently c++
(gdb) p $sp - $save_sp
$2 = 44272
(gdb)

(gdb) frame 0
#0 HCASEMNT_ (entry=0, b_11402=0x60000000f1badbf8 "",
b_11462=0x2b49ff0 "HCASEMNT ", b_13505=0x13a1a50 "en")
at ../../../../obj/server/investigations/srv/cob/tmp/HCASEMNT.c:8091
8091 goto l_17516;
Current language: auto; currently c
(gdb) s

Program received signal SIGSEGV, Segmentation fault
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
0x60000000dfccc710 in <unknown_procedure> ()

 

 

 

 

this shared library has been compiled and linked using the following commands:

/opt/aCC/bin/cc -DXP_UNIX -DAC_BIGENDIAN=1 -D_REENTRANT +DD32 -D_LARGEFILE64_SOURCE +u1 -Z -mt -g0 +O0 +O0 -c -o ../../../../obj/server/investigations/srv/cob/HCASEMNT.o ../../../../obj/server/investigations/srv/cob/tmp/HCASEMNT.c -I../../../../../../upload/source/Build/unix/cpp -I/coro/opt/oracle//instantclient_11_2/rdbms/public -I/coro/opt/oracle//instantclient_11_2/rdbms/demo -I/coro/opt/oracle//instantclient_11_2/sdk/include -I/coro/corodev/eu201001acc/include
/opt/aCC/bin/aCC -o HCASEMNT.so -L/coro/opt/oracle//instantclient_11_2/lib32/ -lclntsh +DD32 -AA -Wl,+s -Wl,+b/lib:/usr/lib:/opt/corona/lib:/coro/opt/oracle//instantclient_11_2/lib32:/coro/opt/oracle//instantclient_11_2/lib:/coro/opt/oracle//instantclient_11_2:/opt/aCC/lib -b ../obj/server/investigations/srv/cob/HCASEMNT.o ../obj/server/investigations/srv/map/HCASEMNT.o -L. -lricdb -L/coro/opt/oracle//instantclient_11_2/lib32/ -lclntsh -L. -lcob -lgmp -lltdl -lc

 

Thanks for any suggestions!

Regards

 

Guenter

7 REPLIES

Re: SEGV_MAPERR in goto statement

additional reg info and disassembly:


(gdb) info reg
pr0: 0x1
pr1: 0
pr2: 0
pr3: 0
pr4: 0
pr5: 0
pr6: 0x1
pr7: 0
pr8: 0x1
pr9: 0
pr10: 0
pr11: 0
pr12: 0
pr13: 0
pr14: 0x1
pr15: 0x1
pr16: 0
pr17: 0
pr18: 0
pr19: 0
pr20: 0
pr21: 0
pr22: 0
---Type <return> to continue, or q <return> to quit---
pr23: 0
pr24: 0
pr25: 0
pr26: 0
pr27: 0
pr28: 0
pr29: 0
pr30: 0
pr31: 0
pr32: 0
pr33: 0
pr34: 0
pr35: 0
pr36: 0
pr37: 0
pr38: 0
pr39: 0
pr40: 0
pr41: 0
pr42: 0
pr43: 0
pr44: 0
pr45: 0
---Type <return> to continue, or q <return> to quit---
pr46: 0
pr47: 0
pr48: 0
pr49: 0
pr50: 0
pr51: 0
pr52: 0
pr53: 0
pr54: 0
pr55: 0
pr56: 0
pr57: 0
pr58: 0
pr59: 0
pr60: 0
pr61: 0
pr62: 0
pr63: 0
gr0: 0
gr1: 0x60000000ded31a50
gr2: 0
gr3: 0x141
gr4: 0
---Type <return> to continue, or q <return> to quit---
gr5: 0xc000000000000408
gr6: 0x60000000f77723b0
gr7: 0x60000000f7722880
gr8: 0x60000000ffffae0f
gr9: 0
gr10: 0
gr11: 0
gr12: 0x60000000ffff2ca0
gr13: 0x60000000f01f8fe0
gr14: 0
gr15: 0x60000000f0945048
gr16: 0x60000000f0960230
gr17: 0xe0000000f0000000
gr18: 0
gr19: 0x1
gr20: 0xf01f8cc0
gr21: 0x60000000f01f9c44
gr22: 0x60000000f7696a54
gr23: 0
gr24: 0
gr25: 0x1f5f
gr26: 0x1
gr27: 0
---Type <return> to continue, or q <return> to quit---
gr28: 0x60000000ffff2bb1
gr29: 0x2b2fc67
gr30: 0xe0000000f0000fc8
gr31: 0xc000000000000491
gr32: 0
gr33: 0xf1badbf8
gr34: 0x2b2fc50
gr35: 0x13b7440
gr36: 0x60000000ded31a50
gr37: 0x60000000ffffb600
gr38: 0xc00000000000030a
gr39: 0x60000000dedb7630
gr40: 0x60000000ded23ec0
gr41: 0x60000000ded2cca0
gr42: 0x1b0
gr43: 0x60000000ffff2ca0
gr44: 0xc000000000000410
gr45: 0x60000000deeecd20
gr46: 0x60000000f0944be0
gr47: 0xded23ec0
br0: 0x60000000deeecd20
br1: 0x60000000f77503e0
br2: 0x60000000f77503e0
---Type <return> to continue, or q <return> to quit---
br3: 0x60000000f77503e0
br4: 0x60000000f77503e0
br5: 0x60000000f77503e0
br6: 0x60000000f0960230
br7: 0x60000000f1749080
rsc: 0x1f
bsp: 0x60000000f77ff608
bspst: 0x60000000f77ff688
rnat: 0
ccv: 0x100000000
unat: 0
fpsr: 0x9804c9e74433f
pfs: 0xc000000000000410
(sor:0, sol:8, sof:16)
lc: 0
ec: 0
ip: 0x60000000deeecf20:1
cfm: 0x410
(sor:0, sol:8, sof:16)
psr: 0x12130862e01a
(gdb)

======================================================================
(gdb) disas $pc-16*8 $pc+16*4
Dump of assembler code from 0x60000000deeecea0:0 to 0x60000000deeecf60:0:
;;; File: ../../../../obj/server/investigations/srv/cob/tmp/HCASEMNT.c
;;; 8090 frame_stack[frame_index].return_address = 0;
0x60000000deeecea0:0 <HCASEMNT_+0x135550>:
shladd ret0=ret0,3,r0 MI,I,
0x60000000deeecea0:1 <HCASEMNT_+0x135551>: nop.i 0x0;;
0x60000000deeecea0:2 <HCASEMNT_+0x135552>:
add ret0=ret0,ret1;;
0x60000000deeeceb0:0 <HCASEMNT_+0x135560>:
addp4 ret0=0,ret0 MI,I,
0x60000000deeeceb0:1 <HCASEMNT_+0x135561>: nop.i 0x0;;
0x60000000deeeceb0:2 <HCASEMNT_+0x135562>: mov ret1=0;;
0x60000000deeecec0:0 <HCASEMNT_+0x135570>:
adds ret0=4,ret0 MI,I,
0x60000000deeecec0:1 <HCASEMNT_+0x135571>: nop.i 0x0;;
0x60000000deeecec0:2 <HCASEMNT_+0x135572>:
extr.u ret2=ret1,24,8;;
0x60000000deeeced0:0 <HCASEMNT_+0x135580>:
st1 [ret0]=ret2 MI,I,
---Type <return> to continue, or q <return> to quit---
0x60000000deeeced0:1 <HCASEMNT_+0x135581>: nop.i 0x0;;
0x60000000deeeced0:2 <HCASEMNT_+0x135582>:
adds ret0=1,ret0;;
0x60000000deeecee0:0 <HCASEMNT_+0x135590>:
nop.m 0x0 MI,I
0x60000000deeecee0:1 <HCASEMNT_+0x135591>:
extr.u ret2=ret1,16,8;;
0x60000000deeecee0:2 <HCASEMNT_+0x135592>: nop.i 0x0
0x60000000deeecef0:0 <HCASEMNT_+0x1355a0>:
st1 [ret0]=ret2 MI,I,
0x60000000deeecef0:1 <HCASEMNT_+0x1355a1>: nop.i 0x0;;
0x60000000deeecef0:2 <HCASEMNT_+0x1355a2>:
adds ret0=1,ret0;;
0x60000000deeecf00:0 <HCASEMNT_+0x1355b0>:
nop.m 0x0 MI,I
0x60000000deeecf00:1 <HCASEMNT_+0x1355b1>:
extr.u ret2=ret1,8,8;;
0x60000000deeecf00:2 <HCASEMNT_+0x1355b2>: nop.i 0x0
0x60000000deeecf10:0 <HCASEMNT_+0x1355c0>:
st1 [ret0]=ret2 MI,---Type <return> to continue, or q <return> to quit---
I,
0x60000000deeecf10:1 <HCASEMNT_+0x1355c1>: nop.i 0x0;;
0x60000000deeecf10:2 <HCASEMNT_+0x1355c2>:
adds ret0=1,ret0;;
0x60000000deeecf20:0 <HCASEMNT_+0x1355d0>:
st1 [ret0]=ret1;; M,MI
;;; 8091 goto l_17516;
0x60000000deeecf20:1 <HCASEMNT_+0x1355d1>: nop.m 0x0
0x60000000deeecf20:2 <HCASEMNT_+0x1355d2>: nop.i 0x0
0x60000000deeecf30:0 <HCASEMNT_+0x1355e0>:
nop.m 0x0 MMB,
0x60000000deeecf30:1 <HCASEMNT_+0x1355e1>: nop.m 0x0
0x60000000deeecf30:2 <HCASEMNT_+0x1355e2>:
br.cond.dptk.many 0x60000000de9cc710;;
;;; 8093 frame_index--;
0x60000000deeecf40:0 <HCASEMNT_+0x1355f0>:
adds ret1=68,sp;; M,MI,
0x60000000deeecf40:1 <HCASEMNT_+0x1355f1>:
ld4 ret1=[ret1]
0x60000000deeecf40:2 <HCASEMNT_+0x1355f2>: nop.i 0x0;;
---Type <return> to continue, or q <return> to quit---
0x60000000deeecf50:0 <HCASEMNT_+0x135600>:
adds ret2=-1,ret1 MI,I,
0x60000000deeecf50:1 <HCASEMNT_+0x135601>: nop.i 0x0;;
0x60000000deeecf50:2 <HCASEMNT_+0x135602>:
adds ret1=68,sp;;
End of assembler dump.
(gdb)
(gdb) s

Program received signal SIGSEGV, Segmentation fault
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
0x60000000de9cc710 in <unknown_procedure> ()
(gdb)

Acclaimed Contributor Acclaimed Contributor

Re: SEGV_MAPERR in goto statement (COBOL)

[ Edited ]

It doesn't do much good to dump registers and machine code before the abort if you end up somewhere else.

You need to get a backtrace and dump at the abort.

You could use repeated "si" to see how it gets to the abort location.

Re: SEGV_MAPERR in goto statement

[ Edited ]

thanks, but the abort is caused by jumping to a bad address, so at that position, there is no machine code available. I will try "si" to see if I get more info...

Re: SEGV_MAPERR in goto statement

(gdb) si
0x60000000deedcf20:2 nop.i 0x0
8091 goto l_17516;
(gdb)
0x60000000deedcf30:0 nop.m 0x0 MMB,
8091 goto l_17516;
(gdb)
0x60000000deedcf30:1 nop.m 0x0
8091 goto l_17516;
(gdb)
0x60000000deedcf30:2 br.cond.dptk.many 0x60000000de9bc710;;
8091 goto l_17516;
(gdb)
0x60000000de9bc710 in <unknown_procedure> ()
(gdb) 

(gdb) disas $pc $pc+16
Dump of assembler code from 0x60000000de9bc710 to 0x60000000de9bc720:
0x60000000de9bc710: Error accessing memory address 0x60000000de9bc710: Bad address.
(gdb)

Highlighted
Acclaimed Contributor Acclaimed Contributor

Re: SEGV_MAPERR in goto statement (COBOL)

[ Edited ]

>but the abort is caused by jumping to a bad address

 

You need to mention or show that.

 

>0x60000000deedcf30:2 br.cond.dptk.many 0x60000000de9bc710;;

 

It looks like your foreign devil assembler is broken.

You are branching back before the beginning of the function:

0x60000000deeecf30:2 <HCASEMNT_+0x1355e2>: br.cond.dptk.many 0x60000000de9cc710;;

 

(gdb) p /x 0x60000000deeecf30 - 0x60000000de9cc710
$1 = 0x520820   Negative from PC
(gdb) p /x 0x60000000deeecf30 - 0x1355e2 - 0x60000000de9cc710
$2 = 0x3eb23e   Negative from the start of HCASEMNT_

Re: SEGV_MAPERR in goto statement (COBOL)

 

>It looks like your foreign devil assembler is broken.


I am almost sure that I have tested this functionality, when the application has been built using an older (trial) version of the compiler; we will try to switch back to this compiler version...

 

Thank you very much!

 

Guenter

Acclaimed Contributor Acclaimed Contributor

Re: SEGV_MAPERR in goto statement (COBOL)

>Thank you very much!

 

Any kudos to go with the solution?