Pass programCommand to dbgDumpInit() so that it can use that to set up debug dump info

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4844 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-04-28 20:45:28 +00:00
parent 8837e5630f
commit 0555874c44
3 changed files with 10 additions and 9 deletions

View File

@ -40,7 +40,6 @@ extern "C"
#endif
static char* dbgHeader = NULL;
static std::string programPath;
static void dumpstr(const DumpFileHandle file, const char * const str)
{
@ -60,7 +59,7 @@ void dbgDumpHeader(DumpFileHandle file)
dumpstr(file, "No debug header available (yet)!\n" );
}
static void initProgramPath(const char* programCommand)
static std::string getProgramPath(const char* programCommand)
{
std::vector<char> buf(PATH_MAX);
@ -81,7 +80,7 @@ static void initProgramPath(const char* programCommand)
}
#endif
programPath = &buf[0];
std::string programPath = &buf[0];
if (!programPath.empty())
{
@ -92,6 +91,8 @@ static void initProgramPath(const char* programCommand)
{
debug(LOG_WARNING, "Could not retrieve full path to %s, will not create extended backtrace\n", programCommand);
}
return programPath;
}
static std::string getSysinfo()
@ -116,12 +117,12 @@ static std::string getSysinfo()
#endif
}
static void createHeader(void)
static void createHeader(const char* programCommand)
{
time_t currentTime = time(NULL);
std::ostringstream os;
os << "Program: " << programPath << "(" PACKAGE ")" << std::endl
os << "Program: " << getProgramPath(programCommand) << "(" PACKAGE ")" << std::endl
<< "Version: " << version_getFormattedVersionString() << std::endl
<< "Distributor: " PACKAGE_DISTRIBUTOR << std::endl
<< "Compiled on: " __DATE__ " " __TIME__ << std::endl
@ -148,7 +149,7 @@ static void createHeader(void)
}
}
void dbgDumpInit()
void dbgDumpInit(const char* programCommand)
{
createHeader();
createHeader(programCommand);
}

View File

@ -36,7 +36,7 @@ typedef int DumpFileHandle;
extern void dbgDumpHeader(DumpFileHandle file);
extern void dbgDumpInit(void);
extern void dbgDumpInit(const char* programCommand);
#if defined(__cplusplus)
}

View File

@ -519,7 +519,7 @@ static void posixExceptionHandler(int signum, siginfo_t * siginfo, WZ_DECL_UNUSE
*/
void setupExceptionHandler(const char * programCommand)
{
dbgDumpInit();
dbgDumpInit(programCommand);
#if defined(WZ_OS_WIN)
# if defined(WZ_CC_MINGW)
ExchndlSetup();