I am having lib named Tplib.a. It is using map for storage for few data structure. Please see below:
typedef std::map<portNo_t, otnPortInfo_t> otnPortList_t;
otnPortList_t otnPortList;
int mapOtnPortAdd( portNo_t portNo)
{
otnPortInfo_t otnPortInfo;
memset(&otnPortInfo, 0, sizeof(otnPortInfo_t));
otnPortInfo.portNo = portNo;
......
......
otnPortInfo.sigDeg.state = 7;
otnPortList[portNo] = otnPortInfo; // Problem line
return RET_Ok;
}
After compilation of above lib(Tplib.a) when I am linking the above lib (Tplib.a) into a driver then it is crashing at run time at otnPortList[portNo] = otnPortInfo; // Problem line
But on another directory after linking Tplib.a working perfectly fine. no crash. Not sure what is the reason. Same lib is crashing at one place and not at other.
Any help how to proceed in debugging the issue. At every time I am seeing the following messages:
> map_initotn()
map_initotn [3834]: adding all port in one go
mapOtnPortAdd [3776]: portNo= 0
data translation miss
Exception current instruction address: 0x01dd8da8
Machine Status Register: 0x02029200
Data Exception Address Register: 0x5555aaba
Condition Register: 0x24000044
Exception Syndrome Register: 0x00000000
Task: 0x3423c68 "tShell"
187028 vxTaskEntry +5c : shell (1)
bf280 shell +1dc: bf2a8 (1)
bf568 shell +4c4: execute (3423b30)
bf754 execute +f8 : yyparse ()
df2bc yyparse +ae0: dca04 (&yyval, 4f092d8, 4f092f8)
dcc04 yystart +b98: map_initotn() ()
1d82990 map_initotn() +68 : mapOtnPortAdd(unsigned long) (0)
1d82664 mapOtnPortAdd(unsigned long)+bc : std::map<unsigned long, otnPortInfo_t, less<unsigned long>, __default_alloc_template<(bool)1, (int)0>>::operator [](const unsigned long (&otnPortList, 34238e0)
1dd6998 std::map<unsigned long, otnPortInfo_t, less<unsigned long>, __default_alloc_template<(bool)1, (int)0>>::operator [](const unsigned long +90 : std::map<unsigned long, otnPortInfo_t, less<unsigned long>, __default_alloc_template<(bool)1, (int)0> ()
1dd7764 std::map<unsigned long, otnPortInfo_t, less<unsigned long>, __default_alloc_template<(bool)1, (int)0>+40 : rb_tree (3423728, &otnPortList, 3423738)
1dd8a90 rb_tree +c8 : less<unsigned long>::operator ()(const unsigned long &, const unsigned long &) const (377f828, 3423738, 5555aaba)
tShell
restarted.
I think its look like pure linking issue. Lib Tddrv.a is same no change in that but when the same code of piece of code is link in one directory it is working fine but in another directory it is crashing. I am using following tools compiler gcc.c3.4.5-p5.ppc and linker gld.c3.4.5-p5.ppc .