G
I statically link the Synopsys Milkyway C-API library ("MDA") into my
C++ application. When my C++ application throws an exception, it seg
faults instead.
The details of my environment are:
x86 (Pentium) CPU or AMD x86_64 (Opteron)
Red Hat Enterprise Linux 3 OS
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54)
Also reproduced with gcc version 3.3.2
The Synopsys Milkyway C-API library is,
Static linked library (dynamic linked not available)
Developed in C, not C++
supported on Red Hat Enterprise Linux 3.0, gcc version 3.3.2
The problem is platform-dependent:
- The problem occurs when I compile for 32 bits and link to the x86
MDA library, and run on either x86 and AMD x86_64 (Opteron)
- No problem when I compile for 64 bits and link to the x86_64 MDA,
and run on AMD x86_64
- No problem in the absence of IA32 MDE
In summary, there is something wrong with the 32 bit x86 version of MDA
library, regardless of whether it is run on an x86 machine or an AMD
x86_64 machine. But how to fix it?
The attached test program executes the MDA initialization function
MWXDb_omwxInit(), and then throws an exception. This causes the seg
fault as described above. When I comment out MWXDb_omwxInit(), throw
works as expected.
---------
#include <cstdio>
#include <cstdlib>
#include "omwx_proto.h" // Include file for MDA
void
thrower(const int in)
{
if (in > 1) {
printf("Throw an exception.\n");
throw 3;
}
printf("Did not throw an exception.\n");
}
int
main(int argc,
char **argv)
{
// When present, causes the mda lib to be included,
// and the throw to fail with a segv.
// When commented out, the throw works fine.
MWXDb_omwxInit(argc, argv, 1);
try {
thrower(argc);
} catch(int &excp) {
printf("Caught exception %d.\n", excp);
}
}
C++ application. When my C++ application throws an exception, it seg
faults instead.
The details of my environment are:
x86 (Pentium) CPU or AMD x86_64 (Opteron)
Red Hat Enterprise Linux 3 OS
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54)
Also reproduced with gcc version 3.3.2
The Synopsys Milkyway C-API library is,
Static linked library (dynamic linked not available)
Developed in C, not C++
supported on Red Hat Enterprise Linux 3.0, gcc version 3.3.2
The problem is platform-dependent:
- The problem occurs when I compile for 32 bits and link to the x86
MDA library, and run on either x86 and AMD x86_64 (Opteron)
- No problem when I compile for 64 bits and link to the x86_64 MDA,
and run on AMD x86_64
- No problem in the absence of IA32 MDE
In summary, there is something wrong with the 32 bit x86 version of MDA
library, regardless of whether it is run on an x86 machine or an AMD
x86_64 machine. But how to fix it?
The attached test program executes the MDA initialization function
MWXDb_omwxInit(), and then throws an exception. This causes the seg
fault as described above. When I comment out MWXDb_omwxInit(), throw
works as expected.
---------
#include <cstdio>
#include <cstdlib>
#include "omwx_proto.h" // Include file for MDA
void
thrower(const int in)
{
if (in > 1) {
printf("Throw an exception.\n");
throw 3;
}
printf("Did not throw an exception.\n");
}
int
main(int argc,
char **argv)
{
// When present, causes the mda lib to be included,
// and the throw to fail with a segv.
// When commented out, the throw works fine.
MWXDb_omwxInit(argc, argv, 1);
try {
thrower(argc);
} catch(int &excp) {
printf("Caught exception %d.\n", excp);
}
}