Changeset - r14293:a7858a5997d3
[Not reviewed]
master
0 5 0
smatz - 14 years ago 2010-01-18 10:11:27
smatz@openttd.org
(svn r18855) -Codechange: record compiler name and version in the crash log
5 files changed with 44 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/crashlog.cpp
Show inline comments
 
@@ -35,6 +35,30 @@
 
/* static */ char *CrashLog::gamelog_buffer = NULL;
 
/* static */ const char *CrashLog::gamelog_last = NULL;
 

	
 
char *CrashLog::LogCompiler(char *buffer, const char *last) const
 
{
 
			buffer += seprintf(buffer, last, " Compiler: "
 
#if defined(_MSC_VER)
 
			"MSVC %d", _MSC_VER
 
#elif defined(__ICC) && defined(__GNUC__)
 
			"ICC %d (GCC %d.%d.%d mode)", __ICC,  __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
 
#elif defined(__ICC)
 
			"ICC %d", __ICC
 
#elif defined(__GNUC__)
 
			"GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
 
#elif defined(__WATCOMC__)
 
			"WatcomC %d", __WATCOMC__
 
#else
 
			"<unknown>"
 
#endif
 
			);
 
#if defined(__VERSION__)
 
			return buffer + seprintf(buffer, last,  " \"" __VERSION__ "\"\n\n");
 
#else
 
			return buffer + seprintf(buffer, last,  "\n\n");
 
#endif
 
}
 

	
 
/* virtual */ char *CrashLog::LogRegisters(char *buffer, const char *last) const
 
{
 
	/* Stub implementation; not all OSes support this. */
 
@@ -233,6 +257,7 @@ char *CrashLog::FillCrashLog(char *buffe
 
	buffer = this->LogRegisters(buffer, last);
 
	buffer = this->LogStacktrace(buffer, last);
 
	buffer = this->LogOSVersion(buffer, last);
 
	buffer = this->LogCompiler(buffer, last);
 
	buffer = this->LogConfiguration(buffer, last);
 
	buffer = this->LogLibraries(buffer, last);
 
	buffer = this->LogModules(buffer, last);
src/crashlog.h
Show inline comments
 
@@ -41,6 +41,14 @@ protected:
 
	virtual char *LogOSVersion(char *buffer, const char *last) const = 0;
 

	
 
	/**
 
	 * Writes compiler (and its version, if available) to the buffer.
 
	 * @param buffer The begin where to write at.
 
	 * @param last   The last position in the buffer to write to.
 
	 * @return the position of the \c '\0' character after the buffer.
 
	 */
 
	virtual char *LogCompiler(char *buffer, const char *last) const;
 

	
 
	/**
 
	 * Writes actually encountered error to the buffer.
 
	 * @param buffer  The begin where to write at.
 
	 * @param last    The last position in the buffer to write to.
src/os/macosx/crashlog_osx.cpp
Show inline comments
 
@@ -59,10 +59,10 @@ class CrashLogOSX : public CrashLog {
 

	
 
		return buffer + seprintf(buffer, last,
 
				"Operating system:\n"
 
				" Name:    Mac OS X\n"
 
				" Release: %d.%d.%d\n"
 
				" Machine: %s\n"
 
				" Min Ver: %d\n\n",
 
				" Name:     Mac OS X\n"
 
				" Release:  %d.%d.%d\n"
 
				" Machine:  %s\n"
 
				" Min Ver:  %d\n",
 
				ver_maj, ver_min, ver_bug,
 
				arch != NULL ? arch->description : "unknown",
 
				MAC_OS_X_VERSION_MIN_REQUIRED
src/os/unix/crashlog_unix.cpp
Show inline comments
 
@@ -43,10 +43,10 @@ class CrashLogUnix : public CrashLog {
 

	
 
		return buffer + seprintf(buffer, last,
 
				"Operating system:\n"
 
				" Name:    %s\n"
 
				" Release: %s\n"
 
				" Version: %s\n"
 
				" Machine: %s\n\n",
 
				" Name:     %s\n"
 
				" Release:  %s\n"
 
				" Version:  %s\n"
 
				" Machine:  %s\n",
 
				name.sysname,
 
				name.release,
 
				name.version,
src/os/windows/crashlog_win.cpp
Show inline comments
 
@@ -78,18 +78,12 @@ public:
 

	
 
	return buffer + seprintf(buffer, last,
 
			"Operating system:\n"
 
			" Name:    Windows\n"
 
			" Release: %d.%d.%d (%s)\n"
 
			" MSVC:    %s\n\n",
 
			" Name:     Windows\n"
 
			" Release:  %d.%d.%d (%s)\n",
 
			(int)os.dwMajorVersion,
 
			(int)os.dwMinorVersion,
 
			(int)os.dwBuildNumber,
 
			os.szCSDVersion,
 
#if defined(_MSC_VER)
 
			"Yes"
 
#else
 
			"No"
 
#endif
 
			os.szCSDVersion
 
	);
 

	
 
}
0 comments (0 inline, 0 general)