Bug 306334 - XULRunner debug doesn't link on mac r=darin/brendan

This commit is contained in:
bsmedberg%covad.net 2005-08-31 17:20:09 +00:00
parent 5befaddbbf
commit 3e2adc9538
7 changed files with 52 additions and 54 deletions

View File

@ -9,7 +9,7 @@ s/jsbit\.h/prbit.h/
s/jsdhash\.h/pldhash.h/ s/jsdhash\.h/pldhash.h/
s/jsdhash\.c/pldhash.c/ s/jsdhash\.c/pldhash.c/
s/jsdhash:/pldhash:/ s/jsdhash:/pldhash:/
s/jsutil\.h/prlog.h/ s/jsutil\.h/nsDebug.h/
s/JS_DHASH/PL_DHASH/g s/JS_DHASH/PL_DHASH/g
s/JS_DHash/PL_DHash/g s/JS_DHash/PL_DHash/g
s/JSDHash/PLDHash/g s/JSDHash/PLDHash/g
@ -28,4 +28,5 @@ s/JS_PUBLIC_API(\([^()]*\))/\1/
s/JS_DLL_CALLBACK/PR_CALLBACK/ s/JS_DLL_CALLBACK/PR_CALLBACK/
s/JS_STATIC_DLL_CALLBACK/PR_STATIC_CALLBACK/ s/JS_STATIC_DLL_CALLBACK/PR_STATIC_CALLBACK/
s/JS_NewDHashTable/PL_NewDHashTable/ s/JS_NewDHashTable/PL_NewDHashTable/
s/JS_ASSERT(\(.*\));/NS_ASSERTION(\1, "PLDHash precondition");/
s/JS_/PR_/g s/JS_/PR_/g

View File

@ -181,7 +181,7 @@ private:
#define NS_BOX_ASSERTION(box,expr,str) \ #define NS_BOX_ASSERTION(box,expr,str) \
if (!(expr)) { \ if (!(expr)) { \
box->DumpBox(stdout); \ box->DumpBox(stdout); \
nsDebug::Assertion(str, #expr, __FILE__, __LINE__); \ NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} }
#else #else
#define NS_BOX_ASSERTION(box,expr,str) {} #define NS_BOX_ASSERTION(box,expr,str) {}

View File

@ -244,7 +244,7 @@ nsDebugImpl::Assertion(const char *aStr, const char *aExpr, const char *aFile, P
"Click Enter to continue running the Application.", buf); "Click Enter to continue running the Application.", buf);
ULONG code = MBID_ERROR; ULONG code = MBID_ERROR;
code = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, msg, code = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, msg,
"nsDebug::Assertion", 0, "NSGlue_Assertion", 0,
MB_ERROR | MB_ENTERCANCEL); MB_ERROR | MB_ENTERCANCEL);
/* It is possible that we are executing on a thread that doesn't have a /* It is possible that we are executing on a thread that doesn't have a

View File

@ -75,7 +75,7 @@ void GlueShutdownDebug()
} }
#endif #endif
NS_COM_GLUE void nsDebug::Abort(const char* aFile, PRIntn aLine) void NSGlue_Abort(const char* aFile, PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)
return; return;
@ -83,7 +83,7 @@ NS_COM_GLUE void nsDebug::Abort(const char* aFile, PRIntn aLine)
gDebugObject->Abort(aFile, aLine); gDebugObject->Abort(aFile, aLine);
} }
NS_COM_GLUE void nsDebug::Break(const char* aFile, PRIntn aLine) void NSGlue_Break(const char* aFile, PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)
return; return;
@ -91,17 +91,15 @@ NS_COM_GLUE void nsDebug::Break(const char* aFile, PRIntn aLine)
gDebugObject->Break(aFile, aLine); gDebugObject->Break(aFile, aLine);
} }
NS_COM_GLUE void nsDebug::Warning(const char* aStr, void NSGlue_Warning(const char* aStr, const char* aFile, PRIntn aLine)
const char* aFile,
PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)
return; return;
gDebugObject->Warning(aStr, aFile, aLine); gDebugObject->Warning(aStr, aFile, aLine);
} }
NS_COM_GLUE void nsDebug::Assertion(const char* aStr, const char* aExpr, void NSGlue_Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine) const char* aFile, PRIntn aLine)
{ {
if (!ENSURE_DEBUGOBJECT) if (!ENSURE_DEBUGOBJECT)
return; return;

View File

@ -56,34 +56,34 @@
* conditionally compiled out. * conditionally compiled out.
*/ */
/* in case this is included by a C file */ PR_BEGIN_EXTERN_C
#ifdef __cplusplus
class nsDebug { /**
public: * Log a warning message to the debug log.
*/
NS_COM_GLUE NS_HIDDEN_(void) NS_FASTCALL
NSGlue_Warning(const char *aMessage, const char *aFile, PRIntn aLine);
/** /**
* Log a warning message to the debug log. * Abort the executing program. This works on all architectures.
*/ */
static NS_COM_GLUE void Warning(const char* aMessage, NS_COM_GLUE NS_HIDDEN_(void) NS_FASTCALL
const char* aFile, PRIntn aLine); NSGlue_Abort(const char *aFile, PRIntn aLine);
/** /**
* Abort the executing program. This works on all architectures. * Break the executing program into the debugger.
*/ */
static NS_COM_GLUE void Abort(const char* aFile, PRIntn aLine); NS_COM_GLUE NS_HIDDEN_(void) NS_FASTCALL
NSGlue_Break(const char* aFile, PRIntn aLine);
/** /**
* Break the executing program into the debugger. * Log an assertion message to the debug log
*/ */
static NS_COM_GLUE void Break(const char* aFile, PRIntn aLine); NS_COM_GLUE NS_HIDDEN_(void) NS_FASTCALL
NSGlue_Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine);
/** PR_END_EXTERN_C
* Log an assertion message to the debug log
*/
static NS_COM_GLUE void Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine);
};
#ifdef DEBUG #ifdef DEBUG
@ -106,7 +106,7 @@ public:
#define NS_ABORT_IF_FALSE(_expr, _msg) \ #define NS_ABORT_IF_FALSE(_expr, _msg) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
if (!(_expr)) { \ if (!(_expr)) { \
nsDebug::Assertion(_msg, #_expr, __FILE__, __LINE__); \ NSGlue_Assertion(_msg, #_expr, __FILE__, __LINE__); \
} \ } \
PR_END_MACRO PR_END_MACRO
@ -121,7 +121,7 @@ public:
#define NS_WARN_IF_FALSE(_expr,_msg) \ #define NS_WARN_IF_FALSE(_expr,_msg) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
if (!(_expr)) { \ if (!(_expr)) { \
nsDebug::Assertion(_msg, #_expr, __FILE__, __LINE__); \ NSGlue_Assertion(_msg, #_expr, __FILE__, __LINE__); \
} \ } \
PR_END_MACRO PR_END_MACRO
@ -132,7 +132,7 @@ public:
#define NS_PRECONDITION(expr, str) \ #define NS_PRECONDITION(expr, str) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
if (!(expr)) { \ if (!(expr)) { \
nsDebug::Assertion(str, #expr, __FILE__, __LINE__); \ NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} \ } \
PR_END_MACRO PR_END_MACRO
@ -143,7 +143,7 @@ public:
#define NS_ASSERTION(expr, str) \ #define NS_ASSERTION(expr, str) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
if (!(expr)) { \ if (!(expr)) { \
nsDebug::Assertion(str, #expr, __FILE__, __LINE__); \ NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} \ } \
PR_END_MACRO PR_END_MACRO
@ -154,7 +154,7 @@ public:
#define NS_POSTCONDITION(expr, str) \ #define NS_POSTCONDITION(expr, str) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
if (!(expr)) { \ if (!(expr)) { \
nsDebug::Assertion(str, #expr, __FILE__, __LINE__); \ NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} \ } \
PR_END_MACRO PR_END_MACRO
@ -163,38 +163,38 @@ public:
* an attempt was made to execute some unimplemented functionality. * an attempt was made to execute some unimplemented functionality.
*/ */
#define NS_NOTYETIMPLEMENTED(str) \ #define NS_NOTYETIMPLEMENTED(str) \
nsDebug::Assertion(str, "NotYetImplemented", __FILE__, __LINE__) NSGlue_Assertion(str, "NotYetImplemented", __FILE__, __LINE__)
/** /**
* This macros triggers a program failure if executed. It indicates that * This macros triggers a program failure if executed. It indicates that
* an attempt was made to execute some unimplemented functionality. * an attempt was made to execute some unimplemented functionality.
*/ */
#define NS_NOTREACHED(str) \ #define NS_NOTREACHED(str) \
nsDebug::Assertion(str, "Not Reached", __FILE__, __LINE__) NSGlue_Assertion(str, "Not Reached", __FILE__, __LINE__)
/** /**
* Log an error message. * Log an error message.
*/ */
#define NS_ERROR(str) \ #define NS_ERROR(str) \
nsDebug::Assertion(str, "Error", __FILE__, __LINE__) NSGlue_Assertion(str, "Error", __FILE__, __LINE__)
/** /**
* Log a warning message. * Log a warning message.
*/ */
#define NS_WARNING(str) \ #define NS_WARNING(str) \
nsDebug::Warning(str, __FILE__, __LINE__) NSGlue_Warning(str, __FILE__, __LINE__)
/** /**
* Trigger an abort * Trigger an abort
*/ */
#define NS_ABORT() \ #define NS_ABORT() \
nsDebug::Abort(__FILE__, __LINE__) NSGlue_Abort(__FILE__, __LINE__)
/** /**
* Cause a break * Cause a break
*/ */
#define NS_BREAK() \ #define NS_BREAK() \
nsDebug::Break(__FILE__, __LINE__) NSGlue_Break(__FILE__, __LINE__)
#else /* NS_DEBUG */ #else /* NS_DEBUG */
@ -215,7 +215,6 @@ public:
#define NS_BREAK() PR_BEGIN_MACRO /* nothing */ PR_END_MACRO #define NS_BREAK() PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#endif /* ! NS_DEBUG */ #endif /* ! NS_DEBUG */
#endif /* __cplusplus */
// Macros for checking the trueness of an expression passed in within an // Macros for checking the trueness of an expression passed in within an
// interface implementation. These need to be compiled regardless of the // interface implementation. These need to be compiled regardless of the

View File

@ -46,7 +46,7 @@
#include <string.h> #include <string.h>
#include "prbit.h" #include "prbit.h"
#include "pldhash.h" #include "pldhash.h"
#include "prlog.h" /* for PR_ASSERT */ #include "nsDebug.h" /* for PR_ASSERT */
#ifdef PL_DHASHMETER #ifdef PL_DHASHMETER
# if defined MOZILLA_CLIENT && defined DEBUG_XXXbrendan # if defined MOZILLA_CLIENT && defined DEBUG_XXXbrendan
@ -247,7 +247,7 @@ PL_DHashTableSetAlphaBounds(PLDHashTable *table,
* Reject obviously insane bounds, rather than trying to guess what the * Reject obviously insane bounds, rather than trying to guess what the
* buggy caller intended. * buggy caller intended.
*/ */
PR_ASSERT(0.5 <= maxAlpha && maxAlpha < 1 && 0 <= minAlpha); NS_ASSERTION(0.5 <= maxAlpha && maxAlpha < 1 && 0 <= minAlpha, "PLDHash precondition");
if (maxAlpha < 0.5 || 1 <= maxAlpha || minAlpha < 0) if (maxAlpha < 0.5 || 1 <= maxAlpha || minAlpha < 0)
return; return;
@ -256,7 +256,7 @@ PL_DHashTableSetAlphaBounds(PLDHashTable *table,
* minimum size leaves no entries free, reduce maxAlpha based on minimum * minimum size leaves no entries free, reduce maxAlpha based on minimum
* size and the precision limit of maxAlphaFrac's fixed point format. * size and the precision limit of maxAlphaFrac's fixed point format.
*/ */
PR_ASSERT(PL_DHASH_MIN_SIZE - (maxAlpha * PL_DHASH_MIN_SIZE) >= 1); NS_ASSERTION(PL_DHASH_MIN_SIZE - (maxAlpha * PL_DHASH_MIN_SIZE) >= 1, "PLDHash precondition");
if (PL_DHASH_MIN_SIZE - (maxAlpha * PL_DHASH_MIN_SIZE) < 1) { if (PL_DHASH_MIN_SIZE - (maxAlpha * PL_DHASH_MIN_SIZE) < 1) {
maxAlpha = (float) maxAlpha = (float)
(PL_DHASH_MIN_SIZE - PR_MAX(PL_DHASH_MIN_SIZE / 256, 1)) (PL_DHASH_MIN_SIZE - PR_MAX(PL_DHASH_MIN_SIZE / 256, 1))
@ -268,7 +268,7 @@ PL_DHashTableSetAlphaBounds(PLDHashTable *table,
* not to truncate an entry's worth of alpha when storing in minAlphaFrac * not to truncate an entry's worth of alpha when storing in minAlphaFrac
* (8-bit fixed point format). * (8-bit fixed point format).
*/ */
PR_ASSERT(minAlpha < maxAlpha / 2); NS_ASSERTION(minAlpha < maxAlpha / 2, "PLDHash precondition");
if (minAlpha >= maxAlpha / 2) { if (minAlpha >= maxAlpha / 2) {
size = PL_DHASH_TABLE_SIZE(table); size = PL_DHASH_TABLE_SIZE(table);
minAlpha = (size * maxAlpha - PR_MAX(size / 256, 1)) / (2 * size); minAlpha = (size * maxAlpha - PR_MAX(size / 256, 1)) / (2 * size);
@ -362,7 +362,7 @@ SearchTable(PLDHashTable *table, const void *key, PLDHashNumber keyHash,
PRUint32 sizeMask; PRUint32 sizeMask;
METER(table->stats.searches++); METER(table->stats.searches++);
PR_ASSERT(!(keyHash & COLLISION_FLAG)); NS_ASSERTION(!(keyHash & COLLISION_FLAG), "PLDHash precondition");
/* Compute the primary hash address. */ /* Compute the primary hash address. */
hashShift = table->hashShift; hashShift = table->hashShift;
@ -470,7 +470,7 @@ ChangeTable(PLDHashTable *table, int deltaLog2)
oldEntry->keyHash &= ~COLLISION_FLAG; oldEntry->keyHash &= ~COLLISION_FLAG;
newEntry = SearchTable(table, getKey(table, oldEntry), newEntry = SearchTable(table, getKey(table, oldEntry),
oldEntry->keyHash, PL_DHASH_ADD); oldEntry->keyHash, PL_DHASH_ADD);
PR_ASSERT(PL_DHASH_ENTRY_IS_FREE(newEntry)); NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(newEntry), "PLDHash precondition");
moveEntry(table, oldEntry, newEntry); moveEntry(table, oldEntry, newEntry);
newEntry->keyHash = oldEntry->keyHash; newEntry->keyHash = oldEntry->keyHash;
} }
@ -575,7 +575,7 @@ PL_DHashTableOperate(PLDHashTable *table, const void *key, PLDHashOperator op)
break; break;
default: default:
PR_ASSERT(0); NS_ASSERTION(0, "PLDHash precondition");
entry = NULL; entry = NULL;
} }
@ -587,7 +587,7 @@ PL_DHashTableRawRemove(PLDHashTable *table, PLDHashEntryHdr *entry)
{ {
PLDHashNumber keyHash; /* load first in case clearEntry goofs it */ PLDHashNumber keyHash; /* load first in case clearEntry goofs it */
PR_ASSERT(PL_DHASH_ENTRY_IS_LIVE(entry)); NS_ASSERTION(PL_DHASH_ENTRY_IS_LIVE(entry), "PLDHash precondition");
keyHash = entry->keyHash; keyHash = entry->keyHash;
table->ops->clearEntry(table, entry); table->ops->clearEntry(table, entry);
if (keyHash & COLLISION_FLAG) { if (keyHash & COLLISION_FLAG) {

View File

@ -85,7 +85,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
"Click Ignore to continue running the Application.", "Click Ignore to continue running the Application.",
lpszCmdLine); lpszCmdLine);
return MessageBox(NULL, msg, "nsDebug::Assertion", return MessageBox(NULL, msg, "NSGlue_Assertion",
MB_ICONSTOP | MB_SYSTEMMODAL| MB_ICONSTOP | MB_SYSTEMMODAL|
MB_ABORTRETRYIGNORE | MB_DEFBUTTON3); MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
} }