vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi Platform : HPUX 11.23 Compiler : HP ANSI C++ B3910B A.03.37 (aCC) I have a C++ program which was giving an SIGBUS error due to unaligned memory access in my code. I got it solved by making a call to allow_unaligned_data_access() functions and linking the executable with -lhppa library. Now my executable is running fine. But I am facing the problem during debugging my code using gdb debugger. During debugging my code gives SIGBUS error at the same point where it was previously giving the SIGBUS error instead of the call to allow_unaligned_data_access() function. I am unable to identify the problem. Thanks for any suggestions. Manoj |
| |||
| Manoj Pattanaik wrote: : During debugging my code gives SIGBUS error at the same point where it : was previously giving the SIGBUS error instead of the call to : allow_unaligned_data_access() function. : I am unable to identify the problem. You need to pass signal 10 to the program and not stop: handle SIGBUS noprint nostop pass (Or you can continue after every misaligned trap. ;-) |
| |||
| "Manoj Pattanaik" <manoj.pattanaik@gmail.com> writes: > I have a C++ program which was giving an SIGBUS error due to unaligned > memory access in my code. I got it solved by making a call to > allow_unaligned_data_access() functions and linking the executable with > -lhppa library. Now my executable is running fine. If you get SIGBUS in debugger, your executable does not "run fine". If the code that generates SIGBUS is executed frequently, your exe is running horribly inefficiently, and you are patching over the problem with a hack. Couldn't you just fix the unaligned access in the first place? Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| ||||
| Paul Pluzhnikov wrote: : "Manoj Pattanaik" <manoj.pattanaik@gmail.com> writes: : > I have a C++ program which was giving an SIGBUS error due to unaligned : > memory access in my code. Now my executable is running fine. : If you get SIGBUS in debugger, your executable does not "run fine". If Manoj says it's "running fine" who are we to argue? ;-) Of course he could say "runs slow". : If the code that generates SIGBUS is executed frequently, your exe : is running horribly inefficiently, and you are patching over the : problem with a hack. Couldn't you just fix the unaligned access in : the first place? If the performance is a problem, here are some of the things you can do: http://docs.hp.com/en/7133/pragmas.htm#pragma-pack There is +u# that makes every access slower, whether aligned or not. There is the pack pragma that would only change certain structures. Unfortunately, if you pass the address of an unaligned member to another lib, like libc, you can only use allow_unaligned_data_access. Note on IPF, unaligned access is orders of magnitude faster because it is either handled directly by the hardware by the kernel without a user signal handler. |