Ignore:
Timestamp:
Mar 27, 2008, 2:29:35 AM (16 years ago)
Author:
dai_9181
Message:

いくつかのグローバル変数をProgram/Debuggerクラスにまとめた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp

    r455 r467  
    377377void DebugProgram(void){
    378378    extern HWND hMainDlg;
    379     extern char OutputFileName[MAX_PATH];
    380379    extern DWORD ImageBase;
    381380    extern int MemPos_CodeSection;
     
    419418
    420419
    421     extern BOOL bAttach;
    422     if(bAttach){
    423         extern DWORD dwAttachProcessId;
    424 
     420    // デバッグをスタート
     421    debugger.DebugStart();
     422
     423
     424    if( program.IsAttach() )
     425    {
    425426        //プロセスIDを元にハンドルを取得
    426427        HANDLE hProcess;
    427         hProcess=OpenProcess(PROCESS_ALL_ACCESS,0,dwAttachProcessId);
     428        hProcess=OpenProcess(PROCESS_ALL_ACCESS,0, program.GetAttachProcessId() );
    428429        if(!hProcess) goto AttachError;
    429430
     
    434435
    435436        //実行ファイル名を取得
    436         GetModuleFileNameEx(hProcess,hModule,OutputFileName,MAX_PATH);
     437        char tempOutputFileName[MAX_PATH];
     438        GetModuleFileNameEx(hProcess,hModule,tempOutputFileName,MAX_PATH);
     439        program.SetOutputFilePath( tempOutputFileName );
    437440
    438441        CloseHandle(hProcess);
     
    440443/*
    441444        //デバッグ用の拡張情報を取得
    442         pobj_DebugSection->load(OutputFileName);*/
    443 
    444         if(!DebugActiveProcess(dwAttachProcessId)){
     445        pobj_DebugSection->load(program.GetOutputFilePath().c_str());*/
     446
     447        if(!DebugActiveProcess( program.GetAttachProcessId() )){
    445448AttachError:
    446449            DebugMessage("アタッチに失敗しました。");
     
    449452    }
    450453    else{
    451         /*if(!pobj_DebugSection->load(OutputFileName)){
     454        /*if(!pobj_DebugSection->load(program.GetOutputFilePath().c_str())){
    452455            extern BOOL bDebugCompile;
    453456            bDebugCompile=1;
    454457            OutputExe();
    455             pobj_DebugSection->load(OutputFileName);
     458            pobj_DebugSection->load(program.GetOutputFilePath().c_str());
    456459        }*/
    457460
     
    464467        if( !compiler.IsDll() ){
    465468            //EXEファイルをデバッグ
    466             CreateProcess(OutputFileName,szDebugCmdLine,NULL,NULL,0,NORMAL_PRIORITY_CLASS|DEBUG_ONLY_THIS_PROCESS|CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi);
     469            CreateProcess(program.GetOutputFilePath().c_str(),szDebugCmdLine,NULL,NULL,0,NORMAL_PRIORITY_CLASS|DEBUG_ONLY_THIS_PROCESS|CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi);
    467470        }
    468471        else{
     
    537540
    538541
    539             /*if(lstrcmpi(temporary, OutputFileName)==0){
     542            /*if(lstrcmpi(temporary, program.GetOutputFilePath().c_str())==0){
    540543                ImageBase=(DWORD)de.u.LoadDll.lpBaseOfDll;
    541544
     
    817820    SetDlgItemText(hMainDlg,IDOK,STRING_CLOSE);
    818821
     822    debugger.FinishDebug();
     823
    819824    SendMessage(hOwnerEditor,WM_DESTROYDEBUGGERBASE,0,0);
    820825}
Note: See TracChangeset for help on using the changeset viewer.