예제 #1
0
        public bool fLaunch(string _sPath, bool _bSanitize = false, string _sSubArg = "")
        {
            if (_sPath.Length > 1 && _sPath[_sPath.Length - 1] == '/') //Not a file
            {
                Output.TraceError("Path is not a File: " + _sPath);
                return(false);
            }
            //   Output.TraceError("Try: " + _sPath);

            bool _bDebug       = true;//Temp
            bool _bLaunchDebug = false;

            if (_bDebug)
            {
                _bLaunchDebug = true;
            }



            //	Debug.fTrace("Launch: " + _sPath);



            // if (oCurLaunch == null) { //We can reLaunch !? => Run button
            if (File.Exists(_sPath))
            {
                if (Data.oGuiConsole != null)
                {
                    Data.oGuiConsole.fLaunchPrj();
                }


                oCurLaunch = new LaunchTool();

                //oCurLaunch.bWaitEndForOutput = true;
                //	oCurLaunch.bRunInThread = false;

                oCurLaunch.bRedirectOutput = false;


                string _sArg     = "";
                string _sExePath = _sPath;
                if (Data.fGetGlobalVar("_sPlatform") == "Web_Emsc")
                {
                    _bDebug = false;     // No GDB
                    oCurLaunch.bRedirectOutput = true;
                    oCurLaunch.bHidden         = true;
                    oCurLaunch.UseShellExecute = true;


                    //	bWeb = true;
                    //	bSanitize = false;
                    string _sBrowser = Data.fGetViewIn();
                    _sArg = "\"" + Data.fGetGlobalVar("vWebRT_Emsc") + "emrun\" ";
                    //_sArg +=  "--serve_after_close ";
                    //_sArg +=  "--serve_after_exit ";

                    _sArg += "--browser \"" + _sBrowser + "\" ";
                    //_sArg +=  "--kill_exit ";
                    //sArg +=  "--kill_start ";

                    _sArg += "\"" + _sExePath + "\" ";


                    _sExePath = Data.fGetGlobalVar("vWebRT_Python") + "python.exe";

                    //_sWorkPath = _sExePath;

                    //	public
                }
                else
                {
                    //Normal
                    //	oCurLaunch.bDontKill = true;
                    //oCurLaunch.UseShellExecute = false;
                }

                _sArg += _sSubArg;
                _sArg  = _sArg.Trim();
                //Output.TraceWarning("_sSubArg " + _sSubArg);

                oCurLaunch.dError = new LaunchTool.dIError(fAppError); //Too much error in Emsc?
                oCurLaunch.dOut   = new LaunchTool.dIOut(fAppOut);

                oCurLaunch.dExit = new LaunchTool.dIExit(fExit);

                string _sPrintArg = "";
                if (_sArg != "")
                {
                    _sPrintArg = " [" + _sExePath + " " + _sArg + "]";
                }



                if (_bLaunchDebug)
                {
                    Output.TraceAction("Debug: " + _sPath + _sPrintArg);
                }
                else
                {
                    Output.TraceAction("Run: " + _sPath + _sPrintArg);
                }

                if (_bDebug)
                {
                    //Better way?
                    string       _sCompiler = Data.fGetGlobalVar("_wToolchain");
                    string       _sPlatform = Data.fGetGlobalVar("_sConfig_Type");
                    CompilerData _oCompiler = Finder.fUseCompiler(_sCompiler, _sPlatform);
                    string       _sDebugger = _oCompiler.oGblConfigType.fGetNode(null, new string[] { "Exe", "Debugger" }, "");
                    GDB          _oGdb      = new GDB(this, oCurLaunch, _sDebugger, _sExePath, _oCompiler, _sArg); //Create debugger proxy
                }
                else
                {
                    oCurLaunch.fLaunchExe(_sExePath, _sArg);
                }


                //_oPreload.dExit = new LaunchTool.dIExit(fUrlRequestComplete);
                //	Output.TraceWarning("------------------------");

/*
 *                  oCurLaunch.oForm = this;
 *                  oCurLaunch.bSanitize = _bSanitize;
 *                  oCurLaunch.fLaunchExe(_sPath);
 */

                return(true);
            }
            else
            {
                Output.TraceError("Executable not found: " + _sPath);
            }
            //      }
            return(false);
        }
예제 #2
0
        public GDB(LaunchProject _oLaunchProject, LaunchTool _oProcess, string _sGdbPath, string _sExePath, CompilerData _oCompiler, string _sSubArg = "")
        {
            nLimitNbOutput = LIMIT_OUTPUT;
            singleton      = this;

            if (_sSubArg != "")
            {
                _sSubArg = " " + _sSubArg;
            }


            oLaunchProject = _oLaunchProject;
            oProcess       = _oProcess;

            oProcess.dOut   = new LaunchTool.dIOut(fAppOut);
            oProcess.dError = new LaunchTool.dIError(fAppError);

            oProcess.bHidden         = true;
            oProcess.bRedirectOutput = true; //DBG assole in !bRedirectOutput

            oProcess.sWorkPath = Path.GetDirectoryName(_sExePath);
            //Output.TraceAction("Dir: " +  oProcess.sWorkPath );


            //oProcess.fLaunchExe(_sGdbPath, "--args " + _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer + " " + " -exit_code_if_errors 1 -malloc_callstacks -no_soft_kills   -no_soft_kills  -pause_at_exit  -batch -crash_at_unaddressable -crash_at_error " + _sExePath   );

            bool _bSanitize = true;

            //bool _bSanitize = false;

            if (Data.fIsDataTrue("Options/Debug Type/Sanitizer"))
            {
                //if(_bSanitize) {
                //oProcess.bExterneLaunch = false;
                //  oProcess.bHidden = false;
                //     oProcess.bRedirectOutput = false;
                // oProcess.fLaunchExe(_sGdbPath, "--args " + _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer + " " + " -v -exit_code_if_errors 1 -malloc_callstacks -no_soft_kills -batch -pause_at_exit " + _sExePath   );
                // oProcess.fLaunchExe( _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer,  " -v -exit_code_if_errors 1 -malloc_callstacks -no_soft_kills -batch -pause_at_exit " + _sExePath   );


                string _sSanitizer = _oCompiler.oGblConfigType.fGetNode(null, new string[] { "Exe", "Sanitizer" }, "");

                // oProcess.fLaunchExe( _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer,  " -no_callstack_use_fp   -no_callstack_use_top_fp  -v -exit_code_if_errors 1 -malloc_callstacks  -batch " + _sExePath   ); //-no_soft_kills
                oProcess.fLaunchExe(_sSanitizer, " -no_callstack_use_fp   -no_callstack_use_top_fp  -v -exit_code_if_errors 1 -malloc_callstacks  -batch " + _sExePath + _sSubArg);       //-no_soft_kills

                return;
            }
            else                                                                           //   if(Data.fIsDataTrue("Options/Debug Type/Debugger") ){
            {
                oProcess.fLaunchExe(_sGdbPath, "--args \"" + _sExePath + "\"" + _sSubArg); //GDB only
            }

            fLoadBreakpoints();

            /*
             *
             * To enter non-stop mode, use this sequence of commands before you run or attach to your program:
             *
             # Enable the async interface.
             # set target-async 1
             #
             # If using the CLI, pagination breaks non-stop.
             # set pagination off
             #
             # Finally, turn it on!
             # set non-stop on
             #
             * */

            // oProcess.fSend("set target-async 1");
            //  oProcess.fSend("set pagination off");
            //  oProcess.fSend("set non-stop on");


            oProcess.fSend("cd " + Path.GetDirectoryName(_sExePath));

            oProcess.fSend("set width 0");
            oProcess.fSend("set filename-display absolute");
            oProcess.fSend("set breakpoint pending on");
            oProcess.fSend("break GDB_Func_Break");
            oProcess.fSend("break GDB_Func_ExecuteCmds");

            // oProcess.fSend("set output-radix 16");//All in hex?



            fSetAllGdbBreakpoint();


            //oProcess.fSend("set new-console on");



            // oProcess.fSend("tbreak main");

            //oProcess.fSend("break _start");  //Entry point: 0x4014a0
            //oProcess.fSend("set backtrace past-entry on");

            /*
             * oProcess.fSend("info files");  //Entry point: 0x4014a0
             * oProcess.fSend("break *0x4014a0");
             * oProcess.fSend("show backtrace past-entry");
             */

            oProcess.fSend("run");  bRunning = true;
            //    oProcess.bRedirectOutput = false;
            //   oProcess.processStartInfo.RedirectStandardInput = false;Ok

            Start();
        }