*/
void wxMemStruct::ErrorMsg (const char * mesg)
{
- wxLogDebug(wxT("wxWindows memory checking error: %s"), mesg);
+ wxLogMessage(wxT("wxWindows memory checking error: %s"), mesg);
PrintNode ();
// << m_fileName << ' ' << m_lineNum << endl;
*/
void wxMemStruct::ErrorMsg ()
{
- wxLogDebug(wxT("wxWindows over/underwrite memory error:"));
+ wxLogMessage(wxT("wxWindows over/underwrite memory error:"));
PrintNode ();
// cerr << m_fileName << ' ' << m_lineNum << endl;
msg2.Printf(wxT(" at $%lX, size %d"), (long)GetActualData(), (int)RequestSize());
msg += msg2;
- wxLogDebug(msg);
+ wxLogMessage(msg);
}
else
{
msg2.Printf(wxT(" at $%lX, size %d\n"), (long)GetActualData(), (int)RequestSize());
msg += msg2;
- wxLogDebug(msg);
+ wxLogMessage(msg);
}
}
msg2.Printf(wxT(" at $%lX, size %d"), (long)GetActualData(), (int)RequestSize());
msg += msg2;
- wxLogDebug(msg);
+ wxLogMessage(msg);
}
else
{
wxString msg2("");
msg2.Printf(wxT("non-object data at $%lX, size %d"), (long)GetActualData(), (int)RequestSize() );
msg += msg2;
- wxLogDebug(msg);
+ wxLogMessage(msg);
}
}
else {
// Can't use the error routines as we have no recognisable object.
#ifndef __WXGTK__
- wxLogDebug(wxT("Can't verify memory struct - all bets are off!"));
+ wxLogMessage(wxT("Can't verify memory struct - all bets are off!"));
#endif
}
return 0;
bool wxDebugContext::debugOn = TRUE;
wxMemStruct *wxDebugContext::checkPoint = NULL;
+// For faster alignment calculation
+static wxMarkerType markerCalc[2];
+int wxDebugContext::m_balign = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]);
+int wxDebugContext::m_balignmask = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]) - 1;
+
wxDebugContext::wxDebugContext(void)
{
// m_streamBuf = new wxDebugStreamBuf;
bool wxDebugContext::SetFile(const wxString& file)
{
- ofstream *str = new ofstream(file.fn_str());
+ ofstream *str = new ofstream(file.mb_str());
if (str->bad())
{
I don't know how portable this stuff is, but it seems to work for me at
the moment. It would be real nice if I knew more about this!
+
+ // Note: this function is now obsolete (along with CalcAlignment)
+ // because the calculations are done statically, for greater speed.
*/
size_t wxDebugContext::GetPadding (const size_t size)
{
return (pad) ? sizeof(wxMarkerType) - pad : 0;
}
-
-
size_t wxDebugContext::PaddedSize (const size_t size)
{
+ // Added by Terry Farnham <TJRT@pacbell.net> to replace
+ // slow GetPadding call.
+ int padb;
+
+ padb = size & m_balignmask;
+ if(padb)
+ return(size + m_balign - padb);
+ else
+ return(size);
+
+// Old (slow) code
+#if 0
return size + GetPadding (size);
+#endif
}
/*
{
appNameStr = wxTheApp->GetAppName();
appName = WXSTRINGCAST appNameStr;
- wxLogDebug(wxT("----- Memory dump of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
+ wxLogMessage(wxT("----- Memory dump of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
}
else
{
- wxLogDebug( wxT("----- Memory dump -----") );
+ wxLogMessage( wxT("----- Memory dump -----") );
}
}
TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL));
- wxLogDebug( wxT("") );
- wxLogDebug( wxT("") );
+ wxLogMessage( wxT("") );
+ wxLogMessage( wxT("") );
return TRUE;
#else
{
appNameStr = wxTheApp->GetAppName();
appName = WXSTRINGCAST appNameStr;
- wxLogDebug(wxT("----- Memory statistics of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
+ wxLogMessage(wxT("----- Memory statistics of %s at %s -----"), appName, WXSTRINGCAST wxNow() );
}
else
{
- wxLogDebug( wxT("----- Memory statistics -----") );
+ wxLogMessage( wxT("----- Memory statistics -----") );
}
}
{
while (list)
{
- wxLogDebug(wxT("%ld objects of class %s, total size %ld"),
+ wxLogMessage(wxT("%ld objects of class %s, total size %ld"),
list->instanceCount, list->instanceClass, list->totalSize);
wxDebugStatsStruct *old = list;
list = old->next;
free((char *)old);
}
- wxLogDebug(wxT(""));
+ wxLogMessage(wxT(""));
}
SetDebugMode(currentMode);
- wxLogDebug(wxT("Number of object items: %ld"), noObjectNodes);
- wxLogDebug(wxT("Number of non-object items: %ld"), noNonObjectNodes);
- wxLogDebug(wxT("Total allocated size: %ld"), totalSize);
- wxLogDebug(wxT(""));
- wxLogDebug(wxT(""));
+ wxLogMessage(wxT("Number of object items: %ld"), noObjectNodes);
+ wxLogMessage(wxT("Number of non-object items: %ld"), noNonObjectNodes);
+ wxLogMessage(wxT("Total allocated size: %ld"), totalSize);
+ wxLogMessage(wxT(""));
+ wxLogMessage(wxT(""));
return TRUE;
#else
{
appNameStr = wxTheApp->GetAppName();
appName = WXSTRINGCAST appNameStr;
- wxLogDebug(wxT("----- Classes in %s -----"), appName);
+ wxLogMessage(wxT("----- Classes in %s -----"), appName);
}
}
if (info->GetConstructor())
msg += wxT(": dynamic");
- wxLogDebug(msg);
+ wxLogMessage(msg);
}
node = wxClassInfo::sm_classTable->Next();
n ++;
}
- wxLogDebug(wxT(""));
- wxLogDebug(wxT("There are %d classes derived from wxObject."), n);
- wxLogDebug(wxT(""));
- wxLogDebug(wxT(""));
+ wxLogMessage(wxT(""));
+ wxLogMessage(wxT("There are %d classes derived from wxObject."), n);
+ wxLogMessage(wxT(""));
+ wxLogMessage(wxT(""));
return TRUE;
}
wxDebugFree(pData, FALSE);
}
// New operator 21/11/1998
-void operator delete[](void* pData, char* /* fileName */, int /* lineNum */)
+void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */)
{
wxDebugFree(pData, TRUE);
}
int totSize = wxDebugContext::TotSize (size);
char * buf = (char *) malloc(totSize);
if (!buf) {
- wxLogDebug(wxT("Call to malloc (%ld) failed."), (long)size);
+ wxLogMessage(wxT("Call to malloc (%ld) failed."), (long)size);
return 0;
}
wxMemStruct * st = (wxMemStruct *)buf;
// Trace: send output to the current debugging stream
void wxTrace(const wxChar *fmt ...)
{
- va_list ap;
+#if 1
+ wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead."));
+#else
+ va_list ap;
static wxChar buffer[512];
va_start(ap, fmt);
#else
fprintf(stderr, buffer);
#endif
+#endif
}
// Trace with level
void wxTraceLevel(int level, const wxChar *fmt ...)
{
+#if 1
+ wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead."));
+#else
if (wxDebugContext::GetLevel() < level)
return;
va_start(ap, fmt);
#ifdef __WXMSW__
- wvsprintf(buffer,fmt,ap) ;
+ wxWvsprintf(buffer,fmt,ap) ;
#else
vsprintf(buffer,fmt,ap) ;
#endif
#else
fprintf(stderr, buffer);
#endif
+#endif
}
#else // wxUSE_MEMORY_TRACING && defined(__WXDEBUG__)