[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog cygnal/stream.cpp libbase/log.c...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog cygnal/stream.cpp libbase/log.c... |
Date: |
Mon, 21 May 2007 06:53:37 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/05/21 06:53:37
Modified files:
. : ChangeLog
cygnal : stream.cpp
libbase : log.cpp log.h
server/parser : action_buffer.cpp action_buffer.h
server/vm : ActionExec.cpp
testsuite/server: PropertyListTest.cpp
Log message:
* libbase/log.{cpp,h}: make LogFile output operators
private, provide a sipler thread-safe log() method.
Have all printf-like log_*() method use this new method.
Fixes bug bug #19906.
* cygnal/stream.cpp, server/parser/action_buffer.cpp,
server/parser/action_buffer.h, server/vm/ActionExec.cpp,
testsuite/server/PropertyListTest.cpp: remove any
use of LogFile::operator<<, substitute with log_*() calls.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3287&r2=1.3288
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/stream.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.cpp?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.h?cvsroot=gnash&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/PropertyListTest.cpp?cvsroot=gnash&r1=1.12&r2=1.13
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3287
retrieving revision 1.3288
diff -u -b -r1.3287 -r1.3288
--- ChangeLog 21 May 2007 06:23:40 -0000 1.3287
+++ ChangeLog 21 May 2007 06:53:35 -0000 1.3288
@@ -1,3 +1,14 @@
+2007-05-21 Sandro Santilli <address@hidden>
+
+ * libbase/log.{cpp,h}: make LogFile output operators
+ private, provide a sipler thread-safe log() method.
+ Have all printf-like log_*() method use this new method.
+ Fixes bug bug #19906.
+ * cygnal/stream.cpp, server/parser/action_buffer.cpp,
+ server/parser/action_buffer.h, server/vm/ActionExec.cpp,
+ testsuite/server/PropertyListTest.cpp: remove any
+ use of LogFile::operator<<, substitute with log_*() calls.
+
2007-05-21 Zou Lunkai <address@hidden>
* testsuite/misc-ming.all/loop_test4.c:
Index: cygnal/stream.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/stream.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cygnal/stream.cpp 14 May 2007 09:44:21 -0000 1.5
+++ cygnal/stream.cpp 21 May 2007 06:53:35 -0000 1.6
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: stream.cpp,v 1.5 2007/05/14 09:44:21 jgilmore Exp $ */
+/* $Id: stream.cpp,v 1.6 2007/05/21 06:53:35 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -46,7 +46,7 @@
namespace cygnal {
namespace {
-gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+//gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
}
#if 0
@@ -172,7 +172,7 @@
_netfd = netfd;
_statistics = statistics;
- dbglogfile << "Trying to open " << filespec << endl;
+ log_debug("Trying to open %s", filespec);
if (stat(filespec, &st) == 0) {
_filesize = st.st_size;
@@ -265,7 +265,7 @@
_bytes += nbytes;
_seekptr += nbytes;
- dbglogfile << "Done..." << endl;
+ log_debug("Done...");
munmap(_dataptr, _filesize);
_seekptr = 0;
Index: libbase/log.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- libbase/log.cpp 4 May 2007 00:11:24 -0000 1.49
+++ libbase/log.cpp 21 May 2007 06:53:36 -0000 1.50
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: log.cpp,v 1.49 2007/05/04 00:11:24 nihilus Exp $ */
+/* $Id: log.cpp,v 1.50 2007/05/21 06:53:36 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -45,15 +45,6 @@
This should be set by boost itself.
*/
-#if defined(_WIN32) || defined(WIN32)
-#define lock(io_mutex) ;
-#define scoped_lock ;
-#else
- #include <boost/detail/lightweight_mutex.hpp>
- using boost::detail::lightweight_mutex;
- #define scoped_lock lightweight_mutex::scoped_lock
- static lightweight_mutex io_mutex;
-#endif
#include "log.h"
@@ -146,8 +137,6 @@
// THIS IS DANGEROUS AS TIME OF INITIALIZATION IS UNPREDICTABLE,
// THUS WE NOW HAVE A LogFile::getDefaultInstance() TO MAKE SURE
// INITIALIZATION OF THE GLOBAL data HAPPENS BEFORE USE
-//LogFile dbglogfile;
-
LogFile&
LogFile::getDefaultInstance()
{
@@ -170,7 +159,7 @@
vsnprintf (tmp, BUFFER_SIZE, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << tmp << endl;
+ dbglogfile.log(tmp);
va_end (ap);
}
@@ -186,7 +175,7 @@
vsnprintf (tmp, BUFFER_SIZE, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << _("TRACE: ") << tmp << endl;
+ dbglogfile.log(_("TRACE"), tmp);
va_end (ap);
}
@@ -207,7 +196,7 @@
// its type would change (to non-const char string) and the letters would
// change to the local language. Could perhaps be fixed more cleanly
// later...
- dbglogfile << N_("DEBUG: ") << tmp << endl;
+ dbglogfile.log(N_("DEBUG"), tmp);
va_end (ap);
}
@@ -224,7 +213,7 @@
bool stamp = dbglogfile.getStamp();
dbglogfile.setStamp(false);
- dbglogfile << tmp << endl;
+ dbglogfile.log(tmp);
dbglogfile.setStamp(stamp);
}
@@ -239,7 +228,7 @@
vsnprintf (tmp, BUFFER_SIZE, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << tmp << endl;
+ dbglogfile.log(tmp);
va_end (ap);
}
@@ -255,7 +244,7 @@
vsnprintf (tmp, BUFFER_SIZE, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << _("ERROR: ") << tmp << endl;
+ dbglogfile.log(_("ERROR"), tmp);
va_end (ap);
}
@@ -270,7 +259,7 @@
vsnprintf (tmp, BUFFER_SIZE-1, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << _("ERROR: Unimplemented: ") << tmp << endl;
+ dbglogfile.log(_("ERROR: Unimplemented"), tmp);
va_end (ap);
}
@@ -285,7 +274,7 @@
vsnprintf (tmp, BUFFER_SIZE-1, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << _("SECURITY: ") << tmp << endl;
+ dbglogfile.log(_("SECURITY"), tmp);
va_end (ap);
}
@@ -300,7 +289,7 @@
vsnprintf (tmp, BUFFER_SIZE-1, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << _("MALFORMED SWF: ") << tmp << endl;
+ dbglogfile.log(_("MALFORMED SWF"), tmp);
va_end (ap);
}
@@ -315,7 +304,7 @@
vsnprintf (tmp, BUFFER_SIZE-1, fmt, ap);
tmp[BUFFER_SIZE-1] = '\0';
- dbglogfile << _("ACTIONSCRIPT ERROR: ") << tmp << endl;
+ dbglogfile.log(_("ACTIONSCRIPT ERROR"), tmp);
va_end (ap);
}
@@ -326,6 +315,24 @@
return _logentry.c_str();
}
+void
+LogFile::log(const char* msg)
+{
+ boost::mutex::scoped_lock lock(_ioMutex);
+
+ dbglogfile << msg << endl;
+
+}
+
+void
+LogFile::log(const char* label, const char* msg)
+{
+ boost::mutex::scoped_lock lock(_ioMutex);
+
+ dbglogfile << label << ": " << msg << endl;
+
+}
+
// Default constructor
LogFile::LogFile (void): _state(OPEN),
_stamp(true),
@@ -420,7 +427,6 @@
LogFile&
LogFile::operator << (char x)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << x;
}
@@ -438,7 +444,6 @@
LogFile&
LogFile::operator << (long x)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << x;
}
@@ -456,7 +461,6 @@
LogFile&
LogFile::operator << (unsigned int x)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << x;
}
@@ -474,7 +478,6 @@
LogFile&
LogFile::operator << (unsigned long x)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << x;
}
@@ -492,7 +495,6 @@
LogFile&
LogFile::operator << (float x)
{
- scoped_lock lock(io_mutex);
if (_verbose > 0) {
cout << x;
}
@@ -510,7 +512,6 @@
LogFile&
LogFile::operator << (double &x)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << x;
}
@@ -545,7 +546,6 @@
LogFile&
LogFile::operator << (void *ptr)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << ptr;
}
@@ -563,7 +563,6 @@
LogFile&
LogFile::operator << (const std::string &s)
{
- scoped_lock lock(io_mutex);
if (_verbose) {
cout << s;
}
@@ -600,22 +599,6 @@
_trace = true;
}
- scoped_lock lock(io_mutex);
-
-#if 0 // Fixed the callers!
- // Since the log_* functions are wrappers for the older API used
- // for logging, we have to strip the CR off the end otr we get
- // blanks lines as the previous implementation required a CR, and
- // now we don't.
- int len = c.length();
- if (len > 0) {
- if (c[len-1] == '\n') {
- //c[len-1] = 0;
- c.resize(len-1);
- }
- }
-#endif
-
if (_stamp == true && (_state == IDLE || _state == OPEN)) {
_state = INPROGRESS;
if (_trace) {
@@ -659,41 +642,6 @@
return *this;
}
- scoped_lock lock(io_mutex);
- if (_stamp == true && (_state == IDLE || _state == OPEN)) {
- _state = INPROGRESS;
- if (_verbose) {
- cout << _logentry << c;
- }
- if (_write) {
- _outstream << _logentry << c;
- }
- } else {
- if (_verbose) {
- cout << c;
- }
- if (_write) {
- _outstream << c;
- }
- }
- _logentry += (const char*)c;
-
- return *this;
-}
-
-#if 0
-/// \brief print an XML char *
-LogFile&
-LogFile::operator << (const xmlChar *c)
-{
- scoped_lock lock(io_mutex);
- _logentry = timestamp();
- _logentry += ": ";
-
- if (c == -0) {
- return *this;
- }
-
if (_stamp == true && (_state == IDLE || _state == OPEN)) {
_state = INPROGRESS;
if (_verbose) {
@@ -714,13 +662,11 @@
return *this;
}
-#endif
/// \brief Grab the endl operator.
LogFile&
LogFile::operator << (std::ostream & (&)(std::ostream &))
{
- scoped_lock lock(io_mutex);
if (_trace) {
if (_verbose) {
cout << endl;
Index: libbase/log.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- libbase/log.h 21 May 2007 06:22:38 -0000 1.54
+++ libbase/log.h 21 May 2007 06:53:36 -0000 1.55
@@ -35,6 +35,8 @@
#include <fstream>
#include <sstream>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/mutex.hpp>
// the default name for the debug log
#define DEFAULT_LOGFILE "gnash-dbg.log"
@@ -59,8 +61,6 @@
// This is a basic file logging class
class DSOEXPORT LogFile {
public:
- LogFile (void);
- LogFile (const char *);
static LogFile& getDefaultInstance();
@@ -69,6 +69,7 @@
closeLog();
}
}
+
enum file_state {
CLOSED,
OPEN,
@@ -76,38 +77,24 @@
IDLE
} _state;
- file_state GetState (void) { return _state; }
- LogFile& operator << (char x);
- LogFile& operator << (int x);
- LogFile& operator << (long x);
- LogFile& operator << (unsigned int x);
- LogFile& operator << (unsigned long x);
- // These both resolve to an unsigned int.
- // LogFile& operator << (size_t x);
- // LogFile& operator << (time_t x);
- LogFile& operator << (float x);
- LogFile& operator << (double &x);
- LogFile& operator << (bool x);
- LogFile& operator << (void *);
- LogFile& operator << (const char *);
- LogFile& operator << (unsigned char const *);
- LogFile& operator << (const std::string &s);
-// LogFile& operator << (const xmlChar *c);
- LogFile& operator << (std::ostream & (&)(std::ostream &));
+ /// Intended for use by log_*(). Thread-safe (locks _ioMutex)
+ //
+ /// @param label
+ /// The label string ie: "ERROR" for "ERROR: <msg>"
+ ///
+ /// @param msg
+ /// The message string ie: "bah" for "ERROR: bah"
+ ///
+ void log(const char* label, const char* msg);
- /// Print anything that can be printed on a stringstream
+ /// Intended for use by log_*(). Thread-safe (locks _ioMutex)
//
- /// This template function could replace ALL but
- /// operator << (const std::string&) members of
- /// LogFile class.
+ /// @param msg
+ /// The message to print
///
- template <class T>
- LogFile& operator << (const T& any)
- {
- std::stringstream ss;
- ss << any;
- return *this << ss.str();
- }
+ void log(const char* msg);
+
+ file_state GetState (void) { return _state; }
const char *getEntry(void);
@@ -153,6 +140,15 @@
}
private:
+
+ // Use getDefaultInstance for getting the singleton
+ LogFile (void);
+
+ // Use getDefaultInstance for getting the singleton
+ LogFile (const char *);
+
+ boost::mutex _ioMutex;
+
static std::ofstream _console;
std::ofstream _outstream;
static int _verbose;
@@ -164,6 +160,39 @@
std::string _filespec;
std::string _logentry;
friend std::ostream & operator << (std::ostream &os, LogFile& e);
+
+ LogFile& operator << (char x);
+ LogFile& operator << (int x);
+ LogFile& operator << (long x);
+ LogFile& operator << (unsigned int x);
+ LogFile& operator << (unsigned long x);
+ // These both resolve to an unsigned int.
+ // LogFile& operator << (size_t x);
+ // LogFile& operator << (time_t x);
+ LogFile& operator << (float x);
+ LogFile& operator << (double &x);
+ LogFile& operator << (bool x);
+ LogFile& operator << (void *);
+ LogFile& operator << (const char *);
+ LogFile& operator << (unsigned char const *);
+ LogFile& operator << (const std::string &s);
+// LogFile& operator << (const xmlChar *c);
+ LogFile& operator << (std::ostream & (&)(std::ostream &));
+
+ /// Print anything that can be printed on a stringstream
+ //
+ /// This template function could replace ALL but
+ /// operator << (const std::string&) members of
+ /// LogFile class.
+ ///
+ template <class T>
+ LogFile& operator << (const T& any)
+ {
+ std::stringstream ss;
+ ss << any;
+ return *this << ss.str();
+ }
+
};
Index: server/parser/action_buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/parser/action_buffer.cpp 25 Apr 2007 11:29:12 -0000 1.19
+++ server/parser/action_buffer.cpp 21 May 2007 06:53:36 -0000 1.20
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: action_buffer.cpp,v 1.19 2007/04/25 11:29:12 martinwguy Exp $ */
+/* $Id: action_buffer.cpp,v 1.20 2007/05/21 06:53:36 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -38,7 +38,7 @@
using std::endl;
namespace {
-gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+//gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
}
namespace gnash {
@@ -189,8 +189,8 @@
#endif
// Disassemble one instruction to the log.
-static void
-disasm(const unsigned char* instruction_data)
+static std::string
+disasm_instruction(const unsigned char* instruction_data)
{
using namespace gnash::SWF;
@@ -202,12 +202,13 @@
unsigned char num[10];
memset(num, 0, 10);
- dbglogfile.setStamp(false);
+ std::stringstream ss;
+
// Show instruction.
if (action_id > ash.lastType()) {
- dbglogfile << "<unknown>[0x" << action_id << "]" << endl;
+ ss << "<unknown>[0x]" << action_id << endl;
} else {
- dbglogfile << ash[action_id].getName().c_str() << endl;
+ ss << ash[action_id].getName() << endl;
fmt = ash[action_id].getArgFormat();
}
@@ -218,28 +219,27 @@
if (fmt == ARG_HEX) {
for (int i = 0; i < length; i++) {
hexify(num, (const unsigned char *)&instruction_data[3 + i], 1,
false);
- dbglogfile << "0x" << num << " ";
-// dbglogfile << instruction_data[3 + i] << " ";
+ ss << "0x" << num << " ";
}
- dbglogfile << endl;
+ ss << endl;
} else if (fmt == ARG_STR) {
string str;
for (int i = 0; i < length; i++) {
str += instruction_data[3 + i];
}
- dbglogfile << "\"" << str.c_str() << "\"" << endl;
+ ss << "\"" << str.c_str() << "\"" << endl;
} else if (fmt == ARG_U8) {
int val = instruction_data[3];
- dbglogfile << " " << val << endl;
+ ss << " " << val << endl;
} else if (fmt == ARG_U16) {
int val = instruction_data[3] | (instruction_data[4] << 8);
- dbglogfile << " " << val << endl;
+ ss << " " << val << endl;
} else if (fmt == ARG_S16) {
int val = instruction_data[3] | (instruction_data[4] << 8);
if (val & 0x8000) val |= ~0x7FFF; // sign-extend
- dbglogfile << " " << val << endl;
+ ss << " " << val << endl;
} else if (fmt == ARG_PUSH_DATA) {
- dbglogfile << endl;
+ ss << endl;
int i = 0;
while (i < length) {
int type = instruction_data[3 + i];
@@ -252,30 +252,30 @@
i++;
}
i++;
- dbglogfile << "\t\"" << str.c_str() << "\"" << endl;
+ ss << "\t\"" << str.c_str() << "\"" << endl;
} else if (type == 1) {
// float (little-endian)
float f = convert_float_little(instruction_data + 3 + i);
i += 4;
- dbglogfile << "(float) " << f << endl;
+ ss << "(float) " << f << endl;
} else if (type == 2) {
- dbglogfile << "NULL" << endl;
+ ss << "NULL" << endl;
} else if (type == 3) {
- dbglogfile << "undef" << endl;
+ ss << "undef" << endl;
} else if (type == 4) {
// contents of register
int reg = instruction_data[3 + i];
i++;
- dbglogfile << "reg[" << reg << "]" << endl;
+ ss << "reg[" << reg << "]" << endl;
} else if (type == 5) {
int bool_val = instruction_data[3 + i];
i++;
- dbglogfile << "bool(" << bool_val << ")" << endl;
+ ss << "bool(" << bool_val << ")" << endl;
} else if (type == 6) {
// double in wacky format: 45670123
double d = convert_double_wacky(instruction_data + 3 + i);
i += 8;
- dbglogfile << "(double) " << d << endl;
+ ss << "(double) " << d << endl;
} else if (type == 7) {
// int32_t
int32_t val = instruction_data[3 + i]
@@ -283,15 +283,15 @@
| (instruction_data[3 + i + 2] << 16)
| (instruction_data[3 + i + 3] << 24);
i += 4;
- dbglogfile << "(int) " << val << endl;
+ ss << "(int) " << val << endl;
} else if (type == 8) {
int id = instruction_data[3 + i];
i++;
- dbglogfile << "dict_lookup[" << id << "]" << endl;
+ ss << "dict_lookup[" << id << "]" << endl;
} else if (type == 9) {
int id = instruction_data[3 + i] | (instruction_data[3 + i
+ 1] << 8);
i += 2;
- dbglogfile << "dict_lookup_lg[" << id << "]" << endl;
+ ss << "dict_lookup_lg[" << id << "]" << endl;
}
}
} else if (fmt == ARG_DECL_DICT) {
@@ -299,23 +299,23 @@
int count = instruction_data[3 + i] | (instruction_data[3 + i + 1]
<< 8);
i += 2;
- dbglogfile << " [" << count << "]" << endl;
+ ss << " [" << count << "]" << endl;
// Print strings.
for (int ct = 0; ct < count; ct++) {
- dbglogfile << "\t" << ct << ") ";
+ ss << "\t" << ct << ") ";
string str;
while (instruction_data[3 + i]) {
// safety check.
if (i >= length) {
- dbglogfile << "<disasm error -- length exceeded>" <<
endl;
+ log_debug("<disasm error -- length exceeded>");
break;
}
str += instruction_data[3 + i];
i++;
}
- dbglogfile << "\"" << str.c_str() << "\"" << endl;
+ ss << "\"" << str.c_str() << "\"" << endl;
i++;
}
} else if (fmt == ARG_FUNCTION2) {
@@ -330,7 +330,7 @@
int reg_count = instruction_data[3 + i];
i++;
- dbglogfile << "\t\tname = '" << function_name << "'"
+ ss << "\t\tname = '" << function_name << "'"
<< " arg_count = " << arg_count
<< " reg_count = " << reg_count << endl;
@@ -371,7 +371,7 @@
const char* arg_name = (const char*) &instruction_data[3 +
i];
i += strlen(arg_name) + 1;
- dbglogfile << "\t\targ[" << argi << "]"
+ ss << "\t\targ[" << argi << "]"
<< " - reg[" << arg_register << "]"
<< " - '" << arg_name << "'" << endl;
}
@@ -379,21 +379,24 @@
int function_length = instruction_data[3 + i] | (instruction_data[3
+ i + 1] << 8);
i += 2;
- dbglogfile << "\t\tfunction length = " << function_length << endl;
+ ss << "\t\tfunction length = " << function_length << endl;
}
} else {
- dbglogfile << endl;
+ ss << endl;
}
- dbglogfile.setStamp(true);
+
+ //dbglogfile.setStamp(false); // why ?
+ //log_msg("%s", ss.str().c_str());
+ //dbglogfile.setStamp(true);
+ return ss.str();
}
-// Disassemble one instruction to the log.
-void
-action_buffer::log_disasm(size_t pc) const
+std::string
+action_buffer::disasm(size_t pc) const
{
const unsigned char* instruction_data =
(const unsigned char *)&m_buffer[pc];
- disasm(instruction_data);
+ return disasm_instruction(instruction_data);
}
// Endian conversion routines.
Index: server/parser/action_buffer.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/parser/action_buffer.h 28 Feb 2007 09:46:48 -0000 1.12
+++ server/parser/action_buffer.h 21 May 2007 06:53:36 -0000 1.13
@@ -107,8 +107,8 @@
return m_buffer[off];
}
- /// Disassemble instruction at given offset to the log.
- void log_disasm(size_t pc) const;
+ /// Disassemble instruction at given offset and return as a string
+ std::string disasm(size_t pc) const;
/// Get a null-terminated string from given offset
//
Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/vm/ActionExec.cpp 27 Apr 2007 16:09:01 -0000 1.32
+++ server/vm/ActionExec.cpp 21 May 2007 06:53:36 -0000 1.33
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: ActionExec.cpp,v 1.32 2007/04/27 16:09:01 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.33 2007/05/21 06:53:36 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -59,7 +59,7 @@
namespace gnash {
-static LogFile& dbglogfile = LogFile::getDefaultInstance();
+//static LogFile& dbglogfile = LogFile::getDefaultInstance();
#ifdef USE_DEBUGGER
static Debugger& debugger = Debugger::getDefaultInstance();
#endif
@@ -175,8 +175,7 @@
IF_VERBOSE_ACTION (
// FIXME, avoid direct dbglogfile access, use log_action
- dbglogfile << std::endl << "PC:" << pc << " - EX: ";
- code.log_disasm(pc);
+ log_action("PC:" SIZET_FMT " - EX: %s", pc,
code.disasm(pc).c_str());
);
// Set default next_pc offset, control flow action handlers
Index: testsuite/server/PropertyListTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/PropertyListTest.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- testsuite/server/PropertyListTest.cpp 15 Mar 2007 22:39:54 -0000
1.12
+++ testsuite/server/PropertyListTest.cpp 21 May 2007 06:53:36 -0000
1.13
@@ -49,7 +49,7 @@
VM& vm = VM::init(*md5);
- dbglogfile << "VM version " << vm.getSWFVersion() << endl;
+ log_debug("VM version %d", vm.getSWFVersion());
as_object obj;
PropertyList props;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog cygnal/stream.cpp libbase/log.c...,
Sandro Santilli <=