Debug-only logging code to track down bug 469514.

r=ted
This commit is contained in:
Shawn Wilsher 2009-04-21 11:32:07 -04:00
Родитель bf7dd1c3fd
Коммит 3ff1abe44a
2 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -98,6 +98,11 @@ public:
mTarget->Dispatch(this, NS_DISPATCH_NORMAL);
if (NS_FAILED(rv)) {
NS_WARNING("Dispatch failed");
#ifdef DEBUG
(void)fprintf(stdout,
"### mTarget (%p) may not be accepting events!\n",
mTarget);
#endif
return NS_ERROR_FAILURE;
}
@ -177,6 +182,11 @@ public:
mTarget->Dispatch(this, NS_DISPATCH_NORMAL);
if (NS_FAILED(rv)) {
NS_WARNING("PostEvent failed");
#ifdef DEBUG
(void)fprintf(stdout,
"### mTarget (%p) may not be accepting events!\n",
mTarget);
#endif
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -43,6 +43,21 @@
#include "nsAutoPtr.h"
#include "nsAutoLock.h"
#ifdef DEBUG
#include "nsStackWalk.h"
static void
thread_stack_callback(void *aPC, void *)
{
char buf[1024];
nsCodeAddressDetails details;
(void)NS_DescribeCodeAddress(aPC, &details);
(void)NS_FormatCodeAddressDetails(aPC, &details, buf, sizeof(buf));
(void)fprintf(stdout, buf);
}
#endif
typedef nsTArray< nsRefPtr<nsThread> > nsThreadArray;
//-----------------------------------------------------------------------------
@ -232,6 +247,11 @@ nsThreadManager::NewThread(PRUint32 creationFlags, nsIThread **result)
// At this point, we expect that the thread has been registered in mThread;
// however, it is possible that it could have also been replaced by now, so
// we cannot really assert that it was added.
#ifdef DEBUG
(void)fprintf(stdout, "### Creating thread with address %p\n", thr);
(void)NS_StackWalk(thread_stack_callback, 0, nsnull);
(void)fprintf(stdout, "\n\n");
#endif
*result = thr;
return NS_OK;