Beispiel #1
0
 public void fCppAstEnd(LaunchTool _oLaunch)
 {
     /*
      * this.BeginInvoke((MethodInvoker)delegate {
      *                      fGitCloneEnd();
      *       });*/
 }
Beispiel #2
0
        public void    fAppError(LaunchTool _oTool, string _sOut)
        {
            //E> Function "GDB_Func_Break" not defined.
            if (_sOut.IndexOf("Function \"GDB_Func_Break\" not defined") != -1)
            {
                Output.TraceActionLite("Tips: To have in-code GDB break, add this function: extern \"C\" void GDB_Func_Break(){}");
                return;
            }
            if (_sOut.IndexOf("Function \"GDB_Func_ExecuteCmds\" not defined") != -1)
            {
                Output.TraceActionLite("Tips: To have in-code GDB command-line, add this function: extern \"C\" void GDB_Func_ExecuteCmds(){}\nSend command like this: fprintf(stderr,\"Cmd[GDB]:yourCmd\")");
                return;
            }


            // bRunning= false;
            oLaunchProject.bReceiveOutput = true;
            // bCmdSend = false;//Proble occur, we can resend cmd
            if (bCmdSend)
            {
                if (fTestEndOfCommand(_sOut)) //Or just check resutl?
                {
                    return;
                }
                else
                {
                    _sOut = sCurrentCmd;
                }
            }

            Output.ProcessStdErr(_sOut);


            // Output.Trace("E> " + _sOut);
        }
Beispiel #3
0
        //private  LaunchTool oLaunchCmd = null;

        public void fLaunchConsoleCmd(string sCurrentCmd)
        {
            ///// CURRENT APP Launch
            if (Data.oLaunchProject.oCurLaunch != null)
            {
                oCurLaunch.fSend(sCurrentCmd);
                Debug.fPrint("");
                return;
            }

            ///// CONSOLE Launch
            if (sCurrentCmd.Trim() == "")
            {
                fConsoleExit(null);
                return;
            }

            oCurLaunch = new LaunchTool();
            //      _oLaunchUrl.bWaitEndForOutput = true;
            oCurLaunch.bRedirectOutput = false; //Important
            // _oLaunchUrl.bRunInThread = false;

            oCurLaunch.dOut   = new LaunchTool.dIOut(fConsoleOut);
            oCurLaunch.dError = new LaunchTool.dIError(fConsoleOut);
            oCurLaunch.dExit  = new LaunchTool.dIExit(fConsoleExit);
            // _oLaunchUrl. = true;

            Debug.fPrint("");

            oCurLaunch.fLaunchExe("cmd.exe", "/C " + sCurrentCmd);
        }
Beispiel #4
0
        public static void      fUrlRequestComplete(LaunchTool _oTool)
        {
            ParamHttp _oParam = (ParamHttp)_oTool.oCustom;

            //Console.WriteLine("------------------ Finish :\n"  +_oParam.sURL );

            //Console.WriteLine( _oParam.sResult );
            //Console.WriteLine("" );
            //Console.WriteLine("------------------" );
            if (_oParam.bDownloadFile)
            {
                if (_oParam.nTotalBytes > 0)
                {
                    _oParam.nBytes = _oParam.nTotalBytes;
                }
                else
                {
                    _oParam.nBytes *= 1.5;             //Boost gain
                }
                fUrlProgress(_oParam);                 //100%
                Output.TraceGood("Downloaded: " + _oParam.sToFile);
            }

            ///if(!_oParam.bDownloadFile) {
            _oParam.dComplete(_oParam);
            //}
        }
Beispiel #5
0
        public static void      fHttpOut(LaunchTool _oTool, string _sOut)
        {
            ParamHttp _oParam = (ParamHttp)_oTool.oCustom;

            _oParam.sResult += _sOut;
            //	Debug.fTrace(": " + _sOut);

            //	_oParam.oHeader = _response.Headers;
        }
Beispiel #6
0
 public void    fExit(LaunchTool _oTool)
 {
     if (Data.oLaunchProject.oCurLaunch != null)
     {
         Output.TraceError("Exit: " + _oTool.sExeName);
         Data.oLaunchProject.oCurLaunch = null;
         Build.EndExecution();
     }
 }
Beispiel #7
0
        public void fLaunchEnd()
        {
            /*
             *          if(oMainForm!= null) {
             *                  oMainForm.fLaunchEnd();
             *          }*/

            oCurLaunch = null;
        }
Beispiel #8
0
        /// <summary>
        /// The constructor requires a reference to the process that will be read.
        /// The process should have .RedirectStandardOutput and .RedirectStandardError set to true.
        /// </summary>
        /// <param name="process">The process that will have its output read by this class.</param>
        public ProcessOutputHandler(LaunchTool _oTool)
        {
            oTool = _oTool;
            proc  = _oTool.ExeProcess;

            StdErr = "";
            StdOut = "";
            //     Debug.Assert(proc.StartInfo.RedirectStandardError, "RedirectStandardError must be true to use ProcessOutputHandler.");
            //      Debug.Assert(proc.StartInfo.RedirectStandardOutput, "RedirectStandardOut must be true to use ProcessOutputHandler.");
        }
Beispiel #9
0
        public void fCompressionExit(LaunchTool _oTool)
        {
            //Output.TraceWarning("--!!!fCompressionExit!-----: " );
            bExtracting = false;
            fGetLastVersions();
            //   Output.TraceWarning("-#1: " );

            if (oForm != null)
            {
                oForm.fExtractProgress(100, "");
            }

            // Debug.fTrace("----------------------fCompressionExit : " );

            try {
                //Debug.fTrace("-Trydelete : " +  _oTool.sSourceFile);
                if (File.Exists(_oTool.sSourceFile))
                {
                    File.Delete(_oTool.sSourceFile);
                    // Debug.fTrace("-Deleted : " +  _oTool.sSourceFile);
                }
            }catch (Exception Ex) {
                Output.TraceError("--Error: " + Ex.Message);
            }


            if (!fCheckForAutoExtractFiles(_oTool))
            {
                bExtact_InProgress = false;

                // Output.TraceGood("----- Complete All Sub Extraction ------ " );
                bSubExtract = false;

                if (oForm != null)
                {
                    oForm.fModuleFinish();
                }
            }
            else
            {
                Output.TraceGood("----- Complete " + _oTool.sSourceFile);
            }


            if (sName == "Cwc")
            {
                //Cwc update now!
                if (oForm != null)
                {
                    oForm.fExecuteUpdater(this);
                }
            }
        }
Beispiel #10
0
        public void  fConsoleOut(LaunchTool _oTool, string _sOut)
        {
            Debug.fPrint(_sOut);
            bReceiveOutput = true;

            //Debug.fPrint(_sOut );
            //Require answer

            /*
             * if (_sOut == "(gdb) (gdb)") {
             *  fConsoleExit(null);
             * }*/
        }
Beispiel #11
0
        public static void fGetHttp(ParamHttp _oParam)
        {
//if(_oParam.sURL[8] == 'a'){


            Console.WriteLine("------------------------fGetHttp : " + _oParam.sURL);


            //if(!_oParam.bDownloadFile) {
            if (true)
            {
                LaunchTool _oLaunchUrl = new LaunchTool();
                _oLaunchUrl.dOut   = new LaunchTool.dIOut(fHttpOut);
                _oLaunchUrl.dError = new LaunchTool.dIError(fHttpOutInfo);

                _oLaunchUrl.bHidden = true;
                _oLaunchUrl.dExit   = new LaunchTool.dIExit(fUrlRequestComplete);
                _oLaunchUrl.oCustom = (Object)_oParam;

                //_oLaunchUrl.bRunInThread = false;
                //_oLaunchUrl.bWaitEndForOutput = true;
                _oParam.sResult = "";

                //	_oLaunchUrl.fLaunchExe( PathHelper.ToolDir + "curl/curl.exe", "-i  -k -L  -A \"Cwc - app\" \"" + _oParam.sURL + "\"");
                //_oLaunchUrl.fLaunchExe( PathHelper.ToolDir + "curl/curl.exe", "--anyauth -f -i  -k -L  -A \"Cwc - app\" \"" + _oParam.sURL + "\"");
                //_oLaunchUrl.fLaunchExe( PathHelper.ToolDir + "wget/wget.exe", "--no-check-certificate -S -O - \"" + _oParam.sURL + "\"");
                if (!_oParam.bDownloadFile)
                {
                    _oLaunchUrl.fLaunchExe(PathHelper.ToolDir + "wget/wget.exe", "--no-check-certificate -S -O - \"" + _oParam.sURL + "\"");
                }
                else
                {
                    //    _oLaunchUrl.dOut += new LaunchTool.dIOut(fHttpConsole);
                    //  _oLaunchUrl.dError += new LaunchTool.dIError(fHttpConsole);

                    Console.WriteLine("------------------Download File !! ");
                    _oLaunchUrl.fLaunchExe(PathHelper.ToolDir + "wget/wget.exe", "--no-check-certificate -O \"" + _oParam.sToFile + "\" \"" + _oParam.sURL + "\"");
                }
                //
            }
            else
            {
                BackgroundWorker oWorkHttp;
                oWorkHttp = new BackgroundWorker();
                oWorkHttp.WorkerSupportsCancellation = true;
                oWorkHttp.DoWork             += new DoWorkEventHandler(fHttpRequestTagRelease);
                oWorkHttp.RunWorkerCompleted += new RunWorkerCompletedEventHandler(fHttpRequestComplete);
                oWorkHttp.RunWorkerAsync(_oParam);
            }
//}
        }
Beispiel #12
0
        internal static void fLaunchUpdate(string sCurrFolder, string _sVersion)
        {
            LaunchTool _oUpd = new LaunchTool();

            _oUpd.bOutput         = false;
            _oUpd.UseShellExecute = true;
            _oUpd.fLaunchExe(sCurrFolder + "cwc.exe", " -wCwcUpd " + PathHelper.GetExeDirectory() + " -wCwcVer " + _sVersion, "", "", true);
            //		Console.WriteLine("Update to ver "  +_sVersion );
            while (!_oUpd.bExeLaunched && Base.bAlive)
            {
                Thread.Sleep(1);
            }
            SysAPI.fQuit(true);
        }
Beispiel #13
0
        internal static void fRestart(string sCurrFolder)
        {
            LaunchTool _oUpd = new LaunchTool();

            _oUpd.bOutput         = false;
            _oUpd.UseShellExecute = true;
            //	_oUpd.fLaunchExe( sCurrFolder + "cwc.exe", "Updated ", "","",true);
            _oUpd.fLaunchExe(sCurrFolder + "cwc.exe", "-wCwcUpdated " + Data.sUpdateVer, "", "", true);
            //				_process.StartInfo.Arguments = "Updated " + _sVersion + " " + Data.sWorkDir + " " + Data.sResendArg;
            while (!_oUpd.bExeLaunched && Base.bAlive)
            {
                Thread.Sleep(1);
            }
            SysAPI.fQuit(true);
        }
Beispiel #14
0
        public void fExtractSevenZip(string zipFileName, string targetDir, string _sFullTargetDir, ModuleLink _oLink = null, object _oCustom = null)
        {
            //Debug.fPrint("-Extact : " + zipFileName);
            //    Output.TraceWarning("-Extact : " + zipFileName);

            LaunchTool _o7z = new LaunchTool();

            _o7z.oModule = _oLink;
            _o7z.oCustom = _oCustom;
            _o7z.dExit   = new LaunchTool.dIExit(fCompressionExit);
            _o7z.bHidden = true;
            _o7z.dOut    = fExtractOut;
            _o7z.dError  = fExtractOut;
            _o7z.fLaunchExe(PathHelper.ToolDir + "7z/7z.exe", "x \"" + zipFileName + "\"  -bsp2 -y -o\"" + targetDir + "\"", zipFileName, _sFullTargetDir, true);
        }
Beispiel #15
0
        public static void fAppError(LaunchTool _oThis, string _sOut)
        {
            // lock(Data.oLockError) {
            if (_oThis.dError != null)
            {
                _oThis.dError(_oThis, _sOut);
            }
            else
            {
                /*
                 * if(_sOut.Length > 3 && _sOut[3] == '%') {
                 * Console.Write( "\r\r" + _sOut.Substring(4,_sOut.Length-4) );
                 * }else { */
                Debug.fTrace(_sOut);
                // }
            }

            //}
        }
Beispiel #16
0
        public void fCppAstOut(LaunchTool _oThis, string _sOut)
        {
            if (_sOut == null)
            {
                return;
            }
            if (_sOut.Length > 7 && _sOut[0] == 'c' && _sOut[1] == 'w' && _sOut[2] == 'c')                //cwcAst:
            {
                if (_sOut == "cwcAst:Rdy")
                {
                    if (!oCppAstStarted)
                    {
                        oCppAstStarted = true;
                        fIsFinished();
                    }

                    fIdeSend("cwcAst:Rdy");     //ToDebug


                    //  MessageBox.Show("cwcAst:Rdy ");
                    oCppAst.fSend("*run|" + "E:/TestProjectFD/TestCw/src/HelloWorld.cpp|");

                    //	Debug.fTrace("---------------------------------YEAGH");
                }
                else
                {
                    //	 MessageBox.Show("FrromAstSend: "+  _sOut);
                    //  Debug.fTrace("cwc:OUT---- " + _sOut);
                    fIdeSend(_sOut);
                }
                //Debug.fTrace(_sOut + " lengt " + _sOut.Length.ToString());
            }
            else
            {
                fIdeSend("AA:" + _sOut);                 //ToDebug
            }


            //Debug.fTrace(_sOut);
            // this.BeginInvoke((MethodInvoker)delegate {

            //	 });
        }
Beispiel #17
0
        public void  fConsoleExit(LaunchTool _oTool)
        {
            if (_oTool != null)
            {
                bReceiveOutput = false;
                // Data.oLaunchProject.oCurLaunch = null;
                oCurLaunch = null;
            }

            string _sName = "Cmd";

            if (oCurLaunch != null)
            {
                _sName = oCurLaunch.sExeName;
            }

            Debug.fPrint("");
            Debug.fWPrint("(" + _sName + ")> ");
        }
Beispiel #18
0
        public bool fCheckForAutoExtractFiles(LaunchTool _oTool)
        {
            if (_oTool.oCustom == null)  //Not for sub extract items (Only master extact get auto sub extract)
            //Master!

            //   Debug.fTrace("Target: " + _oTool.sTarget );

            {
                aFileAutoExtract = Directory.GetFiles(_oTool.sTarget, "*.-ex", SearchOption.AllDirectories);     //**TODO _oTool.sTarget contain all libs version, todo optimise to the current extraction **
                nTotalExtract    = aFileAutoExtract.Length;
                nExtracted       = 0;

                Output.TraceWarning("SubFile to extract: " + nTotalExtract + "");

                //   foreach (string _sFile in _aFileAutoExtract) {


                //  }
            }
            else
            {
                nExtracted++;
                Output.TraceWarning("----- Complete " + _oTool.sSourceFile + " (" + nExtracted + "/" + nTotalExtract + ")");
            }
            if (nExtracted != nTotalExtract)
            {
                bSubExtract = true;
                string _sFile          = aFileAutoExtract[nExtracted];
                string _sFileDirectory = Path.GetDirectoryName(_sFile);
                sCurrentExtractFile = Path.GetFileName(_sFile);
                fExtractSevenZip(_sFile, _sFileDirectory, _sFileDirectory, _oTool.oModule, true);
            }


            //  bool  bLastOne = false;
            if (nExtracted == nTotalExtract)
            {
                return(false);
            }

            return(true);
        }
Beispiel #19
0
        public static string fDelocaliseExe(string _sPath)
        {
//fLaunchConsoleCmd("");



            LaunchTool _oSubCmd = new LaunchTool();

            _oSubCmd.dExit = new LaunchTool.dIExit(fDelocaliseEnd);

            _oSubCmd.bRedirectOutput = false;
            //_oSubCmd.bReturnBoth= true;
            _oSubCmd.bReturnError = true;
            //_oSubCmd.bRunInThread = false;
            _oSubCmd.bWaitEndForOutput = true;

            string sResult = _oSubCmd.fLaunchExe(_sPath, " @wDeloc ");

            _oSubCmd.fSend("Cwc:Launch by " + Data.MainProcess.Handle); //Remove "pause" bug ?

            while (_oSubCmd.bExeLaunch)
            {
                //Thread.Sleep(1);
                Thread.CurrentThread.Join(1);
            }
            sResult = _oSubCmd.sError;


            int _nBegin = sResult.IndexOf("wOut");

            if (_nBegin != -1)
            {
                sResult = sResult.Substring(_nBegin);
            }

            //	fDebug("!!RESULT!: " + sResult);
            //fDebug("-----------------------------: ");

            return(sResult);
        }
Beispiel #20
0
        public static void fAppOutput(LaunchTool _oThis, string _sOut)
        {
            //       lock(Data.oLockOutPut) {

            if (_oThis.dOut != null)
            {
                _oThis.dOut(_oThis, _sOut);
            }
            else
            {
                /*
                 * if(_sOut.Length > 3 && _sOut[3] == '%') {
                 * Console.Write( "\r\r" + _sOut.Substring(4,_sOut.Length-4) );
                 * }else { */
                lock (Debug.oLockOutPut) {                                       //???
                    Debug.fTrace(_sOut);
                }
                // }
            }

            // }
        }
Beispiel #21
0
        public void    fAppOut(LaunchTool _oTool, string _sOut)
        {
            //bRunning= false;
            if (_sOut == null || _sOut == "")
            {
                return;
            }

            //    Output.Trace("Test> "  +_sOut);


            oLaunchProject.bReceiveOutput = true;
            string _sColor = "";


            string _sLetter = "O";

            if (bCmdSend)
            {
                if (fTestEndOfCommand(_sOut))
                {
                    // fTestFrame(_sOut);
                    return;
                }
                else
                {
                    _sLetter = "C";
                    _sOut    = sCurrentCmd;
                }
            }


            //  if ( _sOut.StartsWith("Breakpoint") ) {
            if (_sOut.IndexOf("it Breakpoint ", 0) != -1)        //Hit breakpoint
            {
                if (_sOut.IndexOf("GDB_Func_ExecuteCmds") != -1) //Special function
                {
                    _sColor = Output.sGoodColorLite;
                    Output.Trace(_sLetter + "> " + _sColor + _sOut);
                    oProcess.fSend("Continue");
                    return;
                }
                _sColor = Output.sWarningColor;
                Output.Trace(_sLetter + "> " + _sColor + _sOut);
                fShowBacktrace();
                return;
            }

            //Thread 1 received signal SIGSEGV, Segmentation fault.
            //Program received signal SIGSEGV, Segmentation fault
            if (_sOut.IndexOf("received signal", 0) != -1)
            {
                _sColor = Output.sErrorColor;
                Output.Trace(_sLetter + "> " + _sColor + _sOut);
                fShowBacktrace();
                return;
            }


            Output.fPrjOut(_sLetter, _sColor + _sOut);
            if (nLimitNbOutput == -1)
            {
                Output.TraceError("Error: Output exceed Limit");
            }

            // Output.Trace(_sLetter + "> " +_sColor +_sOut);
        }
Beispiel #22
0
 public void    fAppOut(LaunchTool _oTool, string _sOut)
 {
     Output.fPrjOut("O", _sOut);
     bReceiveOutput = true;
 }
Beispiel #23
0
        public static void      fHttpOutInfo(LaunchTool _oTool, string _sOut)
        {
            ParamHttp _oParam = (ParamHttp)_oTool.oCustom;

            //_oParam.sResult = _sOut;
            _oParam.sInfo += _sOut + "\n";
            //_oParam
            //Debug.fTrace("E: " + _sOut);

            //"Length:"
            if (_oParam.bDownloadFile)
            {
                int _nLimit = -1;
                if (_sOut.Length > 7 && _sOut[0] == 'L' && _sOut[6] == ':')
                {
                    string _sLength = _sOut.Substring(8);
                    //Debug.fTrace("_sLength: " + _sLength);
                    string _sSubLength = _sLength;
                    int    _nEnd       = _sSubLength.IndexOf(' ');
                    if (_nEnd != -1)
                    {
                        _sSubLength = _sSubLength.Substring(0, _nEnd);
                    }

                    int.TryParse(_sSubLength, out _nLimit);
                    //	Debug.fTrace("--Total!! " + _nLimit);
                }
                _oParam.nTotalBytes = _nLimit;
                //	Debug.fTrace("--_sOut[_sOut.Length - 1 ]!! " + _sOut[_sOut.Length - 1 ]);
                if (_sOut[_sOut.Length - 1] == 's')
                {
                    int _nEnd = _sOut.IndexOf('K');
                    if (_nEnd != -1)
                    {
                        string _sBytes = _sOut.Substring(0, _nEnd);
                        int    _nByte  = -1;
                        int.TryParse(_sBytes, out _nByte);
                        _oParam.nBytes = _nByte * 1000;
                        //	Debug.fTrace("--nBytes!! " + _oParam.nBytes);
                        fUrlProgress(_oParam);
                    }
                }

                // if(Data.oGuiConsole != null){ Data.oGuiConsole.Fctb.RemoveLines(aLineToDelete); aLineToDelete.Clear();}
                _sOut = _sOut.Trim();
                if (_sOut != "")
                {
                    if (_sOut.IndexOf("Cannot") >= 0 || _sOut.IndexOf("Bad") >= 0)
                    {
                        Output.TraceError("\rDownload: " + _sOut);
                    }
                    else
                    {
                        Output.TraceAction("\rDownload: " + _sOut);
                    }
                }

                // if(Data.oGuiConsole != null){ aLineToDelete.Add( Data.oGuiConsole.Fctb.LinesCount-1); }

                Debug.fRPrint("Download: " + _sOut + "                                                                                                 ");
            }
            ////	_oParam.oHeader = _response.Headers;
        }
Beispiel #24
0
 public void    fAppError(LaunchTool _oTool, string _sOut)
 {
     Output.ProcessStdErr(_sOut);
     bReceiveOutput = true;
 }
Beispiel #25
0
        public void fExtractOut(LaunchTool _oThis, string _sMsg)
        {
            //Debug.fTrace(_sOut);
            if (!FileUtils.IsEmpty(_sMsg))
            {
                string[] _aResult = _sMsg.Split('\n');
                bool     _bError  = false;
                bool     _bGood   = false;
                if (_sMsg.IndexOf("Can not") >= 0 || _sMsg.IndexOf("Can't") >= 0 || _sMsg.IndexOf("Unexpected") >= 0 || _sMsg.IndexOf("ERROR") >= 0 || _sMsg.IndexOf("Error ") >= 0 || _sMsg.IndexOf("Error:") >= 0)
                {
                    _bError = true;
                    //  Output.TraceError( "--- [" + _oThis.sArg + "] ---"   );
                }
                else if (_sMsg.IndexOf("Everything is Ok") >= 0)
                {
                    _bGood = true;
                }

                foreach (string _sOutput in _aResult)
                {
                    string _sOut = _sOutput.Trim();
                    if (_sOut == "")
                    {
                        continue;
                    }

                    Debug.fRPrint("Extract: " + _sOut + "                                                                                             ");

                    if (_bGood)
                    {
                        Output.TraceGood(_sOut);
                    }
                    else if (_bError)
                    {
                        Output.TraceError(_sOut);
                    }
                    else
                    {
                        Output.TraceWarning("\rExtract[" + _oThis.oModule.sName + "]: " + _sOut);
                    }

                    if (_sOut.IndexOf("Extracting") != -1)
                    {
                        bExtracting = true;
                    }
                    else if (bExtracting)
                    {
                        string [] _aExtInfo = _sOut.Split('%');
                        if (_aExtInfo.Length >= 2)
                        {
                            string _sNumber = _aExtInfo[0].Trim();
                            int    _nValue  = 0;
                            //Debug.fTrace("TryParce: " + _sNumber);
                            if (Int32.TryParse(_sNumber, out _nValue))
                            {
                                if (oForm != null)
                                {
                                    oForm.fExtractProgress(_nValue, _aExtInfo[1]);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #26
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);
        }
Beispiel #27
0
 public static void      fDelocaliseEnd(LaunchTool _oTool)
 {
     Debug.fTrace("fDelocaliseEnd--------");
 }
Beispiel #28
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();
        }