Changeset 741 in dev for trunk/ab5.0
- Timestamp:
- Sep 7, 2008, 12:05:40 AM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/CDebugThreadInfo.cpp
r740 r741 10 10 11 11 extern HANDLE hDebugProcess; 12 extern DebugSectionCollection debugSectionCollection; 12 13 13 14 CDebugThreadInfo *pobj_dti; … … 27 28 28 29 DWORD dwRWSectionPos; 29 dwRWSectionPos= pobj_DBDebugSection->debugSections[0]->dwImageBase+30 pobj_DBDebugSection->debugSections[0]->dwRVA_RWSection;30 dwRWSectionPos=debugSectionCollection.debugSections[0]->dwImageBase+ 31 debugSectionCollection.debugSections[0]->dwRVA_RWSection; 31 32 32 33 ReadProcessMemory(hDebugProcess, … … 80 81 extern DWORD ImageBase; 81 82 if((HMODULE)(ULONG_PTR)ImageBase!=hTargetModule){ 82 for(i=0;i< pobj_DBDebugSection->debugSections.size();i++){83 if((HMODULE)(ULONG_PTR) pobj_DBDebugSection->debugSections[i]->dwImageBase==hTargetModule){84 pobj_DBDebugSection->choice(i);83 for(i=0;i<debugSectionCollection.debugSections.size();i++){ 84 if((HMODULE)(ULONG_PTR)debugSectionCollection.debugSections[i]->dwImageBase==hTargetModule){ 85 debugSectionCollection.choice(i); 85 86 break; 86 87 } -
trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp
r740 r741 23 23 int NextStepThreadNum; 24 24 25 DebugSectionCollection debugSectionCollection; 25 26 26 27 void Debugger_StepIn(void){ … … 129 130 130 131 StepCursorObpSchedule=oldSourceLines[i3].GetNativeCodePos(); 131 StepCursor_BackupChar= pobj_DBDebugSection->pobj_now->BreakStepCodeBuffer[StepCursorObpSchedule];132 133 pobj_DBDebugSection->pobj_now->BreakStepCodeBuffer[StepCursorObpSchedule]=(char)0xCC;132 StepCursor_BackupChar=debugSectionCollection.GetCurrent().BreakStepCodeBuffer[StepCursorObpSchedule]; 133 134 debugSectionCollection.GetCurrent().BreakStepCodeBuffer[StepCursorObpSchedule]=(char)0xCC; 134 135 135 136 break; … … 292 293 WriteProcessMemory(hDebugProcess, 293 294 (void *)(ULONG_PTR)(ImageBase+MemPos_CodeSection), 294 pobj_DBDebugSection->pobj_now->BreakStepCodeBuffer,295 debugSectionCollection.GetCurrent().BreakStepCodeBuffer, 295 296 FileSize_CodeSection,&lpAccBytes); 296 297 … … 298 299 if(ImageBase+MemPos_CodeSection<=EIP_RIP(*pContext)&&EIP_RIP(*pContext)<ImageBase+MemPos_CodeSection+FileSize_CodeSection){ 299 300 if(OpBuffer[EIP_RIP(*pContext)-ImageBase-MemPos_CodeSection-1]!= 300 pobj_DBDebugSection->pobj_now->BreakStepCodeBuffer[EIP_RIP(*pContext)-ImageBase-MemPos_CodeSection-1]){301 debugSectionCollection.GetCurrent().BreakStepCodeBuffer[EIP_RIP(*pContext)-ImageBase-MemPos_CodeSection-1]){ 301 302 //直前のブレークポイントがユーザー指定によるものだったとき 302 303 … … 312 313 if(StepCursorObpSchedule==(int)(EIP_RIP(*pContext)-ImageBase-MemPos_CodeSection)){ 313 314 //カーソル行までのステップ実行の場合 314 pobj_DBDebugSection->pobj_now->BreakStepCodeBuffer[StepCursorObpSchedule]=StepCursor_BackupChar;315 debugSectionCollection.GetCurrent().BreakStepCodeBuffer[StepCursorObpSchedule]=StepCursor_BackupChar; 315 316 StepCursorObpSchedule=-1; 316 317 } … … 340 341 void Set_DebugSys_dwThreadID() 341 342 { 342 BOOST_FOREACH( CDebugSection *pDebugSection, pobj_DBDebugSection->debugSections )343 BOOST_FOREACH( DebugSection *pDebugSection, debugSectionCollection.debugSections ) 343 344 { 344 345 ULONG_PTR lpAccBytes; … … 483 484 484 485 485 //デバッグ情報データベースを生成486 pobj_DBDebugSection=new CDBDebugSection();487 488 486 //デバッグスレッド情報(プロシージャの階層構造を管理)を生成 489 487 pobj_dti=new CDebugThreadInfo(); … … 538 536 539 537 //可能であればデバッグ情報を読みとる 540 if( pobj_DBDebugSection->add((HMODULE)de.u.LoadDll.lpBaseOfDll)){541 pobj_DBDebugSection->choice(0);538 if(debugSectionCollection.add((HMODULE)de.u.LoadDll.lpBaseOfDll)){ 539 debugSectionCollection.choice(0); 542 540 Set_DebugSys_dwThreadID(); 543 541 } … … 553 551 //DLLのアンロード 554 552 555 pobj_DBDebugSection->del((HMODULE)de.u.UnloadDll.lpBaseOfDll);553 debugSectionCollection.del((HMODULE)de.u.UnloadDll.lpBaseOfDll); 556 554 } 557 555 else if(de.dwDebugEventCode==CREATE_PROCESS_DEBUG_EVENT){ … … 559 557 hMainThread=de.u.CreateProcessInfo.hThread; 560 558 561 if( pobj_DBDebugSection->add((HMODULE)de.u.CreateProcessInfo.lpBaseOfImage)){562 pobj_DBDebugSection->choice(0);559 if(debugSectionCollection.add((HMODULE)de.u.CreateProcessInfo.lpBaseOfImage)){ 560 debugSectionCollection.choice(0); 563 561 } 564 562 … … 716 714 //シングルステップON 717 715 WriteProcessMemory(hDebugProcess,(void *)(ULONG_PTR)(ImageBase+MemPos_CodeSection), 718 pobj_DBDebugSection->pobj_now->SingleStepCodeBuffer,716 debugSectionCollection.GetCurrent().SingleStepCodeBuffer, 719 717 FileSize_CodeSection,&lpAccBytes); 720 718 … … 754 752 WriteProcessMemory(hDebugProcess, 755 753 (void *)(ULONG_PTR)(ImageBase+MemPos_CodeSection), 756 pobj_DBDebugSection->pobj_now->SingleStepCodeBuffer,754 debugSectionCollection.GetCurrent().SingleStepCodeBuffer, 757 755 GlobalOpBufferSize, 758 756 &lpAccBytes); … … 765 763 WriteProcessMemory(hDebugProcess, 766 764 (void *)rva_to_real(pUserProc->GetBeginOpAddress()), 767 pobj_DBDebugSection->pobj_now->SingleStepCodeBuffer+pUserProc->GetBeginOpAddress(),765 debugSectionCollection.GetCurrent().SingleStepCodeBuffer+pUserProc->GetBeginOpAddress(), 768 766 pUserProc->GetEndOpAddress()-pUserProc->GetBeginOpAddress(), 769 767 &lpAccBytes); … … 812 810 if(hDebugWnd) SendMessage(hDebugWnd,WM_COMMAND,IDCANCEL,0); 813 811 814 //デバッグに利用した情報を解放815 delete pobj_DBDebugSection;816 817 812 //デバッグスレッド情報を解放 818 813 delete pobj_dti; -
trunk/ab5.0/abdev/BasicCompiler_Common/DebugMiddleFile.cpp
r740 r741 44 44 45 45 46 CDebugSection::~CDebugSection(){46 DebugSection::~DebugSection(){ 47 47 if(dwImageBase) DeleteDebugInfo(); 48 48 if(buffer){ … … 51 51 } 52 52 } 53 void CDebugSection::make(void){53 void DebugSection::make(void){ 54 54 int i2,BufferSize; 55 55 … … 168 168 } 169 169 170 char * CDebugSection::MakeSingleStepCode(void){170 char *DebugSection::MakeSingleStepCode(void){ 171 171 char *buffer; 172 172 buffer=(char *)HeapAlloc(hHeap,0,SizeOf_CodeSection); … … 187 187 return buffer; 188 188 } 189 BOOL CDebugSection::__load(void){189 BOOL DebugSection::__load(void){ 190 190 int i2,i3; 191 191 … … 311 311 } 312 312 313 BOOL CDebugSection::load(HMODULE hModule){313 BOOL DebugSection::load(HMODULE hModule){ 314 314 if(buffer){ 315 315 HeapDefaultFree(buffer); … … 389 389 } 390 390 391 void CDebugSection::choice(void){391 void DebugSection::choice(void){ 392 392 //イメージベース 393 393 extern DWORD ImageBase; … … 423 423 } 424 424 425 void CDebugSection::DeleteDebugInfo(void){425 void DebugSection::DeleteDebugInfo(void){ 426 426 //コードバッファを解放 427 427 free(OpBuffer); … … 437 437 438 438 439 CDBDebugSection::CDBDebugSection()439 DebugSectionCollection::DebugSectionCollection() 440 440 { 441 441 } 442 CDBDebugSection::~CDBDebugSection()442 DebugSectionCollection::~DebugSectionCollection() 443 443 { 444 BOOST_FOREACH( CDebugSection *pDebugSection, debugSections )444 BOOST_FOREACH( DebugSection *pDebugSection, debugSections ) 445 445 { 446 446 delete pDebugSection; … … 449 449 } 450 450 451 BOOL CDBDebugSection::add(HMODULE hModule){452 CDebugSection *pobj_d;453 pobj_d=new CDebugSection();451 BOOL DebugSectionCollection::add(HMODULE hModule){ 452 DebugSection *pobj_d; 453 pobj_d=new DebugSection(); 454 454 if(!pobj_d->load(hModule)){ 455 455 //デバッグ情報が存在しないとき … … 463 463 } 464 464 465 void CDBDebugSection::del(HMODULE hModule){465 void DebugSectionCollection::del(HMODULE hModule){ 466 466 for( int i=0; i<static_cast<int>(this->debugSections.size()); i++ ) 467 467 { … … 469 469 { 470 470 delete debugSections[i]; 471 Jenga::Common::EraseVectorItem<std::vector< CDebugSection *>>( debugSections, i );471 Jenga::Common::EraseVectorItem<std::vector<DebugSection *>>( debugSections, i ); 472 472 break; 473 473 } … … 475 475 } 476 476 477 void CDBDebugSection::choice( int index )477 void DebugSectionCollection::choice( int index ) 478 478 { 479 pobj_now = debugSections[index]; 480 pobj_now->choice(); 481 } 482 483 484 485 CDBDebugSection *pobj_DBDebugSection; 479 pCurrent = debugSections[index]; 480 pCurrent->choice(); 481 } -
trunk/ab5.0/abdev/BasicCompiler_Common/DebugSection.h
r740 r741 1 1 #pragma once 2 2 3 class CDebugSection{3 class DebugSection{ 4 4 public: 5 5 char szNowFilePath[MAX_PATH]; … … 49 49 50 50 51 CDebugSection()51 DebugSection() 52 52 : buffer( NULL ) 53 53 , length( 0 ) … … 64 64 szNowFilePath[0]=0; 65 65 } 66 ~ CDebugSection();66 ~DebugSection(); 67 67 68 68 void make(void); … … 79 79 }; 80 80 81 class CDBDebugSection{ 81 class DebugSectionCollection{ 82 DebugSection *pCurrent; 82 83 public: 83 std::vector< CDebugSection *> debugSections;84 std::vector<DebugSection *> debugSections; 84 85 85 CDebugSection *pobj_now; 86 87 CDBDebugSection(); 88 ~CDBDebugSection(); 86 DebugSectionCollection(); 87 ~DebugSectionCollection(); 89 88 90 89 BOOL add(HMODULE hModule); … … 93 92 void choice(int index); 94 93 94 DebugSection &GetCurrent() 95 { 96 MyAssert( pCurrent != NULL ); 97 return *pCurrent; 98 } 95 99 }; 96 97 extern CDBDebugSection *pobj_DBDebugSection; -
trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp
r710 r741 853 853 854 854 //デバッグセクションを生成 855 CDebugSection *pobj_DebugSection;856 pobj_DebugSection=new CDebugSection();855 DebugSection *pobj_DebugSection; 856 pobj_DebugSection=new DebugSection(); 857 857 if( compiler.IsDebug() && !compiler.errorMessenger.HasError() ) 858 858 {
Note:
See TracChangeset
for help on using the changeset viewer.