This is a discussion on vxWorks 5.5.1 g++pentium 2.9 compiler problem in initialising member array of function pointers in C++ - VxWorks ; Hi All, I am facing one of the typical scenario in the Tornado 2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. This Compiler is not initialising properly any of the member array of function pointers either 1-dimensional or 2-dimensional. For this problem i ...
Hi All,
I am facing one of the typical scenario in the Tornado
2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler.
This Compiler is not initialising properly any of the member array of
function pointers either 1-dimensional or 2-dimensional.
For this problem i got a solution from windriver because
it is one of the SPR'S it's number : 110843 so
i installed the Service Patch: Tornado 2.2.1 Service Pack 1 (Tornado
2.2.1 Cumulative Update Patch).
This will update my Tornado version to 2.2.2(earlier
2.2.1) & vxWorks to 5.5.2(earlier 5.5.1). I thought
problem will get resolved after this. But the thing is i am still
facing the same problem.
Source Code:
#include
using namespace std;
class test;
typedef void (test::*fp)();
class test
{
public:
void f1();
void f2();
void f3();
void f4();
void f5();
void f6();
void f7();
void f8();
static fp fptr[4][2];
void f();
};
fp test::fptr[4][2]= {
{&test::f1,&test::f2},
{&test::f3,&test::f4},
{&test::f5,&test::f6},
{&test::f7,&test::f8}
};
void test::f()
{
for(int i=0; i<4;i++)
for(int j=0; j<2;j++)
(this->*(fptr[i][j]))();
return;
}
void test::f1()
{
cout<<"1"<return;
}
void test::f2()
{
cout<<"2"<return;
}
void test::f3()
{
cout<<"3"<return;
}
void test::f4()
{
cout<<"4"<return;
}
void test::f5()
{
cout<<"5"<return;
}
void test::f6()
{
cout<<"6"<return;
}
void test::f7()
{
cout<<"7"<return;
}
void test::f8()
{
cout<<"8"<return;
}
int main()
{
test a;
a.f();
}
Output:
Page Fault
Page Dir Base : 0x0ff78000
Esp0 0x0feebf48 : 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0x00000000
Esp0 0x0feebf58 : 0x00000000, 0x00000000, 0xeeeeeeee, 0xeeeeeeee
Program Counter : 0x013f513d
Code Selector : 0x00000008
Eflags Register : 0x00010246
Error Code : 0x00000000
Page Fault Addr : 0xfffffff8
Task: 0xfeebfdc "s2u1"
Procedure How i will do the Compilation:
1) Here i am doing Cross-Compilation, I m having Solaris 5.8 as well
Windows XP as two different Host.
In both the host Tornado 2.2.1 for pentium target got installed &
later on after installing the patch both of
them got upgraded to Tornado 2.2.2
2) In Solaris I will do the Compilation in Command line based(i wont
use Tornado IDE here in Solaris) and
I will get an executable file.
3) I will copy the executable to the windows host & later I will
download it to the pentium target & then
using the Tornado IDE in windows XP i will execute.
Command which used to get executable in Solaris Host:
1) g++pentium -c sample.cpp
2) ldpentium -r sample.o
3) "a.out" i will get.
Important Information to Note:
The sample program which i given here if i compile in Tornado IDE
of either Windows or Solaris that means
creating project then adding this sample.cpp file " i am not
getting any page faults error".
Everything is working properly.
Now my doubt is why not it's working in
Command line based in Solaris & how can i
make it to work.
What procedure should i have to follow.
Expecting lots of responses from lots of group members.
Regards,
Sakthivel