- Timestamp:
- Jun 17, 2008, 9:24:12 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 4 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp
r641 r648 58 58 const IncludedFilesRelation *pIncludedFilesRelation = NULL; 59 59 const BasicSource *pNowSource = NULL; 60 BOOST_FOREACH( const ObjectModule *pObjectModule, compiler.staticLibraries ) 60 61 extern BasicSources sourcesLinkRelationalObjectModule; 62 BOOST_FOREACH( const BasicSource &source, sourcesLinkRelationalObjectModule ) 61 63 { 62 const BasicSource *pSource = &pObjectModule->GetSource(); 63 64 pIncludedFilesRelation = &pSource->GetIncludedFilesRelation(); 64 pIncludedFilesRelation = &source.GetIncludedFilesRelation(); 65 65 66 66 for(FileNum=0;FileNum<pIncludedFilesRelation->GetFileCounts();FileNum++) … … 68 68 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(),szFilePath)==0) 69 69 { 70 pNowSource = pSource;70 pNowSource = &source; 71 71 break; 72 72 } … … 418 418 419 419 //ブレークポイントを生成 420 pobj_DBBreakPoint=new CDBBreakPoint;420 pobj_DBBreakPoint=new BreakPointManager; 421 421 422 422 -
trunk/ab5.0/abdev/BasicCompiler_Common/common.h
r625 r648 18 18 #include "../BasicCompiler_Common/NonVolatile.h" 19 19 #include "../BasicCompiler_Common/psapi.h" 20 #include "../BasicCompiler_Common/BreakPoint.h"21 20 22 21 -
trunk/ab5.0/abdev/BasicCompiler_Common/include/BreakPoint.h
r647 r648 1 1 2 2 3 class CFileBreakPoint{ 3 class BreakPointsPerFile 4 { 4 5 public: 5 char *lpszFileName; 6 std::string filename; 7 std::vector<int> lines; 6 8 7 int *piLine; 8 int num; 9 10 CFileBreakPoint(char *lpszFileName,int iLineNum); 11 ~CFileBreakPoint(); 9 BreakPointsPerFile(char *lpszFileName,int iLineNum); 12 10 13 11 void add(int iLineNum); … … 16 14 void update(char *nativeCodeBuffer); 17 15 }; 16 typedef std::vector<BreakPointsPerFile> BreakPointsPerFiles; 18 17 19 class CDBBreakPoint{20 CFileBreakPoint **ppItem; 21 int num;18 class BreakPointManager 19 { 20 BreakPointsPerFiles breakpointsPerFiles; 22 21 23 22 public: 24 CDBBreakPoint(); 25 ~CDBBreakPoint(); 23 BreakPointManager(); 26 24 27 25 void insert(char *lpszFileName,int iLineNum); … … 32 30 33 31 34 extern CDBBreakPoint*pobj_DBBreakPoint;32 extern BreakPointManager *pobj_DBBreakPoint; -
trunk/ab5.0/abdev/BasicCompiler_Common/src/BreakPoint.cpp
r647 r648 5 5 ////////////////////////// 6 6 7 CDBBreakPoint *pobj_DBBreakPoint; 8 9 CFileBreakPoint::CFileBreakPoint(char *lpszFileName,int iLineNum){ 10 this->lpszFileName=(char *)HeapAlloc(hHeap,0,lstrlen(lpszFileName)+1); 11 lstrcpy(this->lpszFileName,lpszFileName); 12 13 piLine=(int *)HeapAlloc(hHeap,0,sizeof(int)); 14 piLine[0]=iLineNum; 15 num=1; 16 } 17 CFileBreakPoint::~CFileBreakPoint(){ 18 HeapDefaultFree(lpszFileName); 19 HeapDefaultFree(piLine); 20 } 21 void CFileBreakPoint::add(int iLineNum){ 22 piLine=(int *)HeapReAlloc(hHeap,0,piLine,(num+1)*sizeof(int)); 23 piLine[num]=iLineNum; 24 num++; 25 } 26 void CFileBreakPoint::remove(int iLineNum){ 27 int i; 28 for(i=0;i<num;i++){ 29 if(iLineNum==piLine[i]) break; 30 } 31 if(i==num) return; 32 33 num--; 34 for(;i<num;i++){ 35 piLine[i]=piLine[i+1]; 36 } 37 } 38 39 void CFileBreakPoint::update(char *nativeCodeBuffer) 7 BreakPointManager *pobj_DBBreakPoint; 8 9 BreakPointsPerFile::BreakPointsPerFile(char *lpszFileName,int iLineNum){ 10 this->filename = lpszFileName; 11 12 lines.clear(); 13 lines.push_back( iLineNum ); 14 } 15 void BreakPointsPerFile::add(int iLineNum){ 16 lines.push_back( iLineNum ); 17 } 18 void BreakPointsPerFile::remove( int iLineNum ) 19 { 20 for( int i=0; i<static_cast<int>(this->lines.size()); i++ ) 21 { 22 if( iLineNum == this->lines[i] ) 23 { 24 Jenga::Common::EraseVectorItem<std::vector<int>>( this->lines, i ); 25 break; 26 } 27 } 28 } 29 30 void BreakPointsPerFile::update(char *nativeCodeBuffer) 40 31 { 41 32 int FileNum; 42 33 const IncludedFilesRelation *pIncludedFilesRelation = NULL; 43 34 const BasicSource *pNowSource = NULL; 44 BOOST_FOREACH( const ObjectModule *pObjectModule, compiler.staticLibraries ) 45 {46 const BasicSource *pSource = &pObjectModule->GetSource();47 48 pIncludedFilesRelation = & pSource->GetIncludedFilesRelation();35 36 extern BasicSources sourcesLinkRelationalObjectModule; 37 BOOST_FOREACH( const BasicSource &source, sourcesLinkRelationalObjectModule ) 38 { 39 pIncludedFilesRelation = &source.GetIncludedFilesRelation(); 49 40 50 41 for(FileNum=0;FileNum<pIncludedFilesRelation->GetFileCounts();FileNum++) 51 42 { 52 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(), lpszFileName)==0)43 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(),this->filename.c_str())==0) 53 44 { 54 pNowSource = pSource;45 pNowSource = &source; 55 46 break; 56 47 } … … 68 59 if( !pIncludedFilesRelation ) 69 60 { 70 Jenga::Throw( " CFileBreakPoint::update内で不正な処理" );61 Jenga::Throw( "BreakPointsPerFile::update内で不正な処理" ); 71 62 return; 72 63 } … … 96 87 } 97 88 98 if(i2== piLine[nCount]){89 if(i2==this->lines[nCount]){ 99 90 extern SourceLines oldSourceLines; 100 91 … … 114 105 115 106 nCount++; 116 if(nCount>=num) break; 117 } 118 } 119 } 120 121 122 CDBBreakPoint::CDBBreakPoint(){ 123 ppItem=(CFileBreakPoint **)HeapAlloc(hHeap,0,1); 124 num=0; 125 107 if( nCount >= static_cast<int>(this->lines.size()) ) 108 { 109 break; 110 } 111 } 112 } 113 } 114 115 116 BreakPointManager::BreakPointManager() 117 { 126 118 char *buffer; 127 119 buffer=(char *)HeapAlloc(hHeap,0,65535); 128 120 121 std::string filepath = ActiveBasic::Common::Environment::GetAbdevRootPath() + "\\ab_breakpoint.tmp"; 129 122 HANDLE hFile=CreateFile( 130 ( Jenga::Common::Environment::GetAppDir() + "\\ab_breakpoint.tmp" ).c_str(),123 filepath.c_str(), 131 124 GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 132 if(hFile!=INVALID_HANDLE_VALUE){ 125 if(hFile!=INVALID_HANDLE_VALUE) 126 { 133 127 DWORD dwAccBytes; 134 128 ReadFile(hFile,buffer,MAX_PATH,&dwAccBytes,NULL); … … 136 130 buffer[dwAccBytes]=0; 137 131 } 138 else buffer[0]=0; 132 else 133 { 134 buffer[0]=0; 135 } 139 136 140 137 int i=0,i2; … … 161 158 HeapDefaultFree(buffer); 162 159 } 163 CDBBreakPoint::~CDBBreakPoint(){ 164 int i; 165 for(i=0;i<num;i++){ 166 delete ppItem[i]; 167 } 168 HeapDefaultFree(ppItem); 169 } 170 void CDBBreakPoint::insert(char *lpszFileName,int iLineNum){ 171 int i; 172 for(i=0;i<num;i++){ 173 if(lstrcmpi(ppItem[i]->lpszFileName,lpszFileName)==0){ 174 ppItem[i]->add(iLineNum); 160 void BreakPointManager::insert(char *lpszFileName,int iLineNum) 161 { 162 BOOST_FOREACH( BreakPointsPerFile &breakpointsPerFile, breakpointsPerFiles ) 163 { 164 if(lstrcmpi(breakpointsPerFile.filename.c_str(),lpszFileName)==0) 165 { 166 breakpointsPerFile.add( iLineNum ); 175 167 return; 176 168 } 177 169 } 178 170 179 if(i==num){ 180 ppItem=(CFileBreakPoint **)HeapReAlloc(hHeap,0,ppItem,(num+1)*sizeof(CFileBreakPoint *)); 181 ppItem[num]=new CFileBreakPoint(lpszFileName,iLineNum); 182 num++; 183 } 184 } 185 void CDBBreakPoint::remove(char *lpszFileName,int iLineNum){ 186 int i; 187 for(i=0;i<num;i++){ 188 if(lstrcmpi(lpszFileName,ppItem[i]->lpszFileName)==0){ 189 ppItem[i]->remove(iLineNum); 190 break; 191 } 192 } 193 if(i==num) return; 194 195 if(ppItem[i]->num==0){ 196 delete ppItem[i]; 197 198 num--; 199 for(;i<num;i++){ 200 ppItem[i]=ppItem[i+1]; 201 } 202 } 203 } 204 205 char *CDBBreakPoint::update(char *nativeCodeBuffer,int SizeOf_CodeSection){ 171 this->breakpointsPerFiles.push_back( BreakPointsPerFile( lpszFileName, iLineNum ) ); 172 } 173 void BreakPointManager::remove(char *lpszFileName,int iLineNum) 174 { 175 for( int i=0; i<static_cast<int>(this->breakpointsPerFiles.size()); i++ ) 176 { 177 BreakPointsPerFile *pBreakpointsPerFile = &breakpointsPerFiles[i]; 178 if(lstrcmpi(pBreakpointsPerFile->filename.c_str(),lpszFileName)==0) 179 { 180 pBreakpointsPerFile->remove( iLineNum ); 181 if( pBreakpointsPerFile->lines.empty() ) 182 { 183 Jenga::Common::EraseVectorItem<BreakPointsPerFiles>( this->breakpointsPerFiles, i ); 184 } 185 break; 186 } 187 } 188 } 189 190 char *BreakPointManager::update(char *nativeCodeBuffer,int SizeOf_CodeSection){ 206 191 char *buffer; 207 192 buffer=(char *)HeapAlloc(hHeap,0,SizeOf_CodeSection); 208 193 memcpy(buffer,nativeCodeBuffer,SizeOf_CodeSection); 209 194 210 int i;211 for(i=0;i<num;i++){212 ppItem[i]->update(buffer);195 BOOST_FOREACH( BreakPointsPerFile &breakpointsPerFile, breakpointsPerFiles ) 196 { 197 breakpointsPerFile.update( buffer ); 213 198 } 214 199 -
trunk/ab5.0/abdev/compiler_x86/compiler_x86.vcproj
r628 r648 602 602 > 603 603 <File 604 RelativePath="..\BasicCompiler_Common\BreakPoint.cpp"605 >606 <FileConfiguration607 Name="Debug|Win32"608 >609 <Tool610 Name="VCCLCompilerTool"611 PreprocessorDefinitions=""612 />613 </FileConfiguration>614 <FileConfiguration615 Name="Release|Win32"616 >617 <Tool618 Name="VCCLCompilerTool"619 PreprocessorDefinitions=""620 />621 </FileConfiguration>622 </File>623 <File624 RelativePath="..\BasicCompiler_Common\BreakPoint.h"625 >626 </File>627 <File628 604 RelativePath="..\BasicCompiler_Common\CDebugThreadInfo.cpp" 629 605 > … … 1298 1274 <File 1299 1275 RelativePath="..\BasicCompiler_Common\src\Program.cpp" 1276 > 1277 </File> 1278 </Filter> 1279 <Filter 1280 Name="Debugger Classes" 1281 > 1282 <File 1283 RelativePath="..\BasicCompiler_Common\src\BreakPoint.cpp" 1300 1284 > 1301 1285 </File> … … 1438 1422 > 1439 1423 <File 1424 RelativePath="..\BasicCompiler_Common\include\BreakPoint.h" 1425 > 1426 </File> 1427 <File 1440 1428 RelativePath="..\BasicCompiler_Common\include\Debugger.h" 1441 1429 > -
trunk/ab5.0/abdev/compiler_x86/stdafx.h
r628 r648 57 57 #include <ProcedureGenerator.h> 58 58 #include <DataTableGenerator.h> 59 #include <BreakPoint.h>
Note:
See TracChangeset
for help on using the changeset viewer.