一个C++框架的程序,运行没有任何问题。后来增加了一个函数,语法也通过编译,没有任何问题。可是调试运行后出现:unhandled exception in DC.exe 0xc00000fd, stack Overflow.改为单步运行,结果在程序运行到没几步的时候就出错了。转入到D:\....\SRC\Intel\CHKSTK.ASM中,提示如下:labelP _alloca_probe, PUBLIC
labelP _chkstk, PUBLIC push ecx ; save ecx
cmp eax,_PAGESIZE_ ; more than one page requested?
lea ecx,[esp] + 8 ; compute new stack pointer in ecx
; correct for return address and
; saved ecx
jb short lastpage ; no;------------probepages:
sub ecx,_PAGESIZE_ ; yes, move down a page
sub eax,_PAGESIZE_ ; adjust request and... --> test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested?
jae short probepages ; nolastpage:
sub ecx,eax ; move stack down by eax
mov eax,esp ; save current tos and do a... test dword ptr [ecx],eax ; ...probe in case a page was crossed mov esp,ecx ; set the new stack pointer mov ecx,dword ptr [eax] ; recover ecx
mov eax,dword ptr [eax + 4] ; recover return address push eax ; prepare return address
; ...probe in case a page was crossed
ret end黄色指针指在箭头处。有人能帮我看看这个是什么问题吗?关键是调试到的这个函数离我修改的地方很远,我增加的函数要很后面才会运行到,并且这个函数和我修改的函数没有一点关系的。所以一点思路都没有了。是什么问题呢?我该怎么办?听说这里人气很旺,很能解决问题。一个C++ 新手,第一次来这里发贴,还希望大家能给予支持!!再次感谢拉!!
labelP _chkstk, PUBLIC push ecx ; save ecx
cmp eax,_PAGESIZE_ ; more than one page requested?
lea ecx,[esp] + 8 ; compute new stack pointer in ecx
; correct for return address and
; saved ecx
jb short lastpage ; no;------------probepages:
sub ecx,_PAGESIZE_ ; yes, move down a page
sub eax,_PAGESIZE_ ; adjust request and... --> test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested?
jae short probepages ; nolastpage:
sub ecx,eax ; move stack down by eax
mov eax,esp ; save current tos and do a... test dword ptr [ecx],eax ; ...probe in case a page was crossed mov esp,ecx ; set the new stack pointer mov ecx,dword ptr [eax] ; recover ecx
mov eax,dword ptr [eax + 4] ; recover return address push eax ; prepare return address
; ...probe in case a page was crossed
ret end黄色指针指在箭头处。有人能帮我看看这个是什么问题吗?关键是调试到的这个函数离我修改的地方很远,我增加的函数要很后面才会运行到,并且这个函数和我修改的函数没有一点关系的。所以一点思路都没有了。是什么问题呢?我该怎么办?听说这里人气很旺,很能解决问题。一个C++ 新手,第一次来这里发贴,还希望大家能给予支持!!再次感谢拉!!
解决方案 »
- 怎样解析web中的javascript?
- DropBox
- 用labview开发制作的安装软件(含有串口通讯)在XP中可以顺利运行串口通讯,在VISTA确不能。
- 怎样让匿名用户可以创建我的COM组件?? 用ATL写的
- 哪里可以下到BCG7.0? 正式版本的哦,不是体验版的。
- 小问题:std是什么意思?
- 怎样使用CreateProcessWithLogonW函数以本机管理员的身份登陆?
- 一个关于edit box 控件的拷贝,粘贴奇怪的为题!谢谢!
- VC&&COM新手问题之二:如何在组件创建时初始化变量的值?
- 请问如何才能将ADO的异常转换为能直接看的懂的错误?
- Delphi里的TMemoryStream在VC++里对应什么类型(非MFC)?
- CListCtrl里,如何让鼠标能一次连续选定多行?
{ SESSION_ID sessionId = GetSessionID(scf->connId);
int switchTimes = scf->switchTimes;
// int bSwitched = NOSWITCH;
ID inlink, outlink;
scf->usedWave;
PORT inport, outport;
// ID lwfsPos;
int pos, inpos, outpos;
double timeInterval;//else if(g_signalingConfig.reserveChoice == BACKWARD_RESERVE){
//bool bPreLinkHasFreeWave=true;
// int lwfsPos;
CLink* preLink = GetPreLink(scf ->path);
if(scf->path->IsFirstNode(m_nodeId)){
inlink=INVALID;
}
else{
inlink=GetPreLink(scf->path)->m_linkId;
} outlink=GetNextLink(scf->path)->m_linkId;
/*if(!scf->path->IsFirstNode(m_nodeId))
{
if(!GetPreLink(sra->path)->IsWaveAvailable(sra->usedWave))
bPreLinkHasFreeWave = false;
}*/
/*if( GetFreePortPos(inlink, scf->usedWave, IN,inpos=0) && GetFreePortPos(outlink, scf->usedWave, OUT,outpos=0))
{ */
GetFreeCutthroughPortPos(inlink,outlink,scf->usedWave,pos=0);
if (scf->path->IsFirstNode(m_nodeId) )
{
if ( m_switchMatrix[pos].bswstatus == 1 || !switchTimes == NOTSWITCHED){
m_pEventList->InsertEvent(MS_CONFIRM, preLink->GetPeerNode(m_nodeId), m_processingTm, &m_scf[sessionId], sizeof(S_CONFIRM));
}
else {
m_pEventList->InsertEvent(MS_CONFIRM, preLink->GetPeerNode(m_nodeId), 0 , &m_scf[sessionId], sizeof(S_CONFIRM));
}
} else { m_sso[sessionId].connId = scf->connId;
m_sso[sessionId].nodeId = m_nodeId;
//double timeInterval = (bSwitched==SWITCHED)?m_switchingTm:0 ;
if ( m_switchMatrix[pos].bswstatus == 1 || !switchTimes == NOTSWITCHED){
timeInterval = m_processingTm;
}
else{
timeInterval = 0;
}
//timeInterval += m_processingTm;
m_pEventList->InsertEvent(M_SETUP_OK, 0, timeInterval, &m_sso[sessionId], sizeof(S_SETUP_OK));
// sso->path.showPath();
// showEventList();
m_usedAddPortNum ++;
// store the setup time
g_setupTimeRecorder.AddValue( m_occurTime-m_session[sessionId].requestTime);
return OK;
}
return OK;
}
float transmissionTime, float switchingTime, float processingTime)
-->{
long *pTopo;
pTopo = phyTopo;
int col,row;
ID linkId=0, nodeId=0;//'A' m_pGraph = new CGraph;
if(m_pGraph == NULL){
cout << "No enough memory." << endl;
exit(1);
} m_transmissionTime = transmissionTime;
m_switchingTime = switchingTime;
m_processingTime = processingTime; // create node resources
for(row=0; row<nodeNum; row++)
{
CNode node(nodeId);
node.m_pEventList = &g_eventList;
node.m_processingTm = m_processingTime;
node.m_switchingTm = m_switchingTime;
node.m_pGraph = m_pGraph;
g_vNode.push_back(node);
nodeId++;
} ADJACENCY adj;
// correlate the adjacent nodes and links
for(row=0; row<nodeNum; row++)
{
// changes: 2002.10.22
// store the bidirectional link.
for(col=0; col<nodeNum; col++) {
if(*(pTopo+nodeNum*row+col) !=0) { CLink link; g_vLink.push_back(link);
g_vLink.back().Init( linkId, row, col, fiberNum, waveNum);
g_vLink.back().m_transmissionTm = m_transmissionTime; adj.linkId = linkId;
adj.nodeId = g_vNode[col].m_nodeId;
adj.status = OUT;
g_vNode[row].GetAdjacency()->push_back(adj);
adj.nodeId = g_vNode[row].m_nodeId;
adj.status = IN;
g_vNode[col].GetAdjacency()->push_back(adj);
linkId++;
}
}
}
m_pGraph->CreateGraph(phyTopo);
m_pGraph->GetShortestPath(); //showResource();
NODEVECTOR::iterator nodeItor;
for( nodeItor = g_vNode.begin(); nodeItor != g_vNode.end(); nodeItor++)
nodeItor->CreateSwitchMatrix(fiberNum, waveNum, addDropPortNum);
// nodeItor->showMatrix();
// nodeItor->InitLambdaWFStatus(waveNum);//modified for lwfs
g_linkUtilizationRecorder.SetTotalWaveNum(fiberNum*waveNum*g_vLink.size());
}谢谢楼上的回复。是调用此函数时出的错误,黄色指针指在箭头处。出错后就自动显示那个汇编代码段了。这段函数以前程序中就有,一点没做修改的。
前面那个CONFIRM()函数是我新加的,不过和这个函数没有任何联系的。各位再帮忙看看,谢谢拉!
float transmissionTime, float switchingTime, float processingTime)
{
m_resource.CreateResource(phyTopo, nodeNum, fiberNum, waveNum, addDropPortNum, transmissionTime,
switchingTime, processingTime);
m_transmissionTime = transmissionTime;
m_processingTime = processingTime;
m_switchTime = switchingTime;
m_nodeNum = nodeNum;
m_fiberNum = fiberNum;
m_waveNum = waveNum;
m_addDropPortNum = addDropPortNum;// m_resource.showResource();
}