void Extrae_trace_callers(iotimer_t time, int offset, int type) { ucontext_t Contexto; void * InstructionPointer; void ** StackFrame; int Frame = 1; /* Check for valid CALLER types */ if (type != CALLER_MPI && type != CALLER_SAMPLING) return; /* Leave if they aren't initialized (asked by user!) */ if (Trace_Caller[type] == NULL) return; if (getcontext (&Contexto) < 0) { fprintf(stderr, "backtrace: Error retrieving process context.\n"); return; } #if defined(MPI_CALLER_DEBUG) fprintf(stderr, "Executing instruction at 0x%08x\n", (&Contexto)->uc_mcontext.jmp_context.iar); #endif /* Roll down the stack frames */ InstructionPointer = (void *) (&Contexto)->uc_mcontext.jmp_context.iar; StackFrame = (void **) (&Contexto)->uc_mcontext.jmp_context.gpr[1]; while ((StackFrame) && (Frame < Caller_Deepness[type]+offset)) { #if defined(MPI_CALLER_DEBUG) fprintf(stderr, "(%2d) 0x%p\n", Frame, InstructionPointer); #endif if (Frame >= offset) { if (Trace_Caller[type][Frame-offset]) { /* Esta es la profundidad que queremos tracear */ TRACE_EVENT(time, MPI_CALLER_EVENT_TYPE(Frame-offset+1), (UINT64)InstructionPointer); } } if (!StackFrame[0]) return; /* Seguramente esta comprobacion se puede comentar */ #if defined(MPI_CALLER_DEBUG) if (!ValidAddress((void *) StackFrame) || !ValidAddress((void *) StackFrame[0]) || !ValidAddress((void *) ((void **) StackFrame[0] + 2))) { fprintf(stderr, "backtrace: Invalid frame at %p\n", (void *)StackFrame); return; } #endif StackFrame = (void **) StackFrame[0]; InstructionPointer = StackFrame[2]; Frame ++; } }
void CAddBuilding::OnEnKillfocusAddbuidingSetedit() { #if 1 CString strText; m_AddBuiding_SetEditCtrl.GetWindowText(strText); m_strMainBuildingName = m_AddBuiding_FlexGrid.get_TextMatrix(m_nCurRow, AB_MAINNAME); if (m_nCurRow==m_AddBuiding_FlexGrid.get_Rows()-1) { if(m_nCurCol==AB_NAME) { CString strTemp; //for(UINT i=0;i++;i<m_BuildNameLst.size()) // commented by zgq;2010-12-06,不知道这种写法是什么意思? for(UINT i=0;i<m_BuildNameLst.size();i++) { strTemp=m_BuildNameLst.at(i).strSubBuildName; if(strText.CompareNoCase(strTemp)==0 && m_BuildNameLst.at(i).strMainBuildName.CompareNoCase(m_strMainBuildingName)==0) { AfxMessageBox(_T("The Subnet Name has existed, please input a unused name.")); return; } } m_AddBuiding_FlexGrid.put_TextMatrix(m_nCurRow,m_nCurCol,strText); m_strBuildingName=strText; m_strBuilding_Name2=strText; } if(m_nCurCol==AB_IPADDRESS) { CString strIP; bool is_domain = false; strIP = strText; if(strIP.IsEmpty()) return; CStringArray temparray; SplitCStringA(temparray,strIP,_T(".")); if((temparray.GetSize()==4)) //有3个 . 4段 { CString temp_0; CString temp_1; CString temp_2; CString temp_3; temp_0 = temparray.GetAt(0); temp_1 = temparray.GetAt(1); temp_2 = temparray.GetAt(2); temp_3 = temparray.GetAt(3); if((Is_Dig_Num(temp_0)) && (Is_Dig_Num(temp_1)) && (Is_Dig_Num(temp_2)) && (Is_Dig_Num(temp_3))) { if(::ValidAddress(strIP) == false) { MessageBox(_T("Warning!IP address error!")); return; } } else //否则判断为 域名; { is_domain = true; } } else //判断为 域名; { is_domain = true; } if(is_domain) { CString temp_host_ip; if(!GetIPbyHostName(strText,temp_host_ip)) { AfxMessageBox(_T("Can not get a validate IP adreess from the domain name!")); return; } strText = temp_host_ip; //char temp_domain[200]; //WideCharToMultiByte( CP_ACP, 0, strIP.GetBuffer(), -1, temp_domain, 255, NULL, NULL ); //strIP.ReleaseBuffer(); //hostent* host = gethostbyname(temp_domain); //if(host == NULL) //{ // if(IDYES == MessageBox(_T("The domain is unreachable .Continue?"),_T("Warning"),MB_YESNO)) // { // } // else // { // return; // } //} } #if 0 if(!ValidAddress(strText)) { if(strText.IsEmpty()) { AfxMessageBox(_T("Please input a validate IP adreess or domain name!")); return; } /* CStringIP; if(!GetIPbyHostName(strText,CStringIP)) { AfxMessageBox(_T("Can not get a validate IP adreess from the domain name!")); return; } m_strIpAddress=CStringIP; m_AddBuiding_FlexGrid.put_TextMatrix(m_nCurRow,m_nCurCol,strText); return; */ } //if(m_strIpAddress.CompareNoCase(strText)==0) //{ // return; //} #endif m_strIpAddress=strText; m_AddBuiding_FlexGrid.put_TextMatrix(m_nCurRow,m_nCurCol,strText); } if(m_nCurCol==AB_IPPORT) { //if(m_strIpPort.CompareNoCase(strText)==0) //{ // return; //} m_strIpPort=strText; m_AddBuiding_FlexGrid.put_TextMatrix(m_nCurRow,m_nCurCol,strText); } } else { if(m_nCurCol==AB_NAME && m_strBuilding_Name2.CompareNoCase(strText)!=0) { CString strTemp; for(UINT i=0;i<m_BuildNameLst.size();i++) { strTemp=m_BuildNameLst.at(i).strSubBuildName; if(strText.CompareNoCase(strTemp)==0&&m_strMainBuildingName2.CompareNoCase(m_BuildNameLst.at(i).strMainBuildName)==0) { AfxMessageBox(_T("The building Name has exist, please change another one.")); return; } } /*Good Code//using Format is OK, use strSql= Error..?? CString strSql; //strSql.Format(_T("update Building set Building_Name = '%s', where Building_Name = '%s'"),strText,m_strBuildingName);//erro strSql.Format(_T("update Building set Building_Name = '"+strText+"' where Building_Name = '"+m_strBuildingName+"'")); _pCon->Execute(strSql.GetString(),NULL,adCmdText); m_strBuildingName=strText; */ m_strBuildingName=strText; } if(m_nCurCol==AB_IPADDRESS) { if(!::ValidAddress(strText)) { //if(strText.CompareNoCase((CString)NO_APPLICATION)==0) //return; if(strText.IsEmpty()) { //AfxMessageBox(_T("Please input a validate IP adreess or domain name!")); return; } /* CStringIP; if(!GetIPbyHostName(strText,CStringIP)) { AfxMessageBox(_T("Can not get a validate IP adreess from the domain name!")); return; } m_strIpAddress=CStringIP; m_AddBuiding_FlexGrid.put_TextMatrix(m_nCurRow,m_nCurCol,strText); */ //return; } //if(m_strIpAddress.CompareNoCase(strText)==0) //{ // return; //} m_strIpAddress=strText; } if(m_nCurCol==AB_IPPORT) { //if(m_strIpPort.CompareNoCase(strText)==0) //{ // return; //} m_strIpPort=strText; } Update_Recorder(); } m_AddBuiding_SetEditCtrl.ShowWindow(SW_HIDE); OnBnClickedAddbuiding(); #endif }