By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

To port our C++ Solaris 9, Studio 8 application to HP-UNIX 11i aCC environment

P: 2
Dear Friends,

I need some help regarding to port our C++ Solaris 9, Studio 8 application to HP-UNIX 11i aCC environment.

Our same code in Solaris, after porting to HP-UNIX, exiting by the SIGBUS signal at some strange point, at the line, where we are doing "memset" of one of our 'big' structure (local variable, 74120 Bytes)

--------------------------------------
Program received signal SIGBUS, Bus error
si_code: 0 - BUS_UNKNOWN - Unknown Error.
[Switching to thread 3 (system thread 6992034)]
0x77f021f8 in <unknown_procedure> + 0xc0 () from /usr/lib/libc.2
(gdb) bt
#0 0x77f021f8 in <unknown_procedure> + 0xc0 () from /usr/lib/libc.2
#1 0x1664d0 in DIA_UTIL::_memset (s=0x77231248, c=0, n=74120)
at AAAOSWrapper.cpp:28
#2 0x104b44 in AAADiaMsgHandler::handleDiameterMessage (this=0x401b0128,
buffer=0x77230168 "\001", len=260, fd=14) at AAADiaMsgHandler.cpp:83
#3 0x628dc in AAAIfHandler::serviceRequest (this=0x40065668,
buffer=0x77230168 "\001", len=260, fd=14) at AAAIfHandler.cpp:704
#4 0x14746c in AAAThreadService::runThread (this=0x4008a0d8, inIndex=0)
--------------------------------------

Another thing we observed is that, HP gdb can not find any "code instruction" in the binary, at the line where we declared our variable, which was giving BUS error at 'memset'.
------------------------------------------------------------------------------- ---------
bash-2.03$ gdb dfn
HP gdb 5.4.0 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.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) break AAADiaMsgHandler.cpp:82
warning: Line 82 in file "AAADiaMsgHandler.cpp" does not have instructions. Plac
ing breakpoint on the next available source line.
Breakpoint 1 at 0x104b2c: file AAADiaMsgHandler.cpp, line 83 from ./obj/dfn.
------------------------------------------------------------------------------- ---------

We use the following procedure regarding Solaris to HPU porting.
1) Since we use POSIX system call, so do not face to change system API, apart from some SOCKET api signature like 'accept'.
2) compile option: aCC -g -v -DHP_UX -AA -z -ext +u1 -mt
3) link option: -lpthread -lrt -lm -lnsl

HPU Version: HP-UX telco03 B.11.23 U 9000/800 908196403 unlimited-user license
aCC Version: aCC: HP ANSI C++ B3910B A.03.70

If anyone can help me in this problem, I will be very helpful.

Thanks in advance,
Regards,
Nilanjan
Aug 11 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 10K+
P: 11,448
A bus error is caused by trying to access a mis aligned data type (e.g. ints should
be aligned at 4 byte boundaries etc.) I don't know what aCC's flags are doing there.
Does any of them have to do with alignment of structs or similar? Is there some
'struct packing' flag active?

kind regards,

Jos
Aug 11 '07 #2

P: 2
A bus error is caused by trying to access a mis aligned data type (e.g. ints should
be aligned at 4 byte boundaries etc.) I don't know what aCC's flags are doing there.
Does any of them have to do with alignment of structs or similar? Is there some
'struct packing' flag active?

kind regards,

Jos
Hello Jos,
Thank you for reply. We found the root cause of the problem. In HP-UNIX thread stack size by default is very small (64K), compared with other OS like linux (10MB). So our big structure was overflowing the smaller thread stack on HP-UX and causing the issue. After setting some big value with pthread_attr_setstacksize(), it is working :-)

Regards,
Nilanjan
Aug 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.