Solaris Unix Porting Question / Signals Question 
Author Message
 Solaris Unix Porting Question / Signals Question

I am doing a port of a software package from SCO unix to Solaris, and
I am having some trouble.  The software compiles OK, but when parts of
the program execute, I get a SIGBUS error (with a core dump of
course).

What can cause bus errors?

I would place a piece of code here, but it would be far out of
context.  The areas I get these errors always involve pointer
manipulation, usually calculating an address based on another address
and an offset.

I am doing this port remote over telnet, so I don't have access to the
hardware.  The SunOS is 5.5.1.  The compiler is gcc 2.7.2.

I have spent some time debugging this software with no success, using
gdb.

If you wish to reply via email, please remove the 000 portion of the
address.

Thanks in advance for any help.



Sun, 26 Sep 1999 03:00:00 GMT  
 Solaris Unix Porting Question / Signals Question



Quote:
>I am doing a port of a software package from SCO unix to Solaris, and
>I am having some trouble.  The software compiles OK, but when parts of
>the program execute, I get a SIGBUS error (with a core dump of
>course).

While at first glance this appars to be platform related (and of course
the exact behaviour you get is) your code may well have a simple C related
error. However I;ll just draw your attention to newsgroups such as
comp.unix.programmer, comp.unix.solaris and comp.unix.sco.programmer
for platform related issues.

Quote:
>What can cause bus errors?

It depends on the platform but one possible cause is misaligned memory
accesses.

Quote:
>I would place a piece of code here, but it would be far out of
>context.  The areas I get these errors always involve pointer
>manipulation, usually calculating an address based on another address
>and an offset.

That would be consistent. This sort of thing (misaligned memory access)
will occur in practical terms through misuse of pointers. The C language
requires that you access object at addresses consistent with the alignment
requirements of the type. So for instance the following:

int main(void)
{
    int a[2];
    char *p = (char *)a;

    p++;
    *(int *)p = 0;

    return *(int *)p;

Quote:
}

will work on systems where the alignment requirements for an int are
any byte boundary (and x86 based systems come into that category) but may
fail on systems that have stricter alignment requirements for int. Sparc
based systems are an example of that.

The thing to realise here is that although the code may work on some systems
it isn't valid/portable C.

Quote:
>I am doing this port remote over telnet, so I don't have access to the
>hardware.  The SunOS is 5.5.1.  The compiler is gcc 2.7.2.

>I have spent some time debugging this software with no success, using
>gdb.

Try to create a minimal but complete program that demonstrates the problem.
That in itself may show you what is going wrong. If not post it and we
should be able to tell you.

--
-----------------------------------------


-----------------------------------------



Thu, 30 Sep 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Question: Unix SCO to linux C program porting...

2. Porting or not porting, that is the question!!!

3. Porting or not porting, that is the question!!!

4. Signal handling in C software under Sun/SOLARIS

5. find what signals are caught under Solaris 2.5.1

6. Trapping Signals On Solaris

7. Help! Solaris Threads and Signals

8. comp.arch comp.unix.questions comp.unix.programmer

9. Problems Porting clcc code from sun/os to solaris

10. Porting ANSI C code from AIX to Solaris

11. Porting from Solaris to MFC

12. Porting from Linux to Win32 - alarm signal needed

 

 
Powered by phpBB® Forum Software