- close logfile and reset logging to stderr at the end of the simulation

- removed unused code
This commit is contained in:
Volker Ruppert 2006-09-09 11:28:52 +00:00
parent c1a073bc2d
commit e075c68f78
3 changed files with 16 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.195 2006-05-28 17:07:56 sshwarts Exp $
// $Id: bochs.h,v 1.196 2006-09-09 11:28:52 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -318,6 +318,7 @@ public:
void init_log(const char *fn);
void init_log(int fd);
void init_log(FILE *fs);
void exit_log();
void set_log_prefix(const char *prefix);
int get_n_logfns () { return n_logfn; }
logfunc_t *get_logfn (int index) { return logfn_list[index]; }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.166 2006-09-07 18:50:51 vruppert Exp $
// $Id: siminterface.cc,v 1.167 2006-09-09 11:28:52 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// See siminterface.h for description of the siminterface concept.
@ -349,6 +349,7 @@ int bx_real_sim_c::get_max_log_level()
void bx_real_sim_c::quit_sim(int code) {
BX_INFO(("quit_sim called with exit code %d", code));
exit_code = code;
io->exit_log();
// use longjmp to quit cleanly, no matter where in the stack we are.
if (quit_context != NULL) {
longjmp(*quit_context, 1);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: logio.cc,v 1.55 2006-06-12 19:51:31 sshwarts Exp $
// $Id: logio.cc,v 1.56 2006-09-09 11:28:52 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -125,6 +125,17 @@ void iofunctions::init_log(int fd)
init_log(tmpfd);
};
void iofunctions::exit_log()
{
flush();
if (logfd != stderr) {
fclose(logfd);
logfd = stderr;
free(logfn);
logfn = "/dev/stderr";
}
}
// all other functions may use genlog safely.
#define LOG_THIS genlog->
@ -155,11 +166,6 @@ void iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list
default: break;
}
//fprintf(logfd, "-%c",c);
//if(prefix != NULL)
// fprintf(logfd, "%s ", prefix);
s=logprefix;
while(*s) {
switch(*s) {
@ -572,15 +578,6 @@ void logfunctions::fatal(const char *prefix, const char *fmt, va_list ap, int ex
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n%s\n", divider);
#endif
#if 0 && defined(WIN32)
#error disabled because it is not working yet!
// wait for a keypress before quitting. Depending on how bochs is
// installed, the console window can disappear before the user has
// a chance to read the final message.
fprintf(stderr, "\n\nPress Enter to exit...\n");
char buf[8];
fgets(buf, 8, stdin);
#endif
#if !BX_DEBUGGER
BX_EXIT(exit_status);
#else