Operating System - HP-UX
1837533 Members
3640 Online
110117 Solutions
New Discussion

Debug heap corruption in HP-UX

 
Manish_33
Advisor

Debug heap corruption in HP-UX

Hello friends,
I am trying to debug a program using gdb. which gives me SIGBUS error. My stack shows

#0 0x79f48b20 in _sigfillset+0x50 () from /usr/lib/libc.2
#1 0x79f46bbc in _sscanf+0x68c () from /usr/lib/libc.2
#2 0x79f4c294 in malloc+0x18c () from /usr/lib/libc.2
#3 0x79ca433c in rpc_ss_mem_alloc (handle=0x79b3e364, bytes=12)
.
.
.


Googling i found that this is due to heap corruption. However i am not able to find how to debug it.....any suggestions. Also the same code works perfectly fine on Linux. any suggestions. This is a recursive function and when it succeeds no linux the stack is around of depth 200+ but it crashes on HPUX at around 176. I have tried setting the stacksize same on both the platforms but no success. what could have gone wrong
Thanks in advance for any help or suggestions.
3 REPLIES 3
Arunvijai_4
Honored Contributor

Re: Debug heap corruption in HP-UX

HI Manish,

Perhaps, you can try running your program with "tusc",

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-7.8/

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Mark Greene_1
Honored Contributor

Re: Debug heap corruption in HP-UX

The stack and the heap are seperate memory structures, so stacksize isn't going to change this error.

What's on line 176? If it works on Linux but not HP-UX, it sounds like you have a library call that has a much larger header in HP-UX than its counterpart in Linux, and is exceeding the bounds of the heap.

mark
the future will be a lot like now, only later
Manish_33
Advisor

Re: Debug heap corruption in HP-UX

Hi Arun,
Thanks for giving me the clue to use tusc. Atleast now i know that i am hitting something while alligning data. The bottom portion of tusc shows something like

sigprocmask(0x79ebe540, NULL, 0x79ebe56c) ............................................................. = 0
sigprocmask(0x79eada48, NULL, 0x79eada74) ............................................................. = 0
brk(0x40060008) ....................................................................................... = 0
sigprocmask(0x79eae010, NULL, 0x79eae03c) ............................................................. = 0
brk(0x40061ff0) ....................................................................................... = 0
brk(0x40080000) ....................................................................................... = 0
Received signal 10, SIGBUS, in user mode, [SIG_DFL], partial siginfo
Siginfo: si_code: I_NONEXIST, faulting address: 0x79ece060, si_errno: 0
PC: 0xc0197b23, instruction: 0x6bd33fc1

Any suggestons. thanks in advance.
May be that there is something which is getting violated while alligning on HPUX but not on Linux