#include "wx/defs.h"
#endif
-#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
+#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
#ifdef __GNUG__
// #pragma implementation
#include <stdlib.h>
-#if USE_IOSTREAMH
+#if wxUSE_IOSTREAMH
#include <iostream.h>
+#include <fstream.h>
#else
#include <iostream>
+#include <fstream>
+# ifdef _MSC_VER
+ using namespace std;
+# endif
#endif
-#include <fstream.h>
#if !defined(__WATCOMC__) && !defined(__VMS__)
#include <memory.h>
#include "wx/memory.h"
-/*
#ifdef new
#undef new
#endif
-*/
// wxDebugContext wxTheDebugContext;
/*
{
wxObject *obj = (wxObject *)m_actualData;
wxClassInfo *info = obj->GetClassInfo();
-
+/*
if (info && info->GetClassName())
wxTrace("%s", info->GetClassName());
else
if (m_fileName)
wxTrace(" (%s %d)", m_fileName, (int)m_lineNum);
+ wxTrace(" at $%lX, size %d\n", (long)GetActualData(), (int)RequestSize());
+*/
+ // Let's put this in standard form so IDEs can load the file at the appropriate
+ // line
+ if (m_fileName)
+ wxTrace("%s(%d): ", m_fileName, (int)m_lineNum);
+
+ if (info && info->GetClassName())
+ wxTrace("%s", info->GetClassName());
+ else
+ wxTrace("object");
+
wxTrace(" at $%lX, size %d\n", (long)GetActualData(), (int)RequestSize());
}
else
{
- wxTrace("Non-object data");
if (m_fileName)
- wxTrace(" (%s %d)", m_fileName, (int)m_lineNum);
+ wxTrace("%s(%d): ", m_fileName, (int)m_lineNum);
+ wxTrace("non-object data");
wxTrace(" at $%lX, size %d\n", (long)GetActualData(), (int)RequestSize());
}
}
if (m_isObject)
{
wxObject *obj = (wxObject *)m_actualData;
-// wxClassInfo *info = obj->GetClassInfo();
if (m_fileName)
- wxTrace("Item (%s %d)", m_fileName, (int)m_lineNum);
- else
- wxTrace("Item");
+ wxTrace("%s(%d): ", m_fileName, (int)m_lineNum);
- wxTrace(" at $%lX, size %d: ", (long)GetActualData(), (int)RequestSize());
-// wxTrace(info->GetClassName());
obj->Dump(wxDebugContext::GetStream());
+ wxTrace(" at $%lX, size %d", (long)GetActualData(), (int)RequestSize());
wxTrace("\n");
}
else
{
- wxTrace("Non-object data");
if (m_fileName)
- wxTrace(" (%s %d)", m_fileName, (int)m_lineNum);
+ wxTrace("%s(%d): ", m_fileName, (int)m_lineNum);
+ wxTrace("non-object data");
wxTrace(" at $%lX, size %d\n", (long)GetActualData(), (int)RequestSize());
}
}
{
appNameStr = wxTheApp->GetAppName();
appName = (char*) (const char*) appNameStr;
- wxTrace("Memory dump of %s at %s:\n", appName, WXSTRINGCAST wxNow() );
+ wxTrace("----- Memory dump of %s at %s -----\n", appName, WXSTRINGCAST wxNow() );
+ }
+ else
+ {
+ wxTrace( "----- Memory dump -----\n" );
}
}
TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL));
+
+ wxTrace( "\n\n" );
return TRUE;
#else
if (!HasStream())
return FALSE;
+ if (TRUE)
+ {
+ char* appName = "application";
+ wxString appNameStr("");
+ if (wxTheApp)
+ {
+ appNameStr = wxTheApp->GetAppName();
+ appName = (char*) (const char*) appNameStr;
+ wxTrace("----- Memory statistics of %s at %s -----\n", appName, WXSTRINGCAST wxNow() );
+ }
+ else
+ {
+ wxTrace( "----- Memory statistics -----\n" );
+ }
+ }
+
bool currentMode = GetDebugMode();
SetDebugMode(FALSE);
wxTrace("Number of object items: %ld\n", noObjectNodes);
wxTrace("Number of non-object items: %ld\n", noNonObjectNodes);
wxTrace("Total allocated size: %ld\n", totalSize);
+ wxTrace("\n\n");
return TRUE;
#else
{
appNameStr = wxTheApp->GetAppName();
appName = (char*) (const char*) appNameStr;
- wxTrace("Classes in %s:\n\n", appName);
+ wxTrace("----- Classes in %s -----\n", appName);
}
}
int n = 0;
- wxClassInfo *info = wxClassInfo::first;
- while (info)
+ wxNode *node;
+ wxClassInfo *info;
+
+ wxClassInfo::sm_classTable->BeginFind();
+ node = wxClassInfo::sm_classTable->Next();
+ while (node)
{
+ info = (wxClassInfo *)node->Data();
if (info->GetClassName())
{
wxTrace("%s ", info->GetClassName());
wxTrace("is a %s", info->GetBaseClassName1());
else if (info->GetBaseClassName1() && info->GetBaseClassName2())
wxTrace("is a %s, %s", info->GetBaseClassName1(), info->GetBaseClassName2());
- if (info->objectConstructor)
+ if (info->GetConstructor())
wxTrace(": dynamic\n");
else
wxTrace("\n");
}
- info = info->next;
+ node = wxClassInfo::sm_classTable->Next();
n ++;
}
- wxTrace("\nThere are %d classes derived from wxObject.\n", n);
+ wxTrace("\nThere are %d classes derived from wxObject.\n\n\n", n);
return TRUE;
}
// We'll only do malloc and free for the moment: leave the interesting
// stuff for the wxObject versions.
-#if WXDEBUG && USE_GLOBAL_MEMORY_OPERATORS
+#if WXDEBUG && wxUSE_GLOBAL_MEMORY_OPERATORS
#ifdef new
#undef new
#endif
}
-#if !( defined (_MSC_VER) && (_MSC_VER <= 1000) )
+#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) )
void * operator new[] (size_t size, char * fileName, int lineNum)
{
#ifdef NO_DEBUG_ALLOCATION
#endif
}
-#if !( defined (_MSC_VER) && (_MSC_VER <= 1000) )
+// VC++ 6.0
+#if _MSC_VER >= 1200
+void operator delete(void* pData, char* /* fileName */, int /* lineNum */)
+{
+ ::operator delete(pData);
+}
+#endif
+
+#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) )
void operator delete[] (void * buf)
{
#ifdef NO_DEBUG_ALLOCATION
#endif
}
-#else // USE_MEMORY_TRACING && WXDEBUG
+#else // wxUSE_MEMORY_TRACING && WXDEBUG
void wxTrace(const char *WXUNUSED(fmt) ...)
{
}