Author: janderwald Date: Tue Nov 14 19:58:42 2006 New Revision: 24755
URL: http://svn.reactos.org/svn/reactos?rev=24755&view=rev Log: - dump reached checkpoints when an BSOD is detected - dump rest of log file when a BSOD is detected - write debugging data to ROSBOOT_DEBUG_FILE when reading from a pipe - update configuration files - silence debug print in sym_file.cpp
Modified: trunk/reactos/tools/sysreg/rosboot_test.cpp trunk/reactos/tools/sysreg/rosboot_test.h trunk/reactos/tools/sysreg/runonce.cfg trunk/reactos/tools/sysreg/secstage.cfg trunk/reactos/tools/sysreg/sym_file.cpp trunk/reactos/tools/sysreg/txtmode.cfg
Modified: trunk/reactos/tools/sysreg/rosboot_test.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.c... ============================================================================== --- trunk/reactos/tools/sysreg/rosboot_test.cpp (original) +++ trunk/reactos/tools/sysreg/rosboot_test.cpp Tue Nov 14 19:58:42 2006 @@ -18,6 +18,7 @@
#include <iostream> #include <vector> +#include <fstream> #include <time.h> #include <float.h> #include <stdio.h> @@ -33,6 +34,13 @@ using System_::SymbolFile; using System_::FileReader; using System_::OsSupport; + +#ifdef UNICODE + using std::wofstream; + typedef wofstream ofstream; +#else + using std::ofstream; +#endif
string RosBootTest::VARIABLE_NAME = _T("ROSBOOT_CMD"); string RosBootTest::CLASS_NAME = _T("rosboot"); @@ -102,8 +110,6 @@ m_Delayread = 0; } } - -
/// /// read optional arguments @@ -111,6 +117,8 @@
conf_parser.getStringValue (RosBootTest::CHECK_POINT, m_Checkpoint); conf_parser.getStringValue (RosBootTest::CRITICAL_APP, m_CriticalApp); + conf_parser.getStringValue (RosBootTest::DEBUG_FILE, m_DebugFile); + if (conf_parser.getStringValue (RosBootTest::PID_FILE, m_PidFile)) { _tremove(m_PidFile.c_str ()); @@ -122,13 +130,12 @@ } else if (!_tcscmp(debug_port.c_str(), _T("file"))) { - string debug_file; - if (!conf_parser.getStringValue (RosBootTest::DEBUG_FILE, debug_file)) + if (!m_DebugFile.length()) { cerr << "Error: ROSBOOT_DEBUG_FILE is not set in configuration file" << endl; return false; } - ret = fetchDebugByFile(boot_cmd, debug_file); + ret = fetchDebugByFile(boot_cmd); } else { @@ -137,7 +144,6 @@ return false; }
- return ret; } //--------------------------------------------------------------------------------------- @@ -167,7 +173,7 @@ { string line = debug_data[i];
- cerr << line << endl; + //cerr << line << endl;
if (line.find (RosBootTest::SYSREG_CHECKPOINT) != string::npos) { @@ -177,18 +183,35 @@ state = DebugStateCPReached; break; } - if (line.find (_T("|")) != string::npos) - { - string fline = debug_data[i]; - m_Checkpoints.push_back (fline); - } + m_Checkpoints.push_back (line); }
if (line.find (_T("*** Fatal System Error")) != string::npos) { - cerr << "BSOD detected" <<endl; - dumpCheckpoints(); + cerr << "Blue Screen of Death detected" <<endl; + if (m_Checkpoints.size ()) + { + cerr << "dumping list of reached checkpoints:" << endl; + do + { + string cp = m_Checkpoints[0]; + m_Checkpoints.erase (m_Checkpoints.begin ()); + cerr << cp << endl; + }while(m_Checkpoints.size ()); + cerr << _T("----------------------------------") << endl; + } + if (i + 1 < debug_data.size () ) + { + cerr << "dumping rest of debug log" << endl; + while(i < debug_data.size ()) + { + string data = debug_data[i]; + cerr << data << endl; + i++; + } + cerr << _T("----------------------------------") << endl; + } state = DebugStateBSODDetected; break; } @@ -362,18 +385,37 @@ bool ret = true; vector<string> vect; size_t lines = 0; + bool write_log; + ofstream file; + if (m_DebugFile.length ()) + { + _tremove(m_DebugFile.c_str ()); + file.open (m_DebugFile.c_str ()); + } + + write_log = file.is_open (); + while(1) { if (isTimeout(m_Timeout)) { break; } + size_t prev_count = vect.size (); size_t line_count = namedpipe_reader.readPipe (vect); if (!line_count) { cerr << "No data read" << endl; continue; } + if (write_log) + { + for (size_t i = prev_count; i < vect.size (); i++) + { + string & line = vect[i]; + file << line; + } + }
DebugState state = checkDebugData(vect); if (state == DebugStateBSODDetected || state == DebugStateUMEDetected) @@ -388,16 +430,20 @@ lines += line_count; } namedpipe_reader.closePipe (); + if (write_log) + { + file.close(); + } _sleep(3* CLOCKS_PER_SEC); OsSupport::terminateProcess (pid);
return ret; } //--------------------------------------------------------------------------------------- - bool RosBootTest::fetchDebugByFile(string boot_cmd, string debug_log) + bool RosBootTest::fetchDebugByFile(string boot_cmd) { PipeReader pipe_reader; - _tremove(debug_log.c_str ()); + _tremove(m_DebugFile.c_str ());
if (!pipe_reader.openPipe(boot_cmd, string(_T("rt")))) { @@ -432,9 +478,9 @@ } } FileReader file; - if (!file.openFile (debug_log.c_str ())) - { - cerr << "Error: failed to open debug log " << debug_log << endl; + if (!file.openFile (m_DebugFile.c_str ())) + { + cerr << "Error: failed to open debug log " << m_DebugFile<< endl; pipe_reader.closePipe (); return false; }
Modified: trunk/reactos/tools/sysreg/rosboot_test.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.h... ============================================================================== --- trunk/reactos/tools/sysreg/rosboot_test.h (original) +++ trunk/reactos/tools/sysreg/rosboot_test.h Tue Nov 14 19:58:42 2006 @@ -92,10 +92,9 @@ /// Note: if an error occurs, this function returns false /// /// @param BootCmd the command which is passed to PipeReader class -/// @param debug_log path pointing to debug log /// @return bool
- bool fetchDebugByFile(string BootCmd, string debug_log); + bool fetchDebugByFile(string BootCmd);
//--------------------------------------------------------------------------------------- /// @@ -140,6 +139,7 @@ string m_PidFile; string m_Checkpoint; string m_CriticalApp; + string m_DebugFile; vector <string> m_Checkpoints; unsigned long m_Delayread;
Modified: trunk/reactos/tools/sysreg/runonce.cfg URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/runonce.cfg?re... ============================================================================== --- trunk/reactos/tools/sysreg/runonce.cfg (original) +++ trunk/reactos/tools/sysreg/runonce.cfg Tue Nov 14 19:58:42 2006 @@ -60,8 +60,8 @@ ; debug data to the specified debug file ;
-;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\bsdebug.log -;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\debug.log +ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\runonce.log +
; ROSBOOT_DELAY_READ; ;
Modified: trunk/reactos/tools/sysreg/secstage.cfg URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/secstage.cfg?r... ============================================================================== --- trunk/reactos/tools/sysreg/secstage.cfg (original) +++ trunk/reactos/tools/sysreg/secstage.cfg Tue Nov 14 19:58:42 2006 @@ -60,8 +60,8 @@ ; debug data to the specified debug file ;
-;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\bsdebug.log -;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\debug.log +ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\secstage.log +
; ROSBOOT_DELAY_READ; ;
Modified: trunk/reactos/tools/sysreg/sym_file.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/sym_file.cpp?r... ============================================================================== --- trunk/reactos/tools/sysreg/sym_file.cpp (original) +++ trunk/reactos/tools/sysreg/sym_file.cpp Tue Nov 14 19:58:42 2006 @@ -97,8 +97,9 @@ string path = current_dir; path.insert (path.length () -1, _T("\")); path.insert (path.length () -1, filename); - +#ifdef NDEBUG cerr << "Module Name " << modulename << endl << "File Name " << path << endl; +#endif
m_Map.insert(std::make_pair<string, string>(modulename, path));
Modified: trunk/reactos/tools/sysreg/txtmode.cfg URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/txtmode.cfg?re... ============================================================================== --- trunk/reactos/tools/sysreg/txtmode.cfg (original) +++ trunk/reactos/tools/sysreg/txtmode.cfg Tue Nov 14 19:58:42 2006 @@ -60,8 +60,7 @@ ; debug data to the specified debug file ;
-;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\bsdebug.log -;ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\debug.log +ROSBOOT_DEBUG_FILE=D:\ReactOS\tools\sysreg\txtmode.log
; ROSBOOT_DELAY_READ; ;