- make sysreg compilable under Linux
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sat, 13 Jan 2007 12:19:56 +0000 (12:19 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sat, 13 Jan 2007 12:19:56 +0000 (12:19 +0000)
- sysreg is now able to start the emulator but it cannot get any debug data yet. But this might be due that i tested sysreg in linux under vmware which then ran qemu....

svn path=/trunk/; revision=25437

reactos/tools/sysreg/os_support.cpp
reactos/tools/sysreg/os_support.h
reactos/tools/sysreg/pipe_reader.cpp
reactos/tools/sysreg/rosboot_test.cpp
reactos/tools/sysreg/sysreg.cpp
reactos/tools/sysreg/sysreg.mak
reactos/tools/sysreg/txtmode.cfg

index 13828e8..15fa570 100644 (file)
@@ -57,7 +57,7 @@ namespace System_
                free(command);
                return pid;
        }
-#elif defined (__LINUX__)
+#else
 /********************************************************************************************************************/
        OsSupport::ProcessID OsSupport::createProcess(TCHAR *procname, int procargsnum, TCHAR **procargs)
        {
@@ -66,11 +66,24 @@ namespace System_
                if ((pid = fork()) < 0)
                {
                        cerr << "OsSupport::createProcess> fork failed" << endl;
-                       return pid;
+                       return 0;
                }
+               if (pid == 0)
+               {
+                       execv(procname, procargs);
+                       return 0;
+               }
+               
+               return pid;
+       }
 
+       bool OsSupport::terminateProcess(OsSupport::ProcessID pid)
+       {
+               kill(pid, SIGKILL);
+               return true;
        }
 
+
 #endif
 
 } // end of namespace System_
index 3f63ae4..af046f6 100644 (file)
  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
  */
 
-#ifdef WIN32
+#if 0
 #include <windows.h>
-#elif defined(__LINUX__)
+#else
 #include <unistd.h>
+#include <sys/types.h>
+#include <signal.h>
 #endif
 
 #include "user_types.h"
@@ -34,14 +36,10 @@ namespace System_
 #ifdef WIN32
 
                typedef DWORD ProcessID;
-
-#elif defined(__LINUX__)
+#else
 
                typedef pid_t ProcessID;
-
-#else
-#error you need to define pid handle type for your platform
-#endif
+               #endif
 
 //---------------------------------------------------------------------------------------
 ///
index 8e7d588..88de72e 100644 (file)
@@ -36,7 +36,7 @@ namespace System_
                        return false;
                }
                // 
-               m_File = _tpopen(PipeCmd.c_str(), AccessMode.c_str());
+               m_File = popen(PipeCmd.c_str(), "r"); //AccessMode.c_str());
                if (m_File)
                {
                        cerr << "PipeReader::openPipe> successfully opened pipe" << endl;
@@ -57,7 +57,7 @@ namespace System_
                        return false;
                }
 
-               int res = _pclose(m_File);
+               int res = pclose(m_File);
                
                if (res == INT_MAX)
                {
index c6dd8aa..19f0326 100644 (file)
@@ -11,8 +11,8 @@
 
 #include "rosboot_test.h"
 #include "pipe_reader.h"
-#include "namedpipe_reader.h"
-#include "sym_file.h"
+//#include "namedpipe_reader.h"
+//#include "sym_file.h"
 #include "file_reader.h"
 #include "os_support.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <math.h>
  
-
+                       
 namespace Sysreg_
 {
        using std::vector;
        using System_::PipeReader;
+#if 0
        using System_::NamedPipeReader;
        using System_::SymbolFile;
+#endif
        using System_::FileReader;
        using System_::OsSupport;
 
@@ -93,7 +96,8 @@ namespace Sysreg_
                {
                        TCHAR * stop;
                        m_Timeout = _tcstod(timeout.c_str (), &stop);
-                       if (_isnan(m_Timeout) || m_Timeout == 0.0)
+
+                       if (isnan(m_Timeout) || m_Timeout == 0.0)
                        {
                                cerr << "Warning: overriding timeout with default of 60 sec" << endl;
                                m_Timeout = 60.0;
@@ -289,10 +293,10 @@ namespace Sysreg_
                                ///
                                string result;
                                result.reserve (200);
-
+#if 0
                                SymbolFile::resolveAddress (modulename, address, result);
                                cerr << result << endl;
-                               
+#endif                         
                                ///
                                /// TODO
                                ///
@@ -338,17 +342,18 @@ namespace Sysreg_
 //---------------------------------------------------------------------------------------
        bool RosBootTest::fetchDebugByPipe(string boot_cmd)
        {
-               NamedPipeReader namedpipe_reader;
                string pipecmd = _T("");
+               bool ret = true;
                
                ///
                /// FIXME
                /// split up arguments
 
                OsSupport::ProcessID pid = OsSupport::createProcess ((TCHAR*)boot_cmd.c_str (), 0, NULL); 
-
+#if 0          
                string::size_type pipe_pos = boot_cmd.find (_T("serial pipe:"));
 
+               NamedPipeReader namedpipe_reader;
                if (pipe_pos != string::npos)
                {
                        pipe_pos += 12;
@@ -371,7 +376,7 @@ namespace Sysreg_
                        /// delay reading until emulator is ready
                        ///
 
-                       _sleep( (clock_t)m_Delayread * CLOCKS_PER_SEC );
+                       sleep( (clock_t)m_Delayread * CLOCKS_PER_SEC );
                }
 
                if (!namedpipe_reader.openPipe(pipecmd))
@@ -382,7 +387,6 @@ namespace Sysreg_
                string Buffer;
                Buffer.reserve (500);
 
-               bool ret = true;
                vector<string> vect;
                size_t lines = 0;
                bool write_log;
@@ -436,7 +440,7 @@ namespace Sysreg_
                }
                _sleep(3* CLOCKS_PER_SEC);
                OsSupport::terminateProcess (pid);
-
+#endif
                return ret;
        }
 //---------------------------------------------------------------------------------------
@@ -457,7 +461,7 @@ namespace Sysreg_
                        /// delay reading until emulator is ready
                        ///
 
-                       _sleep( (clock_t)m_Delayread * CLOCKS_PER_SEC );
+                       sleep( (clock_t)m_Delayread * CLOCKS_PER_SEC );
                }
 
                OsSupport::ProcessID pid = 0;
index e36c2e4..0d4fde4 100644 (file)
@@ -20,7 +20,9 @@ using Sysreg_::ConfigParser;
 using Sysreg_::RegressionTest;
 using Sysreg_::RosBootTest;
 
+#if 0
 using System_::SymbolFile;
+#endif
 
 typedef ComponentFactoryTemplate<RegressionTest, string> ComponentFactory;
 
@@ -87,9 +89,9 @@ int _tmain(int argc, TCHAR * argv[])
        string envvar;
        string ros = _T("ROS_OUTPUT");
        config.getStringValue (ros, envvar);
-
+#if 0
        SymbolFile::initialize (config, envvar);
-       
+#endif 
        if (regtest->execute (config))
        {
                cout << "The regression test " << regtest->getName () << " completed successfully" << endl;
index 3fcc89a..ee36f7f 100644 (file)
@@ -22,9 +22,7 @@ SYSREGBUILD_SOURCES = $(addprefix $(SYSREGBUILD_BASE_),\
        conf_parser.cpp \
        env_var.cpp \
        pipe_reader.cpp \
-       namedpipe_reader.cpp \
        rosboot_test.cpp \
-       sym_file.cpp \
        sysreg.cpp \
        file_reader.cpp \
        os_support.cpp \
index b136391..672ff7d 100644 (file)
@@ -27,7 +27,9 @@ ROS_ADDR2LINE=addr2line.exe --exe=
 ; This value is the command which is executed to gain debugging data
 ; this value is mandatory
 
-ROSBOOT_CMD=D:\reactos\qemu\qemu.exe -serial pipe:qemu -boot d -m 128 -L D:\reactos\qemu\ D:\reactos\RosVM.vmdk -cdrom D:\Reactos\ReactOS-RegTest.iso -pidfile pid.txt
+;ROSBOOT_CMD=D:\reactos\qemu\qemu.exe -serial pipe:qemu -boot d -m 128 -L D:\reactos\qemu\ D:\reactos\RosVM.vmdk -cdrom ; D:\Reactos\ReactOS-RegTest.iso -pidfile pid.txt
+
+ROSBOOT_CMD=/usr/bin/qemu -serial file:/home/freenet/reactos/tools/sysreg/txtmode.log -boot d -m 64 -L /home/freenet/reactos/qemu /home/freenet/reactos/qemu/c.img -cdrom /home/freenet/reactos/ReactOS.iso
 
 ;
 ; ROSBOOT_PIDFILE
@@ -47,8 +49,8 @@ ROSBOOT_PID_FILE=pid.txt
 ; If the value is set to pipe, then sysreg will read from pipe created by the
 ; ROSBOOT_CMD
 ;
-;ROSBOOT_DEBUG_PORT=file
-ROSBOOT_DEBUG_PORT=pipe
+ROSBOOT_DEBUG_PORT=file
+;ROSBOOT_DEBUG_PORT=pipe
 
 ;
 ; ROSBOOT_DEBUG_FILE
@@ -60,7 +62,8 @@ ROSBOOT_DEBUG_PORT=pipe
 ; debug data to the specified debug file
 ;
 
-ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\txtmode.log
+;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\txtmode.log
+ROSBOOT_DEBUG_FILE=/home/freenet/reactos/tools/sysreg/txtmode.log
 
 ; ROSBOOT_DELAY_READ;
 ;
@@ -94,9 +97,9 @@ ROSBOOT_TIME_OUT=180.0
 ;
 ; CP_NAME is the value of the ROSBOOT_CHECK_POINT variable
 
-ROSBOOT_CHECK_POINT=USETUP_COMPLETE
-;ROSBOOT_CHECK_POINT=SYSSETUP_COMPLETE
-;ROSBOOT_CHECK_POINT=THIRDBOOT_COMPLETE
+;ROSBOOT_CHECK_POINT=USETUP_COMPLETE
+ROSBOOT_CHECK_POINT=SYSSETUP_COMPLETE
+ROSBOOT_CHECK_POINT=THIRDBOOT_COMPLETE
 
 ; ROSBOOT_CRITICAL_APP
 ;
@@ -114,5 +117,4 @@ ROSBOOT_CHECK_POINT=USETUP_COMPLETE
 
 
 ROSBOOT_CRITICAL_APP=setup.exe userinit.exe smss.exe winlogon.exe csrss.exe explorer.exe
-;ROSBOOT_CRITICAL_APP=setup.exe userinit.exe smss.exe winlogon.exe csrss.exe explorer.exe lsass.exe
-
+;ROSBOOT_CRITICAL_APP=setup.exe userinit.exe smss.exe winlogon.exe csrss.exe explorer.exe lsass.exe
\ No newline at end of file