Create a new function, addDumpInfo(), to be used to add custom information to the crash dump report file.

Currently, we query openAL & openGL vendor/version info.
This should give us more descriptive crash reports on the user's hardware.


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7738 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2009-06-15 03:49:21 +00:00 committed by Git SVN Gateway
parent e53a25e859
commit 1ccb1487de
4 changed files with 60 additions and 21 deletions

View File

@ -51,6 +51,9 @@ static const std::size_t max_debug_messages = 20;
static char* dbgHeader = NULL;
static std::deque<std::vector<char> > dbgMessages;
// used to add custom info to the crash log
static std::ostringstream miscData;
static void dumpstr(const DumpFileHandle file, const char * const str, std::size_t const size)
{
#if defined(WZ_OS_WIN)
@ -126,6 +129,13 @@ void dbgDumpHeader(DumpFileHandle file)
if (dbgHeader)
{
dumpstr(file, dbgHeader);
// Now get any other data that we need to include in bug report
dumpstr(file, "Misc Data:");
dumpEOL(file);
dumpstr(file, miscData.str().c_str());
dumpEOL(file);
dumpstr(file, "===============");
dumpEOL(file);
}
else
{
@ -307,6 +317,7 @@ static void createHeader(int const argc, char* argv[])
PHYSFS_getLinkedVersion(&physfs_version);
os << "Running with PhysicsFS version: " << physfs_version << endl
<< endl;
os << "===============" << endl;
dbgHeader = strdup(os.str().c_str());
if (dbgHeader == NULL)
@ -317,6 +328,11 @@ static void createHeader(int const argc, char* argv[])
}
}
void addDumpInfo( char *inbuffer)
{
miscData << std::string(inbuffer) << endl;
}
void dbgDumpInit(int argc, char* argv[])
{
debug_register_callback(&debug_exceptionhandler_data, NULL, NULL, NULL );

View File

@ -45,6 +45,8 @@ extern void dbgDumpLog(DumpFileHandle file);
extern void dbgDumpInit(int argc, char* argv[]);
extern void addDumpInfo(char *inbuffer);
#if defined(__cplusplus)
}
#endif

View File

@ -26,7 +26,7 @@
#include "lib/ivis_opengl/GLee.h"
#include "lib/framework/frame.h"
#include "lib/exceptionhandler/dumpinfo.h"
#include <SDL.h>
#include <physfs.h>
#include <png.h>
@ -36,6 +36,7 @@
#include "lib/framework/frameint.h"
#include "lib/ivis_common/piestate.h"
#include "lib/ivis_common/pieblitfunc.h"
#if defined(WZ_OS_MAC)
#include <OpenGL/glu.h>
#else
@ -172,6 +173,16 @@ BOOL screenInitialise(
debug( LOG_ERROR, "OpenGL initialization did not give double buffering!" );
}
{
char buf[256];
// Copy this info to the crash handler report info
ssprintf(buf, "OpenGL Vendor : %s", glGetString(GL_VENDOR));
addDumpInfo(buf);
ssprintf(buf, "OpenGL Renderer : %s", glGetString(GL_RENDERER));
addDumpInfo(buf);
ssprintf(buf, "OpenGL Version : %s", glGetString(GL_VERSION));
addDumpInfo(buf);
/* Dump information about OpenGL implementation to the console */
debug(LOG_3D, "OpenGL Vendor : %s", glGetString(GL_VENDOR));
debug(LOG_3D, "OpenGL Renderer : %s", glGetString(GL_RENDERER));
@ -191,7 +202,7 @@ BOOL screenInitialise(
debug(LOG_3D, " * Anisotropic filtering %s supported.", GLEE_EXT_texture_filter_anisotropic ? "is" : "is NOT");
debug(LOG_3D, " * Rectangular texture %s supported.", GLEE_ARB_texture_rectangle ? "is" : "is NOT");
debug(LOG_3D, " * FrameBuffer Object (FBO) %s supported.", GLEE_EXT_framebuffer_object ? "is" : "is NOT");
}
// Make OpenGL's VBO functions available under the core names for
// implementations that have them only as extensions, namely Mesa.
if (!strncmp((const char *)glGetString(GL_RENDERER), "Mesa", 4))

View File

@ -25,6 +25,7 @@
#include "lib/framework/frame.h"
#include "lib/framework/math_ext.h"
#include "lib/framework/frameresource.h"
#include "lib/exceptionhandler/dumpinfo.h"
#ifndef WZ_NOSOUND
# ifdef WZ_OS_MAC
@ -122,6 +123,7 @@ static void sound_RemoveSample(SAMPLE_LIST* previous, SAMPLE_LIST* to_remove)
static void PrintOpenALVersion(code_part part)
{
const ALchar* pDeviceNames = NULL;
char buf[256];
debug(part, "OpenAL Vendor: %s", alGetString(AL_VENDOR));
debug(part, "OpenAL Version: %s", alGetString(AL_VERSION));
@ -139,6 +141,14 @@ static void PrintOpenALVersion(code_part part)
debug(part, "available openAL device(s) are: %s", pDeviceNames);
pDeviceNames += strlen(pDeviceNames) + 1;
}
// Copy this info to the crash handler report info
ssprintf(buf,"OpenAL Vendor: %s", alGetString(AL_VENDOR));
addDumpInfo(buf);
ssprintf(buf,"OpenAL Version: %s", alGetString(AL_VERSION));
addDumpInfo(buf);
ssprintf(buf,"OpenAL Renderer: %s", alGetString(AL_RENDERER));
addDumpInfo(buf);
}
#endif