|
Home > Archive > Unix Programming > March 2004 > segmentation fault on solaris
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
segmentation fault on solaris
|
|
| Tejas Kokje 2004-03-21, 7:34 pm |
| Hi,
I am porting code from Linux to Solaris. The code works perfectly on
Linux, but i am getting segmentation fault for the same code on Solaris.
The code involves socket programming. Can some body tell me possible
causes of segmentation fault error.
Regards,
Tejas
| |
| Paul Pluzhnikov 2004-03-21, 8:34 pm |
| Tejas Kokje <kokje@usc.edu> writes:
> Can some body tell me possible causes of segmentation fault error.
The most likely cause of SIGSEGV is a bug in the program you are
porting.
Since you didn't provide any details of *where* your progam dies,
it is impossible to give you any specific help.
Run your program under debugger, see where it dies, look at the
state of variables at the time of the crash. If the cause is still
a mystery to you, reduce your program to the smallest possible
test case that still dies in the same way. Post it here, and the
bug will be revealed.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
| |
| joe@invalid.address 2004-03-21, 8:34 pm |
| Tejas Kokje <kokje@usc.edu> writes:
> I am porting code from Linux to Solaris. The code works perfectly on
> Linux, but i am getting segmentation fault for the same code on
> Solaris. The code involves socket programming. Can some body tell
> me possible causes of segmentation fault error.
Possible causes of segmentation faults are invalid pointers, buffer
overflows, unterminated strings, et al. There's no way to tell from
the description you've given.
However, Solaris (depending on the version, which you also didn't
give) has memory debugging facilities available at runtime. see the
watchmalloc(3MALLOC) man page. If you use the LD_PRELOAD and
MALLOC_DEBUG macros it will check memory accesses for you. This will
slow down execution time, but probably speed up debugging time :-)
Joe
--
Don't worry, be happy
- Bobby McFerrin
|
|
|
|
|